Skip to content

Commit 1bbaef7

Browse files
committed
lights: Add GI.
1 parent f4b368a commit 1bbaef7

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

VisualPinball.Engine.PinMAME.Unity/Runtime/PinMameGamelogicEngine.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,7 @@ public class PinMameGamelogicEngine : MonoBehaviour, IGamelogicEngine
4242
public const string DmdPrefix = "dmd";
4343
public const string SegDispPrefix = "display";
4444

45-
public PinMameGame Game {
46-
get => _game;
47-
set => _game = value;
48-
}
45+
public PinMameGame Game { get => _game; set => _game = value; }
4946

5047
[HideInInspector]
5148
public string romId = string.Empty;
@@ -174,6 +171,16 @@ private void Update()
174171
OnLampChanged?.Invoke(this, new LampEventArgs(_lamps[changedLamp.Id].Id, changedLamp.Value));
175172
}
176173
}
174+
175+
// gi
176+
foreach (var changedGi in _pinMame.GetChangedGIs()) {
177+
if (_lamps.ContainsKey(changedGi.Id)) {
178+
Logger.Info($"[PinMAME] <= gi {changedGi.Id}: {changedGi.Value}");
179+
OnLampChanged?.Invoke(this, new LampEventArgs(_lamps[changedGi.Id].Id, changedGi.Value, LampSource.GI));
180+
} else {
181+
Debug.Log($"No GI {changedGi.Id} found.");
182+
}
183+
}
177184
}
178185

179186
private void OnDisplayAvailable(int index, int displayCount, PinMameDisplayLayout displayLayout)
@@ -277,7 +284,7 @@ private int OnAudioUpdated(IntPtr framePtr, int frameSize)
277284
if (_audioNumSamplesInput > 100000) {
278285
var delta = AudioSettings.dspTime - _audioInputStart;
279286
var queueMs = System.Math.Round(_audioQueue.Count * (double)_audioInfo.SamplesPerFrame / _audioInfo.SampleRate * 1000);
280-
Debug.Log($"INPUT: {System.Math.Round(_audioNumSamplesInput / delta)} - {_audioQueue.Count} in queue ({queueMs}ms)");
287+
//Debug.Log($"INPUT: {System.Math.Round(_audioNumSamplesInput / delta)} - {_audioQueue.Count} in queue ({queueMs}ms)");
281288
_audioInputStart = AudioSettings.dspTime;
282289
_audioNumSamplesInput = 0;
283290
}
@@ -328,7 +335,7 @@ private void OnAudioFilterRead(float[] data, int channels)
328335
_audioNumSamplesOutput += data.Length / channels;
329336
if (_audioNumSamplesOutput > 100000) {
330337
var delta = AudioSettings.dspTime - _audioOutputStart;
331-
Debug.Log($"OUTPUT: {System.Math.Round(_audioNumSamplesOutput / delta)}");
338+
//Debug.Log($"OUTPUT: {System.Math.Round(_audioNumSamplesOutput / delta)}");
332339
_audioOutputStart = AudioSettings.dspTime;
333340
_audioNumSamplesOutput = 0;
334341
}

0 commit comments

Comments
 (0)