Repository navigation
Fix au3 project loading - #12213
Fix au3 project loading#12213
Conversation
|
Important Review skippedWe couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthrough
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Severity of issue fixed: Medium Merge Risk: 🟡 Moderate · up to Legacy projects with tempo-matched clips can lose hidden audio when a cut line is expanded, because the restored cut line's speed no longer matches its clip. The rest of the tempo-persistence change looks sound; this single construction site should be fixed before merge. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Warning Linked repositories: Public OSS repositories can only analyze public repositories installed in this organization. No linked repositories were analyzed; skipped Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟠 Major · Pass the project tempo to deserialized cut lines. · WaveClip.cpp:1238
au3/libraries/au3-wave-track/WaveClip.cpp:1238
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winPass the project tempo to deserialized cut lines.
NewSharedleavesmProjectTempounset. XML restores the raw tempo and tempo-match flag, but not the project tempo. Therefore, with the default stretch ratio, the cut line can use1.0while its parent usesrawAudioTempo / projectTempo.
ExpandCutLinecallsPasteon the non-empty parent, so the new empty-clip derivation does not apply.Pasterejects ratios that differ by more than1e-6.ExpandCutLinethen erases the cut line even whenPastereturns false, which can delete the hidden audio without pasting it.Proposed fix
- mCutLines.push_back(WaveClip::NewShared(1, pFirst->GetFactory(), format, mRate)); + mCutLines.push_back( + WaveClip::NewShared( + 1, pFirst->GetFactory(), format, mRate, mProjectTempo));
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: CHILL
Plan: Advanced
Run ID: ab3896da-b2a9-42c9-bce3-9de3d2c37997
📒 Files selected for processing (6)
au3/libraries/au3-wave-track/WaveClip.cppau3/libraries/au3-wave-track/WaveClip.hau3/libraries/au3-wave-track/WaveTrack.cppsrc/project/tests/CMakeLists.txtsrc/project/tests/cliptempopersistence_tests.cppsrc/trackedit/tests/au3clipsinteraction_tests.cpp
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
saintmatthieu
left a comment
There was a problem hiding this comment.
I will suggest some improvements for the unit tests, but in the meantime it may move on to QA.
| EXPECT_DOUBLE_EQ(clips[i]->GetEnvelope().GetTrackLen(), 1.0); | ||
| } | ||
|
|
||
| // Loading must not mistake the inflated legacy durations for overlaps. |
There was a problem hiding this comment.
Having a hard time understanding this ... Is this a setup thing? GIVEN/WHEN/THEN would actually be helpful here.
There was a problem hiding this comment.
Commenting it out doesn't fail the test either.
| { | ||
| ASSERT_TRUE(readProject()); | ||
| auto& track = *firstTrack(); | ||
| track.LinkConsistencyFix(true); |
There was a problem hiding this comment.
I can kind of understand why this is needed for the test with a stereo clip, but for the three others ?.. and indeed, commenting these three out don't fail the test.
| // Exercise the project reader's track-addition notifications and clip XML | ||
| // handlers, using silent blocks so no recorded audio fixture is needed. |
There was a problem hiding this comment.
A comment on this factory describing what the project coming out of it looks like would be helpful.
|
|
||
| for (size_t i = 0; i < clips.size(); ++i) { | ||
| EXPECT_DOUBLE_EQ(clips[i]->GetStretchRatio(), 1.0); | ||
| EXPECT_NEAR(clips[i]->GetPlayStartTime(), 0.2 + 0.5 * i, 1e-9); |
There was a problem hiding this comment.
It's really tedious here. I have to go check the impl of readProject to understand this expectation. A helper function like testClipStartTime(i), also used in readProject for the construction, would be helpful.
…lip tempo and stretching Assisted-by: Codex
7aabaf8 to
c2aa4e0
Compare
Resolves: #12209 (resolves it on master - ticket is already resolved for 4.0.1) Resolves: #12266 A clip's stretch ratio is now stored as one variable. It used to be based on `mRawAudioTempo`, `mClipStretchRatio` and `mClipTempo` (the latter being the current project's tempo or a freeze of it if the user unchecked the "Stretch to match project tempo" box). This simplification lumps those three in just one variable, `mStretchRatio`. It's based on the belief (reviewers please challenge this) that the raw tempo, issued from the detection, really only is needed once at import. The PR also adds a plethora of test cases: that's because a wrong parsing of the stretch ratio from a legacy project file can lead to many bugs (clips cutting each other, trim boundaries not respected, etc). They are largely based on those in @kryksyh 's PR #12213 <!-- Use "x" to fill the checkboxes below like [x] --> - [x] I signed [CLA](https://www.audacityteam.org/cla/) - [x] This PR includes AI assistance - [x] If the PR is AI-assisted, I have read, understood and complied with the [guidelines for AI-assisted contributions](https://github.com/audacity/audacity/blob/master/AI_POLICY.md) - [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
Resolves: #12209
After the change introduced in ff3dcf4, the track added notification is emitted before any clip is created.
therefore project tempo is never set for the clip, which results in miscalculation of clip's timing.
There is another issue that could not be solved by reverting: the envelope points are calculated at clip loading time, if we set the tempo after that, some envelope points may be already removed. This is also present in au3.
Recommended: