From a6f2d430099fb09b348925c67396d269bf8ceabd Mon Sep 17 00:00:00 2001 From: gered Date: Mon, 27 Feb 2023 15:12:07 -0500 Subject: [PATCH] add convenience method for playing the system audio queue --- libretrogd/src/system/mod.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libretrogd/src/system/mod.rs b/libretrogd/src/system/mod.rs index 50b9632..4a4f424 100644 --- a/libretrogd/src/system/mod.rs +++ b/libretrogd/src/system/mod.rs @@ -522,6 +522,13 @@ impl System { should_quit } + /// Convenience method that applies any [`AudioBuffer`]s that may have been queued up on + /// [`System::audio_queue`] to the system audio device so that they will be played. Do not + /// call this when you already have an active lock on an [`AudioDevice`]. + pub fn apply_audio_queue(&mut self) -> Result<(), AudioDeviceError> { + self.audio_queue.apply(&mut self.audio) + } + pub fn ticks(&self) -> u64 { self.sdl_timer_subsystem.performance_counter() }