Beispiel #1
0
 public void Pause()
 {
     if (BassHelper.IsInitialized && fileStream != 0)
     {
         Bass.BASS_ChannelPause(fileStream);
     }
 }
Beispiel #2
0
 public void PauseStream(int _stream)
 {
     if (_stream != 0)
     {
         Bass.BASS_ChannelPause(_stream);
     }
 }
Beispiel #3
0
 public void SetPosition(double position)
 {
     Bass.BASS_ChannelPause(_stream);
     Bass.BASS_ChannelSetPosition(_stream, position);
     Bass.BASS_ChannelPlay(_stream, false);
     vm.AudioPosition = position;
 }
 public override void Pause()
 {
     if (Bass.BASS_ChannelIsActive(_stream) == BASSActive.BASS_ACTIVE_PLAYING)
     {
         Bass.BASS_ChannelPause(_stream);
     }
 }
Beispiel #5
0
        public void Pause()
        {
            lock (this)
            {
                if (fStatus != SongPlayerStatus.Playing)
                {
                    throw new SongPlayerInconsistence(
                              string.Format("Unexpected SongPlayer status {0}.", fStatus.ToString()));
                }

                //if (fStreamHandler != 0)
                if (fStreamFxHandler != 0)
                {
                    //bool status = Bass.BASS_ChannelPause(fStreamHandler);
                    bool status = Bass.BASS_ChannelPause(fStreamFxHandler);

                    if (!status)
                    {
                        throw new AudioProcessingError(
                                  string.Format("SongPlayer.Pause() couldn´t pause the file [{0}].", fFileName));
                    }
                }

                //Update the SongPlayer.Status
                this.fStatus = SongPlayerStatus.Paused;
            }
        }
        /// <summary>
        ///		This function makes sure your default device is being used, if not, reload Bass and the song back and continue as if nothing happened.
        /// </summary>
        private void CheckDevice()
        {
            if (!BassManager.CheckDevice(streamID))
            {
                var pos  = Bass.BASS_ChannelGetPosition(streamID, BASSMode.BASS_POS_BYTES);
                var secs = TimeSpan.FromSeconds(Bass.BASS_ChannelBytes2Seconds(streamID, pos));

                var state  = Bass.BASS_ChannelIsActive(streamID);
                var volume = 0.3f;

                Bass.BASS_ChannelGetAttribute(streamID, BASSAttribute.BASS_ATTRIB_VOL, ref volume);

                BassManager.Reload();

                Load(lastFile);

                Volume      = volume;
                CurrentTime = secs;

                switch (state)
                {
                case BASSActive.BASS_ACTIVE_PAUSED:
                case BASSActive.BASS_ACTIVE_STOPPED:
                    Bass.BASS_ChannelPause(streamID);
                    Bass.BASS_ChannelSetPosition(streamID, pos, BASSMode.BASS_POS_BYTES);
                    break;

                case BASSActive.BASS_ACTIVE_STALLED:
                case BASSActive.BASS_ACTIVE_PLAYING:
                    Bass.BASS_ChannelPlay(streamID, false);
                    break;
                }
            }
        }
Beispiel #7
0
        protected void OnPlayUpdated()
        {
            if (this.BassHandle.HasValue)
            {
                //Check if channel is within a mixer or not
                int mixerhandle = BassMix.BASS_Mixer_ChannelGetMixer(this.BassHandle.Value);

                if (mixerhandle != 0)
                {
                    //In a mixer, updated the proper status
                    if (this.play)
                    {
                        BassMix.BASS_Mixer_ChannelPlay(this.basshandle.Value);
                    }
                    else
                    {
                        BassMix.BASS_Mixer_ChannelPause(this.basshandle.Value);
                    }
                }
                else
                {
                    //Not in a mixer, just updated standard status
                    if (this.play)
                    {
                        Bass.BASS_ChannelPlay(this.basshandle.Value, false);
                    }
                    else
                    {
                        Bass.BASS_ChannelPause(this.basshandle.Value);
                    }
                }
            }
        }
Beispiel #8
0
 void Location_MouseDown(object sender, MouseButtonEventArgs e)
 {
     IsLocationChanging = true;
     IsPaused           = true;
     Bass.BASS_ChannelPause(Stream);
     Bass.BASS_ChannelSetAttribute(Stream, BASSAttribute.BASS_ATTRIB_VOL, 0f);
 }
Beispiel #9
0
 public void StopButton()
 {
     if (Bass.BASS_ChannelIsActive(Stream) == BASSActive.BASS_ACTIVE_PLAYING)
     {
         Bass.BASS_ChannelPause(Stream);
     }
 }
