Fix PianoRoll Timeline Constantly Emitting positionJumped During Record-Play (#8252)
When #7454 was merged, Timelines were refactored to emit a positionJumped signal whenever their internal tick position was changed via Timeline::setTicks. This was meant as an easy way to account for all situations where the user might drag or click or somehow forcefully set the position of a timeline mid-playback. However, the current way timeline syncing is implemented between the song editor and piano roll (when doing record-play in the piano roll) is by constantly calling setTicks on the piano roll's timeline whenever the song editor's timeline moves. This inadvertantly means that positionJumped is being emitted, even when the timeline is tracking smoothly. This PR attempts to address this issue by adding an optional parameter to Timeline::setTicks which allows the caller to opt out of emitting positionJumped. Ideally, we would have a better system for syncing timelines together, one which does not rely on forcefully calling setTicks. But for now, this should work. --------- Co-authored-by: Sotonye Atemie <satemiej@gmail.com>
This commit is contained in:
@@ -50,13 +50,13 @@ public:
|
||||
auto ticks() const -> tick_t { return m_pos.getTicks(); }
|
||||
|
||||
//! Forcefully sets the current ticks, resets the frame offset, and sets the elapsed seconds based on the global position (ignoring potential mid-song tempo changes)
|
||||
//! This function will emit the `positionJumped` signal to allow other widgets to update accordingly
|
||||
void setTicks(tick_t ticks)
|
||||
//! Unless `jumped` is passed as false, this function will emit the `positionJumped` signal to allow other widgets to update accordingly.
|
||||
void setTicks(tick_t ticks, bool jumped = true)
|
||||
{
|
||||
m_pos.setTicks(ticks);
|
||||
m_frameOffset = 0;
|
||||
m_elapsedSeconds = ticks * Engine::framesPerTick() / Engine::audioEngine()->outputSampleRate();
|
||||
emit positionJumped();
|
||||
if (jumped) { emit positionJumped(); }
|
||||
emit positionChanged();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user