author | harlekin <harlekin> | 2002-12-13 19:37:59 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-12-13 19:37:59 (UTC) |
commit | e348262d418e3a133d13d039ed23da4625726f9d (patch) (side-by-side diff) | |
tree | 36cdf26700d424b06b6c37b86e5f1e07bc233b88 | |
parent | 11ccc2e5341677cd54037a1f9cfb04831feed0f9 (diff) | |
download | opie-e348262d418e3a133d13d039ed23da4625726f9d.zip opie-e348262d418e3a133d13d039ed23da4625726f9d.tar.gz opie-e348262d418e3a133d13d039ed23da4625726f9d.tar.bz2 |
added Bass and Treble handling - next stop should be odevice
-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 @@ -329,8 +329,50 @@ 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 that are available to all Qtopia applications. @@ -1115,8 +1157,27 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data stream >> micMuted; 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 } /*! |