lmms icon indicating copy to clipboard operation
lmms copied to clipboard

Fix Automation Editor Playing from Start of Song

Open regulus79 opened this issue 6 months ago • 0 comments

This pull request makes the play button in the automation editor teleport the playhead position to where the clip begins before playing the song, instead of playing from the very start. In the case of note detuning, it teleports the playhead to the position of the note being detuned.

Changes

In AutomationEditor::play()

  • Added Engine::getSong()->setToTime(m_clip->startPosition().getTicks(), Song::PlayMode::Song); for when the automation clip is standalone.
  • Added Engine::getSong()->setToTime(m_detuningOffset, Song::PlayMode::MidiClip); in two places for when the automation editor is being used for note detuning.

However, since the position of the note which is being detuned is only stored in a temportary variable, a new private member was also added, m_detuningOffset, which is assigned when the notes are being looped over to find the detuning note in paintEvent(), so that it can be accessed in AutomationEditor::play().

Note

I am not sure what the purpose of the playMidiClip() on line 1694, as I could never get it to execute during normal usage, playing/stopping in the detuner. I have added a setToTime() there anyway, but if I am misunderstanding its purpose that may not be necessary.

regulus79 avatar Aug 22 '24 03:08 regulus79