diff options
-rw-r--r-- | muse/ChangeLog | 2 | ||||
-rw-r--r-- | muse/muse/driver/alsatimer.cpp | 7 | ||||
-rw-r--r-- | muse/muse/driver/dummyaudio.cpp | 9 | ||||
-rw-r--r-- | muse/muse/midiseq.cpp | 6 |
4 files changed, 20 insertions, 4 deletions
diff --git a/muse/ChangeLog b/muse/ChangeLog index d829a6e4..09b431f8 100644 --- a/muse/ChangeLog +++ b/muse/ChangeLog @@ -1,3 +1,5 @@ +18.07.2010 + * Fixed: Handle errors during timer initialization more gracefully (rj) 15.07.2010 * Added: Volume control for audio metronome (rj) 12.07.2010 diff --git a/muse/muse/driver/alsatimer.cpp b/muse/muse/driver/alsatimer.cpp index 277ecd34..f8294bec 100644 --- a/muse/muse/driver/alsatimer.cpp +++ b/muse/muse/driver/alsatimer.cpp @@ -55,7 +55,7 @@ }; int max_ids = sizeof(test_ids) / sizeof(int); long best_res = LONG_MAX; - int best_dev = SND_TIMER_GLOBAL_SYSTEM; + int best_dev = -1; // SND_TIMER_GLOBAL_SYSTEM; int i; if (id || info || params) { @@ -89,6 +89,9 @@ device = best_dev; } + if(best_dev==-1) + return -1; // no working timer found + sprintf(timername, "hw:CLASS=%i,SCLASS=%i,CARD=%i,DEV=%i,SUBDEV=%i", devclass, sclass, card, device, subdevice); if ((err = snd_timer_open(&handle, timername, SND_TIMER_OPEN_NONBLOCK))<0) { fprintf(stderr, "AlsaTimer::initTimer(): timer open %i (%s)\n", err, snd_strerror(err)); @@ -142,7 +145,7 @@ setTick = (1000000000 / snd_timer_info_get_resolution(info)) / freq; if (setTick == 0) { - // return, print error if freq i below 500 (timing will suffer) + // return, print error if freq is below 500 (timing will suffer) if (((1000000000.0 / snd_timer_info_get_resolution(info)) / snd_timer_params_get_ticks(params)) < 500) { fprintf(stderr,"AlsaTimer::setTimerTicks(): requested freq %u Hz too high for timer (max is %g)\n", freq, 1000000000.0 / snd_timer_info_get_resolution(info)); diff --git a/muse/muse/driver/dummyaudio.cpp b/muse/muse/driver/dummyaudio.cpp index 54b1609f..d7c2e127 100644 --- a/muse/muse/driver/dummyaudio.cpp +++ b/muse/muse/driver/dummyaudio.cpp @@ -260,10 +260,15 @@ static void* dummyLoop(void* ptr) unsigned int tickRate = sampleRate / segmentSize; AlsaTimer timer; - fprintf(stderr, "Finding best alsa timer for dummy driver:\n"); + fprintf(stderr, "Get alsa timer for dummy driver:\n"); timer.setFindBestTimer(false); int fd = timer.initTimer(); - + if (fd==-1) { + QMessageBox::critical( 0, /*tr*/(QString("Failed to start timer for dummy audio driver!")), + /*tr*/(QString("No functional timer was available.\n" + "Alsa timer not available, check if module snd_timer is available and /dev/snd/timer is available"))); + } + /* Depending on nature of the timer, the requested tickRate might not * be available. The return value is the nearest available frequency, * so use this to reset our dummpy sampleRate to keep everything diff --git a/muse/muse/midiseq.cpp b/muse/muse/midiseq.cpp index e5692a6a..7d7dedef 100644 --- a/muse/muse/midiseq.cpp +++ b/muse/muse/midiseq.cpp @@ -8,6 +8,8 @@ // (C) Copyright 2003 Werner Schweer (ws@seh.de) //========================================================= +#include <qmessagebox.h> +#include <qobject.h> #include <stdio.h> #include <fcntl.h> #include <sys/ioctl.h> @@ -273,6 +275,10 @@ signed int MidiSeq::selectTimer() } delete timer; timer=NULL; + QMessageBox::critical( 0, /*tr*/(QString("Failed to start timer!")), + /*tr*/(QString("No functional timer was available.\n" + "RTC timer not available, check if /dev/rtc is available and readable by current user\n" + "Alsa timer not available, check if module snd_timer is available and /dev/snd/timer is available"))); printf("No functional timer available!!!\n"); exit(1); } |