AudioChannel.Reset C# (CSharp) Méthode

Reset() public méthode

public Reset ( ) : void
Résultat void
    public void Reset()
    {
        this.instrument = Instrument.AcousticGrandPiano;

        this.volume = 1.0f;
        this.coarseVolume = 127; // int(0.5 * 0xFE)
        this.coarseExpression = 127;
        this.coarsePan = 63; //int(0.5 * 0x7F)
        this.finePan = 63;
        this.fineExpression = 127; //int(0x7F)
        this.fineVolume = 127;

        this.data = new float[2048];

        this.sustain = false;
        this.pitchBend = 0.5f;
        this.changed = false;

        SetReverb(0.0f);
    }

Usage Example

Exemple #1
0
    void Update()
    {
        for (int i = 0; i < toFreeList.Count; ++i)
        {
            AudioChannel channel = toFreeList[i];

            // 回收AudioClip
            Dictionary <string, AudioCache> .Enumerator er = ClipCacheDic.GetEnumerator();
            while (er.MoveNext())
            {
                if (er.Current.Key.Equals(channel.Name))
                {
                    AudioCache cache = er.Current.Value;
                    cache.AddClip(channel.Clip);
                    channel.Reset();
                }
            }

            // 回收AudioChannel
            freeList.Add(channel);
            useList.Remove(channel);

            if (useList.Count + freeList.Count > _maxChannel && freeList.Count > 0)
            {
                GameObject obj = freeList[0].gameObject;
                freeList.RemoveAt(0);
                GameObject.Destroy(obj);
            }
        }

        toFreeList.Clear();
    }
All Usage Examples Of AudioChannel::Reset