author | sandman <sandman> | 2002-06-09 23:37:26 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-06-09 23:37:26 (UTC) |
commit | 65b1a790493272a38b0ac44e219d5186168fabac (patch) (side-by-side diff) | |
tree | b26ebca8644af8e7af68690f13c45cebfd747e49 /library/sound.cpp | |
parent | bb2f23307a6797c4b338b4504de39fdde3678893 (diff) | |
download | opie-65b1a790493272a38b0ac44e219d5186168fabac.zip opie-65b1a790493272a38b0ac44e219d5186168fabac.tar.gz opie-65b1a790493272a38b0ac44e219d5186168fabac.tar.bz2 |
Fixed sound handling for iPAQs
New feature: raise volume while playing Alarm sound (confiureable via
qpe.conf / Sound / AlarmPercent -- needs a GUI !)
-rw-r--r-- | library/sound.cpp | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/library/sound.cpp b/library/sound.cpp index 373fd4c..602fcf0 100644 --- a/library/sound.cpp +++ b/library/sound.cpp @@ -27,2 +27,9 @@ +#include <unistd.h> +#include <fcntl.h> +#include <sys/ioctl.h> +#include <sys/soundcard.h> + +#include "config.h" +#include <qmessagebox.h> #ifndef QT_NO_SOUND @@ -101,7 +108,9 @@ public: { + loopsleft=0; } - void playLoop() + void playLoop(int loopcnt = -1) { // needs server support + loopsleft = loopcnt; @@ -113,4 +122,9 @@ public: - void timerEvent(QTimerEvent*) + void timerEvent ( QTimerEvent *e ) { + if (loopsleft >= 0) { + if (--loopsleft <= 0) + killTimer (e->timerId()); + return; + } play(); @@ -118,4 +132,10 @@ public: + bool isFinished ( ) const + { + return ( loopsleft == 0 ); + } + private: QString filename; + int loopsleft; }; @@ -141,3 +161,3 @@ void Sound::play() d->killTimers(); - d->play(); + d->playLoop(1); #endif @@ -160,2 +180,8 @@ void Sound::stop() +bool Sound::isFinished() const +{ +#ifndef QT_NO_SOUND + return d->isFinished(); +#endif +} @@ -163,3 +189,2 @@ void Sound::soundAlarm() { -#ifdef QT_QWS_CUSTOM # ifndef QT_NO_COP @@ -167,7 +192,2 @@ void Sound::soundAlarm() # endif -#else -# ifndef QT_NO_SOUND - QSound::play(Resource::findSound("alarm")); -# endif -#endif } |