Ejemplo n.º 1
0
 /// <summary>
 /// Blocks the calling thread until a volume slide has finished.
 /// </summary>
 protected void WaitForVolumeSlide()
 {
     while (Bass.BASS_ChannelIsSliding(_stream.Handle, BASSAttribute.BASS_ATTRIB_VOL))
     {
         Thread.Sleep(10);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Fade out and Stop the Song
        /// </summary>
        /// <param name="stream"></param>
        public void FadeOutStop()
        {
            new Thread(() =>
            {
                Log.Debug("BASS: FadeOutStop of stream {0}", _filePath);

                if (!IsPlaying)
                {
                    return;
                }

                double crossFadeSeconds = 0.0;

                if (Config.CrossFadeIntervalMs > 0)
                {
                    crossFadeSeconds = crossFadeSeconds / 1000.0;
                }

                if ((TotalStreamSeconds - (StreamElapsedTime + crossFadeSeconds) > -1))
                {
                    Bass.BASS_ChannelSlideAttribute(_stream, BASSAttribute.BASS_ATTRIB_VOL, -1,
                                                    Config.CrossFadeIntervalMs);
                    while (Bass.BASS_ChannelIsSliding(_stream, BASSAttribute.BASS_ATTRIB_VOL))
                    {
                        Thread.Sleep(20);
                    }
                }
                else
                {
                    Bass.BASS_ChannelStop(_stream);
                }
                Dispose();
            }
                       ).Start();
        }