[Scummvm-git-logs] scummvm master -> 55ff2f91bca4b2d3d1251e9ac716ed977d315a86

yuv422 yuv422 at users.noreply.github.com
Sat Aug 29 04:41:23 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:
55ff2f91bc DRAGONS: Play sfx from vab tone range.


Commit: 55ff2f91bca4b2d3d1251e9ac716ed977d315a86
    https://github.com/scummvm/scummvm/commit/55ff2f91bca4b2d3d1251e9ac716ed977d315a86
Author: Eric Fry (yuv422 at users.noreply.github.com)
Date: 2020-08-29T14:39:37+10:00

Commit Message:
DRAGONS: Play sfx from vab tone range.

Changed paths:
    engines/dragons/sound.cpp
    engines/dragons/vabsound.cpp


diff --git a/engines/dragons/sound.cpp b/engines/dragons/sound.cpp
index e55de24e89..2bf6dc935e 100644
--- a/engines/dragons/sound.cpp
+++ b/engines/dragons/sound.cpp
@@ -441,8 +441,12 @@ void SoundManager::playSound(uint16 soundId, uint16 volumeId) {
 	if (vagID >= 0) {
 		Audio::SoundHandle *handle = getVoiceHandle(soundId);
 		if (handle) {
+			//TODO need to handle sfx where the requested key doesn't match the vag tone.
+			// We need to change pitch in this case.
 			_vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, handle, vabSound->getAudioStream(program, vagID), -1, _sfxVolume);
 		}
+	} else {
+		warning("Sound not found Program: %d, key %d", program, key);
 	}
 }
 
diff --git a/engines/dragons/vabsound.cpp b/engines/dragons/vabsound.cpp
index 3239a35318..1589ac3dd8 100644
--- a/engines/dragons/vabsound.cpp
+++ b/engines/dragons/vabsound.cpp
@@ -158,7 +158,11 @@ void VabSound::loadToneAttributes(Common::SeekableReadStream *vhData) {
 int16 VabSound::getVagID(uint16 program, uint16 key) {
 	if (program < _header.numVAG) {
 		for (int i = 0; i < _programAttrs[program].tones; i++) {
-			if (_toneAttrs[i].prog == program && _toneAttrs[i].min == key && _toneAttrs[i].max == key) {
+			if (_toneAttrs[i].prog == program && _toneAttrs[i].min <= key && _toneAttrs[i].max >= key) {
+				if (key != _toneAttrs[i].min) {
+					warning("Sfx key requested doesn't exactly match vab tone. TODO we need to change the playback pitch. key requested: %d tone match (min,max) (%d, %d)",
+						key, _toneAttrs[i].min, _toneAttrs[i].max);
+				}
 				return _toneAttrs[i].vag - 1;
 			}
 		}




More information about the Scummvm-git-logs mailing list