[Scummvm-cvs-logs] CVS: scummvm/backends/midi/mt32 part.cpp,1.4,1.5 partial.cpp,1.12,1.13 partial.h,1.7,1.8 partialManager.cpp,1.3,1.4 structures.h,1.11,1.12 synth.cpp,1.28,1.29
Jerome Fisher
kingguppy at users.sourceforge.net
Sun Nov 28 13:09:17 CET 2004
Update of /cvsroot/scummvm/scummvm/backends/midi/mt32
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27488
Modified Files:
part.cpp partial.cpp partial.h partialManager.cpp structures.h
synth.cpp
Log Message:
- Cleanup.
- Signedness fix.
- Changed partial age to 32-bit... They don't exactly run until the heat-death of the universe.
Index: part.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/midi/mt32/part.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- part.cpp 28 Nov 2004 05:35:07 -0000 1.4
+++ part.cpp 28 Nov 2004 21:08:36 -0000 1.5
@@ -46,7 +46,7 @@
return partials[0] != NULL || partials[1] != NULL || partials[2] != NULL || partials[3] != NULL;
}
-Bit64s dpoly::getAge() const {
+Bit32u dpoly::getAge() const {
for (int i = 0; i < 4; i++) {
if (partials[i] != NULL) {
return partials[i]->age;
@@ -582,7 +582,7 @@
// Find oldest poly... yes, the MT-32 can be reconfigured to kill different poly first
// This is simplest
int oldest = -1;
- Bit64s oldage = -1;
+ Bit32u oldage = 0;
for (int q = 0; q < MT32EMU_MAX_POLY; q++) {
dpoly *tpoly = &polyTable[q];
@@ -595,7 +595,7 @@
}
}
- if (oldest!=-1) {
+ if (oldest != -1) {
startDecayPoly(&polyTable[oldest]);
}
}
Index: partial.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/midi/mt32/partial.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- partial.cpp 28 Nov 2004 13:09:02 -0000 1.12
+++ partial.cpp 28 Nov 2004 21:08:36 -0000 1.13
@@ -716,7 +716,7 @@
}
Bit32u Partial::getAmpEnvelope() {
- Bit32u tc;
+ Bit32s tc;
EnvelopeStatus *tStat = &envs[EnvelopeType_amp];
@@ -726,8 +726,8 @@
if (tStat->decaying) {
tc = tStat->envbase;
tc = (tc + ((tStat->envdist * tStat->envpos) / tStat->envsize));
- //if (tc < 0) // tc is unsigned, so it will *never* be less than 0
- // tc = 0;
+ if (tc < 0)
+ tc = 0;
if ((tStat->envpos >= tStat->envsize) || (tc == 0)) {
play = false;
// Don't have to worry about prevlevel storage or anything, this partial's about to die
@@ -814,7 +814,11 @@
}
}
}
- return tc;
+ if (tc < 0) {
+ synth->printDebug("*** ERROR: tc < 0 (%d) at getAmpEnvelope()", tc);
+ tc = 0;
+ }
+ return (Bit32u)tc;
}
Bit32s Partial::getPitchEnvelope() {
Index: partial.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/midi/mt32/partial.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- partial.h 28 Nov 2004 05:35:07 -0000 1.7
+++ partial.h 28 Nov 2004 21:08:37 -0000 1.8
@@ -113,7 +113,7 @@
Partial *pair;
bool alreadyOutputed;
- Bit64s age;
+ Bit32u age;
Partial(Synth *synth);
~Partial();
Index: partialManager.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/midi/mt32/partialManager.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- partialManager.cpp 28 Nov 2004 05:35:07 -0000 1.3
+++ partialManager.cpp 28 Nov 2004 21:08:37 -0000 1.4
@@ -219,7 +219,7 @@
}*/
// Then kill those with the lowest part priority -- oldest at the moment
while (needed > 0) {
- Bit64s prior = -1;
+ Bit32u prior = 0;
int priornum = -1;
for (int i = 0; i < MT32EMU_MAX_PARTIALS; i++) {
@@ -229,7 +229,7 @@
prior = mt32ram.system.reserveSettings[partialTable[i]->ownerPart];
priornum = i;
}*/
- if (partialTable[i]->age > prior) {
+ if (partialTable[i]->age >= prior) {
prior = partialTable[i]->age;
priornum = i;
}
@@ -245,11 +245,11 @@
// Kill off the oldest partials within this part
while (needed > 0) {
- Bit64s oldest = -1;
- Bit64s oldlist = -1;
+ Bit32u oldest = 0;
+ int oldlist = -1;
for (int i = 0; i < MT32EMU_MAX_PARTIALS; i++) {
if (partialTable[i]->getOwnerPart() == partNum && partialTable[i]->isActive()) {
- if (partialTable[i]->age > oldest) {
+ if (partialTable[i]->age >= oldest) {
oldest = partialTable[i]->age;
oldlist = i;
}
Index: structures.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/midi/mt32/structures.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- structures.h 28 Nov 2004 05:35:07 -0000 1.11
+++ structures.h 28 Nov 2004 21:08:37 -0000 1.12
@@ -274,7 +274,7 @@
bool sustain;
bool isActive() const;
- Bit64s getAge() const;
+ Bit32u getAge() const;
};
}
Index: synth.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/midi/mt32/synth.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- synth.cpp 28 Nov 2004 13:10:57 -0000 1.28
+++ synth.cpp 28 Nov 2004 21:08:37 -0000 1.29
@@ -278,7 +278,7 @@
return rc;
}
-struct TempPCMStruct
+struct ControlROMPCMStruct
{
Bit8u pos;
Bit8u len;
@@ -287,7 +287,7 @@
};
void Synth::initPCMList() {
- TempPCMStruct *tps = (TempPCMStruct *)&controlROMData[0x3000];
+ ControlROMPCMStruct *tps = (ControlROMPCMStruct *)&controlROMData[0x3000];
for (int i = 0; i < 128; i++) {
int rAddr = tps[i].pos * 0x800;
int rLenExp = (tps[i].len & 0x70) >> 4;
@@ -322,11 +322,10 @@
}
void Synth::initRhythmTimbres() {
- //TempPCMStruct *tps = (TempPCMStruct *)&controlROMData[0x3000];
- //const Bit8u *drumMap = &controlROMData[0x3200];
+ const Bit8u *drumMap = &controlROMData[0x3200];
int timbreNum = 192;
- for (Bit16u i = 0x3200; i < 0x323C; i += 2) {
- Bit16u address = (controlROMData[i + 1] << 8) | controlROMData[i];
+ for (Bit16u i = 0; i < 60; i += 2) {
+ Bit16u address = (drumMap[i + 1] << 8) | drumMap[i];
initRhythmTimbre(timbreNum++, &controlROMData[address]);
}
}
More information about the Scummvm-git-logs
mailing list