1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-10 09:01:13 +02:00

Improve error message when capture stream fails

Rather than just guessing at the cause of the error, include the actual
error string from PortAudio.
This commit is contained in:
Steve Daulton 2018-08-12 16:12:22 +01:00
parent 90286acb6a
commit 1d22ca5789
3 changed files with 12 additions and 4 deletions

View File

@ -1826,6 +1826,11 @@ bool AudioIO::StartPortAudioStream(double sampleRate,
return (mLastPaError == paNoError); return (mLastPaError == paNoError);
} }
wxString AudioIO::LastPaErrorString()
{
return wxString::Format(wxT("%d %s."), (int) mLastPaError, Pa_GetErrorText(mLastPaError));
}
void AudioIO::StartMonitoring(double sampleRate) void AudioIO::StartMonitoring(double sampleRate)
{ {
if ( mPortStreamV19 || mStreamToken ) if ( mPortStreamV19 || mStreamToken )

View File

@ -729,6 +729,10 @@ private:
volatile double mLastRecordingOffset; volatile double mLastRecordingOffset;
PaError mLastPaError; PaError mLastPaError;
public:
wxString LastPaErrorString();
private:
AudacityProject *mOwningProject; AudacityProject *mOwningProject;
wxWeakRef<MeterPanel> mInputMeter{}; wxWeakRef<MeterPanel> mInputMeter{};
MeterPanel *mOutputMeter; MeterPanel *mOutputMeter;

View File

@ -1312,9 +1312,8 @@ bool ControlToolBar::DoRecord(AudacityProject &project,
CancelRecording(); CancelRecording();
// Show error message if stream could not be opened // Show error message if stream could not be opened
ShowErrorDialog(this, _("Error"), wxString msg = wxString::Format(_("Error opening recording device.\nError code: %s"), gAudioIO->LastPaErrorString());
_("Error opening sound device.\nTry changing the audio host, recording device and the project sample rate."), ShowErrorDialog(this, _("Error"), msg, wxT("Error_opening_sound_device"));
wxT("Error_opening_sound_device"));
} }
} }