1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-30 07:29:29 +02:00

Fix bug 12 Input volume reset if changed before recording

This is just a workaround for what appears to be a portaudio bug, where Pa_OpenStream() resets the device level that port mixer should control.
Looked at portaudio src (pa_win_wmme.c's OpenStream()) but I couldn't find the origin of the problem.
This commit is contained in:
mchinen 2010-11-30 15:08:28 +00:00
parent 913185d7b6
commit 6a84c9a3e3

View File

@ -1000,6 +1000,15 @@ bool AudioIO::StartPortAudioStream(double sampleRate,
#ifdef EXPERIMENTAL_MIDI_OUT
if (numPlaybackChannels == 0 && numCaptureChannels == 0)
return true;
#endif
#ifdef USE_PORTMIXER
#ifdef __WXMSW__
//mchinen nov 30 2010. For some reason Pa_OpenStream resets the input volume on windows.
//so cache and restore after it.
//The actual problem is likely in portaudio's pa_win_wmme.c OpenStream().
float oldRecordVolume = Px_GetInputVolume(mPortMixer);
#endif
#endif
mLastPaError = Pa_OpenStream( &mPortStreamV19,
captureParameters, playbackParameters,
@ -1008,6 +1017,9 @@ bool AudioIO::StartPortAudioStream(double sampleRate,
audacityAudioCallback, NULL );
#if USE_PORTMIXER
#ifdef __WXMSW__
Px_SetInputVolume(mPortMixer, oldRecordVolume);
#endif
if (mPortStreamV19 != NULL && mLastPaError == paNoError) {
#ifdef __WXMAC__
if (mPortMixer) {