Skip to content

The number of threads spawned by ma_engine_init(NULL, &engine); #798

Answered by mackron
lukasz-szczur asked this question in Q&A
Discussion options

You must be logged in to vote

That should work, but it's something I would consider bad practice. The typical way to do it is have one ma_engine that you initialize once at application start up, and then uninitialize once at shutdown. Then for every sound you want to play, just initialize and uninitialize a ma_sound object. It should be one ma_engine to many ma_sounds.

Every time you initialize a ma_engine there's a lot of things going on like initializing a connection to the backend for playback, allocation of memory, starting threads, all that stuff. It's just unnecessary overhead.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@mackron
Comment options

Answer selected by lukasz-szczur
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants