From d7602f64e1ba99db93c56bd9f5778c6dd6391550 Mon Sep 17 00:00:00 2001 From: marci1175 Date: Sat, 8 Aug 2026 11:17:39 +0200 Subject: [PATCH] added a function to fetch the length of the queue --- src/queue.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/queue.rs b/src/queue.rs index 840e4f50c..523cf1eae 100644 --- a/src/queue.rs +++ b/src/queue.rs @@ -100,6 +100,11 @@ impl SourcesQueueInput { self.keep_alive_if_empty.load(Ordering::Acquire) } + /// Returns the additional length of the queue. + pub fn queue_len(&self) -> usize { + self.next_sounds.lock().unwrap().len() + } + /// Removes all the sounds from the queue. Returns the number of sounds cleared. pub fn clear(&self) -> usize { let mut sounds = self.next_sounds.lock().unwrap();