Hiya. I was doing some random grepping along the documentation, and got these;
renoise.song().instruments.samples.loop_mode, _observable
renoise.song().instruments.samples.loop_release, _observable
renoise.song().instruments.samples.loop_start, _observable
renoise.song().instruments.samples.loop_end, _observable
Am I to understand that the loop_mode of a sample can be changed via LUA? or that one can LUA script sample loop_start & end lengths, etc? Or?
Okay, I got this going now:
renoise.song().selected_sample.loop_mode = renoise.Sample.LOOP_MODE_OFF
renoise.song().selected_sample.loop_mode = renoise.Sample.LOOP_MODE_REVERSE
renoise.song().selected_sample.loop_mode = renoise.Sample.LOOP_MODE_PING_PONG
For some reason, loop_mode_forward just doesn’t want to work, which is weird!
Set a loop to forward and then query that samples loop value via the lua console. Maybe things will clarify. I would guess that the constants are 0,1,2,3.
This switches between sample loop mode “off” and “forward”
function toggle_sample_looping()
local loop_mode = renoise.song().selected_sample.loop_mode
if loop_mode == 1 then
loop_mode =2
else
loop_mode = 1
end
renoise.song().selected_sample.loop_mode = loop_mode
end
Ok, made a little keybind which tries to think in mathematical terms. LoopTest
function selsamploop()
local selsamp = renoise.song().selected_sample
if selsamp.loop_end <200 then
selsamp.loop_end = renoise.song().selected_sample.sample_buffer.number_of_frames
else
if selsamp.loop_end >3000 then
selsamp.loop_end = selsamp.loop_end - 1000
else selsamp.loop_end = selsamp.loop_end -100
end
end
end
If anyone has any suggestions as to how to handle samples of different sizes mathematically so that this kind of loop-setting and re-setting and “closer to sample_start starts increasing resolution” makes more sense, please suggest.
edit: Well, added one more thing, every second press on the keybind will switch from pingpong to forward loop. Just mucking about, really. (didn’t add it to the code, cos why?)
edit: v0.39 Impulsecomplex has cycle off-forward-backward-pingpong and pingpong-backward-forward-off shortcuts and set-off, set-forward, set-backward, set-pingpong shortcuts.