Skip to content

Does miniaudio require pointer stability? #1007

Closed Answered by aganm
aganm asked this question in Q&A
Discussion options

You must be logged in to vote

I got my answer by reading the discord server: the answer is yes, it requires pointer stability.

https://discord.com/channels/712952679415939085/712952679881637931/1337547239517589664

This part is definitely wrong and needs to change: std::vector<std::vector<ma_sound>> soundInstances;. You are storing a list of ma_sound object in a vector. When you call push_back(), internally there might be a memory reallocation which will change the address of the sounds. This will result in a crash. The other issue is InitializeSound() is using a locally declared ma_sound object. As soon as the function returns that will be destroyed since it's on the stack. In addition, you are pushing a copy of the …

Replies: 1 comment

Comment options

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