Esempio n. 1
0
 public void Replay(ref SoundBuffer voice)
 {
     voice.Wave.Stop();
     voice.Reader.CurrentTime = TimeSpan.FromSeconds(0);
     voice.Wave.Init(voice.Reader);
     voice.Wave.Play();
 }
Esempio n. 2
0
        //Play=0:Pause Play=1:Play/Resume Play=Other:Auto Pause/Play
        public void Pause(ref SoundBuffer voice, int Play = -1)
        {
            switch (voice.Wave.PlaybackState)
            {
            case PlaybackState.Stopped:
                if (Play != 0 || Play == 1)
                {
                    voice.Reader.CurrentTime = TimeSpan.FromSeconds(0);
                    voice.Wave.Init(voice.Reader);
                    voice.Wave.Play();
                }
                break;

            case PlaybackState.Paused:
                if (Play != 0 || Play == 1)
                {
                    voice.Wave.Resume();
                }
                break;

            case PlaybackState.Playing:
                if (Play != 1 || Play == 0)
                {
                    voice.Wave.Pause();
                }
                break;
            }
        }
Esempio n. 3
0
 public void GetStream(System.IO.Stream data, ref SoundBuffer voice)
 {
     if (voice == null)
     {
         voice = new SoundBuffer();
     }
     voice.Reader = new WaveFileReader(data);
     voice.Wave   = new WaveOut();
 }
Esempio n. 4
0
 public void Play(ref SoundBuffer voice)
 {
     try
     {
         voice.Reader.CurrentTime = TimeSpan.FromSeconds(0);
         voice.Wave.Init(voice.Reader);
         voice.Wave.Play();
     }catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
Esempio n. 5
0
 public bool Dispose(ref SoundBuffer voice)
 {
     try
     {
         voice.Wave.Dispose();
         voice.Reader.Dispose();
         voice = null;
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Esempio n. 6
0
 public void Stop(ref SoundBuffer voice)
 {
     voice.Wave.Stop();
 }