From 15bc708610822d98133ff5fefb52ca55fa8ddd83 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 16 Jun 2011 22:00:33 +1000 Subject: TSAGE: Bugfix for _sfRethinkVoiceTypes type 1 handling --- engines/tsage/sound.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'engines/tsage/sound.cpp') diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp index f8f0cf6019..61254bb21f 100644 --- a/engines/tsage/sound.cpp +++ b/engines/tsage/sound.cpp @@ -778,6 +778,7 @@ void SoundManager::_sfRethinkVoiceTypes() { int maxPriority = 0; for (uint idx = 0; idx < vtStruct->_entries.size(); ++idx) maxPriority = MAX(maxPriority, vtStruct->_entries[idx]._type1._priority2); + if (!maxPriority) { _sfUpdateVoiceStructs2(); break; @@ -793,11 +794,11 @@ void SoundManager::_sfRethinkVoiceTypes() { } } while (chNumVoices > numVoices); - int voicesCtr = numVoices; + int voicesCtr = chNumVoices; for (uint idx = 0; (idx < vtStruct->_entries.size()) && (voicesCtr > 0); ++idx) { if (!vtStruct->_entries[idx]._type1._sound2) { vtStruct->_entries[idx]._type1._sound2 = sound; - vtStruct->_entries[idx]._type1._channelNum2 = idx; + vtStruct->_entries[idx]._type1._channelNum2 = foundIndex; vtStruct->_entries[idx]._type1._priority2 = foundPriority; --voicesCtr; } @@ -2509,7 +2510,17 @@ void AdlibSoundDriver::setPitch(int channel, int pitchBlend) { void AdlibSoundDriver::write(byte reg, byte value) { static int num = 1; -debug("%d [%x]=%x", num++, reg, value);//***DEBUG**** +/* + if (((num - 1) % 8) == 0) + debugN("\n9800:%.4x ", (num - 1) * 2 + 2); + + debugN("%.2x %.2x ", reg, value); + ++num; +*/ +debugN("%d [%x]=%x ", num++, reg, value);//***DEBUG**** + for (int idx = 0; idx < 16; ++idx) debugN("%d", _channelVoiced[idx] ? 1 : 0); + debugN("\n"); + _portContents[reg] = value; OPLWriteReg(_opl, reg, value); } -- cgit v1.2.3