Skip to content

Commit c695e6a

Browse files
author
dvdsk
committed
upgrade.md fixes OutputStreamBuilder::open_default_stream recommendation
1 parent dbaeabe commit c695e6a

1 file changed

Lines changed: 20 additions & 8 deletions

File tree

UPGRADE.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,26 @@ No changes are required.
2525
- `OutputStreamHandle::play_raw` has been removed, instead use `OutputStream.mixer().add()`.
2626
- The output stream is now more configurable. Where you used
2727
`OutputStream::try_default()`, you need to change to either:
28-
- *(recommended)* `OutputStreamBuilder::open_default_stream()?` which
29-
returns an error when the default stream could not be opened, or
30-
- `OutputStreamBuilder::open_stream_or_fallback()`, which tries to open the
31-
default audio stream. If that fails it tries all other combinations of
32-
device and settings. This is close to the old behavior, except that
33-
previously only all settings of the default device were tried.
34-
- The output stream now prints to stderr or logs a message on drop, if that breaks your
35-
CLI/UI use `stream.log_on_drop(false)`.
28+
- *(recommended)* `OutputStreamBuilder::open_default_stream()?` which tries
29+
to open a new output stream for the default output device with its default
30+
configuration. Failing that it attempt to open an output stream with
31+
alternative configuration and/or non default output devices. Returns the
32+
stream for the first configurations tried that succeeds. If all attempts
33+
fail returns the initial error.
34+
- *(org behavior)* `open_stream_or_fallback()?` which is used as follows:
35+
```rust
36+
let default_device = cpal::default_host()
37+
.default_output_device()
38+
.ok_or("No default audio output device is found.")?;
39+
rodio::OutputStreamBuilder::from_device(default_device)?
40+
.open_stream_or_fallback()?;
41+
```
42+
That tries to opening a output stream with the default configuration on
43+
the default device. Failing that attempt to open a stream with other
44+
available configurations supported by the default device. If all attempts
45+
fail returns initial error.
46+
- The output stream now prints to stderr or logs a message on drop, if that breaks your
47+
CLI/UI use `stream.log_on_drop(false)`.
3648

3749
## Sink & SpatialSink
3850
- Replace `Sink::try_new` with `Sink::connect_new`, which takes an `&Mixer`

0 commit comments

Comments
 (0)