Use slighly more accurate formula for C816.

Wrap a couple of comments to 80 columns.
This commit is contained in:
Francois Gouget 2002-12-15 01:12:03 +00:00 committed by Alexandre Julliard
parent f650222131
commit ec55d23568
1 changed files with 9 additions and 9 deletions

View File

@ -128,15 +128,15 @@ static DWORD PCM_GetFormatIndex(LPWAVEFORMATEX wfx)
* parameters: * parameters:
* + 8 bit unsigned vs 16 bit signed * + 8 bit unsigned vs 16 bit signed
* + mono vs stereo (1 or 2 channels) * + mono vs stereo (1 or 2 channels)
* + sampling rate (8.0, 11.025, 22.05, 44.1 kHz are defined, but algo shall work * + sampling rate (8.0, 11.025, 22.05, 44.1 kHz are defined, but algo
* in all cases) * shall work in all cases)
* *
* mono => stereo: copy the same sample on Left & Right channels * mono => stereo: copy the same sample on Left & Right channels
* stereo =) mono: use the average value of samples from Left & Right channels * stereo =) mono: use the average value of samples from Left & Right channels
* resampling; we lookup for each destination sample the two source adjacent samples * resampling; we lookup for each destination sample the two source adjacent
* were src <= dst < src+1 (dst is increased by a fractional value which is * samples were src <= dst < src+1 (dst is increased by a fractional
* equivalent to the increment by one on src); then we use a linear * value which is equivalent to the increment by one on src); then we
* interpolation between src and src+1 * use a linear interpolation between src and src+1
*/ */
/*********************************************************************** /***********************************************************************
@ -146,7 +146,7 @@ static DWORD PCM_GetFormatIndex(LPWAVEFORMATEX wfx)
*/ */
static inline short C816(unsigned char b) static inline short C816(unsigned char b)
{ {
return (short)(b ^ 0x80) * 256; return (short)((b+(b << 8))-32768);
} }
/*********************************************************************** /***********************************************************************
@ -784,8 +784,8 @@ static LRESULT PCM_FormatDetails(PACMFORMATDETAILSW afd, DWORD dwQuery)
afd->pwfx->nChannels = PCM_Formats[afd->dwFormatIndex].nChannels; afd->pwfx->nChannels = PCM_Formats[afd->dwFormatIndex].nChannels;
afd->pwfx->nSamplesPerSec = PCM_Formats[afd->dwFormatIndex].rate; afd->pwfx->nSamplesPerSec = PCM_Formats[afd->dwFormatIndex].rate;
afd->pwfx->wBitsPerSample = PCM_Formats[afd->dwFormatIndex].nBits; afd->pwfx->wBitsPerSample = PCM_Formats[afd->dwFormatIndex].nBits;
/* native MSACM uses a PCMWAVEFORMAT structure, so cbSize is not accessible /* native MSACM uses a PCMWAVEFORMAT structure, so cbSize is not
* afd->pwfx->cbSize = 0; * accessible afd->pwfx->cbSize = 0;
*/ */
afd->pwfx->nBlockAlign = afd->pwfx->nBlockAlign =
(afd->pwfx->nChannels * afd->pwfx->wBitsPerSample) / 8; (afd->pwfx->nChannels * afd->pwfx->wBitsPerSample) / 8;