mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-22 20:45:11 +00:00
OPL and OPLL vol map
This commit is contained in:
parent
8d30ac4d3b
commit
0208883fa1
6 changed files with 26 additions and 2 deletions
|
@ -191,7 +191,7 @@ class DivPlatformOPN: public DivPlatformFMBase {
|
|||
if (ch==adpcmBChanOffs) return vel*255.0;
|
||||
if (ch>=adpcmAChanOffs) {
|
||||
if (vel==0) return 0;
|
||||
if (vel==127) return 31;
|
||||
if (vel>=1.0) return 31;
|
||||
return CLAMP(round(32.0-(56.0-log2(vel*127.0)*8.0)),0,31);
|
||||
}
|
||||
if (ch>=psgChanOffs) return round(15.0*pow(vel,0.33));
|
||||
|
|
|
@ -132,7 +132,7 @@ class DivPlatformFMBase: public DivDispatch {
|
|||
// -36: 2: 48
|
||||
// -42: 1: 56
|
||||
if (vel==0) return 0;
|
||||
if (vel==127) return 127;
|
||||
if (vel>=1.0) return 127;
|
||||
return CLAMP(round(128.0-(56.0-log2(vel*127.0)*8.0)),0,127);
|
||||
}
|
||||
|
||||
|
|
|
@ -2104,6 +2104,21 @@ DivDispatchOscBuffer* DivPlatformOPL::getOscBuffer(int ch) {
|
|||
return oscBuf[ch];
|
||||
}
|
||||
|
||||
int DivPlatformOPL::mapVelocity(int ch, float vel) {
|
||||
if (ch==adpcmChan) return vel*255.0;
|
||||
// -0.75dB per step
|
||||
// -6: 64: 8
|
||||
// -12: 32: 16
|
||||
// -18: 16: 24
|
||||
// -24: 8: 32
|
||||
// -30: 4: 40
|
||||
// -36: 2: 48
|
||||
// -42: 1: 56
|
||||
if (vel==0) return 0;
|
||||
if (vel>=1.0) return 63;
|
||||
return CLAMP(round(64.0-(56.0-log2(vel*127.0)*8.0)),0,63);
|
||||
}
|
||||
|
||||
unsigned char* DivPlatformOPL::getRegisterPool() {
|
||||
return regPool;
|
||||
}
|
||||
|
|
|
@ -150,6 +150,7 @@ class DivPlatformOPL: public DivDispatch {
|
|||
unsigned short getPan(int chan);
|
||||
DivChannelPair getPaired(int chan);
|
||||
DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||
int mapVelocity(int ch, float vel);
|
||||
unsigned char* getRegisterPool();
|
||||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
|
|
|
@ -962,6 +962,13 @@ DivDispatchOscBuffer* DivPlatformOPLL::getOscBuffer(int ch) {
|
|||
return oscBuf[ch];
|
||||
}
|
||||
|
||||
int DivPlatformOPLL::mapVelocity(int ch, float vel) {
|
||||
// -3dB per step
|
||||
if (vel==0) return 0;
|
||||
if (vel>=1.0) return 15;
|
||||
return CLAMP(round(16.0-(14.0-log2(vel*127.0)*2.0)),0,15);
|
||||
}
|
||||
|
||||
unsigned char* DivPlatformOPLL::getRegisterPool() {
|
||||
return regPool;
|
||||
}
|
||||
|
|
|
@ -95,6 +95,7 @@ class DivPlatformOPLL: public DivDispatch {
|
|||
void* getChanState(int chan);
|
||||
DivMacroInt* getChanMacroInt(int ch);
|
||||
DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||
int mapVelocity(int ch, float vel);
|
||||
unsigned char* getRegisterPool();
|
||||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
|
|
Loading…
Reference in a new issue