2021-05-16 18:43:10 -04:00
|
|
|
#include "genesisext.h"
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
int DivPlatformGenesisExt::dispatch(DivCommand c) {
|
|
|
|
if (c.chan<2) {
|
|
|
|
return DivPlatformGenesis::dispatch(c);
|
|
|
|
}
|
|
|
|
if (c.chan>5) {
|
|
|
|
c.chan-=3;
|
|
|
|
return DivPlatformGenesis::dispatch(c);
|
|
|
|
}
|
|
|
|
switch (c.cmd) {
|
|
|
|
case DIV_CMD_NOTE_ON:
|
|
|
|
chan[c.chan].freq=16.4f*pow(2.0f,((float)c.value/12.0f));
|
|
|
|
chan[c.chan].active=true;
|
|
|
|
break;
|
|
|
|
case DIV_CMD_NOTE_OFF:
|
|
|
|
chan[c.chan].active=false;
|
|
|
|
break;
|
|
|
|
case DIV_CMD_VOLUME:
|
|
|
|
chan[c.chan].vol=c.value;
|
|
|
|
break;
|
2021-05-17 16:06:11 -04:00
|
|
|
case DIV_CMD_GET_VOLMAX:
|
|
|
|
return 127;
|
|
|
|
break;
|
2021-05-16 18:43:10 -04:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DivPlatformGenesisExt::tick() {
|
|
|
|
DivPlatformGenesis::tick();
|
|
|
|
}
|
2021-05-16 21:49:54 -04:00
|
|
|
|
|
|
|
int DivPlatformGenesisExt::init(DivEngine* parent, int channels, int sugRate) {
|
|
|
|
DivPlatformGenesis::init(parent,channels,sugRate);
|
|
|
|
|
|
|
|
extMode=true;
|
|
|
|
return 13;
|
2021-05-17 16:06:11 -04:00
|
|
|
}
|