This commit is contained in:
Chikashi Miyama 2019-10-05 14:18:52 +02:00
parent a2d9a37e55
commit d00d95859f
18 changed files with 914 additions and 26 deletions

View file

@ -59,10 +59,13 @@
<Compile Include="Assets\Scenes\Examples\Composition\script\BallMapping.cs" /> <Compile Include="Assets\Scenes\Examples\Composition\script\BallMapping.cs" />
<Compile Include="Assets\Scenes\Examples\Composition\script\RmsAnalyzer.cs" /> <Compile Include="Assets\Scenes\Examples\Composition\script\RmsAnalyzer.cs" />
<Compile Include="Assets\Scenes\Examples\PdBackend\script\BoomBall.cs" /> <Compile Include="Assets\Scenes\Examples\PdBackend\script\BoomBall.cs" />
<Compile Include="Assets\Scenes\Examples\PositionBind.cs" />
<Compile Include="Assets\Scenes\Examples\PostProcessing\script\BokehBind.cs" /> <Compile Include="Assets\Scenes\Examples\PostProcessing\script\BokehBind.cs" />
<Compile Include="Assets\Scenes\Examples\VisualEffectGraph\script\FlareBind.cs" /> <Compile Include="Assets\Scenes\Examples\VisualEffectGraph\script\FlareBind.cs" />
<Compile Include="Assets\Scenes\Examples\VisualEffectGraph\script\SmokeBind.cs" /> <Compile Include="Assets\Scenes\Examples\VisualEffectGraph\script\SmokeBind.cs" />
<Compile Include="Assets\Scripts\PdConnection\DspController.cs" /> <Compile Include="Assets\Scripts\PdConnection\DspController.cs" />
<Compile Include="Assets\Scripts\PdConnection\MidiParser.cs" />
<Compile Include="Assets\Scripts\PdConnection\PdReceiver.cs" />
<Compile Include="Assets\Scripts\PdConnection\SpectrumArrayContainer.cs" /> <Compile Include="Assets\Scripts\PdConnection\SpectrumArrayContainer.cs" />
<Compile Include="Assets\Scripts\PdConnection\SpectrumArraySelector.cs" /> <Compile Include="Assets\Scripts\PdConnection\SpectrumArraySelector.cs" />
<Compile Include="Assets\Scripts\PdConnection\ISpectrumGenerator.cs" /> <Compile Include="Assets\Scripts\PdConnection\ISpectrumGenerator.cs" />
@ -70,7 +73,7 @@
<Compile Include="Assets\Scripts\PdConnection\PdBackend.cs" /> <Compile Include="Assets\Scripts\PdConnection\PdBackend.cs" />
<Compile Include="Assets\Scripts\PdConnection\PdConstant.cs" /> <Compile Include="Assets\Scripts\PdConnection\PdConstant.cs" />
<Compile Include="Assets\Scripts\PdConnection\PdProcess.cs" /> <Compile Include="Assets\Scripts\PdConnection\PdProcess.cs" />
<Compile Include="Assets\Scripts\PdConnection\PdSocket.cs" /> <Compile Include="Assets\Scripts\PdConnection\PdSender.cs" />
<Compile Include="Assets\Scripts\PdConnection\PdSpectrumBind.cs" /> <Compile Include="Assets\Scripts\PdConnection\PdSpectrumBind.cs" />
<Compile Include="Assets\Scripts\PdConnection\SpectrumGeneratorPlayMode.cs" /> <Compile Include="Assets\Scripts\PdConnection\SpectrumGeneratorPlayMode.cs" />
<Compile Include="Assets\Scripts\PdConnection\WaveformTexture.cs" /> <Compile Include="Assets\Scripts\PdConnection\WaveformTexture.cs" />

View file

