Skip to content
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

Fix PianoRoll playhead not moving during Record-Play #7454

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

regulus79
Copy link
Contributor

@regulus79 regulus79 commented Aug 14, 2024

This pull request fixes #7351 by changing the PianoRoll's connection from m_timeline to &Engine::getSong()->getTimeline(Song::PlayMode::Song), and additionally adding the signal positionChanged to the Timeline class.

The new signal is necessary because getTimeline() returns a Timeline, which does not have a positionChanged signal, while m_timeline is a TimeLineWidget which does.

This pr is marked as a draft, since after fixing the bug I found another one: When pressing stop after record-play, the piano roll play head does not go back to the start, but instead stops at its current position. Edit: I have decided to leave fixing that bug to a future pr, as it appears that it existed prior to the regression. Instead, this pr simply fixes the pianoroll playhead movement.

@regulus79 regulus79 marked this pull request as ready for review August 25, 2024 16:29
@@ -290,7 +290,7 @@ PianoRoll::PianoRoll() :
this, SLOT( updatePositionStepRecording( const lmms::TimePos& ) ) );

// update timeline when in record-accompany mode
connect(m_timeLine, &TimeLineWidget::positionChanged, this, &PianoRoll::updatePositionAccompany);
connect(&Engine::getSong()->getTimeline(Song::PlayMode::Song), SIGNAL(positionChanged(const lmms::TimePos&)), this, SLOT(updatePositionAccompany(const lmms::TimePos&)));
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
connect(&Engine::getSong()->getTimeline(Song::PlayMode::Song), SIGNAL(positionChanged(const lmms::TimePos&)), this, SLOT(updatePositionAccompany(const lmms::TimePos&)));
connect(&Engine::getSong()->getTimeline(Song::PlayMode::Song), &Timeline::positionChanged, this, &PianoRoll::updatePositionAccompany);

We're trying to avoid using the SIGNAL and SLOT macros in new code

Copy link
Member

Choose a reason for hiding this comment

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

Actually, there may be a better approach than adding a signal to Timeline... Let me think this over some more

Copy link
Member

Choose a reason for hiding this comment

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

I don't really like how Timeline and TimeLineWidget have implemented their signals and slots for changes in position. I think ideally Timeline should be the model and only it should emit any positionChanged signals, while TimeLineWidget should be the view and its updatePosition slot should not emit any signals. The way it is currently, the TimeLineWidget is trying to do the job of both a model and a view, and that complicates things.

Copy link
Member

@messmerd messmerd Aug 31, 2024

Choose a reason for hiding this comment

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

@DomClark Do you agree with my assessment? It looks to me like a proper solution to this bug may require rethinking how the timeline position signals/slots are implemented.

Co-authored-by: Dalton Messmer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Piano Roll playhead not shown during Record-Play
2 participants