Example #1
0
        public static WaveGenerator PlayInstrumentNote(string instrumentName, int noteIndex, float amp)
        {
            _checkInstrAndNote(instrumentName, noteIndex);

            Instruments.TryGetValue(instrumentName, out WaveFunction instrClone);
            instrClone           = instrClone.Clone();
            instrClone.Frequency = Notes.NoteFreqs[noteIndex];
            instrClone.Amplitude = amp;

            var generator = new WaveGenerator(instrClone);

            generator.Play();

            Voices.Add(generator);

            return(generator);
        }