Ejemplo n.º 1
0
 public void Play()
 {
     if (Bass.BASS_ChannelIsActive(streamHandle) == BASSActive.BASS_ACTIVE_PAUSED)
     {
         Bass.BASS_ChannelPlay(streamHandle, false);
         tmrUpdatePosition.Start();
         PlaybackState = PlaybackStates.PLAYING;
         OnPlaybackStateChanged?.Invoke(this, PlaybackStates.PLAYING);
     }
 }
Ejemplo n.º 2
0
        private void timer_Tick(object sender, EventArgs e)
        {
            if (activeTrack > list.Count - 1)
            {
                activeTrack = list.Count - 1;
            }

            if (Bass.BASS_ChannelIsActive(stream) == BASSActive.BASS_ACTIVE_STOPPED && list[activeTrack].Type != PlaylistItem.TYPE_STREAM_URL)
            {
                ShouldPlayNext();
            }

            string length = null;
            double lSecsD = -1;

            if (list[activeTrack].Type != PlaylistItem.TYPE_STREAM_URL)
            {
                lSecsD = Bass.BASS_ChannelBytes2Seconds(stream, Bass.BASS_ChannelGetLength(stream));

                int lHrs  = (int)Math.Floor(lSecsD / 3600);
                int lMins = (int)Math.Floor((lSecsD % 3600) / 60);
                int lSecs = (int)lSecsD % 60;

                length = string.Format("{0}{1}:{2}", ((lHrs == 0) ? "" : lHrs + ":"), lMins.ToString("00"), lSecs.ToString("00"));
            }

            double pSecsD = Bass.BASS_ChannelBytes2Seconds(stream, Bass.BASS_ChannelGetPosition(stream));

            if (!scrubbing && list[activeTrack].Type != PlaylistItem.TYPE_STREAM_URL)
            {
                if (list[activeTrack].Type == PlaylistItem.TYPE_MUSIC && pSecsD >= lSecsD)
                {
                    ShouldPlayNext();
                }
                else
                {
                    trkPos.Value = (int)pSecsD;
                }
            }

            int pHrs  = (int)Math.Floor(pSecsD / 3600);
            int pMins = (int)Math.Floor((pSecsD % 3600) / 60);
            int pSecs = (int)pSecsD % 60;

            string pos = string.Format("{0}{1}:{2}", ((pHrs == 0) ? "" : pHrs + ":"), pMins.ToString("00"), pSecs.ToString("00"));

            if (list[activeTrack].Type == PlaylistItem.TYPE_STREAM_URL)
            {
                lblPos.Text = pos;
            }
            else
            {
                lblPos.Text = pos + "/" + length;
            }
        }
Ejemplo n.º 3
0
 public static bool PlauRandomTrack()
 {
     if ((Bass.BASS_ChannelIsActive(Stream) == BASSActive.BASS_ACTIVE_STOPPED) && (!isStoped))
     {
         Random rand = new Random();
         main.CurrentTrackNumber = rand.Next(0, main.Files.Count);
         Play(main.Files[main.CurrentTrackNumber], Volume);
         return(true);
     }
     return(false);
 }
