[Scummvm-git-logs] scummvm master -> b0a804e8be85f2f4a3d17b143bcee81e898aa4af

bluegr noreply at scummvm.org
Sun Nov 14 12:27:24 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
b0a804e8be ULTIMA: Delete deprecated wave decoder


Commit: b0a804e8be85f2f4a3d17b143bcee81e898aa4af
    https://github.com/scummvm/scummvm/commit/b0a804e8be85f2f4a3d17b143bcee81e898aa4af
Author: Orgad Shaneh (orgads at gmail.com)
Date: 2021-11-14T13:42:33+02:00

Commit Message:
ULTIMA: Delete deprecated wave decoder

Amends commit 1f2265e885a799dcff8674869a982c237f3702a0.

Changed paths:
  R engines/ultima/nuvie/sound/decoder/wave/adpcm.cpp
  R engines/ultima/nuvie/sound/decoder/wave/adpcm.h
  R engines/ultima/nuvie/sound/decoder/wave/endian.h
  R engines/ultima/nuvie/sound/decoder/wave/list.h
  R engines/ultima/nuvie/sound/decoder/wave/list_intern.h
  R engines/ultima/nuvie/sound/decoder/wave/memstream.h
  R engines/ultima/nuvie/sound/decoder/wave/raw.cpp
  R engines/ultima/nuvie/sound/decoder/wave/raw.h
  R engines/ultima/nuvie/sound/decoder/wave/stdiostream.cpp
  R engines/ultima/nuvie/sound/decoder/wave/stdiostream.h
  R engines/ultima/nuvie/sound/decoder/wave/stream.cpp
  R engines/ultima/nuvie/sound/decoder/wave/stream.h
  R engines/ultima/nuvie/sound/decoder/wave/wave.cpp
  R engines/ultima/nuvie/sound/decoder/wave/wave.h


