Flag PortAudio and PortMixer unhandled error returns.
This commit is contained in:
parent
763485b0dc
commit
0a16141ee5
|
@ -1089,6 +1089,8 @@ AudioIO::~AudioIO()
|
|||
mPortMixer = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
// FIXME: ? TRAP_ERR. Pa_Terminate probably OK if err without reporting.
|
||||
Pa_Terminate();
|
||||
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
|
@ -1358,6 +1360,7 @@ void AudioIO::HandleDeviceChange()
|
|||
}
|
||||
}
|
||||
|
||||
// FIXME: TRAP_ERR errors in HandleDeviceChange not reported.
|
||||
// if it's still not working, give up
|
||||
if( error )
|
||||
return;
|
||||
|
@ -1603,6 +1606,8 @@ void AudioIO::StartMonitoring(double sampleRate)
|
|||
if (mSoftwarePlaythrough)
|
||||
playbackChannels = 2;
|
||||
|
||||
// FIXME: TRAP_ERR StartPortAudioStream (a PaError may be present)
|
||||
// but StartPortAudioStream function only returns true or false.
|
||||
success = StartPortAudioStream(sampleRate, (unsigned int)playbackChannels,
|
||||
(unsigned int)captureChannels,
|
||||
captureFormat);
|
||||
|
@ -1614,7 +1619,10 @@ void AudioIO::StartMonitoring(double sampleRate)
|
|||
e.SetInt(true);
|
||||
wxTheApp->ProcessEvent(e);
|
||||
|
||||
// FIXME: TRAP_ERR PaErrorCode 'noted' but not reported in StartMonitoring.
|
||||
// Now start the PortAudio stream!
|
||||
// TODO: ? Factor out and reuse error reporting code from end of
|
||||
// AudioIO::StartStream?
|
||||
mLastPaError = Pa_StartStream( mPortStreamV19 );
|
||||
|
||||
// Update UI display only now, after all possibilities for error are past.
|
||||
|
@ -2612,6 +2620,7 @@ bool AudioIO::IsBusy()
|
|||
bool AudioIO::IsStreamActive()
|
||||
{
|
||||
bool isActive = false;
|
||||
// JKC: Not reporting any Pa error, but that looks OK.
|
||||
if( mPortStreamV19 )
|
||||
isActive = (Pa_IsStreamActive( mPortStreamV19 ) > 0);
|
||||
|
||||
|
@ -2727,6 +2736,7 @@ wxArrayLong AudioIO::GetSupportedPlaybackRates(int devIndex, double rate)
|
|||
pars.suggestedLatency = devInfo->defaultHighOutputLatency;
|
||||
pars.hostApiSpecificStreamInfo = NULL;
|
||||
|
||||
// JKC: PortAudio Errors handled OK here. No need to report them
|
||||
for (i = 0; i < NumRatesToTry; i++)
|
||||
{
|
||||
// LLL: Remove when a proper method of determining actual supported
|
||||
|
@ -3135,6 +3145,9 @@ int AudioIO::getPlayDevIndex(const wxString &devNameArg)
|
|||
}
|
||||
|
||||
// The host wasn't found, so use the default output device.
|
||||
// FIXME: TRAP_ERR PaErrorCode not handled well (this code is similar to input code
|
||||
// and the input side has more comments.)
|
||||
|
||||
PaDeviceIndex deviceNum = Pa_GetDefaultOutputDevice();
|
||||
|
||||
// Sometimes PortAudio returns -1 if it cannot find a suitable default
|
||||
|
@ -3189,10 +3202,12 @@ int AudioIO::getRecordDevIndex(const wxString &devNameArg)
|
|||
}
|
||||
|
||||
// The host wasn't found, so use the default input device.
|
||||
// FIXME: TRAP_ERR PaErrorCode not handled well in getRecordDevIndex()
|
||||
PaDeviceIndex deviceNum = Pa_GetDefaultInputDevice();
|
||||
|
||||
// Sometimes PortAudio returns -1 if it cannot find a suitable default
|
||||
// device, so we just use the first one available
|
||||
// PortAudio has an error reporting function. We should log/report the error?
|
||||
//
|
||||
// LL: At this point, preferences and active no longer match
|
||||
//
|
||||
|
@ -3220,9 +3235,9 @@ wxString AudioIO::GetDeviceInfo()
|
|||
}
|
||||
|
||||
|
||||
// FIXME: TRAP_ERR PaErrorCode not handled. 3 instances in GetDeviceInfo().
|
||||
int recDeviceNum = Pa_GetDefaultInputDevice();
|
||||
int playDeviceNum = Pa_GetDefaultOutputDevice();
|
||||
|
||||
int cnt = Pa_GetDeviceCount();
|
||||
|
||||
wxLogDebug(wxT("Portaudio reports %d audio devices"),cnt);
|
||||
|
@ -3370,7 +3385,7 @@ wxString AudioIO::GetDeviceInfo()
|
|||
}
|
||||
|
||||
if (error) {
|
||||
s << wxT("Recieved ") << error << wxT(" while opening devices") << e;
|
||||
s << wxT("Received ") << error << wxT(" while opening devices") << e;
|
||||
return o.GetString();
|
||||
}
|
||||
|
||||
|
@ -3385,6 +3400,7 @@ wxString AudioIO::GetDeviceInfo()
|
|||
s << wxT("==============================") << e;
|
||||
s << wxT("Available mixers:") << e;
|
||||
|
||||
// FIXME: ? PortMixer errors on query not reported in GetDeviceInfo
|
||||
cnt = Px_GetNumMixers(stream);
|
||||
for (int i = 0; i < cnt; i++) {
|
||||
wxString name = wxSafeConvertMB2WX(Px_GetMixerName(stream, i));
|
||||
|
|
|
@ -268,10 +268,12 @@ void DeviceManager::Rescan()
|
|||
}
|
||||
|
||||
// restart portaudio - this updates the device list
|
||||
// FIXME: TRAP_ERR restarting PortAudio
|
||||
Pa_Terminate();
|
||||
Pa_Initialize();
|
||||
}
|
||||
|
||||
// FIXME: TRAP_ERR PaErrorCode not handled in ReScan()
|
||||
int nDevices = Pa_GetDeviceCount();
|
||||
|
||||
//The heirarchy for devices is Host/device/source.
|
||||
|
|
|
@ -85,13 +85,18 @@ void DevicePrefs::Populate()
|
|||
OnHost(e);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get names of device hosts.
|
||||
*/
|
||||
void DevicePrefs::GetNamesAndLabels()
|
||||
{
|
||||
// Gather list of hosts. Only added hosts that have devices attached.
|
||||
// FIXME: TRAP_ERR PaErrorCode not handled in DevicePrefs GetNamesAndLabels()
|
||||
// With an error code won't add hosts, but won't report a problem either.
|
||||
int nDevices = Pa_GetDeviceCount();
|
||||
for (int i = 0; i < nDevices; i++) {
|
||||
const PaDeviceInfo *info = Pa_GetDeviceInfo(i);
|
||||
if (info->maxOutputChannels > 0 || info->maxInputChannels > 0) {
|
||||
if ((info!=NULL)&&(info->maxOutputChannels > 0 || info->maxInputChannels > 0)) {
|
||||
wxString name = wxSafeConvertMB2WX(Pa_GetHostApiInfo(info->hostApi)->name);
|
||||
if (mHostNames.Index(name) == wxNOT_FOUND) {
|
||||
mHostNames.Add(name);
|
||||
|
@ -183,6 +188,7 @@ void DevicePrefs::OnHost(wxCommandEvent & e)
|
|||
|
||||
int nDevices = Pa_GetDeviceCount();
|
||||
|
||||
// FIXME: TRAP_ERR PaErrorCode not handled. nDevices can be negative number.
|
||||
if (nDevices == 0) {
|
||||
mHost->Clear();
|
||||
mHost->Append(_("No audio interfaces"), (void *) NULL);
|
||||
|
|
Loading…
Reference in New Issue