Permalink
Browse files

STARTREK: Loop audio

  • Loading branch information...
Drenn1 authored and sev- committed May 31, 2018
1 parent fe5658c commit c17bef8285086d438a03fcff6ae5f3d15b5532e8
Showing with 11 additions and 2 deletions.
  1. +11 −2 engines/startrek/sound.cpp
@@ -160,8 +160,11 @@ void Sound::playVoc(const Common::String &baseSoundName) {
playMacSoundEffect(baseSoundName);
else
*/
if (baseSoundName.size() == 8 && baseSoundName.hasSuffixIgnoreCase("loop"))
bool loop = false;
if (baseSoundName.size() == 8 && baseSoundName.hasSuffixIgnoreCase("loop")) {
_loopingAudioName = baseSoundName;
loop = true;
}

if (!_vm->_sfxEnabled || !_vm->_sfxWorking)
return;
@@ -182,7 +185,13 @@ void Sound::playVoc(const Common::String &baseSoundName) {
error("Couldn't open '%s'", soundName.c_str());

debugC(5, kDebugSound, "Playing sound effect '%s'", soundName.c_str());
Audio::AudioStream *audioStream = Audio::makeVOCStream(readStream, Audio::FLAG_UNSIGNED, DisposeAfterUse::YES);

Audio::RewindableAudioStream *srcStream = Audio::makeVOCStream(readStream, Audio::FLAG_UNSIGNED, DisposeAfterUse::YES);
Audio::AudioStream *audioStream;
if (loop)
audioStream = new Audio::LoopingAudioStream(srcStream, 0, DisposeAfterUse::YES);
else
audioStream = srcStream;
_vm->_system->getMixer()->playStream(Audio::Mixer::kSFXSoundType, &_sfxHandles[i], audioStream);
return;
}

0 comments on commit c17bef8

Please sign in to comment.