06-26-2019 07:52 AM
06-27-2019 08:30 AM
if (GetComponent<OvrAvatarLocalDriver>() != null)
{
if (audioSource == null)
{
audioSource = MouthAnchor.gameObject.AddComponent<AudioSource>();
}
spatializedSource = MouthAnchor.GetComponent<ONSPAudioSource>();
if (spatializedSource == null)
{
spatializedSource = MouthAnchor.gameObject.AddComponent<ONSPAudioSource>();
}
spatializedSource.UseInvSqr = true;
spatializedSource.EnableRfl = true; // Enabled
spatializedSource.EnableSpatialization = true;
spatializedSource.Far = 1f;//Reduced from 5f
spatializedSource.Near = 0.1f;
spatializedSource.VolumetricRadius = 0.1f;
spatializedSource.ReverbSend = 10f;
// Add phoneme context to the mouth anchor
lipsyncContext = MouthAnchor.GetComponent<OVRLipSyncContext>();
if (lipsyncContext == null)
{
lipsyncContext = MouthAnchor.gameObject.AddComponent<OVRLipSyncContext>();
lipsyncContext.provider = OVRLipSync.ContextProviders.Enhanced;
// Ignore audio callback if microphone is owned by VoIP
lipsyncContext.skipAudioSource = !CanOwnMicrophone;
}
StartCoroutine(WaitForMouthAudioSource());
}
private IEnumerator WaitForMouthAudioSource()
{
while (MouthAnchor.GetComponent<AudioSource>() == null)
{
yield return new WaitForSeconds(0.1f);
}
AudioSource AS = MouthAnchor.GetComponent<AudioSource>();
AS.minDistance = 0.1f;
AS.maxDistance = 0.5f; // Reduced from 1.0
AS.rolloffMode = AudioRolloffMode.Linear; //Changed fromLogarithmic
AS.loop = true;
AS.playOnAwake = true;
AS.spatialBlend = 1.0f;
AS.spatialize = true;
AS.spread = 360; //added this
AS.spatializePostEffects = true;
}
06-28-2019 11:54 AM
//ADDED CODE
audioSource.minDistance = 0.1f;
audioSource.maxDistance = 2f;
audioSource.rolloffMode = AudioRolloffMode.Linear;
audioSource.spatialBlend = 1.0f;
audioSource.spatialize = true;
audioSource.spread = 360;
audioSource.velocityUpdateMode = AudioVelocityUpdateMode.Dynamic;
audioSource.spatializePostEffects = true;
02-01-2020 10:27 AM
02-03-2020 12:01 PM
02-05-2020 07:29 AM
02-05-2020 12:38 PM
JeffNik said:
I could be wrong, but doesn't the SDK audio 3D spacialization support VOIP? And that would handle the "volume over distance" change automatically.
02-05-2020 01:31 PM