add mathematical solution to the stuttering problem

This commit is contained in:
Chikashi Miyama 2019-10-27 12:52:36 +01:00
parent 7b273e2b8a
commit 1757ace208
4 changed files with 79 additions and 36 deletions

View file

@ -361,6 +361,24 @@
<Reference Include="System.Threading.Tasks.Extensions"> <Reference Include="System.Threading.Tasks.Extensions">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/Plugins/System.Threading.Tasks.Extensions.dll</HintPath> <HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/Plugins/System.Threading.Tasks.Extensions.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.Azure.Kinect.Sensor">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/ThridParty/AzureKinectExamples/SDK/Kinect4AzureSDK/Plugins/Microsoft.Azure.Kinect.Sensor.dll</HintPath>
</Reference>
<Reference Include="System.Buffers">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/ThridParty/AzureKinectExamples/SDK/Kinect4AzureSDK/Plugins/System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Memory">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/ThridParty/AzureKinectExamples/SDK/Kinect4AzureSDK/Plugins/System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/ThridParty/AzureKinectExamples/SDK/Kinect4AzureSDK/Plugins/System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="Kinect2UnityWrapper">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/ThridParty/AzureKinectExamples/SDK/KinectSDK2.0/Plugins/Kinect2UnityWrapper.dll</HintPath>
</Reference>
<Reference Include="Intel.RealSense">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/ThridParty/AzureKinectExamples/SDK/RealSenseSDK2.0/Plugins/Intel.RealSense.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.Advertisements"> <Reference Include="UnityEditor.Advertisements">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Library/PackageCache/com.unity.ads@2.0.8/Editor/UnityEditor.Advertisements.dll</HintPath> <HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Library/PackageCache/com.unity.ads@2.0.8/Editor/UnityEditor.Advertisements.dll</HintPath>
</Reference> </Reference>
@ -379,24 +397,6 @@
<Reference Include="ICSharpCode.NRefactory"> <Reference Include="ICSharpCode.NRefactory">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Library/PackageCache/com.unity.render-pipelines.high-definition@6.9.1-preview/Editor/Core/ShaderGenerator/ICSharpCode.NRefactory.dll</HintPath> <HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Library/PackageCache/com.unity.render-pipelines.high-definition@6.9.1-preview/Editor/Core/ShaderGenerator/ICSharpCode.NRefactory.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.Memory">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/ThridParty/AzureKinectExamples/SDK/Kinect4AzureSDK/Plugins/System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/ThridParty/AzureKinectExamples/SDK/Kinect4AzureSDK/Plugins/System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Kinect.Sensor">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/ThridParty/AzureKinectExamples/SDK/Kinect4AzureSDK/Plugins/Microsoft.Azure.Kinect.Sensor.dll</HintPath>
</Reference>
<Reference Include="Intel.RealSense">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/ThridParty/AzureKinectExamples/SDK/RealSenseSDK2.0/Plugins/Intel.RealSense.dll</HintPath>
</Reference>
<Reference Include="System.Buffers">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/ThridParty/AzureKinectExamples/SDK/Kinect4AzureSDK/Plugins/System.Buffers.dll</HintPath>
</Reference>
<Reference Include="Kinect2UnityWrapper">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/ThridParty/AzureKinectExamples/SDK/KinectSDK2.0/Plugins/Kinect2UnityWrapper.dll</HintPath>
</Reference>
<Reference Include="nunit.framework"> <Reference Include="nunit.framework">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Library/PackageCache/com.unity.ext.nunit@1.0.0/net35/unity-custom/nunit.framework.dll</HintPath> <HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Library/PackageCache/com.unity.ext.nunit@1.0.0/net35/unity-custom/nunit.framework.dll</HintPath>
</Reference> </Reference>

View file

