Skip to content

Rebuild envelope from source clips when joining - #10830

Merged
grliszas14 merged 3 commits into
audacity:masterfrom
grliszas14:join_adjacent_clips
May 6, 2026
Merged

grliszas14 merged 3 commits into
audacity:masterfrom
grliszas14:join_adjacent_clips

Conversation

@grliszas14

Copy link
Copy Markdown
Contributor

Resolves: #10446

  • I signed CLA
  • The title of the pull request describes an issue it addresses
  • If changes are extensive, then there is a sequence of easily reviewable commits
  • Each commit's message describes its purpose and effects
  • There are no behavior changes unnecessary for the stated purpose of the PR

Recommended:

  • Each commit compiles and runs on my machine without known undesirable changes of behavior

QA:

  • Testflow test cases have been run

@coderabbitai

coderabbitai Bot commented Apr 29, 2026 •

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 83b0093f-1fef-4f2b-998e-3e72d64b87f5

📥 Commits

Reviewing files that changed from the base of the PR and between 123e3ab1c95111dd1a05e1aaab329e22126712f5 and 04451a3.

📒 Files selected for processing (1)
  • au3/libraries/au3-wave-track/WaveTrack.cpp

📝 Walkthrough

Walkthrough

WaveTrack::Join now rebuilds the joined clip’s automation envelope after concatenating source clips. A new Envelope is created with offset and length matching the joined clip, and visible/play-range control points from each source clip are copied in order. Per-clip play boundaries are emitted; coincident boundary timestamps within sample tolerance are coalesced when values match (preferring explicit user points) or preserved as duplicated same-timestamp points when values differ. Outermost boundaries are kept only if they were explicit in the originals. The rebuilt envelope replaces the target clip’s envelope.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant WaveTrack
    participant SourceClips as "SourceClip(s)"
    participant NewClip as "Joined WaveClip"
    participant Envelope

    Caller->>WaveTrack: Join(clips)
    WaveTrack->>NewClip: Concatenate audio -> create newClip
    WaveTrack->>Envelope: Create envelope sized/offset to newClip
    WaveTrack->>SourceClips: Iterate clips in order
    SourceClips->>WaveTrack: Emit visible play-region points & boundaries
    WaveTrack->>Envelope: Insert points (handle seam coalescing/duplication)
    WaveTrack->>NewClip: Replace clip envelope with rebuilt Envelope
    WaveTrack-->>Caller: Return joined clip
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Rebuild envelope from source clips when joining' is concise, specific, and directly describes the main change from the summary: rebuilding clip envelopes after concatenating clips.
Description check ✅ Passed The pull request description includes all required template sections: resolved issue link, completed checklist items, and commit documentation. Although QA testflow tests are not completed, this is marked as optional in the template.
Linked Issues check ✅ Passed The pull request directly addresses issue #10446 by implementing envelope rebuilding during clip joining to preserve automation control points correctly, resolving the reported broken line problem.
Out of Scope Changes check ✅ Passed All 162 lines of changes are contained within WaveTrack.cpp's internal implementation, adding the RebuildJoinedEnvelope helper function to support envelope reconstruction during joins, with no public API modifications.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@grliszas14
grliszas14 force-pushed the join_adjacent_clips branch 2 times, most recently from 3ea9ed7 to 0a7cc88 Compare April 30, 2026 09:18
@grliszas14
grliszas14 requested a review from kryksyh April 30, 2026 09:20

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 8e48f418-8da2-4ff7-a93a-a712b64af537

📥 Commits

Reviewing files that changed from the base of the PR and between 3ea9ed7d8cad72e01c977e11b6752b36157d2858 and 0a7cc881717dd1cc089a45b460e343511cc73171.

📒 Files selected for processing (1)
  • au3/libraries/au3-wave-track/WaveTrack.cpp

@grliszas14
grliszas14 force-pushed the join_adjacent_clips branch from 0a7cc88 to 123e3ab Compare May 5, 2026 14:03

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
au3/libraries/au3-wave-track/WaveTrack.cpp (1)

2304-2323: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

hasExplicitPointAt() still treats synthesized trim/split preserves as authored control points.

This helper only checks whether a point exists at playStart / playEnd, so boundary preserves created by earlier trim/split paths still satisfy it. That means the “keep only real outer points” rule is still not reliable for previously edited clips. Based on the current implementation, this is the same unresolved concern raised on the earlier revision.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: a2eff399-2371-4af2-8112-c37d46ab444e

📥 Commits

Reviewing files that changed from the base of the PR and between 0a7cc881717dd1cc089a45b460e343511cc73171 and 123e3ab1c95111dd1a05e1aaab329e22126712f5.

📒 Files selected for processing (1)
  • au3/libraries/au3-wave-track/WaveTrack.cpp

@kryksyh kryksyh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

awesome 🔥

double value;
bool isExplicit;
};
std::optional<PendingBoundary> pendingEnd;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we never check if pendingEnd is set, do we need an optional here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

right, fixed!

@grliszas14
grliszas14 force-pushed the join_adjacent_clips branch from 123e3ab to 04451a3 Compare May 6, 2026 12:52
@grliszas14
grliszas14 merged commit fa07081 into audacity:master May 6, 2026
9 checks passed
@grliszas14
grliszas14 deleted the join_adjacent_clips branch May 6, 2026 17:56
kryksyh added a commit that referenced this pull request May 25, 2026
Ports #10830

- [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
@kryksyh kryksyh mentioned this pull request Jun 1, 2026
6 of 7 tasks
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.

Wrong behavior when joining two adjacent clips with gain automation control points in both

2 participants