Beispiel #10
0
        /// <summary>
        /// pause the current stream
        /// </summary>
        public void Pause()
        {
            if (Valid && StreamStatus == StreamStatus.CanPause)
            {
                //Check if the Fader is on, if so
                //First fade and then pause, else just pause
                if (Config.ReactorFade)
                {
                    var fader = new Fader(this, FadeMode.Linear, 5, 250, true, Volume);

                    fader.Start();
                    fader.ActionCompletedEvent += new Fader.ActionCompleted(delegate
                    {
                        if (Bass.BASS_ChannelPause(Handle))
                        {
                            StreamStatus = StreamStatus.CanPlay;
                        }
                    });
                }
                else // just pause
                {
                    if (Bass.BASS_ChannelPause(Handle))
                    {
                        StreamStatus = StreamStatus.CanPlay;
                    }
                }
            }
        }
Beispiel #11
0
 //Pause
 public static void Pause()
 {
     if (Bass.BASS_ChannelIsActive(Stream) == BASSActive.BASS_ACTIVE_PLAYING)
     {
         Bass.BASS_ChannelPause(Stream);
     }
 }
Beispiel #12
0
        async void Position_Change()
        {
            while (Visibility == Visibility.Visible)
            {
                if (IsEnded)
                {
                    await Task.Delay(500);

                    Bass.BASS_ChannelPause(Stream);
                    Bass.BASS_ChannelSetPosition(Stream, 0, BASSMode.BASS_POS_BYTES);
                    IsPaused         = true;
                    IsEnded          = false;
                    Location_S.Value = 0;
                    Location_T.Text  = "00:00";
                }
                if (Bass.BASS_ChannelIsActive(Stream) == BASSActive.BASS_ACTIVE_PLAYING && !IsLocationChanging)
                {
                    long position = Bass.BASS_ChannelGetPosition(Stream);
                    Location_S.Value = Bass.BASS_ChannelBytes2Seconds(Stream, position);
                    TimeSpan Time    = TimeSpan.FromSeconds(Location_S.Value);
                    string   Minutes = Time.Minutes.ToString();
                    string   Seconds = Time.Seconds.ToString();
                    if (Time.Minutes < 10)
                    {
                        Minutes = "0" + Time.Minutes;
                    }
                    if (Time.Seconds < 10)
                    {
                        Seconds = "0" + Time.Seconds;
                    }
                    Location_T.Text = Minutes + ":" + Seconds;
                }
                await Task.Delay(100);
            }
        }
        void Play(String m_filename)
        {
            switch (Bass.BASS_ChannelIsActive(_stream))
            {
            case BASSActive.BASS_ACTIVE_STOPPED:
                Bass.BASS_StreamFree(_stream);
                if (!string.IsNullOrEmpty(m_filename))
                {
                    _fs     = System.IO.File.OpenRead(m_filename);
                    _stream = Bass.BASS_StreamCreateFileUser(BASSStreamSystem.STREAMFILE_NOBUFFER, BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_PRESCAN | BASSFlag.BASS_STREAM_AUTOFREE, _myStreamCreateUser, IntPtr.Zero);
                    if (_stream != 0)
                    {
                        m_totaltime = String.Format(Utils.FixTimespan(Bass.BASS_ChannelBytes2Seconds(_stream, Bass.BASS_ChannelGetLength(_stream)), "MMSS"));
                        Bass.BASS_ChannelPlay(_stream, true);
                        MainProgressBar.Maximum = (int)Bass.BASS_ChannelBytes2Seconds(_stream, Bass.BASS_ChannelGetLength(_stream));
                        _maintimer.Start();
                        iconPlay.Kind = MaterialDesignThemes.Wpf.PackIconKind.Pause;
                        //
                    }
                }
                break;

            case BASSActive.BASS_ACTIVE_PLAYING:
                Bass.BASS_ChannelPause(_stream);
                iconPlay.Kind = MaterialDesignThemes.Wpf.PackIconKind.Play;
                break;

            case BASSActive.BASS_ACTIVE_PAUSED:
                Bass.BASS_ChannelPlay(_stream, false);
                iconPlay.Kind = MaterialDesignThemes.Wpf.PackIconKind.Pause;
                break;
            }
        }
Beispiel #14
0
        /// <summary>
        /// Starts, pauses or resumes playback of the current song
        /// </summary>
        public void PlayPause()
        {
            if (currentTrack == null)
            {
                throw new Exception("No song loaded.");
            }

            if (playing)
            {
                Bass.BASS_ChannelPause(currentHandle);
                playing = false;
            }
            else
            {
                if (currentHandle == 0)
                {
                    currentHandle = Bass.BASS_StreamCreateFile(currentTrack.Tags.filename, 0, 0, BASSFlag.BASS_DEFAULT);
                    Bass.BASS_ChannelSetDevice(currentHandle, currentDevice);
                    Bass.BASS_ChannelSetSync(currentHandle, BASSSync.BASS_SYNC_END, 0, EndTrackDelegate, IntPtr.Zero);

                    long scrobblePos = Bass.BASS_ChannelGetLength(currentHandle) / 2;
                    Bass.BASS_ChannelSetSync(currentHandle, BASSSync.BASS_SYNC_POS, scrobblePos, ScrobbleTrackDelegate, IntPtr.Zero);
                }
                Bass.BASS_ChannelPlay(currentHandle, false);
                playing = true;
            }
        }
