I think I may have discovered some strange behavior with the sample.loop_end and .loop_start fields. Here’s what I did:
- Load a sound, set a loop only 1 sample long.
- Execute this code:
local function loop_endpoints_changed() local samp = renoise.song().selected_sample print("Loop start: " .. samp.loop_start .. " Loop end: " .. samp.loop_end) end renoise.song().selected_sample.loop_start_observable:add_notifier(loop_endpoints_changed) renoise.song().selected_sample.loop_end_observable:add_notifier(loop_endpoints_changed)
- In the sample editor, drag the loop end marker to the left.
- I get this in the terminal:
Loop start: 200 Loop end: 199 Loop start: 200 Loop end: 200 Loop start: 200 Loop end: 199 Loop start: 200 Loop end: 200 Loop start: 200 Loop end: 199 Loop start: 200 Loop end: 200 ...
Every time I move the mouse another pixel to the left while dragging, another two of those lines come out in the terminal.
I think it’s odd that sample.loop_end is ever less than sample.loop_start, as its (loop_end’s) value usually indicates the index of the last sample in the loop; of course, it corrects itself (hence the “Loop start: 200 Loop end: 200” lines), but this sort of behavior could be difficult for a script to deal with, e.g. if it had a notifier on loop_start_observable or loop_end_observable. Also note that this behavior only occurs when dragging the loop end marker past the loop start marker, not the other way around. Dragging the loop start marker past the loop end marker does not trigger any notifications on loop_start_observable - even if this isn’t considered a bug, it’s inconsistent like that.