mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 11:40:13 +01:00
potentially fix certain audios not playing
This commit is contained in:
@@ -206,6 +206,10 @@ class AudioEngine:
|
|||||||
file_path_str = str(file_path).encode('utf-8')
|
file_path_str = str(file_path).encode('utf-8')
|
||||||
sound = lib.load_sound(file_path_str) # type: ignore
|
sound = lib.load_sound(file_path_str) # type: ignore
|
||||||
|
|
||||||
|
if not lib.is_sound_valid(sound): # type: ignore
|
||||||
|
file_path_str = str(file_path).encode('utf-8')
|
||||||
|
sound = lib.load_sound(file_path_str) # type: ignore
|
||||||
|
|
||||||
if lib.is_sound_valid(sound): # type: ignore
|
if lib.is_sound_valid(sound): # type: ignore
|
||||||
self.sounds[name] = sound
|
self.sounds[name] = sound
|
||||||
return name
|
return name
|
||||||
@@ -325,8 +329,13 @@ class AudioEngine:
|
|||||||
file_path_str = str(file_path).encode('cp932', errors='replace')
|
file_path_str = str(file_path).encode('cp932', errors='replace')
|
||||||
else:
|
else:
|
||||||
file_path_str = str(file_path).encode('utf-8')
|
file_path_str = str(file_path).encode('utf-8')
|
||||||
|
|
||||||
music = lib.load_music_stream(file_path_str) # type: ignore
|
music = lib.load_music_stream(file_path_str) # type: ignore
|
||||||
|
|
||||||
|
if not lib.is_music_valid(music): # type: ignore
|
||||||
|
file_path_str = str(file_path).encode('utf-8')
|
||||||
|
music = lib.load_music_stream(file_path_str) # type: ignore
|
||||||
|
|
||||||
if lib.is_music_valid(music): # type: ignore
|
if lib.is_music_valid(music): # type: ignore
|
||||||
self.music_streams[name] = music
|
self.music_streams[name] = music
|
||||||
logger.info(f"Loaded music stream from {file_path} as {name}")
|
logger.info(f"Loaded music stream from {file_path} as {name}")
|
||||||
|
|||||||
Reference in New Issue
Block a user