コード例 #1
0
        void Update()
        {
            // case needs to update PV information
            if (id >= 0)
            {
                // case this object is currently playing: update the emission, and update the output
                if (source)
                {
                    PlaneverbContext.UpdateEmission(id, transform.position);
                    PlaneverbDSPContext.UpateEmitter(id, transform.position, transform.forward);
                    output = PlaneverbContext.GetOutput(id);
                }
                // case this emission has ended since the last frame: end emission and reset the id
                else
                {
                    OnEndEmission();
                    id = -1;
                }

                if (PlaneverbContext.GetInstance().debugDraw)
                {
                    Debug.DrawRay(transform.position, transform.forward);
                }
            }
        }
コード例 #2
0
        // two versions of Emit. one for playing stored Clip, other for AudioSource.PlayOneShot functionality

        public void Emit()
        {
            // start the emission and create the source
            id = PlaneverbContext.Emit(transform.position);
            PlaneverbDSPContext.UpateEmitter(id, transform.position, transform.forward);
            PlaneverbDSPContext.SetEmitterDirectivityPattern(id, DirectivityPattern);
            output = PlaneverbContext.GetOutput(id);
            source = PlaneverbAudioManager.pvDSPAudioManager.Play(Clip, id, this, Loop);
            if (source == null)
            {
                OnEndEmission();
            }
        }