Browse Source

working midi recorder

post-projects
Cailean Finn 1 year ago
parent
commit
d4726f2911
  1. 118
      Assets/Midi-Test.unity
  2. 8
      Assets/Recordings.meta
  3. 136
      Assets/Scripts/MidiMap.cs
  4. 133
      Assets/Timeline/MIDI Timeline.playable
  5. 4650
      Assets/VFX/111.anim
  6. 18
      Assets/VFX/KeyTest.cs
  7. 11
      Assets/VFX/KeyTest.cs.meta
  8. 18
      ProjectSettings/BurstAotSettings_StandaloneWindows.json
  9. 6
      ProjectSettings/CommonBurstAotSettings.json

118
Assets/Midi-Test.unity

@ -727,6 +727,28 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_VFX: {fileID: 256521901}
f_PLifeMax: 20
f_PRate: 70000
f_PNoise: 5
f_PSpeed: 5
f_PRatio: 1
f_PGravity: -0
f_PFreq: 5
f_PTurb: 5
f_LRate: 10000
f_LLifetime: 5
f_LToggle: 0
f_LRange: 1
f_LThickness: 1
f_BSize: 1
f_BRate: 10000
f_BFreq: 10
f_BLifetime: 10
f_BTurb: 10
f_BToggle: 0
f_BForceX: 0
f_BForceY: 0
f_BForceZ: 0
--- !u!114 &256521898
MonoBehaviour:
m_ObjectHideFlags: 2
@ -825,31 +847,31 @@ VisualEffect:
m_PropertySheet:
m_Float:
m_Array:
- m_Value: 5
- m_Value: 0
m_Name: Noise
m_Overridden: 1
- m_Value: 6.614173
- m_Value: 0
m_Name: Point Lifetime Max
m_Overridden: 1
- m_Value: 20944.883
- m_Value: 0
m_Name: Point Rate
m_Overridden: 1
- m_Value: 4.96063
- m_Value: 0
m_Name: Turbulences
m_Overridden: 1
- m_Value: 5
- m_Value: 0
m_Name: Turbulences Frequency
m_Overridden: 1
- m_Value: 1
- m_Value: 0
m_Name: Turbulences Ratio
m_Overridden: 1
- m_Value: 5
- m_Value: 0
m_Name: Turbulences Speed
m_Overridden: 1
- m_Value: 0.05
m_Name: Antenna Point Size
m_Overridden: 1
- m_Value: 42.3
- m_Value: 0
m_Name: Pont Lifetime Min
m_Overridden: 1
- m_Value: 100
@ -858,22 +880,22 @@ VisualEffect:
- m_Value: 0
m_Name: Bubble Alpha
m_Overridden: 1
- m_Value: 1
- m_Value: 0
m_Name: Bubble Lifetime
m_Overridden: 1
- m_Value: 100
- m_Value: 0
m_Name: Bubble Rate
m_Overridden: 1
- m_Value: 0.02
- m_Value: 0
m_Name: Bubble Size
m_Overridden: 1
- m_Value: 1
- m_Value: 0
m_Name: Bubble Turbulences
m_Overridden: 1
- m_Value: 1
- m_Value: 0
m_Name: Bubble Turbulences Frequency
m_Overridden: 1
- m_Value: 3
- m_Value: 0
m_Name: Line Lifetime
m_Overridden: 1
- m_Value: 0
@ -882,16 +904,16 @@ VisualEffect:
- m_Value: 0.02
m_Name: Line Point Size
m_Overridden: 1
- m_Value: 0.1
- m_Value: 0
m_Name: Line Range
m_Overridden: 1
- m_Value: 1000
- m_Value: 0
m_Name: Line Rate
m_Overridden: 1
- m_Value: 0
m_Name: Line Smoothness
m_Overridden: 1
- m_Value: 0.02
- m_Value: 0
m_Name: Line Thickness
m_Overridden: 1
- m_Value: 0
@ -928,10 +950,10 @@ VisualEffect:
m_Array: []
m_Vector3f:
m_Array:
- m_Value: {x: 0, y: 0, z: 0}
- m_Value: {x: 0, y: -0, z: 0}
m_Name: Gravity Point
m_Overridden: 1
- m_Value: {x: 0, y: 1, z: 0}
- m_Value: {x: 0, y: -0, z: 0}
m_Name: Bubble Force
m_Overridden: 1
m_Vector4f:
@ -983,10 +1005,10 @@ VisualEffect:
- m_Value: 1
m_Name: Toggle Trail
m_Overridden: 1
- m_Value: 0
- m_Value: 1
m_Name: Toggle Bubble
m_Overridden: 1
- m_Value: 0
- m_Value: 1
m_Name: Toggle Line
m_Overridden: 1
- m_Value: 1
@ -1002,7 +1024,7 @@ Animator:
m_GameObject: {fileID: 256521889}
m_Enabled: 1
m_Avatar: {fileID: 0}
m_Controller: {fileID: 9100000, guid: 42d8e2c08205891489b0f3df2e67f992, type: 2}
m_Controller: {fileID: 0}
m_CullingMode: 0
m_UpdateMode: 0
m_ApplyRootMotion: 0
@ -1517,6 +1539,55 @@ Transform:
- {fileID: 872902549}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1270603316
GameObject:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1270603318}
- component: {fileID: 1270603317}
m_Layer: 0
m_Name: Unity-RecorderBindings
m_TagString: EditorOnly
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1270603317
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1270603316}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a24bc7e8573847adbdf1198360b3c794, type: 3}
m_Name:
m_EditorClassIdentifier:
m_References:
m_Keys:
- f9a8a3e2c5aeb4144b78925129772cef
m_Values:
- {fileID: 256521889}
--- !u!4 &1270603318
Transform:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1270603316}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1595781237
GameObject:
m_ObjectHideFlags: 0
@ -1551,8 +1622,6 @@ PlayableDirector:
m_SceneBindings:
- key: {fileID: 2246285225922495411, guid: 219b44f685a6aa1428df393ac25c6755, type: 2}
value: {fileID: 1726262886}
- key: {fileID: -4974505950630656619, guid: 219b44f685a6aa1428df393ac25c6755, type: 2}
value: {fileID: 256521902}
m_ExposedReferences:
m_References: []
--- !u!4 &1595781239
@ -2987,3 +3056,4 @@ SceneRoots:
- {fileID: 1141447085}
- {fileID: 1225025837}
- {fileID: 1595781239}
- {fileID: 1270603318}

