コード例 #1
0
        private void MessageFrm_Shown(object sender, EventArgs e)
        {
            SoundPlayer sound = new SoundPlayer(@"C:\WINDOWS\Media\notify.wav");

            sound.Play();
            sound.Dispose();
        }
コード例 #2
0
ファイル: Face.cs プロジェクト: egold555/WheelChairRobot
        //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();
        }
コード例 #3
0
        private void button27_Click(object sender, EventArgs e)
        {
            var sp = new SoundPlayer(stream: Properties.Resources.question_straighforward);

            sp.Play();
            sp.Dispose();
        }
コード例 #4
0
        private void button23_Click(object sender, EventArgs e)
        {
            var sp = new SoundPlayer(stream: Properties.Resources.okay);

            sp.Play();
            sp.Dispose();
        }
コード例 #5
0
        private void startaskquestionBtn_Click(object sender, EventArgs e)
        {
            var sp = new SoundPlayer(stream: Properties.Resources.start_ask_question);

            sp.Play();
            sp.Dispose();
        }
コード例 #6
0
        private void smacklipsBtn_Click(object sender, EventArgs e)
        {
            var sp = new SoundPlayer(stream: Properties.Resources.smack_lips);

            sp.Play();
            sp.Dispose();
        }
コード例 #7
0
        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();
        }
コード例 #8
0
        private void button6_Click(object sender, EventArgs e)
        {
            var sp = new SoundPlayer(stream: Properties.Resources.finish_summarise);

            sp.Play();
            sp.Dispose();
        }
コード例 #9
0
        private void button17_Click(object sender, EventArgs e)
        {
            var sp = new SoundPlayer(stream: Properties.Resources.and_what_it_means);

            sp.Play();
            sp.Dispose();
        }
コード例 #10
0
        private void button18_Click(object sender, EventArgs e)
        {
            var sp = new SoundPlayer(stream: Properties.Resources.add_count_combine);

            sp.Play();
            sp.Dispose();
        }
コード例 #11
0
ファイル: Program.cs プロジェクト: nick3ds/savetray
            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 { }
            }
コード例 #12
0
 protected override void OnClosed(EventArgs e)
 {
     if (sfx != null)
     {
         sfx.Dispose();
     }
 }
コード例 #13
0
ファイル: smsgeldi.cs プロジェクト: zha0/AndroSpy
 private void smsgeldi_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (sp != null)
     {
         sp.Stop(); sp.Dispose();
     }
 }
コード例 #14
0
 /// <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;
 }
コード例 #15
0
        private void button15_Click(object sender, EventArgs e)
        {
            var sp = new SoundPlayer(stream: Properties.Resources.brains_super_good);

            sp.Play();
            sp.Dispose();
        }
コード例 #16
0
        private void button5_Click(object sender, EventArgs e)
        {
            var sp = new SoundPlayer(stream: Properties.Resources.gonna_do_example);

            sp.Play();
            sp.Dispose();
        }
コード例 #17
0
        private void button10_Click(object sender, EventArgs e)
        {
            var sp = new SoundPlayer(stream: Properties.Resources.mr_hegarty_here);

            sp.Play();
            sp.Dispose();
        }
コード例 #18
0
        private void button1_Click(object sender, EventArgs e)
        {
            var sp = new SoundPlayer(stream: Properties.Resources.three_two_five);

            sp.Play();
            sp.Dispose();
        }
コード例 #19
0
        private void button11_Click(object sender, EventArgs e)
        {
            var sp = new SoundPlayer(stream: Properties.Resources.look_see_how_much_got);

            sp.Play();
            sp.Dispose();
        }
コード例 #20
0
        private void thismeansBtn_Click(object sender, EventArgs e)
        {
            var sp = new SoundPlayer(stream: Properties.Resources.so_this_means);

            sp.Play();
            sp.Dispose();
        }
コード例 #21
0
        private void button12_Click(object sender, EventArgs e)
        {
            var sp = new SoundPlayer(stream: Properties.Resources.in_this_vid_talking_about);

            sp.Play();
            sp.Dispose();
        }
コード例 #22
0
        private void button25_Click(object sender, EventArgs e)
        {
            var sp = new SoundPlayer(stream: Properties.Resources.simple_addition);

            sp.Play();
            sp.Dispose();
        }
コード例 #23
0
        private void button7_Click(object sender, EventArgs e)
        {
            var sp = new SoundPlayer(stream: Properties.Resources.imagine_we_had);

            sp.Play();
            sp.Dispose();
        }
コード例 #24
0
        private void button24_Click(object sender, EventArgs e)
        {
            var sp = new SoundPlayer(stream: Properties.Resources.our_brain_isnt_good);

            sp.Play();
            sp.Dispose();
        }
コード例 #25
0
        private void button8_Click(object sender, EventArgs e)
        {
            var sp = new SoundPlayer(stream: Properties.Resources.hope_found_useful);

            sp.Play();
            sp.Dispose();
        }
コード例 #26
0
 public void Dispose()
 {
     if (player != null)
     {
         player.Dispose();
     }
 }
コード例 #27
0
        private void button9_Click(object sender, EventArgs e)
        {
            var sp = new SoundPlayer(stream: Properties.Resources.hi_another_video);

            sp.Play();
            sp.Dispose();
        }
コード例 #28
0
 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));
             }
         }
     }
 }
コード例 #29
0
        private void button4_Click(object sender, EventArgs e)
        {
            var sp = new SoundPlayer(stream: Properties.Resources.help_count_things);

            sp.Play();
            sp.Dispose();
        }
コード例 #30
0
        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();
            }
        }
コード例 #31
0
ファイル: Audio.cs プロジェクト: k2wanko/PSMGameJamWinter
 /// <summary>
 /// Effect player dispose.
 /// </summary>
 /// <param name='soundEffectPlayer'>
 /// Sound effect player.
 /// </param>
 public static void SoundEffectPlayerDispose(SoundPlayer soundEffectPlayer)
 {
     soundEffectPlayer.Dispose();
     soundEffectPlayer = null;
 }