From 6cef5a9d69ff491372e5d4e03c22e8b0644866ca Mon Sep 17 00:00:00 2001 From: sofoxe1 <22683778+sofoxe1@users.noreply.github.com> Date: Wed, 18 Feb 2026 18:38:21 +0100 Subject: [PATCH 1/2] expose pause/play in MixerDeviceSink --- src/stream.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/stream.rs b/src/stream.rs index 3b6a736e..d693b3d0 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -54,6 +54,16 @@ impl MixerDeviceSink { pub fn mixer(&self) -> &Mixer { &self.mixer } + /// pause underlaying audio stream + /// + /// this will prevent audio from playing until play() is called + pub fn pause(&self) { + let _ = self._stream.pause(); + } + /// resumes underlaying audio stream + pub fn play(&self) { + let _ = self._stream.play(); + } /// Access the sink's config. pub fn config(&self) -> &DeviceSinkConfig { From e5b57be64e0b16845227e6d4e0e236a4fe964f13 Mon Sep 17 00:00:00 2001 From: sofoxe1 <22683778+sofoxe1@users.noreply.github.com> Date: Fri, 20 Feb 2026 20:08:16 +0100 Subject: [PATCH 2/2] better document play/pause on MixerDeviceSink --- src/stream.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/stream.rs b/src/stream.rs index d693b3d0..07d21ea3 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -54,13 +54,19 @@ impl MixerDeviceSink { pub fn mixer(&self) -> &Mixer { &self.mixer } - /// pause underlaying audio stream + /// pause underlaying audio stream reducing cpu usage /// - /// this will prevent audio from playing until play() is called + /// will silenty fail to play audio until play() is called + /// + /// This is an experimental API it is likely to removed once a better solution is found without notice or a change log entry + #[cfg(feature = "experimental")] pub fn pause(&self) { let _ = self._stream.pause(); } - /// resumes underlaying audio stream + /// resume underlaying audio stream + /// + /// This is an experimental API it is likely to removed once a better solution is found without notice or a change log entry + #[cfg(feature = "experimental")] pub fn play(&self) { let _ = self._stream.play(); }