Ejemplo n.º 4
0
        void BassTimer_Tick(object sender, EventArgs e)
        {
            PlayerProgressInformation progress = new PlayerProgressInformation();
            BASSActive state = Bass.BASS_ChannelIsActive(BassStream);

            if (state == BASSActive.BASS_ACTIVE_PLAYING)
            {
                progress.state = PlayState.PLAYING;
            }
            else if (state == BASSActive.BASS_ACTIVE_PAUSED)
            {
                progress.state = PlayState.PAUSED;
            }
            else if (state == BASSActive.BASS_ACTIVE_STOPPED)
            {
                progress.state = PlayState.STOPPED;
            }
            else if (state == BASSActive.BASS_ACTIVE_STALLED)
            {
                progress.state = PlayState.STALLED;
            }

            if (TagInfo != null)
            {
                progress.artist = TagInfo.artist;
                progress.track  = TagInfo.title;
            }
            double totaltime, elapsedtime;

            if (state != BASSActive.BASS_ACTIVE_STOPPED)
            {
                long pos = Bass.BASS_ChannelGetPosition(BassStream);           // position in bytes
                long len = Bass.BASS_ChannelGetLength(BassStream);             // length in bytes
                totaltime   = Bass.BASS_ChannelBytes2Seconds(BassStream, len); // the total time length
                elapsedtime = Bass.BASS_ChannelBytes2Seconds(BassStream, pos); // the elapsed time length
            }
            else
            {
                totaltime = elapsedtime = 0;
            }



            progress.totalLength     = (int)totaltime;
            progress.currentPosition = (int)elapsedtime;


            Program.playerWindow.Invoke(new neprostopleer.PlayerWindow.UpdateGUIStatusDelegate(Program.playerWindow.UpdateGUIStatus), new object[] { progress });

            if (Bass.BASS_ChannelIsActive(BassStream) != BASSActive.BASS_ACTIVE_PLAYING)
            {
                BassTimer.Stop();
            }
        }
Ejemplo n.º 5
0
        internal static void LoadSampleSet(SampleSet s, bool force)
        {
            if (!force && ((s == CurrentSampleSet && CustomSamples == customLoaded) ||
                           !(GameBase.Mode == Modes.Play || GameBase.Mode == Modes.Edit ||
                             GameBase.Mode == Modes.OptionsSkin)))
            {
                return;
            }

            //SilenceCache.Clear();

            if (s == SampleSet.None)
            {
                s = SampleSet.Normal;
            }

            CurrentSampleSet = s;
            customLoaded     = CustomSamples;

            if (ch_sliderSlide != 0 && BASSActive.BASS_ACTIVE_PLAYING == Bass.BASS_ChannelIsActive(ch_sliderSlide))
            {
                Bass.BASS_ChannelStop(ch_sliderSlide);
            }
            if (ch_sliderWhistle != 0 && BASSActive.BASS_ACTIVE_PLAYING == Bass.BASS_ChannelIsActive(ch_sliderWhistle))
            {
                Bass.BASS_ChannelStop(ch_sliderWhistle);
            }
            if (ch_spinnerSpin != 0 && BASSActive.BASS_ACTIVE_PLAYING == Bass.BASS_ChannelIsActive(ch_spinnerSpin))
            {
                Bass.BASS_ChannelStop(ch_spinnerSpin);
            }

            if (s == SampleSet.None)
            {
                return;
            }

            LoadSample(ref s_HitNormal, "hitnormal", false, true);

            LoadSample(ref s_HitFinish, "hitfinish", false, true);
            LoadSample(ref s_HitWhistle, "hitwhistle", false, true);

            LoadSample(ref s_SliderSlide, "sliderslide", true, true, false, 1);
            LoadSample(ref s_SliderWhistle, "sliderwhistle", true, true, false, 1);
            LoadSample(ref s_SliderTick, "slidertick", false, true);

            ch_sliderSlide   = Bass.BASS_SampleGetChannel(s_SliderSlide, false);
            ch_sliderWhistle = Bass.BASS_SampleGetChannel(s_SliderWhistle, false);
            ch_spinnerSpin   = Bass.BASS_SampleGetChannel(s_SpinnerSpin, false);

            Bass.BASS_ChannelSetAttribute(ch_sliderSlide, BASSAttribute.BASS_ATTRIB_VOL, (float)VolumeSample / 100);
            Bass.BASS_ChannelSetAttribute(ch_sliderWhistle, BASSAttribute.BASS_ATTRIB_VOL, (float)VolumeSample / 100);
            Bass.BASS_ChannelSetAttribute(ch_spinnerSpin, BASSAttribute.BASS_ATTRIB_VOL, (float)VolumeSample / 100);
        }
