Browse code

[NCSF] Removed the Cnv_Scale function as it seemed to cause sounds to be too loud in some cases.

Naram Qashat authored on 2014/10/05 20:17:36
Showing 3 changed files
... ...
@@ -71,8 +71,8 @@ Channel::Channel() : chnId(-1), tempReg(), state(CS_NONE), trackId(-1), prio(0),
71 71
 void Channel::UpdateVol(const Track &trk)
72 72
 {
73 73
 	int finalVol = trk.ply->masterVol;
74
-	finalVol += Cnv_Scale(trk.vol);
75
-	finalVol += Cnv_Scale(trk.expr);
74
+	finalVol += Cnv_Sust(trk.vol);
75
+	finalVol += Cnv_Sust(trk.expr);
76 76
 	this->extAmpl = finalVol;
77 77
 }
78 78
 
... ...
@@ -187,7 +187,7 @@ int Track::NoteOn(int key, int vel, int len)
187 187
 	chn->prio = this->prio;
188 188
 	chn->key = key;
189 189
 	chn->orgKey = bIsPCM ? noteDef->noteNumber : 69;
190
-	chn->velocity = Cnv_Scale(vel);
190
+	chn->velocity = Cnv_Sust(vel);
191 191
 	chn->pan = static_cast<int>(noteDef->pan) - 64;
192 192
 	chn->modDelayCnt = 0;
193 193
 	chn->modCounter = 0;
... ...
@@ -229,7 +229,7 @@ int Track::NoteOnTie(int key, int vel)
229 229
 	chn->flags.reset();
230 230
 	chn->prio = this->prio;
231 231
 	chn->key = key;
232
-	chn->velocity = Cnv_Scale(vel);
232
+	chn->velocity = Cnv_Sust(vel);
233 233
 	chn->modDelayCnt = 0;
234 234
 	chn->modCounter = 0;
235 235
 
... ...
@@ -161,33 +161,6 @@ inline int Cnv_Fall(int fall)
161 161
 		return (0x1E00 / (0x7E - fall)) & 0xFFFF;
162 162
 }
163 163
 
164
-// This function actually doesn't come from FSS, I got the lookup table from the Nintendo DS SDK.
165
-inline int Cnv_Scale(int scale)
166
-{
167
-	static const int16_t lut[] =
168
-	{
169
-		-32768, -421, -361, -325, -300, -281, -265, -252,
170
-		-240, -230, -221, -212, -205, -198, -192, -186,
171
-		-180, -175, -170, -165, -161, -156, -152, -148,
172
-		-145, -141, -138, -134, -131, -128, -125, -122,
173
-		-120, -117, -114, -112, -110, -107, -105, -103,
174
-		-100, -98, -96, -94, -92, -90, -88, -86,
175
-		-85, -83, -81, -79, -78, -76, -74, -73,
176
-		-71, -70, -68, -67, -65, -64, -62, -61,
177
-		-60, -58, -57, -56, -54, -53, -52, -51,
178
-		-49, -48, -47, -46, -45, -43, -42, -41,
179
-		-40, -39, -38, -37, -36, -35, -34, -33,
180
-		-32, -31, -30, -29, -28, -27, -26, -25,
181
-		-24, -23, -23, -22, -21, -20, -19, -18,
182
-		-17, -17, -16, -15, -14, -13, -12, -12,
183
-		-11, -10, -9, -9, -8, -7, -6, -6,
184
-		-5, -4, -3, -3, -2, -1, -1, 0
185
-	};
186
-	if (scale & 0x80)
187
-		scale = 0x7F;
188
-	return lut[scale];
189
-}
190
-
191 164
 inline int Cnv_Sust(int sust)
192 165
 {
193 166
 	static const int16_t lut[] =