示例#1
0
 public SpatializedChannel(ReferenceChannel source, Cavernizer master, int updateRate)
 {
     Channel = ChannelPrototype.Mapping[(int)source];
     filter  = new Filters.Cavernize(AudioListener3D.Current.SampleRate, 250);
     filter.PresetOutput(updateRate);
     Output = new float[updateRate];
     CreateSource(master, true);
     CreateSource(master, false);
 }
示例#2
0
        void CreateSource(Cavernizer master, bool groundLevel)
        {
            GameObject newObject;

            if (!Channel.Equals(ChannelPrototype.ScreenLFE))
            {
                newObject = GameObject.CreatePrimitive(PrimitiveType.Sphere);
            }
            else
            {
                newObject = GameObject.CreatePrimitive(PrimitiveType.Cube);
            }
            newObject.name = Channel.Name;
            CavernizeOutput newSource = newObject.AddComponent <CavernizeOutput>();

            newSource.Master  = master;
            newSource.Channel = this;
            if (newSource.GroundLevel = groundLevel)
            {
                GroundSource   = newSource;
                GroundRenderer = newObject.GetComponent <Renderer>();
            }
            else
            {
                MovingSource   = newSource;
                MovingRenderer = newObject.GetComponent <Renderer>();
            }
            newSource.Loop          = true;
            newSource.VolumeRolloff = Rolloffs.Disabled;
            newSource.LFE           = Channel.LFE;
            newObject.AddComponent <ScaleByGain>().Source = newSource;
            if (Channel.Muted)
            {
                newSource.Volume = 0;
            }
            newObject.transform.SetParent(master.transform);
            Vector3D position = new Vector3D(0, Channel.Y, 0).PlaceInCube();

            position *= Listener.EnvironmentSize;
            newObject.transform.localPosition = VectorUtils.VectorMatch(position);
        }