Beispiel #15
0
 public void Pause()
 {
     if (CurrentMusicHandle != 0)
     {
         Bass.BASS_ChannelPause(CurrentMusicHandle);
     }
 }
Beispiel #16
0
 public void Pause()
 {
     if (stream != -1024)
     {
         Bass.BASS_ChannelPause(stream);
     }
 }
        public void Pause()
        {
            var pos = Bass.BASS_ChannelGetPosition(streamID, BASSMode.BASS_POS_BYTES);

            Bass.BASS_ChannelPause(streamID);

            Bass.BASS_ChannelSetPosition(streamID, pos, BASSMode.BASS_POS_BYTES);
        }
Beispiel #18
0
 public void Pause()
 {
     if (!Bass.BASS_ChannelPause(__BassStream))
     {
         Error.HandleBASSError("BASS_ChannelPause");
     }
     __PlayingStopwatch.Stop();
 }
Beispiel #19
0
 /// <summary>
 /// Pausing the stream (check the state first)
 /// </summary>
 public void Pause()
 {
     if (Bass.BASS_ChannelIsActive(Stream) == BASSActive.BASS_ACTIVE_PLAYING)
     {
         Bass.BASS_ChannelPause(Stream);
     }
     activeState = PlayerState.Paused;
 }
Beispiel #20
0
 private void Pause_B_Click(object sender, RoutedEventArgs e)
 {
     if (IsClosing || IsBusy)
     {
         return;
     }
     Bass.BASS_ChannelPause(Stream);
 }
Beispiel #21
0
 /// <summary>
 /// 暂停
 /// </summary>
 public void Pause()
 {
     if (Bass.BASS_ChannelIsActive(stream) == BASSActive.BASS_ACTIVE_PLAYING)
     {
         Bass.BASS_ChannelPause(stream);
         OnStateChangedEvent(new MusicEventArgs(PlayState, Volume, Schedule, false));
     }
 }
Beispiel #22
0
 /// <summary>
 /// Пауза
 /// </summary>
 public static void Pause()
 {
     if (Bass.BASS_ChannelIsActive(Stream) == BASSActive.BASS_ACTIVE_PLAYING)
     {
         Bass.BASS_ChannelPause(Stream);
         CommonInterface.Pause = true;
     }
 }
Beispiel #23
0
 public void Pause()
 {
     if (this.playing != 2 && this.stream != 0)
     {
         this.playing = 2;
         Bass.BASS_ChannelPause(this.stream);
     }
 }
Beispiel #24
0
 public void Pause()
 {
     if (Bass.BASS_ChannelIsActive(Stream) == BASSActive.BASS_ACTIVE_PLAYING)
     {
         Bass.BASS_ChannelPause(Stream);
     }
     isStopped = true;
 }
Beispiel #25
0
 public void DetachChannel(ChannelInfo info)
 {
     if (info.BassHandle.HasValue)
     {
         Bass.BASS_ChannelPause(info.BassHandle.Value);
         BassMix.BASS_Mixer_ChannelRemove(info.BassHandle.Value);
     }
     this.Streams.Remove(info);
 }
Beispiel #26
0
        internal void Pause()
        {
            if (!Playing || !hasChannel)
            {
                return;
            }

            Bass.BASS_ChannelPause(channel);
        }
Beispiel #27
0
 public void Pause()
 {
     _timer.Stop();
     this.State = PlayerState.Paused;
     if (Bass.BASS_ChannelIsActive(_stream) == BASSActive.BASS_ACTIVE_PLAYING)
     {
         Bass.BASS_ChannelPause(_stream);
     }
 }
Beispiel #28
0
 public void Pause()
 {
     if (Bass.BASS_ChannelIsActive(this._stream) == BASSActive.BASS_ACTIVE_PLAYING)
     {
         Bass.BASS_ChannelPause(this._stream);
         return;
     }
     Bass.BASS_ChannelPlay(this._stream, false);
 }
 // Token: 0x060000C4 RID: 196 RVA: 0x00002BC6 File Offset: 0x00000DC6
 public void PauseSong()
 {
     if (this.isSongLoaded && !this.isSongPaused)
     {
         Bass.BASS_ChannelPause(this.linkedChannel);
         this.isSongPaused  = true;
         this.isSongPlaying = false;
         return;
     }
 }
Beispiel #30
0
 public void Pause()
 {
     if (IsPlaying && CanPause)
     {
         Bass.BASS_ChannelPause(ActiveStreamHandle);
         IsPlaying = false;
         CanPlay   = true;
         CanPause  = false;
     }
 }