@@ -283,12 +283,6 @@ def _init_display(self) -> pygame.Surface:
283283 os .environ ["SDL_VIDEODRIVER" ] = "fbcon"
284284 os .environ .setdefault ("SDL_FBDEV" , "/dev/fb0" )
285285
286- # Don't try to open ALSA — most handheld builds have no configured
287- # sound card on first boot, and pygame's audio init is noisy when it
288- # fails. Sound is opt-in via SDL_AUDIODRIVER if/when we add it.
289- os .environ .setdefault ("SDL_AUDIODRIVER" , "dummy" )
290-
291- # Init only the subsystems we use, so a missing audio device or
292286 # joystick doesn't sink the whole startup.
293287 pygame .display .init ()
294288 pygame .font .init ()
@@ -661,16 +655,30 @@ def play_notification(self) -> None:
661655 """Plays the system notification sound (assets/chat_notify.mp3)."""
662656 try :
663657 if not pygame .mixer .get_init ():
664- pygame .mixer .init ()
658+ # Ensure we have the pulse environment if available
659+ from bigbox import audio as _audio
660+ env = _audio ._pulse_env ()
661+ for k , v in env .items ():
662+ os .environ [k ] = v
663+
664+ try :
665+ pygame .mixer .init ()
666+ except Exception :
667+ # Fallback to ALSA if pulse fails
668+ os .environ ["SDL_AUDIODRIVER" ] = "alsa"
669+ pygame .mixer .init ()
665670
666671 if self ._notif_sound is None :
667672 p = Path (__file__ ).resolve ().parents [1 ] / "assets" / "chat_notify.mp3"
668673 if p .exists ():
669674 self ._notif_sound = pygame .mixer .Sound (str (p ))
670- self ._notif_sound .set_volume (0.5 )
675+ self ._notif_sound .set_volume (0.7 )
671676
672677 if self ._notif_sound :
678+ # Stop any currently playing notification before starting new one
679+ self ._notif_sound .stop ()
673680 self ._notif_sound .play ()
681+ print ("[app] notification played" )
674682 except Exception as e :
675683 print (f"[app] play_notification failed: { e } " )
676684
0 commit comments