Permalink
Browse files

restored: short crossfade on trackskip if crossfade is enabled functi…

…onality.
  • Loading branch information...
1 parent 3b0402f commit 08b922135d11b97182533a3698927e962b04b872 @chadoe committed May 19, 2012
Showing with 22 additions and 2 deletions.
  1. +22 −2 xbmc/cores/paplayer/PAPlayer.cpp
@@ -37,6 +37,7 @@
#define TIME_TO_CACHE_NEXT_FILE 5000 /* 5 seconds before end of song, start caching the next song */
#define FAST_XFADE_TIME 80 /* 80 milliseconds */
+#define MAX_SKIP_XFADE_TIME 2000 /* max 2 seconds crossfade on track skip */
// PAP: Psycho-acoustic Audio Player
// Supporting all open audio codec standards.
@@ -221,12 +222,31 @@ void PAPlayer::CloseAllStreams(bool fade/* = true */)
bool PAPlayer::OpenFile(const CFileItem& file, const CPlayerOptions &options)
{
- CloseAllStreams();
- m_crossFadeTime = g_guiSettings.GetInt("musicplayer.crossfade") * 1000;
+ //set crossfade time for the file being opened
+ UpdateCrossFadingTime(file);
+
+ if (m_streams.size() > 1 || !m_crossFadeTime)
+ {
+ CloseAllStreams();
+ }
if (!QueueNextFileEx(file, false))
return false;
+ CSharedLock lock(m_streamsLock);
+ if (m_streams.size() == 2)
+ {
+ //do a short crossfade on trackskip, set to max 2 seconds for these prev/next transitions
+ if (m_crossFadeTime > MAX_SKIP_XFADE_TIME)
+ m_crossFadeTime = MAX_SKIP_XFADE_TIME;
+
+ //start transition to next track
+ StreamInfo* si = m_streams.front();
+ si->m_playNextAtFrame = si->m_framesSent; //start next track at current frame
+ si->m_prepareTriggered = true; //next track is ready to go
+ }
+ lock.Leave();
+
if (!IsRunning())
Create();

0 comments on commit 08b9221

Please sign in to comment.