From 5f19a2aedfdb83452206bed17afb590fdee81327 Mon Sep 17 00:00:00 2001 From: e2-71828 Date: Thu, 11 Aug 2022 10:12:01 +0000 Subject: [PATCH] Add set_sync_timeout --- src/client/client_impl.rs | 10 ++++++++++ src/jack_enums.rs | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/client/client_impl.rs b/src/client/client_impl.rs index 17482563d..e9f26a40c 100644 --- a/src/client/client_impl.rs +++ b/src/client/client_impl.rs @@ -129,6 +129,16 @@ impl Client { } } + /// Set the maximum length of time that a client can hold transport start as it gets ready. + pub fn set_sync_timeout(&self, timeout:std::time::Duration) -> Result<(), Error> { + let timeout = timeout.as_micros() as u64; + let res = unsafe { j::jack_set_sync_timeout(self.raw(), timeout) }; + match res { + 0 => Ok(()), + _ => Err(Error::SetSyncTimeoutError), + } + } + /// Get the numeric `uuid` of this client. /// /// # Remarks diff --git a/src/jack_enums.rs b/src/jack_enums.rs index b4e33c1d6..d6b812292 100644 --- a/src/jack_enums.rs +++ b/src/jack_enums.rs @@ -2,6 +2,7 @@ use crate::ClientStatus; /// An error that can occur in JACK. #[derive(Clone, Debug, Eq, PartialEq)] +#[non_exhaustive] pub enum Error { CallbackDeregistrationError, CallbackRegistrationError, @@ -23,6 +24,7 @@ pub enum Error { WeakFunctionNotFound(&'static str), ClientIsNoLongerAlive, RingbufferCreateFailed, + SetSyncTimeoutError, UnknownError, }