RSound icon indicating copy to clipboard operation
RSound copied to clipboard

Request to implement pstream-stop and pstream-pause

Open benoid opened this issue 8 years ago • 4 comments

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!

benoid avatar Feb 02 '17 18:02 benoid

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.

jbclements avatar Feb 02 '17 22:02 jbclements

Thanks!

benoid avatar Feb 02 '17 22:02 benoid

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

benoid avatar Feb 03 '17 01:02 benoid

I'm not going to close this actually. I think there is still a need for a method to stop a pstream.

benoid avatar Feb 13 '17 03:02 benoid