private void StopTracks(object state) { Dispatcher.BeginInvoke(delegate { MainProgress.Stop(); viewModel.AudioMan.StopAll(); PlayBank1.Stop(); PlayBank2.Stop(); PlayBank3.Stop(); PlayBank4.Stop(); PlayBank5.Stop(); PlayBank6.Stop(); }); }
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) { base.OnNavigatingFrom(e); playingTimer.Dispose(); stopTimer.Dispose(); MainProgress.Stop(); PlayBank1.Stop(); PlayBank2.Stop(); PlayBank3.Stop(); PlayBank4.Stop(); PlayBank5.Stop(); PlayBank6.Stop(); viewModel.AudioMan.StopAll(); isPlaying = false; }
private void StartButton_Click(object sender, RoutedEventArgs e) { if (recording) { playingTimer.Dispose(); stopTimer.Dispose(); isPlaying = false; recording = false; play1 = false; play2 = false; play3 = false; play4 = false; play5 = false; play6 = false; MainProgress.Stop(); PlayBank1.Stop(); PlayBank2.Stop(); PlayBank3.Stop(); PlayBank4.Stop(); PlayBank5.Stop(); PlayBank6.Stop(); viewModel.AudioMan.StopAll(); int numMeasures = currentMeasure - 1; //string fileName = FileNameTextBox.Text; string fileName = "ML_Performance_" + DateTime.Now.ToShortDateString(); if (string.IsNullOrEmpty(fileName) || string.IsNullOrWhiteSpace(fileName)) { fileName = "MyWave"; } fileName += ".wav"; viewModel.AudioMan.ExportAndUpload(instructions, viewModel.SelectedProject.banks.Count, numMeasures, fileName); StartButton.Content = "Start"; NavigationService.GoBack(); } recording = true; if (!isPlaying) { StartButton.Content = "Finalize"; playingTimer.Change(0, 4000); isPlaying = true; recording = true; } }
private void PlayTracks(object state) { stopTimer.Change(3950, System.Threading.Timeout.Infinite); Dispatcher.BeginInvoke(delegate { MainProgress.Begin(); if (play1) { viewModel.AudioMan.PlayMixedBank(0); PlayBank1.Begin(); if (recording) { instructions[0][currentMeasure] = true; } } if (play2) { viewModel.AudioMan.PlayMixedBank(1); PlayBank2.Begin(); if (recording) { instructions[1][currentMeasure] = true; } } if (play3) { viewModel.AudioMan.PlayMixedBank(2); PlayBank3.Begin(); if (recording) { instructions[2][currentMeasure] = true; } } if (play4) { viewModel.AudioMan.PlayMixedBank(3); PlayBank4.Begin(); if (recording) { instructions[3][currentMeasure] = true; } } if (play5) { viewModel.AudioMan.PlayMixedBank(4); PlayBank5.Begin(); if (recording) { instructions[4][currentMeasure] = true; } } if (play6) { viewModel.AudioMan.PlayMixedBank(5); PlayBank6.Begin(); if (recording) { instructions[5][currentMeasure] = true; } } if (recording) { currentMeasure++; } }); }