8
Assets/Recordings.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0f8aee1097a01eb4586e94fbd54929cb
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

136
Assets/Scripts/MidiMap.cs

@ -4,6 +4,7 @@ using UnityEngine.InputSystem;
using UnityEngine.VFX;
[ExecuteInEditMode]
[System.Serializable]
public class MidiMap : MonoBehaviour
{
public VisualEffect m_VFX;
@ -35,42 +36,40 @@ public class MidiMap : MonoBehaviour
private int m_BToggle;
float f_PLifeMax = 20f;
float f_PRate = 70000f;
float f_PNoise = 5f;
float f_PSpeed = 5f;
float f_PRatio = 1f;
float f_PGravity = 0f;
float f_PFreq = 5f;
float f_PTurb = 5f;
public float f_PLifeMax = 20f;
public float f_PRate = 70000f;
public float f_PNoise = 5f;
public float f_PSpeed = 5f;
public float f_PRatio = 1f;
public float f_PGravity = 0f;
public float f_PFreq = 5f;
public float f_PTurb = 5f;
float f_LRate = 10000f;
float f_LLifetime = 5f;
bool f_LToggle = false;
float f_LRange = 1f;
float f_LThickness = 1f;
public float f_LRate = 10000f;
public float f_LLifetime = 5f;
public bool f_LToggle = false;
public float f_LRange = 1f;
public float f_LThickness = 1f;
float f_BSize = 1f;
float f_BRate = 10000f;
float f_BFreq = 10f;
float f_BLifetime = 10f;
float f_BTurb = 10f;
bool f_BToggle = false;
public float f_BSize = 1f;
public float f_BRate = 10000f;
public float f_BFreq = 10f;
public float f_BLifetime = 10f;
public float f_BTurb = 10f;
public bool f_BToggle = false;
float f_BForceX = 0f;
float f_BForceY = 0f;
float f_BForceZ = 0f;
public float f_BForceX = 0f;
public float f_BForceY = 0f;
public float f_BForceZ = 0f;
float testMIDI = 0f;
float testMIDInoise = 0f;
private float m_Slider = 0f;
private bool m_BSlider = false;
private float m_Potent = 0f;
private bool m_BPotent = false;
float m_Slider = 0f;
bool m_BSlider = false;
float m_Potent = 0f;
float[] m_SliderIn = new float[8];
float[] m_PotIn = new float[8];
private float[] m_SliderIn = new float[8];
private float[] m_PotIn = new float[8];
void Start()
{
@ -142,6 +141,33 @@ public class MidiMap : MonoBehaviour
m_BSlider = true;
}
if (device.controlNumber == 58)
{
if (m_BPotent)
{
m_BPotent = false;
return;
}
// Left
m_Potent -= 1;
if (m_Potent < 0) { m_Potent = 2; }
m_BPotent = true;
}
if (device.controlNumber == 59)
{
// Right
if (m_BPotent)
{
m_BPotent = false;
return;
}
m_Potent += 1;
if (m_Potent > 2) { m_Potent = 0; }
m_BPotent = true;
}
if (device.controlNumber < 8)
@ -155,7 +181,8 @@ public class MidiMap : MonoBehaviour
m_PotIn[device.controlNumber - 16] = (float)change;
}
Debug.Log(device.controlNumber);
// Debug.Log(device.controlNumber);
Debug.Log(m_Slider + ":" + m_Potent);
if (device.controlNumber == 32)
{
@ -167,7 +194,6 @@ public class MidiMap : MonoBehaviour
};
};
}
void Update()
@ -223,6 +249,52 @@ public class MidiMap : MonoBehaviour
m_VFX.SetVector3(m_BForce, new Vector3(0, -9.8f * m_SliderIn[5], 0));
}
if (m_Potent == 0)
{
// Points
m_VFX.SetFloat(m_PRate, f_PRate * m_PotIn[0]);
m_VFX.SetFloat(m_PLifeMax, f_PLifeMax * m_PotIn[1]);
m_VFX.SetFloat(m_PNoise, f_PNoise * m_PotIn[2]);
m_VFX.SetFloat(m_PTurb, f_PTurb * m_PotIn[3]);
m_VFX.SetFloat(m_PSpeed, f_PSpeed * m_PotIn[4]);
m_VFX.SetFloat(m_PRatio, f_PRatio * m_PotIn[5]);
m_VFX.SetFloat(m_PSpeed, f_PSpeed * m_PotIn[6]);
m_VFX.SetFloat(m_PFreq, f_PFreq * m_PotIn[7]);
m_VFX.SetVector3(m_PGravity, new Vector3(0, f_PGravity, 0));
}
if (m_Potent == 1)
{
// Points
m_VFX.SetBool(m_LToggle, true);
m_VFX.SetFloat(m_LRate, f_LRate * m_PotIn[0]);
m_VFX.SetFloat(m_LLifetime, f_LLifetime * m_PotIn[1]);
m_VFX.SetFloat(m_LRange, f_LRange * m_PotIn[2]);
m_VFX.SetFloat(m_LThickness, f_LThickness * m_PotIn[3]);
//m_VFX.SetFloat(m_PSpeed, f_PSpeed * m_SliderIn[4]);
//m_VFX.SetFloat(m_PRatio, f_PRatio * m_SliderIn[5]);
//m_VFX.SetFloat(m_PSpeed, f_PSpeed * m_SliderIn[6]);
//m_VFX.SetFloat(m_PFreq, f_PFreq * m_SliderIn[7]);
}
if (m_Potent == 2)
{
m_VFX.SetBool(m_BToggle, true);
m_VFX.SetFloat(m_BRate, f_BRate * m_PotIn[0]);
m_VFX.SetFloat(m_BSize, f_BSize * m_PotIn[1]);
m_VFX.SetFloat(m_BFreq, f_BFreq * m_PotIn[2]);
m_VFX.SetFloat(m_BLifetime, f_BLifetime * m_PotIn[3]);
m_VFX.SetFloat(m_BTurb, f_BTurb * m_PotIn[4]);
m_VFX.SetVector3(m_BForce, new Vector3(0, -9.8f * m_PotIn[5], 0));
}
}
}

