/// <summary> /// Discard the entire buffer to stop playing /// </summary> public void Reset() { if (buffer != null) { buffer.ClearBuffer(); } }
/// <summary> /// Dispose and destroy the audio playback object /// </summary> public void Destroy() { waveOut.Stop(); provider.ClearBuffer(); waveOut.Dispose(); waveOut = null; provider = null; }
private static void TryJukeboxStart() { if (_jukeboxList == null) { return; } IList <Spotify.Track> tracks = _jukeboxList.Tracks; if (tracks.Count == 0) { Console.WriteLine("jukebox: No more tracks in playlist. Waiting"); return; } if (_trackIndex >= tracks.Count) { Console.WriteLine("jukebox: Not more tracks in playlist. Waiting"); return; } Spotify.Track track = tracks[_trackIndex]; if (_currentTrack != null && !_currentTrack.IsClone(track)) { _session.PlayerUnload(); _audioSink.Stop(); _audioProvider.ClearBuffer(); _currentTrack = null; } if (track.Error != Spotify.Error.Ok) { return; } if (_currentTrack != null && _currentTrack.IsClone(track)) { return; } Console.WriteLine("jukebox: Now playing \"{0}\"...", track.Name); _session.PlayerLoad(track); _session.PlayerPlay(true); _audioSink.Play(); _currentTrack = track; }