From a739f3ae3b34044915d09ddb954fead713779850 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Wed, 17 Dec 2003 11:07:40 +0000 Subject: The mixer handles little-endian samples now. Take advantage of that. svn-id: r11707 --- sword2/driver/d_draw.cpp | 2 +- sword2/driver/d_sound.cpp | 18 ++---------------- 2 files changed, 3 insertions(+), 17 deletions(-) (limited to 'sword2') diff --git a/sword2/driver/d_draw.cpp b/sword2/driver/d_draw.cpp index 82fa3a2415..3b0f96ca99 100644 --- a/sword2/driver/d_draw.cpp +++ b/sword2/driver/d_draw.cpp @@ -186,7 +186,7 @@ int32 MoviePlayer::play(char *filename, _movieTextObject *text[], uint8 *musicOu openTextObject(text[textCounter]); drawTextObject(text[textCounter]); if (text[textCounter]->speech) { - _vm->_mixer->playRaw(&handle, text[textCounter]->speech, text[textCounter]->speechBufferSize, 22050, SoundMixer::FLAG_16BITS); + _vm->_mixer->playRaw(&handle, text[textCounter]->speech, text[textCounter]->speechBufferSize, 22050, SoundMixer::FLAG_16BITS | SoundMixer::FLAG_LITTLE_ENDIAN); } } diff --git a/sword2/driver/d_sound.cpp b/sword2/driver/d_sound.cpp index 7ff29f3507..97e5c2b023 100644 --- a/sword2/driver/d_sound.cpp +++ b/sword2/driver/d_sound.cpp @@ -363,14 +363,6 @@ uint32 Sound::preFetchCompSpeech(const char *filename, uint32 speechid, uint16 * } free(data8); - -#ifndef SCUMM_BIG_ENDIAN - // Until the mixer supports LE samples natively, we need to convert - // our LE ones to BE - for (uint j = 0; j < bufferSize / 2; j++) - data16[j] = SWAP_BYTES_16(data16[j]); -#endif - return bufferSize; } @@ -406,7 +398,7 @@ int32 Sound::playCompSpeech(const char *filename, uint32 speechid, uint8 vol, in _speechPaused = true; - uint32 flags = SoundMixer::FLAG_16BITS | SoundMixer::FLAG_AUTOFREE; + uint32 flags = SoundMixer::FLAG_16BITS | SoundMixer::FLAG_LITTLE_ENDIAN | SoundMixer::FLAG_AUTOFREE; _vm->_mixer->playRaw(&_soundHandleSpeech, data16, bufferSize, 22050, flags, -1, volume, p); @@ -596,17 +588,11 @@ int32 Sound::openFx(int32 id, uint8 *data) { free(_fx[fxi]._buf); _fx[fxi]._buf = (uint16 *) malloc(_fx[fxi]._bufSize); memcpy(_fx[fxi]._buf, (uint8 *) (data32 + 2), _fx[fxi]._bufSize); - _fx[fxi]._flags = SoundMixer::FLAG_16BITS; + _fx[fxi]._flags = SoundMixer::FLAG_16BITS | SoundMixer::FLAG_LITTLE_ENDIAN; if (FROM_LE_16(wav->channels) == 2) _fx[fxi]._flags |= SoundMixer::FLAG_STEREO; _fx[fxi]._rate = FROM_LE_16(wav->samplesPerSec); - - // Until the mixer supports LE samples natively, we need to - // convert our LE ones to BE - for (int32 j = 0; j < _fx[fxi]._bufSize / 2; j++) - _fx[fxi]._buf[j] = SWAP_BYTES_16(_fx[fxi]._buf[j]); - _fx[fxi]._id = id; } return RD_OK; -- cgit v1.2.3