First post, by Ictoagh
I've taken a look at the code, and I think I have figured out how to get modulation & pitch-bends to work correctly. They might be a bit off, still, but this should get closer to having them properly emulated:
/ This is a new version of the pitch-bend routine, this seems to give pretty faithful pitch bends.
void MidiChannel::SetBend(int vol) {
// The maximum bend is over 2 octaves.
// Set the bend range to 2 oct / chosen range
float bend_range = (float)mt32ram.params.pSettings[storedpatch].benderRange/24;
// it appears 4096 is centered... this may be incorrect (bends can go from - to + ??
bend = 4096+(vol-8192)*bend_range;
}
// This is a new version of the SetModulation routine. The Mod controller controls modulation depth
// so, this is what is added here.
void MidiChannel::SetModulation(int vol) {
// Just a bloody guess, as always, before I get things figured out
int t;
for(t=0;t<4;t++) {
if(pcache[t].playPartial) {
int newrate = (pcache[t].modsense * vol) >> 7;
pcache[t].lfodepth = newrate;
}
}
}