1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-04 04:50:22 +00:00

Update func__sndopen() to use filepath_fix_directory()

This commit is contained in:
Samuel Gomes 2023-12-29 02:49:30 +05:30
parent cd5a60546f
commit 84b58c0fde
2 changed files with 4 additions and 3 deletions

View file

@ -109,7 +109,7 @@ const char *filepath_fix_directory(qbs *path) {
#endif
}
return (char *)path->chr;
return reinterpret_cast<char *>(path->chr);
}
/// @brief Changes the slashes in a file name / path to make it compatible with the OS

View file

@ -17,6 +17,7 @@
#define STB_VORBIS_HEADER_ONLY
#include "datetime.h"
#include "extras/stb_vorbis.c"
#include "filepath.h"
#include "miniaudio.h"
#include "mutex.h"
#include <algorithm>
@ -1754,8 +1755,8 @@ int32_t func__sndopen(qbs *fileName, qbs *requirements, int32_t passed) {
qbs_set(fileNameZ, qbs_add(fileName, qbs_new_txt_len("\0", 1))); // s1 = filename + CHR$(0)
// Forward the request to miniaudio to open the sound file
audioEngine.maResult = ma_sound_init_from_file(&audioEngine.maEngine, (const char *)fileNameZ->chr, audioEngine.soundHandles[handle]->maFlags, NULL,
NULL, &audioEngine.soundHandles[handle]->maSound);
audioEngine.maResult = ma_sound_init_from_file(&audioEngine.maEngine, filepath_fix_directory(fileNameZ), audioEngine.soundHandles[handle]->maFlags,
NULL, NULL, &audioEngine.soundHandles[handle]->maSound);
}
// If the sound failed to initialize, then free the handle and return INVALID_SOUND_HANDLE