RustAudio / rodio

Rust audio playback library
Apache License 2.0
1.78k stars 231 forks source link

Should `Decoder` be cached? #583

Closed feois closed 5 months ago

feois commented 5 months ago

Context: I am trying to create a music player

IDK how is it implemented internally, is it inefficient to use new Decoder every time thus the need of caching or is it completely fine?

dvdsk commented 5 months ago

whats the context? Do you need multiple decoder's for a single audio file?

feois commented 5 months ago

whats the context? Do you need multiple decoder's for a single audio file?

No, I mean that if audio is frequently played, does it help to cache the Decoder rather than dropping it after it played. Sorry if this is a dumb question, I don't actually know what Decoder does (i.e. is it in real time or not)

dvdsk commented 5 months ago

Ahhh, I understand now. In the context of a music player you need not worry about it. Depending on the codec the decoder might do some IO on creation but that is quite quick and should not be a problem.

feois commented 5 months ago

Ahhh, I understand now. In the context of a music player you need not worry about it. Depending on the codec the decoder might do some IO on creation but that is quite quick and should not be a problem.

Thanks for the helpful reply!