From 2975ef3ebeffe1beb6857c0cc0336d2dd515440d Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 3 May 2014 11:18:47 +0300 Subject: FULLPIPE: Implement FullpipeEngine::stopAllSounds() --- engines/fullpipe/sound.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'engines/fullpipe/sound.cpp') diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index 3c13bad854..06e664faf9 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -298,8 +298,12 @@ void FullpipeEngine::startSoundStream1(char *trackName) { } void FullpipeEngine::stopAllSounds() { - // TODO: Differences from stopAllSoundStreams() - _mixer->stopAll(); + // _mixer->stopAll(); + + for (int i = 0; i < _currSoundListCount; i++) + for (int j = 0; i < _currSoundList1[i]->getCount(); j++) { + _currSoundList1[i]->getSoundByIndex(j)->stop(); + } } void FullpipeEngine::toggleMute() { -- cgit v1.2.3 From a708e4ffc9daaece6a2fae8512c0f754101ec945 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 3 May 2014 11:22:45 +0300 Subject: FULLPIPE: Implement FullpipeEngine::setMusicVolume() --- engines/fullpipe/sound.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/fullpipe/sound.cpp') diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index 06e664faf9..3578e2a1df 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -451,7 +451,7 @@ void FullpipeEngine::updateSoundVolume() { void FullpipeEngine::setMusicVolume(int vol) { _musicVolume = vol; - debug(3, "STUB FullpipeEngine::setMusicVolume()"); + g_fp->_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, vol); } } // End of namespace Fullpipe -- cgit v1.2.3 From b07a833b639fa90c1306bcf1674f3f244ceba043 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 14 May 2014 11:33:19 +0200 Subject: FULLPIPE: Fix mistypo in FullpipeEngine::stopAllSounds() which lead to crash --- engines/fullpipe/sound.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/fullpipe/sound.cpp') diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index 3578e2a1df..ced5c75850 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -301,7 +301,7 @@ void FullpipeEngine::stopAllSounds() { // _mixer->stopAll(); for (int i = 0; i < _currSoundListCount; i++) - for (int j = 0; i < _currSoundList1[i]->getCount(); j++) { + for (int j = 0; j < _currSoundList1[i]->getCount(); j++) { _currSoundList1[i]->getSoundByIndex(j)->stop(); } } -- cgit v1.2.3 From 5a80e828e67a6a8b2dbdcbda252e673ffec910e1 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 30 May 2014 08:03:17 +0300 Subject: FULLPIPE: Implement Sound::setPanAndVolumeByStaticAni() --- engines/fullpipe/sound.cpp | 72 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) (limited to 'engines/fullpipe/sound.cpp') diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index ced5c75850..65c9bf84ca 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -27,6 +27,8 @@ #include "fullpipe/sound.h" #include "fullpipe/ngiarchive.h" #include "fullpipe/messages.h" +#include "fullpipe/statics.h" + #include "common/memstream.h" #include "audio/audiostream.h" #include "audio/decoders/vorbis.h" @@ -132,7 +134,75 @@ void Sound::updateVolume() { } void Sound::setPanAndVolumeByStaticAni() { - debug(3, "STUB Sound::setPanAndVolumeByStaticAni()"); + if (!_objectId) + return; + + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObject1ById(_objectId, -1); + if (!ani) + return; + + int a, b; + + if (ani->_ox >= g_fp->_sceneRect.left) { + int par, pan; + + if (ani->_ox <= g_fp->_sceneRect.right) { + int dx; + + if (ani->_oy <= g_fp->_sceneRect.bottom) { + if (ani->_oy >= g_fp->_sceneRect.top) { + setPanAndVolume(g_fp->_sfxVolume, 0); + + return; + } + dx = g_fp->_sceneRect.top - ani->_oy; + } else { + dx = ani->_oy - g_fp->_sceneRect.bottom; + } + + par = 0; + + if (dx > 800) { + setPanAndVolume(-3500, 0); + return; + } + + pan = -3500; + a = g_fp->_sfxVolume - (-3500); + b = 800 - dx; + } else { + int dx = ani->_ox - g_fp->_sceneRect.right; + + if (dx > 800) { + setPanAndVolume(-3500, 0); + return; + } + + pan = -3500; + par = dx * (-3500) / -800; + a = g_fp->_sfxVolume - (-3500); + b = 800 - dx; + } + + int32 pp = b * a; + + setPanAndVolume(pan + pp / 800, par); + + return; + } + + int dx = g_fp->_sceneRect.left - ani->_ox; + if (dx <= 800) { + int32 s = (800 - dx) * (g_fp->_sfxVolume - (-3500)); + int32 p = -3500 + s / 800; + + if (p > g_fp->_sfxVolume) + p = g_fp->_sfxVolume; + + setPanAndVolume(p, dx * (-3500) / 800); + } else { + setPanAndVolume(-3500, 0); + } } void Sound::setPanAndVolume(int vol, int pan) { -- cgit v1.2.3