Some small improvements to the resource manager.

These changes are in preparation for fixing some issues relating to
retrieval of channel counts from data sources. The problem relates to
the asynchronous nature of the resource manager and how data sources
may be in the middle of loading when trying to initialize a sound which
results in the channel count not yet being available. The channel count
is necessary in order for the engine to be able to convert the data
source to the channel count of the final output.
This commit is contained in:
David Reid
2021-01-10 22:38:00 +10:00
parent 085728fdcd
commit 369fb6fd8f
2 changed files with 137 additions and 59 deletions
+1 -8
View File
@@ -18,13 +18,6 @@ void on_sound_loaded(ma_async_notification* pNotification, int code)
//ma_uint64 lengthInPCMFrames;
(void)pNotification;
if (code == MA_NOTIFICATION_INIT) {
} else if (code == MA_NOTIFICATION_COMPLETE) {
}
(void)code;
/*
@@ -85,7 +78,7 @@ int main(int argc, char** argv)
loadNotification.cb.onSignal = on_sound_loaded;
loadNotification.pSound = &sound;
result = ma_sound_init_from_file(&engine, argv[1], MA_DATA_SOURCE_FLAG_DECODE /*| MA_DATA_SOURCE_FLAG_ASYNC | MA_DATA_SOURCE_FLAG_STREAM*/, &loadNotification, NULL, &sound);
result = ma_sound_init_from_file(&engine, argv[1], MA_DATA_SOURCE_FLAG_DECODE | MA_DATA_SOURCE_FLAG_ASYNC /*| MA_DATA_SOURCE_FLAG_STREAM*/, &loadNotification, NULL, &sound);
if (result != MA_SUCCESS) {
printf("Failed to load sound: %s\n", argv[1]);
ma_engine_uninit(&engine);