Noise detector added
This commit is contained in:
parent
9c89f8162c
commit
644a50aa11
7 changed files with 240 additions and 94 deletions
|
@ -81,6 +81,7 @@
|
|||
<Compile Include="Assets\Scripts\PdConnection\PdBackend.cs" />
|
||||
<Compile Include="Assets\Scripts\PdConnection\PdConstant.cs" />
|
||||
<Compile Include="Assets\Scripts\PdConnection\PdLevelBind.cs" />
|
||||
<Compile Include="Assets\Scripts\PdConnection\PdNoiseBind.cs" />
|
||||
<Compile Include="Assets\Scripts\PdConnection\PdProcess.cs" />
|
||||
<Compile Include="Assets\Scripts\PdConnection\PdReceiver.cs" />
|
||||
<Compile Include="Assets\Scripts\PdConnection\PdSender.cs" />
|
||||
|
|
|
@ -120,71 +120,6 @@ NavMeshSettings:
|
|||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &127705016
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 127705019}
|
||||
- component: {fileID: 127705017}
|
||||
m_Layer: 0
|
||||
m_Name: SpectrumBind
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &127705017
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 127705016}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 54ab37d032df403e881d6a7a78141815, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
pdBackend: {fileID: 987772533}
|
||||
selection:
|
||||
serializedVersion: 2
|
||||
x: 16.083769
|
||||
y: 75
|
||||
width: 97.84293
|
||||
height: 128
|
||||
energyChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 428795649}
|
||||
m_MethodName: set_Size
|
||||
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
|
||||
channel: 0
|
||||
--- !u!4 &127705019
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 127705016}
|
||||
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_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &267275365
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -368,6 +303,97 @@ MonoBehaviour:
|
|||
enableFptlForForwardOpaque: 0
|
||||
enableBigTilePrepass: 0
|
||||
isFptlEnabled: 0
|
||||
--- !u!1 &294529190
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 294529194}
|
||||
- component: {fileID: 294529193}
|
||||
- component: {fileID: 294529192}
|
||||
- component: {fileID: 294529191}
|
||||
m_Layer: 0
|
||||
m_Name: NoiseBall
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &294529191
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 294529190}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 87673687b9b5a10488287f6faecad9d0, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!23 &294529192
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 294529190}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: f044463ea66a19c47aef13261142b54e, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 0
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
--- !u!33 &294529193
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 294529190}
|
||||
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!4 &294529194
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 294529190}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 3.496, y: 0, z: 3.25}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &409530998
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -647,11 +673,11 @@ Transform:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 428795648}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 3.25}
|
||||
m_LocalPosition: {x: -6.14, y: 0, z: 3.25}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 3
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &987772532
|
||||
GameObject:
|
||||
|
@ -663,6 +689,8 @@ GameObject:
|
|||
m_Component:
|
||||
- component: {fileID: 987772534}
|
||||
- component: {fileID: 987772533}
|
||||
- component: {fileID: 987772536}
|
||||
- component: {fileID: 987772535}
|
||||
m_Layer: 0
|
||||
m_Name: PdBackend
|
||||
m_TagString: Untagged
|
||||
|
@ -682,7 +710,12 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 3ba69cee3466a304d9d570268f717413, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
mainPatch: analyzer.pd
|
||||
midiMessageReceived:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
midiClockReceived:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
samplePlayback: 0
|
||||
--- !u!4 &987772534
|
||||
Transform:
|
||||
|
@ -698,3 +731,65 @@ Transform:
|
|||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &987772535
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 987772532}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ec32b42d27978a247b42723238f38255, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
pdbackend: {fileID: 987772533}
|
||||
channel: 1
|
||||
noiseLevelChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 294529191}
|
||||
m_MethodName: set_Size
|
||||
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
|
||||
--- !u!114 &987772536
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 987772532}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 54ab37d032df403e881d6a7a78141815, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
pdBackend: {fileID: 987772533}
|
||||
selection:
|
||||
serializedVersion: 2
|
||||
x: 16.083769
|
||||
y: 75
|
||||
width: 97.84293
|
||||
height: 128
|
||||
energyChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 428795649}
|
||||
m_MethodName: set_Size
|
||||
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
|
||||
channel: 0
|
||||
|
|
|
@ -9,6 +9,7 @@ namespace cylvester
|
|||
public interface IPdBackend
|
||||
{
|
||||
IPdArray LevelArray { get; }
|
||||
IPdArray NoiseArray { get; }
|
||||
IPdArrayContainer SpectrumArrayContainer{ get; }
|
||||
IPdArrayContainer WaveformArrayContainer{ get; }
|
||||
void SendState(IStateManager manager);
|
||||
|
@ -29,6 +30,7 @@ namespace cylvester
|
|||
private IDspController dspController_;
|
||||
|
||||
public IPdArray LevelArray { get; private set; }
|
||||
public IPdArray NoiseArray { get; private set; }
|
||||
public IPdArrayContainer SpectrumArrayContainer { get; private set; }
|
||||
public IPdArrayContainer WaveformArrayContainer { get; private set; }
|
||||
|
||||
|
@ -40,12 +42,18 @@ namespace cylvester
|
|||
|
||||
private void Awake()
|
||||
{
|
||||
LevelArray = new PdArray("level", PdConstant.NumMaxInputChannels);
|
||||
NoiseArray = new PdArray("noise", PdConstant.NumMaxInputChannels);
|
||||
SpectrumArrayContainer = new PdArrayContainer("fft_");
|
||||
WaveformArrayContainer = new PdArrayContainer("wave_");
|
||||
LevelArray = new PdArray("level", PdConstant.NumMaxInputChannels);
|
||||
|
||||
|
||||
updaters_ = new List<IUpdater>
|
||||
{(IUpdater) LevelArray, (IUpdater) SpectrumArrayContainer, (IUpdater) WaveformArrayContainer};
|
||||
{
|
||||
(IUpdater) LevelArray,
|
||||
(IUpdater) NoiseArray,
|
||||
(IUpdater) SpectrumArrayContainer,
|
||||
(IUpdater) WaveformArrayContainer
|
||||
};
|
||||
|
||||
pdSender_ = new PdSender(PdConstant.ip, PdConstant.sendPort);
|
||||
pdReceiver_ = new PdReceiver(PdConstant.receivedPort);
|
||||
|
|
29
UnityProject/Assets/Scripts/PdConnection/PdNoiseBind.cs
Normal file
29
UnityProject/Assets/Scripts/PdConnection/PdNoiseBind.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace cylvester
|
||||
{
|
||||
[System.Serializable]
|
||||
public class NoiseEvent : UnityEvent<float>
|
||||
{
|
||||
}
|
||||
|
||||
public class PdNoiseBind : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private PdBackend pdbackend;
|
||||
[SerializeField, Range(1, 16)] private int channel = 1;
|
||||
[SerializeField] private NoiseEvent noiseLevelChanged;
|
||||
private float noise_;
|
||||
|
||||
void Update()
|
||||
{
|
||||
var noise = pdbackend.NoiseArray.Data[channel - 1];
|
||||
|
||||
if (noise_ != noise)
|
||||
{
|
||||
noise_ = noise;
|
||||
noiseLevelChanged.Invoke(noise_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
UnityProject/Assets/Scripts/PdConnection/PdNoiseBind.cs.meta
Normal file
11
UnityProject/Assets/Scripts/PdConnection/PdNoiseBind.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ec32b42d27978a247b42723238f38255
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -275,16 +275,6 @@ Roses_Front.wav \; TimbreID_Test.wav \;;
|
|||
#X text 429 140 sample CC;
|
||||
#X msg 417 201 send 176 \$1 \$2;
|
||||
#X text 416 223 176... control channel 1;
|
||||
#N canvas 695 332 450 300 level 0;
|
||||
#X obj 90 182 table level 16;
|
||||
#X obj 89 152 shmem level 16;
|
||||
#X obj 89 127 r shmemupdate;
|
||||
#X obj 213 182 table noise 16;
|
||||
#X obj 213 154 shmem noise 16;
|
||||
#X obj 213 128 r shmemupdate;
|
||||
#X connect 2 0 1 0;
|
||||
#X connect 5 0 4 0;
|
||||
#X restore 405 71 pd level;
|
||||
#X obj 6 194 midirealtimein;
|
||||
#X obj 242 41 netreceive -u 54345;
|
||||
#X obj 598 90 cnv 15 500 60 empty current Outro 20 12 0 45 -204786
|
||||
|
@ -403,6 +393,16 @@ samples/kick.wav kick \, read -resize samples/closed.wav closed;
|
|||
#X connect 23 0 3 0;
|
||||
#X restore 879 442 pd timbreID_example;
|
||||
#X obj 321 320 r netsend;
|
||||
#N canvas 695 332 450 300 shmem 0;
|
||||
#X obj 90 182 table level 16;
|
||||
#X obj 89 152 shmem level 16;
|
||||
#X obj 89 127 r shmemupdate;
|
||||
#X obj 213 182 table noise 16;
|
||||
#X obj 213 154 shmem noise 16;
|
||||
#X obj 213 128 r shmemupdate;
|
||||
#X connect 2 0 1 0;
|
||||
#X connect 5 0 4 0;
|
||||
#X restore 405 71 pd shmem;
|
||||
#X connect 0 0 2 0;
|
||||
#X connect 0 1 2 1;
|
||||
#X connect 0 2 2 2;
|
||||
|
@ -434,12 +434,12 @@ samples/kick.wav kick \, read -resize samples/closed.wav closed;
|
|||
#X connect 17 0 20 0;
|
||||
#X connect 18 0 20 0;
|
||||
#X connect 20 0 11 0;
|
||||
#X connect 23 0 14 0;
|
||||
#X connect 24 0 8 0;
|
||||
#X connect 26 0 32 0;
|
||||
#X connect 27 0 28 0;
|
||||
#X connect 28 0 11 0;
|
||||
#X connect 30 0 31 0;
|
||||
#X connect 22 0 14 0;
|
||||
#X connect 23 0 8 0;
|
||||
#X connect 25 0 31 0;
|
||||
#X connect 26 0 27 0;
|
||||
#X connect 27 0 11 0;
|
||||
#X connect 29 0 30 0;
|
||||
#X connect 30 0 11 0;
|
||||
#X connect 31 0 11 0;
|
||||
#X connect 32 0 11 0;
|
||||
#X connect 37 0 11 0;
|
||||
#X connect 36 0 11 0;
|
||||
|
|
|
@ -64,15 +64,16 @@ files used in this help file., f 22;
|
|||
#X obj 303 432 f;
|
||||
#X obj 322 485 list prepend send;
|
||||
#X obj 322 516 list trim;
|
||||
#X obj 633 121 specFlatness~ 512;
|
||||
#X obj 633 202 tabwrite noise;
|
||||
#X obj 714 152 loadbang;
|
||||
#X obj 714 177 f \$1, f 6;
|
||||
#X obj 633 121 zeroCrossing~ 512;
|
||||
#X obj 633 85 r shmemupdate;
|
||||
#X connect 0 0 1 0;
|
||||
#X connect 0 0 7 0;
|
||||
#X connect 0 0 11 0;
|
||||
#X connect 0 0 13 0;
|
||||
#X connect 0 0 30 0;
|
||||
#X connect 0 0 33 0;
|
||||
#X connect 3 0 4 0;
|
||||
#X connect 3 0 6 0;
|
||||
#X connect 3 0 7 0;
|
||||
|
@ -99,6 +100,7 @@ files used in this help file., f 22;
|
|||
#X connect 27 0 26 0;
|
||||
#X connect 28 0 29 0;
|
||||
#X connect 29 0 24 0;
|
||||
#X connect 30 0 31 0;
|
||||
#X connect 32 0 33 0;
|
||||
#X connect 33 0 31 1;
|
||||
#X connect 31 0 32 0;
|
||||
#X connect 32 0 30 1;
|
||||
#X connect 33 0 30 0;
|
||||
#X connect 34 0 33 0;
|
||||
|
|
Loading…
Reference in a new issue