[PATCH 11/12] imaadp32.acm: Fix block size calculations.

Zebediah Figura z.figura12 at gmail.com
Tue Jun 6 15:15:00 CDT 2017


Partially fixes https://bugs.winehq.org/show_bug.cgi?id=33722 - the
apparent doubled length is fixed since samples per block is now
calculated correctly.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/imaadp32.acm/imaadp32.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/dlls/imaadp32.acm/imaadp32.c b/dlls/imaadp32.acm/imaadp32.c
index da1acd6b9f..2b23e5931e 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;
     pwfx->nAvgBytesPerSec = (pwfx->nSamplesPerSec * pwfx->nBlockAlign) / awfx->wSamplesPerBlock;
 }
 
@@ -629,11 +629,7 @@ static	LRESULT	ADPCM_FormatDetails(PACMFORMATDETAILSW afd, DWORD dwQuery)
 	    afd->pwfx->nChannels = ADPCM_Formats[afd->dwFormatIndex].nChannels;
 	    afd->pwfx->nSamplesPerSec = ADPCM_Formats[afd->dwFormatIndex].rate;
 	    afd->pwfx->wBitsPerSample = ADPCM_Formats[afd->dwFormatIndex].nBits;
-	    afd->pwfx->nBlockAlign = 1024;
-	    /* we got 4 bits per sample */
-            afd->pwfx->nAvgBytesPerSec = (afd->pwfx->nSamplesPerSec * 4) / 8;
-            afd->pwfx->cbSize = sizeof(WORD);
-            ((IMAADPCMWAVEFORMAT*)afd->pwfx)->wSamplesPerBlock = (1024 - 4 * afd->pwfx->nChannels) * (2 / afd->pwfx->nChannels) + 1;
+	    init_wfx_ima_adpcm((IMAADPCMWAVEFORMAT *)afd->pwfx);
 	    break;
 	default:
             WARN("Unsupported tag %08x\n", afd->dwFormatTag);
-- 
2.13.0




More information about the wine-patches mailing list