Updated mapVelocity; also changed back to MIDI standard

This commit is contained in:
Kagamiin~ 2023-12-17 09:05:46 -03:00
parent 13e45cfce2
commit 71841aaf4f
2 changed files with 4 additions and 4 deletions

View file

@ -1019,10 +1019,10 @@ void DivPlatformESFM::notifyInsDeletion(void* ins) {
}
}
int DivPlatformESFM::mapVelocity(int ch, unsigned char vel) {
int DivPlatformESFM::mapVelocity(int ch, float vel) {
const int volMax=MAX(1,dispatch(DivCommand(DIV_CMD_GET_VOLMAX,MAX(ch,0))));
double attenDb=20*log10(vel/127); // 20dB/decade for a linear mapping
double attenUnits=attenDb*(8.0/6.0);
double attenDb=40*log10(vel); // 40dB/decade for a quadratic mapping, per MIDI standard
double attenUnits=attenDb/0.75; // 0.75dB/unit
return MAX(0,volMax+attenUnits);
}