summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2025-12-16 00:56:00 -0500
committerLLLL Colonq <llll@colonq>2025-12-16 00:56:00 -0500
commitc3f29c1a37e7cf85f00be22ee87331bce13ef7da (patch)
tree9331f752f881dc0e8c41d4b935ebeff5bde3eada
parent1695185a429918ed85fe36b0b65566940174aca0 (diff)
Delay the stop to prevent the pop
-rw-r--r--crates/teleia/src/audio.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/teleia/src/audio.rs b/crates/teleia/src/audio.rs
index 9571745..e95a86d 100644
--- a/crates/teleia/src/audio.rs
+++ b/crates/teleia/src/audio.rs
@@ -31,10 +31,10 @@ impl AudioPlayingHandle {
self.node.stop().expect("failed to stop audio");
}
pub fn fade_out(&self, ctx: &Context, time: f32) {
- let t = ctx.audio.current_time() + time as f64;
self.gain.gain().set_target_at_time(0.0, ctx.audio.current_time(), time as f64)
.expect("failed to fade out audio");
- // self.node.stop_with_when(t).expect("failed to stop audio while fading out");
+ self.node.stop_with_when(ctx.audio.current_time() + time as f64 + 1.0)
+ .expect("failed to stop audio while fading out");
}
}