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 do we play back animation and sound together #6

Open
glowmouse opened this issue Nov 27, 2024 · 0 comments
Open

How do we play back animation and sound together #6

glowmouse opened this issue Nov 27, 2024 · 0 comments

Comments

@glowmouse
Copy link
Member

Idea 1:

Add a non-blocking/ non async update/ service call to the sound sub-system, similar to what's already there, and call it when we're animating gifs. Servicing that is just stuffing the sound pipe, which sound be fast.

Idea 2:

I feel it's more Rust like to have the sound service be an async function, and to run both the animation playback and sound playback at the same time.

One thought would be something like std::sync::mpsc::channel, which is basically a safe pipe, with the main async task on the sender end of the pipe and a sound service on the receiver.

The main pipe would send commands like "start playing sound XXXX" to the the sound service, which would run in its own async thread. It might look something like

   start_sound( ANIMATION_SOUND_ID );  // does not block, not async
   play_animation( AIMATION_GIF_ID ); // 100% async task
   stop_sound();  // does not block, not async
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

1 participant