prepare to add function for mapping vol to percent
This commit is contained in:
parent
7a6e41f482
commit
482f5de0fe
|
|
@ -681,6 +681,14 @@ class DivDispatch {
|
|||
*/
|
||||
virtual int mapVelocity(int ch, float vel);
|
||||
|
||||
/**
|
||||
* map chip volume to gain.
|
||||
* @param ch the chip channel. -1 means N/A.
|
||||
* @param vol input volume.
|
||||
* @return output gain fron 0.0 to 1.0.
|
||||
*/
|
||||
virtual float getGain(int ch, int vol);
|
||||
|
||||
/**
|
||||
* get the lowest note in a portamento.
|
||||
* @param ch the channel in question.
|
||||
|
|
|
|||
|
|
@ -107,6 +107,11 @@ int DivDispatch::mapVelocity(int ch, float vel) {
|
|||
return round(vel*volMax);
|
||||
}
|
||||
|
||||
float DivDispatch::getGain(int ch, int vol) {
|
||||
const float volMax=MAX(1,dispatch(DivCommand(DIV_CMD_GET_VOLMAX,MAX(ch,0))));
|
||||
return (float)vol/volMax;
|
||||
}
|
||||
|
||||
int DivDispatch::getPortaFloor(int ch) {
|
||||
return 0x00;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue