@@ -104,8 +104,10 @@ public GamelogicEngineLamp[] RequestedLamps {
104104 [ NonSerialized ] private BallManager _ballManager ;
105105 [ NonSerialized ] private PlayfieldComponent _playfieldComponent ;
106106
107- [ SerializeReference ] private PinMameGame _game ;
107+ [ NonSerialized ] private readonly List < PinMameLampInfo > _changedLamps = new ( ) ;
108+ [ NonSerialized ] private readonly List < PinMameLampInfo > _changedGIs = new ( ) ;
108109
110+ [ SerializeReference ] private PinMameGame _game ;
109111
110112 private Dictionary < string , GamelogicEngineSwitch > _switches = new ( ) ;
111113 private Dictionary < int , string > _pinMameIdToSwitchIdMappings = new ( ) ;
@@ -177,21 +179,23 @@ private void Update()
177179 }
178180
179181 // lamps
180- foreach ( var changedLamp in _pinMame . GetChangedLamps ( ) ) {
182+ _pinMame . GetChangedLamps ( _changedLamps ) ;
183+ foreach ( var changedLamp in _changedLamps ) {
181184 if ( _pinMameIdToLampIdMapping . ContainsKey ( changedLamp . Id ) ) {
182185 //Logger.Info($"[PinMAME] <= lamp {changedLamp.Id}: {changedLamp.Value}");
183186 OnLampChanged ? . Invoke ( this , new LampEventArgs ( _lamps [ _pinMameIdToLampIdMapping [ changedLamp . Id ] ] . Id , changedLamp . Value ) ) ;
184187 }
185188 }
186189
187190 // gi
188- foreach ( var changedGi in _pinMame . GetChangedGIs ( ) ) {
191+ _pinMame . GetChangedGIs ( _changedGIs ) ;
192+ foreach ( var changedGi in _changedGIs ) {
189193 if ( _pinMameIdToLampIdMapping . ContainsKey ( changedGi . Id ) ) {
190194 //Logger.Info($"[PinMAME] <= gi {changedGi.Id}: {changedGi.Value}");
191195 OnLampChanged ? . Invoke ( this , new LampEventArgs ( _lamps [ _pinMameIdToLampIdMapping [ changedGi . Id ] ] . Id , changedGi . Value , LampSource . GI ) ) ;
192- } else {
193- Debug . Log ( $ "No GI { changedGi . Id } found.") ;
194- }
196+ } /* else {
197+ Logger.Info ($"No GI {changedGi.Id} found.");
198+ }*/
195199 }
196200 }
197201
@@ -545,7 +549,7 @@ private int OnAudioUpdated(IntPtr framePtr, int frameSize)
545549 if ( _audioNumSamplesInput > 100000 ) {
546550 // var delta = AudioSettings.dspTime - _audioInputStart;
547551 // var queueMs = System.Math.Round(_audioQueue.Count * (double)_audioInfo.SamplesPerFrame / _audioInfo.SampleRate * 1000);
548- //Debug.Log ($"INPUT: {System.Math.Round(_audioNumSamplesInput / delta)} - {_audioQueue.Count} in queue ({queueMs}ms)");
552+ // Logger.Info ($"INPUT: {System.Math.Round(_audioNumSamplesInput / delta)} - {_audioQueue.Count} in queue ({queueMs}ms)");
549553 _audioInputStart = AudioSettings . dspTime ;
550554 _audioNumSamplesInput = 0 ;
551555 }
@@ -594,7 +598,7 @@ private void OnAudioFilterRead(float[] data, int channels)
594598 _audioNumSamplesOutput += data . Length / channels ;
595599 if ( _audioNumSamplesOutput > 100000 ) {
596600 //var delta = AudioSettings.dspTime - _audioOutputStart;
597- //Debug.Log ($"OUTPUT: {System.Math.Round(_audioNumSamplesOutput / delta)}");
601+ //Logger.Info ($"OUTPUT: {System.Math.Round(_audioNumSamplesOutput / delta)}");
598602 _audioOutputStart = AudioSettings . dspTime ;
599603 _audioNumSamplesOutput = 0 ;
600604 }
0 commit comments