133
Assets/Timeline/MIDI Timeline.playable

@ -1,115 +1,5 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-4974505950630656619
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d21dcc2386d650c4597f3633c75a1f98, type: 3}
m_Name: Animation Track (1)
m_EditorClassIdentifier:
m_Version: 3
m_AnimClip: {fileID: 0}
m_Locked: 0
m_Muted: 0
m_CustomPlayableFullTypename:
m_Curves: {fileID: 0}
m_Parent: {fileID: 11400000}
m_Children: []
m_Clips:
- m_Version: 1
m_Start: 25.766666666666666
m_ClipIn: 0
m_Asset: {fileID: 5157459536936784988}
m_Duration: 61.94999999999986
m_TimeScale: 1
m_ParentTrack: {fileID: -4974505950630656619}
m_EaseInDuration: 0
m_EaseOutDuration: 0
m_BlendInDuration: -1
m_BlendOutDuration: -1
m_MixInCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
m_MixOutCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
m_BlendInCurveMode: 0
m_BlendOutCurveMode: 0
m_ExposedParameterNames: []
m_AnimationCurves: {fileID: 0}
m_Recordable: 0
m_PostExtrapolationMode: 1
m_PreExtrapolationMode: 1
m_PostExtrapolationTime: Infinity
m_PreExtrapolationTime: 25.766666666666666
m_DisplayName: 111
m_Markers:
m_Objects: []
m_InfiniteClipPreExtrapolation: 0
m_InfiniteClipPostExtrapolation: 0
m_InfiniteClipOffsetPosition: {x: 0, y: 0, z: 0}
m_InfiniteClipOffsetEulerAngles: {x: 0, y: 0, z: 0}
m_InfiniteClipTimeOffset: 0
m_InfiniteClipRemoveOffset: 0
m_InfiniteClipApplyFootIK: 1
mInfiniteClipLoop: 0
m_MatchTargetFields: 63
m_Position: {x: 0, y: 0, z: 0}
m_EulerAngles: {x: 0, y: 0, z: 0}
m_AvatarMask: {fileID: 0}
m_ApplyAvatarMask: 1
m_TrackOffset: 0
m_InfiniteClip: {fileID: 0}
m_OpenClipOffsetRotation: {x: 0, y: 0, z: 0, w: 1}
m_Rotation: {x: 0, y: 0, z: 0, w: 1}
m_ApplyOffsets: 0
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
@ -125,7 +15,6 @@ MonoBehaviour:
m_Version: 0
m_Tracks:
- {fileID: 2246285225922495411}
- {fileID: -4974505950630656619}
m_FixedDuration: 0
m_EditorSettings:
m_Framerate: 60
@ -264,25 +153,3 @@ MonoBehaviour:
m_Loop: 0
m_Version: 1
m_Rotation: {x: 0, y: 0, z: 0, w: 1}
--- !u!114 &5157459536936784988
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 030f85c3f73729f4f976f66ffb23b875, type: 3}
m_Name: AnimationPlayableAsset
m_EditorClassIdentifier:
m_Clip: {fileID: 7400000, guid: 98e8830020c7ac84387c25f8c364813a, type: 2}
m_Position: {x: 0, y: 0, z: 0}
m_EulerAngles: {x: 0, y: 0, z: 0}
m_UseTrackMatchFields: 1
m_MatchTargetFields: 63
m_RemoveStartOffset: 1
m_ApplyFootIK: 1
m_Loop: 0
m_Version: 1
m_Rotation: {x: 0, y: 0, z: 0, w: 1}

4650
Assets/VFX/111.anim

File diff suppressed because it is too large

18
Assets/VFX/KeyTest.cs

@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class KeyTest : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

11
Assets/VFX/KeyTest.cs.meta

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

18
ProjectSettings/BurstAotSettings_StandaloneWindows.json

@ -0,0 +1,18 @@
{
"MonoBehaviour": {
"Version": 4,
"EnableBurstCompilation": true,
"EnableOptimisations": true,
"EnableSafetyChecks": false,
"EnableDebugInAllBuilds": false,
"DebugDataKind": 1,
"EnableArmv9SecurityFeatures": false,
"CpuMinTargetX32": 0,
"CpuMaxTargetX32": 0,
"CpuMinTargetX64": 0,
"CpuMaxTargetX64": 0,
"CpuTargetsX32": 6,
"CpuTargetsX64": 72,
"OptimizeFor": 0
}
}

6
ProjectSettings/CommonBurstAotSettings.json

@ -0,0 +1,6 @@
{
"MonoBehaviour": {
"Version": 4,
"DisabledWarnings": ""
}
}
Loading…
Cancel
Save