Ejemplo n.º 6
0
        public void Play(MusicFileItem item)
        {
            if (item == currentItem)
            {
                if (Bass.BASS_ChannelIsActive(stream) == BASSActive.BASS_ACTIVE_PLAYING)
                {
                    Bass.BASS_ChannelPause(stream);
                    currentItem.IsPlaying = false;
                    timer.Stop();
                }
                else
                {
                    Bass.BASS_ChannelPlay(stream, false);
                    currentItem.IsPlaying = true;
                    timer.Start();
                }
                return;
            }

            if (currentItem != null)
            {
                currentItem.VuValue   = 0;
                currentItem.IsPlaying = false;
            }

            if (Bass.BASS_ChannelIsActive(stream) == BASSActive.BASS_ACTIVE_PLAYING)
            {
                Bass.BASS_StreamFree(stream);
            }

            currentItem = item;

            if (item.IsRemote)
            {
                var client = new TcpClient();
                client.Connect(TransferViewModel.device.Address, 8000);

                var    ns     = client.GetStream();
                byte[] buffer = Encoding.UTF8.GetBytes("receive:" + item.Path);

                ns.Write(buffer, 0, buffer.Length);
                ns.Flush();

                var handle = GCHandle.Alloc(client);
                stream = Bass.BASS_StreamCreateFileUser(BASSStreamSystem.STREAMFILE_BUFFER, BASSFlag.BASS_DEFAULT, fileproc, (IntPtr)handle);
            }
            else
            {
                stream = Bass.BASS_StreamCreateFile(item.Path, 0, 0, BASSFlag.BASS_DEFAULT);
            }

            currentItem.IsPlaying = Bass.BASS_ChannelPlay(stream, false);
            timer.Start();
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Метод - проигрывания следующего трека в АВТО режиме (проигрывает следущий трек по завершению текущего)
 /// </summary>
 /// <returns></returns>
 public static bool GoNextTrack()
 {
     if ((Bass.BASS_ChannelIsActive(v_Stream) == BASSActive.BASS_ACTIVE_STOPPED))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 8
0
 /// <summary>
 /// 停止
 /// </summary>
 /// <returns></returns>
 public bool Stop()
 {
     if (Bass.BASS_ChannelIsActive(Stream_playmusic) != BASSActive.BASS_ACTIVE_STOPPED)
     {
         return(Bass.BASS_ChannelStop(Stream_playmusic));
     }
     else
     {
         return(true);
     }
 }
Ejemplo n.º 9
0
 /// <summary>
 /// 播放
 /// </summary>
 /// <returns></returns>
 public bool Play()
 {
     if (Bass.BASS_ChannelIsActive(Stream_playmusic) != BASSActive.BASS_ACTIVE_PLAYING)
     {
         return(Bass.BASS_ChannelPlay(Stream_playmusic, false));
     }
     else
     {
         return(true);
     }
 }
Ejemplo n.º 10
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     if (_blogStreamHandle == 0 || Bass.BASS_ChannelIsActive(_blogStreamHandle) != BASSActive.BASS_ACTIVE_PLAYING)
     {
         btnStopLame.Enabled = false;
     }
     if (pcmImportStreamHandle == 0 || Bass.BASS_ChannelIsActive(pcmImportStreamHandle) != BASSActive.BASS_ACTIVE_PLAYING)
     {
         btnStopPcm.Enabled = false;
     }
 }
Ejemplo n.º 11
0
 /// <summary>
 /// 暂停
 /// </summary>
 public void Puase()
 {
     if (Bass.BASS_ChannelIsActive(stream) == BASSActive.BASS_ACTIVE_PLAYING)
     {
         Bass.BASS_ChannelPause(stream);
     }
     else if (Bass.BASS_ChannelIsActive(stream) == BASSActive.BASS_ACTIVE_PAUSED)
     {
         Bass.BASS_ChannelPlay(stream, false);
     }
 }
Ejemplo n.º 12
0
 /// <summary>
 /// 暂停
 /// </summary>
 /// <returns></returns>
 public bool Pause()
 {
     if (Bass.BASS_ChannelIsActive(Stream_playmusic) != BASSActive.BASS_ACTIVE_PAUSED)
     {
         return(Bass.BASS_ChannelPause(Stream_playmusic));
     }
     else
     {
         return(true);
     }
 }
Ejemplo n.º 13
0
 private void draw()
 {
     while (Bass.BASS_ChannelGetPosition(myStreamHandle, BASSMode.BASS_POS_BYTES) < Bass.BASS_ChannelGetLength(myStreamHandle) &&
            Bass.BASS_ChannelIsActive(myStreamHandle) == BASSActive.BASS_ACTIVE_PLAYING
            )
     {
         updateFrames();
         drawWave();
         Thread.Sleep(50);
     }
 }
Ejemplo n.º 14
0
 void dpt_Tick(object sender, EventArgs e)
 {
     if (prevStatus != Bass.BASS_ChannelIsActive(Handle))
     {
         prevStatus = Bass.BASS_ChannelIsActive(Handle);
         if (prevStatus == BASSActive.BASS_ACTIVE_STOPPED)
         {
             StreamStatus = StreamStatus.Stopped;
         }
         OnPropertyChanged("StreamStatus");
     }
 }
Ejemplo n.º 15
0
        private void LvAudios_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyData)
            {
            case Keys.Enter:
                Playfile();
                break;

            case Keys.Shift | Keys.Enter:
                if (lvAudios.SelectedItems.Count == 0)
                {
                    return;
                }
                if (tvSections.SelectedNode != tvSections.Nodes[1] && tvSections.SelectedNode.Parent != tvSections.Nodes[1])
                {
                    cmAudiosAdd.PerformClick();
                }
                break;

            case Keys.Delete:
                if (tvSections.SelectedNode == tvSections.Nodes[1] || tvSections.SelectedNode.Parent == tvSections.Nodes[1])
                {
                    cmAudiosDelete.PerformClick();
                }
                break;

            case Keys.Control | Keys.Shift | Keys.Alt | Keys.Return:
                cmAudiosDownload.PerformClick();
                break;

            case Keys.F2:
                if (tvSections.SelectedNode == tvSections.Nodes[1] || tvSections.SelectedNode.Parent == tvSections.Nodes[1])
                {
                    AudioEditAsync();
                }
                break;

            case Keys.Space:
            case Keys.MediaPlayPause:
                BASSActive isActive = default(BASSActive);
                isActive = Bass.BASS_ChannelIsActive(stream);
                if (isActive == BASSActive.BASS_ACTIVE_PLAYING)
                {
                    Bass.BASS_ChannelPause(stream);
                }
                else if (isActive == BASSActive.BASS_ACTIVE_PAUSED)
                {
                    Bass.BASS_ChannelPlay(stream, false);
                }
                e.Handled = e.SuppressKeyPress = true;
                break;
            }
        }
