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);
}

View file

@ -136,7 +136,7 @@ class DivPlatformESFM: public DivDispatch {
void toggleRegisterDump(bool enable);
void notifyInsChange(int ins);
void notifyInsDeletion(void* ins);
int mapVelocity(int ch, unsigned char vel);
int mapVelocity(int ch, float vel);
void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist);
void setFlags(const DivConfig& flags);