[Portaudio] The 16 bit truncation
rossb-lists at audiomulch.com
Fri Dec 4 03:56:13 EST 2015
On 4/12/2015 12:54 PM, Bernt Ronningsbakk wrote:
> The 16 bit truncation is a substantial weakness in PA.
I presume you're talking about PA/DirectSound. I'm not aware of that
limitation in any other host API.
> In the copy that I'm working on right now, I have removed all code that
> changes the word format to 16 bit. And it seems to work without issues on my
> PC. I haven't checked wdmks though, since it has other issues.
> Here is one of the changes I've done in dsound:
> /* IMPLEMENT ME - establish which host formats are available */
> //PaSampleFormat nativeInputFormats = paInt16;
> PaSampleFormat nativeInputFormats =
> /* PaSampleFormat nativeFormats = paUInt8 | paInt16 | paInt24 |
> paInt32 | paFloat32; */
> hostInputSampleFormat =
> PaUtil_SelectClosestAvailableFormat( nativeInputFormats,
> inputParameters->sampleFormat );// Bernt
> A handful of these was all it took. I did text a search on 16 and simply
> disabled all functionality that changed a stream to 16 bit. Several places
> have "implement me" regarding checking the sound card capability and
> choosing the nearest format. I don't think that is needed.
> Unless there's a very good reason for keeping the 16 bit truncation I
> suggest that we remove it.
The "very good reason" is that there is no fallback path if >16-bit fails.
If you can provide good evidence that Windows (XP and later) will always
accept >16-bit then I agree that we should just go ahead with your
proposed changes. But otherwise, I think 16-bit truncation is a better
option than failing.
The correct fix, as has been discussed here in the past, and in the
tickets, is to retry with 16 bit if a higher bit-depth fails. I'd be
very happy to accept a patch that does this retry.
> A second best alternative would be to use paInt24 as default. It is good
> enough for basically all purposes, and those who don't have a sound card who
> supports this probably doesn't care if their win machine does a downsizing
> that is a bit less than sota.
I'm not sure what you are proposing with the above paragraph.
More information about the Portaudio