|
|
@ -68,6 +68,7 @@ static inline TQCString configPath() { return TQFile::encodeName(locate( "data",
|
|
|
|
static Fader *s_fader = 0;
|
|
|
|
static Fader *s_fader = 0;
|
|
|
|
static OutFader *s_outfader = 0;
|
|
|
|
static OutFader *s_outfader = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool XineEngine::s_logarithmicVolume = false;
|
|
|
|
|
|
|
|
|
|
|
|
XineEngine::XineEngine()
|
|
|
|
XineEngine::XineEngine()
|
|
|
|
: EngineBase()
|
|
|
|
: EngineBase()
|
|
|
@ -89,6 +90,12 @@ XineEngine::XineEngine()
|
|
|
|
addPluginProperty("HasCDDA", "true"); // new property
|
|
|
|
addPluginProperty("HasCDDA", "true"); // new property
|
|
|
|
debug() << "hello" << endl;
|
|
|
|
debug() << "hello" << endl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Detect xine version, this is used for volume adjustment.
|
|
|
|
|
|
|
|
// Xine versions prior to 1.2.13 use linear volume, so the engine uses logarithmic volume.
|
|
|
|
|
|
|
|
// Xine versions starting from 1.2.13 use logarithmic volume, so the engine uses linear volume.
|
|
|
|
|
|
|
|
int xinemajor = 0, xineminor = 0, xinemaint = 0;
|
|
|
|
|
|
|
|
xine_get_version(&xinemajor, &xineminor, &xinemaint);
|
|
|
|
|
|
|
|
s_logarithmicVolume = (xinemajor * 1000000 + xineminor * 1000 + xinemaint < 1002013);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
XineEngine::~XineEngine()
|
|
|
|
XineEngine::~XineEngine()
|
|
|
@ -568,6 +575,15 @@ XineEngine::seek( uint ms )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
|
|
XineEngine::setVolume( uint value )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m_volume = value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setVolumeSW( adjustVolume( value ) );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
XineEngine::setVolumeSW( uint vol )
|
|
|
|
XineEngine::setVolumeSW( uint vol )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -577,6 +593,19 @@ XineEngine::setVolumeSW( uint vol )
|
|
|
|
xine_set_param( m_stream, XINE_PARAM_AUDIO_AMP_LEVEL, static_cast<uint>( vol * m_preamp ) );
|
|
|
|
xine_set_param( m_stream, XINE_PARAM_AUDIO_AMP_LEVEL, static_cast<uint>( vol * m_preamp ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Xine versions prior to 1.2.13 use linear volume, so the engine uses logarithmic volume.
|
|
|
|
|
|
|
|
// Xine versions starting from 1.2.13 use logarithmic volume, so the engine uses linear volume.
|
|
|
|
|
|
|
|
uint
|
|
|
|
|
|
|
|
XineEngine::adjustVolume( uint volume )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (s_logarithmicVolume)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return XineEngine::makeVolumeLogarithmic(volume);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return volume;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
XineEngine::fadeOut( uint fadeLength, bool* terminate, bool exiting )
|
|
|
|
XineEngine::fadeOut( uint fadeLength, bool* terminate, bool exiting )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -585,7 +614,7 @@ XineEngine::fadeOut( uint fadeLength, bool* terminate, bool exiting )
|
|
|
|
|
|
|
|
|
|
|
|
m_fadeOutRunning = !m_fadeOutRunning;
|
|
|
|
m_fadeOutRunning = !m_fadeOutRunning;
|
|
|
|
const bool isPlaying = m_stream && ( xine_get_status( m_stream ) == XINE_STATUS_PLAY );
|
|
|
|
const bool isPlaying = m_stream && ( xine_get_status( m_stream ) == XINE_STATUS_PLAY );
|
|
|
|
const float originalVol = Engine::Base::makeVolumeLogarithmic( m_volume ) * m_preamp;
|
|
|
|
const float originalVol = adjustVolume( m_volume ) * m_preamp;
|
|
|
|
|
|
|
|
|
|
|
|
// On shutdown, limit fadeout to 3 secs max, so that we don't risk getting killed
|
|
|
|
// On shutdown, limit fadeout to 3 secs max, so that we don't risk getting killed
|
|
|
|
const int length = exiting ? TQMIN( fadeLength, 3000 ) : fadeLength;
|
|
|
|
const int length = exiting ? TQMIN( fadeLength, 3000 ) : fadeLength;
|
|
|
@ -605,7 +634,7 @@ XineEngine::fadeOut( uint fadeLength, bool* terminate, bool exiting )
|
|
|
|
if( *terminate ) break;
|
|
|
|
if( *terminate ) break;
|
|
|
|
|
|
|
|
|
|
|
|
::usleep( stepSizeUs );
|
|
|
|
::usleep( stepSizeUs );
|
|
|
|
float vol = Engine::Base::makeVolumeLogarithmic( m_volume ) * m_preamp;
|
|
|
|
float vol = adjustVolume( m_volume ) * m_preamp;
|
|
|
|
float mix = (float)t.elapsed() / (float)length;
|
|
|
|
float mix = (float)t.elapsed() / (float)length;
|
|
|
|
if ( mix > 1.0 )
|
|
|
|
if ( mix > 1.0 )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1294,7 +1323,7 @@ Fader::run()
|
|
|
|
elapsedUs += stepSizeUs;
|
|
|
|
elapsedUs += stepSizeUs;
|
|
|
|
|
|
|
|
|
|
|
|
// get volume (amarok main * equalizer preamp)
|
|
|
|
// get volume (amarok main * equalizer preamp)
|
|
|
|
float vol = XineEngine::makeVolumeLogarithmic( m_engine->m_volume ) * m_engine->m_preamp;
|
|
|
|
float vol = XineEngine::adjustVolume( m_engine->m_volume ) * m_engine->m_preamp;
|
|
|
|
|
|
|
|
|
|
|
|
// compute the mix factor as the percentage of time spent since fade begun
|
|
|
|
// compute the mix factor as the percentage of time spent since fade begun
|
|
|
|
float mix = (elapsedUs / 1000.0) / (float)m_fadeLength;
|
|
|
|
float mix = (elapsedUs / 1000.0) / (float)m_fadeLength;
|
|
|
|