Skip to content

Commit 773e4df

Browse files
authored
Merge pull request #847 from sofoxe1/playpuse
expose pause/play in MixerDeviceSink
2 parents a352fb5 + e5b57be commit 773e4df

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/stream.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,22 @@ impl MixerDeviceSink {
6767
pub fn mixer(&self) -> &Mixer {
6868
&self.mixer
6969
}
70+
/// pause underlaying audio stream reducing cpu usage
71+
///
72+
/// will silenty fail to play audio until play() is called
73+
///
74+
/// This is an experimental API it is likely to removed once a better solution is found without notice or a change log entry
75+
#[cfg(feature = "experimental")]
76+
pub fn pause(&self) {
77+
let _ = self._stream.pause();
78+
}
79+
/// resume underlaying audio stream
80+
///
81+
/// This is an experimental API it is likely to removed once a better solution is found without notice or a change log entry
82+
#[cfg(feature = "experimental")]
83+
pub fn play(&self) {
84+
let _ = self._stream.play();
85+
}
7086

7187
/// Access the sink's config.
7288
pub fn config(&self) -> &DeviceSinkConfig {

0 commit comments

Comments
 (0)