@ -61,6 +61,7 @@
<Compile Include="Assets\Scenes\Examples\Composition\script\RmsAnalyzer.cs" /> <Compile Include="Assets\Scenes\Examples\Composition\script\RmsAnalyzer.cs" />
<Compile Include="Assets\Scenes\Examples\LevelThreshold\script\ConstructionColumnBehaviour.cs" /> <Compile Include="Assets\Scenes\Examples\LevelThreshold\script\ConstructionColumnBehaviour.cs" />
<Compile Include="Assets\Scenes\Examples\LevelThreshold\script\Spawner.cs" /> <Compile Include="Assets\Scenes\Examples\LevelThreshold\script\Spawner.cs" />
<Compile Include="Assets\Scenes\Examples\MIDI\script\CubeSync.cs" />
<Compile Include="Assets\Scenes\Examples\MIDI\script\PositionBind.cs" /> <Compile Include="Assets\Scenes\Examples\MIDI\script\PositionBind.cs" />
<Compile Include="Assets\Scenes\Examples\PdBackend\script\BoomBall.cs" /> <Compile Include="Assets\Scenes\Examples\PdBackend\script\BoomBall.cs" />
<Compile Include="Assets\Scenes\Examples\PostProcessing\script\BokehBind.cs" /> <Compile Include="Assets\Scenes\Examples\PostProcessing\script\BokehBind.cs" />
@ -577,6 +578,24 @@
<Reference Include="System.Threading.Tasks.Extensions"> <Reference Include="System.Threading.Tasks.Extensions">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/Plugins/System.Threading.Tasks.Extensions.dll</HintPath> <HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/Plugins/System.Threading.Tasks.Extensions.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.Azure.Kinect.Sensor">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/ThridParty/AzureKinectExamples/SDK/Kinect4AzureSDK/Plugins/Microsoft.Azure.Kinect.Sensor.dll</HintPath>
</Reference>
<Reference Include="System.Buffers">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/ThridParty/AzureKinectExamples/SDK/Kinect4AzureSDK/Plugins/System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Memory">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/ThridParty/AzureKinectExamples/SDK/Kinect4AzureSDK/Plugins/System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/ThridParty/AzureKinectExamples/SDK/Kinect4AzureSDK/Plugins/System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="Kinect2UnityWrapper">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/ThridParty/AzureKinectExamples/SDK/KinectSDK2.0/Plugins/Kinect2UnityWrapper.dll</HintPath>
</Reference>
<Reference Include="Intel.RealSense">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/ThridParty/AzureKinectExamples/SDK/RealSenseSDK2.0/Plugins/Intel.RealSense.dll</HintPath>
</Reference>
<Reference Include="Unity.Analytics.Editor"> <Reference Include="Unity.Analytics.Editor">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Library/PackageCache/com.unity.analytics@3.3.2/Unity.Analytics.Editor.dll</HintPath> <HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Library/PackageCache/com.unity.analytics@3.3.2/Unity.Analytics.Editor.dll</HintPath>
</Reference> </Reference>
@ -586,24 +605,6 @@
<Reference Include="Unity.Analytics.Tracker"> <Reference Include="Unity.Analytics.Tracker">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Library/PackageCache/com.unity.analytics@3.3.2/Unity.Analytics.Tracker.dll</HintPath> <HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Library/PackageCache/com.unity.analytics@3.3.2/Unity.Analytics.Tracker.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.Memory">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/ThridParty/AzureKinectExamples/SDK/Kinect4AzureSDK/Plugins/System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/ThridParty/AzureKinectExamples/SDK/Kinect4AzureSDK/Plugins/System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Kinect.Sensor">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/ThridParty/AzureKinectExamples/SDK/Kinect4AzureSDK/Plugins/Microsoft.Azure.Kinect.Sensor.dll</HintPath>
</Reference>
<Reference Include="Intel.RealSense">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/ThridParty/AzureKinectExamples/SDK/RealSenseSDK2.0/Plugins/Intel.RealSense.dll</HintPath>
</Reference>
<Reference Include="System.Buffers">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/ThridParty/AzureKinectExamples/SDK/Kinect4AzureSDK/Plugins/System.Buffers.dll</HintPath>
</Reference>
<Reference Include="Kinect2UnityWrapper">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/ThridParty/AzureKinectExamples/SDK/KinectSDK2.0/Plugins/Kinect2UnityWrapper.dll</HintPath>
</Reference>
<Reference Include="mscorlib"> <Reference Include="mscorlib">
<HintPath>C:/Program Files/Unity_2019.2.8f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/mscorlib.dll</HintPath> <HintPath>C:/Program Files/Unity_2019.2.8f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/mscorlib.dll</HintPath>
</Reference> </Reference>

View file

@ -0,0 +1,31 @@
using UnityEngine;
public class CubeSync : MonoBehaviour
{
private int counter_ = 0;
private float currentX_;
private float targetX_;
private float lastCallBack_;
private float callbackInterval_ = 0.05f;
public void onClockReceived()
{
var now = Time.realtimeSinceStartup;
callbackInterval_ = now - lastCallBack_;
lastCallBack_ = now;
currentX_ = (counter_ - 12) * 0.2f;
counter_++;
targetX_ = (counter_ - 12) * 0.2f;
counter_ %= 24;
}
public void Update()
{
var timeSinceLastCallback = Time.realtimeSinceStartup - lastCallBack_;
var elapsedRatio = timeSinceLastCallback / callbackInterval_;
var animationX = Mathf.Lerp(currentX_, targetX_, elapsedRatio);
Debug.Log(elapsedRatio);
transform.position = new Vector3(animationX, 0f, 0f);
}
}

View file

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