Esempio n. 1
0
        public void Sound(ToggleButton btn)
        {
            Ad_name.Adres("select name from music where id=" + Convert.ToString(btn.Name.ToString()[4]));
            name = Ad_name.muzic_name;

            if (btn_n != btn)
            {
                if (output != null)
                {
                    output.Stop();
                    output.Dispose();
                }
                gg(name);
                output.Play();
                btn_n = btn;
                del_(false);
            }
            else if (btn_n == btn)
            {
                if (output != null)
                {
                    output.Stop();
                    stream.Dispose();
                    output.Dispose();
                    output = null;
                }
                else if (output == null)
                {
                    gg(name);
                    output.Play();
                }
            }
        }
 private void DisposeWave()
 {
     if (output != null)
     {
         if (output.PlaybackState == NAudio.Wave.PlaybackState.Playing) output.Stop();
         output.Dispose();
         output = null;
     }
     if (stream != null)
     {
         stream.Dispose();
         stream = null;
     }
 }
 private void DisposeWave()
 {
     //dispose of song from stream. To ensure no memory leaks
     if (stream == null)
     {
         txtNowPlaying.Text = "Nothing to stop...";
     }
     if (output != null)
     {
         if (output.PlaybackState == NAudio.Wave.PlaybackState.Playing)
         {
             output.Stop();
         }
         output.Dispose();
         output = null;
     }
     if (stream != null)
     {
         stream.Dispose();
         stream = null;
     }
 }
Esempio n. 4
0
        public void DisposeWave()
        {
            if (output != null)
            {
                if (output.PlaybackState == NAudio.Wave.PlaybackState.Playing)
                {
                    output.Stop();
                }
                output.Dispose();
                output = null;
            }

            if (wave != null)
            {
                wave.Dispose();
                wave = null;
            }

            if (stream != null)
            {
                stream.Dispose();
                stream = null;
            }
        }