@ -7,6 +7,7 @@ namespace cylvester
public class PdBackendEditor : Editor public class PdBackendEditor : Editor
{ {
private PdBackend pdBackend_; private PdBackend pdBackend_;
private SerializedProperty onControlMessageReceivedProperty_;
private readonly string[] samples_ = private readonly string[] samples_ =
{ {
@ -29,13 +30,19 @@ namespace cylvester
public override void OnInspectorGUI () public override void OnInspectorGUI ()
{ {
serializedObject.Update();
pdBackend_ = (PdBackend) target; pdBackend_ = (PdBackend) target;
onControlMessageReceivedProperty_ = serializedObject.FindProperty("onControlMessageReceived");
EditorGUILayout.PropertyField(onControlMessageReceivedProperty_);
if (Application.isPlaying) if (Application.isPlaying)
{ {
RenderSamplePlayback(); RenderSamplePlayback();
Repaint(); Repaint();
} }
serializedObject.ApplyModifiedProperties();
} }
private void RenderSamplePlayback() private void RenderSamplePlayback()

View file

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

View file

@ -0,0 +1,649 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 512
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 256
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 1
m_PVRDenoiserTypeDirect: 1
m_PVRDenoiserTypeIndirect: 1
m_PVRDenoiserTypeAO: 1
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &265790067
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 265790071}
- component: {fileID: 265790070}
- component: {fileID: 265790069}
- component: {fileID: 265790068}
m_Layer: 0
m_Name: Sphere
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &265790068
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 265790067}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b159fbb376a54b99aa66ea53f9f29235, type: 3}
m_Name:
m_EditorClassIdentifier:
channel: 1
--- !u!23 &265790069
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 265790067}
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: 1
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 &265790070
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 265790067}
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &265790071
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 265790067}
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: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1261823479
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1261823481}
- component: {fileID: 1261823480}
m_Layer: 0
m_Name: PdBackend
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1261823480
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: 3ba69cee3466a304d9d570268f717413, type: 3}
m_Name:
m_EditorClassIdentifier:
onControlMessageReceived:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 265790068}
m_MethodName: OnControlMessageReceived
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
samplePlayback: 0
--- !u!4 &1261823481
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1261823479}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -10}
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 &1461024797
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1461024800}
- component: {fileID: 1461024799}
- component: {fileID: 1461024798}
- component: {fileID: 1461024801}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &1461024798
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1461024797}
m_Enabled: 1
--- !u!20 &1461024799
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1461024797}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 0
m_AllowMSAA: 0
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &1461024800
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1461024797}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: -0.18, z: -2.08}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1461024801
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1461024797}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 23c1ce4fb46143f46bc5cb5224c934f6, type: 3}
m_Name:
m_EditorClassIdentifier:
clearColorMode: 0
backgroundColorHDR: {r: 0.025, g: 0.07, b: 0.19, a: 0}
clearDepth: 1
volumeLayerMask:
serializedVersion: 2
m_Bits: 1
volumeAnchorOverride: {fileID: 0}
antialiasing: 0
SMAAQuality: 2
dithering: 0
stopNaNs: 0
physicalParameters:
m_Iso: 200
m_ShutterSpeed: 0.005
m_Aperture: 16
m_BladeCount: 5
m_Curvature: {x: 2, y: 11}
m_BarrelClipping: 0.25
m_Anamorphism: 0
flipYMode: 0
fullscreenPassthrough: 0
allowDynamicResolution: 0
customRenderingSettings: 0
invertFaceCulling: 0
probeLayerMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPathCustomFrameSettings:
bitDatas:
data1: 69284264935197
data2: 4539628424389459968
lodBias: 1
lodBiasMode: 0
maximumLODLevel: 0
maximumLODLevelMode: 0
renderingPathCustomFrameSettingsOverrideMask:
mask:
data1: 0
data2: 0
defaultFrameSettings: 0
m_Version: 5
m_ObsoleteRenderingPath: 0
m_ObsoleteFrameSettings:
overrides: 0
enableShadow: 0
enableContactShadows: 0
enableShadowMask: 0
enableSSR: 0
enableSSAO: 0
enableSubsurfaceScattering: 0
enableTransmission: 0
enableAtmosphericScattering: 0
enableVolumetrics: 0
enableReprojectionForVolumetrics: 0
enableLightLayers: 0
enableExposureControl: 1
diffuseGlobalDimmer: 0
specularGlobalDimmer: 0
shaderLitMode: 0
enableDepthPrepassWithDeferredRendering: 0
enableTransparentPrepass: 0
enableMotionVectors: 0
enableObjectMotionVectors: 0
enableDecals: 0
enableRoughRefraction: 0
enableTransparentPostpass: 0
enableDistortion: 0
enablePostprocess: 0
enableOpaqueObjects: 0
enableTransparentObjects: 0
enableRealtimePlanarReflection: 0
enableMSAA: 0
enableAsyncCompute: 0
runLightListAsync: 0
runSSRAsync: 0
runSSAOAsync: 0
runContactShadowsAsync: 0
runVolumeVoxelizationAsync: 0
lightLoopSettings:
overrides: 0
enableDeferredTileAndCluster: 0
enableComputeLightEvaluation: 0
enableComputeLightVariants: 0
enableComputeMaterialVariants: 0
enableFptlForForwardOpaque: 0
enableBigTilePrepass: 0
isFptlEnabled: 0
--- !u!1 &2049244779
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2049244781}
- component: {fileID: 2049244780}
- component: {fileID: 2049244783}
- component: {fileID: 2049244782}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &2049244780
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2049244779}
m_Enabled: 1
serializedVersion: 9
m_Type: 1
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 3.1415927
m_Range: 10
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 4
m_LightShadowCasterMode: 2
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &2049244781
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2049244779}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!114 &2049244782
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2049244779}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c6c2871f720b2af4e9210febdac74517, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Version: 1
shadowResolution: 512
shadowDimmer: 1
volumetricShadowDimmer: 1
shadowFadeDistance: 10000
contactShadows: 0
shadowTint: {r: 0, g: 0, b: 0, a: 1}
viewBiasMin: 0.2
viewBiasMax: 100
viewBiasScale: 1
normalBiasMin: 0.5
normalBiasMax: 0.5
normalBiasScale: 1
sampleBiasScale: 0
edgeLeakFixup: 0
edgeToleranceNormal: 1
edgeTolerance: 1
shadowCascadeCount: 4
shadowCascadeRatios:
- 0.05
- 0.2
- 0.3
shadowCascadeBorders:
- 0.2
- 0.2
- 0.2
- 0.2
shadowAlgorithm: 0
shadowVariant: 0
shadowPrecision: 0
--- !u!114 &2049244783
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2049244779}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7a68c43fe1f2a47cfa234b5eeaa98012, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 5
m_Version: 5
directionalIntensity: 3.1415927
punctualIntensity: 600
areaIntensity: 200
enableSpotReflector: 0
luxAtDistance: 1
m_InnerSpotPercent: 0
lightDimmer: 1
m_VolumetricDimmer: 1
lightUnit: 2
fadeDistance: 10000
affectDiffuse: 1
affectSpecular: 1
nonLightmappedOnly: 0
lightTypeExtent: 0
m_SpotLightShape: 0
shapeWidth: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 0.99
applyRangeAttenuation: 1
useOldInspector: 0
useVolumetric: 1
featuresFoldout: 1
showAdditionalSettings: 0
displayLightIntensity: 3.1415927
displayAreaLightEmissiveMesh: 0
areaLightCookie: {fileID: 0}
areaLightShadowCone: 120
useScreenSpaceShadows: 0
evsmExponent: 15
evsmLightLeakBias: 0
evsmVarianceBias: 0.00001
evsmBlurPasses: 0
lightLayers: 1
lightlayersMask: 1
linkShadowLayers: 1
shadowNearPlane: 0.1
shadowSoftness: 0.5
blockerSampleCount: 24
filterSampleCount: 16
minFilterSize: 0.00001
kernelSize: 5
lightAngle: 1
maxDepthBias: 0.001

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d36311f0d798d5b498edf48abc435ebc
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

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