Ejemplo n.º 16
0
        //рандомное воспроизведение
        public static bool RandPlay()
        {
            Random tmp = new Random();

            if ((Bass.BASS_ChannelIsActive(Stream) == BASSActive.BASS_ACTIVE_STOPPED) && (!isStopped))
            {
                int k = tmp.Next(0, Vars.Files.Count);
                Vars.trackNum = k;
                Play(Vars.Files[Vars.trackNum], Volume);
            }
            return(true);
        }
Ejemplo n.º 17
0
 //创建音频流
 public static void CreateStream()
 {
     if (stream != 0)
     {
         if (Bass.BASS_ChannelIsActive(stream) == BASSActive.BASS_ACTIVE_PLAYING || Bass.BASS_ChannelIsActive(stream) == BASSActive.BASS_ACTIVE_PAUSED)
         {
             Bass.BASS_ChannelStop(stream);
         }
         Bass.BASS_StreamFree(stream);
     }
     stream = Bass.BASS_StreamCreateFile(fileName, 0L, 0L, BASSFlag.BASS_MUSIC_FLOAT);
 }
Ejemplo n.º 18
0
 public void Play()
 {
     if (BassHelper.IsInitialized && fileStream != 0 && Bass.BASS_ChannelIsActive(fileStream) != BASSActive.BASS_ACTIVE_PLAYING)
     {
         if (EndCallback != null)
         {
             Bass.BASS_ChannelSetSync(fileStream, BASSSync.BASS_SYNC_END | BASSSync.BASS_SYNC_MIXTIME, 0, EndCallback, IntPtr.Zero);
         }
         Bass.BASS_ChannelSetAttribute(fileStream, BASSAttribute.BASS_ATTRIB_VOL, Volume);
         Bass.BASS_ChannelPlay(fileStream, Bass.BASS_ChannelIsActive(fileStream) != BASSActive.BASS_ACTIVE_PAUSED);
     }
 }
