Skip to content

Fix playing notes notes retriggering when changing clip during first loop in Clip Launcher #255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ class LoopedMidiEventGenerator : public MidiGenerator
generator->setTime (0.0);
}

return exhausted();
return !exhausted();
}

bool exhausted() override
Expand Down Expand Up @@ -1267,7 +1267,10 @@ class GeneratorAndNoteList
midiSourceID,
0.0,
isPlaying);
shouldCreateMessagesForTime = true;

// Only create messages at clip start, otherwise use the existing note state
// This prevents notes from retriggering when the step clip content is modified during playback
shouldCreateMessagesForTime = blockStartBeatRelativeToClip <= 0.00001_bd;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you actually sure this is needed? The existing block around that line is this:

        if (! isContiguousWithPreviousBlock
            || blockStartBeatRelativeToClip <= 0.00001_bd)
        {
            MidiNodeHelpers::createNoteOffs (*activeNoteList,
                                             destBuffer,
                                             midiSourceID,
                                             0.0,
                                             isPlaying);
            shouldCreateMessagesForTime = true;
        }

So unless the playhead jumps, or loops round, it's the same as your modified line?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're completely right. I was able to reproduce the issue in Waveform 13 simply using Midi Clip with single note.

Screen.Recording.2025-05-20.at.7.mp4

Well, talking about the fix. I don't think shouldCreateMessagesForTime = blockStartBeatRelativeToClip <= 0.00001_bd; is THE solution. I think it just masking a bug in active note state comparing code.

Let me know if you have any suggestion on fixing. I cannot seem to figure out where to make a change.

}

if (shouldCreateMessagesForTime)
Expand Down