Initialize an ma_sound
from a file, with notification callbacks
#637
-
Thank you for a fantastic library! I recently switched from FMOD core and in several ways the experience has been far better. I'm looking for a way to initialize an I can add a fence, but the callback mechanism works much better in my case. I'd like this because I want to read and store the length of the audio clip, for which I need the sound/data source to be completely decoded. I'm loading asynchronously. So to put it simply, is there a built-in way to add a notification callback when initializing a sound from a file? I could create my own version of Thanks! EDIT: I found that by using |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
At first when I was reading I was very confused because I thought it was strange that you wouldn't just do the exact same thing with There's no easy way to do what you're after. I'll have to figure out a solution for this and report back. |
Beta Was this translation helpful? Give feedback.
-
I've gone ahead and pushed a change to the dev branch. I can't change the To use it, you would do something like this: ma_sound_config config = ma_sound_config_init_2(pEngine);
config.pFilePath = pFilePath;
config.flags = flags;
config.initNotifications.done.pNotification = &myNotification;
result = ma_sound_init_ex(pEngine, &config, &sound); It's a bit tedious, but it's the best I can do for now. The Note that I've not had a chance to properly test this yet. |
Beta Was this translation helpful? Give feedback.
I've gone ahead and pushed a change to the dev branch. I can't change the
ma_sound_init_from_file()
API because I'm not ready to do a breaking API change, however I've got it so it should work withma_sound_init_ex()
.To use it, you would do something like this:
It's a bit tedious, but it's the best I can do for now. The
myNotification
will be you custom object that extends fromma_async_notification_callbacks
.Note that I've not had a chance to properly test this yet.