summaryrefslogtreecommitdiff
authorzecke <zecke>2004-09-21 00:40:38 (UTC)
committer zecke <zecke>2004-09-21 00:40:38 (UTC)
commit97e20b7cc746d5e2822385fc815739853a9c6e2f (patch) (unidiff)
tree8c72e5148518cd7b11be4ccce3d9e9f9c4c541d5
parentee21a12cded5c53f196a5183f39e8069a22ef835 (diff)
downloadopie-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;
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.cpp2
-rw-r--r--libopie2/opiecore/device/odevice_ramses.cpp2
-rw-r--r--libopie2/opiecore/device/odevice_simpad.cpp2
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp4
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
@@ -318,32 +318,34 @@ bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, b
318 return false; 318 return false;
319} 319}
320 320
321void iPAQ::timerEvent ( QTimerEvent * ) 321void 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
330void iPAQ::playAlarmSound() 330void 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
341bool iPAQ::setSoftSuspend ( bool soft ) 343bool 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
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
@@ -86,32 +86,34 @@ void Ramses::init(const QString&)
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
98void Ramses::playAlarmSound() 98void 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
111bool Ramses::suspend() 113bool 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();
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
@@ -306,32 +306,34 @@ bool SIMpad::filter ( int /*unicode*/, int /*keycode*/, int /*modifiers*/, bool
306 return false; 306 return false;
307} 307}
308 308
309void SIMpad::timerEvent ( QTimerEvent * ) 309void 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
318void SIMpad::playAlarmSound() 318void 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
330bool SIMpad::suspend() // Must override because SIMpad does NOT have apm 332bool 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
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
@@ -332,36 +332,36 @@ void Zaurus::buzzer ( int sound )
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
364void Zaurus::playAlarmSound() 364void Zaurus::playAlarmSound()
365{ 365{
366 buzzer ( SHARP_BUZ_SCHEDULE_ALARM ); 366 buzzer ( SHARP_BUZ_SCHEDULE_ALARM );
367} 367}