// 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();
            }
        }
        public PlaneverbAudioSource Play(AudioClip clip, int id, PlaneverbEmitter emitter, bool loop)
        {
            if (clip)
            {
                // make a new source to be played next audio frame
                GameObject           newSource = Instantiate(sourceTemplate);
                PlaneverbAudioSource newComp   = newSource.GetComponent <PlaneverbAudioSource>();

                // set information on new object
                newComp.SetClip(clip);
                newComp.SetEmitter(emitter);
                newComp.SetManager(gameObject);
                newComp.SetLoop(loop);

                // add it as a child
                newSource.transform.SetParent(transform);

                return(newComp);
            }
            else
            {
                return(null);
            }
        }