Browse code

[NCSF] Reversed the order of the PSG and Noise channel allocations.

This was suggested by fincs as the proper way to fix channels being
cutoff incorrectly.
(Also moved volume assignment so it was less duplicated.)

Naram Qashat authored on 2014/10/23 23:05:57
Showing 2 changed files
... ...
@@ -79,8 +79,8 @@ void Player::Stop(bool bKillSound)
79 79
 int Player::ChannelAlloc(int type, int priority)
80 80
 {
81 81
 	static const uint8_t pcmChnArray[] = { 4, 5, 6, 7, 2, 0, 3, 1, 8, 9, 10, 11, 14, 12, 15, 13 };
82
-	static const uint8_t psgChnArray[] = { 13, 12, 11, 10, 9, 8 };
83
-	static const uint8_t noiseChnArray[] = { 15, 14 };
82
+	static const uint8_t psgChnArray[] = { 8, 9, 10, 11, 12, 13 };
83
+	static const uint8_t noiseChnArray[] = { 14, 15 };
84 84
 	static const uint8_t arraySizes[] = { sizeof(pcmChnArray), sizeof(psgChnArray), sizeof(noiseChnArray) };
85 85
 	static const uint8_t *const arrayArray[] = { pcmChnArray, psgChnArray, noiseChnArray };
86 86
 
... ...
@@ -107,7 +107,7 @@ int Player::ChannelAlloc(int type, int priority)
107 107
 		return -1;
108 108
 	this->channels[curChnNo].ply = this;
109 109
 	this->channels[curChnNo].noteLength = -1;
110
-	this->channels[curChnNo].vol = 0;
110
+	this->channels[curChnNo].vol = 0x7FF;
111 111
 	return curChnNo;
112 112
 }
113 113
 
... ...
@@ -194,7 +194,6 @@ int Track::NoteOn(int key, int vel, int len)
194 194
 	chn->modDelayCnt = 0;
195 195
 	chn->modCounter = 0;
196 196
 	chn->noteLength = len;
197
-	chn->vol = 0x7FF;
198 197
 	chn->reg.sampleIncrease = 0;
199 198
 
200 199
 	chn->attackLvl = Cnv_Attack(this->a == 0xFF ? noteDef->attackRate : this->a);