diff --git a/research/miniaudio_engine.h b/research/miniaudio_engine.h index 73c4d94c..a3772980 100644 --- a/research/miniaudio_engine.h +++ b/research/miniaudio_engine.h @@ -1678,6 +1678,7 @@ MA_API ma_result ma_engine_play_sound(ma_engine* pEngine, const char* pFilePath, #ifndef MA_NO_RESOURCE_MANAGER MA_API ma_result ma_sound_init_from_file(ma_engine* pEngine, const char* pFilePath, ma_uint32 flags, ma_async_notification* pNotification, ma_sound_group* pGroup, ma_sound* pSound); +MA_API ma_result ma_sound_init_from_file_w(ma_engine* pEngine, const wchar_t* pFilePath, ma_uint32 flags, ma_async_notification* pNotification, ma_sound_group* pGroup, ma_sound* pSound); #endif MA_API ma_result ma_sound_init_from_data_source(ma_engine* pEngine, ma_data_source* pDataSource, ma_uint32 flags, ma_sound_group* pGroup, ma_sound* pSound); MA_API void ma_sound_uninit(ma_sound* pSound); @@ -9582,7 +9583,7 @@ static ma_result ma_sound_init_from_data_source_internal(ma_engine* pEngine, ma_ } #ifndef MA_NO_RESOURCE_MANAGER -MA_API ma_result ma_sound_init_from_file(ma_engine* pEngine, const char* pFilePath, ma_uint32 flags, ma_async_notification* pNotification, ma_sound_group* pGroup, ma_sound* pSound) +MA_API ma_result ma_sound_init_from_file_internal(ma_engine* pEngine, const char* pFilePath, const wchar_t* pFilePathW, ma_uint32 flags, ma_async_notification* pNotification, ma_sound_group* pGroup, ma_sound* pSound) { ma_result result; @@ -9601,7 +9602,14 @@ MA_API ma_result ma_sound_init_from_file(ma_engine* pEngine, const char* pFilePa will get triggered before this function returns. This is OK, so long as the caller is aware of it and can avoid accessing the sound from within the notification. */ - result = ma_resource_manager_data_source_init(pEngine->pResourceManager, pFilePath, flags | MA_DATA_SOURCE_FLAG_WAIT_INIT, pNotification, &pSound->resourceManagerDataSource); + flags |= MA_DATA_SOURCE_FLAG_WAIT_INIT; + + if (pFilePath != NULL) { + result = ma_resource_manager_data_source_init(pEngine->pResourceManager, pFilePath, flags, pNotification, &pSound->resourceManagerDataSource); + } else { + result = ma_resource_manager_data_source_init_w(pEngine->pResourceManager, pFilePathW, flags, pNotification, &pSound->resourceManagerDataSource); + } + if (result != MA_SUCCESS) { return result; } @@ -9617,6 +9625,16 @@ MA_API ma_result ma_sound_init_from_file(ma_engine* pEngine, const char* pFilePa return MA_SUCCESS; } + +MA_API ma_result ma_sound_init_from_file(ma_engine* pEngine, const char* pFilePath, ma_uint32 flags, ma_async_notification* pNotification, ma_sound_group* pGroup, ma_sound* pSound) +{ + return ma_sound_init_from_file_internal(pEngine, pFilePath, NULL, flags, pNotification, pGroup, pSound); +} + +MA_API ma_result ma_sound_init_from_file_w(ma_engine* pEngine, const wchar_t* pFilePath, ma_uint32 flags, ma_async_notification* pNotification, ma_sound_group* pGroup, ma_sound* pSound) +{ + return ma_sound_init_from_file_internal(pEngine, NULL, pFilePath, flags, pNotification, pGroup, pSound); +} #endif MA_API ma_result ma_sound_init_from_data_source(ma_engine* pEngine, ma_data_source* pDataSource, ma_uint32 flags, ma_sound_group* pGroup, ma_sound* pSound)