Lua 'move_slice_marker' Updates Notes Incorrectly

Start a new song, load a sample into the initial slot, make sure both Drumkit options are disabled and the ‘from’ note is set to B-3, then run this:

renoise.song():pattern(1):track(1):line(1):note_column(1).note_string = "C-4"
renoise.song():pattern(1):track(1):line(1):note_column(1).instrument_value = 00
renoise.song():instrument(1):insert_phrase_at(1)
renoise.song().selected_phrase_index = 1
renoise.song():instrument(1):sample(1):insert_slice_marker(100)
renoise.song():instrument(1):sample(1):insert_slice_marker(200)
renoise.song():instrument(1):sample(1):insert_slice_marker(300)
renoise.song():instrument(1):sample(1):move_slice_marker(100, 101)

Now take a look at the Pattern Editor and the Phrase Editor. Both notes that were C-4 (one was automatically inserted into the new phrase) have been changed to D-4. Nothing is supposed to happen in this situation and when you manually recreate it that’s precisely the case. It seems like it thinks that it’s moved the marker behind or before another - changing the slice order - and is making incorrect adjustments.

Interestingly, if the sample column in the Phrase Editor is enabled before the ‘move_slice_marker’ is run, then the notes there are preserved, but the Pattern Editor is still affected either way. Edit - I think the phrase notes are still being edited in this situation even if they appear the same, because sample playback stops. Playback only stops when moving markers manually if slices change order.

Here’s a more thorough test:

renoise.song():pattern(1):track(1):line(1):note_column(1).note_string = "C-4"
renoise.song():pattern(1):track(1):line(2):note_column(1).note_string = "C#4"
renoise.song():pattern(1):track(1):line(3):note_column(1).note_string = "D-4"
renoise.song():pattern(1):track(1):line(4):note_column(1).note_string = "D#4"
renoise.song():pattern(1):track(1):line(1):note_column(1).instrument_value = 00
renoise.song():pattern(1):track(1):line(2):note_column(1).instrument_value = 00
renoise.song():pattern(1):track(1):line(3):note_column(1).instrument_value = 00
renoise.song():pattern(1):track(1):line(4):note_column(1).instrument_value = 00
renoise.song():instrument(1):insert_phrase_at(1)
renoise.song().selected_phrase_index = 1
renoise.song():instrument(1):phrase(1).instrument_column_visible = true
renoise.song():instrument(1):phrase(1):line(1):note_column(1).note_string = "C-4"
renoise.song():instrument(1):phrase(1):line(2):note_column(1).note_string = "C#4"
renoise.song():instrument(1):phrase(1):line(3):note_column(1).note_string = "D-4"
renoise.song():instrument(1):phrase(1):line(4):note_column(1).note_string = "D#4"
renoise.song():instrument(1):phrase(1):line(1):note_column(1).instrument_value = 00
renoise.song():instrument(1):phrase(1):line(2):note_column(1).instrument_value = 00
renoise.song():instrument(1):phrase(1):line(3):note_column(1).instrument_value = 00
renoise.song():instrument(1):phrase(1):line(4):note_column(1).instrument_value = 00
renoise.song():instrument(1):sample(1):insert_slice_marker(100)
renoise.song():instrument(1):sample(1):insert_slice_marker(200)
renoise.song():instrument(1):sample(1):insert_slice_marker(300)
renoise.song():instrument(1):sample(1):move_slice_marker(100, 101)

Here’s a video example of what the above code sets up. The only thing that happens here is the first slice marker being moved slightly by Lua. The markers do not change position, but the notes assigned to the slices in both the Pattern & Phrase Editor behave as though they have. I’m undoing and redoing at the end to show the difference.

Thanks for the detailed report. Will be fixed.