[Scummvm-git-logs] scummvm master -> 419009b684d8ebcc7c6110f0793c24b16f13198b

yuv422 yuv422 at users.noreply.github.com
Sat Sep 5 12:03:02 UTC 2020


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

Summary:
419009b684 DRAGONS: Fixed music volume when starting game.


Commit: 419009b684d8ebcc7c6110f0793c24b16f13198b
    https://github.com/scummvm/scummvm/commit/419009b684d8ebcc7c6110f0793c24b16f13198b
Author: Eric Fry (yuv422 at users.noreply.github.com)
Date: 2020-09-05T22:01:16+10:00

Commit Message:
DRAGONS: Fixed music volume when starting game.

Changed paths:
    engines/dragons/dragons.cpp
    engines/dragons/midimusicplayer.cpp
    engines/dragons/midimusicplayer.h


diff --git a/engines/dragons/dragons.cpp b/engines/dragons/dragons.cpp
index de54ab540e..47353ced2e 100644
--- a/engines/dragons/dragons.cpp
+++ b/engines/dragons/dragons.cpp
@@ -250,6 +250,8 @@ Common::Error DragonsEngine::run() {
 	_sound = new SoundManager(this, _bigfileArchive, _dragonRMS);
 	_strPlayer = new StrPlayer(this, _screen);
 
+	syncSoundSettings();
+
 	if (ConfMan.hasKey("save_slot")) {
 		loadGameState(ConfMan.getInt("save_slot"));
 	} else {
@@ -1813,7 +1815,9 @@ void DragonsEngine::clearAllText() {
 
 void DragonsEngine::syncSoundSettings() {
 	Engine::syncSoundSettings();
-	_sound->syncSoundSettings();
+	if (_sound) {
+		_sound->syncSoundSettings();
+	}
 }
 
 uint16 DragonsEngine::getCursorHandPointerSequenceID() {
diff --git a/engines/dragons/midimusicplayer.cpp b/engines/dragons/midimusicplayer.cpp
index c019115b4f..5b4769be62 100644
--- a/engines/dragons/midimusicplayer.cpp
+++ b/engines/dragons/midimusicplayer.cpp
@@ -141,6 +141,19 @@ void MidiMusicPlayer::setVolume(int volume) {
 	MidiPlayer::setVolume(volume);
 }
 
+void MidiMusicPlayer::sendToChannel(byte channel, uint32 b) {
+	if (!_channelsTable[channel]) {
+		_channelsTable[channel] = (channel == 9) ? _driver->getPercussionChannel() : _driver->allocateChannel();
+		// If a new channel is allocated during the playback, make sure
+		// its volume is correctly initialized.
+		if (_channelsTable[channel])
+			_channelsTable[channel]->volume(_channelsVolume[channel] * _masterVolume / 255);
+	}
+
+	if (_channelsTable[channel])
+		_channelsTable[channel]->send(b);
+}
+
 Common::SeekableReadStream *MidiMusicPlayer::loadSoundFont(BigfileArchive *bigFileArchive) {
 	uint32 headSize, bodySize;
 	byte *headData = bigFileArchive->load("musx.vh", headSize);
diff --git a/engines/dragons/midimusicplayer.h b/engines/dragons/midimusicplayer.h
index 155aa64818..fa6d450c0e 100644
--- a/engines/dragons/midimusicplayer.h
+++ b/engines/dragons/midimusicplayer.h
@@ -43,6 +43,8 @@ public:
 	// The original sets the "sequence timing" to 109 Hz, whatever that
 	// means. The default is 120.
 	uint32 getBaseTempo()	{ return _driver ? (109 * _driver->getBaseTempo()) / 120 : 0; }
+
+	void sendToChannel(byte channel, uint32 b) override;
 private:
 	byte *resizeMidiBuffer(uint32 desiredSize);
 	Common::SeekableReadStream *loadSoundFont(BigfileArchive *bigFileArchive);




More information about the Scummvm-git-logs mailing list