Skip to content

How to auto exit after audio is finished? #511

Answered by mackron
azkadev asked this question in Q&A
Discussion options

You must be logged in to vote

Can you explain in more detail what it is you're trying to achieve? Do you want to just play a sound and then exit the whole program when the sound finishes playing? If so, you need to periodically call ma_sound_at_end() to know when the sound has finished, but you won't be able to use ma_engine_play_sound() for that because it doesn't give you a ma_sound object. Instead you'll need to initialize a sound ma_sound object with ma_sound_init_from_file(). There's no way to wait for ma_engine_play_sound() to finish - that function plays the sound asynchronously (it returns straight away while the sound plays in the background).

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@azkadev
Comment options

@mackron
Comment options

Answer selected by azkadev
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants