Kurumitsu-8L: channel redesign, remove echo

This commit is contained in:
Natt Akuma 2025-09-22 04:10:41 +07:00
parent cf4d72dd7c
commit 33fa17ff46
6 changed files with 175 additions and 279 deletions

View file

@ -21,26 +21,24 @@
#include "../engine.h" #include "../engine.h"
#include <math.h> #include <math.h>
#define chRead(c,a) regPool[(c)*16+(a)] #define chRead(c,a) regPool[(c)*24+(a)]
#define chWrite(c,a,v) if (!skipRegisterWrites) {regPool[(c)*16+(a)]=v; if (dumpWrites) {addWrite(a,v);} } #define chWrite(c,a,v) if (!skipRegisterWrites) {regPool[(c)*24+(a)]=v; if (dumpWrites) {addWrite(a,v);} }
#define chDWrite(c,a,v) regPool[(c)*16+(a)]=v; #define chDWrite(c,a,v) regPool[(c)*24+(a)]=v;
#define CHIP_FREQBASE 67108864 #define CHIP_FREQBASE 67108864
const char* regCheatSheetKurumitsu8L[]={ const char* regCheatSheetKurumitsu8L[]={
"CHxAtt", "00+x*10", "CHxBank", "00+x*18",
"CHxPanL", "01+x*10", "CHxVol", "01+x*18",
"CHxPanR", "02+x*10", "CHxModF", "02+x*18",
"CHxMod", "03+x*10", "CHxModI", "03+x*18",
"CHxFreq", "04+x*10", "CHxPanL", "04+x*18",
"CHxEcho", "07+x*10", "CHxPanR", "06+x*18",
"CHxAcc", "08+x*10", "CHxLoopE", "08+x*18",
"CH7Bank", "73", "CHxLoopL", "0A+x*18",
"CH7LoopE", "7C", "CHxFreq", "0C+x*18",
"CH7LoopL", "7E", "CHxAcc", "10+x*18",
"EchoFB", "80", "CHxOut", "14+x*18",
"EchoVolL", "81",
"EchoVolR", "82",
NULL NULL
}; };
@ -49,79 +47,70 @@ const char** DivPlatformKurumitsu8L::getRegisterSheet() {
} }
void DivPlatformKurumitsu8L::acquire(short** buf, size_t len) { void DivPlatformKurumitsu8L::acquire(short** buf, size_t len) {
const int volTab[32]={ // channel diagram:
65535, 64130, 62756, 61411, 60095, 58808, 57547, 56314, 55108, 53927, 52771, 51640, 50534, 49451, 48391, 47354, // .---[ModF]-------+-[PanL]-> DryL
46340, 45347, 44375, 43424, 42494, 41583, 40692, 39820, 38967, 38132, 37315, 36515, 35733, 34967, 34218, 33485 // V |
}; // [Freq]->(+)->[Wave]-[Env]-+-[PanR]-> DryR
// ^ |
// Wet ---[ModI]---' '--------> Wet
for (int i=0; i<8; i++) { for (int i=0; i<8; i++) {
oscBuf[i]->begin(len); oscBuf[i]->begin(len);
} }
signed char echoFB=chRead(8,0);
signed char echoL=chRead(8,1);
signed char echoR=chRead(8,2);
for (size_t h=0; h<len; h++) { for (size_t h=0; h<len; h++) {
int outE=((int)echoMem[echoPtr]*echoFB)<<11; int outAL=0;
int outAL=((int)echoMem[echoPtr]*echoL)<<11; int outAR=0;
int outAR=((int)echoMem[echoPtr]*echoR)<<11;
int modData=0; int modData=0;
for (int i=0; i<8; i++) { for (int i=0; i<8; i++) {
unsigned char vol=chRead(i,0); unsigned char vol=chRead(i,1);
signed char panL=chRead(i,1); unsigned char fb=chRead(i,2);
signed char panR=chRead(i,2); unsigned char mod=chRead(i,3);
signed char echo=chRead(i,7); short panL=chRead(i,4)|((short)chRead(i,5)<<8);
unsigned freq=chRead(i,4)|((unsigned)chRead(i,5)<<8)|((unsigned)chRead(i,6)<<16)|((unsigned)chRead(i,7)<<24); short panR=chRead(i,6)|((short)chRead(i,7)<<8);
unsigned phase=chRead(i,8)|((unsigned)chRead(i,9)<<8)|((unsigned)chRead(i,10)<<16)|((unsigned)chRead(i,11)<<24); unsigned freq=chRead(i,12)|((unsigned)chRead(i,13)<<8)|((unsigned)chRead(i,14)<<16)|((unsigned)chRead(i,15)<<24);
int fbData=0; unsigned phase=chRead(i,16)|((unsigned)chRead(i,17)<<8)|((unsigned)chRead(i,18)<<16)|((unsigned)chRead(i,19)<<24);
unsigned loopE=chRead(i,8)|((unsigned)chRead(i,9)<<8);
short fbData1=chRead(i,20)|((short)chRead(i,21)<<8);
short fbData2=chRead(i,22)|((short)chRead(i,23)<<8);
int data=0; int data=0;
if (i<7) { int phase_inc=(((int)fbData1+fbData2)*fb)+((modData*mod)<<3);
unsigned char fb=chRead(i,3)&0xf; if (loopE==0) {
unsigned char mod=(chRead(i,3)>>4)&0xf; // wavetable, does stable phasemod
fbData=chRead(i,12)|((int)chRead(i,13)<<8)|((int)chRead(i,14)<<16)|((int)chRead(i,15)<<24); data=wtMem[i][((phase+phase_inc)>>16)&255];
unsigned phase_modded=phase;
phase_modded+=fbData>>fb;
phase_modded+=modData>>mod;
data=wtMem[i][(phase_modded>>16)&255];
phase+=freq; phase+=freq;
} else { } else {
unsigned loopE=chRead(i,12)|((unsigned)chRead(i,13)<<8); // samples, does unstable pitchmod
unsigned loopL=chRead(i,14)|((unsigned)chRead(i,15)<<8); unsigned loopL=chRead(i,10)|((unsigned)chRead(i,11)<<8);
data=sampleMem[(phase>>16)|(chRead(i,3)<<16)]; data=sampleMem[(phase>>16)|(chRead(i,0)<<16)];
int64_t newPhase=phase+(freq&0x00ffffff); phase_inc+=freq;
if (newPhase>=(loopE<<16)) { if (phase_inc<0) phase_inc=0;
int64_t newPhase=phase+phase_inc;
if (newPhase>=0x100000000LL || (newPhase)>=(loopE<<16)) {
newPhase-=loopL<<16; newPhase-=loopL<<16;
} }
phase=newPhase; phase=newPhase;
} }
int out=data*(volTab[vol&0x1f]>>(vol>>5)); int out=data*vol; // 16 bits
outAL+=out*panL/256; outAL+=(out*panL)>>2; // 29 bits
outAR+=out*panR/256; outAR+=(out*panR)>>2;
outE+=out*echo/256; oscBuf[i]->putSample(h,(out*((int)abs(panL)+abs(panR)))>>17);
oscBuf[i]->putSample(h,out*((int)abs(panL)+abs(panR))/65536);
chDWrite(i,8,phase&0xff); fbData2=fbData1;
chDWrite(i,9,(phase>>8)&0xff); fbData1=out;
chDWrite(i,10,(phase>>16)&0xff); modData=out;
chDWrite(i,11,(phase>>24)&0xff); chDWrite(i,16,phase&0xff);
if (i<7) { chDWrite(i,17,(phase>>8)&0xff);
fbData=out; chDWrite(i,18,(phase>>16)&0xff);
modData=out; chDWrite(i,19,(phase>>24)&0xff);
chDWrite(i,12,fbData&0xff); chDWrite(i,20,fbData1&0xff);
chDWrite(i,13,(fbData>>8)&0xff); chDWrite(i,21,(fbData1>>8)&0xff);
chDWrite(i,14,(fbData>>16)&0xff); chDWrite(i,22,fbData2&0xff);
chDWrite(i,15,(fbData>>24)&0xff); chDWrite(i,23,(fbData2>>24)&0xff);
} } // 32 bits
} buf[0][h]=outAL>>16; // 16 bits
buf[0][h]=outAL>>10; buf[1][h]=outAR>>16;
buf[1][h]=outAR>>10;
outE>>=18;
if (outE<0) outE++;
echoMem[echoPtr]=outE;
echoPtr=(echoPtr+1)&4095;
} }
for (int i=0; i<8; i++) { for (int i=0; i<8; i++) {
@ -130,7 +119,6 @@ void DivPlatformKurumitsu8L::acquire(short** buf, size_t len) {
} }
void DivPlatformKurumitsu8L::updateWave(int ch) { void DivPlatformKurumitsu8L::updateWave(int ch) {
if (ch>=7) return;
for (int i=0; i<256; i++) { for (int i=0; i<256; i++) {
wtMem[ch][i]=chan[ch].ws.output[i]^128; wtMem[ch][i]=chan[ch].ws.output[i]^128;
} }
@ -138,32 +126,29 @@ void DivPlatformKurumitsu8L::updateWave(int ch) {
void DivPlatformKurumitsu8L::writePan(int ch) { void DivPlatformKurumitsu8L::writePan(int ch) {
if (!isMuted[ch] && chan[ch].active) { if (!isMuted[ch] && chan[ch].active) {
chWrite(ch,1,VOL_SCALE_LINEAR(chan[ch].panL,chan[ch].vol,127)*(chan[ch].invertL?-1:1)); int valL=chan[ch].panL*chan[ch].vol*(chan[ch].invertL?-1:1)/2;
chWrite(ch,2,VOL_SCALE_LINEAR(chan[ch].panR,chan[ch].vol,127)*(chan[ch].invertR?-1:1)); int valR=chan[ch].panR*chan[ch].vol*(chan[ch].invertR?-1:1)/2;
} else { chWrite(ch,4,valL&0xff);
chWrite(ch,1,0); chWrite(ch,5,valL>>8);
chWrite(ch,2,0); chWrite(ch,6,valR&0xff);
} chWrite(ch,7,valR>>8);
}
void DivPlatformKurumitsu8L::writeEcho(int ch) {
if (!isMuted[ch] && chan[ch].active) {
chWrite(ch,7,chan[ch].echo);
} else { } else {
chWrite(ch,4,0);
chWrite(ch,5,0);
chWrite(ch,6,0);
chWrite(ch,7,0); chWrite(ch,7,0);
} }
} }
void DivPlatformKurumitsu8L::tick(bool sysTick) { void DivPlatformKurumitsu8L::tick(bool sysTick) {
for (int i=0; i<8; i++) { for (int i=0; i<8; i++) {
bool panChanged=false; bool panChanged=false;
bool echoChanged=false;
chan[i].std.next(); chan[i].std.next();
if (chan[i].std.vol.had) { if (chan[i].std.vol.had) {
chan[i].outVol=chan[i].std.vol.val*(chan[i].isAmiga?4:1); chan[i].outVol=chan[i].std.vol.val*(chan[i].isAmiga?4:1);
if (chan[i].outVol>255) chan[i].outVol=255; if (chan[i].outVol>255) chan[i].outVol=255;
if (!isMuted[i] && chan[i].active) { if (!isMuted[i] && chan[i].active) {
chWrite(i,0,~chan[i].outVol&255); chWrite(i,1,chan[i].outVol);
} }
} }
if (NEW_ARP_STRAT) { if (NEW_ARP_STRAT) {
@ -174,10 +159,6 @@ void DivPlatformKurumitsu8L::tick(bool sysTick) {
} }
chan[i].freqChanged=true; chan[i].freqChanged=true;
} }
if (chan[i].std.duty.had) {
chan[i].echo=chan[i].std.duty.val;
echoChanged=true;
}
if (chan[i].std.wave.had) { if (chan[i].std.wave.had) {
if (chan[i].wave!=chan[i].std.wave.val || chan[i].ws.activeChanged()) { if (chan[i].wave!=chan[i].std.wave.val || chan[i].ws.activeChanged()) {
chan[i].wave=chan[i].std.wave.val; chan[i].wave=chan[i].std.wave.val;
@ -204,24 +185,22 @@ void DivPlatformKurumitsu8L::tick(bool sysTick) {
} }
if (chan[i].std.phaseReset.had) { if (chan[i].std.phaseReset.had) {
if (chan[i].std.phaseReset.val==1 && chan[i].active) { if (chan[i].std.phaseReset.val==1 && chan[i].active) {
if (i==7) { if (chan[i].pcm) {
chan[i].audPos=0; chan[i].audPos=0;
chan[i].setPos=true; chan[i].setPos=true;
} else { } else {
chWrite(i,8,0); chWrite(i,16,0);
chWrite(i,9,0); chWrite(i,17,0);
chWrite(i,10,0); chWrite(i,18,0);
chWrite(i,11,0); chWrite(i,19,0);
} }
} }
} }
if (i<7 && chan[i].std.ex1.had) { if (chan[i].std.ex1.had) {
unsigned char val=chRead(i,3)&0xf0; chWrite(i,2,chan[i].std.ex1.val);
chWrite(i,3,val|(~chan[i].std.ex1.val&0xf));
} }
if (i<7 && chan[i].std.ex2.had) { if (chan[i].std.ex2.had) {
unsigned char val=chRead(i,3)&0x0f; chWrite(i,3,chan[i].std.ex2.val);
chWrite(i,3,val|((~chan[i].std.ex2.val&0xf)<<4));
} }
if (chan[i].std.ex3.had) { if (chan[i].std.ex3.had) {
chan[i].invertL=chan[i].std.ex3.val&2; chan[i].invertL=chan[i].std.ex3.val&2;
@ -242,16 +221,16 @@ void DivPlatformKurumitsu8L::tick(bool sysTick) {
} }
if (chan[i].freqChanged) { if (chan[i].freqChanged) {
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,chipClock,CHIP_FREQBASE); chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,chipClock,CHIP_FREQBASE);
if (i==7) { if (chan[i].pcm) {
DivSample* s=parent->getSample(chan[i].sample); DivSample* s=parent->getSample(chan[i].sample);
double off=(s->centerRate>=1)?((double)s->centerRate/parent->getCenterRate()):1.0; double off=(s->centerRate>=1)?((double)s->centerRate/parent->getCenterRate()):1.0;
chan[i].freq*=off/16.; chan[i].freq*=off/16.;
} }
if (chan[i].freq<0) chan[i].freq=0; if (chan[i].freq<0) chan[i].freq=0;
if (chan[i].freq>8388608) chan[i].freq=8388608; if (chan[i].freq>8388608) chan[i].freq=8388608;
chWrite(i,4,chan[i].freq&0xff); chWrite(i,12,chan[i].freq&0xff);
chWrite(i,5,(chan[i].freq>>8)&0xff); chWrite(i,13,(chan[i].freq>>8)&0xff);
chWrite(i,6,(chan[i].freq>>16)&0xff); chWrite(i,14,(chan[i].freq>>16)&0xff);
chan[i].freqChanged=false; chan[i].freqChanged=false;
} }
if (chan[i].keyOn || chan[i].keyOff) { if (chan[i].keyOn || chan[i].keyOff) {
@ -259,15 +238,14 @@ void DivPlatformKurumitsu8L::tick(bool sysTick) {
chan[i].outVol=255; chan[i].outVol=255;
} }
if (!isMuted[i] && chan[i].active) { if (!isMuted[i] && chan[i].active) {
chWrite(i,0,~chan[i].outVol&255); chWrite(i,1,chan[i].outVol);
} else { } else {
chWrite(i,0,255); chWrite(i,1,0);
} }
panChanged=true; panChanged=true;
echoChanged=true;
if (chan[i].keyOn) { if (chan[i].keyOn) {
chan[i].keyOn=false; chan[i].keyOn=false;
if (i==7) { if (chan[i].pcm) {
DivSample* s=parent->getSample(chan[i].sample); DivSample* s=parent->getSample(chan[i].sample);
unsigned int start, length, loop; unsigned int start, length, loop;
start=sampleOff[chan[i].sample]; start=sampleOff[chan[i].sample];
@ -282,21 +260,23 @@ void DivPlatformKurumitsu8L::tick(bool sysTick) {
if (chan[i].audPos>0) { if (chan[i].audPos>0) {
start=start+MIN(chan[i].audPos,length); start=start+MIN(chan[i].audPos,length);
} }
chWrite(i,16,0);
chWrite(i,17,0);
chWrite(i,18,start&0xff);
chWrite(i,19,(start>>8)&0xff);
chWrite(i,0,start>>16);
chWrite(i,8,(start+length)&0xff);
chWrite(i,9,((start+length)>>8)&0xff);
chWrite(i,10,loop&0xff);
chWrite(i,11,(loop>>8)&0xff);
} else {
chWrite(i,8,0); chWrite(i,8,0);
chWrite(i,9,0); chWrite(i,9,0);
chWrite(i,10,start&0xff);
chWrite(i,11,(start>>8)&0xff);
chWrite(i,3,start>>16);
chWrite(i,12,(start+length)&0xff);
chWrite(i,13,((start+length)>>8)&0xff);
chWrite(i,14,loop&0xff);
chWrite(i,15,(loop>>8)&0xff);
} }
} }
if (chan[i].keyOff) chan[i].keyOff=false; if (chan[i].keyOff) chan[i].keyOff=false;
} }
if (panChanged) writePan(i); if (panChanged) writePan(i);
if (echoChanged) writeEcho(i);
} }
} }
@ -305,7 +285,8 @@ int DivPlatformKurumitsu8L::dispatch(DivCommand c) {
case DIV_CMD_NOTE_ON: { case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_AMIGA); DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_AMIGA);
chan[c.chan].isAmiga=ins->type==DIV_INS_AMIGA; chan[c.chan].isAmiga=ins->type==DIV_INS_AMIGA;
if (c.chan==7 && c.value!=DIV_NOTE_NULL) { chan[c.chan].pcm=ins->type==DIV_INS_AMIGA || ins->amiga.useSample;
if (chan[c.chan].pcm && c.value!=DIV_NOTE_NULL) {
chan[c.chan].sample=ins->amiga.getSample(c.value); chan[c.chan].sample=ins->amiga.getSample(c.value);
c.value=ins->amiga.getFreq(c.value); c.value=ins->amiga.getFreq(c.value);
} else { } else {
@ -315,7 +296,7 @@ int DivPlatformKurumitsu8L::dispatch(DivCommand c) {
} }
chan[c.chan].ws.init(ins,256,255,chan[c.chan].insChanged); chan[c.chan].ws.init(ins,256,255,chan[c.chan].insChanged);
} }
if (c.chan!=7 || chan[c.chan].sample<0 || chan[c.chan].sample>=parent->song.sampleLen) { if (!chan[c.chan].pcm || chan[c.chan].sample<0 || chan[c.chan].sample>=parent->song.sampleLen) {
chan[c.chan].sample=-1; chan[c.chan].sample=-1;
} }
if (c.value!=DIV_NOTE_NULL) { if (c.value!=DIV_NOTE_NULL) {
@ -329,7 +310,7 @@ int DivPlatformKurumitsu8L::dispatch(DivCommand c) {
if (!parent->song.brokenOutVol && !chan[c.chan].std.vol.will) { if (!parent->song.brokenOutVol && !chan[c.chan].std.vol.will) {
chan[c.chan].outVol=255; chan[c.chan].outVol=255;
if (!isMuted[c.chan] && chan[c.chan].active) { if (!isMuted[c.chan] && chan[c.chan].active) {
chWrite(c.chan,0,~chan[c.chan].outVol&255); chWrite(c.chan,1,chan[c.chan].outVol);
} }
} }
chan[c.chan].insChanged=false; chan[c.chan].insChanged=false;
@ -420,32 +401,15 @@ int DivPlatformKurumitsu8L::dispatch(DivCommand c) {
chan[c.chan].setPos=true; chan[c.chan].setPos=true;
break; break;
case DIV_CMD_FM_FB: { case DIV_CMD_FM_FB: {
if (c.chan>=7) break; chWrite(c.chan,2,c.value);
unsigned char val=chRead(c.chan,3)&0xf0;
chWrite(c.chan,3,val|(~c.value&0xf));
break; break;
} }
case DIV_CMD_FM_PM_DEPTH: { case DIV_CMD_FM_PM_DEPTH: {
if (c.chan>=7) break; chWrite(c.chan,3,c.value);
unsigned char val=chRead(c.chan,3)&0x0f;
chWrite(c.chan,3,val|((~c.value&0xf)<<4));
break; break;
} }
case DIV_CMD_SNES_ECHO:
chan[c.chan].echo=c.value;
writeEcho(c.chan);
break;
case DIV_CMD_SNES_ECHO_FEEDBACK:
chWrite(8,0,c.value);
break;
case DIV_CMD_SNES_ECHO_VOL_LEFT:
chWrite(8,1,c.value);
break;
case DIV_CMD_SNES_ECHO_VOL_RIGHT:
chWrite(8,2,c.value);
break;
case DIV_CMD_GET_VOLMAX: case DIV_CMD_GET_VOLMAX:
return 127; return 255;
break; break;
case DIV_CMD_MACRO_OFF: case DIV_CMD_MACRO_OFF:
chan[c.chan].std.mask(c.value,true); chan[c.chan].std.mask(c.value,true);
@ -465,11 +429,10 @@ int DivPlatformKurumitsu8L::dispatch(DivCommand c) {
void DivPlatformKurumitsu8L::muteChannel(int ch, bool mute) { void DivPlatformKurumitsu8L::muteChannel(int ch, bool mute) {
isMuted[ch]=mute; isMuted[ch]=mute;
if (!mute && chan[ch].active) { if (!mute && chan[ch].active) {
chWrite(ch,0,~chan[ch].outVol&255); chWrite(ch,1,chan[ch].outVol);
writePan(ch); writePan(ch);
writeEcho(ch);
} else { } else {
chWrite(ch,0,255); chWrite(ch,1,0);
} }
} }
@ -491,20 +454,22 @@ DivMacroInt* DivPlatformKurumitsu8L::getChanMacroInt(int ch) {
} }
unsigned short DivPlatformKurumitsu8L::getPan(int ch) { unsigned short DivPlatformKurumitsu8L::getPan(int ch) {
return (chRead(ch,1)<<8)|chRead(ch,2); short panL=abs(chRead(ch,4)|((short)chRead(ch,5)<<8));
short panR=abs(chRead(ch,6)|((short)chRead(ch,7)<<8));
return ((panL/128)<<8)|(panR/128);
} }
void DivPlatformKurumitsu8L::getPaired(int ch, std::vector<DivChannelPair>& ret) { void DivPlatformKurumitsu8L::getPaired(int ch, std::vector<DivChannelPair>& ret) {
if (ch==0 || ch==7) return; if (ch==0) return;
unsigned char mod=~(chRead(ch,3)>>4)&0xf; unsigned char mod=chRead(ch,3);
if (mod>0) { if (mod!=0) {
sprintf(modLabel[ch],"%d",mod); sprintf(modLabel[ch],"%d",mod);
ret.push_back(DivChannelPair(modLabel[ch],ch-1)); ret.push_back(DivChannelPair(modLabel[ch],ch-1));
} }
} }
DivSamplePos DivPlatformKurumitsu8L::getSamplePos(int ch) { DivSamplePos DivPlatformKurumitsu8L::getSamplePos(int ch) {
if (ch!=7 || chan[ch].sample<0 || if (!chan[ch].pcm || chan[ch].sample<0 ||
chan[ch].sample>=parent->song.sampleLen || !chan[ch].active chan[ch].sample>=parent->song.sampleLen || !chan[ch].active
) { ) {
return DivSamplePos(); return DivSamplePos();
@ -525,7 +490,7 @@ unsigned char* DivPlatformKurumitsu8L::getRegisterPool() {
} }
int DivPlatformKurumitsu8L::getRegisterPoolSize() { int DivPlatformKurumitsu8L::getRegisterPoolSize() {
return 16*8+3; return 24*8;
} }
const void* DivPlatformKurumitsu8L::getSampleMem(int index) { const void* DivPlatformKurumitsu8L::getSampleMem(int index) {
@ -552,7 +517,6 @@ const DivMemoryComposition* DivPlatformKurumitsu8L::getMemCompo(int index) {
switch (index) { switch (index) {
case 0: return &romMemCompo; case 0: return &romMemCompo;
case 1: return &wtMemCompo; case 1: return &wtMemCompo;
case 2: return &echoMemCompo;
} }
return NULL; return NULL;
} }
@ -598,9 +562,7 @@ void DivPlatformKurumitsu8L::renderSamples(int sysID) {
void DivPlatformKurumitsu8L::reset() { void DivPlatformKurumitsu8L::reset() {
memset(regPool,0,sizeof(regPool)); memset(regPool,0,sizeof(regPool));
memset(wtMem,0xff,sizeof(wtMem)); memset(wtMem,0,sizeof(wtMem));
memset(echoMem,0,sizeof(echoMem));
echoPtr=0;
if (dumpWrites) { if (dumpWrites) {
addWrite(0xffffffff,0); addWrite(0xffffffff,0);
} }
@ -609,12 +571,7 @@ void DivPlatformKurumitsu8L::reset() {
chan[i].std.setEngine(parent); chan[i].std.setEngine(parent);
chan[i].ws.setEngine(parent); chan[i].ws.setEngine(parent);
chan[i].ws.init(NULL,256,255,false); chan[i].ws.init(NULL,256,255,false);
chWrite(i,0,0xff); // set env to min
if (i<7) chWrite(i,3,0xff); // set mod to min
} }
chWrite(8,0,initEchoFeedback);
chWrite(8,1,initEchoVolL);
chWrite(8,2,initEchoVolR);
} }
int DivPlatformKurumitsu8L::getOutputCount() { int DivPlatformKurumitsu8L::getOutputCount() {
@ -640,13 +597,6 @@ void DivPlatformKurumitsu8L::notifyInsDeletion(void* ins) {
} }
} }
int DivPlatformKurumitsu8L::mapVelocity(int ch, float vel) {
// -0.19dB per step
if (vel==0) return 0;
if (vel>=1.0) return 255;
return CLAMP(roundf(256.f-(32.f-log2f(vel)*32.f)),0,255);
}
void DivPlatformKurumitsu8L::setFlags(const DivConfig& flags) { void DivPlatformKurumitsu8L::setFlags(const DivConfig& flags) {
chipClock=3072000; chipClock=3072000;
CHECK_CUSTOM_CLOCK; CHECK_CUSTOM_CLOCK;
@ -654,18 +604,15 @@ void DivPlatformKurumitsu8L::setFlags(const DivConfig& flags) {
for (int i=0; i<8; i++) { for (int i=0; i<8; i++) {
oscBuf[i]->setRate(rate); oscBuf[i]->setRate(rate);
} }
initEchoVolL=flags.getInt("echoVolL",0);
initEchoVolR=flags.getInt("echoVolR",0);
initEchoFeedback=flags.getInt("echoFeedback",0);
} }
void DivPlatformKurumitsu8L::poke(unsigned int addr, unsigned short val) { void DivPlatformKurumitsu8L::poke(unsigned int addr, unsigned short val) {
if (addr < (unsigned int)getRegisterPoolSize()) chWrite(addr>>4,addr&0xf,val); if (addr < (unsigned int)getRegisterPoolSize()) chWrite(addr/24,addr%24,val);
} }
void DivPlatformKurumitsu8L::poke(std::vector<DivRegWrite>& wlist) { void DivPlatformKurumitsu8L::poke(std::vector<DivRegWrite>& wlist) {
for (DivRegWrite& i: wlist) { for (DivRegWrite& i: wlist) {
if (i.addr < (unsigned int)getRegisterPoolSize()) chWrite(i.addr>>4,i.addr&0xf,i.val); if (i.addr < (unsigned int)getRegisterPoolSize()) chWrite(i.addr/24,i.addr%24,i.val);
} }
} }
@ -684,22 +631,14 @@ int DivPlatformKurumitsu8L::init(DivEngine* p, int channels, int sugRate, const
romMemCompo.name="Sample ROM"; romMemCompo.name="Sample ROM";
wtMemCompo=DivMemoryComposition(); wtMemCompo=DivMemoryComposition();
wtMemCompo.name="Wavetable RAM"; wtMemCompo.name="Wavetable RAM";
wtMemCompo.capacity=256*7; wtMemCompo.capacity=256*8;
wtMemCompo.memory=(unsigned char*)wtMem; wtMemCompo.memory=(unsigned char*)wtMem;
wtMemCompo.waveformView=DIV_MEMORY_WAVE_8BIT_SIGNED; wtMemCompo.waveformView=DIV_MEMORY_WAVE_8BIT_SIGNED;
echoMemCompo=DivMemoryComposition(); wtMemCompo.used=256*8;
echoMemCompo.name="Echo Buffer";
echoMemCompo.capacity=4096;
echoMemCompo.memory=(unsigned char*)echoMem;
echoMemCompo.waveformView=DIV_MEMORY_WAVE_8BIT_SIGNED;
wtMemCompo.used=256*7;
echoMemCompo.used=4096;
wtMemCompo.entries.clear(); wtMemCompo.entries.clear();
echoMemCompo.entries.clear(); for (int i=0; i<8; i++) {
for (int i=0; i<7; i++) {
wtMemCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_WAVE_RAM, fmt::sprintf("Channel %d",i+1),-1,i*256,i*256+256)); wtMemCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_WAVE_RAM, fmt::sprintf("Channel %d",i+1),-1,i*256,i*256+256));
} }
echoMemCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_ECHO, "Echo Buffer",-1,0,4096));
setFlags(flags); setFlags(flags);
reset(); reset();
return 8; return 8;

View file

@ -27,22 +27,21 @@
class DivPlatformKurumitsu8L: public DivDispatch { class DivPlatformKurumitsu8L: public DivDispatch {
struct Channel: public SharedChannel<int> { struct Channel: public SharedChannel<int> {
unsigned char panL, panR; unsigned char panL, panR;
unsigned char echo;
unsigned int audPos; unsigned int audPos;
int sample, wave; int sample, wave;
bool invertL, invertR; bool invertL, invertR;
bool setPos, isAmiga; bool pcm, setPos, isAmiga;
DivWaveSynth ws; DivWaveSynth ws;
Channel(): Channel():
SharedChannel<int>(127), SharedChannel<int>(255),
panL(127), panL(255),
panR(127), panR(255),
echo(0),
audPos(0), audPos(0),
sample(-1), sample(-1),
wave(-1), wave(-1),
invertL(false), invertL(false),
invertR(false), invertR(false),
pcm(false),
setPos(false), setPos(false),
isAmiga(false) {} isAmiga(false) {}
}; };
@ -52,22 +51,15 @@ class DivPlatformKurumitsu8L: public DivDispatch {
unsigned int sampleOff[256]; unsigned int sampleOff[256];
bool sampleLoaded[256]; bool sampleLoaded[256];
unsigned char regPool[8*16+3]; unsigned char regPool[8*24];
signed char wtMem[7][256]; signed char wtMem[8][256];
signed char echoMem[4096];
int echoPtr;
char modLabel[8][4]; char modLabel[8][4];
signed char initEchoVolL;
signed char initEchoVolR;
signed char initEchoFeedback;
signed char* sampleMem; signed char* sampleMem;
size_t sampleMemLen; size_t sampleMemLen;
DivMemoryComposition romMemCompo; DivMemoryComposition romMemCompo;
DivMemoryComposition wtMemCompo; DivMemoryComposition wtMemCompo;
DivMemoryComposition echoMemCompo;
void updateWave(int ch); void updateWave(int ch);
void writePan(int ch); void writePan(int ch);
void writeEcho(int ch);
friend void putDispatchChip(void*,int); friend void putDispatchChip(void*,int);
friend void putDispatchChan(void*,int,int); friend void putDispatchChan(void*,int,int);
public: public:
@ -90,7 +82,6 @@ class DivPlatformKurumitsu8L: public DivDispatch {
void setFlags(const DivConfig& flags); void setFlags(const DivConfig& flags);
void notifyWaveChange(int wave); void notifyWaveChange(int wave);
void notifyInsDeletion(void* ins); void notifyInsDeletion(void* ins);
int mapVelocity(int ch, float vel);
void poke(unsigned int addr, unsigned short val); void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist); void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet(); const char** getRegisterSheet();

View file

@ -314,7 +314,7 @@ const char* DivEngine::getChannelName(int chan) {
if (chan<0 || chan>chans) return "??"; if (chan<0 || chan>chans) return "??";
if (!curSubSong->chanName[chan].empty()) return curSubSong->chanName[chan].c_str(); if (!curSubSong->chanName[chan].empty()) return curSubSong->chanName[chan].c_str();
if (sysDefs[sysOfChan[chan]]==NULL) return "??"; if (sysDefs[sysOfChan[chan]]==NULL) return "??";
const char* ret=sysDefs[sysOfChan[chan]]->chanNames[dispatchChanOfChan[chan]]; const char* ret=sysDefs[sysOfChan[chan]]->chanNames[dispatchChanOfChan[chan]];
if (ret==NULL) return "??"; if (ret==NULL) return "??";
return ret; return ret;
@ -324,7 +324,7 @@ const char* DivEngine::getChannelShortName(int chan) {
if (chan<0 || chan>chans) return "??"; if (chan<0 || chan>chans) return "??";
if (!curSubSong->chanShortName[chan].empty()) return curSubSong->chanShortName[chan].c_str(); if (!curSubSong->chanShortName[chan].empty()) return curSubSong->chanShortName[chan].c_str();
if (sysDefs[sysOfChan[chan]]==NULL) return "??"; if (sysDefs[sysOfChan[chan]]==NULL) return "??";
const char* ret=sysDefs[sysOfChan[chan]]->chanShortNames[dispatchChanOfChan[chan]]; const char* ret=sysDefs[sysOfChan[chan]]->chanShortNames[dispatchChanOfChan[chan]];
if (ret==NULL) return "??"; if (ret==NULL) return "??";
return ret; return ret;
@ -2174,7 +2174,7 @@ void DivEngine::registerSystems() {
); );
sysDefs[DIV_SYSTEM_ESFM]=new DivSysDef( sysDefs[DIV_SYSTEM_ESFM]=new DivSysDef(
_("ESS ES1xxx series (ESFM)"), NULL, 0xd1, 0, 18, true, false, 0, false, 0, 0, 0, _("ESS ES1xxx series (ESFM)"), NULL, 0xd1, 0, 18, true, false, 0, false, 0, 0, 0,
_("a unique FM synth featured in PC sound cards.\nbased on the OPL3 design, but with lots of its features extended."), _("a unique FM synth featured in PC sound cards.\nbased on the OPL3 design, but with lots of its features extended."),
{_("FM 1"), _("FM 2"), _("FM 3"), _("FM 4"), _("FM 5"), _("FM 6"), _("FM 7"), _("FM 8"), _("FM 9"), _("FM 10"), _("FM 11"), _("FM 12"), _("FM 13"), _("FM 14"), _("FM 15"), _("FM 16"), _("FM 17"), _("FM 18")}, {_("FM 1"), _("FM 2"), _("FM 3"), _("FM 4"), _("FM 5"), _("FM 6"), _("FM 7"), _("FM 8"), _("FM 9"), _("FM 10"), _("FM 11"), _("FM 12"), _("FM 13"), _("FM 14"), _("FM 15"), _("FM 16"), _("FM 17"), _("FM 18")},
{"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18"}, {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18"},
@ -2186,9 +2186,9 @@ void DivEngine::registerSystems() {
}, },
fmESFMPostEffectHandlerMap fmESFMPostEffectHandlerMap
); );
sysDefs[DIV_SYSTEM_POWERNOISE]=new DivSysDef( sysDefs[DIV_SYSTEM_POWERNOISE]=new DivSysDef(
_("PowerNoise"), NULL, 0xd4, 0, 4, false, false, 0, false, 0, 0, 0, _("PowerNoise"), NULL, 0xd4, 0, 4, false, false, 0, false, 0, 0, 0,
_("a fantasy sound chip designed by jvsTSX and The Beesh-Spweesh!\nused in the Hexheld fantasy console."), _("a fantasy sound chip designed by jvsTSX and The Beesh-Spweesh!\nused in the Hexheld fantasy console."),
{_("Noise 1"), _("Noise 2"), _("Noise 3"), _("Slope")}, {_("Noise 1"), _("Noise 2"), _("Noise 3"), _("Slope")},
{"N1", "N2", "N3", "SL"}, {"N1", "N2", "N3", "SL"},
@ -2222,7 +2222,7 @@ void DivEngine::registerSystems() {
{0x16, {DIV_CMD_DAVE_CLOCK_DIV, _("16xx: Set clock divider (0: /2; 1: /3)")}}, {0x16, {DIV_CMD_DAVE_CLOCK_DIV, _("16xx: Set clock divider (0: /2; 1: /3)")}},
} }
); );
sysDefs[DIV_SYSTEM_GBA_DMA]=new DivSysDef( sysDefs[DIV_SYSTEM_GBA_DMA]=new DivSysDef(
_("Game Boy Advance DMA Sound"), NULL, 0xd7, 0, 2, false, true, 0, false, 1U<<DIV_SAMPLE_DEPTH_8BIT, 0, 256, _("Game Boy Advance DMA Sound"), NULL, 0xd7, 0, 2, false, true, 0, false, 1U<<DIV_SAMPLE_DEPTH_8BIT, 0, 256,
_("additional PCM FIFO channels in Game Boy Advance driven directly by its DMA hardware."), _("additional PCM FIFO channels in Game Boy Advance driven directly by its DMA hardware."),
@ -2305,7 +2305,7 @@ void DivEngine::registerSystems() {
} }
); );
sysDefs[DIV_SYSTEM_SID2]=new DivSysDef( sysDefs[DIV_SYSTEM_SID2]=new DivSysDef(
_("SID2"), NULL, 0xf0, 0, 3, false, true, 0, false, 0, 0, 0, _("SID2"), NULL, 0xf0, 0, 3, false, true, 0, false, 0, 0, 0,
_("a fantasy sound chip created by LTVA. it is similar to the SID chip, but with many of its problems fixed."), _("a fantasy sound chip created by LTVA. it is similar to the SID chip, but with many of its problems fixed."),
{_("Channel 1"), _("Channel 2"), _("Channel 3")}, {_("Channel 1"), _("Channel 2"), _("Channel 3")},
@ -2313,11 +2313,11 @@ void DivEngine::registerSystems() {
{DIV_CH_NOISE, DIV_CH_NOISE, DIV_CH_NOISE}, {DIV_CH_NOISE, DIV_CH_NOISE, DIV_CH_NOISE},
{DIV_INS_SID2, DIV_INS_SID2, DIV_INS_SID2}, {DIV_INS_SID2, DIV_INS_SID2, DIV_INS_SID2},
{}, {},
{}, {},
SID2PostEffectHandlerMap SID2PostEffectHandlerMap
); );
sysDefs[DIV_SYSTEM_SID3]=new DivSysDef( sysDefs[DIV_SYSTEM_SID3]=new DivSysDef(
_("SID3"), NULL, 0xf5, 0, 7, false, true, 0, false, (1U<<DIV_SAMPLE_DEPTH_8BIT)|(1U<<DIV_SAMPLE_DEPTH_16BIT), 256, 256, _("SID3"), NULL, 0xf5, 0, 7, false, true, 0, false, (1U<<DIV_SAMPLE_DEPTH_8BIT)|(1U<<DIV_SAMPLE_DEPTH_16BIT), 256, 256,
_("a fantasy sound chip created by LTVA. it is a big rework of SID chip with probably too many features added on top."), _("a fantasy sound chip created by LTVA. it is a big rework of SID chip with probably too many features added on top."),
{_("Channel 1"), _("Channel 2"), _("Channel 3"), _("Channel 4"), _("Channel 5"), _("Channel 6"), _("Wave")}, {_("Channel 1"), _("Channel 2"), _("Channel 3"), _("Channel 4"), _("Channel 5"), _("Channel 6"), _("Wave")},
@ -2325,7 +2325,7 @@ void DivEngine::registerSystems() {
{DIV_CH_NOISE, DIV_CH_NOISE, DIV_CH_NOISE, DIV_CH_NOISE, DIV_CH_NOISE, DIV_CH_NOISE, DIV_CH_WAVE}, {DIV_CH_NOISE, DIV_CH_NOISE, DIV_CH_NOISE, DIV_CH_NOISE, DIV_CH_NOISE, DIV_CH_NOISE, DIV_CH_WAVE},
{DIV_INS_SID3, DIV_INS_SID3, DIV_INS_SID3, DIV_INS_SID3, DIV_INS_SID3, DIV_INS_SID3, DIV_INS_SID3}, {DIV_INS_SID3, DIV_INS_SID3, DIV_INS_SID3, DIV_INS_SID3, DIV_INS_SID3, DIV_INS_SID3, DIV_INS_SID3},
{}, {},
{}, {},
SID3PostEffectHandlerMap SID3PostEffectHandlerMap
); );
@ -2352,21 +2352,17 @@ void DivEngine::registerSystems() {
sysDefs[DIV_SYSTEM_KURUMITSU_8L]=new DivSysDef( sysDefs[DIV_SYSTEM_KURUMITSU_8L]=new DivSysDef(
_("Kurumitsu-8L"), NULL, 0xfe, 0, 8, false, true, 0x151, false, 1U<<DIV_SAMPLE_DEPTH_8BIT, 256, 256, _("Kurumitsu-8L"), NULL, 0xfe, 0, 8, false, true, 0x151, false, 1U<<DIV_SAMPLE_DEPTH_8BIT, 256, 256,
_(":grins:"), _(":zrobilusmiech:"),
{_("Channel 1"), _("Channel 2"), _("Channel 3"), _("Channel 4"), _("Channel 5"), _("Channel 6"), _("Channel 7"), _("Sample")}, {_("Channel 1"), _("Channel 2"), _("Channel 3"), _("Channel 4"), _("Channel 5"), _("Channel 6"), _("Channel 7"), _("Channel 8")},
{"CH1", "CH2", "CH3", "CH4", "CH5", "CH6", "CH7", "CH8"}, {"CH1", "CH2", "CH3", "CH4", "CH5", "CH6", "CH7", "CH8"},
{DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_PCM}, {DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE},
{DIV_INS_KURUMITSU_8L, DIV_INS_KURUMITSU_8L, DIV_INS_KURUMITSU_8L, DIV_INS_KURUMITSU_8L, DIV_INS_KURUMITSU_8L, DIV_INS_KURUMITSU_8L, DIV_INS_KURUMITSU_8L, DIV_INS_KURUMITSU_8L}, {DIV_INS_KURUMITSU_8L, DIV_INS_KURUMITSU_8L, DIV_INS_KURUMITSU_8L, DIV_INS_KURUMITSU_8L, DIV_INS_KURUMITSU_8L, DIV_INS_KURUMITSU_8L, DIV_INS_KURUMITSU_8L, DIV_INS_KURUMITSU_8L},
{}, {},
{ {
{0x10, {DIV_CMD_WAVE, _("10xx: Set waveform")}}, {0x10, {DIV_CMD_WAVE, _("10xx: Set waveform")}},
{0x11, {DIV_CMD_FM_FB, _("11xx: Set feedback (0 to F)")}}, {0x11, {DIV_CMD_FM_FB, _("11xx: Set feedback")}},
{0x12, {DIV_CMD_FM_PM_DEPTH, _("12xx: Set modulation (0 to F)")}}, {0x12, {DIV_CMD_FM_PM_DEPTH, _("12xx: Set modulation")}},
{0x13, {DIV_CMD_SNES_ECHO, _("13xx: Set channel echo input volume")}},
{0x14, {DIV_CMD_SNES_INVERT, _("14xy: Toggle invert (x: left; y: right)")}}, {0x14, {DIV_CMD_SNES_INVERT, _("14xy: Toggle invert (x: left; y: right)")}},
{0x1a, {DIV_CMD_SNES_ECHO_VOL_LEFT, _("1Axx: Set left global echo output volume")}},
{0x1b, {DIV_CMD_SNES_ECHO_VOL_RIGHT, _("1Bxx: Set right global echo output volume")}},
{0x1c, {DIV_CMD_SNES_ECHO_FEEDBACK, _("1Cxx: Set global echo feedback")}},
} }
); );

View file

@ -2069,6 +2069,7 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool p
writeMultiPCM[1]=disCont[i].dispatch; writeMultiPCM[1]=disCont[i].dispatch;
hasMultiPCM|=0x40000000; hasMultiPCM|=0x40000000;
howManyChips++; howManyChips++;
}
break; break;
// HACK // HACK
case DIV_SYSTEM_KURUMITSU_8L: case DIV_SYSTEM_KURUMITSU_8L:

View file

@ -1146,14 +1146,14 @@ WaveFunc waveFuncsIns[]={
quartSin, quartSin,
squiSin, squiSin,
squiAbsSin, squiAbsSin,
rectSaw, rectSaw,
absSaw, absSaw,
cubSaw, cubSaw,
rectCubSaw, rectCubSaw,
absCubSaw, absCubSaw,
cubSine, cubSine,
rectCubSin, rectCubSin,
absCubSin, absCubSin,
@ -1934,7 +1934,7 @@ void FurnaceGUI::drawGBEnv(unsigned char vol, unsigned char len, unsigned char s
ImGui::ItemSize(size,style.FramePadding.y); ImGui::ItemSize(size,style.FramePadding.y);
if (ImGui::ItemAdd(rect,ImGui::GetID("gbEnv"))) { if (ImGui::ItemAdd(rect,ImGui::GetID("gbEnv"))) {
ImGui::RenderFrame(rect.Min,rect.Max,ImGui::GetColorU32(ImGuiCol_FrameBg),true,style.FrameRounding); ImGui::RenderFrame(rect.Min,rect.Max,ImGui::GetColorU32(ImGuiCol_FrameBg),true,style.FrameRounding);
float volY=1.0-((float)vol/15.0); float volY=1.0-((float)vol/15.0);
float lenPos=(sLen>62)?1.0:((float)sLen/384.0); float lenPos=(sLen>62)?1.0:((float)sLen/384.0);
float envEndPoint=((float)len/7.0)*((float)(dir?(15-vol):vol)/15.0); float envEndPoint=((float)len/7.0)*((float)(dir?(15-vol):vol)/15.0);
@ -2450,7 +2450,7 @@ void FurnaceGUI::drawMacroEdit(FurnaceGUIMacroDesc& i, int totalFit, float avail
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding(); ImGui::AlignTextToFramePadding();
ImGui::Text(_("Release")); ImGui::Text(_("Release"));
@ -2757,7 +2757,7 @@ void FurnaceGUI::drawMacros(std::vector<FurnaceGUIMacroDesc>& macros, FurnaceGUI
ImGui::TableNextColumn(); ImGui::TableNextColumn();
if (++curColumn>=columns) curColumn=0; if (++curColumn>=columns) curColumn=0;
float availableWidth=ImGui::GetContentRegionAvail().x-reservedSpace; float availableWidth=ImGui::GetContentRegionAvail().x-reservedSpace;
int totalFit=i.macro->len; int totalFit=i.macro->len;
if (totalFit<1) totalFit=1; if (totalFit<1) totalFit=1;
@ -3459,7 +3459,8 @@ void FurnaceGUI::insTabSample(DivInstrument* ins) {
ins->type==DIV_INS_SU || ins->type==DIV_INS_SU ||
ins->type==DIV_INS_NDS || ins->type==DIV_INS_NDS ||
ins->type==DIV_INS_SUPERVISION || ins->type==DIV_INS_SUPERVISION ||
ins->type==DIV_INS_SID3) { ins->type==DIV_INS_SID3 ||
ins->type==DIV_INS_KURUMITSU_8L) {
P(ImGui::Checkbox(_("Use sample"),&ins->amiga.useSample)); P(ImGui::Checkbox(_("Use sample"),&ins->amiga.useSample));
if (ins->type==DIV_INS_X1_010) { if (ins->type==DIV_INS_X1_010) {
if (ImGui::InputInt(_("Sample bank slot##BANKSLOT"),&ins->x1_010.bankSlot,1,4)) { PARAMETER if (ImGui::InputInt(_("Sample bank slot##BANKSLOT"),&ins->x1_010.bankSlot,1,4)) { PARAMETER
@ -4110,7 +4111,7 @@ void FurnaceGUI::insTabFM(DivInstrument* ins) {
if (ImGui::Button(_("Request from TX81Z"))) { if (ImGui::Button(_("Request from TX81Z"))) {
doAction(GUI_ACTION_TX81Z_REQUEST); doAction(GUI_ACTION_TX81Z_REQUEST);
} }
/* /*
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button("Send to TX81Z")) { if (ImGui::Button("Send to TX81Z")) {
showError("Coming soon!"); showError("Coming soon!");
@ -5128,7 +5129,7 @@ void FurnaceGUI::insTabFM(DivInstrument* ins) {
} }
ImGui::SetCursorPos(prevCurPos); ImGui::SetCursorPos(prevCurPos);
ImGui::TableNextColumn(); ImGui::TableNextColumn();
switch (ins->type) { switch (ins->type) {
case DIV_INS_FM: { case DIV_INS_FM: {
@ -5145,7 +5146,7 @@ void FurnaceGUI::insTabFM(DivInstrument* ins) {
if (CWSliderScalar("##SSG",ImGuiDataType_U8,&ssgEnv,&_ZERO,&_SEVEN,_(ssgEnvTypes[ssgEnv]))) { PARAMETER if (CWSliderScalar("##SSG",ImGuiDataType_U8,&ssgEnv,&_ZERO,&_SEVEN,_(ssgEnvTypes[ssgEnv]))) { PARAMETER
op.ssgEnv=(op.ssgEnv&8)|(ssgEnv&7); op.ssgEnv=(op.ssgEnv&8)|(ssgEnv&7);
} }
// params // params
ImGui::Separator(); ImGui::Separator();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
@ -5219,7 +5220,7 @@ void FurnaceGUI::insTabFM(DivInstrument* ins) {
if (ImGui::Checkbox(FM_NAME(FM_EGS),&ssgOn)) { PARAMETER if (ImGui::Checkbox(FM_NAME(FM_EGS),&ssgOn)) { PARAMETER
op.ssgEnv=(op.ssgEnv&7)|(ssgOn<<3); op.ssgEnv=(op.ssgEnv&7)|(ssgOn<<3);
} }
ImGui::EndTable(); ImGui::EndTable();
} }
@ -5265,11 +5266,11 @@ void FurnaceGUI::insTabFM(DivInstrument* ins) {
if (ImGui::Checkbox(FM_NAME(FM_SUS),&susOn)) { PARAMETER if (ImGui::Checkbox(FM_NAME(FM_SUS),&susOn)) { PARAMETER
op.sus=susOn; op.sus=susOn;
} }
ImGui::EndTable(); ImGui::EndTable();
} }
pushWarningColor(ins->type==DIV_INS_OPL_DRUMS && i==0); pushWarningColor(ins->type==DIV_INS_OPL_DRUMS && i==0);
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
snprintf(tempID,1024,"%s: %%d",FM_NAME(FM_MULT)); snprintf(tempID,1024,"%s: %%d",FM_NAME(FM_MULT));
P(CWSliderScalar("##MULT",ImGuiDataType_U8,&op.mult,&_ZERO,&_FIFTEEN,tempID)); rightClickable P(CWSliderScalar("##MULT",ImGuiDataType_U8,&op.mult,&_ZERO,&_FIFTEEN,tempID)); rightClickable
@ -5314,7 +5315,7 @@ void FurnaceGUI::insTabFM(DivInstrument* ins) {
if (block>7) block=7; if (block>7) block=7;
op.dt=block; op.dt=block;
} }
ImGui::Text(_("Freq")); ImGui::Text(_("Freq"));
ImGui::SameLine(); ImGui::SameLine();
ImGui::SetCursorPos(ImVec2(cursorAlign.x,ImGui::GetCursorPosY())); ImGui::SetCursorPos(ImVec2(cursorAlign.x,ImGui::GetCursorPosY()));
@ -5871,7 +5872,7 @@ void FurnaceGUI::insTabFM(DivInstrument* ins) {
ImGui::Separator(); ImGui::Separator();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::Separator(); ImGui::Separator();
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
@ -5953,7 +5954,7 @@ void FurnaceGUI::insTabFM(DivInstrument* ins) {
} else { } else {
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
pushWarningColor(ins->type==DIV_INS_OPL_DRUMS && i==0); pushWarningColor(ins->type==DIV_INS_OPL_DRUMS && i==0);
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
P(CWSliderScalar(FM_NAME(FM_MULT),ImGuiDataType_U8,&op.mult,&_ZERO,&_FIFTEEN)); rightClickable P(CWSliderScalar(FM_NAME(FM_MULT),ImGuiDataType_U8,&op.mult,&_ZERO,&_FIFTEEN)); rightClickable
if (ins->type==DIV_INS_OPL_DRUMS && i==0) { if (ins->type==DIV_INS_OPL_DRUMS && i==0) {
@ -5965,7 +5966,7 @@ void FurnaceGUI::insTabFM(DivInstrument* ins) {
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::Text("%s",FM_NAME(FM_MULT)); ImGui::Text("%s",FM_NAME(FM_MULT));
} }
if (ins->type==DIV_INS_FM || ins->type==DIV_INS_OPZ || ins->type==DIV_INS_OPM) { if (ins->type==DIV_INS_FM || ins->type==DIV_INS_OPZ || ins->type==DIV_INS_OPM) {
if (!(ins->type==DIV_INS_OPZ && op.egt)) { if (!(ins->type==DIV_INS_OPZ && op.egt)) {
int detune=detuneMap[settings.unsignedDetune?1:0][op.dt&7]; int detune=detuneMap[settings.unsignedDetune?1:0][op.dt&7];
@ -6275,7 +6276,7 @@ void FurnaceGUI::drawInsSID3(DivInstrument* ins) {
ImGui::EndTable(); ImGui::EndTable();
} }
if (!ins->sid3.doWavetable) { if (!ins->sid3.doWavetable) {
strncpy(buffer,macroSID3WaveMixMode(0,(float)ins->sid3.mixMode,NULL).c_str(),40); strncpy(buffer,macroSID3WaveMixMode(0,(float)ins->sid3.mixMode,NULL).c_str(),40);
P(CWSliderScalar(_("Wave Mix Mode"),ImGuiDataType_U8,&ins->sid3.mixMode,&_ZERO,&_FOUR,buffer)); P(CWSliderScalar(_("Wave Mix Mode"),ImGuiDataType_U8,&ins->sid3.mixMode,&_ZERO,&_FOUR,buffer));
@ -6764,7 +6765,7 @@ void FurnaceGUI::drawInsEdit() {
ImGui::EndTable(); ImGui::EndTable();
} }
if (ImGui::BeginTabBar("insEditTab")) { if (ImGui::BeginTabBar("insEditTab")) {
std::vector<FurnaceGUIMacroDesc> macroList; std::vector<FurnaceGUIMacroDesc> macroList;
@ -6926,7 +6927,7 @@ void FurnaceGUI::drawInsEdit() {
macroList.push_back(FurnaceGUIMacroDesc(_("Op. Pitch"),&ins->std.opMacros[ordi].susMacro,-2048,2047,160,uiColors[GUI_COLOR_MACRO_PITCH],true,macroRelativeMode,NULL,false,NULL,false,NULL,false,true)); macroList.push_back(FurnaceGUIMacroDesc(_("Op. Pitch"),&ins->std.opMacros[ordi].susMacro,-2048,2047,160,uiColors[GUI_COLOR_MACRO_PITCH],true,macroRelativeMode,NULL,false,NULL,false,NULL,false,true));
} }
} }
macroList.push_back(FurnaceGUIMacroDesc(FM_NAME(FM_AR),&ins->std.opMacros[ordi].arMacro,0,maxArDr,64,uiColors[GUI_COLOR_MACRO_ENVELOPE])); macroList.push_back(FurnaceGUIMacroDesc(FM_NAME(FM_AR),&ins->std.opMacros[ordi].arMacro,0,maxArDr,64,uiColors[GUI_COLOR_MACRO_ENVELOPE]));
macroList.push_back(FurnaceGUIMacroDesc(FM_NAME(FM_DR),&ins->std.opMacros[ordi].drMacro,0,maxArDr,64,uiColors[GUI_COLOR_MACRO_ENVELOPE])); macroList.push_back(FurnaceGUIMacroDesc(FM_NAME(FM_DR),&ins->std.opMacros[ordi].drMacro,0,maxArDr,64,uiColors[GUI_COLOR_MACRO_ENVELOPE]));
macroList.push_back(FurnaceGUIMacroDesc(FM_NAME(FM_D2R),&ins->std.opMacros[ordi].d2rMacro,0,31,64,uiColors[GUI_COLOR_MACRO_ENVELOPE])); macroList.push_back(FurnaceGUIMacroDesc(FM_NAME(FM_D2R),&ins->std.opMacros[ordi].d2rMacro,0,31,64,uiColors[GUI_COLOR_MACRO_ENVELOPE]));
@ -7284,7 +7285,7 @@ void FurnaceGUI::drawInsEdit() {
P(ImGui::Checkbox(_("Enable filter"),&ins->c64.toFilter)); P(ImGui::Checkbox(_("Enable filter"),&ins->c64.toFilter));
P(ImGui::Checkbox(_("Initialize filter"),&ins->c64.initFilter)); P(ImGui::Checkbox(_("Initialize filter"),&ins->c64.initFilter));
if (ins->type==DIV_INS_SID2) { if (ins->type==DIV_INS_SID2) {
P(CWSliderScalar(_("Cutoff"),ImGuiDataType_U16,&ins->c64.cut,&_ZERO,&_FOUR_THOUSAND_NINETY_FIVE)); rightClickable P(CWSliderScalar(_("Cutoff"),ImGuiDataType_U16,&ins->c64.cut,&_ZERO,&_FOUR_THOUSAND_NINETY_FIVE)); rightClickable
P(CWSliderScalar(_("Resonance"),ImGuiDataType_U8,&ins->c64.res,&_ZERO,&_TWO_HUNDRED_FIFTY_FIVE)); rightClickable P(CWSliderScalar(_("Resonance"),ImGuiDataType_U8,&ins->c64.res,&_ZERO,&_TWO_HUNDRED_FIFTY_FIVE)); rightClickable
@ -7769,7 +7770,7 @@ void FurnaceGUI::drawInsEdit() {
processDrags(ImGui::GetMousePos().x,ImGui::GetMousePos().y); processDrags(ImGui::GetMousePos().x,ImGui::GetMousePos().y);
ImGui::InhibitInertialScroll(); ImGui::InhibitInertialScroll();
} }
if (ImGui::Button(modTableHex?"Hex##MTHex":"Dec##MTHex")) { if (ImGui::Button(modTableHex?"Hex##MTHex":"Dec##MTHex")) {
modTableHex=!modTableHex; modTableHex=!modTableHex;
} }
@ -8061,7 +8062,7 @@ void FurnaceGUI::drawInsEdit() {
ins->type==DIV_INS_NAMCO || ins->type==DIV_INS_NAMCO ||
ins->type==DIV_INS_SM8521 || ins->type==DIV_INS_SM8521 ||
(ins->type==DIV_INS_GBA_MINMOD && ins->amiga.useWave) || (ins->type==DIV_INS_GBA_MINMOD && ins->amiga.useWave) ||
ins->type==DIV_INS_KURUMITSU_8L) ins->type==DIV_INS_KURUMITSU_8L)
{ {
insTabWavetable(ins); insTabWavetable(ins);
} }
@ -8720,7 +8721,7 @@ void FurnaceGUI::drawInsEdit() {
macroList.push_back(FurnaceGUIMacroDesc(_("Ring Mod Source"),&ins->std.fmsMacro,0,SID3_NUM_CHANNELS,64,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,macroSID3SourceChan)); macroList.push_back(FurnaceGUIMacroDesc(_("Ring Mod Source"),&ins->std.fmsMacro,0,SID3_NUM_CHANNELS,64,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,macroSID3SourceChan));
macroList.push_back(FurnaceGUIMacroDesc(_("Hard Sync Source"),&ins->std.amsMacro,0,SID3_NUM_CHANNELS - 1,64,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,macroSID3SourceChan)); macroList.push_back(FurnaceGUIMacroDesc(_("Hard Sync Source"),&ins->std.amsMacro,0,SID3_NUM_CHANNELS - 1,64,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,macroSID3SourceChan));
macroList.push_back(FurnaceGUIMacroDesc(_("Phase Mod Source"),&ins->std.fbMacro,0,SID3_NUM_CHANNELS - 1,64,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,macroSID3SourceChan)); macroList.push_back(FurnaceGUIMacroDesc(_("Phase Mod Source"),&ins->std.fbMacro,0,SID3_NUM_CHANNELS - 1,64,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,macroSID3SourceChan));
if (!ins->sid3.doWavetable) { if (!ins->sid3.doWavetable) {
macroList.push_back(FurnaceGUIMacroDesc(_("Feedback"),&ins->std.opMacros[3].arMacro,0,255,160,uiColors[GUI_COLOR_MACRO_OTHER])); macroList.push_back(FurnaceGUIMacroDesc(_("Feedback"),&ins->std.opMacros[3].arMacro,0,255,160,uiColors[GUI_COLOR_MACRO_OTHER]));
} }
@ -8749,14 +8750,13 @@ void FurnaceGUI::drawInsEdit() {
case DIV_INS_KURUMITSU_8L: case DIV_INS_KURUMITSU_8L:
macroList.push_back(FurnaceGUIMacroDesc(_("Envelope"),&ins->std.volMacro,0,255,160,uiColors[GUI_COLOR_MACRO_VOLUME])); macroList.push_back(FurnaceGUIMacroDesc(_("Envelope"),&ins->std.volMacro,0,255,160,uiColors[GUI_COLOR_MACRO_VOLUME]));
macroList.push_back(FurnaceGUIMacroDesc(_("Arpeggio"),&ins->std.arpMacro,-120,120,160,uiColors[GUI_COLOR_MACRO_PITCH],true,NULL,macroHoverNote,false,NULL,true,ins->std.arpMacro.val)); macroList.push_back(FurnaceGUIMacroDesc(_("Arpeggio"),&ins->std.arpMacro,-120,120,160,uiColors[GUI_COLOR_MACRO_PITCH],true,NULL,macroHoverNote,false,NULL,true,ins->std.arpMacro.val));
macroList.push_back(FurnaceGUIMacroDesc(_("Echo Level"),&ins->std.dutyMacro,-127,127,160,uiColors[GUI_COLOR_MACRO_OTHER]));
macroList.push_back(FurnaceGUIMacroDesc(_("Waveform"),&ins->std.waveMacro,0,waveCount,160,uiColors[GUI_COLOR_MACRO_WAVE],false,NULL,NULL,false,NULL)); macroList.push_back(FurnaceGUIMacroDesc(_("Waveform"),&ins->std.waveMacro,0,waveCount,160,uiColors[GUI_COLOR_MACRO_WAVE],false,NULL,NULL,false,NULL));
macroList.push_back(FurnaceGUIMacroDesc(_("Panning (left)"),&ins->std.panLMacro,0,127,160,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL)); macroList.push_back(FurnaceGUIMacroDesc(_("Panning (left)"),&ins->std.panLMacro,0,255,160,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL));
macroList.push_back(FurnaceGUIMacroDesc(_("Panning (right)"),&ins->std.panRMacro,0,127,160,uiColors[GUI_COLOR_MACRO_OTHER])); macroList.push_back(FurnaceGUIMacroDesc(_("Panning (right)"),&ins->std.panRMacro,0,255,160,uiColors[GUI_COLOR_MACRO_OTHER]));
macroList.push_back(FurnaceGUIMacroDesc(_("Pitch"),&ins->std.pitchMacro,-2048,2047,160,uiColors[GUI_COLOR_MACRO_PITCH],true,macroRelativeMode)); macroList.push_back(FurnaceGUIMacroDesc(_("Pitch"),&ins->std.pitchMacro,-2048,2047,160,uiColors[GUI_COLOR_MACRO_PITCH],true,macroRelativeMode));
macroList.push_back(FurnaceGUIMacroDesc(_("Phase Reset"),&ins->std.phaseResetMacro,0,1,32,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true)); macroList.push_back(FurnaceGUIMacroDesc(_("Phase Reset"),&ins->std.phaseResetMacro,0,1,32,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true));
macroList.push_back(FurnaceGUIMacroDesc(_("Feedback"),&ins->std.ex1Macro,0,15,160,uiColors[GUI_COLOR_MACRO_VOLUME],false,NULL,NULL,false,NULL)); macroList.push_back(FurnaceGUIMacroDesc(_("Feedback"),&ins->std.ex1Macro,0,255,160,uiColors[GUI_COLOR_MACRO_VOLUME],false,NULL,NULL,false,NULL));
macroList.push_back(FurnaceGUIMacroDesc(_("Modulation"),&ins->std.ex2Macro,0,15,160,uiColors[GUI_COLOR_MACRO_VOLUME],false,NULL,NULL,false,NULL)); macroList.push_back(FurnaceGUIMacroDesc(_("Modulation"),&ins->std.ex2Macro,0,255,160,uiColors[GUI_COLOR_MACRO_VOLUME],false,NULL,NULL,false,NULL));
macroList.push_back(FurnaceGUIMacroDesc(_("Special"),&ins->std.ex3Macro,0,2,96,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true,minModModeBits)); macroList.push_back(FurnaceGUIMacroDesc(_("Special"),&ins->std.ex3Macro,0,2,96,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true,minModModeBits));
break; break;
case DIV_INS_MAX: case DIV_INS_MAX:
@ -8949,7 +8949,7 @@ void FurnaceGUI::drawInsEdit() {
} }
ImGui::EndMenu(); ImGui::EndMenu();
} }
ImGui::EndPopup(); ImGui::EndPopup();
} }
} }

View file

@ -2720,38 +2720,6 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
} }
break; break;
} }
case DIV_SYSTEM_KURUMITSU_8L: {
int echoVolL=flags.getInt("echoVolL",0);
int echoVolR=flags.getInt("echoVolR",0);
int echoFeedback=flags.getInt("echoFeedback",0);
ImGui::Text(_("Initial echo state:"));
if (CWSliderInt(_("Feedback##EchoFeedback"),&echoFeedback,-128,127)) {
if (echoFeedback<-128) echoFeedback=-128;
if (echoFeedback>127) echoFeedback=127;
altered=true;
} rightClickable
if (CWSliderInt(_("Left Volume##EchoVolL"),&echoVolL,-128,127)) {
if (echoVolL<-128) echoVolL=-128;
if (echoVolL>127) echoVolL=127;
altered=true;
} rightClickable
if (CWSliderInt(_("Right Volume##EchoVolL"),&echoVolR,-128,127)) {
if (echoVolR<-128) echoVolR=-128;
if (echoVolR>127) echoVolR=127;
altered=true;
} rightClickable
if (altered) {
e->lockSave([&]() {
flags.set("echoVolL",echoVolL);
flags.set("echoVolR",echoVolR);
flags.set("echoFeedback",echoFeedback);
});
}
break;
}
case DIV_SYSTEM_BUBSYS_WSG: case DIV_SYSTEM_BUBSYS_WSG:
case DIV_SYSTEM_PET: case DIV_SYSTEM_PET:
case DIV_SYSTEM_GA20: case DIV_SYSTEM_GA20:
@ -2761,6 +2729,7 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
case DIV_SYSTEM_POWERNOISE: case DIV_SYSTEM_POWERNOISE:
case DIV_SYSTEM_UPD1771C: case DIV_SYSTEM_UPD1771C:
case DIV_SYSTEM_MULTIPCM: case DIV_SYSTEM_MULTIPCM:
case DIV_SYSTEM_KURUMITSU_8L:
break; break;
case DIV_SYSTEM_YMU759: case DIV_SYSTEM_YMU759:
case DIV_SYSTEM_ESFM: case DIV_SYSTEM_ESFM: