-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
custom rodio source for audio #145
Conversation
dc8899e
to
cea85fd
Compare
Also, I understand if this is super low priority, so no rush on this at all! |
Can you rebase this on master? Format checking was enabled, and the CI doesn't yet check for it at the commit you're at |
cea85fd
to
fc26e1d
Compare
Rebased |
Awesome, thanks! (the failure isn't yours) |
No problem! I noticed your PR to fix the formatting issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general this seem like a reasonable change. It does introduce a bit of complexity and I dont really understand the cases where you would need new Decodables / rodio::Sources. Could you elaborate on that a bit?
@cart Thanks for taking some time to look at this. I understand this is an edge case, as most people are going to be using MP3, WAV, Vorbis or Flac sources that are supported by the Since the Anyway, I'm still not in love with where I've landed on this API and I think it's reasonable to hold off on this until we are 100% sure it's a reasonable addition to the audio module. In the meantime I'll go ahead and rebase / make the changes you suggested. |
fc26e1d
to
0bad5b5
Compare
I think this is in a good spot to merge. Thanks for your work here! |
Great, thanks @cart! |
support custom rodio source for audio
This is very much an early draft and in need of feedback.
I've made
AudioOuput
able to play anythingDecodable
.Decodable
has been implemented onAudioSource
and is the concrete type used for creating theAudioOutput
in theAudioPlugin
.Decodable
outputs aDecoder
which must implementrodio::Source<Item = rodio::Sample> + Send + Sync
to be accepted byAudioOutput
.The downside right now is if someone created their own
Decodable
, they'd need to setup their ownAudioOutput
on that type and redo a bunch of the stuff theAudioPlugin
sets up on behalf of the user. I've done this at the following test with my Atra3+ decoder and it works. https://github.com/tarkah/bevy-test-custom-audio. Also, users have to specifyAudioOutput<AudioSource>
out of the box, which is less than ideal, though we could type alias something I'm sure.I couldn't get dynamic dispatching working in the way I was hoping since
rodio::Sample
in the associated type forrodio::Source
isSized
. I have no idea if it's possible to have a singleAudioOutput
with a dynamicrodio::Source
input without having to define separate instances over the concreterodio::Source
types. I was hoping to be able to do aBox<dyn Decodable>
type setup but it just doesn't work. I'm also a little out of my depth here so maybe I am missing something, or maybe I am just tackling this API change completely wrong. Anyway, your feedback would be appreciated!