[Scummvm-cvs-logs] scummvm master -> ab8382418d98a22d22ce839f016be9e293f30f6e
bluegr
bluegr at gmail.com
Sun Dec 27 20:43:33 CET 2015
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
70822b32b0 LAB: Some more cleanup to the music code
ab8382418d LAB: Do not pause the background music when a sound effect is played
Commit: 70822b32b0669221940c8f5b2f099de9d8511a0d
https://github.com/scummvm/scummvm/commit/70822b32b0669221940c8f5b2f099de9d8511a0d
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2015-12-27T21:42:05+02:00
Commit Message:
LAB: Some more cleanup to the music code
Changed paths:
engines/lab/music.cpp
diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp
index 2b16fdd..42262bf 100644
--- a/engines/lab/music.cpp
+++ b/engines/lab/music.cpp
@@ -72,26 +72,20 @@ void Music::changeMusic(const Common::String filename, bool storeCurPos, bool se
_musicFile->seek(_storedPos);
Audio::SeekableAudioStream *audioStream = Audio::makeRawStream(_musicFile, SAMPLESPEED, getSoundFlags());
- Audio::LoopingAudioStream *loopingAudioStream = new Audio::LoopingAudioStream(audioStream, 0);
- _vm->_mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, loopingAudioStream);
+ _vm->_mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, new Audio::LoopingAudioStream(audioStream, 0));
}
void Music::playSoundEffect(uint16 sampleSpeed, uint32 length, bool loop, Common::File *dataFile) {
pauseBackMusic();
stopSoundEffect();
- if (sampleSpeed < 4000)
- sampleSpeed = 4000;
-
// NOTE: We need to use malloc(), cause this will be freed with free()
// by the music code
byte *soundData = (byte *)malloc(length);
dataFile->read(soundData, length);
- Audio::SeekableAudioStream *audioStream = Audio::makeRawStream((const byte *)soundData, length, sampleSpeed, getSoundFlags());
- uint loops = (loop) ? 0 : 1;
- Audio::LoopingAudioStream *loopingAudioStream = new Audio::LoopingAudioStream(audioStream, loops);
- _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, loopingAudioStream);
+ Audio::SeekableAudioStream *audioStream = Audio::makeRawStream((const byte *)soundData, length, MAX<uint16>(sampleSpeed, 4000), getSoundFlags());
+ _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, new Audio::LoopingAudioStream(audioStream, (loop) ? 0 : 1));
}
void Music::stopSoundEffect() {
Commit: ab8382418d98a22d22ce839f016be9e293f30f6e
https://github.com/scummvm/scummvm/commit/ab8382418d98a22d22ce839f016be9e293f30f6e
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2015-12-27T21:42:51+02:00
Commit Message:
LAB: Do not pause the background music when a sound effect is played
Changed paths:
engines/lab/engine.cpp
engines/lab/music.cpp
engines/lab/music.h
diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp
index 4d24fb3..8894ae7 100644
--- a/engines/lab/engine.cpp
+++ b/engines/lab/engine.cpp
@@ -418,8 +418,6 @@ void LabEngine::mainGameLoop() {
break;
}
- _music->resumeBackMusic();
-
// Sees what kind of close up we're in and does the appropriate stuff, if any.
if (doCloseUp(_closeDataPtr)) {
_closeDataPtr = nullptr;
diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp
index 42262bf..8045c51 100644
--- a/engines/lab/music.cpp
+++ b/engines/lab/music.cpp
@@ -45,7 +45,6 @@ namespace Lab {
Music::Music(LabEngine *vm) : _vm(vm) {
_musicFile = nullptr;
- _musicPaused = false;
_curRoomMusic = 1;
_storedPos = 0;
}
@@ -64,7 +63,6 @@ void Music::changeMusic(const Common::String filename, bool storeCurPos, bool se
if (storeCurPos)
_storedPos = _musicFile->pos();
- _musicPaused = false;
stopSoundEffect();
freeMusic();
_musicFile = _vm->_resource->openDataFile(filename);
@@ -76,7 +74,6 @@ void Music::changeMusic(const Common::String filename, bool storeCurPos, bool se
}
void Music::playSoundEffect(uint16 sampleSpeed, uint32 length, bool loop, Common::File *dataFile) {
- pauseBackMusic();
stopSoundEffect();
// NOTE: We need to use malloc(), cause this will be freed with free()
@@ -100,26 +97,9 @@ bool Music::isSoundEffectActive() const {
void Music::freeMusic() {
_vm->_mixer->stopHandle(_musicHandle);
_vm->_mixer->stopHandle(_sfxHandle);
- _musicPaused = false;
_musicFile = nullptr;
}
-void Music::pauseBackMusic() {
- if (!_musicPaused) {
- stopSoundEffect();
- _vm->_mixer->pauseHandle(_musicHandle, true);
- _musicPaused = true;
- }
-}
-
-void Music::resumeBackMusic() {
- if (_musicPaused) {
- stopSoundEffect();
- _vm->_mixer->pauseHandle(_musicHandle, false);
- _musicPaused = false;
- }
-}
-
void Music::checkRoomMusic() {
if ((_curRoomMusic == _vm->_roomNum) || !_musicFile)
return;
diff --git a/engines/lab/music.h b/engines/lab/music.h
index a06bfca..09bb969 100644
--- a/engines/lab/music.h
+++ b/engines/lab/music.h
@@ -50,7 +50,6 @@ private:
LabEngine *_vm;
Common::File *_musicFile;
- bool _musicPaused;
uint16 _curRoomMusic;
uint32 _storedPos;
@@ -58,12 +57,7 @@ private:
Audio::SoundHandle _sfxHandle;
private:
- /**
- * Pauses the background music.
- */
- void pauseBackMusic();
void readSound(bool waitTillFinished, bool loop, Common::File *file);
-
byte getSoundFlags();
public:
@@ -92,11 +86,6 @@ public:
*/
bool loadSoundEffect(const Common::String filename, bool loop, bool waitTillFinished);
- /**
- * Resumes the paused background music.
- */
- void resumeBackMusic();
-
void stopSoundEffect();
};
More information about the Scummvm-git-logs
mailing list