Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Bug 193 - Audacity can't record at > 16-bit under MME or Windows Dire…
…ctSound
Fix by Uwe and Carsten of DirectSound issue (only). We can't interrogate for formats, so we use userData to tell PortAudio what the format should be. I have a 16 bit built in sound device and that continues to function correctly at 16 bit with 24 bit requested. Unable to test on a 24 bit device.
Loading branch information
Showing
2 changed files
with
27 additions
and
2 deletions .
+9
−0
lib-src/portaudio-v19/src/hostapi/dsound/pa_win_ds.c
+18
−2
src/AudioIO.cpp
@@ -2046,9 +2046,18 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
if ( inputParameters )
{
/* IMPLEMENT ME - establish which host formats are available */
/* JKC: CAN'T IMPLEMENT. DirectSound does not have a way */
/* to interrogate for formats */
PaSampleFormat nativeInputFormats = paInt16;
/* PaSampleFormat nativeFormats = paUInt8 | paInt16 | paInt24 | paInt32 | paFloat32; */
/* July 2016 (Carsten and Uwe)
* http://bugzilla.audacityteam.org/show_bug.cgi?id=193
* Now we may over ride the paInt16.
*/
if (userData && *((int *)userData) == 24 )
nativeInputFormats = paInt24;
hostInputSampleFormat =
PaUtil_SelectClosestAvailableFormat ( nativeInputFormats, inputParameters->sampleFormat );
}
@@ -1448,10 +1448,19 @@ bool AudioIO::StartPortAudioStream(double sampleRate,
// rate is suggested, but we may get something else if it isn't supported
mRate = GetBestRate (numCaptureChannels > 0 , numPlaybackChannels > 0 , sampleRate);
// July 2016 (Carsten and Uwe)
// BUG 193: Tell PortAudio sound card will handle 24 bit (under DirectSound) using
// userData.
int captureFormat_saved = captureFormat;
// Special case: Our 24-bit sample format is different from PortAudio's
// 3-byte packed format. So just make PortAudio return float samples,
// since we need float values anyway to apply the gain.
// ANSWER-ME: So we *never* actually handle 24-bit?! This causes mCapture to be set to floatSample below.
// ANSWER-ME: So we *never* actually handle 24-bit?! This causes mCapture to
// be set to floatSample below.
// JKC: YES that's right. Internally Audacity uses float, and float has space for
// 24 bits as well as exponent. Actual 24 bit would require packing and
// unpacking unaligned bytes and would be inefficient.
// ANSWER ME: is floatSample 64 bit on 64 bit machines?
if (captureFormat == int24Sample)
captureFormat = floatSample;
@@ -1538,12 +1547,19 @@ bool AudioIO::StartPortAudioStream(double sampleRate,
float oldRecordVolume = Px_GetInputVolume (mPortMixer );
#endif
#endif
// July 2016 (Carsten and Uwe)
// BUG 193: Possibly tell portAudio to use 24 bit with DirectSound.
int userData = 24 ;
int * lpUserData = (captureFormat_saved == int24Sample) ? &userData : NULL ;
mLastPaError = Pa_OpenStream ( &mPortStreamV19 ,
useCapture ? &captureParameters : NULL ,
usePlayback ? &playbackParameters : NULL ,
mRate , paFramesPerBufferUnspecified,
paNoFlag,
audacityAudioCallback, NULL );
audacityAudioCallback, lpUserData );
#if USE_PORTMIXER
#ifdef __WXMSW__
Toggle all file notes
Toggle all file annotations