fixxed buffer
This commit is contained in:
+7
-2
@@ -31,8 +31,13 @@ def create_app():
|
||||
init_bluetooth()
|
||||
|
||||
# pygame initialisieren (einmalig)
|
||||
pygame.mixer.init(frequency=44100, size=-16, channels=2, buffer=512)
|
||||
pygame.mixer.set_num_channels(16) # genug parallele Kanäle für BG + Effekte
|
||||
from config import Config
|
||||
pygame.mixer.pre_init(frequency=Config.AUDIO_FREQ,
|
||||
size=Config.AUDIO_SIZE,
|
||||
channels=Config.AUDIO_CHANNELS,
|
||||
buffer=Config.AUDIO_BUFFER)
|
||||
pygame.mixer.init()
|
||||
pygame.mixer.set_num_channels(Config.AUDIO_NUM_CHANNELS) # genug parallele Kanäle für BG + Effekte
|
||||
pygame.mixer.music.set_volume(0.8) # Standard-Lautstärke (für Legacy-Fälle)
|
||||
app.logger.info("pygame initialisiert")
|
||||
|
||||
|
||||
+7
-2
@@ -18,9 +18,14 @@ audio_lock = threading.Lock()
|
||||
loaded_sounds = {}
|
||||
|
||||
def _ensure_mixer():
|
||||
from config import Config
|
||||
if not pygame.mixer.get_init():
|
||||
pygame.mixer.init(frequency=44100, size=-16, channels=2, buffer=512)
|
||||
pygame.mixer.set_num_channels(16)
|
||||
pygame.mixer.pre_init(frequency=Config.AUDIO_FREQ,
|
||||
size=Config.AUDIO_SIZE,
|
||||
channels=Config.AUDIO_CHANNELS,
|
||||
buffer=Config.AUDIO_BUFFER)
|
||||
pygame.mixer.init()
|
||||
pygame.mixer.set_num_channels(Config.AUDIO_NUM_CHANNELS)
|
||||
|
||||
def _load_sound(file_path):
|
||||
if file_path in loaded_sounds:
|
||||
|
||||
Reference in New Issue
Block a user