Switching Loop recognition on/off while sample plays

Alex posted Sep 30 '18, 18:30:

Hello together,
Is it possible to implement a function to turn loop marker recognition on and off during playback of a sample (for example Midi CC0-63 is on and CC64-127 is off)? Usecase would be backing tracks which can be looped at predefined positions for improvisations and then turned off to ignore loop markers and run the sample to the end.

Greetings Alex

HansEhv posted Sep 30 '18, 22:19:

Interesting question.
For turning it off while playing, the looppos field of the Sound instance in the applicable playingsounds table needs to be set to -1. Not trivial, but seems doable.
As samplerbox currently only supports 1 loop per WAV, it's useless to turn it on again.
Next playing of the note/track will set the original loopmarker again by default (I assume...otherwise an extra field is needed)
Above is "behind my desk", so untested for now = no guarantee :-)

Alex posted Sep 30 '18, 22:49:

Thank you.
Since such "impro-parts" are most likely only one per song this 1-per-wav-limitation should be no problem. Also that the looping will be activated on default is also acceptable. Nice would be a possibility of general deactivation of loop markers, because you won't always want to play a impro part;-). Do you think the playback modes in your fork could help here?

HansEhv posted Sep 30 '18, 23:22:

No problem. Like I said: interesting, I can use this too.
At the cost of an extra note definition yes: define the same wav with another loopmode.
So it's a trade-off: having extra notes defined or having to press the loop-off button after starting the track. But we're not there yet, this loop-off logic has to be created first :-)


  (not published)
  I want to post as guest