Skip to content

Commit

Permalink
restored: short crossfade on trackskip if crossfade is enabled functi…
Browse files Browse the repository at this point in the history
…onality.
  • Loading branch information
chadoe committed Jun 17, 2012
1 parent 3b0402f commit 08b9221
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions xbmc/cores/paplayer/PAPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit 08b9221

Please sign in to comment.