Closed vyfor closed 3 days ago
such as
total_duration()
, are not available inSink
correct, I speculate because a sink can have multiple sources in it and it would be unclear what total_duration()
should return. That can easily be solved but no one has had the time or need I think. You can easily adress it by checking total_duration before you push something into a Sink.
I was also wondering if it's possible to modify the source in real-time, for instance, by applying filters?
You can certainly build something that does that using rodio. It would be a bit of work. Take a look at the Source
trait. Anything implementing Source
can be played by a sink. The object implementing Source
is free to do whatever it wants in its implementation as long as it can give the Sink
a sample when it asks for one.
You can set up some communication to your Source
implementing object to control what it does from outside the Sink.
Have you however taken a look at https://crates.io/crates/kira? Its a bit less extensible then rodio but has real time modification of the filters/effects applied to a source as a main goal.
oh and take a look at periodic_access for an example of how its used open the source for Sink.
Hello, I have a question regarding accessing the underlying source of a sink, in my case, I'm using a
Decoder
. It appears that some functions implemented inSource
, such astotal_duration()
, are not available inSink
(assuming that it's possible to query the currently playing source). I was also wondering if it's possible to modify the source in real-time, for instance, by applying filters? If not, one potential solution I considered is to reconstruct the source and seek it back to the previous position. Though, I am curious if there might be a more efficient approach.