mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-23 04:55:13 +00:00
OPN: proper vol map for SSG/ADPCM/CSM/DAC parts
This commit is contained in:
parent
3742a8e2ea
commit
8d30ac4d3b
13 changed files with 53 additions and 0 deletions
|
@ -186,6 +186,17 @@ class DivPlatformOPN: public DivPlatformFMBase {
|
|||
void setCombo(bool combo) {
|
||||
useCombo=combo;
|
||||
}
|
||||
virtual int mapVelocity(int ch, float vel) {
|
||||
if (ch==csmChan) return vel*127.0;
|
||||
if (ch==adpcmBChanOffs) return vel*255.0;
|
||||
if (ch>=adpcmAChanOffs) {
|
||||
if (vel==0) return 0;
|
||||
if (vel==127) 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));
|
||||
return DivPlatformFMBase::mapVelocity(ch,vel);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1300,6 +1300,12 @@ DivDispatchOscBuffer* DivPlatformGenesis::getOscBuffer(int ch) {
|
|||
return oscBuf[ch];
|
||||
}
|
||||
|
||||
int DivPlatformGenesis::mapVelocity(int ch, float vel) {
|
||||
if (ch==csmChan) return DivPlatformOPN::mapVelocity(ch,vel);
|
||||
if (ch>5) return DivPlatformOPN::mapVelocity(5,vel);
|
||||
return DivPlatformOPN::mapVelocity(ch,vel);
|
||||
}
|
||||
|
||||
unsigned char* DivPlatformGenesis::getRegisterPool() {
|
||||
return regPool;
|
||||
}
|
||||
|
|
|
@ -112,6 +112,7 @@ class DivPlatformGenesis: public DivPlatformOPN {
|
|||
virtual unsigned short getPan(int chan);
|
||||
DivSamplePos getSamplePos(int ch);
|
||||
DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||
virtual int mapVelocity(int ch, float vel);
|
||||
unsigned char* getRegisterPool();
|
||||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
|
|
|
@ -818,6 +818,12 @@ DivDispatchOscBuffer* DivPlatformGenesisExt::getOscBuffer(int ch) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int DivPlatformGenesisExt::mapVelocity(int ch, float vel) {
|
||||
if (ch>=extChanOffs+4) return DivPlatformGenesis::mapVelocity(ch-3,vel);
|
||||
if (ch>=extChanOffs) return DivPlatformGenesis::mapVelocity(extChanOffs,vel);
|
||||
return DivPlatformGenesis::mapVelocity(ch,vel);
|
||||
}
|
||||
|
||||
void DivPlatformGenesisExt::reset() {
|
||||
DivPlatformGenesis::reset();
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ class DivPlatformGenesisExt: public DivPlatformGenesis {
|
|||
DivMacroInt* getChanMacroInt(int ch);
|
||||
unsigned short getPan(int chan);
|
||||
DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||
int mapVelocity(int ch, float vel);
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick(bool sysTick=true);
|
||||
|
|
|
@ -692,6 +692,12 @@ DivDispatchOscBuffer* DivPlatformYM2203Ext::getOscBuffer(int ch) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int DivPlatformYM2203Ext::mapVelocity(int ch, float vel) {
|
||||
if (ch>=extChanOffs+4) return DivPlatformOPN::mapVelocity(ch-3,vel);
|
||||
if (ch>=extChanOffs) return DivPlatformOPN::mapVelocity(extChanOffs,vel);
|
||||
return DivPlatformOPN::mapVelocity(ch,vel);
|
||||
}
|
||||
|
||||
void DivPlatformYM2203Ext::reset() {
|
||||
DivPlatformYM2203::reset();
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ class DivPlatformYM2203Ext: public DivPlatformYM2203 {
|
|||
void* getChanState(int chan);
|
||||
DivMacroInt* getChanMacroInt(int ch);
|
||||
DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||
int mapVelocity(int ch, float vel);
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick(bool sysTick=true);
|
||||
|
|
|
@ -767,6 +767,12 @@ DivDispatchOscBuffer* DivPlatformYM2608Ext::getOscBuffer(int ch) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int DivPlatformYM2608Ext::mapVelocity(int ch, float vel) {
|
||||
if (ch>=extChanOffs+4) return DivPlatformOPN::mapVelocity(ch-3,vel);
|
||||
if (ch>=extChanOffs) return DivPlatformOPN::mapVelocity(extChanOffs,vel);
|
||||
return DivPlatformOPN::mapVelocity(ch,vel);
|
||||
}
|
||||
|
||||
void DivPlatformYM2608Ext::reset() {
|
||||
DivPlatformYM2608::reset();
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ class DivPlatformYM2608Ext: public DivPlatformYM2608 {
|
|||
DivMacroInt* getChanMacroInt(int ch);
|
||||
unsigned short getPan(int chan);
|
||||
DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||
int mapVelocity(int ch, float vel);
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick(bool sysTick=true);
|
||||
|
|
|
@ -757,6 +757,12 @@ DivDispatchOscBuffer* DivPlatformYM2610BExt::getOscBuffer(int ch) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int DivPlatformYM2610BExt::mapVelocity(int ch, float vel) {
|
||||
if (ch>=extChanOffs+4) return DivPlatformOPN::mapVelocity(ch-3,vel);
|
||||
if (ch>=extChanOffs) return DivPlatformOPN::mapVelocity(extChanOffs,vel);
|
||||
return DivPlatformOPN::mapVelocity(ch,vel);
|
||||
}
|
||||
|
||||
void DivPlatformYM2610BExt::reset() {
|
||||
DivPlatformYM2610B::reset();
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ class DivPlatformYM2610BExt: public DivPlatformYM2610B {
|
|||
DivMacroInt* getChanMacroInt(int ch);
|
||||
unsigned short getPan(int chan);
|
||||
DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||
int mapVelocity(int ch, float vel);
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick(bool sysTick=true);
|
||||
|
|
|
@ -757,6 +757,12 @@ DivDispatchOscBuffer* DivPlatformYM2610Ext::getOscBuffer(int ch) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int DivPlatformYM2610Ext::mapVelocity(int ch, float vel) {
|
||||
if (ch>=extChanOffs+4) return DivPlatformOPN::mapVelocity(ch-3,vel);
|
||||
if (ch>=extChanOffs) return DivPlatformOPN::mapVelocity(extChanOffs,vel);
|
||||
return DivPlatformOPN::mapVelocity(ch,vel);
|
||||
}
|
||||
|
||||
void DivPlatformYM2610Ext::reset() {
|
||||
DivPlatformYM2610::reset();
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ class DivPlatformYM2610Ext: public DivPlatformYM2610 {
|
|||
DivMacroInt* getChanMacroInt(int ch);
|
||||
unsigned short getPan(int chan);
|
||||
DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||
int mapVelocity(int ch, float vel);
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick(bool sysTick=true);
|
||||
|
|
Loading…
Reference in a new issue