[Scummvm-git-logs] scummvm master -> 00d85389a86011d0a11a1e7c249cb19ab6d0841e

whiterandrek whiterandrek at gmail.com
Sun May 17 11:23:38 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:
00d85389a8 PETKA: implemented sound balance in dialog


Commit: 00d85389a86011d0a11a1e7c249cb19ab6d0841e
    https://github.com/scummvm/scummvm/commit/00d85389a86011d0a11a1e7c249cb19ab6d0841e
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2020-05-17T14:21:18+03:00

Commit Message:
PETKA: implemented sound balance in dialog

Changed paths:
    engines/petka/interfaces/dialog_interface.cpp
    engines/petka/sound.cpp


diff --git a/engines/petka/interfaces/dialog_interface.cpp b/engines/petka/interfaces/dialog_interface.cpp
index 5d9cf1ace0..e1d8cc6031 100644
--- a/engines/petka/interfaces/dialog_interface.cpp
+++ b/engines/petka/interfaces/dialog_interface.cpp
@@ -29,6 +29,8 @@
 #include "petka/q_system.h"
 #include "petka/big_dialogue.h"
 #include "petka/sound.h"
+#include "petka/flc.h"
+#include "petka/q_manager.h"
 
 namespace Petka {
 
@@ -110,14 +112,15 @@ void DialogInterface::next(int choice) {
 		if (prevTalkerId != currTalkerId) {
 			sendMsg(kSaid);
 		}
+		_talker = qsys->findObject(currTalkerId);
 		_soundName = g_vm->getSpeechPath() + soundName;
 		Sound *s = g_vm->soundMgr()->addSound(_soundName, Audio::Mixer::kSpeechSoundType);
 		if (s) {
-			// todo pan
+			Common::Rect bounds = g_vm->resMgr()->loadFlic(_talker->_resourceId)->getBounds();
+			s->setBalance(bounds.left + _talker->_x + bounds.width(), 640);
 			s->play(0);
 		}
 		_hasSound = s != nullptr;
-		_talker = qsys->findObject(currTalkerId);
 		if (prevTalkerId != currTalkerId) {
 			sendMsg(kSay);
 		}
diff --git a/engines/petka/sound.cpp b/engines/petka/sound.cpp
index 251013d9f7..3ab32cc800 100644
--- a/engines/petka/sound.cpp
+++ b/engines/petka/sound.cpp
@@ -64,6 +64,7 @@ void Sound::stop() {
 }
 
 void Sound::setBalance(uint16 x, uint16 width) {
+	// original scales from -12.5 db to 12.5 db
 	g_system->getMixer()->setChannelBalance(_handle, (int8)(255 * (2 * x - width) / (2 * width)));
 }
 




More information about the Scummvm-git-logs mailing list