Provide a more useful error message when trying to open an audiodevice
authorAlexander Koenig <alex@lisas.de>
Mon, 18 Jul 2016 21:20:44 +0000 (23:20 +0200)
committerAlexander Koenig <alex@lisas.de>
Mon, 18 Jul 2016 21:20:44 +0000 (23:20 +0200)
driver that was not compiled in.

src/tX_engine.cc
src/tX_engine.h
src/tX_mastergui.cc

index 83d9e20..66589a0 100644 (file)
@@ -227,7 +227,7 @@ tX_engine_error tX_engine :: run() {
 #endif
                
                default:
-                       device=NULL; return ERROR_AUDIO;
+                       device=NULL; return ERROR_BACKEND;
        }
        
        if (device->open()) {
index 811797c..bc395b2 100644 (file)
@@ -48,6 +48,7 @@ enum tX_engine_error {
        NO_ERROR,
        ERROR_TAPE,
        ERROR_AUDIO,
+       ERROR_BACKEND,
        ERROR_BUSY      
 };
 
index 8dc4d64..74e5bc7 100644 (file)
@@ -627,6 +627,30 @@ GCallback audio_on(GtkWidget *w, void *d)
                                case ERROR_AUDIO:
                                tx_note("Error starting engine: failed to access audiodevice.\nPlease check the audio device settings in the \"Preferences\" dialog.", true);
                                break;
+                               case ERROR_BACKEND:
+                               char audio_backend[256];
+                               char message[4096];
+
+                               switch (globals.audiodevice_type) {
+                                   case OSS:
+                                       strcpy(audio_backend, "the Open Sound System (OSS)");
+                                       break;
+                                   case ALSA:
+                                       strcpy(audio_backend, "the Advanced Linux Sound Architecture (ALSA)");
+                                       break;
+                                   case JACK:
+                                       strcpy(audio_backend, "the JACK Audio Connection Kit");
+                                       break;
+                                   case PULSE:
+                                       strcpy(audio_backend, "PulseAudio");
+                                       break;
+                                   default:
+                                       strcpy(audio_backend, "unkown");
+                               }
+
+                               sprintf(message,"Error starting engine: couldn't start audio driver.\nThis terminatorX binary was compiled without support for %s.\nPlease check the audio device settings in the \"Preferences\" dialog.", audio_backend);
+                               tx_note(message, true);
+                               break;
                                case ERROR_TAPE:
                                tx_note("Error starting engine: failed to open the recording file.", true);
                                break;