Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to stop a streaming sound? #79

Open
robtfm opened this issue Mar 18, 2024 · 2 comments
Open

how to stop a streaming sound? #79

robtfm opened this issue Mar 18, 2024 · 2 comments

Comments

@robtfm
Copy link

robtfm commented Mar 18, 2024

sorry if i'm missing something obvious.

i have a struct that implements Decoder which i wrap into a StreamingSoundData and send to AudioManager::play.

when the stream ends i return an error from decode, but kira continues to busy-wait poll the stream, burning cpu pretty hard.

i can't see a way to tell the audio manager to stop the handle, or to reply from the decoder that the stream has ended.

what should i do?

thanks

@robtfm
Copy link
Author

robtfm commented Mar 18, 2024

i now see i can stop the handle, sorry.

would it make sense for this to be automatic if the decoder returns an error? or have another mechanism for the decoder to report that the stream is finished?

@tesselode
Copy link
Owner

Indeed, that is an oversight. I'm not sure if there's any realistic scenarios where a decoder returns an error, but it can still continue decoding. So it might be best to just stop the sound on the first error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants