-
Are we meant to call ma_decoder_uninit everytime we call ma_decoder_init_file? I am working on a C++ class and I am currently planning on reusing an ma_decoder member which will be used to initialize different user loaded sound files. Will this cause a memory leak? Also, is there a good way to check if an ma_decoder has been initialized with one of the methods provided by miniaudio? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Each call to Consider loading the raw file data into memory and then using You could also use the resource manager to help you with managing all of that stuff. |
Beta Was this translation helpful? Give feedback.
Each call to
ma_decoder_init_*()
must be matched up with a call toma_decoder_uninit()
. Eachma_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.