Skip to content

fix(sound): latest rodio breaks sound implementation#149

Merged
sectore merged 1 commit intomainfrom
fix/rodio
Jan 4, 2026
Merged

fix(sound): latest rodio breaks sound implementation#149
sectore merged 1 commit intomainfrom
fix/rodio

Conversation

@sectore
Copy link
Copy Markdown
Owner

@sectore sectore commented Jan 4, 2026

With #144 we upgraded radio 0.20.1 -> 0.21.1, which breaks current sound implementation.

This PR fixes it by following rodios UPGRADE and CHANGELOG guides.

  1. Address breaking changes in rodio 0.21:
  • OutputStream API changed to OutputStreamBuilder
  • Sink::try_new() replaced with mixer.add() pattern
  • Decoder now uses try_from() instead of new()
  1. Implementation changes:
  • Store persistent Sound instance in App with long-lived OutputStream
  • Buffer decoded audio once at initialization (stored in Arc<Buffered<Decoder>>)
  • Use non-blocking mixer.add() instead of Sink with threaded playback
  • Remove redundant file validation in sound.rs (already done in args.rs)
  1. Fixes "Dropping OutputStream" warnings and improves performance.

implementation

Fixed by following `UPGRADE` guide:
https://github.com/RustAudio/rodio/blob/master/UPGRADE.md and CHANGELOG https://github.com/RustAudio/rodio/blob/master/CHANGELOG.md

Breaking changes in rodio 0.21:
- `OutputStream` API changed to `OutputStreamBuilder`
- `Sink::try_new()` replaced with `mixer.add()` pattern
- `Decoder` now uses `try_from()` instead of `new()`

Implementation changes (`--features sound` only):
- Store persistent `Sound` instance in `App` with long-lived `OutputStream`
- Buffer decoded audio once at initialization (stored in `Arc<Buffered<Decoder>>`)
- Use non-blocking `mixer.add()` instead of `Sink` with threaded playback
- Remove redundant file validation in `sound.rs` (already done in
  `args.rs`)

Fixes "Dropping OutputStream" warnings and improves performance.
@sectore sectore merged commit 150bfd8 into main Jan 4, 2026
3 checks passed
@sectore sectore deleted the fix/rodio branch January 4, 2026 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant