@@ -37,7 +37,7 @@ def __init__(self):
3737 if AudioFlinger ._instance :
3838 return
3939 AudioFlinger ._instance = self
40-
40+
4141 self ._i2s_pins = None # I2S pin configuration dict (created per-stream)
4242 self ._buzzer_instance = None # PWM buzzer instance
4343 self ._current_stream = None # Currently playing stream
@@ -377,12 +377,11 @@ def is_recording(self):
377377 bool: True if recording active, False otherwise
378378 """
379379 return self ._current_recording is not None and self ._current_recording .is_recording ()
380-
381-
380+
382381# ============================================================================
383- # Class methods that delegate to singleton instance
382+ # Class method forwarding to singleton instance
384383# ============================================================================
385- # Store original instance methods BEFORE we replace them with class methods
384+ # Store original instance methods before replacing them
386385_original_methods = {}
387386_methods_to_delegate = [
388387 'init' , 'play_wav' , 'play_rtttl' , 'record_wav' , 'stop' , 'pause' , 'resume' ,
@@ -393,10 +392,9 @@ def is_recording(self):
393392for method_name in _methods_to_delegate :
394393 _original_methods [method_name ] = getattr (AudioFlinger , method_name )
395394
396- # Helper function to create delegating class methods
395+ # Helper to create delegating class methods
397396def _make_class_method (method_name ):
398397 """Create a class method that delegates to the singleton instance."""
399- # Capture the original method in the closure
400398 original_method = _original_methods [method_name ]
401399
402400 @classmethod
@@ -406,7 +404,7 @@ def class_method(cls, *args, **kwargs):
406404
407405 return class_method
408406
409-
410407# Attach class methods to AudioFlinger
411408for method_name in _methods_to_delegate :
412409 setattr (AudioFlinger , method_name , _make_class_method (method_name ))
410+
0 commit comments