v1.2: Log zeigt gewaehlte Sequenz (nie zweimal dieselbe), Anleitung vor Moduswahl (jede Runde), Roll-Sound-Kanal reserviert (Fix kein Sound), frueheres Abbremsen + Snap-Fenster 160px, 10s Cooldown am Ende, Sprueche nach Prozent (sayings.py), 56 Tests.

This commit is contained in:
Project Bridge committed 2026-11-01 11:38:16 +00:00
1 parent d970185e75
commit e3a0c5a57d
11 files changed
+319 -37

No files matched your search

+17 -4
View File
@@ -87,14 +87,18 @@ class Assets:
except pygame.error:
continue
if "roll" in self.sounds:
self.sounds["roll"].set_volume(0.3)
self.sounds["roll"].set_volume(0.5)
for name in ("place", "fail"):
if name in self.sounds:
self.sounds[name].set_volume(0.6)
if "zip" in self.sounds:
self.sounds["zip"].set_volume(1.0)
pygame.mixer.set_num_channels(max(8, pygame.mixer.get_num_channels()))
self._roll_channel = pygame.mixer.Channel(1)
# Kanal 0 bleibt für den Roll-Sound reserviert, damit ihn kein
# automatisch vergebener Einzelklang wegschnappt.
pygame.mixer.set_reserved(2)
self._roll_channel = pygame.mixer.Channel(0)
pygame.mixer.unpause()
def _load_beeps(self) -> None:
if not pygame.mixer.get_init():
@@ -144,8 +148,9 @@ class Assets:
if sound is None:
return
if name == "roll" and self._roll_channel is not None:
if not self._roll_channel.get_busy():
self._roll_channel.play(sound, loops=loops)
# Immer neu starten: ein evtl. noch laufender Roll (z. B. aus der
# vorherigen Runde) darf den neuen nicht blockieren.
self._roll_channel.play(sound, loops=loops)
return
sound.play(loops=loops)
@@ -157,6 +162,14 @@ class Assets:
if pygame.mixer.get_init():
pygame.mixer.stop()
def audio_info(self) -> str:
"""Kurzauskunft fürs Start-Log."""
init = pygame.mixer.get_init()
if not init:
return "Audio: nicht verfügbar (kein Ausgabegerät?)"
rate, _, channels = init
return f"Audio: {rate} Hz, {channels} Kanäle, {len(self.sounds)} Sounds geladen"
# ------------------------------------------------------------------
# Töne ohne Dateien (für das Intro)
# ------------------------------------------------------------------