add midi logger

This commit is contained in:
Chikashi Miyama 2019-10-26 22:45:33 +02:00
parent cf59b7f739
commit 386757c9d7
6 changed files with 81 additions and 9 deletions

View file

@ -121,6 +121,9 @@
<Reference Include="UnityEngine.XR.LegacyInputHelpers"> <Reference Include="UnityEngine.XR.LegacyInputHelpers">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Library/ScriptAssemblies/UnityEngine.XR.LegacyInputHelpers.dll</HintPath> <HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Library/ScriptAssemblies/UnityEngine.XR.LegacyInputHelpers.dll</HintPath>
</Reference> </Reference>
<Reference Include="Unity.Rider.Editor">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Library/ScriptAssemblies/Unity.Rider.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary"> <Reference Include="Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Library/ScriptAssemblies/Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary.dll</HintPath> <HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Library/ScriptAssemblies/Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary.dll</HintPath>
</Reference> </Reference>
@ -163,9 +166,6 @@
<Reference Include="com.unity.multiplayer-hlapi.Runtime"> <Reference Include="com.unity.multiplayer-hlapi.Runtime">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Library/ScriptAssemblies/com.unity.multiplayer-hlapi.Runtime.dll</HintPath> <HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Library/ScriptAssemblies/com.unity.multiplayer-hlapi.Runtime.dll</HintPath>
</Reference> </Reference>
<Reference Include="Unity.Rider.Editor">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Library/ScriptAssemblies/Unity.Rider.Editor.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AIModule"> <Reference Include="UnityEngine.AIModule">
<HintPath>C:/Program Files/Unity_2019.2.8f1/Editor/Data/Managed/UnityEngine/UnityEngine.AIModule.dll</HintPath> <HintPath>C:/Program Files/Unity_2019.2.8f1/Editor/Data/Managed/UnityEngine/UnityEngine.AIModule.dll</HintPath>
</Reference> </Reference>

View file

@ -142,6 +142,7 @@
<Compile Include="Assets\Scripts\Math\Threshold.cs" /> <Compile Include="Assets\Scripts\Math\Threshold.cs" />
<Compile Include="Assets\Scripts\PdConnection\DspController.cs" /> <Compile Include="Assets\Scripts\PdConnection\DspController.cs" />
<Compile Include="Assets\Scripts\PdConnection\ISpectrumGenerator.cs" /> <Compile Include="Assets\Scripts\PdConnection\ISpectrumGenerator.cs" />
<Compile Include="Assets\Scripts\PdConnection\MidiLogger.cs" />
<Compile Include="Assets\Scripts\PdConnection\MidiParser.cs" /> <Compile Include="Assets\Scripts\PdConnection\MidiParser.cs" />
<Compile Include="Assets\Scripts\PdConnection\PdArray.cs" /> <Compile Include="Assets\Scripts\PdConnection\PdArray.cs" />
<Compile Include="Assets\Scripts\PdConnection\PdArrayContainer.cs" /> <Compile Include="Assets\Scripts\PdConnection\PdArrayContainer.cs" />
@ -344,6 +345,9 @@
<Reference Include="UnityEngine.XR.LegacyInputHelpers"> <Reference Include="UnityEngine.XR.LegacyInputHelpers">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Library/ScriptAssemblies/UnityEngine.XR.LegacyInputHelpers.dll</HintPath> <HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Library/ScriptAssemblies/UnityEngine.XR.LegacyInputHelpers.dll</HintPath>
</Reference> </Reference>
<Reference Include="Unity.Rider.Editor">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Library/ScriptAssemblies/Unity.Rider.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary"> <Reference Include="Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Library/ScriptAssemblies/Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary.dll</HintPath> <HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Library/ScriptAssemblies/Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary.dll</HintPath>
</Reference> </Reference>
@ -386,9 +390,6 @@
<Reference Include="com.unity.multiplayer-hlapi.Runtime"> <Reference Include="com.unity.multiplayer-hlapi.Runtime">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Library/ScriptAssemblies/com.unity.multiplayer-hlapi.Runtime.dll</HintPath> <HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Library/ScriptAssemblies/com.unity.multiplayer-hlapi.Runtime.dll</HintPath>
</Reference> </Reference>
<Reference Include="Unity.Rider.Editor">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Library/ScriptAssemblies/Unity.Rider.Editor.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AIModule"> <Reference Include="UnityEngine.AIModule">
<HintPath>C:/Program Files/Unity_2019.2.8f1/Editor/Data/Managed/UnityEngine/UnityEngine.AIModule.dll</HintPath> <HintPath>C:/Program Files/Unity_2019.2.8f1/Editor/Data/Managed/UnityEngine/UnityEngine.AIModule.dll</HintPath>
</Reference> </Reference>

View file

@ -222,6 +222,7 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 1261823481} - component: {fileID: 1261823481}
- component: {fileID: 1261823480} - component: {fileID: 1261823480}
- component: {fileID: 1261823482}
m_Layer: 0 m_Layer: 0
m_Name: PdBackend m_Name: PdBackend
m_TagString: Untagged m_TagString: Untagged
@ -241,11 +242,22 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 3ba69cee3466a304d9d570268f717413, type: 3} m_Script: {fileID: 11500000, guid: 3ba69cee3466a304d9d570268f717413, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
onControlMessageReceived: midiMessageReceived:
m_PersistentCalls: m_PersistentCalls:
m_Calls: m_Calls:
- m_Target: {fileID: 265790068} - m_Target: {fileID: 265790068}
m_MethodName: OnControlMessageReceived m_MethodName: OnMidiMessageReceived
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 1261823482}
m_MethodName: OnMidiMessageReceived
m_Mode: 0 m_Mode: 0
m_Arguments: m_Arguments:
m_ObjectArgument: {fileID: 0} m_ObjectArgument: {fileID: 0}
@ -270,6 +282,21 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 2 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1261823482
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1261823479}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 41f237c64f02a2241a30c5c0b5c087e6, type: 3}
m_Name:
m_EditorClassIdentifier:
logAll: 0
logFiltered: 0
filterStatusByte: 176
--- !u!1 &1461024797 --- !u!1 &1461024797
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -348,7 +375,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1461024797} m_GameObject: {fileID: 1461024797}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: -0.18, z: -2.08} m_LocalPosition: {x: 0, y: -0.18, z: -14.47}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}

View file

@ -0,0 +1,25 @@
using UnityEngine;
namespace cylvester
{
public class MidiLogger : MonoBehaviour
{
[SerializeField] private bool logAll;
[SerializeField] private bool logFiltered;
[SerializeField, Range(128, 255)] private int filterStatusByte = 128;
public void OnMidiMessageReceived(MidiMessage mes)
{
if(logAll)
Debug.Log("MIDI Received: " + mes);
if(logFiltered)
{
if (mes.Status == filterStatusByte)
{
Debug.Log("Filtered MIDI Received: " + mes);
}
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 41f237c64f02a2241a30c5c0b5c087e6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -12,6 +12,14 @@ namespace cylvester
public byte Status; public byte Status;
public byte Data1; public byte Data1;
public byte Data2; public byte Data2;
public override string ToString()
{
var statusStr = Status.ToString();
var data1Str = Data1.ToString();
var data2Str = Data2.ToString();
return statusStr + " " +data1Str + " " +data2Str;
}
} }
public interface IMidiParser : IDisposable public interface IMidiParser : IDisposable
{ {