Repository navigation
Ensure that a track has access to the project tempo. - #10688
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: ASSERTIVE Plan: Pro Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between c6587efe951124fc6dd5cfda854db427729a4e9d and b162533. 📒 Files selected for processing (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe change modifies TrackList::AdditionEvent so the TrackListEvent::ADDITION is constructed locally and published immediately via Publish(std::move(event)) rather than being enqueued via QueueEvent(...) for deferred publication through BasicUI::CallAfter. This changes emission from asynchronous/queued to synchronous/immediate. Sequence Diagram(s)sequenceDiagram
participant TrackList
participant QueueSystem
participant BasicUI
participant Subscribers
TrackList->>QueueSystem: QueueEvent(ADDITION)
QueueSystem->>BasicUI: CallAfter(Publish)
BasicUI->>Subscribers: Publish(ADDITION) %% event published later on UI thread
sequenceDiagram
participant TrackList
participant Subscribers
TrackList->>Subscribers: Publish(ADDITION) %% immediate synchronous publish
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem: In a newly created wavetrack, the project tempo "setting" of the wavetrack may not have be set before the call to GetProjectTempo(*this) in a call to WaveTrack::ClearAndPaste(), resulting in the thowing of an inconsistency exception. The problem is that this "setting" is set as a result of the call TrackList::AdditionEvent(), which uses CallAfter. Fix. In TrackList::AdditionEvent(), don't use CallAfter.
Problem: After opening a project, clips can have the wrong tempo. The tempo of a clip is the clip's "RawAudioTempo" rather than the project tempo. So when these values are different, a clip has the wrong tempo. This issue was caused by PR audacity#10688, in which there was a change to publishing a TrackListEvent::ADDITION event immediately, rather than using CallAfter. When opening a project, ProjectTempoListener::ProjectTempoListener() responds to a TrackListEvent::ADDITION by calling DoProjectTempoChange(*track, tempo), which calls OnProjectTempoChange::Call(group, oldTempo, newTempo), where oldTempo is nullopt, and newTempo is the project tempo. This is an attached virtual function, and there are overrides for each type of track. For wavetracks, this function sets the clip's project tempo. However because of the change in timing of the publishing of the event, the clips have not yet been added to the track, and so their values of project tempo are not set. When the oldTempo is nullopt, the overrides for all the other track types do nothing, and so other tracks are not affected by the change in timing. Fix: Add another call to OnProjectTempoChange::Call(group, oldTempo, newTempo), after the clips have been added.
Resolves: #11337 Problem: After opening a project, clips can have the wrong tempo. The tempo of a clip is the clip's "RawAudioTempo" rather than the project tempo. So when these values are different, a clip has the wrong tempo. This issue was caused by PR #10688, in which there was a change to publishing a TrackListEvent::ADDITION event immediately, rather than using CallAfter. When opening a project, ProjectTempoListener::ProjectTempoListener() responds to a TrackListEvent::ADDITION by calling DoProjectTempoChange(*track, tempo), which calls OnProjectTempoChange::Call(group, oldTempo, newTempo), where oldTempo is nullopt, and newTempo is the project tempo. This is an attached virtual function, and there are overrides for each type of track. For wavetracks, this function sets the clip's project tempo. However because of the change in timing of the publishing of the event, the clips have not yet been added to the track, and so their values of project tempo are not set. When the oldTempo is nullopt, the overrides for all the other track types do nothing, and so other tracks are not affected by the change in timing. Fix: Add another call to OnProjectTempoChange::Call(group, oldTempo, newTempo), after the clips have been added. <!-- Use "x" to fill the checkboxes below like [x] --> - [ x] I signed [CLA](https://www.audacityteam.org/cla/) - [x ] The title of the pull request describes an issue it addresses - [x ] If changes are extensive, then there is a sequence of easily reviewable commits - [ x] Each commit's message describes its purpose and effects - [x ] There are no behavior changes unnecessary for the stated purpose of the PR Recommended: - [x ] Each commit compiles and runs on my machine without known undesirable changes of behavior QA: - [ ] Testflow test cases have been run
Resolves: #8440
Resolves: #5790
Problem:
In a newly created wavetrack, the project tempo "setting" of the wavetrack may not have be set before the call to GetProjectTempo(*this) in a call to WaveTrack::ClearAndPaste(), resulting in the thowing of an inconsistency exception. The problem is that this "setting" is set as a result of the call TrackList::AdditionEvent(), which uses CallAfter.
Fix.
In TrackList::AdditionEvent(), don't use CallAfter.
Recommended:
QA: