Example #1
0
        /// <summary>Stops the currently played song.</summary>
        private void Stop(bool restart)
        {
            Log.Write(Log.Level.Debug, "AF stop old");

            playerConnection.AudioStop();
            if (!restart)
            {
                OnResourceEnd(false);
            }
        }
 /// <summary>Stops the currently played song.</summary>
 /// <param name="restart">When set to true, the AudioBob won't be notified aubout the stop.
 /// Use this parameter to prevent fast off-on switching.</param>
 private void Stop(bool restart)
 {
     Log.Write(Log.Level.Debug, "AF stop old (restart:{0})", restart);
     if (CurrentPlayData != null)
     {
         CurrentPlayData = null;
         if (!restart)
         {
             playerConnection.AudioStop();
         }
         OnResourceStopped?.Invoke(this, restart);
     }
 }
Example #3
0
        private void StopInternal(bool songEndedByCallback)
        {
            BeforeResourceStopped?.Invoke(this, new SongEndEventArgs(songEndedByCallback));

            if (songEndedByCallback)
            {
                var result = Next(CurrentPlayData?.Invoker ?? InvokerData.Anonymous, false);
                if (result.Ok)
                {
                    return;
                }
                Log.Info("Song queue ended: {0}", result.Error);
            }
            else
            {
                playerConnection.AudioStop();
            }

            CurrentPlayData = null;
            AfterResourceStopped?.Invoke(this, EventArgs.Empty);
        }