From: rossb Date: Sun, 8 Mar 2009 08:10:55 +0000 (+0000) Subject: always disable wmme clip and dither if an spdif passthrough wave format is requested X-Git-Tag: svn/1415~10 X-Git-Url: https://andrewgundersen.net/repos?a=commitdiff_plain;h=5bf449b175ff8034f88c4f0be1ee207951731bc6;p=portaudio always disable wmme clip and dither if an spdif passthrough wave format is requested --- diff --git a/include/pa_win_wmme.h b/include/pa_win_wmme.h index fa06944..ee7c54d 100644 --- a/include/pa_win_wmme.h +++ b/include/pa_win_wmme.h @@ -53,6 +53,10 @@ extern "C" #endif /* __cplusplus */ +/* The following are flags which can be set in + PaWinMmeStreamInfo's flags field. +*/ + #define paWinMmeUseLowLevelLatencyParameters (0x01) #define paWinMmeUseMultipleDevices (0x02) /* use mme specific multiple device feature */ #define paWinMmeUseChannelMask (0x04) @@ -64,7 +68,8 @@ extern "C" */ #define paWinMmeDontThrottleOverloadedProcessingThread (0x08) -/* flags for non-PCM spdif passthrough */ +/* Flags for non-PCM spdif passthrough. +*/ #define paWinMmeWaveFormatDolbyAc3Spdif (0x10) #define paWinMmeWaveFormatWmaSpdif (0x20) diff --git a/src/hostapi/wmme/pa_win_wmme.c b/src/hostapi/wmme/pa_win_wmme.c index d987a9d..06c525b 100644 --- a/src/hostapi/wmme/pa_win_wmme.c +++ b/src/hostapi/wmme/pa_win_wmme.c @@ -2389,6 +2389,14 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, return paInvalidFlag; /* unexpected platform specific flag */ + /* always disable clipping and dithering if we are outputting a raw spdif stream */ + if( (winMmeSpecificOutputFlags & paWinMmeWaveFormatDolbyAc3Spdif) + || (winMmeSpecificOutputFlags & paWinMmeWaveFormatWmaSpdif) ){ + + streamFlags = streamFlags | paClipOff | paDitherOff; + } + + result = CalculateBufferSettings( &framesPerHostInputBuffer, &hostInputBufferCount, &framesPerHostOutputBuffer, &hostOutputBufferCount, inputChannelCount, hostInputSampleFormat, suggestedInputLatency, inputStreamInfo, diff --git a/test/patest_wmme_ac3.c b/test/patest_wmme_ac3.c index 9823db6..a0c0e1b 100644 --- a/test/patest_wmme_ac3.c +++ b/test/patest_wmme_ac3.c @@ -182,7 +182,7 @@ int main(int argc, char* argv[]) &outputParameters, SAMPLE_RATE, FRAMES_PER_BUFFER, - paClipOff | paDitherOff, /* IMPORTANT must disable clipping and dithering for WMME AC3 */ + 0, patestCallback, &data ); if( err != paNoError ) goto error;