From f5e9aa67c495a64117cc9d30596a34fbe21ef1d5 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Tue, 28 Jul 2009 15:19:55 +0000 Subject: Changing stuff around a bit so alignment requirements won't increase svn-id: r42857 --- graphics/video/coktelvideo/coktelvideo.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'graphics/video/coktelvideo') diff --git a/graphics/video/coktelvideo/coktelvideo.cpp b/graphics/video/coktelvideo/coktelvideo.cpp index 47c8e527d3..efcd77de44 100644 --- a/graphics/video/coktelvideo/coktelvideo.cpp +++ b/graphics/video/coktelvideo/coktelvideo.cpp @@ -1973,11 +1973,10 @@ byte *Vmd::deDPCM(const byte *data, uint32 &size, int32 init[2]) { int channels = (_soundStereo > 0) ? 2 : 1; uint32 inSize = size; - uint32 outSize = (size + channels) * 2; + uint32 outSize = size + channels; - byte *sound = new byte[outSize]; - - int16 *out = (int16 *) sound; + int16 *out = new int16[outSize]; + byte *sound = (byte *) out; int channel = 0; @@ -1999,7 +1998,7 @@ byte *Vmd::deDPCM(const byte *data, uint32 &size, int32 init[2]) { channel = (channel + 1) % channels; } - size = outSize; + size = outSize * 2; return sound; } @@ -2008,10 +2007,10 @@ byte *Vmd::deADPCM(const byte *data, uint32 &size, int32 init, int32 index) { if (!data || (size == 0)) return 0; - uint32 outSize = size * 4; + uint32 outSize = size * 2; - byte *sound = new byte[outSize]; - int16 *out = (int16 *) sound; + int16 *out = new int16[outSize]; + byte *sound = (byte *) out; index = CLIP(index, 0, 88); @@ -2056,7 +2055,7 @@ byte *Vmd::deADPCM(const byte *data, uint32 &size, int32 init, int32 index) { *out++ = TO_BE_16(init); } - size = outSize; + size = outSize * 2; return sound; } -- cgit v1.2.3