Another experimental sound change.

This commit is contained in:
Storm Dragon
2025-09-19 00:44:25 -04:00
parent 6daa243710
commit d364ce28ef
3 changed files with 49 additions and 16 deletions

View File

@@ -289,14 +289,18 @@ def _play_dialog_sound(entry, dialog_config, sounds):
if hasattr(sounds, 'sounds') and sound_to_play in sounds.sounds:
# Sound class instance (like from libstormgames Sound class)
sound_obj = sounds.sounds[sound_to_play]
channel = sound_obj.play()
from .sound import get_available_channel
channel = get_available_channel()
channel.play(sound_obj)
sound_duration = sound_obj.get_length()
if sound_duration > 0:
pygame.time.wait(int(sound_duration * 1000))
elif isinstance(sounds, dict) and sound_to_play in sounds:
# Dictionary of pygame sound objects (like from initialize_gui)
sound_obj = sounds[sound_to_play]
channel = sound_obj.play()
from .sound import get_available_channel
channel = get_available_channel()
channel.play(sound_obj)
sound_duration = sound_obj.get_length()
if sound_duration > 0:
pygame.time.wait(int(sound_duration * 1000))