From f093bde60ca20271a34fb0badc8f125b00b4fb37 Mon Sep 17 00:00:00 2001 From: regulus79 <117475203+regulus79@users.noreply.github.com> Date: Sun, 23 Nov 2025 12:34:41 -0500 Subject: [PATCH] Fix Note Quantization Resetting Clip Length (#8131) Fixes an issue where quantizing notes in a midi clip with auto-resize disabled would cause the length to be reset, in cases where there is only a single note in the clip. This was due to how quantization removes and re-adds each note, so for a moment, the clip would be empty, thus treated as a beat clip. Beat clips were mistakenly always automatically resized no matter whether auto-resize was enabled or not. This PR fixes that by only auto-resizing beat clips when they have auto-resize enabled. Co-authored-by: Fawn --------- Co-authored-by: Fawn --- src/tracks/MidiClip.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/tracks/MidiClip.cpp b/src/tracks/MidiClip.cpp index f5b3b9eea..73a8435b2 100644 --- a/src/tracks/MidiClip.cpp +++ b/src/tracks/MidiClip.cpp @@ -125,16 +125,15 @@ void MidiClip::init() void MidiClip::updateLength() { - if( m_clipType == Type::BeatClip ) - { - changeLength( beatClipLength() ); - updatePatternTrack(); - return; - } - // If the clip hasn't already been manually resized, automatically resize it. if (getAutoResize()) { + if (m_clipType == Type::BeatClip) + { + changeLength(beatClipLength()); + updatePatternTrack(); + return; + } tick_t max_length = TimePos::ticksPerBar(); for (const auto& note : m_notes)