author | zecke <zecke> | 2004-09-21 00:40:38 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-09-21 00:40:38 (UTC) |
commit | 97e20b7cc746d5e2822385fc815739853a9c6e2f (patch) (unidiff) | |
tree | 8c72e5148518cd7b11be4ccce3d9e9f9c4c541d5 | |
parent | ee21a12cded5c53f196a5183f39e8069a22ef835 (diff) | |
download | opie-97e20b7cc746d5e2822385fc815739853a9c6e2f.zip opie-97e20b7cc746d5e2822385fc815739853a9c6e2f.tar.gz opie-97e20b7cc746d5e2822385fc815739853a9c6e2f.tar.bz2 |
If sound is not yet finished return and do not try to play
it again.
if(!snd.isFinished())
return;
-rw-r--r-- | libopie2/opiecore/device/odevice_ipaq.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_ramses.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_simpad.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 4 |
4 files changed, 8 insertions, 2 deletions
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp index 7f5aa7b..6193ddc 100644 --- a/libopie2/opiecore/device/odevice_ipaq.cpp +++ b/libopie2/opiecore/device/odevice_ipaq.cpp | |||
@@ -310,48 +310,50 @@ bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, b | |||
310 | } | 310 | } |
311 | 311 | ||
312 | if ( newkeycode != keycode ) { | 312 | if ( newkeycode != keycode ) { |
313 | if ( newkeycode != Key_unknown ) | 313 | if ( newkeycode != Key_unknown ) |
314 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); | 314 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); |
315 | return true; | 315 | return true; |
316 | } | 316 | } |
317 | else | 317 | else |
318 | return false; | 318 | return false; |
319 | } | 319 | } |
320 | 320 | ||
321 | void iPAQ::timerEvent ( QTimerEvent * ) | 321 | void iPAQ::timerEvent ( QTimerEvent * ) |
322 | { | 322 | { |
323 | killTimer ( m_power_timer ); | 323 | killTimer ( m_power_timer ); |
324 | m_power_timer = 0; | 324 | m_power_timer = 0; |
325 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); | 325 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); |
326 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); | 326 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); |
327 | } | 327 | } |
328 | 328 | ||
329 | 329 | ||
330 | void iPAQ::playAlarmSound() | 330 | void iPAQ::playAlarmSound() |
331 | { | 331 | { |
332 | #ifndef QT_NO_SOUND | 332 | #ifndef QT_NO_SOUND |
333 | static Sound snd ( "alarm" ); | 333 | static Sound snd ( "alarm" ); |
334 | if(!snd.isFinished()) | ||
335 | return; | ||
334 | 336 | ||
335 | changeMixerForAlarm(0, "/dev/sound/mixer", &snd ); | 337 | changeMixerForAlarm(0, "/dev/sound/mixer", &snd ); |
336 | snd. play(); | 338 | snd. play(); |
337 | #endif | 339 | #endif |
338 | } | 340 | } |
339 | 341 | ||
340 | 342 | ||
341 | bool iPAQ::setSoftSuspend ( bool soft ) | 343 | bool iPAQ::setSoftSuspend ( bool soft ) |
342 | { | 344 | { |
343 | bool res = false; | 345 | bool res = false; |
344 | int fd; | 346 | int fd; |
345 | 347 | ||
346 | if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { | 348 | if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { |
347 | if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) | 349 | if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) |
348 | res = true; | 350 | res = true; |
349 | else | 351 | else |
350 | ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); | 352 | ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); |
351 | 353 | ||
352 | ::close ( fd ); | 354 | ::close ( fd ); |
353 | } | 355 | } |
354 | else | 356 | else |
355 | ::perror ( "/proc/sys/ts/suspend_button_mode" ); | 357 | ::perror ( "/proc/sys/ts/suspend_button_mode" ); |
356 | 358 | ||
357 | return res; | 359 | return res; |
diff --git a/libopie2/opiecore/device/odevice_ramses.cpp b/libopie2/opiecore/device/odevice_ramses.cpp index 0cddf85..c75ea3a 100644 --- a/libopie2/opiecore/device/odevice_ramses.cpp +++ b/libopie2/opiecore/device/odevice_ramses.cpp | |||
@@ -78,48 +78,50 @@ void Ramses::init(const QString&) | |||
78 | // This table is true for a Intel XScale PXA 255 | 78 | // This table is true for a Intel XScale PXA 255 |
79 | 79 | ||
80 | #ifdef QT_QWS_ALLOW_OVERCLOCK | 80 | #ifdef QT_QWS_ALLOW_OVERCLOCK |
81 | #define OC(x...) x | 81 | #define OC(x...) x |
82 | #else | 82 | #else |
83 | #define OC(x...) | 83 | #define OC(x...) |
84 | #endif | 84 | #endif |
85 | 85 | ||
86 | d->m_cpu_frequencies->append("99000"); // mem= 99, run= 99, turbo= 99, PXbus= 50 | 86 | d->m_cpu_frequencies->append("99000"); // mem= 99, run= 99, turbo= 99, PXbus= 50 |
87 | OC(d->m_cpu_frequencies->append("118000"); ) // mem=118, run=118, turbo=118, PXbus= 59 OC'd mem | 87 | OC(d->m_cpu_frequencies->append("118000"); ) // mem=118, run=118, turbo=118, PXbus= 59 OC'd mem |
88 | d->m_cpu_frequencies->append("199100"); // mem= 99, run=199, turbo=199, PXbus= 99 | 88 | d->m_cpu_frequencies->append("199100"); // mem= 99, run=199, turbo=199, PXbus= 99 |
89 | OC(d->m_cpu_frequencies->append("236000"); ) // mem=118, run=236, turbo=236, PXbus=118 OC'd mem | 89 | OC(d->m_cpu_frequencies->append("236000"); ) // mem=118, run=236, turbo=236, PXbus=118 OC'd mem |
90 | d->m_cpu_frequencies->append("298600"); // mem= 99, run=199, turbo=298, PXbus= 99 | 90 | d->m_cpu_frequencies->append("298600"); // mem= 99, run=199, turbo=298, PXbus= 99 |
91 | OC(d->m_cpu_frequencies->append("354000"); ) // mem=118, run=236, turbo=354, PXbus=118 OC'd mem | 91 | OC(d->m_cpu_frequencies->append("354000"); ) // mem=118, run=236, turbo=354, PXbus=118 OC'd mem |
92 | d->m_cpu_frequencies->append("398099"); // mem= 99, run=199, turbo=398, PXbus= 99 | 92 | d->m_cpu_frequencies->append("398099"); // mem= 99, run=199, turbo=398, PXbus= 99 |
93 | d->m_cpu_frequencies->append("398100"); // mem= 99, run=398, turbo=398, PXbus=196 | 93 | d->m_cpu_frequencies->append("398100"); // mem= 99, run=398, turbo=398, PXbus=196 |
94 | OC(d->m_cpu_frequencies->append("471000"); ) // mem=118, run=471, turbo=471, PXbus=236 OC'd mem/core/bus | 94 | OC(d->m_cpu_frequencies->append("471000"); ) // mem=118, run=471, turbo=471, PXbus=236 OC'd mem/core/bus |
95 | } | 95 | } |
96 | 96 | ||
97 | 97 | ||
98 | void Ramses::playAlarmSound() | 98 | void Ramses::playAlarmSound() |
99 | { | 99 | { |
100 | #ifndef QT_NO_SOUND | 100 | #ifndef QT_NO_SOUND |
101 | static Sound snd ( "alarm" ); | 101 | static Sound snd ( "alarm" ); |
102 | if(!snd.isFinished()) | ||
103 | return; | ||
102 | 104 | ||
103 | changeMixerForAlarm( 0, "/dev/sound/mixer" , &snd); | 105 | changeMixerForAlarm( 0, "/dev/sound/mixer" , &snd); |
104 | snd.play(); | 106 | snd.play(); |
105 | #else | 107 | #else |
106 | #error QT_NO_SOUND defined | 108 | #error QT_NO_SOUND defined |
107 | #endif | 109 | #endif |
108 | } | 110 | } |
109 | 111 | ||
110 | 112 | ||
111 | bool Ramses::suspend() | 113 | bool Ramses::suspend() |
112 | { | 114 | { |
113 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | 115 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
114 | return false; | 116 | return false; |
115 | 117 | ||
116 | sendSuspendmsg(); | 118 | sendSuspendmsg(); |
117 | ::sync(); | 119 | ::sync(); |
118 | 120 | ||
119 | int fd; | 121 | int fd; |
120 | if ((fd = ::open("/proc/sys/pm/suspend", O_WRONLY)) >= 0) { | 122 | if ((fd = ::open("/proc/sys/pm/suspend", O_WRONLY)) >= 0) { |
121 | char writeCommand[] = "1\n"; | 123 | char writeCommand[] = "1\n"; |
122 | ::write(fd, writeCommand, sizeof(writeCommand) ); | 124 | ::write(fd, writeCommand, sizeof(writeCommand) ); |
123 | ::close(fd); | 125 | ::close(fd); |
124 | } | 126 | } |
125 | 127 | ||
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp index fd46b95..34876da 100644 --- a/libopie2/opiecore/device/odevice_simpad.cpp +++ b/libopie2/opiecore/device/odevice_simpad.cpp | |||
@@ -298,48 +298,50 @@ bool SIMpad::setLedState ( OLed l, OLedState st ) | |||
298 | 298 | ||
299 | return false; | 299 | return false; |
300 | } | 300 | } |
301 | 301 | ||
302 | 302 | ||
303 | bool SIMpad::filter ( int /*unicode*/, int /*keycode*/, int /*modifiers*/, bool /*isPress*/, bool /*autoRepeat*/ ) | 303 | bool SIMpad::filter ( int /*unicode*/, int /*keycode*/, int /*modifiers*/, bool /*isPress*/, bool /*autoRepeat*/ ) |
304 | { | 304 | { |
305 | //TODO | 305 | //TODO |
306 | return false; | 306 | return false; |
307 | } | 307 | } |
308 | 308 | ||
309 | void SIMpad::timerEvent ( QTimerEvent * ) | 309 | void SIMpad::timerEvent ( QTimerEvent * ) |
310 | { | 310 | { |
311 | killTimer ( m_power_timer ); | 311 | killTimer ( m_power_timer ); |
312 | m_power_timer = 0; | 312 | m_power_timer = 0; |
313 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); | 313 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); |
314 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); | 314 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); |
315 | } | 315 | } |
316 | 316 | ||
317 | 317 | ||
318 | void SIMpad::playAlarmSound() | 318 | void SIMpad::playAlarmSound() |
319 | { | 319 | { |
320 | #ifndef QT_NO_SOUND | 320 | #ifndef QT_NO_SOUND |
321 | static Sound snd ( "alarm" ); | 321 | static Sound snd ( "alarm" ); |
322 | if(!snd.isFinished()) | ||
323 | return; | ||
322 | 324 | ||
323 | /* save as the Sound is static! */ | 325 | /* save as the Sound is static! */ |
324 | changeMixerForAlarm( 0, "/dev/sound/mixer" , &snd); | 326 | changeMixerForAlarm( 0, "/dev/sound/mixer" , &snd); |
325 | snd. play(); | 327 | snd. play(); |
326 | #endif | 328 | #endif |
327 | } | 329 | } |
328 | 330 | ||
329 | 331 | ||
330 | bool SIMpad::suspend() // Must override because SIMpad does NOT have apm | 332 | bool SIMpad::suspend() // Must override because SIMpad does NOT have apm |
331 | { | 333 | { |
332 | qDebug( "ODevice for SIMpad: suspend()" ); | 334 | qDebug( "ODevice for SIMpad: suspend()" ); |
333 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | 335 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
334 | return false; | 336 | return false; |
335 | 337 | ||
336 | /* | 338 | /* |
337 | * we need to save the screen content | 339 | * we need to save the screen content |
338 | * then go to suspend using ODevice::suspend | 340 | * then go to suspend using ODevice::suspend |
339 | * and finally restore the screen content | 341 | * and finally restore the screen content |
340 | */ | 342 | */ |
341 | (void)::system( "cat /dev/fb/0 > /tmp/.buffer" ); | 343 | (void)::system( "cat /dev/fb/0 > /tmp/.buffer" ); |
342 | bool res = ODevice::suspend(); | 344 | bool res = ODevice::suspend(); |
343 | 345 | ||
344 | /* | 346 | /* |
345 | * restore | 347 | * restore |
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index 64fa199..733479e 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp | |||
@@ -324,52 +324,52 @@ void Zaurus::buzzer ( int sound ) | |||
324 | 324 | ||
325 | switch ( sound ){ | 325 | switch ( sound ){ |
326 | case SHARP_BUZ_TOUCHSOUND: { | 326 | case SHARP_BUZ_TOUCHSOUND: { |
327 | static Sound touch_sound("touchsound"); | 327 | static Sound touch_sound("touchsound"); |
328 | snd = &touch_sound; | 328 | snd = &touch_sound; |
329 | } | 329 | } |
330 | break; | 330 | break; |
331 | case SHARP_BUZ_KEYSOUND: { | 331 | case SHARP_BUZ_KEYSOUND: { |
332 | static Sound key_sound( "keysound" ); | 332 | static Sound key_sound( "keysound" ); |
333 | snd = &key_sound; | 333 | snd = &key_sound; |
334 | } | 334 | } |
335 | break; | 335 | break; |
336 | case SHARP_BUZ_SCHEDULE_ALARM: | 336 | case SHARP_BUZ_SCHEDULE_ALARM: |
337 | default: { | 337 | default: { |
338 | static Sound alarm_sound("alarm"); | 338 | static Sound alarm_sound("alarm"); |
339 | snd = &alarm_sound; | 339 | snd = &alarm_sound; |
340 | } | 340 | } |
341 | break; | 341 | break; |
342 | } | 342 | } |
343 | } | 343 | } |
344 | 344 | ||
345 | // If a soundname is defined, we expect that this device has | 345 | // If a soundname is defined, we expect that this device has |
346 | // sound capabilities.. Otherwise we expect to have the buzzer | 346 | // sound capabilities.. Otherwise we expect to have the buzzer |
347 | // device.. | 347 | // device.. |
348 | if ( snd ){ | 348 | if ( snd && snd->isFinished() ){ |
349 | changeMixerForAlarm( 0, "/dev/sound/mixer", snd ); | 349 | changeMixerForAlarm( 0, "/dev/sound/mixer", snd ); |
350 | snd-> play(); | 350 | snd-> play(); |
351 | } else { | 351 | } else if( !snd ) { |
352 | int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); | 352 | int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); |
353 | 353 | ||
354 | if ( fd >= 0 ) { | 354 | if ( fd >= 0 ) { |
355 | ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); | 355 | ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); |
356 | ::close ( fd ); | 356 | ::close ( fd ); |
357 | } | 357 | } |
358 | 358 | ||
359 | } | 359 | } |
360 | #endif | 360 | #endif |
361 | } | 361 | } |
362 | 362 | ||
363 | 363 | ||
364 | void Zaurus::playAlarmSound() | 364 | void Zaurus::playAlarmSound() |
365 | { | 365 | { |
366 | buzzer ( SHARP_BUZ_SCHEDULE_ALARM ); | 366 | buzzer ( SHARP_BUZ_SCHEDULE_ALARM ); |
367 | } | 367 | } |
368 | 368 | ||
369 | void Zaurus::playTouchSound() | 369 | void Zaurus::playTouchSound() |
370 | { | 370 | { |
371 | buzzer ( SHARP_BUZ_TOUCHSOUND ); | 371 | buzzer ( SHARP_BUZ_TOUCHSOUND ); |
372 | } | 372 | } |
373 | 373 | ||
374 | void Zaurus::playKeySound() | 374 | void Zaurus::playKeySound() |
375 | { | 375 | { |