Ejemplo n.º 19
0
    public bool isPlaying(int _stream)
    {
        if (_stream != 0)
        {
            if (Bass.BASS_ChannelIsActive(_stream) == BASSActive.BASS_ACTIVE_PLAYING)
            {
                return(true);
            }
        }

        return(false);
    }
Ejemplo n.º 20
0
        private void timerUpdate_Tick(object sender, System.EventArgs e)
        {
            // here we gather info about the stream, when it is playing...
            if (Bass.BASS_ChannelIsActive(_stream) == BASSActive.BASS_ACTIVE_PLAYING)
            {
                // the stream is still playing...
            }
            else
            {
                // the stream is NOT playing anymore...
                _updateTimer.Stop();
                return;
            }

            // from here on, the stream is for sure playing...
            _tickCounter++;
            long pos = Bass.BASS_ChannelGetPosition(_stream); // position in bytes
            long len = Bass.BASS_ChannelGetLength(_stream); // length in bytes
            this._pos = pos;

            if (_tickCounter == 5)
            {
                // display the position every 250ms (since timer is 50ms)
                _tickCounter = 0;
                double totaltime = Bass.BASS_ChannelBytes2Seconds(_stream, len); // the total time length
                double elapsedtime = Bass.BASS_ChannelBytes2Seconds(_stream, pos); // the elapsed time length
                double remainingtime = totaltime - elapsedtime;

                delegateVal.timeInfoValue = String.Format("{0:#0.00} / {1:#0.00}", Utils.FixTimespan(elapsedtime, "MMSS"), Utils.FixTimespan(totaltime, "MMSS")); //Utils.FixTimespan(remainingtime, "MMSS")
                delegateVal.cpuInfoValue = String.Format("Bass-CPU: {0:0.00}%", Bass.BASS_GetCPU());

            }

            // display the level bars
            int peakL = 0;
            int peakR = 0;
            // for testing you might also call RMS_2, RMS_3 or RMS_4
            //RMS(_stream, out peakL, out peakR);
            RMS_2(_stream, out peakL, out peakR);
            // level to dB
            double dBlevelL = Utils.LevelToDB(peakL, 65535);
            double dBlevelR = Utils.LevelToDB(peakR, 65535);
            //RMS_2(_stream, out peakL, out peakR);
            //RMS_3(_stream, out peakL, out peakR);
            //RMS_4(_stream, out peakL, out peakR);

            //**//
            // update the position
            UpdatePosition(pos, len);
            // update spectrum
            UpdateSpectrum();
        }
Ejemplo n.º 21
0
        /// <summary>
        /// stop the current stream
        /// </summary>
        public void Stop()
        {
            var x = Bass.BASS_ChannelIsActive(Handle);

            if (Valid && Bass.BASS_ChannelIsActive(Handle) != BASSActive.BASS_ACTIVE_STOPPED)
            {
                if (Bass.BASS_ChannelStop(Handle))
                {
                    StreamStatus = StreamStatus.CanPlay;
                    Stopped      = true;
                }
            }
        }
