@@ -146,6 +146,7 @@ def __init__(self, scenario: str = "basic.cfg"):
146146 self ._mouse_dx : float = 0.0
147147 self ._mouse_dy : float = 0.0
148148 self ._mouse_held : bool = False
149+ self ._audio_logged : bool = False
149150
150151 # Doom 1 scenarios use ExMy map format, but doom.cfg defaults to "map01"
151152 _DOOM1_SCENARIOS = {"doom.cfg" , "freedoom1.cfg" }
@@ -254,8 +255,9 @@ def _configure(self, scenario: str):
254255 self .game .set_audio_buffer_enabled (True )
255256 self .game .set_audio_sampling_rate (vzd .SamplingRate .SR_22050 )
256257 self .game .set_audio_buffer_size (4 ) # 4 tics of audio per step
257- except Exception :
258- pass
258+ print ("[audio] setup OK" )
259+ except Exception as e :
260+ print (f"[audio] setup FAILED: { e } " )
259261
260262 # --- Input handling (browser play) ---
261263
@@ -425,8 +427,14 @@ def _compress_frame(self, screen: np.ndarray) -> bytes:
425427 def _extract_audio (self , state ) -> bytes | None :
426428 """Extract audio PCM bytes from state, or None if unavailable/silent."""
427429 if state is None or state .audio_buffer is None :
430+ if not self ._audio_logged :
431+ print (f"[audio] buffer: { 'no state' if state is None else 'None' } " )
432+ self ._audio_logged = True
428433 return None
429434 ab = state .audio_buffer
435+ if not self ._audio_logged :
436+ print (f"[audio] buffer: shape={ ab .shape } , nonzero={ np .count_nonzero (ab )} " )
437+ self ._audio_logged = True
430438 if ab .size == 0 or np .count_nonzero (ab ) == 0 :
431439 return None
432440 # int16 stereo PCM, little-endian
0 commit comments