Skip to content

Commit

Permalink
Use OnDispose and fix a debug log statement
Browse files Browse the repository at this point in the history
  • Loading branch information
Nytra committed Jul 20, 2024
1 parent da3974b commit 5091b96
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions ProjectObsidian/Components/Devices/MIDI_CC_Value.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ protected override void OnStart()
}
}

protected override void OnPrepareDestroy()
protected override void OnDispose()
{
base.OnPrepareDestroy();
base.OnDispose();
if (_device != null)
{
_device.Control -= OnControl;
Expand Down
6 changes: 3 additions & 3 deletions ProjectObsidian/Components/Devices/MIDI_InputDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ private async void ReleaseDeviceAsync()
_inputDevice = null;
}

protected override void OnPrepareDestroy()
protected override void OnDispose()
{
base.OnPrepareDestroy();
base.OnDispose();
if (_inputDevice != null)
{
ReleaseDeviceAsync();
Expand Down Expand Up @@ -197,7 +197,7 @@ private void OnMessageReceived(object sender, MidiReceivedEventArgs args)
var events = MidiEvent.Convert(args.Data, args.Start, args.Length);
foreach (var e in events)
{
UniLog.Log(e.ToString());
if (DEBUG) UniLog.Log(e.ToString());
RunSynchronously(() =>
{
_lastEvent.Value = e.ToString();
Expand Down
4 changes: 2 additions & 2 deletions ProjectObsidian/Components/Devices/MIDI_PitchWheel_Value.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ protected override void OnStart()
}
}

protected override void OnPrepareDestroy()
protected override void OnDispose()
{
base.OnPrepareDestroy();
base.OnDispose();
if (_device != null)
{
_device.PitchWheel -= OnPitchWheel;
Expand Down

0 comments on commit 5091b96

Please sign in to comment.