Ejemplo n.º 22
0
        private void tmrVisuals_Tick(object sender, EventArgs e)
        {
            Graphics g = Graphics.FromImage(bmp);

            float[] d = new float[1024];

            g.Clear(Color.White);
            Un4seen.Bass.BASSActive isActive = default(Un4seen.Bass.BASSActive);
            isActive = Bass.BASS_ChannelIsActive(stream);

            if (isActive == Un4seen.Bass.BASSActive.BASS_ACTIVE_PLAYING)
            {
                Bass.BASS_ChannelGetData(stream, d, (int)Un4seen.Bass.BASSData.BASS_DATA_FFT1024);
            }
            else if (isActive == Un4seen.Bass.BASSActive.BASS_ACTIVE_PAUSED)
            {
                for (int i = 0; i <= 1023; i++)
                {
                    d[i] = d[i] - 0.002F;
                    d[i] = Math.Max(d[i], 0);
                }
            }

            int   amount = 512;
            int   step = (int)(1024 / amount);
            float x, y, w, h;

            int j = -1;

            for (int i = 0; i < 1024; i += step)
            {
                j++;
                x = ((float)i / (float)amount * bmp.Width);
                w = Math.Max(((float)bmp.Width / (float)amount), 3);

                y = bmp.Height * (1 - d[i] * dIncreaser(i, 1024)) - 2;
                h = bmp.Height + 2;// -y - 3;

                g.FillRectangle(b, x, y, w, h - y);

                dd[i] = dd[i] - 0.002F;
                if (dd[i] < d[i])
                {
                    dd[i] = d[i];
                }

                y = bmp.Height * (1 - dd[i] * dIncreaser(i, 1024)) - 2;
                g.FillRectangle(b2, x, y, w, 2);
            }
            pbVisuals.Image = bmp;
        }
Ejemplo n.º 23
0
        private async void lstResults_KeyDownAsync(object sender, KeyEventArgs e)
        {
            switch (e.KeyData)
            {
            case Keys.Enter:
                if (lstResults.Items.Count == 0)
                {
                    return;
                }
                curIndex = lstResults.SelectedIndex;
                lstResults.SelectedIndex = curIndex;
                await PlayFileAsync(curIndex);

                break;

            case Keys.Space:
                BASSActive isActive = default(BASSActive);
                isActive = Bass.BASS_ChannelIsActive(stream);
                if (isActive == BASSActive.BASS_ACTIVE_PLAYING)
                {
                    Bass.BASS_ChannelPause(stream);
                    tmSeek.Enabled = false;
                }
                else if (isActive == BASSActive.BASS_ACTIVE_PAUSED)
                {
                    Bass.BASS_ChannelPlay(stream, false);
                    tmSeek.Enabled = true;
                }
                break;

            case Keys.Control | Keys.B:
                e.Handled = e.SuppressKeyPress = true;
                cmOpenInBrowser.PerformClick();
                break;

            case Keys.Control | Keys.C:
                e.Handled = e.SuppressKeyPress = true;
                cmCopyToClipboard.PerformClick();
                break;

            case Keys.Control | Keys.D:
                e.Handled = e.SuppressKeyPress = true;
                cmDownloadMp3.PerformClick();
                break;

            case Keys.Control | Keys.Q:
                e.Handled = e.SuppressKeyPress = true;
                mbExit.PerformClick();
                break;
            }
        }