View file

@ -0,0 +1,22 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace cylvester
{
public class PositionBind : MonoBehaviour
{
[SerializeField,Range(1,16)] private int channel = 1;
public void OnControlMessageReceived(ControlMessage mes)
{
if (mes.Channel == channel - 1)
{
var x = (mes.ControlNumber - 64) / 10f;
var y = (mes.ControlValue - 64) / 10f;
transform.position = new Vector3(x, y, 0f);
}
}
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b159fbb376a54b99aa66ea53f9f29235
timeCreated: 1570277140

View file

@ -7,18 +7,18 @@ namespace cylvester
public class DspController : IDspController public class DspController : IDspController
{ {
private IPdSocket socket_; private IPdSender sender_;
public DspController(IPdSocket socket) public DspController(IPdSender sender)
{ {
socket_ = socket; sender_ = sender;
} }
public bool State public bool State
{ {
set set
{ {
socket_.Send (new[]{(byte)PdMessage.Dsp, (byte)(value?1:0)}); sender_.Send (new[]{(byte)PdMessage.Dsp, (byte)(value?1:0)});
} }
} }
} }

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: aa0f61cbfcd442de8bf3e5331cbf09bd
timeCreated: 1570270050

View file

@ -0,0 +1,98 @@
using System;
using UnityEngine.Events;
namespace cylvester
{
[Serializable]
public class UnityControlEvent : UnityEvent<ControlMessage>
{}
public struct ControlMessage
{
public byte Channel;
public byte ControlNumber;
public byte ControlValue;
}
public interface IMidiParser : IDisposable
{
event Action<ControlMessage> ControlMessageReceived;
}
public class MidiParser : IMidiParser
{
private enum Accept
{
StatusByte,
DataByte1,
DataByte2
}
private struct MidiMessage
{
public byte Status;
public byte Data1;
public byte Data2;
}
private MidiMessage message_;
private Accept accept_ = Accept.StatusByte;
private readonly IPdReceiver pdReceiver_;
private readonly Action<byte[]> onDataReceived_;
public MidiParser(IPdReceiver pdReceiver)
{
pdReceiver_ = pdReceiver;
onDataReceived_ = (bytes) =>
{
foreach (var element in bytes)
{
if (element >= 128)
{
message_ = new MidiMessage {Status = element};
accept_ = Accept.DataByte1;
continue;
}
if (accept_ == Accept.DataByte1 && element <= 128)
{
message_.Data1 = element;
accept_ = Accept.DataByte2;
}
else if (accept_ == Accept.DataByte2 && element <= 128)
{
message_.Data2 = element;
Invoke();
accept_ = Accept.StatusByte;
}
}
};
pdReceiver_.DataReceived += onDataReceived_;
}
private void Invoke()
{
if (176 <= message_.Status || message_.Status <= 191)
{
var controlMessage = new ControlMessage
{
Channel = (byte) (message_.Status - 176),
ControlNumber = message_.Data1,
ControlValue = message_.Data2
};
ControlMessageReceived?.Invoke(controlMessage);
}
}
public void Dispose()
{
pdReceiver_.DataReceived -= onDataReceived_;
}
public event Action<ControlMessage> ControlMessageReceived;
}
}

View file

@ -1,5 +1,6 @@
using System; using System;
using UnityEngine; using UnityEngine;
using UnityEngine.Events;
namespace cylvester namespace cylvester
{ {
@ -11,48 +12,64 @@ namespace cylvester
public class PdBackend : MonoBehaviour, IPdBackend public class PdBackend : MonoBehaviour, IPdBackend
{ {
[SerializeField] UnityControlEvent onControlMessageReceived = null;
public int samplePlayback; public int samplePlayback;
private IUpdater spectrumArrayUpdater_; private IUpdater spectrumArrayUpdater_;
private IChangeObserver<int> samplePlaybackObserver_; private IChangeObserver<int> samplePlaybackObserver_;
private Action onSamplePlaybackChanged_;
private IPdSocket pdSocket_; private IPdSender pdSender_;
private IPdReceiver pdReceiver_;
private IMidiParser midiParser_;
private IDspController dspController_; private IDspController dspController_;
public ISpectrumArrayContainer SpectrumArrayContainer { get; private set; } public ISpectrumArrayContainer SpectrumArrayContainer { get; private set; }
private Action onSamplePlaybackChanged_;
private Action<ControlMessage> onControlMessageReceived_;
private void Awake() private void Awake()
{ {
SpectrumArrayContainer = new SpectrumArrayContainer(); SpectrumArrayContainer = new SpectrumArrayContainer();
spectrumArrayUpdater_ = (IUpdater) SpectrumArrayContainer; spectrumArrayUpdater_ = (IUpdater) SpectrumArrayContainer;
pdSocket_ = new PdSocket(PdConstant.ip, PdConstant.port);
dspController_ = new DspController(pdSocket_); pdSender_ = new PdSender(PdConstant.ip, PdConstant.sendPort);
pdReceiver_ = new PdReceiver(PdConstant.receivedPort);
midiParser_ = new MidiParser(pdReceiver_);
dspController_ = new DspController(pdSender_);
samplePlaybackObserver_ = new ChangeObserver<int>(samplePlayback); samplePlaybackObserver_ = new ChangeObserver<int>(samplePlayback);
onSamplePlaybackChanged_ = () => onSamplePlaybackChanged_ = () =>
{ {
pdSocket_.Send(new[]{(byte)PdMessage.SampleSound, (byte)samplePlayback}); pdSender_.Send(new[]{(byte)PdMessage.SampleSound, (byte)samplePlayback});
};
onControlMessageReceived_ = (message) =>
{
onControlMessageReceived.Invoke(message);
}; };
samplePlaybackObserver_.ValueChanged += onSamplePlaybackChanged_; samplePlaybackObserver_.ValueChanged += onSamplePlaybackChanged_;
dspController_.State = true; midiParser_.ControlMessageReceived += onControlMessageReceived_;
dspController_.State = true;
} }
private void OnDestroy() private void OnDestroy()
{ {
dspController_.State = false; dspController_.State = false;
pdSocket_?.Dispose(); pdSender_?.Dispose();
samplePlaybackObserver_.ValueChanged -= onSamplePlaybackChanged_; samplePlaybackObserver_.ValueChanged -= onSamplePlaybackChanged_;
midiParser_.ControlMessageReceived -= onControlMessageReceived_;
} }
public void Update() public void Update()
{ {
pdReceiver_.Update();
spectrumArrayUpdater_.Update(); spectrumArrayUpdater_.Update();
samplePlaybackObserver_.Value = samplePlayback; samplePlaybackObserver_.Value = samplePlayback;
} }
} }
} }

View file

@ -10,7 +10,8 @@ namespace cylvester
{ {
public static readonly int NumMaxInputChannels = 16; public static readonly int NumMaxInputChannels = 16;
public static readonly string ip = "127.0.0.1"; public static readonly string ip = "127.0.0.1";
public static readonly int port = 54345; public static readonly int sendPort = 54345;
public static readonly int receivedPort = 56765;
public static readonly int FftSize = 512; public static readonly int FftSize = 512;
} }
} }

