Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use git version of the rodio to fix the audio issue on macOS #310

Closed
wants to merge 1 commit into from
Closed

Use git version of the rodio to fix the audio issue on macOS #310

wants to merge 1 commit into from

Conversation

dvtkrlbs
Copy link

Fixes #307 . I am creating this PR as draft since i am not sure if we should wait for rodio to update or just use the git version until it updates.

@cart
Copy link
Member

cart commented Aug 23, 2020

This is a welcome change, but we can't use git dependencies in bevy anymore because that would block crates.io releases. Lets leave this open until the next rodio crates.io release.

@Moxinilian Moxinilian added A-Audio Sounds playback and modification C-Bug An unexpected or incorrect behavior O-MacOS Specific to the MacOS (Apple) desktop operating system labels Aug 24, 2020
@dvtkrlbs
Copy link
Author

Also what can we do with the OutputStream struct it is not Send + Sync and i am currently just std::mem::forget it.

@cart
Copy link
Member

cart commented Aug 25, 2020

Hmm good question. Off the top of my head im not quite sure. It might be good to ask the Rodio folks directly, if the docs dont cover this case.

@endragor
Copy link

The reason is that the platform-specific streams may not be thread-safe. This concerns at least Android (AAudio), maybe some other platforms, but CPAL made all streams non-Send and non-Sync so that the behavior is the same across all platforms.

One solution would be for AudioOutput to create a separate thread that would own the stream and send the handle back. Drop implementation of AudioOutput would join the thread.

@cart
Copy link
Member

cart commented Sep 2, 2020

Cool that seems reasonable. Thanks for the insight @endragor!
(I recognize you from your work on Godot's nim bindings 😄 )

Lazy half formed thought: @aclysma @lachlansneff maybe this could somehow play into our new task system? Create a new "audio thread pool" with one long lived thread? It probably wouldn't really benefit from that abstraction given that the work on that thread would be well defined. I'm more bringing this up in the interest of keeping our threading all under one abstraction.

We could also just look into adding !Send !Sync resources/systems.

@lachlansneff
Copy link
Contributor

lachlansneff commented Sep 2, 2020 via email

@MichaelHills MichaelHills mentioned this pull request Sep 22, 2020
@dvtkrlbs
Copy link
Author

dvtkrlbs commented Oct 6, 2020

The new version of rodio has been published to crates.io. Its been a time since i created this draft so how we handle the main handler. I am not really familiar with the current state of bevy.

@dvtkrlbs dvtkrlbs mentioned this pull request Oct 7, 2020
@dvtkrlbs
Copy link
Author

dvtkrlbs commented Oct 7, 2020

Discussion continues on #638. I deleted my fork so i cannot add commits to the PR.

@dvtkrlbs dvtkrlbs closed this Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Audio Sounds playback and modification C-Bug An unexpected or incorrect behavior O-MacOS Specific to the MacOS (Apple) desktop operating system
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Audio example crashes when an external audio device is selected on macOS
5 participants