Ejemplo n.º 24
0
        private void tmrUpdateControls_Tick(object sender, EventArgs e)
        {
            if (stream == -1)
            {
                return;
            }
            try
            {
                long pos = 0;
                long len = 0;
                len = Bass.BASS_ChannelGetLength(stream);
                pos = Bass.BASS_ChannelGetPosition(stream);

                double tElapsed = 0;
                double tRemain  = 0;
                double tLength  = 0;
                tLength       = Bass.BASS_ChannelBytes2Seconds(stream, len);
                tElapsed      = Bass.BASS_ChannelBytes2Seconds(stream, pos);
                tRemain       = tLength - tElapsed;
                lblTime2.Text = Un4seen.Bass.Utils.FixTimespan(tLength, "MMSS");
                lblTime1.Text = Un4seen.Bass.Utils.FixTimespan(tElapsed, "MMSS");

                trbPosition.MaxValue = (int)(Bass.BASS_ChannelGetLength(stream) / 1000);

                TaskbarManager.Instance.SetProgressValue((int)(Bass.BASS_ChannelGetPosition(stream) / 1000), (int)(Bass.BASS_ChannelGetLength(stream) / 1000), this.Handle);

                if (!shouldChangePosition)
                {
                    trbPosition.Value = (int)(Bass.BASS_ChannelGetPosition(stream) / 1000);
                    if (tRemain == 0)
                    {
                        if (lbFiles.Items.Count > 1)
                        {
                            cmdNext.PerformClick();
                        }
                    }
                }

                Un4seen.Bass.BASSActive isActive = default(Un4seen.Bass.BASSActive);
                isActive = Bass.BASS_ChannelIsActive(stream);
                if (isActive == Un4seen.Bass.BASSActive.BASS_ACTIVE_PLAYING)
                {
                    TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.Normal);
                }
                else if (isActive == Un4seen.Bass.BASSActive.BASS_ACTIVE_PAUSED)
                {
                    TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.Paused);
                }
            }
            catch (Exception ex) { }
        }
Ejemplo n.º 25
0
        public void PausePlayback()
        {
            if (StartLoopChannelHandle != null && Bass.BASS_ChannelIsActive(StartLoopChannelHandle.Handle) == BASSActive.BASS_ACTIVE_PLAYING)
            {
                Bass.BASS_ChannelPause(StartLoopChannelHandle.Handle);
            }
            else
            {
                if (LoopChannelHandle != null)
                {
                    Bass.BASS_ChannelPause(LoopChannelHandle.Handle);
                }
            }

            if (StartBoostChannelHandle != null && Bass.BASS_ChannelIsActive(StartBoostChannelHandle.Handle) == BASSActive.BASS_ACTIVE_PLAYING)
            {
                Bass.BASS_ChannelPause(StartBoostChannelHandle.Handle);
            }
            else
            {
                if (BoostChannelHandle != null)
                {
                    Bass.BASS_ChannelPause(BoostChannelHandle.Handle);
                }
            }

            if (StartJumpChannelHandle != null && Bass.BASS_ChannelIsActive(StartJumpChannelHandle.Handle) == BASSActive.BASS_ACTIVE_PLAYING)
            {
                Bass.BASS_ChannelPause(StartJumpChannelHandle.Handle);
            }
            else
            {
                if (JumpChannelHandle != null)
                {
                    Bass.BASS_ChannelPause(JumpChannelHandle.Handle);
                }
            }

            if (StartFlightChannelHandle != null && Bass.BASS_ChannelIsActive(StartFlightChannelHandle.Handle) == BASSActive.BASS_ACTIVE_PLAYING)
            {
                Bass.BASS_ChannelPause(StartFlightChannelHandle.Handle);
            }
            else
            {
                if (FlightChannelHandle != null)
                {
                    Bass.BASS_ChannelPause(FlightChannelHandle.Handle);
                }
            }
        }
