[PATCH 1/2] imaadp32.acm: Fix block size calculations.

Andrew Eikum aeikum at codeweavers.com
Thu Jun 8 08:35:22 CDT 2017


On Wed, Jun 07, 2017 at 10:29:42AM -0500, Zebediah Figura wrote:
> Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
> ---
>  dlls/imaadp32.acm/imaadp32.c | 11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/dlls/imaadp32.acm/imaadp32.c b/dlls/imaadp32.acm/imaadp32.c
> index 78a0ac4c6c..ecc111c071 100644
> --- a/dlls/imaadp32.acm/imaadp32.c
> +++ b/dlls/imaadp32.acm/imaadp32.c
> @@ -154,7 +154,7 @@ static void     init_wfx_ima_adpcm(IMAADPCMWAVEFORMAT* awfx/*, DWORD nba*/)
>      }
>      pwfx->cbSize = sizeof(WORD);
>  
> -    awfx->wSamplesPerBlock = (pwfx->nBlockAlign - (4 * pwfx->nChannels) * 2) / pwfx->nChannels + 1;
> +    awfx->wSamplesPerBlock = pwfx->nBlockAlign * (2 / pwfx->nChannels) - 7;

If this reference is accurate:

  https://wiki.multimedia.cx/index.php/Microsoft_IMA_ADPCM

Then I think the old version is actually almost correct. I think they
just distributed the 2 factor incorrectly.

Can you try this and double check my math?

+    awfx->wSamplesPerBlock = ((pwfx->nBlockAlign - (4 * pwfx->nChannels)) * 2) / pwfx->nChannels + 1;

Andrew



More information about the wine-devel mailing list