Exemple #1
0
        /// <summary>
        /// The function that runs when the playback thread is started. Returns (ends the thread) when playback is finished or Stop() is called.
        /// </summary>
        private void PlaybackThread()
        {
            while (this.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);

            this.running = false;
        }