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

Tracking issue for redesigning the Sink API #619

Open
dvdsk opened this issue Sep 16, 2024 · 2 comments
Open

Tracking issue for redesigning the Sink API #619

dvdsk opened this issue Sep 16, 2024 · 2 comments
Labels
breaking Proposed change that would break the public API enhancement

Comments

@dvdsk
Copy link
Collaborator

dvdsk commented Sep 16, 2024

There are currently two seperate PR's that expand on the Sink's functionality to be more easily used as a 'playlist':

This issue is to discuss a new Sink which supports both those applications, maybe by merging those PR's or by making breaking changes to the current Sink.

This should take #613 into account.

@dvdsk dvdsk added enhancement breaking Proposed change that would break the public API labels Sep 16, 2024
@teliosdev
Copy link

I think having append return a type that allows the user to register interest in when the sound is finished playing, whether that's sync or async. You may be able to avoid exposing channels at all with this, as the returned (opaque) type can have fn wait(&self) (which blocks the calling thread until the sound is done playing), and async fn stopped(&self), which only completes when the sound is done.

This also allows extension in the future to perform acts upon the specific sound, if that's desired, as well.

You can have this type take &self instead of &mut self by replacing the use of std::sync::mpsc with a Mutex/Condvar for the blocking API. For the async API, you may be able to get away with an AtomicBool/AtomicWaker.

@dvdsk
Copy link
Collaborator Author

dvdsk commented Sep 21, 2024

We might not strictly need an append with interest since there is EmptyCallback. You could append this to the sink after the sound of interest then you would get a callback fired when the source is done.

This is hard to find, so some documentation effort may be needed. Even then it might be worth wile handling this in the sink via an append_with_callback that does append(source) then append(emptycallback).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Proposed change that would break the public API enhancement
Projects
None yet
Development

No branches or pull requests

2 participants