how to pass a reference to sink append
i have this code

i saw that i cannot append more than once the same sink because source it doesnt have copy trait.
but how do i pass a reference to source or use multiple times ?
because i want to play the same sound multiple times. this way the program will be more efficient, instead of loading the file from disk everytime i want to the the audio file.
load once, play multiple times.
how can i achieve this ?
thanks in advance.
I have the same question. How can I reuse file data if all methods take it by value and move it?
~i guess clone is a temporary solution~
nope. Decoder doesnt implement Clone trait, see the source in docs
so i guess the solution would be to create a new instance of Decoder every new audio file (or for the same file?)
Create a new source based on rodio::static_buffer::StaticSamplesBuffer which, instead of accepting a &'static [S], accepts an Arc<Vec<S>> which allows you to load a file from disk once, decode it into a Vec<S> by taking advantage that all sources (including Decoders) are iterators, then wrap that Vec in an Arc which allows it to be read efficiently but not written from as many different sources at a time as you want.
So I proposed a workaround with buffered sources and clones. But the downside is that the types become painfully long as per the example : Buffered<TakeDuration<SkipDuration<Buffered<Decoder<BufReader<File>>>>>>
And also, the data is copied and not referenced. Unfortunately.
I believe the solution in #141 applies to this. It worked well in my case.