prepare for MIDI velocity mapping

This commit is contained in:
tildearrow 2023-12-13 20:44:32 -05:00
parent bdef72666b
commit 69998e2c7e
4 changed files with 21 additions and 2 deletions

View file

@ -1372,7 +1372,11 @@ bool DivEngine::nextTick(bool noAccum, bool inhibitLowLat) {
}
if (note.on) {
dispatchCmd(DivCommand(DIV_CMD_INSTRUMENT,note.channel,note.ins,1));
dispatchCmd(DivCommand(DIV_CMD_VOLUME,note.channel,(note.volume*(chan[note.channel].volMax>>8))/127));
if (note.volume>=0) {
int mappedVol=disCont[dispatchOfChan[note.channel]].dispatch->mapVelocity(note.channel,note.volume);
logV("dispatching volume (%d -> %d)",note.volume,mappedVol);
dispatchCmd(DivCommand(DIV_CMD_VOLUME,note.channel,mappedVol));
}
dispatchCmd(DivCommand(DIV_CMD_NOTE_ON,note.channel,note.note));
keyHit[note.channel]=true;
chan[note.channel].releasing=false;