View file

@ -0,0 +1,35 @@
using System;
using System.Net;
using System.Net.Sockets;
namespace cylvester
{
public interface IPdReceiver
{
event Action<byte[]> DataReceived;
void Update();
}
public class PdReceiver : IPdReceiver
{
private readonly UdpClient udpClient_;
private IPEndPoint remote_;
public PdReceiver(int port)
{
udpClient_ = new UdpClient(port);
remote_ = new IPEndPoint(IPAddress.Any, port);
}
public void Update()
{
while (udpClient_.Available > 0)
{
var receivedData = udpClient_.Receive(ref remote_);
DataReceived?.Invoke(receivedData);
}
}
public event Action<byte[]> DataReceived;
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b918e986dbe241409e844bd6c6418d6e
timeCreated: 1570268830

View file

@ -4,16 +4,16 @@ using System.Net.Sockets;
namespace cylvester namespace cylvester
{ {
public interface IPdSocket : IDisposable public interface IPdSender : IDisposable
{ {
void Send(byte[] bytes); void Send(byte[] bytes);
} }
public class PdSocket : IPdSocket public class PdSender : IPdSender
{ {
private Socket socket_; private Socket socket_;
public PdSocket(string ip, int port) public PdSender(string ip, int port)
{ {
socket_ = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); socket_ = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
socket_.Connect(IPAddress.Parse(ip), port); socket_.Connect(IPAddress.Parse(ip), port);

View file

@ -1,6 +1,6 @@
#N canvas 473 11 560 380 10; #N canvas 473 11 670 468 10;
#X obj 217 251 adc~ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16; #X obj 217 251 adc~ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16;
#X obj 48 304 dac~, f 6; #X obj 49 386 dac~, f 6;
#N canvas 215 619 730 390 analyzers_______________________________ #N canvas 215 619 730 390 analyzers_______________________________
0; 0;
#X obj 95 44 inlet~; #X obj 95 44 inlet~;
@ -203,14 +203,18 @@
#X restore 420 50 pd window; #X restore 420 50 pd window;
#N canvas 2182 728 450 338 commands_from_unity 0; #N canvas 2182 728 450 338 commands_from_unity 0;
#X obj 44 31 inlet; #X obj 44 31 inlet;
#X obj 69 132 s sample_playback; #X obj 108 130 s sample_playback;
#X text 128 55 1 ... sample playback; #X text 128 55 1 ... sample playback;
#X text 127 38 0 ... dsp start/stop; #X text 127 38 0 ... dsp start/stop;
#X obj 44 84 route 0 1; #X obj 47 94 route 0 1;
#X msg 44 190 \; pd dsp \$1; #X msg 3 198 \; pd dsp \$1;
#X obj 86 195 sel 1;
#X obj 89 234 outlet;
#X connect 0 0 4 0; #X connect 0 0 4 0;
#X connect 4 0 5 0; #X connect 4 0 5 0;
#X connect 4 0 6 0;
#X connect 4 1 1 0; #X connect 4 1 1 0;
#X connect 6 0 7 0;
#X restore 230 79 pd commands_from_unity; #X restore 230 79 pd commands_from_unity;
#N canvas 667 603 877 437 sample_playback 0; #N canvas 667 603 877 437 sample_playback 0;
#X obj 86 166 readsf~; #X obj 86 166 readsf~;
@ -237,12 +241,23 @@
#X connect 9 0 7 0; #X connect 9 0 7 0;
#X connect 10 0 0 0; #X connect 10 0 0 0;
#X connect 11 0 0 0; #X connect 11 0 0 0;
#X restore 54 219 pd sample_playback; #X restore 55 301 pd sample_playback;
#X obj 230 24 netreceive -u -b 54345; #X obj 230 24 netreceive -u -b 54345;
#X obj 45 140 text define -k samplefiles; #X obj 45 140 text define -k samplefiles;
#A set Back_Back.wav \; Brutal_Synth.wav \; Dialog.wav \; Drums.wav #A set Back_Back.wav \; Brutal_Synth.wav \; Dialog.wav \; Drums.wav
\; Fox_Melo.wav \; Kick.wav \; Pads+Strings.wav \; Rose_Sax.wav \; \; Fox_Melo.wav \; Kick.wav \; Pads+Strings.wav \; Rose_Sax.wav \;
Roses_Front.wav; Roses_Front.wav;
#X obj 236 215 netsend -u -b;
#X msg 231 140 connect localhost 56765;
#X obj 253 110 loadbang;
#X obj 86 199 list prepend send;
#X obj 86 223 list trim;
#X obj 86 175 midiin;
#X msg 402 128 23 31;
#X msg 454 126 80 84, f 10;
#X text 414 102 sample CC;
#X msg 392 180 send 176 \$1 \$2;
#X text 416 201 176... control channel 1;
#X connect 0 0 2 0; #X connect 0 0 2 0;
#X connect 0 1 2 1; #X connect 0 1 2 1;
#X connect 0 2 2 2; #X connect 0 2 2 2;
@ -262,7 +277,16 @@ Roses_Front.wav;
#X connect 3 0 4 0; #X connect 3 0 4 0;
#X connect 4 0 5 0; #X connect 4 0 5 0;
#X connect 5 0 6 0; #X connect 5 0 6 0;
#X connect 9 0 14 0;
#X connect 10 0 1 0; #X connect 10 0 1 0;
#X connect 10 0 1 1; #X connect 10 0 1 1;
#X connect 10 0 2 0; #X connect 10 0 2 0;
#X connect 11 0 9 0; #X connect 11 0 9 0;
#X connect 14 0 13 0;
#X connect 15 0 14 0;
#X connect 16 0 17 0;
#X connect 17 0 13 0;
#X connect 18 0 16 0;
#X connect 19 0 22 0;
#X connect 20 0 22 0;
#X connect 22 0 13 0;