[Scummvm-cvs-logs] scummvm master -> d1b5d41005ea89e20ae449e6ea815b1dfb5997e6

bluegr bluegr at gmail.com
Sat Dec 26 11:46:48 CET 2015


This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
d3369808f5 LAB: Document where some scene transitions are used
0b9126f774 LAB: Remove superfluous sound effect stopping code
e231c6753b LAB: Update music after drawing the map rooms
d1b5d41005 LAB: Clean up sound effect looping, starting and stopping code


Commit: d3369808f5c66faf19efbb14c2bada5d24df0c4e
    https://github.com/scummvm/scummvm/commit/d3369808f5c66faf19efbb14c2bada5d24df0c4e
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2015-12-26T12:39:18+02:00

Commit Message:
LAB: Document where some scene transitions are used

Changed paths:
    engines/lab/dispman.cpp



diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp
index 8ff6a61..f41975b 100644
--- a/engines/lab/dispman.cpp
+++ b/engines/lab/dispman.cpp
@@ -832,19 +832,19 @@ void DisplayMan::doTransition(TransitionType transitionType, CloseDataPtr *close
 	case kTransitionTransporter:
 		doTransWipe(closePtrList, filename);
 		break;
-	case kTransitionScrollWipe:
+	case kTransitionScrollWipe:		// only used in scene 7 (street, when teleporting to the surreal maze)
 		doScrollWipe(filename);
 		break;
-	case kTransitionScrollBlack:
+	case kTransitionScrollBlack:	// only used in scene 7 (street, when teleporting to the surreal maze)
 		doScrollBlack();
 		break;
-	case kTransitionScrollBounce:
+	case kTransitionScrollBounce:	// only used in scene 7 (street, when teleporting to the surreal maze)
 		doScrollBounce();
 		break;
-	case kTransitionReadFirstFrame:
+	case kTransitionReadFirstFrame:	// only used in scene 7 (street, when teleporting to the surreal maze)
 		readPict(filename, false);
 		break;
-	case kTransitionReadNextFrame:
+	case kTransitionReadNextFrame:	// only used in scene 7 (street, when teleporting to the surreal maze)
 		_vm->_anim->diffNextFrame();
 		break;
 	case kTransitionNone:


Commit: 0b9126f7749a31541d491dc2e1f8af401766788e
    https://github.com/scummvm/scummvm/commit/0b9126f7749a31541d491dc2e1f8af401766788e
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2015-12-26T12:42:45+02:00

Commit Message:
LAB: Remove superfluous sound effect stopping code

Changed paths:
    engines/lab/dispman.cpp
    engines/lab/map.cpp



diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp
index f41975b..4f0f2b5 100644
--- a/engines/lab/dispman.cpp
+++ b/engines/lab/dispman.cpp
@@ -88,10 +88,6 @@ void DisplayMan::readPict(const Common::String filename, bool playOnce, bool onl
 	_vm->_anim->stopDiff();
 	loadPict(filename);
 	_vm->updateMusicAndEvents();
-
-	if (!_vm->_music->_loopSoundEffect)
-		_vm->_music->stopSoundEffect();
-
 	_vm->_anim->setOutputBuffer(memoryBuffer);
 	_vm->_anim->readDiff(_curBitmap, playOnce, onlyDiffData);
 }
diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp
index 21a0830..7d1645f 100644
--- a/engines/lab/map.cpp
+++ b/engines/lab/map.cpp
@@ -83,8 +83,6 @@ void LabEngine::loadMapData() {
 
 	Common::File *mapFile = _resource->openDataFile("Lab:Maps", MKTAG('M', 'A', 'P', '0'));
 	updateMusicAndEvents();
-	if (!_music->_loopSoundEffect)
-		_music->stopSoundEffect();
 
 	_maxRooms = mapFile->readUint16LE();
 	_maps = new MapData[_maxRooms + 1];	// will be freed when the user exits the map


Commit: e231c6753bdc9ccdcae5497ef55af9afcd74edca
    https://github.com/scummvm/scummvm/commit/e231c6753bdc9ccdcae5497ef55af9afcd74edca
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2015-12-26T12:43:18+02:00

Commit Message:
LAB: Update music after drawing the map rooms

Changed paths:
    engines/lab/map.cpp



diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp
index 7d1645f..d96631f 100644
--- a/engines/lab/map.cpp
+++ b/engines/lab/map.cpp
@@ -337,10 +337,11 @@ void LabEngine::drawMap(uint16 curRoom, uint16 curMsg, uint16 floorNum, bool fad
 	for (int i = 1; i <= _maxRooms; i++) {
 		if ((_maps[i]._pageNumber == floorNum) && _roomsFound->in(i) && _maps[i]._x) {
 			drawRoomMap(i, (bool)(i == curRoom));
-			updateMusicAndEvents();
 		}
 	}
 
+	updateMusicAndEvents();
+
 	// Makes sure the X is drawn in corridors
 	// NOTE: this here on purpose just in case there's some weird
 	// condition, like the surreal maze where there are no rooms


Commit: d1b5d41005ea89e20ae449e6ea815b1dfb5997e6
    https://github.com/scummvm/scummvm/commit/d1b5d41005ea89e20ae449e6ea815b1dfb5997e6
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2015-12-26T12:45:48+02:00

Commit Message:
LAB: Clean up sound effect looping, starting and stopping code

Changed paths:
    engines/lab/anim.cpp
    engines/lab/music.cpp
    engines/lab/music.h
    engines/lab/processroom.cpp



diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp
index eb825fb..92ca49b 100644
--- a/engines/lab/anim.cpp
+++ b/engines/lab/anim.cpp
@@ -217,7 +217,9 @@ void Anim::diffNextFrame(bool onlyDiffData) {
 			_sampleSpeed = _diffFile->readUint16LE();
 			_diffFile->skip(2);
 
-			_vm->_music->playSoundEffect(_sampleSpeed, _size, _diffFile);
+			// Sound effects embedded in animations are started here. These are
+			// usually animation-specific, like door opening sounds, and are not looped
+			_vm->_music->playSoundEffect(_sampleSpeed, _size, false, _diffFile);
 			break;
 
 		case 65535:
diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp
index 95581ae..c46e3a1 100644
--- a/engines/lab/music.cpp
+++ b/engines/lab/music.cpp
@@ -56,7 +56,6 @@ Music::Music(LabEngine *vm) : _vm(vm) {
 	_leftInFile = 0;
 
 	_musicOn = false;
-	_loopSoundEffect = false;
 	_queuingAudioStream = nullptr;
 	_lastMusicRoom = 1;
 	_doReset = true;
@@ -95,7 +94,7 @@ uint16 Music::getPlayingBufferCount() {
 	return (_queuingAudioStream) ? _queuingAudioStream->numQueuedStreams() : 0;
 }
 
-void Music::playSoundEffect(uint16 sampleSpeed, uint32 length, Common::File *dataFile) {
+void Music::playSoundEffect(uint16 sampleSpeed, uint32 length, bool loop, Common::File *dataFile) {
 	pauseBackMusic();
 	stopSoundEffect();
 
@@ -114,7 +113,7 @@ void Music::playSoundEffect(uint16 sampleSpeed, uint32 length, Common::File *dat
 	dataFile->read(soundData, length);
 
 	Audio::SeekableAudioStream *audioStream = Audio::makeRawStream((const byte *)soundData, length, sampleSpeed, soundFlags);
-	uint loops = (_loopSoundEffect) ? 0 : 1;
+	uint loops = (loop) ? 0 : 1;
 	Audio::LoopingAudioStream *loopingAudioStream = new Audio::LoopingAudioStream(audioStream, loops);
 	_vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, loopingAudioStream);
 }
@@ -274,22 +273,21 @@ void Music::resetMusic() {
 	_tFile = 0;
 }
 
-bool Music::readMusic(const Common::String filename, bool waitTillFinished) {
+bool Music::readMusic(const Common::String filename, bool loop, bool waitTillFinished) {
 	Common::File *file = _vm->_resource->openDataFile(filename, MKTAG('D', 'I', 'F', 'F'));
 	_vm->updateMusicAndEvents();
-	if (!_loopSoundEffect)
-		stopSoundEffect();
+	stopSoundEffect();
 
 	if (!file)
 		return false;
 
 	_vm->_anim->_doBlack = false;
-	readSound(waitTillFinished, file);
+	readSound(waitTillFinished, loop, file);
 
 	return true;
 }
 
-void Music::readSound(bool waitTillFinished, Common::File *file) {
+void Music::readSound(bool waitTillFinished, bool loop, Common::File *file) {
 	uint32 magicBytes = file->readUint32LE();
 	if (magicBytes != 1219009121) {
 		warning("readSound: Bad signature, skipping");
@@ -320,7 +318,7 @@ void Music::readSound(bool waitTillFinished, Common::File *file) {
 
 			uint16 sampleRate = file->readUint16LE();
 			file->skip(2);
-			playSoundEffect(sampleRate, soundSize, file);
+			playSoundEffect(sampleRate, soundSize, loop, file);
 		} else if (soundTag == 65535) {
 			if (waitTillFinished) {
 				while (isSoundEffectActive()) {
diff --git a/engines/lab/music.h b/engines/lab/music.h
index 42fdf41..1a3fd24 100644
--- a/engines/lab/music.h
+++ b/engines/lab/music.h
@@ -74,7 +74,7 @@ private:
 	 * Pauses the background music.
 	 */
 	void pauseBackMusic();
-	void readSound(bool waitTillFinished, Common::File *file);
+	void readSound(bool waitTillFinished, bool loop, Common::File *file);
 
 	/**
 	 * Starts up the music initially.
@@ -82,9 +82,6 @@ private:
 	void startMusic(bool restartFl);
 
 public:
-	bool _loopSoundEffect;
-
-public:
 	Music(LabEngine *vm);
 
 	/**
@@ -107,12 +104,12 @@ public:
 	 */
 	bool initMusic(const Common::String filename);
 	bool isSoundEffectActive() const;
-	void playSoundEffect(uint16 sampleSpeed, uint32 length, Common::File *dataFile);
+	void playSoundEffect(uint16 sampleSpeed, uint32 length, bool loop, Common::File *dataFile);
 
 	/**
 	 * Reads in a music file.  Ignores any graphics.
 	 */
-	bool readMusic(const Common::String filename, bool waitTillFinished);
+	bool readMusic(const Common::String filename, bool loop, bool waitTillFinished);
 
 	/**
 	 * Changes the background music to the original piece playing.
diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp
index 4d42f96..b955306 100644
--- a/engines/lab/processroom.cpp
+++ b/engines/lab/processroom.cpp
@@ -239,18 +239,15 @@ void LabEngine::doActions(const ActionList &actionList, CloseDataPtr *closePtrLi
 
 		switch (action->_actionType) {
 		case kActionPlaySound:
-			_music->_loopSoundEffect = false;
-			_music->readMusic(action->_messages[0], true);
+			_music->readMusic(action->_messages[0], false, true);
 			break;
 
-		case kActionPlaySoundNoWait:
-			_music->_loopSoundEffect = false;
-			_music->readMusic(action->_messages[0], false);
+		case kActionPlaySoundNoWait:	// only used in scene 7 (street, when teleporting to the surreal maze)
+			_music->readMusic(action->_messages[0], false, false);
 			break;
 
 		case kActionPlaySoundLooping:
-			_music->_loopSoundEffect = true;
-			_music->readMusic(action->_messages[0], false);
+			_music->readMusic(action->_messages[0], true, false);
 			break;
 
 		case kActionShowDiff:
@@ -411,12 +408,7 @@ void LabEngine::doActions(const ActionList &actionList, CloseDataPtr *closePtrLi
 			break;
 
 		case kActionClearSound:
-			if (_music->_loopSoundEffect) {
-				_music->_loopSoundEffect = false;
-				_music->stopSoundEffect();
-			} else if (_music->isSoundEffectActive())
-				_music->stopSoundEffect();
-
+			_music->stopSoundEffect();
 			break;
 
 		case kActionWinMusic:
@@ -474,16 +466,7 @@ void LabEngine::doActions(const ActionList &actionList, CloseDataPtr *closePtrLi
 		}
 	}
 
-	if (_music->_loopSoundEffect) {
-		_music->_loopSoundEffect = false;
-		_music->stopSoundEffect();
-	} else {
-		while (_music->isSoundEffectActive()) {
-			updateMusicAndEvents();
-			_anim->diffNextFrame();
-			waitTOF();
-		}
-	}
+	_music->stopSoundEffect();
 }
 
 bool LabEngine::doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr closePtr, CloseDataPtr *setCloseList, bool allowDefaults) {






More information about the Scummvm-git-logs mailing list