diff --git a/CHANGELOG.md b/CHANGELOG.md index c77a579..43950d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Unreleased +- Implement `default_output_format` for emscripten backend. + # Version 0.8.1 (2018-03-18) - Fix the handling of non-default sample rates for coreaudio input streams. diff --git a/src/emscripten/mod.rs b/src/emscripten/mod.rs index 9b44496..9f435ea 100644 --- a/src/emscripten/mod.rs +++ b/src/emscripten/mod.rs @@ -68,7 +68,6 @@ impl EventLoop { stream: &stream, }; - let id = StreamId(stream_id); let buffer = UnknownTypeOutputBuffer::F32(::OutputBuffer { target: Some(buffer) }); let data = StreamData::Output { buffer: buffer }; user_cb(StreamId(stream_id), data); @@ -204,6 +203,8 @@ impl Device { // TODO: right now cpal's API doesn't allow flexibility here // "44100" and "2" (channels) have also been hard-coded in the rest of the code ; if // this ever becomes more flexible, don't forget to change that + // According to https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/createBuffer + // browsers must support 1 to 32 channels at leats and 8,000 Hz to 96,000 Hz. Ok( vec![ SupportedFormat { @@ -221,7 +222,14 @@ impl Device { } pub fn default_output_format(&self) -> Result { - unimplemented!(); + // TODO: because it is hard coded, see supported_output_formats. + Ok( + Format { + channels: 2, + sample_rate: ::SampleRate(44100), + data_type: ::SampleFormat::F32, + }, + ) } }