diff options
Diffstat (limited to 'engines/tony')
-rw-r--r-- | engines/tony/sound.cpp | 24 | ||||
-rw-r--r-- | engines/tony/sound.h | 3 | ||||
-rw-r--r-- | engines/tony/tony.cpp | 12 |
3 files changed, 13 insertions, 26 deletions
diff --git a/engines/tony/sound.cpp b/engines/tony/sound.cpp index fe4e0ab0e7..88379baf15 100644 --- a/engines/tony/sound.cpp +++ b/engines/tony/sound.cpp @@ -461,7 +461,7 @@ void FPStream::release() { * * @returns True is everything is OK, False otherwise */ -bool FPStream::loadFile(const Common::String &fileName, uint32 codec, int bufSize) { +bool FPStream::loadFile(const Common::String &fileName, int bufSize) { if (!_soundSupported) return true; @@ -469,7 +469,7 @@ bool FPStream::loadFile(const Common::String &fileName, uint32 codec, int bufSiz unloadFile(); // Save the codec type - _codec = codec; + _codec = FPCODEC_ADPCM; // Open the file stream for reading if (!_file.open(fileName)) { @@ -482,25 +482,13 @@ bool FPStream::loadFile(const Common::String &fileName, uint32 codec, int bufSiz // Save the size of the stream _size = _file.size(); - switch (_codec) { - case FPCODEC_RAW: - _rewindableStream = Audio::makeRawStream(&_file, 44100, Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_STEREO, DisposeAfterUse::NO); - break; - - case FPCODEC_ADPCM: #ifdef __amigaos4__ - // HACK: AmigaOS 4 has weird performance problems with reading in the audio thread, - // so we read the whole stream into memory. - _rewindableStream = Audio::makeADPCMStream(_file.readStream(_size), DisposeAfterUse::YES, 0, Audio::kADPCMDVI, 44100, 2); + // HACK: AmigaOS 4 has weird performance problems with reading in the audio thread, + // so we read the whole stream into memory. + _rewindableStream = Audio::makeADPCMStream(_file.readStream(_size), DisposeAfterUse::YES, 0, Audio::kADPCMDVI, 44100, 2); #else - _rewindableStream = Audio::makeADPCMStream(&_file, DisposeAfterUse::NO, 0, Audio::kADPCMDVI, 44100, 2); + _rewindableStream = Audio::makeADPCMStream(&_file, DisposeAfterUse::NO, 0, Audio::kADPCMDVI, 44100, 2); #endif - break; - - default: - _file.close(); - return false; - } // All done _fileLoaded = true; diff --git a/engines/tony/sound.h b/engines/tony/sound.h index 50ef78ae0d..6aa4ae9496 100644 --- a/engines/tony/sound.h +++ b/engines/tony/sound.h @@ -297,12 +297,11 @@ public: * Opens a file stream * * @param fileName Filename to be opened - * @param codec CODEC to be used to uncompress samples * * @returns True is everything is OK, False otherwise */ - bool loadFile(const Common::String &fileName, uint32 codec = FPCODEC_RAW, int sync = 2000); + bool loadFile(const Common::String &fileName, int sync); /** * Closes a file stream (opened or not). diff --git a/engines/tony/tony.cpp b/engines/tony/tony.cpp index b6ed51a84c..67ffd36d57 100644 --- a/engines/tony/tony.cpp +++ b/engines/tony/tony.cpp @@ -323,10 +323,10 @@ void TonyEngine::playMusic(int nChannel, const Common::String &fname, int nFX, b _stream[GLOBALS._nextChannel]->unloadFile(); if (!getIsDemo()) { - if (!_stream[GLOBALS._nextChannel]->loadFile(fname, FPCODEC_ADPCM, nSync)) + if (!_stream[GLOBALS._nextChannel]->loadFile(fname, nSync)) error("failed to open music file '%s'", fname.c_str()); } else { - _stream[GLOBALS._nextChannel]->loadFile(fname, FPCODEC_ADPCM, nSync); + _stream[GLOBALS._nextChannel]->loadFile(fname, nSync); } _stream[GLOBALS._nextChannel]->setLoop(bLoop); @@ -335,10 +335,10 @@ void TonyEngine::playMusic(int nChannel, const Common::String &fname, int nFX, b GLOBALS._flipflop = 1 - GLOBALS._flipflop; } else { if (!getIsDemo()) { - if (!_stream[nChannel]->loadFile(fname, FPCODEC_ADPCM, nSync)) + if (!_stream[nChannel]->loadFile(fname, nSync)) error("failed to open music file '%s'", fname.c_str()); } else { - _stream[nChannel]->loadFile(fname, FPCODEC_ADPCM, nSync); + _stream[nChannel]->loadFile(fname, nSync); } _stream[nChannel]->setLoop(bLoop); @@ -356,10 +356,10 @@ void TonyEngine::doNextMusic(CORO_PARAM, const void *param) { CORO_BEGIN_CODE(_ctx); if (!g_vm->getIsDemo()) { - if (!streams[GLOBALS._nextChannel]->loadFile(GLOBALS._nextMusic, FPCODEC_ADPCM, GLOBALS._nextSync)) + if (!streams[GLOBALS._nextChannel]->loadFile(GLOBALS._nextMusic, GLOBALS._nextSync)) error("failed to open next music file '%s'", GLOBALS._nextMusic.c_str()); } else { - streams[GLOBALS._nextChannel]->loadFile(GLOBALS._nextMusic, FPCODEC_ADPCM, GLOBALS._nextSync); + streams[GLOBALS._nextChannel]->loadFile(GLOBALS._nextMusic, GLOBALS._nextSync); } streams[GLOBALS._nextChannel]->setLoop(GLOBALS._nextLoop); |