no longer shift arpeggio macro by 12

This commit is contained in:
tildearrow 2022-01-26 15:53:52 -05:00
parent 1981dc6033
commit f86838df99
17 changed files with 42 additions and 26 deletions

View file

@ -179,6 +179,7 @@ size | description
1 | reserved (>=17) or wave macro height (>=15) or reserved
4?? | volume macro
4?? | arp macro
| - before version 31, this macro's values were stored offset by 12.
4?? | duty macro
4?? | wave macro
4?? | pitch macro (>=17)

View file

@ -1010,6 +1010,11 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) {
if (ds.version>0x0f) {
ins->std.arpMacroMode=reader.readC();
}
if (!ins->std.arpMacroMode) {
for (int j=0; j<ins->std.arpMacroLen; j++) {
ins->std.arpMacro[j]-=12;
}
}
ins->std.dutyMacroLen=reader.readC();
for (int j=0; j<ins->std.dutyMacroLen; j++) {
@ -1902,7 +1907,13 @@ SafeWriter* DivEngine::saveDMF() {
}
w->writeC(i->std.arpMacroLen);
w->write(i->std.arpMacro,4*i->std.arpMacroLen);
if (i->std.arpMacroMode) {
w->write(i->std.arpMacro,4*i->std.arpMacroLen);
} else {
for (int j=0; j<i->std.arpMacroLen; j++) {
w->writeI(i->std.arpMacro[j]+12);
}
}
if (i->std.arpMacroLen>0) {
w->writeC(i->std.arpMacroLoop);
}

View file

@ -11,8 +11,8 @@
#include <map>
#include <queue>
#define DIV_VERSION "0.5pre1"
#define DIV_ENGINE_VERSION 30
#define DIV_VERSION "0.5pre2"
#define DIV_ENGINE_VERSION 31
enum DivStatusView {
DIV_STATUS_NOTHING=0,

View file

@ -375,6 +375,11 @@ DivDataErrors DivInstrument::readInsData(SafeReader& reader, short version) {
reader.read(std.arpMacro,4*std.arpMacroLen);
reader.read(std.dutyMacro,4*std.dutyMacroLen);
reader.read(std.waveMacro,4*std.waveMacroLen);
if (version<31) {
if (!std.arpMacroMode) for (int j=0; j<std.arpMacroLen; j++) {
std.arpMacro[j]-=12;
}
}
if (version>=17) {
reader.read(std.pitchMacro,4*std.pitchMacroLen);
reader.read(std.ex1Macro,4*std.ex1MacroLen);

View file

@ -60,7 +60,7 @@ void DivPlatformAmiga::tick() {
if (chan[i].std.arpMode) {
chan[i].baseFreq=round(FREQ_BASE/pow(2.0f,((float)(chan[i].std.arp)/12.0f)));
} else {
chan[i].baseFreq=round(FREQ_BASE/pow(2.0f,((float)(chan[i].note+chan[i].std.arp-12)/12.0f)));
chan[i].baseFreq=round(FREQ_BASE/pow(2.0f,((float)(chan[i].note+chan[i].std.arp)/12.0f)));
}
}
chan[i].freqChanged=true;

View file

@ -47,7 +47,7 @@ void DivPlatformAY8910::tick() {
if (chan[i].std.arpMode) {
chan[i].baseFreq=round(PSG_FREQ_BASE/pow(2.0f,((float)(chan[i].std.arp)/12.0f)));
} else {
chan[i].baseFreq=round(PSG_FREQ_BASE/pow(2.0f,((float)(chan[i].note+chan[i].std.arp-12)/12.0f)));
chan[i].baseFreq=round(PSG_FREQ_BASE/pow(2.0f,((float)(chan[i].note+chan[i].std.arp)/12.0f)));
}
}
chan[i].freqChanged=true;

View file

@ -68,7 +68,7 @@ void DivPlatformAY8930::tick() {
if (chan[i].std.arpMode) {
chan[i].baseFreq=round(PSG_FREQ_BASE/pow(2.0f,((float)(chan[i].std.arp)/12.0f)));
} else {
chan[i].baseFreq=round(PSG_FREQ_BASE/pow(2.0f,((float)(chan[i].note+chan[i].std.arp-12)/12.0f)));
chan[i].baseFreq=round(PSG_FREQ_BASE/pow(2.0f,((float)(chan[i].note+chan[i].std.arp)/12.0f)));
}
}
chan[i].freqChanged=true;

View file

@ -44,7 +44,7 @@ void DivPlatformC64::tick() {
if (chan[i].std.arpMode) {
chan[i].baseFreq=round(FREQ_BASE*pow(2.0f,((float)(chan[i].std.arp)/12.0f)));
} else {
chan[i].baseFreq=round(FREQ_BASE*pow(2.0f,((float)(chan[i].note+(signed char)chan[i].std.arp-12)/12.0f)));
chan[i].baseFreq=round(FREQ_BASE*pow(2.0f,((float)(chan[i].note+(signed char)chan[i].std.arp)/12.0f)));
}
}
chan[i].freqChanged=true;
@ -207,7 +207,7 @@ int DivPlatformC64::dispatch(DivCommand c) {
rWrite(c.chan*7+4,(chan[c.chan].wave<<4)|(chan[c.chan].ring<<2)|(chan[c.chan].sync<<1)|chan[c.chan].active);
break;
case DIV_CMD_LEGATO:
chan[c.chan].baseFreq=round(FREQ_BASE*pow(2.0f,((float)(c.value+((chan[c.chan].std.willArp && !chan[c.chan].std.arpMode)?(chan[c.chan].std.arp-12):(0)))/12.0f)));
chan[c.chan].baseFreq=round(FREQ_BASE*pow(2.0f,((float)(c.value+((chan[c.chan].std.willArp && !chan[c.chan].std.arpMode)?(chan[c.chan].std.arp):(0)))/12.0f)));
chan[c.chan].freqChanged=true;
chan[c.chan].note=c.value;
break;

View file

@ -84,7 +84,7 @@ void DivPlatformGB::tick() {
if (chan[i].std.arpMode) {
chan[i].baseFreq=chan[i].std.arp+24;
} else {
chan[i].baseFreq=chan[i].note+chan[i].std.arp-12;
chan[i].baseFreq=chan[i].note+chan[i].std.arp;
}
if (chan[i].baseFreq>255) chan[i].baseFreq=255;
if (chan[i].baseFreq<0) chan[i].baseFreq=0;
@ -93,7 +93,7 @@ void DivPlatformGB::tick() {
if (chan[i].std.arpMode) {
chan[i].baseFreq=round(FREQ_BASE/pow(2.0f,((float)(chan[i].std.arp+24)/12.0f)));
} else {
chan[i].baseFreq=round(FREQ_BASE/pow(2.0f,((float)(chan[i].note+chan[i].std.arp-12)/12.0f)));
chan[i].baseFreq=round(FREQ_BASE/pow(2.0f,((float)(chan[i].note+chan[i].std.arp)/12.0f)));
}
}
}
@ -261,7 +261,7 @@ int DivPlatformGB::dispatch(DivCommand c) {
}
case DIV_CMD_LEGATO:
if (c.chan==3) break;
chan[c.chan].baseFreq=round(FREQ_BASE/pow(2.0f,((float)(c.value+((chan[c.chan].std.willArp && !chan[c.chan].std.arpMode)?(chan[c.chan].std.arp-12):(0)))/12.0f)));
chan[c.chan].baseFreq=round(FREQ_BASE/pow(2.0f,((float)(c.value+((chan[c.chan].std.willArp && !chan[c.chan].std.arpMode)?(chan[c.chan].std.arp):(0)))/12.0f)));
chan[c.chan].freqChanged=true;
chan[c.chan].note=c.value;
break;

View file

@ -93,7 +93,7 @@ void DivPlatformGenesis::tick() {
if (chan[i].std.arpMode) {
chan[i].baseFreq=644.0f*pow(2.0f,((float)chan[i].std.arp/12.0f));
} else {
chan[i].baseFreq=644.0f*pow(2.0f,((float)(chan[i].note+(signed char)chan[i].std.arp-12)/12.0f));
chan[i].baseFreq=644.0f*pow(2.0f,((float)(chan[i].note+(signed char)chan[i].std.arp)/12.0f));
}
}
chan[i].freqChanged=true;

View file

@ -90,7 +90,7 @@ void DivPlatformNES::tick() {
if (chan[i].std.arpMode) {
chan[i].baseFreq=chan[i].std.arp;
} else {
chan[i].baseFreq=chan[i].note+chan[i].std.arp-12;
chan[i].baseFreq=chan[i].note+chan[i].std.arp;
}
if (chan[i].baseFreq>255) chan[i].baseFreq=255;
if (chan[i].baseFreq<0) chan[i].baseFreq=0;
@ -99,7 +99,7 @@ void DivPlatformNES::tick() {
if (chan[i].std.arpMode) {
chan[i].baseFreq=round(freqBase/pow(2.0f,((float)(chan[i].std.arp)/12.0f)));
} else {
chan[i].baseFreq=round(freqBase/pow(2.0f,((float)(chan[i].note+chan[i].std.arp-12)/12.0f)));
chan[i].baseFreq=round(freqBase/pow(2.0f,((float)(chan[i].note+chan[i].std.arp)/12.0f)));
}
}
}
@ -309,7 +309,7 @@ int DivPlatformNES::dispatch(DivCommand c) {
break;
case DIV_CMD_LEGATO:
if (c.chan==3) break;
chan[c.chan].baseFreq=round(freqBase/pow(2.0f,((float)(c.value+((chan[c.chan].std.willArp && !chan[c.chan].std.arpMode)?(chan[c.chan].std.arp-12):(0)))/12.0f)));
chan[c.chan].baseFreq=round(freqBase/pow(2.0f,((float)(c.value+((chan[c.chan].std.willArp && !chan[c.chan].std.arpMode)?(chan[c.chan].std.arp):(0)))/12.0f)));
chan[c.chan].freqChanged=true;
chan[c.chan].note=c.value;
break;
@ -394,7 +394,6 @@ int DivPlatformNES::init(DivEngine* p, int channels, int sugRate, bool pal) {
for (int i=0; i<5; i++) {
isMuted[i]=false;
}
setPAL(pal);
nes=new struct NESAPU;
init_nla_table(500,500);

View file

@ -109,8 +109,8 @@ void DivPlatformPCE::tick() {
// noise
chWrite(i,0x07,chan[i].noise?(0x80|noiseFreq[(chan[i].std.arp)%12]):0);
} else {
chan[i].baseFreq=round(FREQ_BASE/pow(2.0f,((float)(chan[i].note+chan[i].std.arp-12)/12.0f)));
chWrite(i,0x07,chan[i].noise?(0x80|noiseFreq[(chan[i].note+chan[i].std.arp-12)%12]):0);
chan[i].baseFreq=round(FREQ_BASE/pow(2.0f,((float)(chan[i].note+chan[i].std.arp)/12.0f)));
chWrite(i,0x07,chan[i].noise?(0x80|noiseFreq[(chan[i].note+chan[i].std.arp)%12]):0);
}
}
chan[i].freqChanged=true;
@ -306,7 +306,7 @@ int DivPlatformPCE::dispatch(DivCommand c) {
break;
}
case DIV_CMD_LEGATO:
chan[c.chan].baseFreq=round(FREQ_BASE/pow(2.0f,((float)(c.value+((chan[c.chan].std.willArp && !chan[c.chan].std.arpMode)?(chan[c.chan].std.arp-12):(0)))/12.0f)));
chan[c.chan].baseFreq=round(FREQ_BASE/pow(2.0f,((float)(c.value+((chan[c.chan].std.willArp && !chan[c.chan].std.arpMode)?(chan[c.chan].std.arp):(0)))/12.0f)));
chan[c.chan].freqChanged=true;
chan[c.chan].note=c.value;
break;

View file

@ -50,7 +50,7 @@ void DivPlatformSAA1099::tick() {
if (chan[i].std.arpMode) {
chan[i].baseFreq=round(PSG_FREQ_BASE/pow(2.0f,((float)(chan[i].std.arp)/12.0f)));
} else {
chan[i].baseFreq=round(PSG_FREQ_BASE/pow(2.0f,((float)(chan[i].note+chan[i].std.arp-12)/12.0f)));
chan[i].baseFreq=round(PSG_FREQ_BASE/pow(2.0f,((float)(chan[i].note+chan[i].std.arp)/12.0f)));
}
}
chan[i].freqChanged=true;

View file

@ -27,7 +27,7 @@ void DivPlatformSMS::tick() {
if (chan[i].std.arpMode) {
chan[i].baseFreq=round(FREQ_BASE/pow(2.0f,((float)(chan[i].std.arp)/12.0f)));
} else {
chan[i].baseFreq=round(FREQ_BASE/pow(2.0f,((float)(chan[i].note+chan[i].std.arp-12)/12.0f)));
chan[i].baseFreq=round(FREQ_BASE/pow(2.0f,((float)(chan[i].note+chan[i].std.arp)/12.0f)));
}
chan[i].freqChanged=true;
} else {
@ -154,7 +154,7 @@ int DivPlatformSMS::dispatch(DivCommand c) {
updateSNMode=true;
break;
case DIV_CMD_LEGATO:
chan[c.chan].baseFreq=round(FREQ_BASE/pow(2.0f,((float)(c.value+((chan[c.chan].std.willArp && !chan[c.chan].std.arpMode)?(chan[c.chan].std.arp-12):(0)))/12.0f)));
chan[c.chan].baseFreq=round(FREQ_BASE/pow(2.0f,((float)(c.value+((chan[c.chan].std.willArp && !chan[c.chan].std.arpMode)?(chan[c.chan].std.arp):(0)))/12.0f)));
chan[c.chan].freqChanged=true;
chan[c.chan].note=c.value;
break;

View file

@ -58,7 +58,7 @@ void DivPlatformTIA::tick() {
if (chan[i].std.arpMode) {
chan[i].baseFreq=0x80000000|chan[i].std.arp;
} else {
chan[i].baseFreq=(chan[i].note+chan[i].std.arp-12)<<8;
chan[i].baseFreq=(chan[i].note+chan[i].std.arp)<<8;
}
}
chan[i].freqChanged=true;

View file

@ -59,7 +59,7 @@ void DivPlatformYM2610::tick() {
if (chan[i].std.arpMode) {
chan[i].baseFreq=round(PSG_FREQ_BASE/pow(2.0f,((float)(chan[i].std.arp)/12.0f)));
} else {
chan[i].baseFreq=round(PSG_FREQ_BASE/pow(2.0f,((float)(chan[i].note+chan[i].std.arp-12)/12.0f)));
chan[i].baseFreq=round(PSG_FREQ_BASE/pow(2.0f,((float)(chan[i].note+chan[i].std.arp)/12.0f)));
}
}
chan[i].freqChanged=true;

View file

@ -1248,7 +1248,7 @@ void FurnaceGUI::drawInsEdit() {
if (settings.macroView==0) { // modern view
MACRO_BEGIN(28*dpiScale);
NORMAL_MACRO(ins->std.volMacro,ins->std.volMacroLen,ins->std.volMacroLoop,volMin,volMax,"vol",volumeLabel,160,ins->std.volMacroOpen,false,NULL,false,NULL,0,0,0,NULL,uiColors[GUI_COLOR_MACRO_VOLUME],mmlString[0],volMin,volMax);
NORMAL_MACRO(ins->std.arpMacro,ins->std.arpMacroLen,ins->std.arpMacroLoop,arpMacroScroll,arpMacroScroll+24,"arp","Arpeggio",160,ins->std.arpMacroOpen,false,NULL,true,&arpMacroScroll,(arpMode?0:-80),(arpMode?0:-12),0,&ins->std.arpMacroMode,uiColors[GUI_COLOR_MACRO_PITCH],mmlString[1],-92,94);
NORMAL_MACRO(ins->std.arpMacro,ins->std.arpMacroLen,ins->std.arpMacroLoop,arpMacroScroll,arpMacroScroll+24,"arp","Arpeggio",160,ins->std.arpMacroOpen,false,NULL,true,&arpMacroScroll,(arpMode?0:-80),0,0,&ins->std.arpMacroMode,uiColors[GUI_COLOR_MACRO_PITCH],mmlString[1],-92,94);
if (dutyMax>0) {
NORMAL_MACRO(ins->std.dutyMacro,ins->std.dutyMacroLen,ins->std.dutyMacroLoop,0,dutyMax,"duty",dutyLabel,160,ins->std.dutyMacroOpen,false,NULL,false,NULL,0,0,0,NULL,uiColors[GUI_COLOR_MACRO_OTHER],mmlString[2],0,dutyMax);
}
@ -1315,7 +1315,7 @@ void FurnaceGUI::drawInsEdit() {
ImGui::Separator();
ImGui::Text("Arpeggio Macro");
for (int i=0; i<ins->std.arpMacroLen; i++) {
asFloat[i]=arpMode?ins->std.arpMacro[i]:(ins->std.arpMacro[i]-12);
asFloat[i]=ins->std.arpMacro[i];
loopIndicator[i]=(ins->std.arpMacroLoop!=-1 && i>=ins->std.arpMacroLoop);
}
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding,ImVec2(0.0f,0.0f));