apply volExp on velocity input - PLEASE READ
DivDispatch::mapVelocity() now takes a float instead of an unsigned char
This commit is contained in:
parent
99dd85bcb4
commit
51b385a1ef
18 changed files with 39 additions and 24 deletions
|
|
@ -102,9 +102,9 @@ bool DivDispatch::isVolGlobal() {
|
|||
return false;
|
||||
}
|
||||
|
||||
int DivDispatch::mapVelocity(int ch, unsigned char vel) {
|
||||
int DivDispatch::mapVelocity(int ch, float vel) {
|
||||
const int volMax=MAX(1,dispatch(DivCommand(DIV_CMD_GET_VOLMAX,MAX(ch,0))));
|
||||
return (vel*volMax)/127;
|
||||
return round(vel*volMax);
|
||||
}
|
||||
|
||||
int DivDispatch::getPortaFloor(int ch) {
|
||||
|
|
|
|||
|
|
@ -719,8 +719,8 @@ DivDispatchOscBuffer* DivPlatformAY8910::getOscBuffer(int ch) {
|
|||
return oscBuf[ch];
|
||||
}
|
||||
|
||||
int DivPlatformAY8910::mapVelocity(int ch, unsigned char vel) {
|
||||
return round(15.0*pow(((double)vel/127.0),0.33));
|
||||
int DivPlatformAY8910::mapVelocity(int ch, float vel) {
|
||||
return round(15.0*pow(vel,0.33));
|
||||
}
|
||||
|
||||
unsigned char* DivPlatformAY8910::getRegisterPool() {
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ class DivPlatformAY8910: public DivDispatch {
|
|||
int dispatch(DivCommand c);
|
||||
void* getChanState(int chan);
|
||||
DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||
int mapVelocity(int ch, unsigned char vel);
|
||||
int mapVelocity(int ch, float vel);
|
||||
unsigned char* getRegisterPool();
|
||||
int getRegisterPoolSize();
|
||||
void flushWrites();
|
||||
|
|
|
|||
|
|
@ -718,8 +718,8 @@ DivDispatchOscBuffer* DivPlatformAY8930::getOscBuffer(int ch) {
|
|||
return oscBuf[ch];
|
||||
}
|
||||
|
||||
int DivPlatformAY8930::mapVelocity(int ch, unsigned char vel) {
|
||||
return round(31.0*pow(((double)vel/127.0),0.22));
|
||||
int DivPlatformAY8930::mapVelocity(int ch, float vel) {
|
||||
return round(31.0*pow(vel,0.22));
|
||||
}
|
||||
|
||||
unsigned char* DivPlatformAY8930::getRegisterPool() {
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ class DivPlatformAY8930: public DivDispatch {
|
|||
int dispatch(DivCommand c);
|
||||
void* getChanState(int chan);
|
||||
DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||
int mapVelocity(int ch, unsigned char vel);
|
||||
int mapVelocity(int ch, float vel);
|
||||
unsigned char* getRegisterPool();
|
||||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ class DivPlatformFMBase: public DivDispatch {
|
|||
}
|
||||
}
|
||||
|
||||
virtual int mapVelocity(int ch, unsigned char vel) {
|
||||
virtual int mapVelocity(int ch, float vel) {
|
||||
// -0.75dB per step
|
||||
// -6: 64: 8
|
||||
// -12: 32: 16
|
||||
|
|
@ -133,7 +133,7 @@ class DivPlatformFMBase: public DivDispatch {
|
|||
// -42: 1: 56
|
||||
if (vel==0) return 0;
|
||||
if (vel==127) return 127;
|
||||
return CLAMP(round(128.0-(56.0-log2(vel)*8.0)),0,127);
|
||||
return CLAMP(round(128.0-(56.0-log2(vel*127.0)*8.0)),0,127);
|
||||
}
|
||||
|
||||
friend void putDispatchChan(void*,int,int);
|
||||
|
|
|
|||
|
|
@ -539,8 +539,8 @@ DivDispatchOscBuffer* DivPlatformPCE::getOscBuffer(int ch) {
|
|||
return oscBuf[ch];
|
||||
}
|
||||
|
||||
int DivPlatformPCE::mapVelocity(int ch, unsigned char vel) {
|
||||
return round(31.0*pow(((double)vel/127.0),0.22));
|
||||
int DivPlatformPCE::mapVelocity(int ch, float vel) {
|
||||
return round(31.0*pow(vel,0.22));
|
||||
}
|
||||
|
||||
unsigned char* DivPlatformPCE::getRegisterPool() {
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ class DivPlatformPCE: public DivDispatch {
|
|||
DivChannelModeHints getModeHints(int chan);
|
||||
DivSamplePos getSamplePos(int ch);
|
||||
DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||
int mapVelocity(int ch, unsigned char vel);
|
||||
int mapVelocity(int ch, float vel);
|
||||
unsigned char* getRegisterPool();
|
||||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
|
|
|
|||
|
|
@ -462,8 +462,8 @@ DivDispatchOscBuffer* DivPlatformSMS::getOscBuffer(int ch) {
|
|||
return oscBuf[ch];
|
||||
}
|
||||
|
||||
int DivPlatformSMS::mapVelocity(int ch, unsigned char vel) {
|
||||
return round(15.0*pow(((double)vel/127.0),0.33));
|
||||
int DivPlatformSMS::mapVelocity(int ch, float vel) {
|
||||
return round(15.0*pow(vel,0.33));
|
||||
}
|
||||
|
||||
unsigned char* DivPlatformSMS::getRegisterPool() {
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ class DivPlatformSMS: public DivDispatch {
|
|||
DivMacroInt* getChanMacroInt(int ch);
|
||||
unsigned short getPan(int chan);
|
||||
DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||
int mapVelocity(int ch, unsigned char vel);
|
||||
int mapVelocity(int ch, float vel);
|
||||
unsigned char* getRegisterPool();
|
||||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
|
|
|
|||
|
|
@ -308,8 +308,8 @@ DivDispatchOscBuffer* DivPlatformT6W28::getOscBuffer(int ch) {
|
|||
return oscBuf[ch];
|
||||
}
|
||||
|
||||
int DivPlatformT6W28::mapVelocity(int ch, unsigned char vel) {
|
||||
return round(15.0*pow(((double)vel/127.0),0.33));
|
||||
int DivPlatformT6W28::mapVelocity(int ch, float vel) {
|
||||
return round(15.0*pow(vel,0.33));
|
||||
}
|
||||
|
||||
unsigned char* DivPlatformT6W28::getRegisterPool() {
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ class DivPlatformT6W28: public DivDispatch {
|
|||
DivMacroInt* getChanMacroInt(int ch);
|
||||
unsigned short getPan(int chan);
|
||||
DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||
int mapVelocity(int ch, unsigned char vel);
|
||||
int mapVelocity(int ch, float vel);
|
||||
unsigned char* getRegisterPool();
|
||||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue