try putting the following into your GlobalMidiActions.lua, located into the “Scripts” folder (at the end of the file is fine)
-- BEGIN: moving loop markers with MIDI actions
add_action("Selected Sample:Set Loop markers to 1/4th of sample [Trigger]",
function(message)
local sample = song().selected_sample;
local int_frames = sample.sample_buffer.number_of_frames;
local int_message = message.int_value + 1;
if message:is_trigger() then
local int_end_new = int_frames * .25;
sample.loop_start = 1;
sample.loop_end = int_frames * .25;
end
end)
add_action("Selected Sample:Set Loop markers to 2/4th of sample [Trigger]",
function(message)
local sample = song().selected_sample;
local int_frames = sample.sample_buffer.number_of_frames;
local int_message = message.int_value + 1;
if message:is_trigger() then
local int_end_new = int_frames * .5;
if int_end_new < sample.loop_start then
sample.loop_start = int_frames*.25+1;
sample.loop_end = int_frames * .5;
else
sample.loop_end = int_frames * .5;
sample.loop_start = int_frames*.25+1;
end
end
end)
add_action("Selected Sample:Set Loop markers to 3/4th of sample [Trigger]",
function(message)
local sample = song().selected_sample;
local int_frames = sample.sample_buffer.number_of_frames;
local int_message = message.int_value + 1;
if message:is_trigger() then
local int_end_new = int_frames * .75;
if int_end_new < sample.loop_start then
sample.loop_start = int_frames*.5+1;
sample.loop_end = int_frames * .75;
else
sample.loop_end = int_frames * .75;
sample.loop_start = int_frames*.5+1;
end
end
end)
add_action("Selected Sample:Set Loop markers to 4/4th of sample [Trigger]",
function(message)
local sample = song().selected_sample;
local int_frames = sample.sample_buffer.number_of_frames;
local int_message = message.int_value + 1;
if message:is_trigger() then
sample.loop_end = int_frames;
sample.loop_start = int_frames*.75+1;
end
end)
-- BEGIN: moving loop markers with MIDI actions
this will create four new mappable MIDI actions:
Selected Sample => Set Loop markers to 1/4th of sample [Trigger]
Selected Sample => Set Loop markers to 2/4th of sample [Trigger]
Selected Sample => Set Loop markers to 3/4th of sample [Trigger]
Selected Sample => Set Loop markers to 4/4th of sample [Trigger]
assigning them to MIDI controls will change the current sample loop markers to quarters of the sample data