internal void StreamTrackAsync(Track track) { #if DEBUG if (Log.IsDebugEnabled) { Log.Debug("StreamTrackAsync"); } #endif // Prepare to play the track. #if DEBUG if (Log.IsDebugEnabled) { Log.Debug("Playing track: " + track.Name); } #endif // Configure the LAME MP3 encoder. LameEncoder = new LameProgram(track); // Reset the variable used to block until playback done. _playbackDone.Reset(); // Load the track. sp_error loadResult = Session.PlayerLoad(track); #if DEBUG if (Log.IsDebugEnabled) { Log.Debug("Load: " + loadResult); } #endif // Play the track. sp_error playResult = Session.PlayerPlay(true); #if DEBUG if (Log.IsDebugEnabled) { Log.Debug("Play: " + playResult); } #endif }
void HandleOnEndOfTrack(Session sender, SessionEventArgs e) { #if DEBUG if (Log.IsDebugEnabled) { Log.Debug("End of music delivery."); } #endif try { LameEncoder.Close(); LameEncoder = null; _playbackDone.Set(); } catch (Exception ex) { #if DEBUG if (Log.IsErrorEnabled) { Log.Error("Exception", ex); } #endif } }
internal void StreamTrackAsync(Track track) { #if DEBUG if (Log.IsDebugEnabled) Log.Debug("StreamTrackAsync"); #endif // Prepare to play the track. #if DEBUG if (Log.IsDebugEnabled) Log.Debug("Playing track: " + track.Name); #endif // Configure the LAME MP3 encoder. LameEncoder = new LameProgram(track); // Reset the variable used to block until playback done. _playbackDone.Reset(); // Load the track. sp_error loadResult = Session.PlayerLoad(track); #if DEBUG if (Log.IsDebugEnabled) Log.Debug("Load: " + loadResult); #endif // Play the track. sp_error playResult = Session.PlayerPlay(true); #if DEBUG if (Log.IsDebugEnabled) Log.Debug("Play: " + playResult); #endif }