Closed OriginTwo closed 2 years ago
You need to post your initialization code.
It seems that I've solved the problem.
I have a function that load the sound for me, it looks something like this:
ma_sound load_sound(ma_engine *engine, const char *filepath)
{
ma_sound sound = {0};
ma_result result = ma_sound_init_from_file(engine, filepath, flags, NULL, NULL, &sound);
return sound;
}
What I did was change it to look something like this:
void load_sound(ma_sound *sound, ma_engine *engine, const char *filepath)
{
ma_result result = ma_sound_init_from_file(engine, filepath, flags, NULL, NULL, sound);
}
Yep, the ma_sound
structure is a transparent struct, not a handle. As soon as the function returns that object will end up getting destroyed. You need to manage the lifetime of the ma_sound
object yourself.
Hello, I'm having an issue with loading ma_sound. The program always crash when I call 'ma_sound_init_from_file()'.
It usually crashes here:
But sometimes, it crashes because of an assertion failure: