Skip to content

How can I Cache ma_sound's into memory? #846

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

You must be logged in to vote

miniaudio supports reference counting. You can just initialize a ma_sound object and hold onto it for as long as you need. That way the reference count will never hit 0 and will never be unloaded.

However, your map is wrong. You need to remember this trip hazard from the documentation:

In miniaudio, objects are transparent structures. Unlike many other libraries, there are no handles to opaque objects which means you need to allocate memory for objects yourself. In the examples presented in this documentation you will often see objects declared on the stack. You need to be careful when translating these examples to your own code so that you don't accidentally declare your objects on the …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by m1maker
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
Converted from issue

This discussion was converted from issue #845 on May 06, 2024 22:07.