Welcome to the new and improved Native Instruments online community. Join our active forum of 40,000+ members for discussions and much more.

QML Modifications. On today's menu: Double-Tap buttons.

Sûlherokhh
Sûlherokhh Member Posts: 538 Guru

Inspired by Patch & dj_estrela, i decided to publish the basic code i used for all my double-tap modifications i've done. Hopefully you can implement it if you need something like this. The button distinguishes between a single tap (function call in the first timer) and a double tap (function call in the ButtonScriptAdapter) that interrupts the first timer before it has run out of time and made it's call.

ButtonScriptAdapter {
 name: "BUTTON"
 onPress: {
   if (holdButton_countdown.running) {
     tapButton_countdown.stop()
     holdButton_countdown.stop()
     // PLACE DOUBLE-TAP FUNCTION HERE
   }
   else holdButton_countdown.restart()
 }
 onRelease: {
   if (holdButton_countdown.running) tapButton_countdown.restart()
 }
}

Timer { id: holdButton_countdown; interval: 250
 onTriggered: {
   if (tapButton_countdown.running) {
     // PLACE SINGLE-TAP FUNCTION HERE
   }
 }
}

Timer { id: tapButton_countdown; interval: 250 }

Wire { from: "%surface%.controllerButton"; to: "BUTTON" }

🦋

P.S: onTriggered executes when the timer reaches ZERO and doesn't execute if it gets stopped prematurely.

Back To Top