diff --git a/src/emscripten/mod.rs b/src/emscripten/mod.rs index b828f7f..cb53729 100644 --- a/src/emscripten/mod.rs +++ b/src/emscripten/mod.rs @@ -17,6 +17,7 @@ use PauseStreamError; use PlayStreamError; use SupportedFormatsError; use StreamData; +use StreamEvent; use SupportedFormat; use UnknownTypeOutputBuffer; @@ -43,7 +44,7 @@ impl EventLoop { #[inline] pub fn run(&self, callback: F) -> ! - where F: FnMut(StreamId, StreamData) + where F: FnMut(StreamId, StreamEvent) { // The `run` function uses `set_timeout` to invoke a Rust callback repeatidely. The job // of this callback is to fill the content of the audio buffers. @@ -52,7 +53,7 @@ impl EventLoop { // and to the `callback` parameter that was passed to `run`. fn callback_fn(user_data_ptr: *mut c_void) - where F: FnMut(StreamId, StreamData) + where F: FnMut(StreamId, StreamEvent) { unsafe { let user_data_ptr2 = user_data_ptr as *mut (&EventLoop, F); @@ -71,7 +72,8 @@ impl EventLoop { { let buffer = UnknownTypeOutputBuffer::F32(::OutputBuffer { buffer: &mut temporary_buffer }); let data = StreamData::Output { buffer: buffer }; - user_cb(StreamId(stream_id), data); + let event = StreamEvent::Data(data); + user_cb(StreamId(stream_id), event); // TODO: directly use a TypedArray once this is supported by stdweb } diff --git a/src/null/mod.rs b/src/null/mod.rs index c7e4cb7..f3238c8 100644 --- a/src/null/mod.rs +++ b/src/null/mod.rs @@ -10,7 +10,7 @@ use Format; use PauseStreamError; use PlayStreamError; use SupportedFormatsError; -use StreamData; +use StreamEvent; use SupportedFormat; pub struct EventLoop; @@ -23,7 +23,7 @@ impl EventLoop { #[inline] pub fn run(&self, _callback: F) -> ! - where F: FnMut(StreamId, StreamData) + where F: FnMut(StreamId, StreamEvent) { loop { /* TODO: don't spin */ } }