[Scummvm-cvs-logs] scummvm master -> ed33dee7539c6b05f7dba18fb87cdd44c09ba3cd

dreammaster dreammaster at scummvm.org
Fri Mar 13 13:44:30 CET 2015


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:
ed33dee753 MADS: Fix distortions when playing many of the sounds


Commit: ed33dee7539c6b05f7dba18fb87cdd44c09ba3cd
    https://github.com/scummvm/scummvm/commit/ed33dee7539c6b05f7dba18fb87cdd44c09ba3cd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-03-13T08:43:27-04:00

Commit Message:
MADS: Fix distortions when playing many of the sounds

Changed paths:
    engines/mads/nebular/sound_nebular.cpp



diff --git a/engines/mads/nebular/sound_nebular.cpp b/engines/mads/nebular/sound_nebular.cpp
index d41d007..6412654 100644
--- a/engines/mads/nebular/sound_nebular.cpp
+++ b/engines/mads/nebular/sound_nebular.cpp
@@ -594,7 +594,7 @@ void ASound::pollActiveChannel() {
 						break;
 
 					case 8:
-						chan->_field1D = *++pSrc;
+						chan->_field1D = (int8)*++pSrc;
 						chan->_pSrc += 2;
 						break;
 
@@ -733,8 +733,8 @@ void ASound::updateChannelState() {
 		resultCheck();
 	} else {
 		int reg = 0xA0 + _activeChannelNumber;
-		int vTimes = (_activeChannelPtr->_field4 + _activeChannelPtr->_field1F) / 12;
-		int vOffset = (_activeChannelPtr->_field4 + _activeChannelPtr->_field1F) % 12;
+		int vTimes = (byte)(_activeChannelPtr->_field4 + _activeChannelPtr->_field1F) / 12;
+		int vOffset = (byte)(_activeChannelPtr->_field4 + _activeChannelPtr->_field1F) % 12;
 		int val = _vList1[vOffset] + _activeChannelPtr->_field1D;
 		write2(8, reg, val & 0xFF);
 
@@ -751,17 +751,6 @@ static const int outputIndexes[] = {
 static const int outputChannels[] = {
 	0, 1, 2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 16, 17, 18, 19, 20, 21, 0
 };
-static const int volumeList[] = {
-	0x3F, 0x3F, 0x36, 0x31, 0x2D, 0x2A, 0x28, 0x26, 0x24, 0x22, 0x21, 0x20, 0x1F, 0x1E, 0x1D, 0x1C,
-	0x1B, 0x1A, 0x19, 0x19, 0x18, 0x17, 0x17, 0x16, 0x16, 0x15, 0x15, 0x14, 0x14, 0x13, 0x12, 0x12,
-	0x11, 0x11, 0x10, 0x10, 0x0F, 0x0F, 0x0E, 0x0E, 0x0D, 0x0D, 0x0C, 0x0C, 0x0B, 0x0B, 0x0A, 0x0A,
-	0x0A, 0x09, 0x09, 0x09, 0x09, 0x09, 0x08, 0x08, 0x08, 0x08, 0x08, 0x07, 0x07, 0x07, 0x07, 0x07,
-	0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x04,
-	0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
-	0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01,
-	0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
 
 void ASound::updateActiveChannel() {
 	int reg = 0x40 + outputChannels[outputIndexes[_activeChannelNumber * 2 + 1]];
@@ -770,13 +759,9 @@ void ASound::updateActiveChannel() {
 
 	// Note: Original had a whole block not seeming to be used, since the initialisation
 	// sets a variable to 5660h, and doesn't change it, so the branch is never taken
-	int val = CLIP(newVolume - volumeList[_activeChannelPtr->_fieldD], 0, 63);
-	val = (63 - val) | portVal;
+	portVal |= 63 - newVolume;
 
-	int val2 = CLIP(newVolume - volumeList[-(_activeChannelPtr->_fieldD - 127)], 0, 63);
-	val2 = (63 - val2) | portVal;
-	write2(0, reg, val);
-	write2(2, reg, val2);
+	write2(8, reg, portVal);
 }
 
 void ASound::loadSample(int sampleIndex) {






More information about the Scummvm-git-logs mailing list