diff options
-rw-r--r-- | audio/decoders/xa.cpp (renamed from audio/decoders/vag.cpp) | 28 | ||||
-rw-r--r-- | audio/decoders/xa.h (renamed from audio/decoders/vag.h) | 12 | ||||
-rw-r--r-- | audio/module.mk | 2 | ||||
-rw-r--r-- | engines/sword1/music.cpp | 4 | ||||
-rw-r--r-- | engines/sword1/sound.cpp | 6 | ||||
-rw-r--r-- | engines/sword2/music.cpp | 4 | ||||
-rw-r--r-- | engines/sword2/sound.cpp | 6 | ||||
-rw-r--r-- | engines/tinsel/sound.cpp | 9 |
8 files changed, 36 insertions, 35 deletions
diff --git a/audio/decoders/vag.cpp b/audio/decoders/xa.cpp index 10ef69708c..2b8c9b2d99 100644 --- a/audio/decoders/vag.cpp +++ b/audio/decoders/xa.cpp @@ -20,16 +20,16 @@ * */ -#include "audio/decoders/vag.h" +#include "audio/decoders/xa.h" #include "audio/audiostream.h" #include "common/stream.h" namespace Audio { -class VagStream : public Audio::RewindableAudioStream { +class XAStream : public Audio::RewindableAudioStream { public: - VagStream(Common::SeekableReadStream *stream, int rate); - ~VagStream(); + XAStream(Common::SeekableReadStream *stream, int rate); + ~XAStream(); bool isStereo() const { return false; } bool endOfData() const { return _stream->pos() == _stream->size(); } @@ -47,7 +47,7 @@ private: double _s1, _s2; }; -VagStream::VagStream(Common::SeekableReadStream *stream, int rate) : _stream(stream) { +XAStream::XAStream(Common::SeekableReadStream *stream, int rate) : _stream(stream) { _samplesRemaining = 0; _predictor = 0; _s1 = _s2 = 0.0; @@ -55,11 +55,11 @@ VagStream::VagStream(Common::SeekableReadStream *stream, int rate) : _stream(str } -VagStream::~VagStream() { +XAStream::~XAStream() { delete _stream; } -static const double s_vagDataTable[5][2] = +static const double s_xaDataTable[5][2] = { { 0.0, 0.0 }, { 60.0 / 64.0, 0.0 }, @@ -68,14 +68,14 @@ static const double s_vagDataTable[5][2] = { 122.0 / 64.0, -60.0 / 64.0 } }; -int VagStream::readBuffer(int16 *buffer, const int numSamples) { +int XAStream::readBuffer(int16 *buffer, const int numSamples) { int32 samplesDecoded = 0; if (_samplesRemaining) { byte i = 0; for (i = 28 - _samplesRemaining; i < 28 && samplesDecoded < numSamples; i++) { - _samples[i] = _samples[i] + _s1 * s_vagDataTable[_predictor][0] + _s2 * s_vagDataTable[_predictor][1]; + _samples[i] = _samples[i] + _s1 * s_xaDataTable[_predictor][0] + _s2 * s_xaDataTable[_predictor][1]; _s2 = _s1; _s1 = _samples[i]; int16 d = (int) (_samples[i] + 0.5); @@ -116,7 +116,7 @@ int VagStream::readBuffer(int16 *buffer, const int numSamples) { } for (i = 0; i < 28 && samplesDecoded < numSamples; i++) { - _samples[i] = _samples[i] + _s1 * s_vagDataTable[_predictor][0] + _s2 * s_vagDataTable[_predictor][1]; + _samples[i] = _samples[i] + _s1 * s_xaDataTable[_predictor][0] + _s2 * s_xaDataTable[_predictor][1]; _s2 = _s1; _s1 = _samples[i]; int16 d = (int) (_samples[i] + 0.5); @@ -131,7 +131,7 @@ int VagStream::readBuffer(int16 *buffer, const int numSamples) { return samplesDecoded; } -bool VagStream::rewind() { +bool XAStream::rewind() { _stream->seek(0); _samplesRemaining = 0; _predictor = 0; @@ -140,8 +140,8 @@ bool VagStream::rewind() { return true; } -RewindableAudioStream *makeVagStream(Common::SeekableReadStream *stream, int rate) { - return new VagStream(stream, rate); +RewindableAudioStream *makeXAStream(Common::SeekableReadStream *stream, int rate) { + return new XAStream(stream, rate); } -} +} // End of namespace Audio diff --git a/audio/decoders/vag.h b/audio/decoders/xa.h index b80fbdb98f..ed3213f350 100644 --- a/audio/decoders/vag.h +++ b/audio/decoders/xa.h @@ -28,8 +28,8 @@ * - tinsel (PSX port of the game) */ -#ifndef SOUND_VAG_H -#define SOUND_VAG_H +#ifndef AUDIO_DECODERS_XA_H +#define AUDIO_DECODERS_XA_H namespace Common { class SeekableReadStream; @@ -40,17 +40,17 @@ namespace Audio { class RewindableAudioStream; /** - * Takes an input stream containing Vag sound data and creates + * Takes an input stream containing XA ADPCM sound data and creates * an RewindableAudioStream from that. * - * @param stream the SeekableReadStream from which to read the ADPCM data + * @param stream the SeekableReadStream from which to read the XA ADPCM data * @param rate the sampling rate * @return a new RewindableAudioStream, or NULL, if an error occurred */ -RewindableAudioStream *makeVagStream( +RewindableAudioStream *makeXAStream( Common::SeekableReadStream *stream, int rate = 11025); -} // End of namespace Sword1 +} // End of namespace Audio #endif diff --git a/audio/module.mk b/audio/module.mk index 46cb9944e1..e3aa0aaa81 100644 --- a/audio/module.mk +++ b/audio/module.mk @@ -23,10 +23,10 @@ MODULE_OBJS := \ decoders/qdm2.o \ decoders/quicktime.o \ decoders/raw.o \ - decoders/vag.o \ decoders/voc.o \ decoders/vorbis.o \ decoders/wave.o \ + decoders/xa.o \ mods/infogrames.o \ mods/maxtrax.o \ mods/module.o \ diff --git a/engines/sword1/music.cpp b/engines/sword1/music.cpp index b4656ff89f..7a19944c34 100644 --- a/engines/sword1/music.cpp +++ b/engines/sword1/music.cpp @@ -35,7 +35,7 @@ #include "audio/decoders/mp3.h" #include "audio/decoders/vorbis.h" #include "audio/decoders/wave.h" -#include "audio/decoders/vag.h" +#include "audio/decoders/xa.h" #define SMP_BUFSIZE 8192 @@ -131,7 +131,7 @@ bool MusicHandle::playPSX(uint16 id, bool loop) { // not over file size if ((size != 0) && (size != 0xffffffff) && ((int32)(offset + size) <= _file.size())) { _file.seek(offset, SEEK_SET); - _audioSource = Audio::makeLoopingAudioStream(Audio::makeVagStream(_file.readStream(size)), loop ? 0 : 1); + _audioSource = Audio::makeLoopingAudioStream(Audio::makeXAStream(_file.readStream(size)), loop ? 0 : 1); fadeUp(); } else { _audioSource = NULL; diff --git a/engines/sword1/sound.cpp b/engines/sword1/sound.cpp index f7ab9ca1de..ae693bce5c 100644 --- a/engines/sword1/sound.cpp +++ b/engines/sword1/sound.cpp @@ -38,7 +38,7 @@ #include "audio/decoders/raw.h" #include "audio/decoders/vorbis.h" #include "audio/decoders/wave.h" -#include "audio/decoders/vag.h" +#include "audio/decoders/xa.h" namespace Sword1 { @@ -256,7 +256,7 @@ void Sound::playSample(QueueElement *elem) { if (SwordEngine::isPsx()) { uint32 size = READ_LE_UINT32(sampleData); - Audio::AudioStream *audStream = Audio::makeLoopingAudioStream(Audio::makeVagStream(new Common::MemoryReadStream(sampleData + 4, size-4)), (_fxList[elem->id].type == FX_LOOP) ? 0 : 1); + Audio::AudioStream *audStream = Audio::makeLoopingAudioStream(Audio::makeXAStream(new Common::MemoryReadStream(sampleData + 4, size-4)), (_fxList[elem->id].type == FX_LOOP) ? 0 : 1); _mixer->playStream(Audio::Mixer::kSFXSoundType, &elem->handle, audStream, elem->id, volume, pan); } else { uint32 size = READ_LE_UINT32(sampleData + 0x28); @@ -364,7 +364,7 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) { _cowFile.seek(index * 2048); Common::SeekableReadStream *tmp = _cowFile.readStream(sampleSize); assert(tmp); - stream = Audio::makeVagStream(tmp); + stream = Audio::makeXAStream(tmp); _mixer->playStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, stream, SOUND_SPEECH_ID, speechVol, speechPan); // with compressed audio, we can't calculate the wave volume. // so default to talking. diff --git a/engines/sword2/music.cpp b/engines/sword2/music.cpp index 63116e954a..1e52cc29a7 100644 --- a/engines/sword2/music.cpp +++ b/engines/sword2/music.cpp @@ -39,7 +39,7 @@ #include "audio/decoders/vorbis.h" #include "audio/decoders/flac.h" #include "audio/decoders/wave.h" -#include "audio/decoders/vag.h" +#include "audio/decoders/xa.h" #include "audio/rate.h" #include "sword2/sword2.h" @@ -267,7 +267,7 @@ Audio::AudioStream *makePSXCLUStream(Common::File *file, int size) { byte *buffer = (byte *)malloc(size); file->read(buffer, size); - return Audio::makeVagStream(new Common::MemoryReadStream(buffer, size, DisposeAfterUse::YES)); + return Audio::makeXAStream(new Common::MemoryReadStream(buffer, size, DisposeAfterUse::YES)); } // ---------------------------------------------------------------------------- diff --git a/engines/sword2/sound.cpp b/engines/sword2/sound.cpp index 19e244e61c..d9260cc2d5 100644 --- a/engines/sword2/sound.cpp +++ b/engines/sword2/sound.cpp @@ -47,7 +47,7 @@ #include "sword2/sound.h" #include "audio/decoders/wave.h" -#include "audio/decoders/vag.h" +#include "audio/decoders/xa.h" #define Debug_Printf _vm->_debugger->DebugPrintf @@ -234,7 +234,7 @@ void Sound::playMovieSound(int32 res, int type) { Audio::RewindableAudioStream *input = 0; if (Sword2Engine::isPsx()) { - input = Audio::makeVagStream(stream); + input = Audio::makeXAStream(stream); } else { input = Audio::makeWAVStream(stream, DisposeAfterUse::YES); } @@ -361,7 +361,7 @@ int32 Sound::playFx(Audio::SoundHandle *handle, byte *data, uint32 len, uint8 vo Audio::RewindableAudioStream *input = 0; if (Sword2Engine::isPsx()) - input = Audio::makeVagStream(stream); + input = Audio::makeXAStream(stream); else input = Audio::makeWAVStream(stream, DisposeAfterUse::YES); diff --git a/engines/tinsel/sound.cpp b/engines/tinsel/sound.cpp index bf48dd1511..130928d885 100644 --- a/engines/tinsel/sound.cpp +++ b/engines/tinsel/sound.cpp @@ -41,8 +41,9 @@ #include "audio/decoders/flac.h" #include "audio/decoders/mp3.h" #include "audio/decoders/raw.h" -#include "audio/decoders/vag.h" #include "audio/decoders/vorbis.h" +#include "audio/decoders/xa.h" + #include "gui/message.h" @@ -106,8 +107,8 @@ bool SoundManager::playSample(int id, Audio::Mixer::SoundType type, Audio::Sound error(FILE_IS_CORRUPT, _vm->getSampleFile(sampleLanguage)); if (TinselV1PSX) { - // Read the stream and create a VAG Audio stream - Audio::AudioStream *vagStream = Audio::makeVagStream(_sampleStream.readStream(sampleLen), 44100); + // Read the stream and create a XA ADPCM audio stream + Audio::AudioStream *xaStream = Audio::makeXAStream(_sampleStream.readStream(sampleLen), 44100); // FIXME: Should set this in a different place ;) _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, _vm->_config->_soundVolume); @@ -115,7 +116,7 @@ bool SoundManager::playSample(int id, Audio::Mixer::SoundType type, Audio::Sound _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, _vm->_config->_voiceVolume); // Play the audio stream - _vm->_mixer->playStream(type, &curChan.handle, vagStream); + _vm->_mixer->playStream(type, &curChan.handle, xaStream); } else { // allocate a buffer byte *sampleBuf = (byte *)malloc(sampleLen); |