forge
Explore
Log in

Don't you dare go Hollow

A transition step or retyped number arms only what moved

Browse files at this commit

7752ec5b55170be25cd29093fd9d976a1cd876e5Ahmet Kaan GümüşParent: a5f4c04
  • fix
    • a transition step or retyped number arms only what moved
Show full message
fix(player): a transition step or retyped number arms only what moved

Found by the class sweep of "dirty armed ahead of the mutation door, or while
dropping the door's answer", alongside the two mix/EQ doors this wave fixed.
`Player::set_transition_frames` armed on the raw bool from
`set_transition_out` and `crossfade`, and both of those answer true for any two
adjacent clips: they snapshot, they clamp, and a `frames` already in force is
written over the value the join already carried and still reported as a write.
So a `+` step once the dissolve is at the cap, or the same number retyped into
the duration field, lit `unsaved`, wrote a sidecar and raised the close prompt
over an unchanged timeline.

The arm now rides a before/after read of the join's own edges, the comparison
`move_sub` and `commit_fade` already make. The new `transition_edges` helper
reads BOTH sides of the join, because a crossfade writes the anchor's
`fade_out` and its neighbour's `fade_in`: a comparison of the anchor alone
would miss a crossfade whose neighbour-side edge is the one that did not move.
Both the stepper and the typed field keep landing the number the same way -- only
the arm moved.

Witness: `a_transition_step_or_a_retyped_number_arms_only_what_moved`, in the
same `fn_body` shape as the family, asserting the arm is after the comparison
and absent before it, and that the helper still reads both edges. Shown RED
against the pre-fix source.
crates/app/src/player/timeline_edit.rsmodified+36 -9
@@ -1869,17 +1869,44 @@ impl Player {
1869 if self.exporting().is_some() {1869 if self.exporting().is_some() {
1870 return;1870 return;
1871 }1871 }
1872- let Some(session) = &mut self.session else {1872+ if self.session.is_none() {
1873- return;1873+ return;
1874- };1874+ }
1875- let ok = match lane.kind {1875+ // The engine's bool answers "the two clips are adjacent" -- both
1876- LaneKind::Video => session.set_transition_out(lane, idx, frames),1876+ // setters snapshot and clamp, and a `frames` already in force (a step
1877- LaneKind::Audio => session.crossfade(lane, idx, frames),1877+ // past the cap, a number retyped in the field) writes the value the
1878- _ => false,1878+ // clip already carried and still says true. The arm therefore rides
1879+ // the join's own edges read back, the same before/after comparison
1880+ // `move_sub` and `commit_fade` make.
1881+ let before = self.transition_edges(lane, idx);
1882+ let ok = match &mut self.session {
1883+ Some(session) => match lane.kind {
1884+ LaneKind::Video => session.set_transition_out(lane, idx, frames),
1885+ LaneKind::Audio => session.crossfade(lane, idx, frames),
1886+ _ => false,
1887+ },
1888+ None => false,
1879 };1889 };
1880- if ok {1890+ if ok && self.transition_edges(lane, idx) != before {
1881 self.mark_dirty();1891 self.mark_dirty();
1882- cx.notify();1892+ }
1893+ cx.notify();
1894+ }
1895+
1896+ /// What the join at `idx` of `lane` carries on both sides, for the doors
1897+ /// that only the *pair* can answer for: a crossfade writes `idx`'s
1898+ /// `fade_out` and its neighbour's `fade_in`, so a comparison of the
1899+ /// anchor's own field alone would miss a neighbour-side no-op. `None`
1900+ /// for a lane with no such pair, which is a value no write can equal.
1901+ fn transition_edges(&self, lane: Lane, idx: usize) -> Option<(u32, u32)> {
1902+ let session = self.session.as_ref()?;
1903+ match lane.kind {
1904+ LaneKind::Video => Some((session.transition_out_of(lane, idx), 0)),
1905+ LaneKind::Audio => {
1906+ let clips = session.lane_clips(lane);
1907+ Some((clips.get(idx)?.fade_out, clips.get(idx + 1)?.fade_in))
1908+ }
1909+ _ => None,
1883 }1910 }
1884 }1911 }
1885 1912