From a8423c1e4a25f67fd350588bef7704a3bbd003ff Mon Sep 17 00:00:00 2001 From: Sotonye Atemie Date: Sun, 15 Feb 2026 12:14:45 -0500 Subject: [PATCH] Emit the `playbackPositionJumped` signal only when the active timeline jumps (#8256) Only emit the playbackPositionJumped signal when the timeline responsible for the current play mode jumps. --- src/core/Song.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/core/Song.cpp b/src/core/Song.cpp index 457899156..07cbb7044 100644 --- a/src/core/Song.cpp +++ b/src/core/Song.cpp @@ -118,14 +118,17 @@ Song::Song() : for (auto& scale : m_scales) {scale = std::make_shared();} for (auto& keymap : m_keymaps) {keymap = std::make_shared();} - // Aggregate the `positionJumped` signals from all the timelines into a single `playbackPositionJumped` signal for other objects (sample tracks, LFOs, etc) to use. - for (auto& timeline : m_timelines) + // Aggregate the `positionJumped` signals from all the timelines into a single `playbackPositionJumped` signal for + // other objects (sample tracks, LFOs, etc) to use. + for (auto i = std::size_t{0}; i < static_cast(PlayMode::Count); ++i) { - connect(&timeline, &Timeline::positionJumped, this, [this](){ - // Only emit the signal when the song is actually playing + const auto onPositionJumped = [this, playMode = static_cast(i)] { + // Only emit the signal when the song is actually playing and the active timeline jumps // This prevents LFOs from changing phase when the user drags the timeline while paused - if (m_playing) { emit playbackPositionJumped(); } - }, Qt::DirectConnection); + if (m_playing && m_playMode == playMode) { emit playbackPositionJumped(); } + }; + + connect(&m_timelines[i], &Timeline::positionJumped, this, onPositionJumped); } // Inform VST plugins if the user moved the play head