In the case of a failure within miniaudio on the function: ma_convert_frames, the dynamic memory allocated for the `data` variable will leak on the early return.
* Flip release of buffer;
First it needs to be taken out of the processing chain, then it can be released. The inverse of the initialization.
* Add mutex locks to audio buffer functions; Separate those used from both threads
* Flip release of buffer;
First it needs to be taken out of the processing chain, then it can be released. The inverse of the initialization.
* Remove TODO marker; The buffer is in stopped state and its data won't be accessed
* Add mutex locks to music/stream functions directly operating on buffer
* Secure UpdateMusicStream/PlayMusicStream/UpdateAudioStream;
This change is twofold:
* Add locks to UpdateMusicStream/UpdateAudioStream (second one needed separation)
* Remove unnecessary hack to restart music - inlining the statements resulted in a no-op
Especially the second part made it easier to ensure thread-safety overall
* Remove redundant check; Already checked at beginning of function
`char *txtData = (char *)RL_CALLOC(waveDataSize * 6 + 2000, sizeof(char));`
assumes every chunk being added to txtData is 6 bytes. This is not always true, sometimes a newline is involved and the data becomes 12 bytes instead, and this can cause a random segfault.
This commit changes `6` to `12`, and explains why in the comment.
Additionally added a volume assignment from old to new as currently there is no way to get the volume of a sound and the AudioBuffer struct is not reachable from user code due to opaque definition.
It feels a little unfinished when you can SetMasterVolume but can't
really Get it. So to finish the symmetry here is the GetMasterVolume
implementation.
* Add a function to clone a sound and share data with another sound.
* rename items based on feedback
* PR Feedback, use custom unload for sound alias, not variant of normal sound unloading