A setting nobody can hear stops rebuilding the sound
Browse files at this commit0689e40378d844b160e0a0af921e55bc1dc918dcParent: 64a9817- fix
- a setting nobody can hear stops rebuilding the sound
1 changed file +44 -0
crates/engine/tests/invalidation.rsmodified+44 -0
| @@ -218,6 +218,50 @@ fn a_fader_during_playback_stops_restarting_the_sound() { | |||
| 218 | eprintln!("20 fader nudges and 8 limiter moves: not one restart"); | 218 | eprintln!("20 fader nudges and 8 limiter moves: not one restart"); |
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | +/// The same rule on the timeline that has **no mixer at all**: one audio lane | ||
| 222 | +/// at unity with the limiter off is the bit-exact single-stream path, and a | ||
| 223 | +/// ceiling dragged while the limiter is *off* changes not one sample of it. | ||
| 224 | +/// That drag used to reopen the sound at every nudge -- there was no mixer to | ||
| 225 | +/// hand the number to, so the rebuild was the only way to apply a setting that | ||
| 226 | +/// did not apply to anything. | ||
| 227 | +/// | ||
| 228 | +/// The device queue is the oracle, as above; the worker count is the second | ||
| 229 | +/// one, because a rebuild is a feeder thread per nudge whether the ear catches | ||
| 230 | +/// it or not. | ||
| 231 | +#[test] | ||
| 232 | +fn a_ceiling_dragged_with_the_limiter_off_rebuilds_nothing() { | ||
| 233 | + let mut session = open(&asset("test_av.mp4")); | ||
| 234 | + let filled = play_until_heard(&mut session); | ||
| 235 | + let workers = session.live_workers(); | ||
| 236 | + | ||
| 237 | + for step in 1..=20 { | ||
| 238 | + // Off throughout: this is the setting nobody can hear yet. Every step a | ||
| 239 | + // different ceiling, since setting the one already in force is refused | ||
| 240 | + // and would measure nothing. | ||
| 241 | + let limiter = Limiter { | ||
| 242 | + on: false, | ||
| 243 | + ..Limiter::default() | ||
| 244 | + } | ||
| 245 | + .with_ceiling(-1.0 - step as f32 * 0.25); | ||
| 246 | + assert!(session.set_limiter(limiter), "ceiling {step}"); | ||
| 247 | + assert_eq!( | ||
| 248 | + heard(&session), | ||
| 249 | + filled, | ||
| 250 | + "nudge {step} emptied the device queue -- a silent setting restarted the stream" | ||
| 251 | + ); | ||
| 252 | + assert!( | ||
| 253 | + session.live_workers() <= workers, | ||
| 254 | + "nudge {step} started a worker: {} against {workers} before the drag", | ||
| 255 | + session.live_workers() | ||
| 256 | + ); | ||
| 257 | + } | ||
| 258 | + | ||
| 259 | + // ...and turning it *on* is the one move that has to open a mixer, which is | ||
| 260 | + // a rebuild and is allowed to be one. | ||
| 261 | + assert!(session.set_limiter(Limiter::default().with_ceiling(-1.0)), "limiter on"); | ||
| 262 | + eprintln!("20 ceiling nudges with the limiter off: not one rebuild"); | ||
| 263 | +} | ||
| 264 | + | ||
| 221 | /// The other half of the rule, and the one that makes it a *classification* | 265 | /// The other half of the rule, and the one that makes it a *classification* |
| 222 | /// rather than a blanket "never rebuild": an equalizer really is a change to | 266 | /// rather than a blanket "never rebuild": an equalizer really is a change to |
| 223 | /// the samples, so it does restart the audio -- and must leave the picture | 267 | /// the samples, so it does restart the audio -- and must leave the picture |