private void MessageFrm_Shown(object sender, EventArgs e) { SoundPlayer sound = new SoundPlayer(@"C:\WINDOWS\Media\notify.wav"); sound.Play(); sound.Dispose(); }
//Text to speech stuff public void speak(string text, Action whenDone = null) { string fileName = "tempfile.wav"; File.Delete(fileName); stopSpeaking(); var synth = new SpeechSynthesizer(); //Create one and not dispose of it? Might be better memory management //http://www.kobaspeech.com/en/download-voices try { synth.SelectVoice("Vocalizer Karen - English (Australia) For KobaSpeech 3"); } catch (System.ArgumentException e) { //Incase they dont have the voice installed, we will just use the default microsoft david voice witch every computer should have synth.SelectVoice("Microsoft David Desktop"); } synth.SetOutputToWaveFile(fileName); synth.Speak(text); synth.SetOutputToNull(); SetWaveFile(fileName); SoundPlayer soundPlayer = new SoundPlayer(fileName); soundPlayer.Play(); BeginDisplay(whenDone); soundPlayer.Dispose(); synth.Dispose(); }
private void button27_Click(object sender, EventArgs e) { var sp = new SoundPlayer(stream: Properties.Resources.question_straighforward); sp.Play(); sp.Dispose(); }
private void button23_Click(object sender, EventArgs e) { var sp = new SoundPlayer(stream: Properties.Resources.okay); sp.Play(); sp.Dispose(); }
private void startaskquestionBtn_Click(object sender, EventArgs e) { var sp = new SoundPlayer(stream: Properties.Resources.start_ask_question); sp.Play(); sp.Dispose(); }
private void smacklipsBtn_Click(object sender, EventArgs e) { var sp = new SoundPlayer(stream: Properties.Resources.smack_lips); sp.Play(); sp.Dispose(); }
private void button14_Click(object sender, EventArgs e) { var sp = new SoundPlayer(stream: Properties.Resources.count_1_from_8_get_9); sp.Play(); sp.Dispose(); }
private void button6_Click(object sender, EventArgs e) { var sp = new SoundPlayer(stream: Properties.Resources.finish_summarise); sp.Play(); sp.Dispose(); }
private void button17_Click(object sender, EventArgs e) { var sp = new SoundPlayer(stream: Properties.Resources.and_what_it_means); sp.Play(); sp.Dispose(); }
private void button18_Click(object sender, EventArgs e) { var sp = new SoundPlayer(stream: Properties.Resources.add_count_combine); sp.Play(); sp.Dispose(); }
void Dispatch(string file, string args, bool await = false) { try { if (wavfiles.Contains(file.ToLower())) { SoundPlayer player = new SoundPlayer($"Resources\\{file}.wav"); player.PlaySync(); player.Dispose(); return; } using (Process proc = new Process()) { proc.StartInfo.FileName = file; proc.StartInfo.Arguments = args; proc.Start(); if (await) { proc.WaitForExit(); } } } catch { } }
protected override void OnClosed(EventArgs e) { if (sfx != null) { sfx.Dispose(); } }
private void smsgeldi_FormClosing(object sender, FormClosingEventArgs e) { if (sp != null) { sp.Stop(); sp.Dispose(); } }
/// <summary> /// 停止当前的朗读 /// </summary> public void stopRead() { foreach (var t in threads) { try { if (t != null) { t.Abort(); } } catch { } } isRuning = false; player.Stop(); player.Dispose(); for (int i = 0; i < soundFinishState.Length; i++) { soundFinishState[i] = false; } if (Directory.Exists(bufferpath)) { Directory.Delete(bufferpath, true); } isReading = -1; this.soundPlayIndex = 0; this.soundSynIndex = 0; }
private void button15_Click(object sender, EventArgs e) { var sp = new SoundPlayer(stream: Properties.Resources.brains_super_good); sp.Play(); sp.Dispose(); }
private void button5_Click(object sender, EventArgs e) { var sp = new SoundPlayer(stream: Properties.Resources.gonna_do_example); sp.Play(); sp.Dispose(); }
private void button10_Click(object sender, EventArgs e) { var sp = new SoundPlayer(stream: Properties.Resources.mr_hegarty_here); sp.Play(); sp.Dispose(); }
private void button1_Click(object sender, EventArgs e) { var sp = new SoundPlayer(stream: Properties.Resources.three_two_five); sp.Play(); sp.Dispose(); }
private void button11_Click(object sender, EventArgs e) { var sp = new SoundPlayer(stream: Properties.Resources.look_see_how_much_got); sp.Play(); sp.Dispose(); }
private void thismeansBtn_Click(object sender, EventArgs e) { var sp = new SoundPlayer(stream: Properties.Resources.so_this_means); sp.Play(); sp.Dispose(); }
private void button12_Click(object sender, EventArgs e) { var sp = new SoundPlayer(stream: Properties.Resources.in_this_vid_talking_about); sp.Play(); sp.Dispose(); }
private void button25_Click(object sender, EventArgs e) { var sp = new SoundPlayer(stream: Properties.Resources.simple_addition); sp.Play(); sp.Dispose(); }
private void button7_Click(object sender, EventArgs e) { var sp = new SoundPlayer(stream: Properties.Resources.imagine_we_had); sp.Play(); sp.Dispose(); }
private void button24_Click(object sender, EventArgs e) { var sp = new SoundPlayer(stream: Properties.Resources.our_brain_isnt_good); sp.Play(); sp.Dispose(); }
private void button8_Click(object sender, EventArgs e) { var sp = new SoundPlayer(stream: Properties.Resources.hope_found_useful); sp.Play(); sp.Dispose(); }
public void Dispose() { if (player != null) { player.Dispose(); } }
private void button9_Click(object sender, EventArgs e) { var sp = new SoundPlayer(stream: Properties.Resources.hi_another_video); sp.Play(); sp.Dispose(); }
public static void DoEvent(string eventName) { if (App.Settings.Current.Sounds.IsEnabled) { string path = App.Settings.Current.Sounds.GetPathByName(eventName); if (!string.IsNullOrEmpty(path)) { if (_player != null) { _player.Dispose(); } try { _player = new SoundPlayer(path); _player.Play(); } catch (Exception ex) { _player = null; System.Diagnostics.Debug.WriteLine( string.Format("Unable to play audio file {0}: {1}", path, ex.Message)); } } } }
private void button4_Click(object sender, EventArgs e) { var sp = new SoundPlayer(stream: Properties.Resources.help_count_things); sp.Play(); sp.Dispose(); }
private void PlayWav(Stream stream, bool play_looping) { // Stop the player if it is running. if (Player != null) { Player.Stop(); Player.Dispose(); Player = null; } // If we have no stream, we're done. if (stream == null) { return; } // Make the new player for the WAV stream. Player = new SoundPlayer(stream); // Play. if (play_looping) { Player.PlayLooping(); } else { Player.Play(); } }
/// <summary> /// Effect player dispose. /// </summary> /// <param name='soundEffectPlayer'> /// Sound effect player. /// </param> public static void SoundEffectPlayerDispose(SoundPlayer soundEffectPlayer) { soundEffectPlayer.Dispose(); soundEffectPlayer = null; }