aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2014-11-07 12:09:13 +0200
committerFilippos Karapetis2014-11-07 12:11:33 +0200
commit9f2c3d794e4594fd736b6130412c1685ea21afc9 (patch)
tree67a6b2e7c0bdc5521de29e98a8756763fd07ab6b
parent0fd16ef39f503016c710e264752f41caa8daf724 (diff)
downloadscummvm-rg350-9f2c3d794e4594fd736b6130412c1685ea21afc9.tar.gz
scummvm-rg350-9f2c3d794e4594fd736b6130412c1685ea21afc9.tar.bz2
scummvm-rg350-9f2c3d794e4594fd736b6130412c1685ea21afc9.zip
GROOVIE: Do not play audio in V2 games when only one frame is shown
-rw-r--r--engines/groovie/roq.cpp18
-rw-r--r--engines/groovie/roq.h1
2 files changed, 13 insertions, 6 deletions
diff --git a/engines/groovie/roq.cpp b/engines/groovie/roq.cpp
index 8f272d4404..f14cacd6b8 100644
--- a/engines/groovie/roq.cpp
+++ b/engines/groovie/roq.cpp
@@ -174,7 +174,7 @@ bool ROQPlayer::playFrameInternal() {
// Wait until the current frame can be shown
// Don't wait if we're just showing one frame
- if (!(_alpha && !_flagTwo))
+ if (!playFirstFrame())
waitFrame();
if (_dirty) {
@@ -193,7 +193,7 @@ bool ROQPlayer::playFrameInternal() {
// Report the end of the video if we reached the end of the file or if we
// just wanted to play one frame.
- return _file->eos() || (_alpha && !_flagTwo);
+ return _file->eos() || playFirstFrame();
}
bool ROQPlayer::readBlockHeader(ROQBlockHeader &blockHeader) {
@@ -492,7 +492,7 @@ bool ROQPlayer::processBlockSoundMono(ROQBlockHeader &blockHeader) {
}
// Initialize the audio stream if needed
- if (!_audioStream) {
+ if (!_audioStream && !playFirstFrame()) {
_audioStream = Audio::makeQueuingAudioStream(22050, false);
Audio::SoundHandle sound_handle;
g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &sound_handle, _audioStream);
@@ -521,7 +521,10 @@ bool ROQPlayer::processBlockSoundMono(ROQBlockHeader &blockHeader) {
#ifdef SCUMM_LITTLE_ENDIAN
flags |= Audio::FLAG_LITTLE_ENDIAN;
#endif
- _audioStream->queueBuffer((byte *)buffer, blockHeader.size * 2, DisposeAfterUse::YES, flags);
+ if (!playFirstFrame())
+ _audioStream->queueBuffer((byte *)buffer, blockHeader.size * 2, DisposeAfterUse::YES, flags);
+ else
+ free(buffer);
return true;
}
@@ -535,7 +538,7 @@ bool ROQPlayer::processBlockSoundStereo(ROQBlockHeader &blockHeader) {
}
// Initialize the audio stream if needed
- if (!_audioStream) {
+ if (!_audioStream && !playFirstFrame()) {
_audioStream = Audio::makeQueuingAudioStream(22050, true);
Audio::SoundHandle sound_handle;
g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &sound_handle, _audioStream);
@@ -577,7 +580,10 @@ bool ROQPlayer::processBlockSoundStereo(ROQBlockHeader &blockHeader) {
#ifdef SCUMM_LITTLE_ENDIAN
flags |= Audio::FLAG_LITTLE_ENDIAN;
#endif
- _audioStream->queueBuffer((byte *)buffer, blockHeader.size * 2, DisposeAfterUse::YES, flags);
+ if (!playFirstFrame())
+ _audioStream->queueBuffer((byte *)buffer, blockHeader.size * 2, DisposeAfterUse::YES, flags);
+ else
+ free(buffer);
return true;
}
diff --git a/engines/groovie/roq.h b/engines/groovie/roq.h
index b720e6a235..ce1a3a2d58 100644
--- a/engines/groovie/roq.h
+++ b/engines/groovie/roq.h
@@ -57,6 +57,7 @@ private:
bool processBlockSoundMono(ROQBlockHeader &blockHeader);
bool processBlockSoundStereo(ROQBlockHeader &blockHeader);
bool processBlockAudioContainer(ROQBlockHeader &blockHeader);
+ bool playFirstFrame() { return _alpha && !_flagTwo; }
void paint2(byte i, int destx, int desty);
void paint4(byte i, int destx, int desty);