msadp32.acm: compute adpcm header size

Vincent Pelletier plr.vincent at gmail.com
Sun Jan 25 11:31:04 CST 2009


This fixes Freespace segfault (sound thread only, the rest keeps runing fine) 
when entering menu.

I computed header size using data provided at:
http://icculus.org/SDL_sound/downloads/external_documentation/wavecomp.htm
(first thing I found googling)
See ADPCMBLOCKHEADER structure definition.

-- 
Vincent Pelletier
-------------- next part --------------
From 4b168b207bece35c563b4fca7d1187e5d0102a53 Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <plr.vincent at gmail.com>
Date: Sun, 25 Jan 2009 18:27:53 +0100
Subject: Compute block header size.

---
 dlls/msadp32.acm/msadp32.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/dlls/msadp32.acm/msadp32.c b/dlls/msadp32.acm/msadp32.c
index 40b8260..fe221bc 100644
--- a/dlls/msadp32.acm/msadp32.c
+++ b/dlls/msadp32.acm/msadp32.c
@@ -631,8 +631,7 @@ static	LRESULT ADPCM_StreamSize(const ACMDRVSTREAMINSTANCE *adsi, PACMDRVSTREAMS
         else if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_ADPCM &&
                  adsi->pwfxDst->wFormatTag == WAVE_FORMAT_PCM)
         {
-	    FIXME("misses the block header overhead\n");
-	    adss->cbSrcLength = 256 + adss->cbDstLength / 4;
+	    adss->cbSrcLength = (adsi->pwfxDst->nChannels * (sizeof(int) * 3 + 1)) + adss->cbDstLength / 4;
 	}
         else
         {
@@ -644,8 +643,7 @@ static	LRESULT ADPCM_StreamSize(const ACMDRVSTREAMINSTANCE *adsi, PACMDRVSTREAMS
 	if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM &&
 	    adsi->pwfxDst->wFormatTag == WAVE_FORMAT_ADPCM)
         {
-	    FIXME("misses the block header overhead\n");
-	    adss->cbDstLength = 256 + adss->cbSrcLength / 4;
+	    adss->cbDstLength = (adsi->pwfxSrc->nChannels * (sizeof(int) * 3 + 1)) + adss->cbSrcLength / 4;
 	}
         else if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_ADPCM &&
                  adsi->pwfxDst->wFormatTag == WAVE_FORMAT_PCM)
-- 
1.5.6.5



More information about the wine-patches mailing list