예제 #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);
        }
예제 #3
0
 private void Update()
 {
     // TODO: Bend;
     this._frequency = AudioMath.GetFrequency(this.TargetStep);
 }
예제 #4
0
 public void PlayNote(int step, float volume = 1f)
 {
     this._currentNotes.Add(new Note(Time.time + 1, AudioMath.GetFrequency(step), volume));
 }