diff --git a/engines/ultima/nuvie/sound/decoder/wave/adpcm.cpp b/engines/ultima/nuvie/sound/decoder/wave/adpcm.cpp
deleted file mode 100644
index c2aec29c6d..0000000000
--- a/engines/ultima/nuvie/sound/decoder/wave/adpcm.cpp
+++ /dev/null
@@ -1,874 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/sound/decoders/adpcm.cpp $
- * $Id: adpcm.cpp 54204 2010-11-11 17:04:07Z mthreepwood $
- *
- */
-
-//#include <assert.h>
-//#include <string.h>
-#include "decoder/wave/endian.h"
-
-#include "decoder/wave/adpcm.h"
-#include "audiostream.h"
-
-#ifdef MIN
-#undef MIN
-#endif
-
-template<typename T> inline T MIN(T a, T b)    {
-	return (a < b) ? a : b;
-}
-
-template<typename T> inline T CLIP(T v, T amin, T amax) {
-	if (v < amin) return amin;
-	else if (v > amax) return amax;
-	else return v;
-}
-
-namespace Audio {
-
-class ADPCMStream : public RewindableAudioStream {
-protected:
-	Common::SeekableReadStream *_stream;
-	const DisposeAfterUse::Flag _disposeAfterUse;
-	const sint32 _startpos;
-	const sint32 _endpos;
-	const int _channels;
-	const uint32 _blockAlign;
-	uint32 _blockPos[2];
-	const int _rate;
-
-	struct {
-		// OKI/IMA
-		struct {
-			sint32 last;
-			sint32 stepIndex;
-		} ima_ch[2];
-	} _status;
-
-	virtual void reset();
-	sint16 stepAdjust(uint8);
-
-public:
-	ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign);
-	~ADPCMStream();
-
-	virtual bool endOfData() const {
-		return (_stream->eos() || _stream->pos() >= _endpos);
-	}
-	virtual bool isStereo() const   {
-		return _channels == 2;
-	}
-	virtual int getRate() const {
-		return _rate;
-	}
-
-	virtual bool rewind();
-};
-
-// Routines to convert 12 bit linear samples to the
-// Dialogic or Oki ADPCM coding format aka VOX.
-// See also <http://www.comptek.ru/telephony/tnotes/tt1-13.html>
-//
-// IMA ADPCM support is based on
-//   <http://wiki.multimedia.cx/index.php?title=IMA_ADPCM>
-//
-// In addition, also MS IMA ADPCM is supported. See
-//   <http://wiki.multimedia.cx/index.php?title=Microsoft_IMA_ADPCM>.
-
-ADPCMStream::ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign)
-	: _stream(stream),
-	  _disposeAfterUse(disposeAfterUse),
-	  _startpos(stream->pos()),
-	  _endpos(_startpos + size),
-	  _channels(channels),
-	  _blockAlign(blockAlign),
-	  _rate(rate) {
-
-	reset();
-}
-
-ADPCMStream::~ADPCMStream() {
-	if (_disposeAfterUse == DisposeAfterUse::YES)
-		delete _stream;
-}
-
-void ADPCMStream::reset() {
-	memset(&_status, 0, sizeof(_status));
-	_blockPos[0] = _blockPos[1] = _blockAlign; // To make sure first header is read
-}
-
-bool ADPCMStream::rewind() {
-	// TODO: Error checking.
-	reset();
-	_stream->seek(_startpos);
-	return true;
-}
-
-
-#pragma mark -
-
-
-class Oki_ADPCMStream : public ADPCMStream {
-public:
-	Oki_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign)
-		: ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) {}
-
-	virtual int readBuffer(sint16 *buffer, const int numSamples);
-
-protected:
-	sint16 decodeOKI(uint8);
-};
-
-int Oki_ADPCMStream::readBuffer(sint16 *buffer, const int numSamples) {
-	int samples;
-	uint8 data;
-
-	assert(numSamples % 2 == 0);
-
-	for (samples = 0; samples < numSamples && !_stream->eos() && _stream->pos() < _endpos; samples += 2) {
-		data = _stream->readByte();
-		buffer[samples] = decodeOKI((data >> 4) & 0x0f);
-		buffer[samples + 1] = decodeOKI(data & 0x0f);
-	}
-	return samples;
-}
-
-static const sint16 okiStepSize[49] = {
-	16,   17,   19,   21,   23,   25,   28,   31,
-	34,   37,   41,   45,   50,   55,   60,   66,
-	73,   80,   88,   97,  107,  118,  130,  143,
-	157,  173,  190,  209,  230,  253,  279,  307,
-	337,  371,  408,  449,  494,  544,  598,  658,
-	724,  796,  876,  963, 1060, 1166, 1282, 1411,
-	1552
-};
-
-// Decode Linear to ADPCM
-sint16 Oki_ADPCMStream::decodeOKI(uint8 code) {
-	sint16 diff, E, samp;
-
-	E = (2 * (code & 0x7) + 1) * okiStepSize[_status.ima_ch[0].stepIndex] / 8;
-	diff = (code & 0x08) ? -E : E;
-	samp = _status.ima_ch[0].last + diff;
-	// Clip the values to +/- 2^11 (supposed to be 12 bits)
-	samp = CLIP<sint16>(samp, -2048, 2047);
-
-	_status.ima_ch[0].last = samp;
-	_status.ima_ch[0].stepIndex += stepAdjust(code);
-	_status.ima_ch[0].stepIndex = CLIP<sint32>(_status.ima_ch[0].stepIndex, 0, ARRAYSIZE(okiStepSize) - 1);
-
-	// * 16 effectively converts 12-bit input to 16-bit output
-	return samp * 16;
-}
-
-
-#pragma mark -
-
-
-class Ima_ADPCMStream : public ADPCMStream {
-protected:
-	sint16 decodeIMA(uint8 code, int channel = 0); // Default to using the left channel/using one channel
-
-public:
-	Ima_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign)
-		: ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) {
-		memset(&_status, 0, sizeof(_status));
-	}
-
-	virtual int readBuffer(sint16 *buffer, const int numSamples);
-};
-
-int Ima_ADPCMStream::readBuffer(sint16 *buffer, const int numSamples) {
-	int samples;
-	uint8 data;
-
-	assert(numSamples % 2 == 0);
-
-	for (samples = 0; samples < numSamples && !_stream->eos() && _stream->pos() < _endpos; samples += 2) {
-		data = _stream->readByte();
-		buffer[samples] = decodeIMA((data >> 4) & 0x0f);
-		buffer[samples + 1] = decodeIMA(data & 0x0f, _channels == 2 ? 1 : 0);
-	}
-	return samples;
-}
-
-#pragma mark -
-
-
-class Apple_ADPCMStream : public Ima_ADPCMStream {
-protected:
-	// Apple QuickTime IMA ADPCM
-	sint32 _streamPos[2];
-	sint16 _buffer[2][2];
-	uint8 _chunkPos[2];
-
-	void reset() {
-		Ima_ADPCMStream::reset();
-		_chunkPos[0] = 0;
-		_chunkPos[1] = 0;
-		_streamPos[0] = 0;
-		_streamPos[1] = _blockAlign;
-	}
-
-public:
-	Apple_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign)
-		: Ima_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) {
-		_chunkPos[0] = 0;
-		_chunkPos[1] = 0;
-		_streamPos[0] = 0;
-		_streamPos[1] = _blockAlign;
-	}
-
-	virtual int readBuffer(sint16 *buffer, const int numSamples);
-
-};
-
-int Apple_ADPCMStream::readBuffer(sint16 *buffer, const int numSamples) {
-	// Need to write at least one samples per channel
-	assert((numSamples % _channels) == 0);
-
-	// Current sample positions
-	int samples[2] = { 0, 0};
-
-	// Number of samples per channel
-	int chanSamples = numSamples / _channels;
-
-	for (int i = 0; i < _channels; i++) {
-		_stream->seek(_streamPos[i]);
-
-		while ((samples[i] < chanSamples) &&
-		        // Last byte read and a new one needed
-		        !((_stream->eos() || (_stream->pos() >= _endpos)) && (_chunkPos[i] == 0))) {
-
-			if (_blockPos[i] == _blockAlign) {
-				// 2 byte header per block
-				uint16 temp = _stream->readUint16BE();
-
-				// First 9 bits are the upper bits of the predictor
-				_status.ima_ch[i].last      = (sint16)(temp & 0xFF80);
-				// Lower 7 bits are the step index
-				_status.ima_ch[i].stepIndex =          temp & 0x007F;
-
-				// Clip the step index
-				_status.ima_ch[i].stepIndex = CLIP<sint32>(_status.ima_ch[i].stepIndex, 0, 88);
-
-				_blockPos[i] = 2;
-			}
-
-			if (_chunkPos[i] == 0) {
-				// Decode data
-				uint8 data = _stream->readByte();
-				_buffer[i][0] = decodeIMA(data &  0x0F, i);
-				_buffer[i][1] = decodeIMA(data >>    4, i);
-			}
-
-			// The original is interleaved block-wise, we want it sample-wise
-			buffer[_channels * samples[i] + i] = _buffer[i][_chunkPos[i]];
-
-			if (++_chunkPos[i] > 1) {
-				// We're about to decode the next byte, so advance the block position
-				_chunkPos[i] = 0;
-				_blockPos[i]++;
-			}
-
-			samples[i]++;
-
-			if (_channels == 2)
-				if (_blockPos[i] == _blockAlign)
-					// We're at the end of the block.
-					// Since the channels are interleaved, skip the next block
-					_stream->skip(MIN<uint32>(_blockAlign, _endpos - _stream->pos()));
-
-			_streamPos[i] = _stream->pos();
-		}
-	}
-
-	return samples[0] + samples[1];
-}
-
-#pragma mark -
-
-
-class MSIma_ADPCMStream : public Ima_ADPCMStream {
-public:
-	MSIma_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign, bool invertSamples = false)
-		: Ima_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign), _invertSamples(invertSamples) {
-		if (blockAlign == 0)
-			DEBUG(0, LEVEL_ERROR, "ADPCMStream(): blockAlign isn't specified for MS IMA ADPCM");
-	}
-
-	virtual int readBuffer(sint16 *buffer, const int numSamples) {
-		if (_channels == 1)
-			return readBufferMSIMA1(buffer, numSamples);
-		else
-			return readBufferMSIMA2(buffer, numSamples);
-	}
-
-	int readBufferMSIMA1(sint16 *buffer, const int numSamples);
-	int readBufferMSIMA2(sint16 *buffer, const int numSamples);
-
-private:
-	bool _invertSamples;    // Some implementations invert the way samples are decoded
-};
-
-int MSIma_ADPCMStream::readBufferMSIMA1(sint16 *buffer, const int numSamples) {
-	int samples = 0;
-	uint8 data;
-
-	assert(numSamples % 2 == 0);
-
-	while (samples < numSamples && !_stream->eos() && _stream->pos() < _endpos) {
-		if (_blockPos[0] == _blockAlign) {
-			// read block header
-			_status.ima_ch[0].last = _stream->readSint16LE();
-			_status.ima_ch[0].stepIndex = _stream->readSint16LE();
-			_blockPos[0] = 4;
-		}
-
-		for (; samples < numSamples && _blockPos[0] < _blockAlign && !_stream->eos() && _stream->pos() < _endpos; samples += 2) {
-			data = _stream->readByte();
-			_blockPos[0]++;
-			buffer[samples] = decodeIMA(_invertSamples ? (data >> 4) & 0x0f : data & 0x0f);
-			buffer[samples + 1] = decodeIMA(_invertSamples ? data & 0x0f : (data >> 4) & 0x0f);
-		}
-	}
-	return samples;
-}
-
-
-// Microsoft as usual tries to implement it differently. This method
-// is used for stereo data.
-int MSIma_ADPCMStream::readBufferMSIMA2(sint16 *buffer, const int numSamples) {
-	int samples;
-	uint32 data;
-	int nibble;
-	uint8 k;
-
-	// TODO: Currently this implementation only supports
-	// reading a multiple of 16 samples at once. We might
-	// consider changing that so it could read an arbitrary
-	// sample pair count.
-	assert(numSamples % 16 == 0);
-
-	for (samples = 0; samples < numSamples && !_stream->eos() && _stream->pos() < _endpos;) {
-		for (int channel = 0; channel < 2; channel++) {
-			data = _stream->readUint32LE();
-
-			for (nibble = 0; nibble < 8; nibble++) {
-				k = ((data & 0xf0000000) >> 28);
-				buffer[samples + channel + nibble * 2] = decodeIMA(k);
-				data <<= 4;
-			}
-		}
-		samples += 16;
-	}
-	return samples;
-}
-
-
-#pragma mark -
-
-
-static const int MSADPCMAdaptCoeff1[] = {
-	256, 512, 0, 192, 240, 460, 392
-};
-
-static const int MSADPCMAdaptCoeff2[] = {
-	0, -256, 0, 64, 0, -208, -232
-};
-
-static const int MSADPCMAdaptationTable[] = {
-	230, 230, 230, 230, 307, 409, 512, 614,
-	768, 614, 512, 409, 307, 230, 230, 230
-};
-
-
-class MS_ADPCMStream : public ADPCMStream {
-protected:
-	struct ADPCMChannelStatus {
-		uint8 predictor;
-		sint16 delta;
-		sint16 coeff1;
-		sint16 coeff2;
-		sint16 sample1;
-		sint16 sample2;
-	};
-
-	struct {
-		// MS ADPCM
-		ADPCMChannelStatus ch[2];
-	} _status;
-
-	void reset() {
-		ADPCMStream::reset();
-		memset(&_status, 0, sizeof(_status));
-	}
-
-public:
-	MS_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign)
-		: ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) {
-		if (blockAlign == 0)
-			DEBUG(0, LEVEL_ERROR, "MS_ADPCMStream(): blockAlign isn't specified for MS ADPCM");
-		memset(&_status, 0, sizeof(_status));
-	}
-
-	virtual int readBuffer(sint16 *buffer, const int numSamples);
-
-protected:
-	sint16 decodeMS(ADPCMChannelStatus *c, uint8);
-};
-
-sint16 MS_ADPCMStream::decodeMS(ADPCMChannelStatus *c, uint8 code) {
-	sint32 predictor;
-
-	predictor = (((c->sample1) * (c->coeff1)) + ((c->sample2) * (c->coeff2))) / 256;
-	predictor += (signed)((code & 0x08) ? (code - 0x10) : (code)) * c->delta;
-
-	predictor = CLIP<sint32>(predictor, -32768, 32767);
-
-	c->sample2 = c->sample1;
-	c->sample1 = predictor;
-	c->delta = (MSADPCMAdaptationTable[(int)code] * c->delta) >> 8;
-
-	if (c->delta < 16)
-		c->delta = 16;
-
-	return (sint16)predictor;
-}
-
-int MS_ADPCMStream::readBuffer(sint16 *buffer, const int numSamples) {
-	int samples;
-	uint8 data;
-	int i = 0;
-
-	samples = 0;
-
-	while (samples < numSamples && !_stream->eos() && _stream->pos() < _endpos) {
-		if (_blockPos[0] == _blockAlign) {
-			// read block header
-			for (i = 0; i < _channels; i++) {
-				_status.ch[i].predictor = CLIP(_stream->readByte(), (uint8)0, (uint8)6);
-				_status.ch[i].coeff1 = MSADPCMAdaptCoeff1[_status.ch[i].predictor];
-				_status.ch[i].coeff2 = MSADPCMAdaptCoeff2[_status.ch[i].predictor];
-			}
-
-			for (i = 0; i < _channels; i++)
-				_status.ch[i].delta = _stream->readSint16LE();
-
-			for (i = 0; i < _channels; i++)
-				_status.ch[i].sample1 = _stream->readSint16LE();
-
-			for (i = 0; i < _channels; i++)
-				buffer[samples++] = _status.ch[i].sample2 = _stream->readSint16LE();
-
-			for (i = 0; i < _channels; i++)
-				buffer[samples++] = _status.ch[i].sample1;
-
-			_blockPos[0] = _channels * 7;
-		}
-
-		for (; samples < numSamples && _blockPos[0] < _blockAlign && !_stream->eos() && _stream->pos() < _endpos; samples += 2) {
-			data = _stream->readByte();
-			_blockPos[0]++;
-			buffer[samples] = decodeMS(&_status.ch[0], (data >> 4) & 0x0f);
-			buffer[samples + 1] = decodeMS(&_status.ch[_channels - 1], data & 0x0f);
-		}
-	}
-
-	return samples;
-}
-
-
-
-#pragma mark -
-
-
-class Tinsel_ADPCMStream : public ADPCMStream {
-protected:
-	struct {
-		// Tinsel
-		double predictor;
-		double K0, K1;
-		double d0, d1;
-	} _status;
-
-	void reset() {
-		ADPCMStream::reset();
-		memset(&_status, 0, sizeof(_status));
-	}
-
-	sint16 decodeTinsel(sint16, double);
-	void readBufferTinselHeader();
-
-public:
-	Tinsel_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign)
-		: ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) {
-
-		if (blockAlign == 0)
-			DEBUG(0, LEVEL_ERROR, "Tinsel_ADPCMStream(): blockAlign isn't specified");
-
-		if (channels != 1)
-			DEBUG(0, LEVEL_ERROR, "Tinsel_ADPCMStream(): Tinsel ADPCM only supports mono");
-
-		memset(&_status, 0, sizeof(_status));
-	}
-
-};
-
-static const double TinselFilterTable[4][2] = {
-	{0, 0 },
-	{0.9375, 0},
-	{1.796875, -0.8125},
-	{1.53125, -0.859375}
-};
-
-void Tinsel_ADPCMStream::readBufferTinselHeader() {
-	uint8 start = _stream->readByte();
-	uint8 filterVal = (start & 0xC0) >> 6;
-
-	if ((start & 0x20) != 0) {
-		//Lower 6 bit are negative
-
-		// Negate
-		start = ~(start | 0xC0) + 1;
-
-		_status.predictor = 1 << start;
-	} else {
-		// Lower 6 bit are positive
-
-		// Truncate
-		start &= 0x1F;
-
-		_status.predictor = ((double) 1.0) / (1 << start);
-	}
-
-	_status.K0 = TinselFilterTable[filterVal][0];
-	_status.K1 = TinselFilterTable[filterVal][1];
-}
-
-sint16 Tinsel_ADPCMStream::decodeTinsel(sint16 code, double eVal) {
-	double sample;
-
-	sample = (double) code;
-	sample *= eVal * _status.predictor;
-	sample += (_status.d0 * _status.K0) + (_status.d1 * _status.K1);
-
-	_status.d1 = _status.d0;
-	_status.d0 = sample;
-
-	return (sint16) CLIP<double>(sample, -32768.0, 32767.0);
-}
-
-class Tinsel4_ADPCMStream : public Tinsel_ADPCMStream {
-public:
-	Tinsel4_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign)
-		: Tinsel_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) {}
-
-	virtual int readBuffer(sint16 *buffer, const int numSamples);
-};
-
-int Tinsel4_ADPCMStream::readBuffer(sint16 *buffer, const int numSamples) {
-	int samples;
-	uint16 data;
-	const double eVal = 1.142822265;
-
-	samples = 0;
-
-	assert(numSamples % 2 == 0);
-
-	while (samples < numSamples && !_stream->eos() && _stream->pos() < _endpos) {
-		if (_blockPos[0] == _blockAlign) {
-			readBufferTinselHeader();
-			_blockPos[0] = 0;
-		}
-
-		for (; samples < numSamples && _blockPos[0] < _blockAlign && !_stream->eos() && _stream->pos() < _endpos; samples += 2, _blockPos[0]++) {
-			// Read 1 byte = 8 bits = two 4 bit blocks
-			data = _stream->readByte();
-			buffer[samples] = decodeTinsel((data << 8) & 0xF000, eVal);
-			buffer[samples + 1] = decodeTinsel((data << 12) & 0xF000, eVal);
-		}
-	}
-
-	return samples;
-}
-
-class Tinsel6_ADPCMStream : public Tinsel_ADPCMStream {
-protected:
-	uint8 _chunkPos;
-	uint16 _chunkData;
-
-	void reset() {
-		ADPCMStream::reset();
-		_chunkPos = 0;
-		_chunkData = 0;
-	}
-
-public:
-	Tinsel6_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign)
-		: Tinsel_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) {
-		_chunkPos = 0;
-		_chunkData = 0;
-	}
-
-	virtual int readBuffer(sint16 *buffer, const int numSamples);
-};
-
-int Tinsel6_ADPCMStream::readBuffer(sint16 *buffer, const int numSamples) {
-	int samples;
-	const double eVal = 1.032226562;
-
-	samples = 0;
-
-	while (samples < numSamples && !_stream->eos() && _stream->pos() < _endpos) {
-		if (_blockPos[0] == _blockAlign) {
-			readBufferTinselHeader();
-			_blockPos[0] = 0;
-			_chunkPos = 0;
-		}
-
-		for (; samples < numSamples && _blockPos[0] < _blockAlign && !_stream->eos() && _stream->pos() < _endpos; samples++, _chunkPos = (_chunkPos + 1) % 4) {
-
-			switch (_chunkPos) {
-			case 0:
-				_chunkData = _stream->readByte();
-				buffer[samples] = decodeTinsel((_chunkData << 8) & 0xFC00, eVal);
-				break;
-			case 1:
-				_chunkData = (_chunkData << 8) | (_stream->readByte());
-				buffer[samples] = decodeTinsel((_chunkData << 6) & 0xFC00, eVal);
-				_blockPos[0]++;
-				break;
-			case 2:
-				_chunkData = (_chunkData << 8) | (_stream->readByte());
-				buffer[samples] = decodeTinsel((_chunkData << 4) & 0xFC00, eVal);
-				_blockPos[0]++;
-				break;
-			case 3:
-				_chunkData = (_chunkData << 8);
-				buffer[samples] = decodeTinsel((_chunkData << 2) & 0xFC00, eVal);
-				_blockPos[0]++;
-				break;
-			}
-
-		}
-
-	}
-
-	return samples;
-}
-
-class Tinsel8_ADPCMStream : public Tinsel_ADPCMStream {
-public:
-	Tinsel8_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign)
-		: Tinsel_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) {}
-
-	virtual int readBuffer(sint16 *buffer, const int numSamples);
-};
-
-int Tinsel8_ADPCMStream::readBuffer(sint16 *buffer, const int numSamples) {
-	int samples;
-	uint8 data;
-	const double eVal = 1.007843258;
-
-	samples = 0;
-
-	while (samples < numSamples && !_stream->eos() && _stream->pos() < _endpos) {
-		if (_blockPos[0] == _blockAlign) {
-			readBufferTinselHeader();
-			_blockPos[0] = 0;
-		}
-
-		for (; samples < numSamples && _blockPos[0] < _blockAlign && !_stream->eos() && _stream->pos() < _endpos; samples++, _blockPos[0]++) {
-			// Read 1 byte = 8 bits = one 8 bit block
-			data = _stream->readByte();
-			buffer[samples] = decodeTinsel(data << 8, eVal);
-		}
-	}
-
-	return samples;
-}
-
-
-#pragma mark -
-
-// Duck DK3 IMA ADPCM Decoder
-// Based on FFmpeg's decoder and http://wiki.multimedia.cx/index.php?title=Duck_DK3_IMA_ADPCM
-
-class DK3_ADPCMStream : public Ima_ADPCMStream {
-protected:
-
-	void reset() {
-		Ima_ADPCMStream::reset();
-		_topNibble = false;
-	}
-
-public:
-	DK3_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign)
-		: Ima_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) {
-
-		// DK3 only works as a stereo stream
-		assert(channels == 2);
-		_topNibble = false;
-	}
-
-	virtual int readBuffer(sint16 *buffer, const int numSamples);
-
-private:
-	uint8 _nibble, _lastByte;
-	bool _topNibble;
-};
-
-#define DK3_READ_NIBBLE() \
-	do { \
-		if (_topNibble) { \
-			_nibble = _lastByte >> 4; \
-			_topNibble = false; \
-		} else { \
-			if (_stream->pos() >= _endpos) \
-				break; \
-			if ((_stream->pos() % _blockAlign) == 0) \
-				continue; \
-			_lastByte = _stream->readByte(); \
-			_nibble = _lastByte & 0xf; \
-			_topNibble = true; \
-		} \
-	} while (0)
-
-
-int DK3_ADPCMStream::readBuffer(sint16 *buffer, const int numSamples) {
-	int samples = 0;
-
-	assert((numSamples % 4) == 0);
-
-	while (samples < numSamples && !_stream->eos() && _stream->pos() < _endpos) {
-		if ((_stream->pos() % _blockAlign) == 0) {
-			_stream->readUint16LE(); // Unknown
-			uint16 rate = _stream->readUint16LE(); // Copy of rate
-			_stream->skip(6); // Unknown
-			// Get predictor for both sum/diff channels
-			_status.ima_ch[0].last = _stream->readSint16LE();
-			_status.ima_ch[1].last = _stream->readSint16LE();
-			// Get index for both sum/diff channels
-			_status.ima_ch[0].stepIndex = _stream->readByte();
-			_status.ima_ch[1].stepIndex = _stream->readByte();
-
-			if (_stream->eos())
-				break;
-
-			// Sanity check
-			assert(rate == getRate());
-		}
-
-		DK3_READ_NIBBLE();
-		decodeIMA(_nibble, 0);
-
-		DK3_READ_NIBBLE();
-		decodeIMA(_nibble, 1);
-
-		buffer[samples++] = _status.ima_ch[0].last + _status.ima_ch[1].last;
-		buffer[samples++] = _status.ima_ch[0].last - _status.ima_ch[1].last;
-
-		DK3_READ_NIBBLE();
-		decodeIMA(_nibble, 0);
-
-		buffer[samples++] = _status.ima_ch[0].last + _status.ima_ch[1].last;
-		buffer[samples++] = _status.ima_ch[0].last - _status.ima_ch[1].last;
-	}
-
-	return samples;
-}
-
-
-#pragma mark -
-
-
-// adjust the step for use on the next sample.
-sint16 ADPCMStream::stepAdjust(uint8 code) {
-	static const sint16 adjusts[] = { -1, -1, -1, -1, 2, 4, 6, 8};
-
-	return adjusts[code & 0x07];
-}
-
-static const uint16 imaStepTable[89] = {
-	7,    8,    9,   10,   11,   12,   13,   14,
-	16,   17,   19,   21,   23,   25,   28,   31,
-	34,   37,   41,   45,   50,   55,   60,   66,
-	73,   80,   88,   97,  107,  118,  130,  143,
-	157,  173,  190,  209,  230,  253,  279,  307,
-	337,  371,  408,  449,  494,  544,  598,  658,
-	724,  796,  876,  963, 1060, 1166, 1282, 1411,
-	1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024,
-	3327, 3660, 4026, 4428, 4871, 5358, 5894, 6484,
-	7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899,
-	15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794,
-	32767
-};
-
-sint16 Ima_ADPCMStream::decodeIMA(uint8 code, int channel) {
-	sint32 E = (2 * (code & 0x7) + 1) * imaStepTable[_status.ima_ch[channel].stepIndex] / 8;
-	sint32 diff = (code & 0x08) ? -E : E;
-	sint32 samp = CLIP<sint32>(_status.ima_ch[channel].last + diff, -32768, 32767);
-
-	_status.ima_ch[channel].last = samp;
-	_status.ima_ch[channel].stepIndex += stepAdjust(code);
-	_status.ima_ch[channel].stepIndex = CLIP<sint32>(_status.ima_ch[channel].stepIndex, 0, ARRAYSIZE(imaStepTable) - 1);
-
-	return samp;
-}
-
-RewindableAudioStream *makeADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, typesADPCM type, int rate, int channels, uint32 blockAlign) {
-	// If size is 0, report the entire size of the stream
-	if (!size)
-		size = stream->size();
-
-	switch (type) {
-	case kADPCMOki:
-		return new Oki_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign);
-	case kADPCMMSIma:
-		return new MSIma_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign);
-	case kADPCMMSImaLastExpress:
-		return new MSIma_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign, true);
-	case kADPCMMS:
-		return new MS_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign);
-	case kADPCMTinsel4:
-		return new Tinsel4_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign);
-	case kADPCMTinsel6:
-		return new Tinsel6_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign);
-	case kADPCMTinsel8:
-		return new Tinsel8_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign);
-	case kADPCMIma:
-		return new Ima_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign);
-	case kADPCMApple:
-		return new Apple_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign);
-	case kADPCMDK3:
-		return new DK3_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign);
-	default:
-		DEBUG(0, LEVEL_ERROR, "Unsupported ADPCM encoding");
-		break;
-	}
-
-	return NULL;
-}
-
-} // End of namespace Audio
diff --git a/engines/ultima/nuvie/sound/decoder/wave/adpcm.h b/engines/ultima/nuvie/sound/decoder/wave/adpcm.h
deleted file mode 100644
index 62527cecd7..0000000000
--- a/engines/ultima/nuvie/sound/decoder/wave/adpcm.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/sound/decoders/adpcm.h $
- * $Id: adpcm.h 55381 2011-01-21 14:37:46Z mthreepwood $
- *
- */
-
-/**
- * @file
- * Sound decoder used in engines:
- *  - agos
- *  - lastexpress
- *  - mohawk
- *  - saga
- *  - scumm
- *  - tinsel
- */
-
-#ifndef SOUND_ADPCM_H
-#define SOUND_ADPCM_H
-
-//#include "common/scummsys.h"
-#include "ultima/nuvie/core/nuvie_defs.h"
-#include "ultima/nuvie/sound/mixer/types.h"
-#include "decoder/wave/stream.h"
-
-
-namespace Audio {
-
-class AudioStream;
-class RewindableAudioStream;
-
-// There are several types of ADPCM encoding, only some are supported here
-// For all the different encodings, refer to:
-// http://wiki.multimedia.cx/index.php?title=Category:ADPCM_Audio_Codecs
-// Usually, if the audio stream we're trying to play has the FourCC header
-// string intact, it's easy to discern which encoding is used
-enum typesADPCM {
-	kADPCMOki,                 // Dialogic/Oki ADPCM (aka VOX)
-	kADPCMMSIma,               // Microsoft IMA ADPCM
-	kADPCMMSImaLastExpress,    // Microsoft IMA ADPCM (with inverted samples)
-	kADPCMMS,                  // Microsoft ADPCM
-	kADPCMTinsel4,             // 4-bit ADPCM used by the Tinsel engine
-	kADPCMTinsel6,             // 6-bit ADPCM used by the Tinsel engine
-	kADPCMTinsel8,             // 8-bit ADPCM used by the Tinsel engine
-	kADPCMIma,                 // Standard IMA ADPCM
-	kADPCMApple,               // Apple QuickTime IMA ADPCM
-	kADPCMDK3                  // Duck DK3 IMA ADPCM
-};
-
-/**
- * Takes an input stream containing ADPCM compressed sound data and creates
- * an RewindableAudioStream from that.
- *
- * @param stream            the SeekableReadStream from which to read the ADPCM data
- * @param disposeAfterUse   whether to delete the stream after use
- * @param size              how many bytes to read from the stream (0 = all)
- * @param type              the compression type used
- * @param rate              the sampling rate
- * @param channels          the number of channels
- * @param blockAlign        block alignment ???
- * @return   a new RewindableAudioStream, or NULL, if an error occurred
- */
-RewindableAudioStream *makeADPCMStream(
-	Common::SeekableReadStream *stream,
-	DisposeAfterUse::Flag disposeAfterUse,
-	uint32 size, typesADPCM type,
-	int rate = 22050,
-	int channels = 2,
-	uint32 blockAlign = 0);
-
-} // End of namespace Audio
-
-#endif
diff --git a/engines/ultima/nuvie/sound/decoder/wave/endian.h b/engines/ultima/nuvie/sound/decoder/wave/endian.h
deleted file mode 100644
index 54b921524a..0000000000
--- a/engines/ultima/nuvie/sound/decoder/wave/endian.h
+++ /dev/null
@@ -1,455 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/common/endian.h $
- * $Id: endian.h 52480 2010-09-01 12:41:16Z Bluddy $
- *
- */
-
-#ifndef COMMON_ENDIAN_H
-#define COMMON_ENDIAN_H
-
-//#include <SDL.h>
-//#include "common/scummsys.h"
-#include "ultima/nuvie/core/nuvie_defs.h"
-
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
-#define SCUMM_BIG_ENDIAN
-#else
-#if SDL_BYTEORDER == SDL_LIL_ENDIAN
-#define SCUMM_LITTLE_ENDIAN
-#endif
-#endif
-
-/**
- *  \file endian.h
- *  Endian conversion and byteswap conversion functions or macros
- *
- *  SWAP_BYTES_??(a)      - inverse byte order
- *  SWAP_CONSTANT_??(a)   - inverse byte order, implemented as macro.
- *                              Use with compiletime-constants only, the result will be a compiletime-constant aswell.
- *                              Unlike most other functions these can be used for eg. switch-case labels
- *
- *  READ_UINT??(a)        - read native value from pointer a
- *  READ_??_UINT??(a)     - read LE/BE value from pointer a and convert it to native
- *  WRITE_??_UINT??(a, v) - write native value v to pointer a with LE/BE encoding
- *  TO_??_??(a)           - convert native value v to LE/BE
- *  FROM_??_??(a)         - convert LE/BE value v to native
- *  CONSTANT_??_??(a)     - convert LE/BE value v to native, implemented as macro.
- *                              Use with compiletime-constants only, the result will be a compiletime-constant aswell.
- *                              Unlike most other functions these can be used for eg. switch-case labels
- */
-
-
-//
-// GCC specific stuff
-//
-#if defined(__GNUC__)
-#define NORETURN_POST __attribute__((__noreturn__))
-#define PACKED_STRUCT __attribute__((__packed__))
-#define GCC_PRINTF(x,y) __attribute__((__format__(printf, x, y)))
-
-#if !defined(FORCEINLINE) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
-#define FORCEINLINE inline __attribute__((__always_inline__))
-#endif
-#else
-#define PACKED_STRUCT
-#define GCC_PRINTF(x,y)
-#endif
-
-
-//
-// Fallbacks / default values for various special macros
-//
-#ifndef FORCEINLINE
-#define FORCEINLINE inline
-#endif
-
-// Sanity check
-#if !defined(SCUMM_LITTLE_ENDIAN) && !defined(SCUMM_BIG_ENDIAN)
-#   error No endianness defined
-#endif
-
-#define SWAP_CONSTANT_32(a) \
-	((uint32)((((a) >> 24) & 0x00FF) | \
-	          (((a) >>  8) & 0xFF00) | \
-	          (((a) & 0xFF00) <<  8) | \
-	          (((a) & 0x00FF) << 24) ))
-
-#define SWAP_CONSTANT_16(a) \
-	((uint16)((((a) >>  8) & 0x00FF) | \
-	          (((a) <<  8) & 0xFF00) ))
-
-/**
- * Swap the bytes in a 32 bit word in order to convert LE encoded data to BE
- * and vice versa.
- */
-
-// machine/compiler-specific variants come first, fallback last
-
-// Test for GCC and if the target has the MIPS rel.2 instructions (we know the psp does)
-#if defined(__GNUC__) && (defined(__psp__) || defined(_MIPS_ARCH_MIPS32R2) || defined(_MIPS_ARCH_MIPS64R2))
-
-FORCEINLINE uint32 SWAP_BYTES_32(const uint32 a) {
-	if (__builtin_constant_p(a)) {
-		return SWAP_CONSTANT_32(a);
-	} else {
-		uint32 result;
-#   if defined(__psp__)
-		// use special allegrex instruction
-		__asm__("wsbw %0,%1" : "=r"(result) : "r"(a));
-#   else
-		__asm__("wsbh %0,%1\n"
-		        "rotr %0,%0,16" : "=r"(result) : "r"(a));
-#   endif
-		return result;
-	}
-}
-
-// Test for GCC >= 4.3.0 as this version added the bswap builtin
-#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
-
-FORCEINLINE uint32 SWAP_BYTES_32(uint32 a) {
-	return __builtin_bswap32(a);
-}
-
-// test for MSVC 7 or newer
-#elif defined(_MSC_VER) && _MSC_VER >= 1300
-
-FORCEINLINE uint32 SWAP_BYTES_32(uint32 a) {
-	return _byteswap_ulong(a);
-}
-
-// generic fallback
-#else
-
-inline uint32 SWAP_BYTES_32(uint32 a) {
-	const uint16 low = (uint16)a, high = (uint16)(a >> 16);
-	return ((uint32)(uint16)((low >> 8) | (low << 8)) << 16)
-	       | (uint16)((high >> 8) | (high << 8));
-}
-#endif
-
-/**
- * Swap the bytes in a 16 bit word in order to convert LE encoded data to BE
- * and vice versa.
- */
-
-// compilerspecific variants come first, fallback last
-
-// Test for GCC and if the target has the MIPS rel.2 instructions (we know the psp does)
-#if defined(__GNUC__) && (defined(__psp__) || defined(_MIPS_ARCH_MIPS32R2) || defined(_MIPS_ARCH_MIPS64R2))
-
-FORCEINLINE uint16 SWAP_BYTES_16(const uint16 a) {
-	if (__builtin_constant_p(a)) {
-		return SWAP_CONSTANT_16(a);
-	} else {
-		uint16 result;
-		__asm__("wsbh %0,%1" : "=r"(result) : "r"(a));
-		return result;
-	}
-}
-#else
-
-inline uint16 SWAP_BYTES_16(const uint16 a) {
-	return (a >> 8) | (a << 8);
-}
-#endif
-
-
-/**
- * A wrapper macro used around four character constants, like 'DATA', to
- * ensure portability. Typical usage: MKID_BE('DATA').
- *
- * Why is this necessary? The C/C++ standard does not define the endianess to
- * be used for character constants. Hence if one uses multi-byte character
- * constants, a potential portability problem opens up.
- *
- * Fortunately, a semi-standard has been established: On almost all systems
- * and compilers, multi-byte character constants are encoded using the big
- * endian convention (probably in analogy to the encoding of string constants).
- * Still some systems differ. This is why we provide the MKID_BE macro. If
- * you wrap your four character constants with it, the result will always be
- * BE encoded, even on systems which differ from the default BE encoding.
- *
- * For the latter systems we provide the INVERSE_MKID override.
- */
-#if defined(INVERSE_MKID)
-#define MKID_BE(a) SWAP_CONSTANT_32(a)
-
-#else
-#  define MKID_BE(a) ((uint32)(a))
-#endif
-
-// Functions for reading/writing native Integers,
-// this transparently handles the need for alignment
-
-#if !defined(SCUMM_NEED_ALIGNMENT)
-
-FORCEINLINE uint16 READ_UINT16(const void *ptr) {
-	return *(const uint16 *)(ptr);
-}
-
-FORCEINLINE uint32 READ_UINT32(const void *ptr) {
-	return *(const uint32 *)(ptr);
-}
-
-FORCEINLINE void WRITE_UINT16(void *ptr, uint16 value) {
-	*(uint16 *)(ptr) = value;
-}
-
-FORCEINLINE void WRITE_UINT32(void *ptr, uint32 value) {
-	*(uint32 *)(ptr) = value;
-}
-
-// test for GCC >= 4.0. these implementations will automatically use CPU-specific
-// instructions for unaligned data when they are available (eg. MIPS)
-#elif defined(__GNUC__) && (__GNUC__ >= 4)
-
-FORCEINLINE uint16 READ_UINT16(const void *ptr) {
-	struct Unaligned16 {
-		uint16 val;
-	} __attribute__((__packed__, __may_alias__));
-	return ((const Unaligned16 *)ptr)->val;
-}
-
-FORCEINLINE uint32 READ_UINT32(const void *ptr) {
-	struct Unaligned32 {
-		uint32 val;
-	} __attribute__((__packed__, __may_alias__));
-	return ((const Unaligned32 *)ptr)->val;
-}
-
-FORCEINLINE void WRITE_UINT16(void *ptr, uint16 value) {
-	struct Unaligned16 {
-		uint16 val;
-	} __attribute__((__packed__, __may_alias__));
-	((Unaligned16 *)ptr)->val = value;
-}
-
-FORCEINLINE void WRITE_UINT32(void *ptr, uint32 value) {
-	struct Unaligned32 {
-		uint32 val;
-	} __attribute__((__packed__, __may_alias__));
-	((Unaligned32 *)ptr)->val = value;
-}
-
-// use software fallback by loading each byte explicitely
-#else
-
-#   if defined(SCUMM_LITTLE_ENDIAN)
-
-inline uint16 READ_UINT16(const void *ptr) {
-	const uint8 *b = (const uint8 *)ptr;
-	return (b[1] << 8) | b[0];
-}
-inline uint32 READ_UINT32(const void *ptr) {
-	const uint8 *b = (const uint8 *)ptr;
-	return (b[3] << 24) | (b[2] << 16) | (b[1] << 8) | (b[0]);
-}
-inline void WRITE_UINT16(void *ptr, uint16 value) {
-	uint8 *b = (uint8 *)ptr;
-	b[0] = (uint8)(value >> 0);
-	b[1] = (uint8)(value >> 8);
-}
-inline void WRITE_UINT32(void *ptr, uint32 value) {
-	uint8 *b = (uint8 *)ptr;
-	b[0] = (uint8)(value >>  0);
-	b[1] = (uint8)(value >>  8);
-	b[2] = (uint8)(value >> 16);
-	b[3] = (uint8)(value >> 24);
-}
-
-#   elif defined(SCUMM_BIG_ENDIAN)
-
-inline uint16 READ_UINT16(const void *ptr) {
-	const uint8 *b = (const uint8 *)ptr;
-	return (b[0] << 8) | b[1];
-}
-inline uint32 READ_UINT32(const void *ptr) {
-	const uint8 *b = (const uint8 *)ptr;
-	return (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | (b[3]);
-}
-inline void WRITE_UINT16(void *ptr, uint16 value) {
-	uint8 *b = (uint8 *)ptr;
-	b[0] = (uint8)(value >> 8);
-	b[1] = (uint8)(value >> 0);
-}
-inline void WRITE_UINT32(void *ptr, uint32 value) {
-	uint8 *b = (uint8 *)ptr;
-	b[0] = (uint8)(value >> 24);
-	b[1] = (uint8)(value >> 16);
-	b[2] = (uint8)(value >>  8);
-	b[3] = (uint8)(value >>  0);
-}
-
-#   endif
-
-#endif
-
-
-//  Map Funtions for reading/writing BE/LE integers depending on native endianess
-#if defined(SCUMM_LITTLE_ENDIAN)
-
-#define READ_LE_UINT16(a) READ_UINT16(a)
-#define READ_LE_UINT32(a) READ_UINT32(a)
-
-#define WRITE_LE_UINT16(a, v) WRITE_UINT16(a, v)
-#define WRITE_LE_UINT32(a, v) WRITE_UINT32(a, v)
-
-#define FROM_LE_32(a) ((uint32)(a))
-#define FROM_LE_16(a) ((uint16)(a))
-
-#define FROM_BE_32(a) SWAP_BYTES_32(a)
-#define FROM_BE_16(a) SWAP_BYTES_16(a)
-
-#define TO_LE_32(a) ((uint32)(a))
-#define TO_LE_16(a) ((uint16)(a))
-
-#define TO_BE_32(a) SWAP_BYTES_32(a)
-#define TO_BE_16(a) SWAP_BYTES_16(a)
-
-#define CONSTANT_LE_32(a) ((uint32)(a))
-#define CONSTANT_LE_16(a) ((uint16)(a))
-
-#define CONSTANT_BE_32(a) SWAP_CONSTANT_32(a)
-#define CONSTANT_BE_16(a) SWAP_CONSTANT_16(a)
-
-// if the unaligned load and the byteswap take alot instructions its better to directly read and invert
-#   if defined(SCUMM_NEED_ALIGNMENT) && !defined(__mips__)
-
-inline uint16 READ_BE_UINT16(const void *ptr) {
-	const uint8 *b = (const uint8 *)ptr;
-	return (b[0] << 8) | b[1];
-}
-inline uint32 READ_BE_UINT32(const void *ptr) {
-	const uint8 *b = (const uint8 *)ptr;
-	return (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | (b[3]);
-}
-inline void WRITE_BE_UINT16(void *ptr, uint16 value) {
-	uint8 *b = (uint8 *)ptr;
-	b[0] = (uint8)(value >> 8);
-	b[1] = (uint8)(value >> 0);
-}
-inline void WRITE_BE_UINT32(void *ptr, uint32 value) {
-	uint8 *b = (uint8 *)ptr;
-	b[0] = (uint8)(value >> 24);
-	b[1] = (uint8)(value >> 16);
-	b[2] = (uint8)(value >>  8);
-	b[3] = (uint8)(value >>  0);
-}
-#   else
-
-inline uint16 READ_BE_UINT16(const void *ptr) {
-	return SWAP_BYTES_16(READ_UINT16(ptr));
-}
-inline uint32 READ_BE_UINT32(const void *ptr) {
-	return SWAP_BYTES_32(READ_UINT32(ptr));
-}
-inline void WRITE_BE_UINT16(void *ptr, uint16 value) {
-	WRITE_UINT16(ptr, SWAP_BYTES_16(value));
-}
-inline void WRITE_BE_UINT32(void *ptr, uint32 value) {
-	WRITE_UINT32(ptr, SWAP_BYTES_32(value));
-}
-
-#   endif   // if defined(SCUMM_NEED_ALIGNMENT)
-
-#elif defined(SCUMM_BIG_ENDIAN)
-
-#define MKID_BE(a) ((uint32)(a))
-
-#define READ_BE_UINT16(a) READ_UINT16(a)
-#define READ_BE_UINT32(a) READ_UINT32(a)
-
-#define WRITE_BE_UINT16(a, v) WRITE_UINT16(a, v)
-#define WRITE_BE_UINT32(a, v) WRITE_UINT32(a, v)
-
-#define FROM_LE_32(a) SWAP_BYTES_32(a)
-#define FROM_LE_16(a) SWAP_BYTES_16(a)
-
-#define FROM_BE_32(a) ((uint32)(a))
-#define FROM_BE_16(a) ((uint16)(a))
-
-#define TO_LE_32(a) SWAP_BYTES_32(a)
-#define TO_LE_16(a) SWAP_BYTES_16(a)
-
-#define TO_BE_32(a) ((uint32)(a))
-#define TO_BE_16(a) ((uint16)(a))
-
-#define CONSTANT_LE_32(a) SWAP_CONSTANT_32(a)
-#define CONSTANT_LE_16(a) SWAP_CONSTANT_16(a)
-
-#define CONSTANT_BE_32(a) ((uint32)(a))
-#define CONSTANT_BE_16(a) ((uint16)(a))
-
-// if the unaligned load and the byteswap take alot instructions its better to directly read and invert
-#   if defined(SCUMM_NEED_ALIGNMENT) && !defined(__mips__)
-
-inline uint16 READ_LE_UINT16(const void *ptr) {
-	const uint8 *b = (const uint8 *)ptr;
-	return (b[1] << 8) | b[0];
-}
-inline uint32 READ_LE_UINT32(const void *ptr) {
-	const uint8 *b = (const uint8 *)ptr;
-	return (b[3] << 24) | (b[2] << 16) | (b[1] << 8) | (b[0]);
-}
-inline void WRITE_LE_UINT16(void *ptr, uint16 value) {
-	uint8 *b = (uint8 *)ptr;
-	b[0] = (uint8)(value >> 0);
-	b[1] = (uint8)(value >> 8);
-}
-inline void WRITE_LE_UINT32(void *ptr, uint32 value) {
-	uint8 *b = (uint8 *)ptr;
-	b[0] = (uint8)(value >>  0);
-	b[1] = (uint8)(value >>  8);
-	b[2] = (uint8)(value >> 16);
-	b[3] = (uint8)(value >> 24);
-}
-#   else
-
-inline uint16 READ_LE_UINT16(const void *ptr) {
-	return SWAP_BYTES_16(READ_UINT16(ptr));
-}
-inline uint32 READ_LE_UINT32(const void *ptr) {
-	return SWAP_BYTES_32(READ_UINT32(ptr));
-}
-inline void WRITE_LE_UINT16(void *ptr, uint16 value) {
-	WRITE_UINT16(ptr, SWAP_BYTES_16(value));
-}
-inline void WRITE_LE_UINT32(void *ptr, uint32 value) {
-	WRITE_UINT32(ptr, SWAP_BYTES_32(value));
-}
-
-#   endif   // if defined(SCUMM_NEED_ALIGNMENT)
-
-#endif  // if defined(SCUMM_LITTLE_ENDIAN)
-
-inline uint32 READ_LE_UINT24(const void *ptr) {
-	const uint8 *b = (const uint8 *)ptr;
-	return (b[2] << 16) | (b[1] << 8) | (b[0]);
-}
-
-inline uint32 READ_BE_UINT24(const void *ptr) {
-	const uint8 *b = (const uint8 *)ptr;
-	return (b[0] << 16) | (b[1] << 8) | (b[2]);
-}
-
-#endif
diff --git a/engines/ultima/nuvie/sound/decoder/wave/list.h b/engines/ultima/nuvie/sound/decoder/wave/list.h
deleted file mode 100644
index ae50d46d95..0000000000
--- a/engines/ultima/nuvie/sound/decoder/wave/list.h
+++ /dev/null
@@ -1,262 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/common/list.h $
- * $Id: list.h 40291 2009-05-03 22:45:31Z fingolfin $
- */
-
-#ifndef COMMON_LIST_H
-#define COMMON_LIST_H
-
-//#include <assert.h>
-#include "decoder/wave/list_intern.h"
-
-namespace Common {
-
-/**
- * Simple double linked list, modeled after the list template of the standard
- * C++ library.
- */
-template<typename t_T>
-class List {
-protected:
-	typedef ListInternal::NodeBase      NodeBase;
-	typedef ListInternal::Node<t_T>     Node;
-
-	NodeBase _anchor;
-
-public:
-	typedef ListInternal::Iterator<t_T>     iterator;
-	typedef ListInternal::ConstIterator<t_T>    const_iterator;
-
-	typedef t_T value_type;
-
-public:
-	List() {
-		_anchor._prev = &_anchor;
-		_anchor._next = &_anchor;
-	}
-	List(const List<t_T> &list) {
-		_anchor._prev = &_anchor;
-		_anchor._next = &_anchor;
-
-		insert(begin(), list.begin(), list.end());
-	}
-
-	~List() {
-		clear();
-	}
-
-	/**
-	 * Inserts element before pos.
-	 */
-	void insert(iterator pos, const t_T &element) {
-		insert(pos._node, element);
-	}
-
-	/**
-	 * Inserts the elements from first to last before pos.
-	 */
-	template<typename iterator2>
-	void insert(iterator pos, iterator2 first, iterator2 last) {
-		for (; first != last; ++first)
-			insert(pos, *first);
-	}
-
-	/**
-	 * Deletes the element at location pos and returns an iterator pointing
-	 * to the element after the one which was deleted.
-	 */
-	iterator erase(iterator pos) {
-		assert(pos != end());
-		return iterator(erase(pos._node)._next);
-	}
-
-	/**
-	 * Deletes the element at location pos and returns an iterator pointing
-	 * to the element before the one which was deleted.
-	 */
-	iterator reverse_erase(iterator pos) {
-		assert(pos != end());
-		return iterator(erase(pos._node)._prev);
-	}
-
-	/**
-	 * Deletes the elements between first and last (including first but not
-	 * last) and returns an iterator pointing to the element after the one
-	 * which was deleted (i.e., last).
-	 */
-	iterator erase(iterator first, iterator last) {
-		NodeBase *f = first._node;
-		NodeBase *l = last._node;
-		while (f != l)
-			f = erase(f)._next;
-		return last;
-	}
-
-	/**
-	 * Removes all elements that are equal to val from the list.
-	 */
-	void remove(const t_T &val) {
-		NodeBase *i = _anchor._next;
-		while (i != &_anchor)
-			if (val == static_cast<Node *>(i)->_data)
-				i = erase(i)._next;
-			else
-				i = i->_next;
-	}
-
-	/** Inserts element at the start of the list. */
-	void push_front(const t_T &element) {
-		insert(_anchor._next, element);
-	}
-
-	/** Appends element to the end of the list. */
-	void push_back(const t_T &element) {
-		insert(&_anchor, element);
-	}
-
-	/** Removes the first element of the list. */
-	void pop_front() {
-		assert(!empty());
-		erase(_anchor._next);
-	}
-
-	/** Removes the last element of the list. */
-	void pop_back() {
-		assert(!empty());
-		erase(_anchor._prev);
-	}
-
-	/** Returns a reference to the first element of the list. */
-	t_T &front() {
-		return static_cast<Node *>(_anchor._next)->_data;
-	}
-
-	/** Returns a reference to the first element of the list. */
-	const t_T &front() const {
-		return static_cast<Node *>(_anchor._next)->_data;
-	}
-
-	/** Returns a reference to the last element of the list. */
-	t_T &back() {
-		return static_cast<Node *>(_anchor._prev)->_data;
-	}
-
-	/** Returns a reference to the last element of the list. */
-	const t_T &back() const {
-		return static_cast<Node *>(_anchor._prev)->_data;
-	}
-
-	List<t_T> &operator=(const List<t_T> &list) {
-		if (this != &list) {
-			iterator i;
-			const iterator e = end();
-			const_iterator i2;
-			const_iterator e2 = list.end();
-
-			for (i = begin(), i2 = list.begin(); (i != e) && (i2 != e2) ; ++i, ++i2) {
-				static_cast<Node *>(i._node)->_data = static_cast<const Node *>(i2._node)->_data;
-			}
-
-			if (i == e)
-				insert(i, i2, e2);
-			else
-				erase(i, e);
-		}
-
-		return *this;
-	}
-
-	uint32 size() const {
-		int n = 0;
-		for (const NodeBase *cur = _anchor._next; cur != &_anchor; cur = cur->_next)
-			++n;
-		return n;
-	}
-
-	void clear() {
-		NodeBase *pos = _anchor._next;
-		while (pos != &_anchor) {
-			Node *node = static_cast<Node *>(pos);
-			pos = pos->_next;
-			delete node;
-		}
-
-		_anchor._prev = &_anchor;
-		_anchor._next = &_anchor;
-	}
-
-	bool empty() const {
-		return (&_anchor == _anchor._next);
-	}
-
-
-	iterator        begin() {
-		return iterator(_anchor._next);
-	}
-
-	iterator        reverse_begin() {
-		return iterator(_anchor._prev);
-	}
-
-	iterator        end() {
-		return iterator(&_anchor);
-	}
-
-	const_iterator  begin() const {
-		return const_iterator(_anchor._next);
-	}
-
-	const_iterator  reverse_begin() const {
-		return const_iterator(_anchor._prev);
-	}
-
-	const_iterator  end() const {
-		return const_iterator(const_cast<NodeBase *>(&_anchor));
-	}
-
-protected:
-	NodeBase erase(NodeBase *pos) {
-		NodeBase n = *pos;
-		Node *node = static_cast<Node *>(pos);
-		n._prev->_next = n._next;
-		n._next->_prev = n._prev;
-		delete node;
-		return n;
-	}
-
-	/**
-	 * Inserts element before pos.
-	 */
-	void insert(NodeBase *pos, const t_T &element) {
-		ListInternal::NodeBase *newNode = new Node(element);
-		assert(newNode);
-
-		newNode->_next = pos;
-		newNode->_prev = pos->_prev;
-		newNode->_prev->_next = newNode;
-		newNode->_next->_prev = newNode;
-	}
-};
-
-} // End of namespace Common
-
-#endif
diff --git a/engines/ultima/nuvie/sound/decoder/wave/list_intern.h b/engines/ultima/nuvie/sound/decoder/wave/list_intern.h
deleted file mode 100644
index 3cca6affcc..0000000000
--- a/engines/ultima/nuvie/sound/decoder/wave/list_intern.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/common/list_intern.h $
- * $Id: list_intern.h 46644 2009-12-27 14:13:39Z megath $
- */
-
-#ifndef COMMON_LIST_INTERN_H
-#define COMMON_LIST_INTERN_H
-
-//#include "common/scummsys.h"
-
-namespace Common {
-
-template<typename T> class List;
-
-
-namespace ListInternal {
-struct NodeBase {
-	NodeBase *_prev;
-	NodeBase *_next;
-};
-
-template <typename T>
-struct Node : public NodeBase {
-	T _data;
-
-	Node(const T &x) : _data(x) {}
-};
-
-template<typename T> struct ConstIterator;
-
-template<typename T>
-struct Iterator {
-	typedef Iterator<T> Self;
-	typedef Node<T>    *NodePtr;
-	typedef T          &ValueRef;
-	typedef T          *ValuePtr;
-	typedef T           ValueType;
-
-	NodeBase *_node;
-
-	Iterator() : _node(0) {}
-	explicit Iterator(NodeBase *node) : _node(node) {}
-
-	// Prefix inc
-	Self &operator++() {
-		if (_node)
-			_node = _node->_next;
-		return *this;
-	}
-	// Postfix inc
-	Self operator++(int) {
-		Self tmp(_node);
-		++(*this);
-		return tmp;
-	}
-	// Prefix dec
-	Self &operator--() {
-		if (_node)
-			_node = _node->_prev;
-		return *this;
-	}
-	// Postfix dec
-	Self operator--(int) {
-		Self tmp(_node);
-		--(*this);
-		return tmp;
-	}
-	ValueRef operator*() const {
-		assert(_node);
-		return static_cast<NodePtr>(_node)->_data;
-	}
-	ValuePtr operator->() const {
-		return &(operator*());
-	}
-
-	bool operator==(const Self &x) const {
-		return _node == x._node;
-	}
-
-	bool operator!=(const Self &x) const {
-		return _node != x._node;
-	}
-};
-
-template<typename T>
-struct ConstIterator {
-	typedef ConstIterator<T>    Self;
-	typedef const Node<T>  *NodePtr;
-	typedef const T        &ValueRef;
-	typedef const T        *ValuePtr;
-
-	const NodeBase *_node;
-
-	ConstIterator() : _node(0) {}
-	explicit ConstIterator(const NodeBase *node) : _node(node) {}
-	ConstIterator(const Iterator<T> &x) : _node(x._node) {}
-
-	// Prefix inc
-	Self &operator++() {
-		if (_node)
-			_node = _node->_next;
-		return *this;
-	}
-	// Postfix inc
-	Self operator++(int) {
-		Self tmp(_node);
-		++(*this);
-		return tmp;
-	}
-	// Prefix dec
-	Self &operator--() {
-		if (_node)
-			_node = _node->_prev;
-		return *this;
-	}
-	// Postfix dec
-	Self operator--(int) {
-		Self tmp(_node);
-		--(*this);
-		return tmp;
-	}
-	ValueRef operator*() const {
-		assert(_node);
-		return static_cast<NodePtr>(_node)->_data;
-	}
-	ValuePtr operator->() const {
-		return &(operator*());
-	}
-
-	bool operator==(const Self &x) const {
-		return _node == x._node;
-	}
-
-	bool operator!=(const Self &x) const {
-		return _node != x._node;
-	}
-};
-
-
-template<typename T>
-bool operator==(const Iterator<T> &a, const ConstIterator<T> &b) {
-	return a._node == b._node;
-}
-
-template<typename T>
-bool operator!=(const Iterator<T> &a, const ConstIterator<T> &b) {
-	return a._node != b._node;
-}
-}
-
-
-} // End of namespace Common
-
-#endif
diff --git a/engines/ultima/nuvie/sound/decoder/wave/memstream.h b/engines/ultima/nuvie/sound/decoder/wave/memstream.h
deleted file mode 100644
index 498617f2c7..0000000000
--- a/engines/ultima/nuvie/sound/decoder/wave/memstream.h
+++ /dev/null
@@ -1,192 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/common/memstream.h $
- * $Id: memstream.h 54441 2010-11-23 22:27:20Z fingolfin $
- *
- */
-
-#ifndef COMMON_MEMSTREAM_H
-#define COMMON_MEMSTREAM_H
-
-//#include <stdlib.h>
-#include "decoder/wave/stream.h"
-
-namespace Common {
-
-/**
- * Simple memory based 'stream', which implements the ReadStream interface for
- * a plain memory block.
- */
-class MemoryReadStream : public SeekableReadStream {
-private:
-	const uint8 *const _ptrOrig;
-	const uint8 *_ptr;
-	const uint32 _size;
-	uint32 _pos;
-	DisposeAfterUse::Flag _disposeMemory;
-	bool _eos;
-
-public:
-
-	/**
-	 * This constructor takes a pointer to a memory buffer and a length, and
-	 * wraps it. If disposeMemory is true, the MemoryReadStream takes ownership
-	 * of the buffer and hence free's it when destructed.
-	 */
-	MemoryReadStream(const uint8 *dataPtr, uint32 dataSize, DisposeAfterUse::Flag disposeMemory = DisposeAfterUse::NO) :
-		_ptrOrig(dataPtr),
-		_ptr(dataPtr),
-		_size(dataSize),
-		_pos(0),
-		_disposeMemory(disposeMemory),
-		_eos(false) {}
-
-	~MemoryReadStream() {
-		if (_disposeMemory)
-			free(const_cast<uint8 *>(_ptrOrig));
-	}
-
-	uint32 read(void *dataPtr, uint32 dataSize);
-
-	bool eos() const {
-		return _eos;
-	}
-	void clearErr() {
-		_eos = false;
-	}
-
-	sint32 pos() const {
-		return _pos;
-	}
-	sint32 size() const {
-		return _size;
-	}
-
-	bool seek(sint32 offs, int whence = SEEK_SET);
-};
-
-
-/**
- * This is a MemoryReadStream subclass which adds non-endian
- * read methods whose endianness is set on the stream creation.
- */
-class MemoryReadStreamEndian : public MemoryReadStream, public ReadStreamEndian {
-public:
-	MemoryReadStreamEndian(const uint8 *buf, uint32 len, bool bigEndian)
-		: MemoryReadStream(buf, len), ReadStreamEndian(bigEndian) {}
-};
-
-/**
- * Simple memory based 'stream', which implements the WriteStream interface for
- * a plain memory block.
- */
-class MemoryWriteStream : public WriteStream {
-private:
-	uint8 *_ptr;
-	const uint32 _bufSize;
-	uint32 _pos;
-public:
-	MemoryWriteStream(uint8 *buf, uint32 len) : _ptr(buf), _bufSize(len), _pos(0) {}
-
-	uint32 write(const void *dataPtr, uint32 dataSize) {
-		// Write at most as many byuint8as are still available...
-		if (dataSize > _bufSize - _pos)
-			dataSize = _bufSize - _pos;
-		memcpy(_ptr, dataPtr, dataSize);
-		_ptr += dataSize;
-		_pos += dataSize;
-		return dataSize;
-	}
-
-	uint32 pos() const {
-		return _pos;
-	}
-	uint32 size() const {
-		return _bufSize;
-	}
-};
-
-/**
- * A sort of hybrid between MemoryWriteStream and Array classes. A stream
- * that grows as it's written to.
- */
-class MemoryWriteStreamDynamic : public WriteStream {
-private:
-	uint32 _capacity;
-	uint32 _size;
-	uint8 *_ptr;
-	uint8 *_data;
-	uint32 _pos;
-	DisposeAfterUse::Flag _disposeMemory;
-
-	void ensureCapacity(uint32 new_len) {
-		if (new_len <= _capacity)
-			return;
-
-		uint8 *old_data = _data;
-
-		_capacity = new_len + 32;
-		_data = (uint8 *)malloc(_capacity);
-		_ptr = _data + _pos;
-
-		if (old_data) {
-			// Copy old data
-			memcpy(_data, old_data, _size);
-			free(old_data);
-		}
-
-		_size = new_len;
-	}
-public:
-	MemoryWriteStreamDynamic(DisposeAfterUse::Flag disposeMemory = DisposeAfterUse::NO) : _capacity(0), _size(0), _ptr(0), _data(0), _pos(0), _disposeMemory(disposeMemory) {}
-
-	~MemoryWriteStreamDynamic() {
-		if (_disposeMemory)
-			free(_data);
-	}
-
-	uint32 write(const void *dataPtr, uint32 dataSize) {
-		ensureCapacity(_pos + dataSize);
-		memcpy(_ptr, dataPtr, dataSize);
-		_ptr += dataSize;
-		_pos += dataSize;
-		if (_pos > _size)
-			_size = _pos;
-		return dataSize;
-	}
-
-	uint32 pos() const {
-		return _pos;
-	}
-	uint32 size() const {
-		return _size;
-	}
-
-	uint8 *getData() {
-		return _data;
-	}
-
-	bool seek(sint32 offset, int whence = SEEK_SET);
-};
-
-}   // End of namespace Common
-
-#endif
diff --git a/engines/ultima/nuvie/sound/decoder/wave/raw.cpp b/engines/ultima/nuvie/sound/decoder/wave/raw.cpp
deleted file mode 100644
index b4772786e4..0000000000
--- a/engines/ultima/nuvie/sound/decoder/wave/raw.cpp
+++ /dev/null
@@ -1,377 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/sound/decoders/raw.cpp $
- * $Id: raw.cpp 54385 2010-11-19 17:03:07Z fingolfin $
- *
- */
-
-//#include <stdlib.h>
-//#include <string.h>
-#include "ultima/nuvie/core/nuvie_defs.h"
-#include "ultima/nuvie/sound/mixer/types.h"
-#include "decoder/wave/endian.h"
-#include "decoder/wave/memstream.h"
-
-#include "audiostream.h"
-#include "audio/mixer.h"
-#include "decoder/wave/raw.h"
-
-#ifdef MIN
-#undef MIN
-#endif
-
-template<typename T> inline T MIN(T a, T b)    {
-	return (a < b) ? a : b;
-}
-
-namespace Audio {
-
-// This used to be an inline template function, but
-// buggy template function handling in MSVC6 forced
-// us to go with the macro approach. So far this is
-// the only template function that MSVC6 seemed to
-// compile incorrectly. Knock on wood.
-#define READ_ENDIAN_SAMPLE(is16Bit, isUnsigned, ptr, isLE) \
-	((is16Bit ? (isLE ? READ_LE_UINT16(ptr) : READ_BE_UINT16(ptr)) : (*ptr << 8)) ^ (isUnsigned ? 0x8000 : 0))
-
-
-#pragma mark -
-#pragma mark --- RawStream ---
-#pragma mark -
-
-/**
- * This is a stream, which allows for playing raw PCM data from a stream.
- * It also features playback of multiple blocks from a given stream.
- */
-template<bool is16Bit, bool isUnsigned, bool isLE>
-class RawStream : public SeekableAudioStream {
-public:
-	RawStream(int rate, bool stereo, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream, const RawStreamBlockList &blocks)
-		: _rate(rate), _isStereo(stereo), _playtime(0, rate), _stream(stream), _disposeAfterUse(disposeStream), _blocks(blocks), _curBlock(_blocks.begin()), _blockLeft(0), _buffer(0) {
-
-		assert(_blocks.size() > 0);
-
-		// Setup our buffer for readBuffer
-		_buffer = new uint8[kSampleBufferLength * (is16Bit ? 2 : 1)];
-		assert(_buffer);
-
-		// Set current buffer state, playing first block
-		_stream->seek(_curBlock->pos, SEEK_SET);
-
-		// In case of an error we will stop (or rather
-		// not start) stream playback.
-		if (_stream->err()) {
-			_blockLeft = 0;
-			_curBlock = _blocks.end();
-		} else {
-			_blockLeft = _curBlock->len;
-		}
-
-		// Add up length of all blocks in order to caluclate total play time
-		sint32 len = 0;
-		for (RawStreamBlockList::const_iterator i = _blocks.begin(); i != _blocks.end(); ++i) {
-			assert(i->len % (_isStereo ? 2 : 1) == 0);
-			len += i->len;
-		}
-
-		_playtime = Timestamp(0, len / (_isStereo ? 2 : 1), rate);
-	}
-
-	~RawStream() {
-		if (_disposeAfterUse == DisposeAfterUse::YES)
-			delete _stream;
-
-		delete[] _buffer;
-	}
-
-	int readBuffer(sint16 *buffer, const int numSamples);
-
-	bool isStereo() const           {
-		return _isStereo;
-	}
-	bool endOfData() const          {
-		return (_curBlock == _blocks.end()) && (_blockLeft == 0);
-	}
-
-	int getRate() const         {
-		return _rate;
-	}
-	Timestamp getLength() const {
-		return _playtime;
-	}
-
-	bool seek(const Timestamp &where);
-private:
-	const int _rate;                               ///< Sample rate of stream
-	const bool _isStereo;                          ///< Whether this is an stereo stream
-	Timestamp _playtime;                           ///< Calculated total play time
-	Common::SeekableReadStream *_stream;           ///< Stream to read data from
-	const DisposeAfterUse::Flag _disposeAfterUse;  ///< Indicates whether the stream object should be deleted when this RawStream is destructed
-	const RawStreamBlockList _blocks;              ///< Audio block list
-
-	RawStreamBlockList::const_iterator _curBlock;  ///< Current audio block number
-	sint32 _blockLeft;                              ///< How many bytes are still left in the current block
-
-	/**
-	 * Advance one block in the stream in case
-	 * the current one is empty.
-	 */
-	void updateBlockIfNeeded();
-
-	uint8 *_buffer;                                 ///< Buffer used in readBuffer
-	enum {
-		/**
-		 * How many samples we can buffer at once.
-		 *
-		 * TODO: Check whether this size suffices
-		 * for systems with slow disk I/O.
-		 */
-		kSampleBufferLength = 2048
-	};
-
-	/**
-	 * Fill the temporary sample buffer used in readBuffer.
-	 *
-	 * @param maxSamples Maximum samples to read.
-	 * @return actual count of samples read.
-	 */
-	int fillBuffer(int maxSamples);
-};
-
-template<bool is16Bit, bool isUnsigned, bool isLE>
-int RawStream<is16Bit, isUnsigned, isLE>::readBuffer(sint16 *buffer, const int numSamples) {
-	int samplesLeft = numSamples;
-
-	while (samplesLeft > 0) {
-		// Try to read up to "samplesLeft" samples.
-		int len = fillBuffer(samplesLeft);
-
-		// In case we were not able to read any samples
-		// we will stop reading here.
-		if (!len)
-			break;
-
-		// Adjust the samples left to read.
-		samplesLeft -= len;
-
-		// Copy the data to the caller's buffer.
-		const uint8 *src = _buffer;
-		while (len-- > 0) {
-			*buffer++ = READ_ENDIAN_SAMPLE(is16Bit, isUnsigned, src, isLE);
-			src += (is16Bit ? 2 : 1);
-		}
-	}
-
-	return numSamples - samplesLeft;
-}
-
-template<bool is16Bit, bool isUnsigned, bool isLE>
-int RawStream<is16Bit, isUnsigned, isLE>::fillBuffer(int maxSamples) {
-	int bufferedSamples = 0;
-	uint8 *dst = _buffer;
-
-	// We can only read up to "kSampleBufferLength" samples
-	// so we take this into consideration, when trying to
-	// read up to maxSamples.
-	maxSamples = MIN<int>(kSampleBufferLength, maxSamples);
-
-	// We will only read up to maxSamples
-	while (maxSamples > 0 && !endOfData()) {
-		// Calculate how many samples we can safely read
-		// from the current block.
-		const int len = MIN<int>(maxSamples, _blockLeft);
-
-		// Try to read all the sample data and update the
-		// destination pointer.
-		const int bytesRead = _stream->read(dst, len * (is16Bit ? 2 : 1));
-		dst += bytesRead;
-
-		// Calculate how many samples we actually read.
-		const int samplesRead = bytesRead / (is16Bit ? 2 : 1);
-
-		// Update all status variables
-		bufferedSamples += samplesRead;
-		maxSamples -= samplesRead;
-		_blockLeft -= samplesRead;
-
-		// In case of an error we will stop
-		// stream playback.
-		if (_stream->err()) {
-			_blockLeft = 0;
-			_curBlock = _blocks.end();
-		}
-
-		// Advance to the next block in case the current
-		// one is already finished.
-		updateBlockIfNeeded();
-	}
-
-	return bufferedSamples;
-}
-
-template<bool is16Bit, bool isUnsigned, bool isLE>
-void RawStream<is16Bit, isUnsigned, isLE>::updateBlockIfNeeded() {
-	// Have we now finished this block? If so, read the next block
-	if (_blockLeft == 0 && _curBlock != _blocks.end()) {
-		// Next block
-		++_curBlock;
-
-		// Check whether we reached the end of the stream
-		// yet. In case we did not do this, we will just
-		// setup the next block as new block.
-		if (_curBlock != _blocks.end()) {
-			_stream->seek(_curBlock->pos, SEEK_SET);
-
-			// In case of an error we will stop
-			// stream playback.
-			if (_stream->err()) {
-				_blockLeft = 0;
-				_curBlock = _blocks.end();
-			} else {
-				_blockLeft = _curBlock->len;
-			}
-		}
-	}
-}
-
-template<bool is16Bit, bool isUnsigned, bool isLE>
-bool RawStream<is16Bit, isUnsigned, isLE>::seek(const Timestamp &where) {
-	_blockLeft = 0;
-	_curBlock = _blocks.end();
-
-	if (where > _playtime)
-		return false;
-
-	const uint32 seekSample = convertTimeToStreamPos(where, getRate(), isStereo()).totalNumberOfFrames();
-	uint32 curSample = 0;
-
-	// Search for the disk block in which the specific sample is placed
-	for (_curBlock = _blocks.begin(); _curBlock != _blocks.end(); ++_curBlock) {
-		uint32 nextBlockSample = curSample + _curBlock->len;
-
-		if (nextBlockSample > seekSample)
-			break;
-
-		curSample = nextBlockSample;
-	}
-
-	if (_curBlock == _blocks.end()) {
-		return ((seekSample - curSample) == 0);
-	} else {
-		const uint32 offset = seekSample - curSample;
-
-		_stream->seek(_curBlock->pos + offset * (is16Bit ? 2 : 1), SEEK_SET);
-
-		// In case of an error we will stop
-		// stream playback.
-		if (_stream->err()) {
-			_blockLeft = 0;
-			_curBlock = _blocks.end();
-		} else {
-			_blockLeft = _curBlock->len - offset;
-		}
-
-		return true;
-	}
-}
-
-#pragma mark -
-#pragma mark --- Raw stream factories ---
-#pragma mark -
-
-/* In the following, we use preprocessor / macro tricks to simplify the code
- * which instantiates the input streams. We used to use template functions for
- * this, but MSVC6 / EVC 3-4 (used for WinCE builds) are extremely buggy when it
- * comes to this feature of C++... so as a compromise we use macros to cut down
- * on the (source) code duplication a bit.
- * So while normally macro tricks are said to make maintenance harder, in this
- * particular case it should actually help it :-)
- */
-
-#define MAKE_RAW_STREAM(UNSIGNED) \
-	if (is16Bit) { \
-		if (isLE) \
-			return new RawStream<true, UNSIGNED, true>(rate, isStereo, disposeAfterUse, stream, blockList); \
-		else  \
-			return new RawStream<true, UNSIGNED, false>(rate, isStereo, disposeAfterUse, stream, blockList); \
-	} else \
-		return new RawStream<false, UNSIGNED, false>(rate, isStereo, disposeAfterUse, stream, blockList)
-
-SeekableAudioStream *makeRawStream(Common::SeekableReadStream *stream,
-								   const RawStreamBlockList &blockList,
-								   int rate,
-								   uint8 flags,
-								   DisposeAfterUse::Flag disposeAfterUse) {
-	const bool isStereo   = (flags & Audio::FLAG_STEREO) != 0;
-	const bool is16Bit    = (flags & Audio::FLAG_16BITS) != 0;
-	const bool isUnsigned = (flags & Audio::FLAG_UNSIGNED) != 0;
-	const bool isLE       = (flags & Audio::FLAG_LITTLE_ENDIAN) != 0;
-
-	if (blockList.empty()) {
-		DEBUG(0, LEVEL_WARNING, "Empty block list passed to makeRawStream");
-		if (disposeAfterUse == DisposeAfterUse::YES)
-			delete stream;
-		return 0;
-	}
-
-	if (isUnsigned) {
-		MAKE_RAW_STREAM(true);
-	} else {
-		MAKE_RAW_STREAM(false);
-	}
-}
-
-SeekableAudioStream *makeRawStream(Common::SeekableReadStream *stream,
-								   int rate, uint8 flags,
-								   DisposeAfterUse::Flag disposeAfterUse) {
-	RawStreamBlockList blocks;
-	RawStreamBlock block;
-	block.pos = 0;
-
-	const bool isStereo   = (flags & Audio::FLAG_STEREO) != 0;
-	const bool is16Bit    = (flags & Audio::FLAG_16BITS) != 0;
-
-	assert(stream->size() % ((is16Bit ? 2 : 1) * (isStereo ? 2 : 1)) == 0);
-
-	block.len = stream->size() / (is16Bit ? 2 : 1);
-	blocks.push_back(block);
-
-	return makeRawStream(stream, blocks, rate, flags, disposeAfterUse);
-}
-
-
-SeekableAudioStream *makeRawStream(const uint8 *buffer, uint32 size,
-								   int rate, uint8 flags,
-								   DisposeAfterUse::Flag disposeAfterUse) {
-	return makeRawStream(new Common::MemoryReadStream(buffer, size, disposeAfterUse), rate, flags, DisposeAfterUse::YES);
-}
-
-SeekableAudioStream *makeRawDiskStream_OLD(Common::SeekableReadStream *stream, RawStreamBlock *block, int numBlocks,
-		int rate, uint8 flags, DisposeAfterUse::Flag disposeStream) {
-	assert(numBlocks > 0);
-	RawStreamBlockList blocks;
-	for (int i = 0; i < numBlocks; ++i)
-		blocks.push_back(block[i]);
-
-	return makeRawStream(stream, blocks, rate, flags, disposeStream);
-}
-
-} // End of namespace Audio
diff --git a/engines/ultima/nuvie/sound/decoder/wave/raw.h b/engines/ultima/nuvie/sound/decoder/wave/raw.h
deleted file mode 100644
index 6168f5888b..0000000000
--- a/engines/ultima/nuvie/sound/decoder/wave/raw.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/sound/decoders/raw.h $
- * $Id: raw.h 48965 2010-05-07 12:59:46Z salty-horse $
- *
- */
-
-#ifndef SOUND_RAW_H
-#define SOUND_RAW_H
-
-//#include "common/scummsys.h"
-#include "ultima/nuvie/core/nuvie_defs.h"
-#include "ultima/nuvie/sound/mixer/types.h"
-
-#include "decoder/wave/stream.h"
-#include "decoder/wave/list.h"
-
-
-//namespace Common { class SeekableReadStream; }
-
-
-namespace Audio {
-
-class AudioStream;
-//class Common::SeekableAudioStream;
-
-/**
- * Various flags which can be bit-ORed and then passed to
- * makeRawStream and some other AudioStream factories
- * to control their behavior.
- *
- * Engine authors are advised not to rely on a certain value or
- * order of these flags (in particular, do not store them verbatim
- * in savestates).
- */
-enum RawFlags {
-	/** unsigned samples (default: signed) */
-	FLAG_UNSIGNED = 1 << 0,
-
-	/** sound is 16 bits wide (default: 8bit) */
-	FLAG_16BITS = 1 << 1,
-
-	/** samples are little endian (default: big endian) */
-	FLAG_LITTLE_ENDIAN = 1 << 2,
-
-	/** sound is in stereo (default: mono) */
-	FLAG_STEREO = 1 << 3
-};
-
-
-/**
- * Struct used to define the audio data to be played by a RawStream.
- */
-struct RawStreamBlock {
-	sint32 pos;   ///< Position in stream of the block (in bytes of course!)
-	sint32 len;   ///< Length of the block (in raw samples, not sample pairs!)
-};
-
-/**
- * List containing all blocks of a raw stream.
- * @see RawStreamBlock
- */
-typedef Common::List<RawStreamBlock> RawStreamBlockList;
-
-/**
- * Creates an audio stream, which plays from the given buffer.
- *
- * @param buffer Buffer to play from.
- * @param size   Size of the buffer in bytes.
- * @param rate   Rate of the sound data.
- * @param flags  Audio flags combination.
- * @see RawFlags
- * @param disposeAfterUse Whether to free the buffer after use (with free!).
- * @return The new SeekableAudioStream (or 0 on failure).
- */
-SeekableAudioStream *makeRawStream(const uint8 *buffer, uint32 size,
-								   int rate, uint8 flags,
-								   DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES);
-
-/**
- * Creates an audio stream, which plays from the given stream.
- *
- * @param stream Stream object to play from.
- * @param rate   Rate of the sound data.
- * @param flags  Audio flags combination.
- * @see RawFlags
- * @param disposeAfterUse Whether to delete the stream after use.
- * @return The new SeekableAudioStream (or 0 on failure).
- */
-SeekableAudioStream *makeRawStream(Common::SeekableReadStream *stream,
-								   int rate, uint8 flags,
-								   DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES);
-
-/**
- * Creates an audio stream, which plays from the given stream.
- *
- * @param stream Stream object to play from.
- * @param blockList List of blocks to play.
- * @see RawDiskStreamAudioBlock
- * @see RawStreamBlockList
- * @param rate Rate of the sound data.
- * @param flags Audio flags combination.
- * @see RawFlags
- * @param disposeAfterUse Whether to delete the stream after use.
- * @return The new SeekableAudioStream (or 0 on failure).
- */
-
-SeekableAudioStream *makeRawStream(Common::SeekableReadStream *stream,
-								   const RawStreamBlockList &blockList,
-								   int rate,
-								   uint8 flags,
-								   DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES);
-
-
-/**
- * NOTE:
- * This API is considered deprecated.
- *
- * Creates a audio stream, which plays from given stream.
- *
- * @param stream Stream to play from
- * @param block Pointer to an RawStreamBlock array
- * @see RawStreamBlock
- * @param numBlocks Number of blocks.
- * @param rate The rate
- * @param flags Flags combination.
- * @see RawFlags
- * @param disposeStream Whether the "stream" object should be destroyed after playback.
- * @return The new SeekableAudioStream (or 0 on failure).
- */
-SeekableAudioStream *makeRawDiskStream_OLD(Common::SeekableReadStream *stream,
-		RawStreamBlock *block, int numBlocks,
-		int rate, uint8 flags,
-		DisposeAfterUse::Flag disposeStream);
-
-
-} // End of namespace Audio
-
-#endif
diff --git a/engines/ultima/nuvie/sound/decoder/wave/stdiostream.cpp b/engines/ultima/nuvie/sound/decoder/wave/stdiostream.cpp
deleted file mode 100644
index 63b70343cd..0000000000
--- a/engines/ultima/nuvie/sound/decoder/wave/stdiostream.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/fs/stdiostream.cpp $
- * $Id: stdiostream.cpp 53961 2010-10-30 21:27:42Z fingolfin $
- *
- */
-//#include <assert.h>
-#include "decoder/wave/stdiostream.h"
-
-StdioStream::StdioStream(NuvieIOFileRead *handle, DisposeAfterUse::Flag disposeMemory) : _handle(handle), _disposeMemory(disposeMemory) {
-	assert(handle);
-}
-
-StdioStream::~StdioStream() {
-	_handle->close();
-	if (_disposeMemory == DisposeAfterUse::YES)
-		delete _handle;
-}
-
-bool StdioStream::err() const {
-	return false; //FIXME what should we return here?
-}
-
-void StdioStream::clearErr() {
-	//clearerr((FILE *)_handle);
-}
-
-bool StdioStream::eos() const {
-	return _handle->is_end();
-}
-
-sint32 StdioStream::pos() const {
-	return _handle->position();
-}
-
-sint32 StdioStream::size() const {
-	return _handle->get_size();
-}
-
-bool StdioStream::seek(sint32 offs, int whence) {
-
-	if (whence == SEEK_SET) {
-		_handle->seek(offs);
-	} else if (whence == SEEK_CUR) {
-		uint32 pos = _handle->position();
-		_handle->seek(pos + offs);
-	}
-	return true;
-}
-
-uint32 StdioStream::read(void *ptr, uint32 len) {
-	return _handle->readToBuf((unsigned char *)ptr, len);
-}
-
-uint32 StdioStream::write(const void *ptr, uint32 len) {
-	return false;
-}
-
-bool StdioStream::flush() {
-	return true;
-}
-
-StdioStream *StdioStream::makeFromPath(const Std::string &path) {
-	NuvieIOFileRead *niofr = new NuvieIOFileRead();
-
-	if (niofr == NULL || niofr->open(path) == false)
-		return NULL;
-
-	return new StdioStream(niofr, DisposeAfterUse::YES);
-}
diff --git a/engines/ultima/nuvie/sound/decoder/wave/stdiostream.h b/engines/ultima/nuvie/sound/decoder/wave/stdiostream.h
deleted file mode 100644
index 1a6a784a25..0000000000
--- a/engines/ultima/nuvie/sound/decoder/wave/stdiostream.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/fs/stdiostream.h $
- * $Id: stdiostream.h 44276 2009-09-23 16:11:23Z joostp $
- *
- */
-
-#ifndef STDIOSTREAM_H
-#define STDIOSTREAM_H
-
-#include "ultima/shared/std/string.h"
-
-#include "ultima/nuvie/core/nuvie_defs.h"
-#include "ultima/nuvie/files/nuvie_io_file.h"
-#include "ultima/nuvie/sound/mixer/types.h"
-#include "decoder/wave/stream.h"
-
-class StdioStream : public Common::SeekableReadStream {
-protected:
-	/** File handle to the actual file. */
-	NuvieIOFileRead *_handle;
-	DisposeAfterUse::Flag _disposeMemory;
-
-public:
-	/**
-	 * Given a path, invokes NuvieIOFileRead class on that path and wrap the result in a
-	 * StdioStream instance.
-	 */
-	static StdioStream *makeFromPath(const Std::string &path);
-
-	StdioStream(NuvieIOFileRead *handle, DisposeAfterUse::Flag disposeMemory = DisposeAfterUse::NO);
-	virtual ~StdioStream();
-
-	virtual bool err() const;
-	virtual void clearErr();
-	virtual bool eos() const;
-
-	virtual uint32 write(const void *dataPtr, uint32 dataSize);
-	virtual bool flush();
-
-	virtual sint32 pos() const;
-	virtual sint32 size() const;
-	virtual bool seek(sint32 offs, int whence = SEEK_SET);
-	virtual uint32 read(void *dataPtr, uint32 dataSize);
-};
-
-#endif
diff --git a/engines/ultima/nuvie/sound/decoder/wave/stream.cpp b/engines/ultima/nuvie/sound/decoder/wave/stream.cpp
deleted file mode 100644
index 85e332701e..0000000000
--- a/engines/ultima/nuvie/sound/decoder/wave/stream.cpp
+++ /dev/null
@@ -1,512 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/common/stream.cpp $
- * $Id: stream.cpp 54436 2010-11-23 22:25:53Z fingolfin $
- *
- */
-//#include <string.h>
-//#include <assert.h>
-#include "ultima/nuvie/core/nuvie_defs.h"
-#include "ultima/nuvie/sound/mixer/types.h"
-#include "decoder/wave/stream.h"
-#include "decoder/wave/memstream.h"
-//#include "common/substream.h"
-//#include "common/bufferedstream.h"
-//#include "common/str.h"
-//#include "common/util.h"
-
-namespace Common {
-/*
-void WriteStream::writeString(const String &str) {
-	write(str.c_str(), str.size());
-}
-*/
-SeekableReadStream *ReadStream::readStream(uint32 dataSize) {
-	void *buf = malloc(dataSize);
-	dataSize = read(buf, dataSize);
-	assert(dataSize > 0);
-	return new MemoryReadStream((uint8 *)buf, dataSize, DisposeAfterUse::YES);
-}
-
-
-uint32 MemoryReadStream::read(void *dataPtr, uint32 dataSize) {
-	// Read at most as many bytes as are still available...
-	if (dataSize > _size - _pos) {
-		dataSize = _size - _pos;
-		_eos = true;
-	}
-	memcpy(dataPtr, _ptr, dataSize);
-
-	_ptr += dataSize;
-	_pos += dataSize;
-
-	return dataSize;
-}
-
-bool MemoryReadStream::seek(sint32 offs, int whence) {
-	// Pre-Condition
-	assert(_pos <= _size);
-	switch (whence) {
-	case SEEK_END:
-		// SEEK_END works just like SEEK_SET, only 'reversed',
-		// i.e. from the end.
-		offs = _size + offs;
-	// Fall through
-	case SEEK_SET:
-		_ptr = _ptrOrig + offs;
-		_pos = offs;
-		break;
-
-	case SEEK_CUR:
-		_ptr += offs;
-		_pos += offs;
-		break;
-	}
-	// Post-Condition
-	assert(_pos <= _size);
-
-	// Reset end-of-stream flag on a successful seek
-	_eos = false;
-	return true;    // FIXME: STREAM REWRITE
-}
-/*
-bool MemoryWriteStreamDynamic::seek(int32 offs, int whence) {
-	// Pre-Condition
-	assert(_pos <= _size);
-	switch (whence) {
-	case SEEK_END:
-		// SEEK_END works just like SEEK_SET, only 'reversed',
-		// i.e. from the end.
-		offs = _size + offs;
-		// Fall through
-	case SEEK_SET:
-		_ptr = _data + offs;
-		_pos = offs;
-		break;
-
-	case SEEK_CUR:
-		_ptr += offs;
-		_pos += offs;
-		break;
-	}
-	// Post-Condition
-	assert(_pos <= _size);
-
-	return true;    // FIXME: STREAM REWRITE
-}
-*/
-#pragma mark -
-
-enum {
-	LF = 0x0A,
-	CR = 0x0D
-};
-
-char *SeekableReadStream::readLine(char *buf, size_t bufSize) {
-	assert(buf != 0 && bufSize > 1);
-	char *p = buf;
-	size_t len = 0;
-	char c = 0;
-
-	// If end-of-file occurs before any characters are read, return NULL
-	// and the buffer contents remain unchanged.
-	if (eos() || err()) {
-		return 0;
-	}
-
-	// Loop as long as there is still free space in the buffer,
-	// and the line has not ended
-	while (len + 1 < bufSize && c != LF) {
-		c = readByte();
-
-		if (eos()) {
-			// If end-of-file occurs before any characters are read, return
-			// NULL and the buffer contents remain unchanged.
-			if (len == 0)
-				return 0;
-
-			break;
-		}
-
-		// If an error occurs, return NULL and the buffer contents
-		// are indeterminate.
-		if (err())
-			return 0;
-
-		// Check for CR or CR/LF
-		// * DOS and Windows use CRLF line breaks
-		// * Unix and OS X use LF line breaks
-		// * Macintosh before OS X used CR line breaks
-		if (c == CR) {
-			// Look at the next char -- is it LF? If not, seek back
-			c = readByte();
-
-			if (err()) {
-				return 0; // error: the buffer contents are indeterminate
-			}
-			if (eos()) {
-				// The CR was the last character in the file.
-				// Reset the eos() flag since we successfully finished a line
-				clearErr();
-			} else if (c != LF) {
-				seek(-1, SEEK_CUR);
-			}
-
-			// Treat CR & CR/LF as plain LF
-			c = LF;
-		}
-
-		*p++ = c;
-		len++;
-	}
-
-	// We always terminate the buffer if no error occurred
-	*p = 0;
-	return buf;
-}
-
-Std::string SeekableReadStream::readLine() {
-	// Read a line
-	Std::string line;
-
-	while (!line.length() || line[line.length() - 1] != '\n') {
-		char buf[256];
-		if (!readLine(buf, 256))
-			break;
-		line += buf;
-	}
-
-	if (line.length() && line[line.length() - 1] == '\n')
-		line = line.substr(0, line.length() - 1);
-
-	return line;
-}
-
-
-/*
-uint32 SubReadStream::read(void *dataPtr, uint32 dataSize) {
-	if (dataSize > _end - _pos) {
-		dataSize = _end - _pos;
-		_eos = true;
-	}
-
-	dataSize = _parentStream->read(dataPtr, dataSize);
-	_eos |= _parentStream->eos();
-	_pos += dataSize;
-
-	return dataSize;
-}
-
-SeekableSubReadStream::SeekableSubReadStream(SeekableReadStream *parentStream, uint32 begin, uint32 end, DisposeAfterUse::Flag disposeParentStream)
-	: SubReadStream(parentStream, end, disposeParentStream),
-	_parentStream(parentStream),
-	_begin(begin) {
-	assert(_begin <= _end);
-	_pos = _begin;
-	_parentStream->seek(_pos);
-	_eos = false;
-}
-
-bool SeekableSubReadStream::seek(int32 offset, int whence) {
-	assert(_pos >= _begin);
-	assert(_pos <= _end);
-
-	switch (whence) {
-	case SEEK_END:
-		offset = size() + offset;
-		// fallthrough
-	case SEEK_SET:
-		_pos = _begin + offset;
-		break;
-	case SEEK_CUR:
-		_pos += offset;
-	}
-
-	assert(_pos >= _begin);
-	assert(_pos <= _end);
-
-	bool ret = _parentStream->seek(_pos);
-	if (ret) _eos = false; // reset eos on successful seek
-
-	return ret;
-}
-
-*/
-#pragma mark -
-
-namespace {
-
-/**
- * Wrapper class which adds buffering to any given ReadStream.
- * Users can specify how big the buffer should be, and whether the
- * wrapped stream should be disposed when the wrapper is disposed.
- */
-class BufferedReadStream : virtual public ReadStream {
-protected:
-	ReadStream *_parentStream;
-	DisposeAfterUse::Flag _disposeParentStream;
-	uint8 *_buf;
-	uint32 _pos;
-	bool _eos; // end of stream
-	uint32 _bufSize;
-	uint32 _realBufSize;
-
-public:
-	BufferedReadStream(ReadStream *parentStream, uint32 bufSize, DisposeAfterUse::Flag disposeParentStream);
-	virtual ~BufferedReadStream();
-
-	virtual bool eos() const {
-		return _eos;
-	}
-	virtual bool err() const {
-		return _parentStream->err();
-	}
-	virtual void clearErr() {
-		_eos = false;
-		_parentStream->clearErr();
-	}
-
-	virtual uint32 read(void *dataPtr, uint32 dataSize);
-};
-
-BufferedReadStream::BufferedReadStream(ReadStream *parentStream, uint32 bufSize, DisposeAfterUse::Flag disposeParentStream)
-	: _parentStream(parentStream),
-	  _disposeParentStream(disposeParentStream),
-	  _pos(0),
-	  _eos(false),
-	  _bufSize(0),
-	  _realBufSize(bufSize) {
-
-	assert(parentStream);
-	_buf = new uint8[bufSize];
-	assert(_buf);
-}
-
-BufferedReadStream::~BufferedReadStream() {
-	if (_disposeParentStream)
-		delete _parentStream;
-	delete[] _buf;
-}
-
-uint32 BufferedReadStream::read(void *dataPtr, uint32 dataSize) {
-	uint32 alreadyRead = 0;
-	const uint32 bufBytesLeft = _bufSize - _pos;
-
-	// Check whether the data left in the buffer suffices....
-	if (dataSize > bufBytesLeft) {
-		// Nope, we need to read more data
-
-		// First, flush the buffer, if it is non-empty
-		if (0 < bufBytesLeft) {
-			memcpy(dataPtr, _buf + _pos, bufBytesLeft);
-			_pos = _bufSize;
-			alreadyRead += bufBytesLeft;
-			dataPtr = (uint8 *)dataPtr + bufBytesLeft;
-			dataSize -= bufBytesLeft;
-		}
-
-		// At this point the buffer is empty. Now if the read request
-		// exceeds the buffer size, just satisfy it directly.
-		if (dataSize > _realBufSize) {
-			uint32 n = _parentStream->read(dataPtr, dataSize);
-			if (_parentStream->eos())
-				_eos = true;
-			return alreadyRead + n;
-		}
-
-		// Refill the buffer.
-		// If we didn't read as many bytes as requested, the reason
-		// is EOF or an error. In that case we truncate the buffer
-		// size, as well as the number of  bytes we are going to
-		// return to the caller.
-		_bufSize = _parentStream->read(_buf, _realBufSize);
-		_pos = 0;
-		if (_bufSize < dataSize) {
-			// we didn't get enough data from parent
-			if (_parentStream->eos())
-				_eos = true;
-			dataSize = _bufSize;
-		}
-	}
-
-	if (dataSize) {
-		// Satisfy the request from the buffer
-		memcpy(dataPtr, _buf + _pos, dataSize);
-		_pos += dataSize;
-	}
-	return alreadyRead + dataSize;
-}
-
-}   // End of nameless namespace
-
-
-ReadStream *wrapBufferedReadStream(ReadStream *parentStream, uint32 bufSize, DisposeAfterUse::Flag disposeParentStream) {
-	if (parentStream)
-		return new BufferedReadStream(parentStream, bufSize, disposeParentStream);
-	return 0;
-}
-
-#pragma mark -
-
-namespace {
-
-/**
- * Wrapper class which adds buffering to any given SeekableReadStream.
- * @see BufferedReadStream
- */
-class BufferedSeekableReadStream : public BufferedReadStream, public SeekableReadStream {
-protected:
-	SeekableReadStream *_parentStream;
-public:
-	BufferedSeekableReadStream(SeekableReadStream *parentStream, uint32 bufSize, DisposeAfterUse::Flag disposeParentStream = DisposeAfterUse::NO);
-
-	virtual sint32 pos() const {
-		return _parentStream->pos() - (_bufSize - _pos);
-	}
-	virtual sint32 size() const {
-		return _parentStream->size();
-	}
-
-	virtual bool seek(sint32 offset, int whence = SEEK_SET);
-};
-
-BufferedSeekableReadStream::BufferedSeekableReadStream(SeekableReadStream *parentStream, uint32 bufSize, DisposeAfterUse::Flag disposeParentStream)
-	: BufferedReadStream(parentStream, bufSize, disposeParentStream),
-	  _parentStream(parentStream) {
-}
-
-bool BufferedSeekableReadStream::seek(sint32 offset, int whence) {
-	// If it is a "local" seek, we may get away with "seeking" around
-	// in the buffer only.
-	// Note: We could try to handle SEEK_END and SEEK_SET, too, but
-	// since they are rarely used, it seems not worth the effort.
-	_eos = false;   // seeking always cancels EOS
-
-	if (whence == SEEK_CUR && (int)_pos + offset >= 0 && _pos + offset <= _bufSize) {
-		_pos += offset;
-
-		// Note: we do not need to reset parent's eos flag here. It is
-		// sufficient that it is reset when actually seeking in the parent.
-	} else {
-		// Seek was not local enough, so we reset the buffer and
-		// just seek normally in the parent stream.
-		if (whence == SEEK_CUR)
-			offset -= (_bufSize - _pos);
-		_pos = _bufSize;
-		_parentStream->seek(offset, whence);
-	}
-
-	return true;
-}
-
-}   // End of nameless namespace
-
-SeekableReadStream *wrapBufferedSeekableReadStream(SeekableReadStream *parentStream, uint32 bufSize, DisposeAfterUse::Flag disposeParentStream) {
-	if (parentStream)
-		return new BufferedSeekableReadStream(parentStream, bufSize, disposeParentStream);
-	return 0;
-}
-
-#pragma mark -
-
-namespace {
-
-/**
- * Wrapper class which adds buffering to any WriteStream.
- */
-class BufferedWriteStream : public WriteStream {
-protected:
-	WriteStream *_parentStream;
-	uint8 *_buf;
-	uint32 _pos;
-	const uint32 _bufSize;
-
-	/**
-	 * Write out the data in the buffer.
-	 *
-	 * @note This method is identical to flush() (which actually is
-	 * implemented by calling this method), except that it is not
-	 * virtual, hence there is less overhead calling it.
-	 */
-	bool flushBuffer() {
-		const uint32 bytesToWrite = _pos;
-
-		if (bytesToWrite) {
-			_pos = 0;
-			if (_parentStream->write(_buf, bytesToWrite) != bytesToWrite)
-				return false;
-		}
-		return true;
-	}
-
-public:
-	BufferedWriteStream(WriteStream *parentStream, uint32 bufSize)
-		: _parentStream(parentStream),
-		  _pos(0),
-		  _bufSize(bufSize) {
-
-		assert(parentStream);
-		_buf = new uint8[bufSize];
-		assert(_buf);
-	}
-
-	virtual ~BufferedWriteStream() {
-		const bool flushResult = flushBuffer();
-		assert(flushResult);
-
-		delete _parentStream;
-
-		delete[] _buf;
-	}
-
-	virtual uint32 write(const void *dataPtr, uint32 dataSize) {
-		// check if we have enough space for writing to the buffer
-		if (_bufSize - _pos >= dataSize) {
-			memcpy(_buf + _pos, dataPtr, dataSize);
-			_pos += dataSize;
-		} else if (_bufSize >= dataSize) {  // check if we can flush the buffer and load the data
-			const bool flushResult = flushBuffer();
-			assert(flushResult);
-			memcpy(_buf, dataPtr, dataSize);
-			_pos += dataSize;
-		} else  {   // too big for our buffer
-			const bool flushResult = flushBuffer();
-			assert(flushResult);
-			return _parentStream->write(dataPtr, dataSize);
-		}
-		return dataSize;
-	}
-
-	virtual bool flush() {
-		return flushBuffer();
-	}
-
-};
-
-}   // End of nameless namespace
-
-WriteStream *wrapBufferedWriteStream(WriteStream *parentStream, uint32 bufSize) {
-	if (parentStream)
-		return new BufferedWriteStream(parentStream, bufSize);
-	return 0;
-}
-
-}   // End of namespace Common
diff --git a/engines/ultima/nuvie/sound/decoder/wave/stream.h b/engines/ultima/nuvie/sound/decoder/wave/stream.h
deleted file mode 100644
index 2d288f3ed3..0000000000
--- a/engines/ultima/nuvie/sound/decoder/wave/stream.h
+++ /dev/null
@@ -1,448 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/common/stream.h $
- * $Id: stream.h 54500 2010-11-26 15:06:25Z mthreepwood $
- *
- */
-
-#ifndef COMMON_STREAM_H
-#define COMMON_STREAM_H
-
-//#include <stdio.h>
-#include "ultima/shared/std/string.h"
-#include "ultima/nuvie/sound/mixer/types.h"
-#include "decoder/wave/endian.h"
-
-namespace Common {
-
-
-class SeekableReadStream;
-
-/**
- * Virtual base class for both ReadStream and WriteStream.
- */
-class Stream {
-public:
-	virtual ~Stream() {}
-
-	/**
-	 * Returns true if an I/O failure occurred.
-	 * This flag is never cleared automatically. In order to clear it,
-	 * client code has to call clearErr() explicitly.
-	 */
-	virtual bool err() const {
-		return false;
-	}
-
-	/**
-	 * Reset the I/O error status as returned by err().
-	 * For a ReadStream, also reset the end-of-stream status returned by eos().
-	 */
-	virtual void clearErr() {}
-};
-
-/**
- * Generic interface for a writable data stream.
- */
-class WriteStream : virtual public Stream {
-public:
-	/**
-	 * Write data into the stream. Subclasses must implement this
-	 * method; all other write methods are implemented using it.
-	 *
-	 * @param dataPtr   pointer to the data to be written
-	 * @param dataSize  number of bytes to be written
-	 * @return the number of bytes which were actually written.
-	 */
-	virtual uint32 write(const void *dataPtr, uint32 dataSize) = 0;
-
-	/**
-	 * Commit any buffered data to the underlying channel or
-	 * storage medium; unbuffered streams can use the default
-	 * implementation.
-	 *
-	 * @return true on success, false in case of a failure
-	 */
-	virtual bool flush() {
-		return true;
-	}
-
-	/**
-	 * Finalize and close this stream. To be called right before this
-	 * stream instance is deleted. The goal here is to enable calling
-	 * code to detect and handle I/O errors which might occur when
-	 * closing (and this flushing, if buffered) the stream.
-	 *
-	 * After this method has been called, no further writes may be
-	 * performed on the stream. Calling err() is allowed.
-	 *
-	 * By default, this just flushes the stream.
-	 */
-	virtual void finalize() {
-		flush();
-	}
-
-
-	// The remaining methods all have default implementations; subclasses
-	// need not (and should not) overload them.
-
-	void writeByte(uint8 value) {
-		write(&value, 1);
-	}
-
-	void writeSByte(sint8 value) {
-		write(&value, 1);
-	}
-
-	void writeUint16LE(uint16 value) {
-		value = TO_LE_16(value);
-		write(&value, 2);
-	}
-
-	void writeUint32LE(uint32 value) {
-		value = TO_LE_32(value);
-		write(&value, 4);
-	}
-
-	void writeUint16BE(uint16 value) {
-		value = TO_BE_16(value);
-		write(&value, 2);
-	}
-
-	void writeUint32BE(uint32 value) {
-		value = TO_BE_32(value);
-		write(&value, 4);
-	}
-
-	FORCEINLINE void writeSint16LE(sint16 value) {
-		writeUint16LE((uint16)value);
-	}
-
-	FORCEINLINE void writeSint32LE(sint32 value) {
-		writeUint32LE((uint32)value);
-	}
-
-	FORCEINLINE void writeSint16BE(sint16 value) {
-		writeUint16BE((uint16)value);
-	}
-
-	FORCEINLINE void writeSint32BE(sint32 value) {
-		writeUint32BE((uint32)value);
-	}
-
-	/**
-	 * Write the given string to the stream.
-	 * This writes str.size() characters, but no terminating zero byte.
-	 */
-	void writeString(const Std::string &str);
-};
-
-/**
- * Generic interface for a readable data stream.
- */
-class ReadStream : virtual public Stream {
-public:
-	/**
-	 * Returns true if a read failed because the stream end has been reached.
-	 * This flag is cleared by clearErr().
-	 * For a SeekableReadStream, it is also cleared by a successful seek.
-	 */
-	virtual bool eos() const = 0;
-
-	/**
-	 * Read data from the stream. Subclasses must implement this
-	 * method; all other read methods are implemented using it.
-	 *
-	 * @param dataPtr   pointer to a buffer into which the data is read
-	 * @param dataSize  number of bytes to be read
-	 * @return the number of bytes which were actually read.
-	 */
-	virtual uint32 read(void *dataPtr, uint32 dataSize) = 0;
-
-
-	// The remaining methods all have default implementations; subclasses
-	// in general should not overload them.
-
-	/**
-	 * Read an unsigned byte from the stream and return it.
-	 * Performs no error checking. The return value is undefined
-	 * if a read error occurred (for which client code can check by
-	 * calling err() and eos() ).
-	 */
-	uint8 readByte() {
-		uint8 b = 0; // FIXME: remove initialisation
-		read(&b, 1);
-		return b;
-	}
-
-	/**
-	 * Read a signed byte from the stream and return it.
-	 * Performs no error checking. The return value is undefined
-	 * if a read error occurred (for which client code can check by
-	 * calling err() and eos() ).
-	 */
-	FORCEINLINE sint8 readSByte() {
-		return (sint8)readByte();
-	}
-
-	/**
-	 * Read an unsigned 16-bit word stored in little endian (LSB first) order
-	 * from the stream and return it.
-	 * Performs no error checking. The return value is undefined
-	 * if a read error occurred (for which client code can check by
-	 * calling err() and eos() ).
-	 */
-	uint16 readUint16LE() {
-		uint16 val;
-		read(&val, 2);
-		return FROM_LE_16(val);
-	}
-
-	/**
-	 * Read an unsigned 32-bit word stored in little endian (LSB first) order
-	 * from the stream and return it.
-	 * Performs no error checking. The return value is undefined
-	 * if a read error occurred (for which client code can check by
-	 * calling err() and eos() ).
-	 */
-	uint32 readUint32LE() {
-		uint32 val;
-		read(&val, 4);
-		return FROM_LE_32(val);
-	}
-
-	/**
-	 * Read an unsigned 16-bit word stored in big endian (MSB first) order
-	 * from the stream and return it.
-	 * Performs no error checking. The return value is undefined
-	 * if a read error occurred (for which client code can check by
-	 * calling err() and eos() ).
-	 */
-	uint16 readUint16BE() {
-		uint16 val;
-		read(&val, 2);
-		return FROM_BE_16(val);
-	}
-
-	/**
-	 * Read an unsigned 32-bit word stored in big endian (MSB first) order
-	 * from the stream and return it.
-	 * Performs no error checking. The return value is undefined
-	 * if a read error occurred (for which client code can check by
-	 * calling err() and eos() ).
-	 */
-	uint32 readUint32BE() {
-		uint32 val;
-		read(&val, 4);
-		return FROM_BE_32(val);
-	}
-
-	/**
-	 * Read a signed 16-bit word stored in little endian (LSB first) order
-	 * from the stream and return it.
-	 * Performs no error checking. The return value is undefined
-	 * if a read error occurred (for which client code can check by
-	 * calling err() and eos() ).
-	 */
-	FORCEINLINE sint16 readSint16LE() {
-		return (sint16)readUint16LE();
-	}
-
-	/**
-	 * Read a signed 32-bit word stored in little endian (LSB first) order
-	 * from the stream and return it.
-	 * Performs no error checking. The return value is undefined
-	 * if a read error occurred (for which client code can check by
-	 * calling err() and eos() ).
-	 */
-	FORCEINLINE sint32 readSint32LE() {
-		return (sint32)readUint32LE();
-	}
-
-	/**
-	 * Read a signed 16-bit word stored in big endian (MSB first) order
-	 * from the stream and return it.
-	 * Performs no error checking. The return value is undefined
-	 * if a read error occurred (for which client code can check by
-	 * calling err() and eos() ).
-	 */
-	FORCEINLINE sint16 readSint16BE() {
-		return (sint16)readUint16BE();
-	}
-
-	/**
-	 * Read a signed 32-bit word stored in big endian (MSB first) order
-	 * from the stream and return it.
-	 * Performs no error checking. The return value is undefined
-	 * if a read error occurred (for which client code can check by
-	 * calling err() and eos() ).
-	 */
-	FORCEINLINE sint32 readSint32BE() {
-		return (sint32)readUint32BE();
-	}
-
-	/**
-	 * Read the specified amount of data into a malloc'ed buffer
-	 * which then is wrapped into a MemoryReadStream.
-	 * The returned stream might contain less data than requested,
-	 * if reading more failed, because of an I/O error or because
-	 * the end of the stream was reached. Which can be determined by
-	 * calling err() and eos().
-	 */
-	SeekableReadStream *readStream(uint32 dataSize);
-
-};
-
-
-/**
- * Interface for a seekable & readable data stream.
- *
- * @todo Get rid of SEEK_SET, SEEK_CUR, or SEEK_END, use our own constants
- */
-class SeekableReadStream : virtual public ReadStream {
-public:
-
-	/**
-	 * Obtains the current value of the stream position indicator of the
-	 * stream.
-	 *
-	 * @return the current position indicator, or -1 if an error occurred.
-	 */
-	virtual sint32 pos() const = 0;
-
-	/**
-	 * Obtains the total size of the stream, measured in bytes.
-	 * If this value is unknown or can not be computed, -1 is returned.
-	 *
-	 * @return the size of the stream, or -1 if an error occurred
-	 */
-	virtual sint32 size() const = 0;
-
-	/**
-	 * Sets the stream position indicator for the stream. The new position,
-	 * measured in bytes, is obtained by adding offset bytes to the position
-	 * specified by whence. If whence is set to SEEK_SET, SEEK_CUR, or
-	 * SEEK_END, the offset is relative to the start of the file, the current
-	 * position indicator, or end-of-file, respectively. A successful call
-	 * to the seek() method clears the end-of-file indicator for the stream.
-	 *
-	 * @param offset    the relative offset in bytes
-	 * @param whence    the seek reference: SEEK_SET, SEEK_CUR, or SEEK_END
-	 * @return true on success, false in case of a failure
-	 */
-	virtual bool seek(sint32 offset, int whence = SEEK_SET) = 0;
-
-	/**
-	 * TODO: Get rid of this??? Or keep it and document it
-	 * @return true on success, false in case of a failure
-	 */
-	virtual bool skip(uint32 offset) {
-		return seek(offset, SEEK_CUR);
-	}
-
-	/**
-	 * Reads at most one less than the number of characters specified
-	 * by bufSize from the and stores them in the string buf. Reading
-	 * stops when the end of a line is reached (CR, CR/LF or LF), and
-	 * at end-of-file or error. The newline, if any, is retained (CR
-	 * and CR/LF are translated to LF = 0xA = '\n'). If any characters
-	 * are read and there is no error, a `\0' character is appended
-	 * to end the string.
-	 *
-	 * Upon successful completion, return a pointer to the string. If
-	 * end-of-file occurs before any characters are read, returns NULL
-	 * and the buffer contents remain unchanged.  If an error occurs,
-	 * returns NULL and the buffer contents are indeterminate.
-	 * This method does not distinguish between end-of-file and error;
-	 * callers must use err() or eos() to determine which occurred.
-	 *
-	 * @note This methods is closely modeled after the standard fgets()
-	 *       function from stdio.h.
-	 *
-	 * @param buf   the buffer to store into
-	 * @param bufSize   the size of the buffer
-	 * @return a pointer to the read string, or NULL if an error occurred
-	 */
-	virtual char *readLine(char *s, size_t bufSize);
-
-
-	/**
-	 * Reads a full line and returns it as a Common::String. Reading
-	 * stops when the end of a line is reached (CR, CR/LF or LF), and
-	 * at end-of-file or error.
-	 *
-	 * Upon successful completion, return a string with the content
-	 * of the line, *without* the end of a line marker. This method
-	 * does not indicate whether an error occurred. Callers must use
-	 * err() or eos() to determine whether an exception occurred.
-	 */
-	virtual Std::string readLine();
-};
-
-/**
- * This is a ReadStream mixin subclass which adds non-endian read
- * methods whose endianness is set during the stream creation.
- */
-class ReadStreamEndian : virtual public ReadStream {
-private:
-	const bool _bigEndian;
-
-public:
-	ReadStreamEndian(bool bigEndian) : _bigEndian(bigEndian) {}
-
-	bool isBE() const {
-		return _bigEndian;
-	}
-
-	uint16 readUint16() {
-		uint16 val;
-		read(&val, 2);
-		return (_bigEndian) ? TO_BE_16(val) : TO_LE_16(val);
-	}
-
-	uint32 readUint32() {
-		uint32 val;
-		read(&val, 4);
-		return (_bigEndian) ? TO_BE_32(val) : TO_LE_32(val);
-	}
-
-	FORCEINLINE sint16 readSint16() {
-		return (sint16)readUint16();
-	}
-
-	FORCEINLINE sint32 readSint32() {
-		return (sint32)readUint32();
-	}
-};
-
-/**
- * This is a SeekableReadStream subclass which adds non-endian read
- * methods whose endianness is set during the stream creation.
- */
-class SeekableReadStreamEndian : public SeekableReadStream, public ReadStreamEndian {
-public:
-	SeekableReadStreamEndian(bool bigEndian) : ReadStreamEndian(bigEndian) {}
-};
-
-
-}   // End of namespace Common
-
-#endif
diff --git a/engines/ultima/nuvie/sound/decoder/wave/wave.cpp b/engines/ultima/nuvie/sound/decoder/wave/wave.cpp
deleted file mode 100644
index e99bb59479..0000000000
--- a/engines/ultima/nuvie/sound/decoder/wave/wave.cpp
+++ /dev/null
@@ -1,196 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/sound/decoders/wave.cpp $
- * $Id: wave.cpp 54022 2010-11-01 20:41:03Z fingolfin $
- *
- */
-
-//#include <assert.h>
-//#include <string.h>
-//#include "common/debug.h"
-//#include "common/util.h"
-#include "decoder/wave/stream.h"
-
-#include "audiostream.h"
-#include "audio/mixer.h"
-#include "decoder/wave/wave.h"
-#include "decoder/wave/adpcm.h"
-#include "decoder/wave/raw.h"
-
-namespace Audio {
-
-bool loadWAVFromStream(Common::SeekableReadStream &stream, int &size, int &rate, uint8 &flags, uint16 *wavType, int *blockAlign_) {
-	const sint32 initialPos = stream.pos();
-	uint8 buf[4 + 1];
-
-	buf[4] = 0;
-
-	stream.read(buf, 4);
-	if (memcmp(buf, "RIFF", 4) != 0) {
-		DEBUG(0, LEVEL_WARNING, "getWavInfo: No 'RIFF' header");
-		return false;
-	}
-
-	sint32 wavLength = stream.readUint32LE();
-
-	stream.read(buf, 4);
-	if (memcmp(buf, "WAVE", 4) != 0) {
-		DEBUG(0, LEVEL_WARNING, "getWavInfo: No 'WAVE' header");
-		return false;
-	}
-
-	stream.read(buf, 4);
-	if (memcmp(buf, "fmt ", 4) != 0) {
-		DEBUG(0, LEVEL_WARNING, "getWavInfo: No 'fmt' header");
-		return false;
-	}
-
-	uint32 fmtLength = stream.readUint32LE();
-	if (fmtLength < 16) {
-		// A valid fmt chunk always contains at least 16 bytes
-		DEBUG(0, LEVEL_WARNING, "getWavInfo: 'fmt' header is too short");
-		return false;
-	}
-
-	// Next comes the "type" field of the fmt header. Some typical
-	// values for it:
-	// 1  -> uncompressed PCM
-	// 17 -> IMA ADPCM compressed WAVE
-	// See <http://www.saettler.com/RIFFNEW/RIFFNEW.htm> for a more complete
-	// list of common WAVE compression formats...
-	uint16 type = stream.readUint16LE();    // == 1 for PCM data
-	uint16 numChannels = stream.readUint16LE(); // 1 for mono, 2 for stereo
-	uint32 samplesPerSec = stream.readUint32LE();   // in Hz
-	uint32 avgBytesPerSec = stream.readUint32LE();  // == SampleRate * NumChannels * BitsPerSample/8
-
-	uint16 blockAlign = stream.readUint16LE();  // == NumChannels * BitsPerSample/8
-	uint16 bitsPerSample = stream.readUint16LE();   // 8, 16 ...
-	// 8 bit data is unsigned, 16 bit data signed
-
-
-	if (wavType != 0)
-		*wavType = type;
-
-	if (blockAlign_ != 0)
-		*blockAlign_ = blockAlign;
-#if 0
-	DEBUG(0, LEVEL_DEBUGGING, "WAVE information:");
-	DEBUG(0, LEVEL_DEBUGGING, "  total size: %d", wavLength);
-	DEBUG(0, LEVEL_DEBUGGING , "  fmt size: %d", fmtLength);
-	DEBUG(0, LEVEL_DEBUGGING , "  type: %d", type);
-	DEBUG(0, LEVEL_DEBUGGING , "  numChannels: %d", numChannels);
-	DEBUG(0, LEVEL_DEBUGGING , "  samplesPerSec: %d", samplesPerSec);
-	DEBUG(0, LEVEL_DEBUGGING , "  avgBytesPerSec: %d", avgBytesPerSec);
-	DEBUG(0, LEVEL_DEBUGGING , "  blockAlign: %d", blockAlign);
-	DEBUG(0, LEVEL_DEBUGGING , "  bitsPerSample: %d", bitsPerSample);
-#endif
-
-	if (type != 1 && type != 2 && type != 17) {
-		DEBUG(0, LEVEL_WARNING, "getWavInfo: only PCM, MS ADPCM or IMA ADPCM data is supported (type %d)", type);
-		return false;
-	}
-
-	if (blockAlign != numChannels * bitsPerSample / 8 && type != 2) {
-		DEBUG(0, LEVEL_DEBUGGING , 0, "getWavInfo: blockAlign is invalid");
-	}
-
-	if (avgBytesPerSec != samplesPerSec * blockAlign && type != 2) {
-		DEBUG(0, LEVEL_DEBUGGING , 0, "getWavInfo: avgBytesPerSec is invalid");
-	}
-
-	// Prepare the return values.
-	rate = samplesPerSec;
-
-	flags = 0;
-	if (bitsPerSample == 8)     // 8 bit data is unsigned
-		flags |= Audio::FLAG_UNSIGNED;
-	else if (bitsPerSample == 16)   // 16 bit data is signed little endian
-		flags |= (Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN);
-	else if (bitsPerSample == 4 && (type == 2 || type == 17))
-		flags |= Audio::FLAG_16BITS;
-	else {
-		DEBUG(0, LEVEL_WARNING, "getWavInfo: unsupported bitsPerSample %d", bitsPerSample);
-		return false;
-	}
-
-	if (numChannels == 2)
-		flags |= Audio::FLAG_STEREO;
-	else if (numChannels != 1) {
-		DEBUG(0, LEVEL_WARNING, "getWavInfo: unsupported number of channels %d", numChannels);
-		return false;
-	}
-
-	// It's almost certainly a WAV file, but we still need to find its
-	// 'data' chunk.
-
-	// Skip over the rest of the fmt chunk.
-	int offset = fmtLength - 16;
-
-	do {
-		stream.seek(offset, SEEK_CUR);
-		if (stream.pos() >= initialPos + wavLength + 8) {
-			DEBUG(0, LEVEL_WARNING, "getWavInfo: Can't find 'data' chunk");
-			return false;
-		}
-		stream.read(buf, 4);
-		offset = stream.readUint32LE();
-
-#if 0
-		DEBUG(0, LEVEL_DEBUGGING , "  found a '%s' tag of size %d", buf, offset);
-#endif
-	} while (memcmp(buf, "data", 4) != 0);
-
-	// Stream now points at 'offset' bytes of sample data...
-	size = offset;
-
-	return true;
-}
-
-RewindableAudioStream *makeWAVStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse) {
-	int size, rate;
-	uint8 flags;
-	uint16 type;
-	int blockAlign;
-
-	if (!loadWAVFromStream(*stream, size, rate, flags, &type, &blockAlign)) {
-		if (disposeAfterUse == DisposeAfterUse::YES)
-			delete stream;
-		return 0;
-	}
-
-	if (type == 17) // MS IMA ADPCM
-		return makeADPCMStream(stream, disposeAfterUse, size, Audio::kADPCMMSIma, rate, (flags & Audio::FLAG_STEREO) ? 2 : 1, blockAlign);
-	else if (type == 2) // MS ADPCM
-		return makeADPCMStream(stream, disposeAfterUse, size, Audio::kADPCMMS, rate, (flags & Audio::FLAG_STEREO) ? 2 : 1, blockAlign);
-
-	// Raw PCM. Just read everything at once.
-	// TODO: More elegant would be to wrap the stream.
-	uint8 *data = (uint8 *)malloc(size);
-	assert(data);
-	stream->read(data, size);
-
-	if (disposeAfterUse == DisposeAfterUse::YES)
-		delete stream;
-
-	return makeRawStream(data, size, rate, flags);
-}
-
-} // End of namespace Audio
diff --git a/engines/ultima/nuvie/sound/decoder/wave/wave.h b/engines/ultima/nuvie/sound/decoder/wave/wave.h
deleted file mode 100644
index b70b1a168d..0000000000
--- a/engines/ultima/nuvie/sound/decoder/wave/wave.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/sound/decoders/wave.h $
- * $Id: wave.h 55381 2011-01-21 14:37:46Z mthreepwood $
- *
- */
-
-/**
- * @file
- * Sound decoder used in engines:
- *  - agos
- *  - gob
- *  - mohawk
- *  - saga
- *  - sci
- *  - scumm
- *  - sword1
- *  - sword2
- *  - tucker
- */
-
-#ifndef SOUND_WAVE_H
-#define SOUND_WAVE_H
-
-//#include "common/scummsys.h"
-#include "ultima/nuvie/core/nuvie_defs.h"
-#include "ultima/nuvie/sound/mixer/types.h"
-
-namespace Common {
-class SeekableReadStream;
-}
-
-namespace Audio {
-
-class RewindableAudioStream;
-
-/**
- * Try to load a WAVE from the given seekable stream. Returns true if
- * successful. In that case, the stream's seek position will be set to the
- * start of the audio data, and size, rate and flags contain information
- * necessary for playback. Currently this function supports uncompressed
- * raw PCM data, MS IMA ADPCM and MS ADPCM (uses makeADPCMStream internally).
- */
-extern bool loadWAVFromStream(
-	Common::SeekableReadStream &stream,
-	int &size,
-	int &rate,
-	uint8 &flags,
-	uint16 *wavType = 0,
-	int *blockAlign = 0);
-
-/**
- * Try to load a WAVE from the given seekable stream and create an AudioStream
- * from that data. Currently this function supports uncompressed
- * raw PCM data, MS IMA ADPCM and MS ADPCM (uses makeADPCMStream internally).
- *
- * This function uses loadWAVFromStream() internally.
- *
- * @param stream            the SeekableReadStream from which to read the WAVE data
- * @param disposeAfterUse   whether to delete the stream after use
- * @return  a new RewindableAudioStream, or NULL, if an error occurred
- */
-RewindableAudioStream *makeWAVStream(
-	Common::SeekableReadStream *stream,
-	DisposeAfterUse::Flag disposeAfterUse);
-
-} // End of namespace Audio
-
-#endif




More information about the Scummvm-git-logs mailing list