Revert previous commit, was incorrect
[amarok.git] / src / enginebase.cpp
blob0458d3d603fcdb28f1d14025acce4e72b09168ad
1 //Copyright: (C) 2003 Mark Kretschmann
2 // (C) 2004,2005 Max Howell, <max.howell@methylblue.com>
3 //License: See COPYING
5 #include "enginebase.h"
7 #include <cmath>
10 Engine::Base::Base()
11 : Amarok::Plugin()
12 , m_xfadeLength( 0 )
13 , m_xfadeNextTrack( false )
14 , m_volume( 50 )
15 , m_scope( SCOPESIZE )
16 , m_isStream( false )
20 Engine::Base::~Base()
24 //////////////////////////////////////////////////////////////////////
27 bool
28 Engine::Base::load( const KUrl &url, bool stream )
30 m_url = url;
31 m_isStream = stream;
33 return true;
36 void
37 Engine::Base::beginFadeOut()
39 stop();
42 void Engine::Base::setVolume( uint value )
44 m_volume = value;
46 setVolumeSW( makeVolumeLogarithmic( value ) );
50 uint
51 Engine::Base::makeVolumeLogarithmic( uint volume ) // static
53 // We're using a logarithmic function to make the volume ramp more natural.
54 return static_cast<uint>( 100 - 100.0 * std::log10( ( 100 - volume ) * 0.09 + 1.0 ) );
58 #include "enginebase.moc"