mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-17 16:11:11 +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:
@@ -163,18 +163,27 @@ static void AddSources(int deviceIndex, int rate, wxArrayString *hosts, std::vec
|
|||||||
parameters.sampleFormat = paFloat32;
|
parameters.sampleFormat = paFloat32;
|
||||||
parameters.hostApiSpecificStreamInfo = NULL;
|
parameters.hostApiSpecificStreamInfo = NULL;
|
||||||
parameters.channelCount = 1;
|
parameters.channelCount = 1;
|
||||||
if (info)
|
|
||||||
parameters.suggestedLatency = isInput ? info->defaultLowInputLatency:
|
// If the device is for input, open a stream so we can use portmixer to query
|
||||||
info->defaultLowOutputLatency;
|
// the number of inputs. We skip this for outputs because there are no 'sources'
|
||||||
else
|
// and some platforms (e.g. XP) have the same device for input and output, (while
|
||||||
parameters.suggestedLatency = DEFAULT_LATENCY_CORRECTION/1000.0;
|
// 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
|
// try opening for record and playback
|
||||||
error = Pa_OpenStream(&stream,
|
error = Pa_OpenStream(&stream,
|
||||||
isInput ? ¶meters : NULL,
|
isInput ? ¶meters : NULL,
|
||||||
isInput ? NULL : ¶meters,
|
isInput ? NULL : ¶meters,
|
||||||
rate, paFramesPerBufferUnspecified,
|
rate, paFramesPerBufferUnspecified,
|
||||||
paClipOff | paDitherOff,
|
paClipOff | paDitherOff,
|
||||||
DummyPaStreamCallback, NULL);
|
DummyPaStreamCallback, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
if (stream) {
|
if (stream) {
|
||||||
AddSourcesFromStream(deviceIndex, info, maps, stream);
|
AddSourcesFromStream(deviceIndex, info, maps, stream);
|
||||||
Pa_CloseStream(stream);
|
Pa_CloseStream(stream);
|
||||||
|
Reference in New Issue
Block a user