Another Ogg > MP3 consistency reordering, this time in the SMUSH code; also changed it to use the new compressed audio stream factories

svn-id: r25843
This commit is contained in:
Max Horn 2007-02-25 00:12:11 +00:00
parent dd26444b72
commit 497f7683ca
2 changed files with 15 additions and 20 deletions

View File

@ -1180,10 +1180,8 @@ void SmushPlayer::seekSan(const char *file, int32 pos, int32 contFrame) {
}
void SmushPlayer::tryCmpFile(const char *filename) {
if (_compressedFile.isOpen()) {
_vm->_mixer->stopHandle(_compressedFileSoundHandle);
_compressedFile.close();
}
_vm->_mixer->stopHandle(_compressedFileSoundHandle);
_compressedFileMode = false;
const char *i = strrchr(filename, '.');
if (i == NULL) {
@ -1192,28 +1190,26 @@ void SmushPlayer::tryCmpFile(const char *filename) {
#if defined(USE_MAD) || defined(USE_VORBIS)
char fname[260];
#endif
#ifdef USE_MAD
memcpy(fname, filename, i - filename);
strcpy(fname + (i - filename), ".mp3");
_compressedFile.open(fname);
if (_compressedFile.isOpen()) {
int size = _compressedFile.size();
_compressedFileMode = true;
_vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, Audio::makeMP3Stream(&_compressedFile, size));
return;
}
#endif
Common::File *file = new Common::File();
#ifdef USE_VORBIS
memcpy(fname, filename, i - filename);
strcpy(fname + (i - filename), ".ogg");
_compressedFile.open(fname);
if (_compressedFile.isOpen()) {
int size = _compressedFile.size();
if (file->open(fname)) {
_compressedFileMode = true;
_vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, Audio::makeVorbisStream(&_compressedFile, size));
_vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, Audio::makeVorbisStream(file, true, 0, 0));
return;
}
#endif
#ifdef USE_MAD
memcpy(fname, filename, i - filename);
strcpy(fname + (i - filename), ".mp3");
if (file->open(fname)) {
_compressedFileMode = true;
_vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, Audio::makeMP3Stream(file, true, 0, 0));
return;
}
#endif
delete file;
}
void SmushPlayer::pause() {

View File

@ -66,7 +66,6 @@ private:
Audio::SoundHandle _compressedFileSoundHandle;
bool _compressedFileMode;
Common::File _compressedFile;
byte _IACToutput[4096];
int32 _IACTpos;
bool _storeFrame;