mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-04 09:18:38 +00:00
Fixed sound factory messup caused by my previous commit
svn-id: r28111
This commit is contained in:
parent
11b2806741
commit
f4c0b853cc
@ -292,7 +292,9 @@ Audio::AudioStream *MP3Sound::makeAudioStream(uint sound) {
|
||||
|
||||
uint32 size = _offsets[sound + i] - _offsets[sound];
|
||||
|
||||
return Audio::makeMP3Stream(_file, size);
|
||||
Common::MemoryReadStream *tmp = _file->readStream(size);
|
||||
assert(tmp);
|
||||
return Audio::makeMP3Stream(tmp, true);
|
||||
}
|
||||
|
||||
void MP3Sound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, byte flags, int vol) {
|
||||
@ -321,7 +323,9 @@ Audio::AudioStream *VorbisSound::makeAudioStream(uint sound) {
|
||||
|
||||
uint32 size = _offsets[sound + i] - _offsets[sound];
|
||||
|
||||
return Audio::makeVorbisStream(_file, size);
|
||||
Common::MemoryReadStream *tmp = _file->readStream(size);
|
||||
assert(tmp);
|
||||
return Audio::makeVorbisStream(tmp, true);
|
||||
}
|
||||
|
||||
void VorbisSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, byte flags, int vol) {
|
||||
@ -350,7 +354,9 @@ Audio::AudioStream *FlacSound::makeAudioStream(uint sound) {
|
||||
|
||||
uint32 size = _offsets[sound + i] - _offsets[sound];
|
||||
|
||||
return Audio::makeFlacStream(_file, size);
|
||||
Common::MemoryReadStream *tmp = _file->readStream(size);
|
||||
assert(tmp);
|
||||
return Audio::makeFlacStream(tmp, true);
|
||||
}
|
||||
|
||||
void FlacSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, byte flags, int vol) {
|
||||
|
@ -67,7 +67,9 @@ public:
|
||||
MP3Sound(Audio::Mixer *mixer, QueenEngine *vm) : PCSound(mixer, vm) {}
|
||||
protected:
|
||||
void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
|
||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeMP3Stream(f, size));
|
||||
Common::MemoryReadStream *tmp = f->readStream(size);
|
||||
assert(tmp);
|
||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeMP3Stream(tmp, true));
|
||||
}
|
||||
};
|
||||
#endif
|
||||
@ -78,7 +80,9 @@ public:
|
||||
OGGSound(Audio::Mixer *mixer, QueenEngine *vm) : PCSound(mixer, vm) {}
|
||||
protected:
|
||||
void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
|
||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeVorbisStream(f, size));
|
||||
Common::MemoryReadStream *tmp = f->readStream(size);
|
||||
assert(tmp);
|
||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeVorbisStream(tmp, true));
|
||||
}
|
||||
};
|
||||
#endif
|
||||
@ -89,7 +93,9 @@ public:
|
||||
FLACSound(Audio::Mixer *mixer, QueenEngine *vm) : PCSound(mixer, vm) {}
|
||||
protected:
|
||||
void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
|
||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeFlacStream(f, size));
|
||||
Common::MemoryReadStream *tmp = f->readStream(size);
|
||||
assert(tmp);
|
||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeFlacStream(tmp, true));
|
||||
}
|
||||
};
|
||||
#endif // #ifdef USE_FLAC
|
||||
|
@ -84,27 +84,34 @@ void Sound::playSoundBuffer(Audio::SoundHandle *handle, SoundBuffer &buffer, int
|
||||
_mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer.buffer, buffer.size, buffer.frequency, flags, -1, volume);
|
||||
} else {
|
||||
Audio::AudioStream *stream = NULL;
|
||||
Common::MemoryReadStream *tmp = NULL;
|
||||
|
||||
switch (buffer.soundType) {
|
||||
#ifdef USE_MAD
|
||||
case kSoundMP3:
|
||||
debug(1, "Playing MP3 compressed sound");
|
||||
buffer.soundFile->seek((long)buffer.fileOffset, SEEK_SET);
|
||||
stream = Audio::makeMP3Stream(buffer.soundFile, buffer.size);
|
||||
tmp = buffer.soundFile->readStream(buffer.size);
|
||||
assert(tmp);
|
||||
stream = Audio::makeMP3Stream(tmp, true);
|
||||
break;
|
||||
#endif
|
||||
#ifdef USE_VORBIS
|
||||
case kSoundOGG:
|
||||
debug(1, "Playing OGG compressed sound");
|
||||
buffer.soundFile->seek((long)buffer.fileOffset, SEEK_SET);
|
||||
stream = Audio::makeVorbisStream(buffer.soundFile, buffer.size);
|
||||
tmp = buffer.soundFile->readStream(buffer.size);
|
||||
assert(tmp);
|
||||
stream = Audio::makeVorbisStream(tmp, true);
|
||||
break;
|
||||
#endif
|
||||
#ifdef USE_FLAC
|
||||
case kSoundFLAC:
|
||||
debug(1, "Playing FLAC compressed sound");
|
||||
buffer.soundFile->seek((long)buffer.fileOffset, SEEK_SET);
|
||||
stream = Audio::makeFlacStream(buffer.soundFile, buffer.size);
|
||||
tmp = buffer.soundFile->readStream(buffer.size);
|
||||
assert(tmp);
|
||||
stream = Audio::makeFlacStream(tmp, true);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
@ -615,13 +615,15 @@ int32 ImuseDigiSndMgr::getDataFromRegion(soundStruct *soundHandle, int region, b
|
||||
oggMode = true;
|
||||
}
|
||||
if (!soundHandle->compressedStream) {
|
||||
Common::MemoryReadStream *tmp = cmpFile->readStream(len);
|
||||
assert(tmp);
|
||||
#ifdef USE_VORBIS
|
||||
if (oggMode)
|
||||
soundHandle->compressedStream = Audio::makeVorbisStream(cmpFile, len);
|
||||
soundHandle->compressedStream = Audio::makeVorbisStream(tmp, true);
|
||||
#endif
|
||||
#ifdef USE_MAD
|
||||
if (!oggMode)
|
||||
soundHandle->compressedStream = Audio::makeMP3Stream(cmpFile, len);
|
||||
soundHandle->compressedStream = Audio::makeMP3Stream(tmp, true);
|
||||
#endif
|
||||
assert(soundHandle->compressedStream);
|
||||
}
|
||||
|
@ -1183,7 +1183,7 @@ void SmushPlayer::tryCmpFile(const char *filename) {
|
||||
strcpy(fname + (i - filename), ".ogg");
|
||||
if (file->open(fname)) {
|
||||
_compressedFileMode = true;
|
||||
_vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, Audio::makeVorbisStream(file, true, 0, 0));
|
||||
_vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, Audio::makeVorbisStream(file, true));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@ -1192,7 +1192,7 @@ void SmushPlayer::tryCmpFile(const char *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));
|
||||
_vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, Audio::makeMP3Stream(file, true));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -607,24 +607,31 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle
|
||||
|
||||
if (!_soundsPaused && _mixer->isReady()) {
|
||||
Audio::AudioStream *input = NULL;
|
||||
Common::MemoryReadStream *tmp = NULL;
|
||||
|
||||
switch (_soundMode) {
|
||||
case kMP3Mode:
|
||||
#ifdef USE_MAD
|
||||
assert(size > 0);
|
||||
input = Audio::makeMP3Stream(_sfxFile, size);
|
||||
tmp = _sfxFile->readStream(size);
|
||||
assert(tmp);
|
||||
input = Audio::makeMP3Stream(tmp, true);
|
||||
#endif
|
||||
break;
|
||||
case kVorbisMode:
|
||||
#ifdef USE_VORBIS
|
||||
assert(size > 0);
|
||||
input = Audio::makeVorbisStream(_sfxFile, size);
|
||||
tmp = _sfxFile->readStream(size);
|
||||
assert(tmp);
|
||||
input = Audio::makeVorbisStream(tmp, true);
|
||||
#endif
|
||||
break;
|
||||
case kFlacMode:
|
||||
#ifdef USE_FLAC
|
||||
assert(size > 0);
|
||||
input = Audio::makeFlacStream(_sfxFile, size);
|
||||
tmp = _sfxFile->readStream(size);
|
||||
assert(tmp);
|
||||
input = Audio::makeFlacStream(tmp, true);
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
|
@ -201,7 +201,9 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) {
|
||||
#ifdef USE_FLAC
|
||||
else if (_cowMode == CowFlac) {
|
||||
_cowFile.seek(index);
|
||||
_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeFlacStream(&_cowFile, sampleSize), SOUND_SPEECH_ID, speechVol, speechPan);
|
||||
Common::MemoryReadStream *tmp = _cowFile.readStream(sampleSize);
|
||||
assert(tmp);
|
||||
_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeFlacStream(tmp, true), SOUND_SPEECH_ID, speechVol, speechPan);
|
||||
// with compressed audio, we can't calculate the wave volume.
|
||||
// so default to talking.
|
||||
for (int cnt = 0; cnt < 480; cnt++)
|
||||
@ -212,7 +214,9 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) {
|
||||
#ifdef USE_VORBIS
|
||||
else if (_cowMode == CowVorbis) {
|
||||
_cowFile.seek(index);
|
||||
_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeVorbisStream(&_cowFile, sampleSize), SOUND_SPEECH_ID, speechVol, speechPan);
|
||||
Common::MemoryReadStream *tmp = _cowFile.readStream(sampleSize);
|
||||
assert(tmp);
|
||||
_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeVorbisStream(tmp, true), SOUND_SPEECH_ID, speechVol, speechPan);
|
||||
// with compressed audio, we can't calculate the wave volume.
|
||||
// so default to talking.
|
||||
for (int cnt = 0; cnt < 480; cnt++)
|
||||
@ -223,7 +227,9 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) {
|
||||
#ifdef USE_MAD
|
||||
else if (_cowMode == CowMp3) {
|
||||
_cowFile.seek(index);
|
||||
_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeMP3Stream(&_cowFile, sampleSize), SOUND_SPEECH_ID, speechVol, speechPan);
|
||||
Common::MemoryReadStream *tmp = _cowFile.readStream(sampleSize);
|
||||
assert(tmp);
|
||||
_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeMP3Stream(tmp, true), SOUND_SPEECH_ID, speechVol, speechPan);
|
||||
// with compressed audio, we can't calculate the wave volume.
|
||||
// so default to talking.
|
||||
for (int cnt = 0; cnt < 480; cnt++)
|
||||
|
@ -139,21 +139,29 @@ static Audio::AudioStream *getAudioStream(SoundFileHandle *fh, const char *base,
|
||||
}
|
||||
|
||||
fh->file.seek(pos, SEEK_SET);
|
||||
|
||||
Common::MemoryReadStream *tmp = 0;
|
||||
|
||||
switch (fh->fileType) {
|
||||
case kCLUMode:
|
||||
return makeCLUStream(&fh->file, enc_len);
|
||||
#ifdef USE_MAD
|
||||
case kMP3Mode:
|
||||
return Audio::makeMP3Stream(&fh->file, enc_len);
|
||||
tmp = fh->file.readStream(enc_len);
|
||||
assert(tmp);
|
||||
return Audio::makeMP3Stream(tmp, true);
|
||||
#endif
|
||||
#ifdef USE_VORBIS
|
||||
case kVorbisMode:
|
||||
return Audio::makeVorbisStream(&fh->file, enc_len);
|
||||
tmp = fh->file.readStream(enc_len);
|
||||
assert(tmp);
|
||||
return Audio::makeVorbisStream(tmp, true);
|
||||
#endif
|
||||
#ifdef USE_FLAC
|
||||
case kFlacMode:
|
||||
return Audio::makeFlacStream(&fh->file, enc_len);
|
||||
tmp = fh->file.readStream(enc_len);
|
||||
assert(tmp);
|
||||
return Audio::makeFlacStream(tmp, true);
|
||||
#endif
|
||||
default:
|
||||
return NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user