RSound
RSound copied to clipboard
Request to implement pstream-stop and pstream-pause
Currently, the stop
procedure stops all sounds being played by RSound. Would it be possible to implement a stop procedure that could stop an individual pstream while allowing the others to continue playing?
Perhaps a pstream-stop
procedure could stop and clear the pstream, and a pstream-pause
procedure could stop the pstream without clearing it?
I'm not sure I am yet familiar enough with how RSound interacts with portaudio to implement this myself, but I'm willing to have a go at it, provided you can point me in the right direction on where in the code base to look.
Thanks!
That's not a super-functional interface, but yes, it's probably possible. I believe you want to take a look at sequencer.rkt, which (IIRC) is where all of the heap-queueing stuff happens. Stopping should be not-too-difficult. Pausing is going to be more difficult, because the queue times of all the current elements of the heap will have to be increased in order to re-start the stream.
Thanks!
I just implemented a procedure called pstream-clear
, which clears all queued rsounds from a given pstream. It doesn't abruptly stop any rsounds currently playing, but sound will stop once the current rsound is over.
I also added tests for the sequencer level procedure clear-all-sounds!
which deals directly with the heap. The test suite passes after the addition of the new functionality.
I submitted a pull request: https://github.com/jbclements/RSound/pull/29
I'm not going to close this actually. I think there is still a need for a method to stop a pstream.