fixxed alsa sound problems

This commit is contained in:
2026-10-05 11:33:37 +02:00
parent f7654fa8ea
commit 2e311119b0
10 changed files with 42 additions and 29 deletions
Binary file not shown.
+9 -6
View File
@@ -29,13 +29,16 @@ DEFAULT_MAX_PER_HOUR = 2
DEFAULT_WINDOW_SECONDS = 3600
def _ensure_mixer():
from config import Config
if not pygame.mixer.get_init():
pygame.mixer.pre_init(frequency=Config.AUDIO_FREQ,
size=Config.AUDIO_SIZE,
channels=Config.AUDIO_CHANNELS,
buffer=Config.AUDIO_BUFFER)
pygame.mixer.init()
init_args = {
'frequency': Config.AUDIO_FREQ,
'size': Config.AUDIO_SIZE,
'channels': Config.AUDIO_CHANNELS,
'buffer': Config.AUDIO_BUFFER,
}
if Config.AUDIO_DEVICE:
init_args['devicename'] = Config.AUDIO_DEVICE
pygame.mixer.init(**init_args)
pygame.mixer.set_num_channels(Config.AUDIO_NUM_CHANNELS)
def _load_sound(file_path):