private void PlayButton_Click(object sender, EventArgs e) { if (audioPlayer.PlaybackState == PlaybackState.Stopped) { if (CallingForm.IsEncoding) { reader.Position = 0; Buffer.ClearBuffer(); Buffer.AddSamples(clipBuffer, 0, clipBytes); PlayButton.BackColor = Color.Lime; } else { PlayButton.BackColor = Color.Yellow; } reader.Position = 0; audioPlayer.DeviceNumber = CallingForm.PlaybackDeviceNum; audioPlayer.Init(reader); audioPlayer.PlaybackStopped += AudioPlayer_PlaybackStopped; audioPlayer.Play(); DeleteButton.Enabled = false; timer.Start(); timer.Tick += Timer_Tick; } else { Stop(); } }