Only allow for private construction of SupportedStreamConfig.
This should give the user a higher confidence that, if they have a `SupportedStreamConfig` format type that it is actually supported. Also updates the `raw` stream builder methods to take a `StreamConfig` and `SampleFormat` as separate arguments for flexibility. **Backends Updated** - [x] null - [x] alsa - [ ] emscripten - [ ] coreaudio - [ ] wasapi - [ ] asio
This commit is contained in:
parent
07b66f52f3
commit
476f6c4c2c
8 changed files with 92 additions and 58 deletions
|
|
@ -10,7 +10,7 @@ fn main() -> Result<(), anyhow::Error> {
|
|||
.expect("failed to find a default output device");
|
||||
let config = device.default_output_config()?;
|
||||
|
||||
match config.sample_format {
|
||||
match config.sample_format() {
|
||||
cpal::SampleFormat::F32 => run::<f32>(&device, &config.into())?,
|
||||
cpal::SampleFormat::I16 => run::<i16>(&device, &config.into())?,
|
||||
cpal::SampleFormat::U16 => run::<u16>(&device, &config.into())?,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue