Skip to content

Calling Decoder Init From File Multiple Times Without Uninit between? #546

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

You must be logged in to vote

Each call to ma_decoder_init_*() must be matched up with a call to ma_decoder_uninit(). Each ma_decoder object is entirely self-contained and independent.

Consider loading the raw file data into memory and then using ma_decoder_init_memory(). That does not make a copy of the data so you can have multiple decoders efficiently. You just need to make sure the buffer stays valid for the life of all of your decoders.

You could also use the resource manager to help you with managing all of that stuff.

Replies: 1 comment 1 reply

Comment options

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

Answer selected by hiraz01
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