Esempio n. 1
0
    // Token: 0x0600371D RID: 14109 RVA: 0x0011A608 File Offset: 0x00118A08
    private void Acquire()
    {
        if (!this.audioSource)
        {
            return;
        }
        this.panLevel = this.audioSource.spatialBlend;
        this.spread   = this.audioSource.spread;
        if (this.context == -1)
        {
            this.context = OSPManager.AcquireContext(base.GetInstanceID());
        }
        if (this.context == -1)
        {
            return;
        }
        float spatialBlend = 1f;

        if (OSPManager.GetUseInverseSquareAttenuation())
        {
            spatialBlend = 0f;
        }
        this.audioSource.spatialBlend = spatialBlend;
        this.audioSource.spread       = 180f;
    }
Esempio n. 2
0
    //* * * * * * * * * * * * *
    // Private functions
    //* * * * * * * * * * * * *

    /// <summary>
    /// Acquire resources for spatialization
    /// </summary>
    private void Acquire()
    {
        if (!audioSource)
        {
            return;
        }

        // Cache pan and spread
#if (!UNITY5)
#else
        panLevel = audioSource.spatialBlend;
#endif
        spread = audioSource.spread;

        // Reserve a context in OSP that will be used for spatializing sound
        // (Don't grab a new one if is already has a context attached to it)
        if (context == sNoContext)
        {
            context = OSPManager.AcquireContext(GetInstanceID());
        }

        // We don't have a context here, so bail
        if (context == sNoContext)
        {
            return;
        }

        // Set pan to full (spread at 180 will keep attenuation curve working, but all 2D
        // panning will be removed)

        // We want to remove FMod curve attenuation if we are doing our
        // own internal calc
        float pl = sSetPanLevel;
        if (OSPManager.GetUseInverseSquareAttenuation() == true)
        {
            pl = sSetPanLevelInvSq;
        }

                #if (!UNITY5)
#else
        audioSource.spatialBlend = pl;
#endif

        // set spread to 180
        audioSource.spread = sSetSpread;
    }