public void AddNote(int pitch, int velocity) { for(int i = 0; i < Notes.Count; i++) { if (Notes[i].Pitch == pitch) { Notes[i] = new Note(pitch, velocity); break; } } Notes.Add(new Note(pitch, velocity)); }
//double[] Sinc; public override void Process() { Note note = new Note(0, 0); if (Notes.Count == 0) { for (int i = 0; i < Inputs[0].Length; i++) { Outputs[0][i] = 0; Outputs[1][i] = 0; } return; } note = Notes[Notes.Count - 1]; Increment = CalculateIncrement(note.Pitch); var f = Parameters[0]; try { for (int i = 0; i < Inputs[0].Length; i++) { var lookup = (1 - f) * Pos + f * ValueTables.Get(Pos / Wave.Length, ValueTables.Pow3) * Wave.Length; var sample = LinInterp(Wave, lookup); Pos += Increment; if (Pos >= Wave.Length) Pos -= Wave.Length; Outputs[0][i] = sample * note.Velocity * 0.007874; Outputs[1][i] = sample * note.Velocity * 0.007874; } } catch(Exception) { } }