better volume slide accuracy
volume slide seems to be kind of quirky: - sliding all the way down and then up suddenly sets the vol to max - apparently there is an overflow and the slide stops when it reaches its boundaries (instead of continuing)
This commit is contained in:
parent
67847d79cf
commit
9736b77401
|
@ -9,6 +9,7 @@ enum DivDispatchCmds {
|
||||||
DIV_CMD_INSTRUMENT,
|
DIV_CMD_INSTRUMENT,
|
||||||
DIV_CMD_VOLUME,
|
DIV_CMD_VOLUME,
|
||||||
DIV_CMD_GET_VOLUME,
|
DIV_CMD_GET_VOLUME,
|
||||||
|
DIV_CMD_GET_VOLMAX,
|
||||||
DIV_CMD_NOTE_PORTA,
|
DIV_CMD_NOTE_PORTA,
|
||||||
DIV_CMD_PITCH,
|
DIV_CMD_PITCH,
|
||||||
DIV_CMD_PANNING,
|
DIV_CMD_PANNING,
|
||||||
|
|
|
@ -697,6 +697,11 @@ bool DivEngine::init() {
|
||||||
blip_set_rates(bb[0],dispatch->rate,got.rate);
|
blip_set_rates(bb[0],dispatch->rate,got.rate);
|
||||||
blip_set_rates(bb[1],dispatch->rate,got.rate);
|
blip_set_rates(bb[1],dispatch->rate,got.rate);
|
||||||
|
|
||||||
|
for (int i=0; i<chans; i++) {
|
||||||
|
chan[i].volMax=dispatch->dispatch(DivCommand(DIV_CMD_GET_VOLMAX,i))<<8;
|
||||||
|
chan[i].volume=chan[i].volMax;
|
||||||
|
}
|
||||||
|
|
||||||
if (!output->setRun(true)) {
|
if (!output->setRun(true)) {
|
||||||
logE("error while activating!\n");
|
logE("error while activating!\n");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
struct DivChannelState {
|
struct DivChannelState {
|
||||||
std::vector<DivDelayedCommand> delayed;
|
std::vector<DivDelayedCommand> delayed;
|
||||||
int note, pitch, portaSpeed, portaNote;
|
int note, pitch, portaSpeed, portaNote;
|
||||||
int volume, volSpeed, cut, rowDelay;
|
int volume, volSpeed, cut, rowDelay, volMax;
|
||||||
int vibratoDepth, vibratoRate, vibratoPos;
|
int vibratoDepth, vibratoRate, vibratoPos;
|
||||||
int tremoloDepth, tremoloRate, tremoloPos;
|
int tremoloDepth, tremoloRate, tremoloPos;
|
||||||
unsigned char arp, arpStage;
|
unsigned char arp, arpStage;
|
||||||
|
|
|
@ -32,6 +32,9 @@ int DivPlatformDummy::dispatch(DivCommand c) {
|
||||||
case DIV_CMD_GET_VOLUME:
|
case DIV_CMD_GET_VOLUME:
|
||||||
return chan[c.chan].vol;
|
return chan[c.chan].vol;
|
||||||
break;
|
break;
|
||||||
|
case DIV_CMD_GET_VOLMAX:
|
||||||
|
return 15;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -301,6 +301,9 @@ int DivPlatformGenesis::dispatch(DivCommand c) {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case DIV_CMD_GET_VOLMAX:
|
||||||
|
return 127;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
printf("WARNING: unimplemented command %d\n",c.cmd);
|
printf("WARNING: unimplemented command %d\n",c.cmd);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -20,6 +20,9 @@ int DivPlatformGenesisExt::dispatch(DivCommand c) {
|
||||||
case DIV_CMD_VOLUME:
|
case DIV_CMD_VOLUME:
|
||||||
chan[c.chan].vol=c.value;
|
chan[c.chan].vol=c.value;
|
||||||
break;
|
break;
|
||||||
|
case DIV_CMD_GET_VOLMAX:
|
||||||
|
return 127;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -35,4 +38,4 @@ int DivPlatformGenesisExt::init(DivEngine* parent, int channels, int sugRate) {
|
||||||
|
|
||||||
extMode=true;
|
extMode=true;
|
||||||
return 13;
|
return 13;
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,6 +144,9 @@ int DivPlatformSMS::dispatch(DivCommand c) {
|
||||||
case DIV_CMD_PRE_PORTA:
|
case DIV_CMD_PRE_PORTA:
|
||||||
chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
|
chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
|
||||||
break;
|
break;
|
||||||
|
case DIV_CMD_GET_VOLMAX:
|
||||||
|
return 15;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,8 +134,10 @@ void DivEngine::processRow(int i, bool afterDelay) {
|
||||||
|
|
||||||
// volume
|
// volume
|
||||||
if (pat->data[curRow][3]!=-1) {
|
if (pat->data[curRow][3]!=-1) {
|
||||||
chan[i].volume=pat->data[curRow][3]<<8;
|
if ((chan[i].volume>>8)!=pat->data[curRow][3]) {
|
||||||
dispatch->dispatch(DivCommand(DIV_CMD_VOLUME,i,chan[i].volume>>8));
|
chan[i].volume=pat->data[curRow][3]<<8;
|
||||||
|
dispatch->dispatch(DivCommand(DIV_CMD_VOLUME,i,chan[i].volume>>8));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// effects
|
// effects
|
||||||
|
@ -342,11 +344,19 @@ void DivEngine::nextTick() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (chan[i].volSpeed!=0) {
|
if (chan[i].volSpeed!=0) {
|
||||||
chan[i].volume=(chan[i].volume&0xff)|(dispatch->dispatch(DivCommand(DIV_CMD_GET_VOLUME,i))<<8);
|
//chan[i].volume=(chan[i].volume&0xff)|(dispatch->dispatch(DivCommand(DIV_CMD_GET_VOLUME,i))<<8);
|
||||||
chan[i].volume+=chan[i].volSpeed;
|
chan[i].volume+=chan[i].volSpeed;
|
||||||
if (chan[i].volume>0x7f00) chan[i].volume=0x7f00;
|
if (chan[i].volume>chan[i].volMax) {
|
||||||
if (chan[i].volume<0) chan[i].volume=0;
|
chan[i].volume=chan[i].volMax;
|
||||||
dispatch->dispatch(DivCommand(DIV_CMD_VOLUME,i,chan[i].volume>>8));
|
chan[i].volSpeed=0;
|
||||||
|
dispatch->dispatch(DivCommand(DIV_CMD_VOLUME,i,chan[i].volume>>8));
|
||||||
|
} else if (chan[i].volume<0) {
|
||||||
|
chan[i].volSpeed=0;
|
||||||
|
chan[i].volume=chan[i].volMax;
|
||||||
|
dispatch->dispatch(DivCommand(DIV_CMD_VOLUME,i,0));
|
||||||
|
} else {
|
||||||
|
dispatch->dispatch(DivCommand(DIV_CMD_VOLUME,i,chan[i].volume>>8));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (chan[i].vibratoDepth>0) {
|
if (chan[i].vibratoDepth>0) {
|
||||||
chan[i].vibratoPos+=chan[i].vibratoRate;
|
chan[i].vibratoPos+=chan[i].vibratoRate;
|
||||||
|
|
Loading…
Reference in a new issue