Midi loop_start / loop_end

ZeroValue's icon

Hi,
I'm making a midi device, that set the loop_start and loop_end of a selected midi clip.


Most of the time it works fine but sometimes I have an issue and error in the max console :

live.object: Cannot set LoopStart behind LoopEnd
live.object: Changes cannot be triggered by notifications. You will need to defer your response.

I understood that I need to defer low the loop_start while increasing the start position to avoid that the loop end get behind the start position.

What does I need to improve ?

Max Patch
Copy patch and select New From Clipboard in Max.

TFL's icon

You cannot set loop_start behind loop_end AND you cannot set loop_end in front of loop_start, which means the order in which you define loop_start and loop_end depends on if the new loop is before or after the previous one.

Also, [defer] is enough to avoid the second error message. [deferlow] can mess with timing too much.

Max Patch
Copy patch and select New From Clipboard in Max.

ZeroValue's icon

Thank you TFL

I was working on the comparison method for the before / after.
I would have struggle to find the solution for the [defer] method.

ZeroValue's icon

Sometimes it doesn't set the start loop / end correctly.

But I’m not able to reproduce the issue
it's not a 100%

ZeroValue's icon

I think I found where the problem came from. I added a message {start_marker} to set an identical start time for both the loop and the start.