Audiobus: Use your music apps together.

What is Audiobus?Audiobus is an award-winning music app for iPhone and iPad which lets you use your other music apps together. Chain effects on your favourite synth, run the output of apps or Audio Units into an app like GarageBand or Loopy, or select a different audio interface output for each app. Route MIDI between apps — drive a synth from a MIDI sequencer, or add an arpeggiator to your MIDI keyboard — or sync with your external MIDI gear. And control your entire setup from a MIDI controller.

Download on the App Store

Audiobus is the app that makes the rest of your setup better.

double tap, long tap detection?

here's another one:)
now that i got my fader working, i want to add double tap and long tap functionality to that fader.
how is that accomplished correctly?

i have 3 user events to listen to:
mouse_down
mouse_up
mouse_move

and i have a timer (milliseconds)
timer(n)

pseudocode:

mouse_down = 0
mouse_up = 1
mouse_move = 0
double_tap = 0

td = 0
tu = 0
start_timer(1) // from 0

on mouse_down // first event
td = get_timer(1) // say 5000
if td - tu < 250 // not correct! somehow got stuck here:)
double_tap = 1
mouse_move = 0
else
double_tap = 0
mouse_move = 1

on mouse_up
tu = get_timer(1) //say 6000
start timer()

Comments

  • No parentheses around (td-tu)?

    I'm not sure if this applies, but you need to be very careful with subtraction if using "unsigned" variables, since any possible negative result will be treated as a very large value.

  • edited July 2022

    @uncledave said:
    No parentheses around (td-tu)?

    I'm not sure if this applies, but you need to be very careful with subtraction if using "unsigned" variables, since any possible negative result will be treated as a very large value.

    thanks for the hint @uncledave
    but the above is just kind of "pseudocode"

  • What's the context and environment?

    In general, this is kinda complex to handle. You may need to deal with cancelling single taps that have already been detected so that you don't add latency to the single tap. You'll probably want to add the ability to cancel the long press if the user drags out of the control or more than a certain distance during the hold part of the gesture. Since you are doing this in your fader, you may need to threshold the amount movement you allow before you start considering the long press as a tap-and-drag.

    Accessibility is an important consideration too. For example, having a way to set the timing thresholds for double tap recognition can be really important. The builtin gestures on iOS tie directly into the system accessibility settings and are convenient for users. If you need to do the recognition yourself, there's an API for getting the system values to use.

  • What does stuck mean? Some things to consider…

    Movement never is a result of up/down testing.

    Double-click depends on the delta between mouse down events not an up/down pair. Press-hold-release-quickly-re-press is not a double-click.

    The two mouse down events need to occur reasonably near each other in space as well as time.

    Most systems have a function that returns the current time in milliseconds. Not sure why you wouldn’t use that rather than a timer.

    Related… the timer code seems off. You’re restarting the timer on every mouse up and you’re subtracting the timers as if they were millisecond values. So you’re subtracting the time between two ups from the time between up/down.

Sign In or Register to comment.