Ejemplo n.º 26
0
        public void ResumePlayback()
        {
            if (StartLoopChannelHandle != null && Bass.BASS_ChannelIsActive(StartLoopChannelHandle.Handle) == BASSActive.BASS_ACTIVE_PAUSED)
            {
                Bass.BASS_ChannelPlay(StartLoopChannelHandle.Handle, false);
            }
            else
            {
                if (LoopChannelHandle != null)
                {
                    Bass.BASS_ChannelPlay(LoopChannelHandle.Handle, false);
                }
            }

            if (StartBoostChannelHandle != null && Bass.BASS_ChannelIsActive(StartBoostChannelHandle.Handle) == BASSActive.BASS_ACTIVE_PAUSED)
            {
                Bass.BASS_ChannelPlay(StartBoostChannelHandle.Handle, false);
            }
            else
            {
                if (BoostChannelHandle != null)
                {
                    Bass.BASS_ChannelPlay(BoostChannelHandle.Handle, false);
                }
            }

            if (StartJumpChannelHandle != null && Bass.BASS_ChannelIsActive(StartJumpChannelHandle.Handle) == BASSActive.BASS_ACTIVE_PAUSED)
            {
                Bass.BASS_ChannelPlay(StartJumpChannelHandle.Handle, false);
            }
            else
            {
                if (JumpChannelHandle != null)
                {
                    Bass.BASS_ChannelPlay(JumpChannelHandle.Handle, false);
                }
            }

            if (StartFlightChannelHandle != null && Bass.BASS_ChannelIsActive(StartFlightChannelHandle.Handle) == BASSActive.BASS_ACTIVE_PAUSED)
            {
                Bass.BASS_ChannelPlay(StartFlightChannelHandle.Handle, false);
            }
            else
            {
                if (FlightChannelHandle != null)
                {
                    Bass.BASS_ChannelPlay(FlightChannelHandle.Handle, false);
                }
            }
        }
Ejemplo n.º 27
0
 /// <summary>
 ///   Stop Playback of Stream
 /// </summary>
 public void Stop()
 {
     log.Debug("Player: Stop Playback");
     if (Bass.BASS_ChannelIsActive(_stream) == BASSActive.BASS_ACTIVE_PLAYING ||
         Bass.BASS_ChannelIsActive(_stream) == BASSActive.BASS_ACTIVE_PAUSED)
     {
         Bass.BASS_ChannelStop(_stream);
         Bass.BASS_ChannelRemoveSync(_stream, _syncHandleEnd);
     }
     pictureBoxPlayPause.Image = _imgPlay;
     playBackSlider.Value      = 0;
     playBackSlider.Enabled    = false;
     _currentSongPlaying       = "";
 }
        /// <summary>
        /// Checks whether or not a music track is currently playing.
        /// </summary>
        /// <param name="Channel">The channel of the music track.</param>
        /// <returns>True if it is playing, false otherwise.</returns>
        public bool IsMusictrackPlaying(int Channel)
        {
            if (Bass.BASS_ChannelIsActive(Channel) == BASSActive.BASS_ACTIVE_PLAYING)
            {
                return(true);
            }
            else if (Bass.BASS_ChannelIsActive(Channel) == BASSActive.BASS_ACTIVE_PAUSED ||
                     Bass.BASS_ChannelIsActive(Channel) == BASSActive.BASS_ACTIVE_STOPPED)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 29
0
        private void pictureBox1_Click(object sender, System.EventArgs e)
        {
            if (_Stream == 0 || Bass.BASS_ChannelIsActive(_Stream) != BASSActive.BASS_ACTIVE_PLAYING)
            {
                // not playing anymore...
                return;
            }
            BASS_CHANNELINFO info = new BASS_CHANNELINFO();

            if (Bass.BASS_ChannelGetInfo(_Stream, info))
            {
                _bpm.Reset(info.freq);
            }
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Blocks the current thread until our output device has finished and then calls
        /// <see cref="PlaybackProcessor.HandleOutputStreamEnded"/>.
        /// </summary>
        protected internal override void WaitAndHandleOutputEnd_Sync()
        {
            DateTime   timeout = DateTime.Now + CurrentDeviceInfo.Latency + TimeSpan.FromSeconds(1);
            BassStream stream  = _outputStream;

            if (stream != null)
            {
                while (Bass.BASS_ChannelIsActive(stream.Handle) != BASSActive.BASS_ACTIVE_STOPPED && DateTime.Now < timeout)
                {
                    Thread.Sleep(10);
                }
            }
            base.WaitAndHandleOutputEnd_Sync();
        }