Closed baaskoen closed 1 month ago
I locally modified the VoiceHandler
@ GetAmplitude
method so that it compares the timeSamples:
private float GetAmplitude()
{
if (CanGetAmplitude)
{
var amplitude = 0f;
if (AudioSource.timeSamples + AUDIO_SAMPLE_LENGTH > AudioSource.clip.samples)
{
Debug.LogError("Requested samples exceed available samples in the clip.");
return 0f;
}
AudioSource.clip.GetData(audioSample, AudioSource.timeSamples);
foreach (var sample in audioSample)
{
amplitude += Mathf.Abs(sample);
}
return Mathf.Clamp01(amplitude / audioSample.Length * AMPLITUDE_MULTIPLIER);
}
return 0;
}
This prevents the app from crashing, although it will still log the error multiple times.
Thanks for reporting, we will look into it.
This should be fixed now https://github.com/readyplayerme/rpm-unity-sdk-core/releases/tag/v7.3.0
Describe the bug When the assigned audio clip in the VoiceHandler script is played in the browser, the app will crash as soon as the audio stops playing. Happens on all browsers. The audio clip will play just fine, the exception is thrown when it ends.
Files
I'm using an empty project with no modifications, only an imported character and a tiny mp3 file.
To Reproduce
Expected behavior There should be no memory exception. When playing the audio manually without the VoiceHandler on a differen unity node produces no error.
Screenshots
Desktop (please complete the following information):
additionally (if significant for the bug):