Started implementing a libpd2Unity scene.
This commit is contained in:
parent
75320b6bc5
commit
4909a14213
9 changed files with 1457 additions and 6 deletions
|
|
@ -65,6 +65,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Assets\Scripts\GameManager.cs" />
|
||||
<Compile Include="Assets\Scripts\LibPd2UnitySceneScripts\EnvelopeFollower.cs" />
|
||||
<Compile Include="Assets\Scripts\LibPdInstance.cs" />
|
||||
<Compile Include="Assets\Scripts\PlayerMovement.cs" />
|
||||
<Compile Include="Assets\Scripts\SpatialisationSceneScripts\CircleMotion.cs" />
|
||||
|
|
@ -75,6 +76,12 @@
|
|||
<None Include="Assets\02-A note on PD patches.txt" />
|
||||
<None Include="Assets\01-Readme First.txt" />
|
||||
<None Include="Assets\04-Readme Unity2LibPdScene.txt" />
|
||||
<Reference Include="UnityEngine.Purchasing">
|
||||
<HintPath>C:/Users/Niall Moody/Programming/Unity/LibPdIntegrationExamples/Library/ScriptAssemblies/UnityEngine.Purchasing.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEditor.Purchasing">
|
||||
<HintPath>C:/Users/Niall Moody/Programming/Unity/LibPdIntegrationExamples/Library/ScriptAssemblies/UnityEditor.Purchasing.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Unity.TextMeshPro.Editor">
|
||||
<HintPath>C:/Users/Niall Moody/Programming/Unity/LibPdIntegrationExamples/Library/ScriptAssemblies/Unity.TextMeshPro.Editor.dll</HintPath>
|
||||
</Reference>
|
||||
|
|
@ -90,12 +97,6 @@
|
|||
<Reference Include="Unity.Analytics.DataPrivacy">
|
||||
<HintPath>C:/Users/Niall Moody/Programming/Unity/LibPdIntegrationExamples/Library/ScriptAssemblies/Unity.Analytics.DataPrivacy.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.Purchasing">
|
||||
<HintPath>C:/Users/Niall Moody/Programming/Unity/LibPdIntegrationExamples/Library/ScriptAssemblies/UnityEngine.Purchasing.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEditor.Purchasing">
|
||||
<HintPath>C:/Users/Niall Moody/Programming/Unity/LibPdIntegrationExamples/Library/ScriptAssemblies/UnityEditor.Purchasing.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.AIModule">
|
||||
<HintPath>C:/Program Files/Unity/Hub/Editor/2018.4.29f1/Editor/Data/Managed/UnityEngine/UnityEngine.AIModule.dll</HintPath>
|
||||
</Reference>
|
||||
|
|
|
|||
1304
Assets/Scenes/LibPd2UnityScene.unity
Normal file
1304
Assets/Scenes/LibPd2UnityScene.unity
Normal file
File diff suppressed because it is too large
Load diff
7
Assets/Scenes/LibPd2UnityScene.unity.meta
Normal file
7
Assets/Scenes/LibPd2UnityScene.unity.meta
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9dd7eec3796ab5e4d89b1505ce5a9b8f
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Scripts/LibPd2UnitySceneScripts.meta
Normal file
8
Assets/Scripts/LibPd2UnitySceneScripts.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 04ae2e93db7ca9f478a121bfe116db02
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
64
Assets/Scripts/LibPd2UnitySceneScripts/EnvelopeFollower.cs
Normal file
64
Assets/Scripts/LibPd2UnitySceneScripts/EnvelopeFollower.cs
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
// EnvelopeFollower.cs - Script to set the y-axis position of a GameObject based
|
||||
// an amplitude value sent to use from PD.
|
||||
// -----------------------------------------------------------------------------
|
||||
// Copyright (c) 2020 Niall Moody
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
/// Script to set the y-axis position of a GameObject based an amplitude value sent to use from PD.
|
||||
public class EnvelopeFollower : MonoBehaviour
|
||||
{
|
||||
/// The PD patch we are going to listen to.
|
||||
public LibPdInstance pdPatch;
|
||||
|
||||
/// The Transform of the GameObject we are going to move.
|
||||
public Transform moveObject;
|
||||
|
||||
/// We need to tell pdPatch which PD send object we want to listen to.
|
||||
void Start()
|
||||
{
|
||||
//Bind to the named send object.
|
||||
pdPatch.Bind("AmplitudeEnvelope");
|
||||
}
|
||||
|
||||
/// Clean up after ourselves and unbind from the AmplitudeEnvelope object.
|
||||
void OnDestroy()
|
||||
{
|
||||
//Unbind from the named send object.
|
||||
pdPatch.UnBind("AmplitudeEnvelope");
|
||||
}
|
||||
|
||||
/// Our receive function. This will be called whenever a bound send object
|
||||
/// in our PD patch fires.
|
||||
public void FloatReceive(string sender, float value)
|
||||
{
|
||||
//This function will get called for *every* Float event sent by our
|
||||
//patch, so we need to make sure we're only acting on the
|
||||
//*AmplitudeEnvelope* event that we're actually interested in.
|
||||
if(sender == "AmplitudeEnvelope")
|
||||
{
|
||||
moveObject.position = new Vector3(moveObject.position.x,
|
||||
0.5f + value,
|
||||
moveObject.position.z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8e7fd44896109b24da35865f0c2961dc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/StreamingAssets/PdAssets/LibPd2UnityPatches.meta
Normal file
8
Assets/StreamingAssets/PdAssets/LibPd2UnityPatches.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fa3b8b131d194fd4db89c5f021752e28
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
#N canvas 854 131 664 489 10;
|
||||
#X obj 90 6 loadbang;
|
||||
#X obj 33 186 dac~;
|
||||
#X obj 33 103 osc~ 440;
|
||||
#X obj 33 147 *~;
|
||||
#X obj 90 111 vline~;
|
||||
#X obj 198 178 env~;
|
||||
#X obj 198 200 / 100;
|
||||
#X obj 198 221 s AmplitudeEnvelope;
|
||||
#X obj 90 48 metro 2000;
|
||||
#X obj 171 34 + 2000;
|
||||
#X msg 90 88 1 1000 \, 0 950 1000;
|
||||
#X obj 90 132 *~;
|
||||
#X obj 171 10 random 1000;
|
||||
#X text 8 6 A repeating;
|
||||
#X text 6 17 trigger with;
|
||||
#X text 7 28 a variable;
|
||||
#X text 7 38 period.;
|
||||
#X text 138 108 An enveloped sine;
|
||||
#X text 137 118 tone \, with the;
|
||||
#X text 138 129 envelope triggered;
|
||||
#X text 139 139 by the above metro.;
|
||||
#X text 75 177 We send the;
|
||||
#X text 75 189 amplitude envelope;
|
||||
#X text 75 200 of our audio to;
|
||||
#X text 76 211 Unity as a float.;
|
||||
#X connect 0 0 8 0;
|
||||
#X connect 2 0 3 0;
|
||||
#X connect 3 0 1 0;
|
||||
#X connect 3 0 1 1;
|
||||
#X connect 3 0 5 0;
|
||||
#X connect 4 0 11 0;
|
||||
#X connect 4 0 11 1;
|
||||
#X connect 5 0 6 0;
|
||||
#X connect 6 0 7 0;
|
||||
#X connect 8 0 10 0;
|
||||
#X connect 8 0 12 0;
|
||||
#X connect 9 0 8 1;
|
||||
#X connect 10 0 4 0;
|
||||
#X connect 11 0 3 1;
|
||||
#X connect 12 0 9 0;
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9ab0089af2eeb0c419b1315779d38b33
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Reference in a new issue