예제 #1
0
        public float WaveValue(int timeIndex)
        {
            var value = 0f;

            foreach (var note in this._currentNotes)
            {
                value += AudioMath.WaveValue(
                    this._waveFunction,
                    null,
                    timeIndex - (int)(note.StartTime * AudioMath.SampleRate),
                    note.Frequency,
                    this.GetNoteVolume(timeIndex, note));
            }

            return(value);
        }
예제 #2
0
        private float WaveValue(int timeIndex)
        {
            var value = 0f;

            for (var i = 0; i < this._instruments.Length; i++)
            {
                var instrument = this._instruments[i];
                value += AudioMath.WaveValue(
                    instrument.WaveFunction,
                    null,
                    timeIndex,
                    AudioMath.GetFrequency(this.TargetStep + instrument.StepOffset),
                    this.Volume * instrument.Volume * AudioMath.StandardVolume * (1 + .5f * Mathf.Sin(timeIndex * .00002f / (i + 1))));
            }

            return(value);
        }