the "OVRHapticsClip" can't work, help me to write some codes for example.
if use the "OVRHapticsClip " create with " AudioClips" it cause unity crash, there is a Infinite loop in "while"
I find the crux of problem: "OVRHaptics.Config.SampleRateHz" is zero!! and can't get the right value from "OVRHaptics.Config",all value is zero in "OVRHaptics.Config".
I just want to make the touch vbration, somebady can help me? tell me how to use vbration API with some right code for example.
the "OVRInput.SetControllerVibration" is not my need, it can't control vibration duration.
please.
private void InitializeFromAudioFloatTrack(float[] sourceData, double sourceFrequency, int sourceChannelCount, int sourceChannel)
{
double stepSizePrecise = sourceFrequency / OVRHaptics.Config.SampleRateHz;
int stepSize = (int)stepSizePrecise;
double stepSizeError = stepSizePrecise - stepSize;
double accumulatedStepSizeError = 0.0f;
int length = sourceData.Length;
Count = 0;
Capacity = length / sourceChannelCount / stepSize + 1;
Samples = new byte[Capacity * OVRHaptics.Config.SampleSizeInBytes];
int i = sourceChannel % sourceChannelCount;
while (i < length)
{
if (OVRHaptics.Config.SampleSizeInBytes == 1)
{
WriteSample((byte)(Mathf.Clamp01(Mathf.Abs(sourceData)) * System.Byte.MaxValue)); // TODO support multi-byte samples
}
i+= stepSize * sourceChannelCount;
accumulatedStepSizeError += stepSizeError;
if ((int)accumulatedStepSizeError > 0)
{
i+= (int)accumulatedStepSizeError * sourceChannelCount;
accumulatedStepSizeError = accumulatedStepSizeError - (int)accumulatedStepSizeError;
}
}
}
I find the crux of problem: "OVRHaptics.Config.SampleRateHz" is zero!! and can't get the right value from "OVRHaptics.Config",all value is zero in "OVRHaptics.Config".
I just want to make the touch vbration, somebady can help me? tell me how to use vbration API with some right code for example.
the "OVRInput.SetControllerVibration" is not my need, it can't control vibration duration.
please.
