# HG changeset patch # User Matti Hamalainen # Date 1349640122 -10800 # Node ID c619c8b6f69669b0b8bd4ee2bcf6a200dedbcee9 # Parent 9fa6a00b294c73391eb55089af75e4b9cb9e06e5 Fix arpeggio handling. diff -r 9fa6a00b294c -r c619c8b6f696 jssplr.c --- a/jssplr.c Sun Oct 07 21:45:24 2012 +0300 +++ b/jssplr.c Sun Oct 07 23:02:02 2012 +0300 @@ -97,6 +97,8 @@ // Frequency = Frequency = 8363*2^((6*12*16*4 - Period) / (12*16*4)) chn->cfreq = chn->freq = 8363.0f * pow(2.0f, (4608.0f - (double) value) / 768.0f); } + + JMPSETNDFLAGS(cdfNewFreq); } } @@ -790,12 +792,14 @@ */ static void jmpDoArpeggio(JSSPlayer * mp, JSSPlayerChannel *chn, int channel, int paramY, int paramX) { - JSSInstrument *tempInst = chn->instrument; + JSSInstrument *inst = chn->instrument; - if (tempInst) + if (inst != NULL) { int tmp = chn->note; - if (tmp == jsetNotSet || tmp == jsetNoteOff) return; + if (tmp == jsetNotSet || tmp == jsetNoteOff) + return; + switch (mp->tick & 3) { case 1: @@ -805,7 +809,9 @@ tmp += paramY; break; } - jmpCSetPitch(mp, chn, jmpGetPeriodFromNote(mp, tmp + tempInst->ERelNote, tempInst->EFineTune)); + + tmp = dmClamp(tmp + inst->ERelNote, 0, 119); + jmpCSetPitch(mp, chn, jmpGetPeriodFromNote(mp, tmp, inst->EFineTune)); } } @@ -1501,7 +1507,7 @@ if (flags & cdfNewPitch) jmpCSetPitch(mp, chn, chn->pitch); - if (flags & (cdfNewPitch | cdfNewFreq)) + if (flags & (cdfNewFreq | cdfNewPitch)) jvmSetFreq(mp->device, channel, chn->freq); if (flags & cdfNewPos)