diff options
author | Jaap Keuter <jaap.keuter@xs4all.nl> | 2009-05-14 06:26:16 +0000 |
---|---|---|
committer | Jaap Keuter <jaap.keuter@xs4all.nl> | 2009-05-14 06:26:16 +0000 |
commit | 5f900d062c3f3c4fba71c516761b229681fb0b20 (patch) | |
tree | ac0099c7c388a95bf526c03cd3dae2325a628811 /gtk | |
parent | 17e10d08fbf7b6601161d3a14ccf913877cd4d47 (diff) |
Extend error reporting from PortAudio library.
svn path=/trunk/; revision=28358
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/rtp_player.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/gtk/rtp_player.c b/gtk/rtp_player.c index 5ac80804aa..78a34f8784 100644 --- a/gtk/rtp_player.c +++ b/gtk/rtp_player.c @@ -1606,6 +1606,75 @@ play_channels(void) #endif /* PORTAUDIO_API_1 */ if( err != paNoError ) { +#if PORTAUDIO_API_1 + const char *deviceName = "No Device"; + + PaDeviceID device = Pa_GetDefaultOutputDeviceID(); + + if (device != paNoDevice) + { + const PaDeviceInfo* deviceInfo = Pa_GetDeviceInfo( device ); + if (deviceInfo) + deviceName = deviceInfo->name; + else + deviceName = "(No device info)"; + } + + dialog = gtk_message_dialog_new ((GtkWindow *) rtp_player_dlg_w, + GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR,GTK_BUTTONS_CLOSE, + "Got this info from PortAudio Library:\n" + " Default deviceName: %s (%d)", deviceName, device); + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); +#else + PaHostApiIndex hostApi = Pa_GetDefaultHostApi(); + if (hostApi < 0) + { + dialog = gtk_message_dialog_new ((GtkWindow *) rtp_player_dlg_w, + GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR,GTK_BUTTONS_CLOSE, + "Can not even get the default host API from PortAudio Library.\n Error: %s", + Pa_GetErrorText( hostApi )); + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + } + else + { + const PaHostApiInfo *hostApiInfo = Pa_GetHostApiInfo( hostApi ); + + if ( !hostApiInfo ) + { + dialog = gtk_message_dialog_new ((GtkWindow *) rtp_player_dlg_w, + GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR,GTK_BUTTONS_CLOSE, + "Can not even get the host API info from PortAudio Library."); + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + } + else + { + const char *hostApiName = hostApiInfo->name; + const char *deviceName = "No Device"; + + PaDeviceIndex device = hostApiInfo->defaultOutputDevice; + + if (device != paNoDevice) + { + const PaDeviceInfo* deviceInfo = Pa_GetDeviceInfo( device ); + if (deviceInfo) + deviceName = deviceInfo->name; + else + deviceName = "(No device info)"; + } + + dialog = gtk_message_dialog_new ((GtkWindow *) rtp_player_dlg_w, + GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR,GTK_BUTTONS_CLOSE, + "Got this info from PortAudio Library:\n" + " Default hostApiName: %s\n" + " Default deviceName: %s (%d)", hostApiName, deviceName, device); + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + } + } +#endif dialog = gtk_message_dialog_new ((GtkWindow *) rtp_player_dlg_w, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR,GTK_BUTTONS_CLOSE, "Can not Open Stream in PortAudio Library.\n Error: %s", Pa_GetErrorText( err )); |