From 53fdfdbecee91b641f8261d5b2ae71c8c93ec0b2 Mon Sep 17 00:00:00 2001 From: Hank Jackson Date: Sun, 26 Jan 2025 17:38:45 -0500 Subject: [PATCH 1/3] Add constructors for InputCallbackInfo and OutputCallbackInfo --- src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 74405a4a2..643092478 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -485,6 +485,10 @@ impl StreamInstant { } impl InputCallbackInfo { + pub fn new(timestamp: InputStreamTimestamp) -> Self { + Self { timestamp } + } + /// The timestamp associated with the call to an input stream's data callback. pub fn timestamp(&self) -> InputStreamTimestamp { self.timestamp @@ -492,6 +496,10 @@ impl InputCallbackInfo { } impl OutputCallbackInfo { + pub fn new(timestamp: OutputStreamTimestamp) -> Self { + Self { timestamp } + } + /// The timestamp associated with the call to an output stream's data callback. pub fn timestamp(&self) -> OutputStreamTimestamp { self.timestamp From dd0190429a824423a4065b17822946390c025da0 Mon Sep 17 00:00:00 2001 From: Hank Jackson Date: Sun, 26 Jan 2025 17:40:49 -0500 Subject: [PATCH 2/3] Make constructor for StreamInstant public --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 643092478..ad4b8d95a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -479,7 +479,7 @@ impl StreamInstant { Self::new(s, ns) } - fn new(secs: i64, nanos: u32) -> Self { + pub fn new(secs: i64, nanos: u32) -> Self { StreamInstant { secs, nanos } } } From 9b3f51a184b8bdd1a9ad4eea9205781e9a39d7be Mon Sep 17 00:00:00 2001 From: Hank Jackson Date: Sun, 26 Jan 2025 17:54:10 -0500 Subject: [PATCH 3/3] fix emscripten build --- src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index ad4b8d95a..bd7e1d709 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -332,6 +332,7 @@ pub struct Data { /// | wasapi | `QueryPerformanceCounter` | /// | asio | `timeGetTime` | /// | emscripten | `AudioContext.getOutputTimestamp` | +#[cfg_attr(target_os = "emscripten", wasm_bindgen)] #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)] pub struct StreamInstant { secs: i64, @@ -339,6 +340,7 @@ pub struct StreamInstant { } /// A timestamp associated with a call to an input stream's data callback. +#[cfg_attr(target_os = "emscripten", wasm_bindgen)] #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)] pub struct InputStreamTimestamp { /// The instant the stream's data callback was invoked. @@ -350,6 +352,7 @@ pub struct InputStreamTimestamp { } /// A timestamp associated with a call to an output stream's data callback. +#[cfg_attr(target_os = "emscripten", wasm_bindgen)] #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)] pub struct OutputStreamTimestamp { /// The instant the stream's data callback was invoked.