1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-03 17:19:43 +02:00

Bug 11 followup: DeviceToolbar.cpp: Only display input sources for input. Was causing a bug on xp where the portaudio device index is the same for input and output on some devices.

This commit is contained in:
mchinen 2011-01-12 19:15:40 +00:00
parent ad612d1ac7
commit c738b19c81

View File

@ -163,18 +163,27 @@ static void AddSources(int deviceIndex, int rate, wxArrayString *hosts, std::vec
parameters.sampleFormat = paFloat32;
parameters.hostApiSpecificStreamInfo = NULL;
parameters.channelCount = 1;
if (info)
parameters.suggestedLatency = isInput ? info->defaultLowInputLatency:
info->defaultLowOutputLatency;
else
parameters.suggestedLatency = DEFAULT_LATENCY_CORRECTION/1000.0;
// If the device is for input, open a stream so we can use portmixer to query
// the number of inputs. We skip this for outputs because there are no 'sources'
// and some platforms (e.g. XP) have the same device for input and output, (while
// Vista/Win7 seperate these into two devices with the same names (but different
// portaudio indecies)
if (isInput) {
if (info)
parameters.suggestedLatency = isInput ? info->defaultLowInputLatency:
info->defaultLowOutputLatency;
else
parameters.suggestedLatency = DEFAULT_LATENCY_CORRECTION/1000.0;
// try opening for record and playback
error = Pa_OpenStream(&stream,
isInput ? &parameters : NULL,
isInput ? NULL : &parameters,
rate, paFramesPerBufferUnspecified,
paClipOff | paDitherOff,
DummyPaStreamCallback, NULL);
error = Pa_OpenStream(&stream,
isInput ? &parameters : NULL,
isInput ? NULL : &parameters,
rate, paFramesPerBufferUnspecified,
paClipOff | paDitherOff,
DummyPaStreamCallback, NULL);
}
if (stream) {
AddSourcesFromStream(deviceIndex, info, maps, stream);
Pa_CloseStream(stream);