private void PlaybackThread() { while (_running && _playList.NotesRemaining > 0) { // Get the next note. MusicNote currNote = _playList.GetNextNote(); // Set the tone and sleep for the duration SetTone(currNote.Tone); Thread.Sleep(currNote.Duration); } SetTone(Tone.Rest); _running = false; }
/// <summary> /// Adds an existing note to the list to play. /// </summary> /// <param name="note">The note to add.</param> public void Add(MusicNote note) => _list.Enqueue(note);
/// <summary> /// Adds a note to the queue to be played /// </summary> /// <param name="note">The note to be added, which describes the tone and duration to be played.</param> public void AddNote(MusicNote note) { _playList.Add(note); }