-rw-r--r-- | library/qpeapplication.cpp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index c41dd06..852671a 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp @@ -330,6 +330,48 @@ static void setMic( int t = 0, int percent = -1 ) } +static void setBass( int t = 0, int percent = -1 ) +{ + switch ( t ) { + case 0: { + Config cfg( "qpe" ); + cfg.setGroup( "Volume" ); + if ( percent < 0 ) + percent = cfg.readNumEntry( "BassPercent", 50 ); + + int fd = 0; + int bass = percent; + if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { + ioctl( fd, MIXER_WRITE( SOUND_MIXER_BASS ), &bass ); + ::close( fd ); + } + } + break; + } +} + + +static void setTreble( int t = 0, int percent = -1 ) +{ + switch ( t ) { + case 0: { + Config cfg( "qpe" ); + cfg.setGroup( "Volume" ); + if ( percent < 0 ) + percent = cfg.readNumEntry( "TreblePercent", 50 ); + + int fd = 0; + int treble = percent; + if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { + ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble ); + ::close( fd ); + } + } + break; + } +} + + /*! \class QPEApplication qpeapplication.h \brief The QPEApplication class implements various system services @@ -1116,6 +1158,25 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data setMic(); emit micChanged( micMuted ); } + else if ( msg == "setBass(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> + int t, v; + stream >> t >> v; + setBass( t, v ); + } + else if ( msg == "bassChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> + setBass(); + } + else if ( msg == "setTreble(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> + int t, v; + stream >> t >> v; + setTreble( t, v ); + } + else if ( msg == "trebleChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> + setTreble(); + } + + + #endif } |