Exemplo n.º 1
0
    // Initializes the source.
    private bool InitializeSource()
    {
        if (id < 0)
        {
            id = GvrAudio.CreateAudioSource(hrtfEnabled);
            if (id >= 0)
            {
                GvrAudio.UpdateAudioSource(id, this, currentOcclusion);
                audioSource.spatialize = true;
                audioSource.SetSpatializerFloat((int)GvrAudio.SpatializerData.Type,
                                                (float)GvrAudio.SpatializerType.Source);
                audioSource.SetSpatializerFloat((int)GvrAudio.SpatializerData.Gain,
                                                GvrAudio.ConvertAmplitudeFromDb(gainDb));
                audioSource.SetSpatializerFloat((int)GvrAudio.SpatializerData.MinDistance,
                                                sourceMinDistance);
                audioSource.SetSpatializerFloat((int)GvrAudio.SpatializerData.ZeroOutput, 0.0f);

                // Source id must be set after all the spatializer parameters, to ensure that the source is
                // properly initialized before processing.
                audioSource.SetSpatializerFloat((int)GvrAudio.SpatializerData.Id, (float)id);
            }
        }

        return(id >= 0);
    }
Exemplo n.º 2
0
 // Initializes the source.
 private bool InitializeSource()
 {
     if (id < 0)
     {
         id = GvrAudio.CreateAudioSource(hrtfEnabled);
         if (id >= 0)
         {
             GvrAudio.UpdateAudioSource(id, transform, bypassRoomEffects, gainDb, spread, rolloffMode,
                                        sourceMinDistance, sourceMaxDistance, directivityAlpha,
                                        directivitySharpness, currentOcclusion);
             audioSource.spatialize = true;
             audioSource.SetSpatializerFloat(0, id);
         }
     }
     return(id >= 0);
 }
Exemplo n.º 3
0
 // Initializes the source.
 private bool InitializeSource()
 {
     if (id < 0)
     {
         id = GvrAudio.CreateAudioSource(hrtfEnabled);
         if (id >= 0)
         {
             //try
             //{
             GvrAudio.UpdateAudioSource(id, transform, bypassRoomEffects, gainDb, spread, rolloffMode, sourceMinDistance, sourceMaxDistance, directivityAlpha, directivitySharpness, currentOcclusion);
             //}
             //catch(System.Exception e) { Debug.Log(e.ToString()); }
             audioSource.spatialize = true;
             audioSource.SetSpatializerFloat(0, (float)id);
             audioSource.SetSpatializerFloat(1, (float)GvrAudio.SpatializerType.Source);
         }
     }
     return(id >= 0);
 }