mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-01 18:42:40 +00:00
fix velocity input
This commit is contained in:
parent
0208883fa1
commit
39481ab571
3 changed files with 12 additions and 2 deletions
|
@ -2185,6 +2185,13 @@ int DivEngine::getMaxVolumeChan(int ch) {
|
|||
return chan[ch].volMax>>8;
|
||||
}
|
||||
|
||||
int DivEngine::mapVelocity(int ch, float vel) {
|
||||
if (ch<0) return 0;
|
||||
if (ch>=chans) return 0;
|
||||
if (disCont[dispatchOfChan[ch]].dispatch==NULL) return 0;
|
||||
return disCont[dispatchOfChan[ch]].dispatch->mapVelocity(dispatchChanOfChan[ch],vel);
|
||||
}
|
||||
|
||||
unsigned char DivEngine::getOrder() {
|
||||
return prevOrder;
|
||||
}
|
||||
|
|
|
@ -851,6 +851,9 @@ class DivEngine {
|
|||
// get channel max volume
|
||||
int getMaxVolumeChan(int chan);
|
||||
|
||||
// map MIDI velocity to volume
|
||||
int mapVelocity(int ch, float vel);
|
||||
|
||||
// get current order
|
||||
unsigned char getOrder();
|
||||
|
||||
|
|
|
@ -1216,7 +1216,7 @@ void FurnaceGUI::noteInput(int num, int key, int vol) {
|
|||
if (latchVol!=-1) {
|
||||
pat->data[cursor.y][3]=MIN(maxVol,latchVol);
|
||||
} else if (vol!=-1) {
|
||||
pat->data[cursor.y][3]=(vol*maxVol)/127;
|
||||
pat->data[cursor.y][3]=e->mapVelocity(cursor.xCoarse,pow((float)vol/127.0f,midiMap.volExp));
|
||||
}
|
||||
if (latchEffect!=-1) pat->data[cursor.y][4]=latchEffect;
|
||||
if (latchEffectVal!=-1) pat->data[cursor.y][5]=latchEffectVal;
|
||||
|
@ -3776,7 +3776,7 @@ bool FurnaceGUI::loop() {
|
|||
noteInput(
|
||||
msg.data[0]-12,
|
||||
0,
|
||||
midiMap.volInput?((int)(pow((double)msg.data[1]/127.0,midiMap.volExp)*127.0)):-1
|
||||
midiMap.volInput?msg.data[1]:-1
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue