-rw-r--r-- | libopie/odevice.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 9fd3ae2..c947630 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -583,28 +583,26 @@ void iPAQ::alarmSound ( ) | |||
583 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { | 583 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { |
584 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { | 584 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { |
585 | Config cfg ( "qpe" ); | 585 | Config cfg ( "qpe" ); |
586 | cfg. setGroup ( "Volume" ); | 586 | cfg. setGroup ( "Volume" ); |
587 | 587 | ||
588 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); | 588 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); |
589 | if ( volalarm < 0 ) | 589 | if ( volalarm < 0 ) |
590 | volalarm = 0; | 590 | volalarm = 0; |
591 | else if ( volalarm > 100 ) | 591 | else if ( volalarm > 100 ) |
592 | volalarm = 100; | 592 | volalarm = 100; |
593 | volalarm |= ( volalarm << 8 ); | 593 | volalarm |= ( volalarm << 8 ); |
594 | 594 | ||
595 | if (( volalarm & 0xff ) > ( vol & 0xff )) { | 595 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) |
596 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) | 596 | vol_reset = true; |
597 | vol_reset = true; | ||
598 | } | ||
599 | } | 597 | } |
600 | } | 598 | } |
601 | 599 | ||
602 | snd. play ( ); | 600 | snd. play ( ); |
603 | while ( !snd. isFinished ( )) | 601 | while ( !snd. isFinished ( )) |
604 | qApp-> processEvents ( ); | 602 | qApp-> processEvents ( ); |
605 | 603 | ||
606 | if ( fd >= 0 ) { | 604 | if ( fd >= 0 ) { |
607 | if ( vol_reset ) | 605 | if ( vol_reset ) |
608 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); | 606 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); |
609 | ::close ( fd ); | 607 | ::close ( fd ); |
610 | } | 608 | } |