Merge branch 'master' into force-critical-input-trickle

This commit is contained in:
tildearrow 2023-08-12 21:52:12 -05:00
commit bbeb3df9f6
189 changed files with 7585 additions and 3187 deletions

View file

@ -485,6 +485,12 @@ class DivDispatch {
*/
virtual bool keyOffAffectsPorta(int ch);
/**
* test whether volume is global.
* @return whether it is.
*/
virtual bool isVolGlobal();
/**
* get the lowest note in a portamento.
* @param ch the channel in question.

View file

@ -80,6 +80,7 @@
#include "platform/pv1000.h"
#include "platform/k053260.h"
#include "platform/ted.h"
#include "platform/c140.h"
#include "platform/pcmdac.h"
#include "platform/dummy.h"
#include "../ta-log.h"
@ -216,13 +217,6 @@ void DivDispatchContainer::clear() {
if (dispatch->getDCOffRequired()) {
dcOffCompensation=true;
}
// run for one cycle to determine DC offset
// TODO: SAA1099 doesn't like that
/*dispatch->acquire(bbIn[0],bbIn[1],0,1);
temp[0]=bbIn[0][0];
temp[1]=bbIn[1][0];
prevSample[0]=temp[0];
prevSample[1]=temp[1];*/
}
void DivDispatchContainer::init(DivSystem sys, DivEngine* eng, int chanCount, double gotRate, const DivConfig& flags) {
@ -479,7 +473,7 @@ void DivDispatchContainer::init(DivSystem sys, DivEngine* eng, int chanCount, do
break;
case DIV_SYSTEM_NAMCO:
dispatch=new DivPlatformNamcoWSG;
// Pac-Man (TODO: support Pole Position?)
// Pac-Man
((DivPlatformNamcoWSG*)dispatch)->setDeviceType(1);
break;
case DIV_SYSTEM_NAMCO_15XX:
@ -511,6 +505,9 @@ void DivDispatchContainer::init(DivSystem sys, DivEngine* eng, int chanCount, do
case DIV_SYSTEM_TED:
dispatch=new DivPlatformTED;
break;
case DIV_SYSTEM_C140:
dispatch=new DivPlatformC140;
break;
case DIV_SYSTEM_PCM_DAC:
dispatch=new DivPlatformPCMDAC;
break;

View file

@ -107,7 +107,7 @@ const char* DivEngine::getEffectDesc(unsigned char effect, int chan, bool notNul
case 0xea:
return "EAxx: Legato";
case 0xeb:
return "EBxx: Set sample bank";
return "EBxx: Set LEGACY sample mode bank";
case 0xec:
return "ECxx: Note cut";
case 0xed:
@ -3113,6 +3113,8 @@ int DivEngine::addInstrumentPtr(DivInstrument* which) {
song.ins.push_back(which);
song.insLen=song.ins.size();
checkAssetDir(song.insDir,song.ins.size());
checkAssetDir(song.waveDir,song.wave.size());
checkAssetDir(song.sampleDir,song.sample.size());
saveLock.unlock();
BUSY_END;
return song.insLen;

View file

@ -605,7 +605,7 @@ class DivEngine {
// - -2 to add a whole loop of trailing
SafeWriter* saveVGM(bool* sysToExport=NULL, bool loop=true, int version=0x171, bool patternHints=false, bool directStream=false, int trailingTicks=-1);
// dump to ZSM.
SafeWriter* saveZSM(unsigned int zsmrate=60, bool loop=true);
SafeWriter* saveZSM(unsigned int zsmrate=60, bool loop=true, bool optimize=true);
// dump command stream.
SafeWriter* saveCommand(bool binary=false);
// export to an audio file

View file

@ -142,76 +142,78 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) {
}
// compatibility flags
ds.limitSlides=true;
ds.linearPitch=1;
ds.loopModality=0;
ds.properNoiseLayout=false;
ds.waveDutyIsVol=false;
// TODO: WHAT?! geodude.dmf fails when this is true
// but isn't that how Defle behaves???
ds.resetMacroOnPorta=false;
ds.legacyVolumeSlides=true;
ds.compatibleArpeggio=true;
ds.noteOffResetsSlides=true;
ds.targetResetsSlides=true;
ds.arpNonPorta=false;
ds.algMacroBehavior=false;
ds.brokenShortcutSlides=false;
ds.ignoreDuplicateSlides=true;
ds.brokenDACMode=true;
ds.oneTickCut=false;
ds.newInsTriggersInPorta=true;
ds.arp0Reset=true;
ds.brokenSpeedSel=true;
ds.noSlidesOnFirstTick=false;
ds.rowResetsArpPos=false;
ds.ignoreJumpAtEnd=true;
ds.buggyPortaAfterSlide=true;
ds.gbInsAffectsEnvelope=true;
ds.ignoreDACModeOutsideIntendedChannel=false;
ds.e1e2AlsoTakePriority=true;
ds.fbPortaPause=true;
ds.snDutyReset=true;
ds.oldOctaveBoundary=false;
ds.noOPN2Vol=true;
ds.newVolumeScaling=false;
ds.volMacroLinger=false;
ds.brokenOutVol=true;
ds.brokenOutVol2=true;
ds.e1e2StopOnSameNote=true;
ds.brokenPortaArp=false;
ds.snNoLowPeriods=true;
ds.disableSampleMacro=true;
ds.delayBehavior=0;
ds.jumpTreatment=2;
if (!getConfInt("noDMFCompat",0)) {
ds.limitSlides=true;
ds.linearPitch=1;
ds.loopModality=0;
ds.properNoiseLayout=false;
ds.waveDutyIsVol=false;
// TODO: WHAT?! geodude.dmf fails when this is true
// but isn't that how Defle behaves???
ds.resetMacroOnPorta=false;
ds.legacyVolumeSlides=true;
ds.compatibleArpeggio=true;
ds.noteOffResetsSlides=true;
ds.targetResetsSlides=true;
ds.arpNonPorta=false;
ds.algMacroBehavior=false;
ds.brokenShortcutSlides=false;
ds.ignoreDuplicateSlides=true;
ds.brokenDACMode=true;
ds.oneTickCut=false;
ds.newInsTriggersInPorta=true;
ds.arp0Reset=true;
ds.brokenSpeedSel=true;
ds.noSlidesOnFirstTick=false;
ds.rowResetsArpPos=false;
ds.ignoreJumpAtEnd=true;
ds.buggyPortaAfterSlide=true;
ds.gbInsAffectsEnvelope=true;
ds.ignoreDACModeOutsideIntendedChannel=false;
ds.e1e2AlsoTakePriority=true;
ds.fbPortaPause=true;
ds.snDutyReset=true;
ds.oldOctaveBoundary=false;
ds.noOPN2Vol=true;
ds.newVolumeScaling=false;
ds.volMacroLinger=false;
ds.brokenOutVol=true;
ds.brokenOutVol2=true;
ds.e1e2StopOnSameNote=true;
ds.brokenPortaArp=false;
ds.snNoLowPeriods=true;
ds.disableSampleMacro=true;
ds.delayBehavior=0;
ds.jumpTreatment=2;
// 1.1 compat flags
if (ds.version>24) {
ds.waveDutyIsVol=true;
ds.legacyVolumeSlides=false;
}
// 1.1 compat flags
if (ds.version>24) {
ds.waveDutyIsVol=true;
ds.legacyVolumeSlides=false;
}
// Neo Geo detune is caused by Defle running Neo Geo at the wrong clock.
/*
if (ds.system[0]==DIV_SYSTEM_YM2610 || ds.system[0]==DIV_SYSTEM_YM2610_EXT
|| ds.system[0]==DIV_SYSTEM_YM2610_FULL || ds.system[0]==DIV_SYSTEM_YM2610_FULL_EXT
|| ds.system[0]==DIV_SYSTEM_YM2610B || ds.system[0]==DIV_SYSTEM_YM2610B_EXT) {
ds.tuning=443.23;
}
*/
// Neo Geo detune is caused by Defle running Neo Geo at the wrong clock.
/*
if (ds.system[0]==DIV_SYSTEM_YM2610 || ds.system[0]==DIV_SYSTEM_YM2610_EXT
|| ds.system[0]==DIV_SYSTEM_YM2610_FULL || ds.system[0]==DIV_SYSTEM_YM2610_FULL_EXT
|| ds.system[0]==DIV_SYSTEM_YM2610B || ds.system[0]==DIV_SYSTEM_YM2610B_EXT) {
ds.tuning=443.23;
}
*/
// Genesis detuned on Defle v10 and earlier
/*if (ds.version<19 && ds.system[0]==DIV_SYSTEM_GENESIS) {
ds.tuning=443.23;
}*/
// C64 detuned on Defle v11 and earlier
/*if (ds.version<21 && (ds.system[0]==DIV_SYSTEM_C64_6581 || ds.system[0]==DIV_SYSTEM_C64_8580)) {
ds.tuning=433.2;
}*/
// Genesis detuned on Defle v10 and earlier
/*if (ds.version<19 && ds.system[0]==DIV_SYSTEM_GENESIS) {
ds.tuning=443.23;
}*/
// C64 detuned on Defle v11 and earlier
/*if (ds.version<21 && (ds.system[0]==DIV_SYSTEM_C64_6581 || ds.system[0]==DIV_SYSTEM_C64_8580)) {
ds.tuning=433.2;
}*/
// Game Boy arp+soundLen screwery
if (ds.system[0]==DIV_SYSTEM_GB) {
ds.systemFlags[0].set("enoughAlready",true);
// Game Boy arp+soundLen screwery
if (ds.system[0]==DIV_SYSTEM_GB) {
ds.systemFlags[0].set("enoughAlready",true);
}
}
logI("reading module data...");
@ -869,7 +871,7 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) {
if (ds.version>0x15) {
sample->depth=(DivSampleDepth)reader.readC();
if (sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT) {
logW("%d: sample depth is wrong! (%d)",i,sample->depth);
logW("%d: sample depth is wrong! (%d)",i,(int)sample->depth);
sample->depth=DIV_SAMPLE_DEPTH_16BIT;
}
} else {
@ -2344,7 +2346,7 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
}
}
if (ds.version>=136) song.patchbayAuto=reader.readC();
if (ds.version>=136) ds.patchbayAuto=reader.readC();
if (ds.version>=138) {
ds.brokenPortaLegato=reader.readC();

View file

@ -963,6 +963,10 @@ void DivInstrument::putInsData2(SafeWriter* w, bool fui, const DivSong* song) {
break;
case DIV_INS_TED:
break;
case DIV_INS_C140:
featureSM=true;
featureSL=true;
break;
case DIV_INS_MAX:
break;

View file

@ -83,6 +83,7 @@ enum DivInstrumentType: unsigned short {
DIV_INS_K053260=50,
// DIV_INS_YMF292=51,
DIV_INS_TED=52,
DIV_INS_C140=53,
DIV_INS_MAX,
DIV_INS_NULL
};

View file

@ -86,6 +86,10 @@ bool DivDispatch::keyOffAffectsPorta(int ch) {
return false;
}
bool DivDispatch::isVolGlobal() {
return false;
}
int DivDispatch::getPortaFloor(int ch) {
return 0x00;
}

View file

@ -115,7 +115,7 @@ const unsigned char dacLogTableAY[256]={
void DivPlatformAY8910::runDAC() {
for (int i=0; i<3; i++) {
if (chan[i].active && chan[i].curPSGMode.dac && chan[i].dac.sample!=-1) {
if (chan[i].active && (chan[i].curPSGMode.val&8) && chan[i].dac.sample!=-1) {
chan[i].dac.period+=chan[i].dac.rate;
bool end=false;
bool changed=false;
@ -243,7 +243,7 @@ void DivPlatformAY8910::tick(bool sysTick) {
if (chan[i].std.vol.had) {
chan[i].outVol=MIN(15,chan[i].std.vol.val)-(15-(chan[i].vol&15));
if (chan[i].outVol<0) chan[i].outVol=0;
if (!chan[i].nextPSGMode.dac) {
if (!(chan[i].nextPSGMode.val&8)) {
if (isMuted[i]) {
rWrite(0x08+i,0);
} else if (intellivision && (chan[i].nextPSGMode.getEnvelope())) {
@ -265,7 +265,7 @@ void DivPlatformAY8910::tick(bool sysTick) {
rWrite(0x06,31-chan[i].std.duty.val);
}
if (chan[i].std.wave.had) {
if (!chan[i].nextPSGMode.dac) {
if (!(chan[i].nextPSGMode.val&8)) {
chan[i].nextPSGMode.val=(chan[i].std.wave.val+1)&7;
if (chan[i].active) {
chan[i].curPSGMode.val=chan[i].nextPSGMode.val;
@ -290,7 +290,7 @@ void DivPlatformAY8910::tick(bool sysTick) {
}
if (chan[i].std.phaseReset.had) {
if (chan[i].std.phaseReset.val==1) {
if (chan[i].nextPSGMode.dac) {
if (chan[i].nextPSGMode.val&8) {
if (dumpWrites) addWrite(0xffff0002+(i<<8),0);
if (chan[i].dac.sample<0 || chan[i].dac.sample>=parent->song.sampleLen) {
if (dumpWrites) {
@ -340,7 +340,7 @@ void DivPlatformAY8910::tick(bool sysTick) {
if (chan[i].keyOn) {
//rWrite(16+i*5+1,((chan[i].duty&3)<<6)|(63-(ins->gb.soundLen&63)));
//rWrite(16+i*5+2,((chan[i].vol<<4))|(ins->gb.envLen&7)|((ins->gb.envDir&1)<<3));
if (!chan[i].nextPSGMode.dac) {
if (!(chan[i].nextPSGMode.val&8)) {
chan[i].curPSGMode.val=chan[i].nextPSGMode.val;
}
}
@ -396,11 +396,11 @@ int DivPlatformAY8910::dispatch(DivCommand c) {
case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_AY);
if (!parent->song.disableSampleMacro && (ins->type==DIV_INS_AMIGA || ins->amiga.useSample)) {
chan[c.chan].nextPSGMode.dac=true;
chan[c.chan].nextPSGMode.val|=8;
} else if (chan[c.chan].dac.furnaceDAC) {
chan[c.chan].nextPSGMode.dac=false;
chan[c.chan].nextPSGMode.val&=~8;
}
if (chan[c.chan].nextPSGMode.dac) {
if (chan[c.chan].nextPSGMode.val&8) {
if (skipRegisterWrites) break;
if (!parent->song.disableSampleMacro && (ins->type==DIV_INS_AMIGA || ins->amiga.useSample)) {
if (c.value!=DIV_NOTE_NULL) {
@ -452,7 +452,8 @@ int DivPlatformAY8910::dispatch(DivCommand c) {
}
chan[c.chan].dac.furnaceDAC=false;
}
chan[c.chan].curPSGMode.dac=chan[c.chan].nextPSGMode.dac;
chan[c.chan].curPSGMode.val&=~8;
chan[c.chan].curPSGMode.val|=chan[c.chan].nextPSGMode.val&8;
break;
}
if (c.value!=DIV_NOTE_NULL) {
@ -466,7 +467,7 @@ int DivPlatformAY8910::dispatch(DivCommand c) {
if (!parent->song.brokenOutVol && !chan[c.chan].std.vol.will) {
chan[c.chan].outVol=chan[c.chan].vol;
}
if (!chan[c.chan].nextPSGMode.dac) {
if (!(chan[c.chan].nextPSGMode.val&8)) {
if (isMuted[c.chan]) {
rWrite(0x08+c.chan,0);
} else if (intellivision && (chan[c.chan].nextPSGMode.getEnvelope())) {
@ -480,7 +481,7 @@ int DivPlatformAY8910::dispatch(DivCommand c) {
case DIV_CMD_NOTE_OFF:
chan[c.chan].dac.sample=-1;
if (dumpWrites) addWrite(0xffff0002+(c.chan<<8),0);
chan[c.chan].nextPSGMode.dac=false;
chan[c.chan].nextPSGMode.val&=~8;
chan[c.chan].keyOff=true;
chan[c.chan].active=false;
chan[c.chan].macroInit(NULL);
@ -494,7 +495,7 @@ int DivPlatformAY8910::dispatch(DivCommand c) {
if (!chan[c.chan].std.vol.has) {
chan[c.chan].outVol=c.value;
}
if (!chan[c.chan].nextPSGMode.dac) {
if (!(chan[c.chan].nextPSGMode.val&8)) {
if (isMuted[c.chan]) {
rWrite(0x08+c.chan,0);
} else {
@ -553,7 +554,7 @@ int DivPlatformAY8910::dispatch(DivCommand c) {
break;
}
case DIV_CMD_STD_NOISE_MODE:
if (!chan[c.chan].nextPSGMode.dac) {
if (!(chan[c.chan].nextPSGMode.val&8)) {
if (c.value<16) {
chan[c.chan].nextPSGMode.val=(c.value+1)&7;
if (chan[c.chan].active) {
@ -578,11 +579,11 @@ int DivPlatformAY8910::dispatch(DivCommand c) {
ayEnvMode=c.value>>4;
rWrite(0x0d,ayEnvMode);
if (c.value&15) {
chan[c.chan].nextPSGMode.envelope|=1;
chan[c.chan].nextPSGMode.val|=4;
} else {
chan[c.chan].nextPSGMode.envelope&=~1;
chan[c.chan].nextPSGMode.val&=~4;
}
if (!chan[c.chan].nextPSGMode.dac && chan[c.chan].active) {
if (!(chan[c.chan].nextPSGMode.val&8) && chan[c.chan].active) {
chan[c.chan].curPSGMode.val=chan[c.chan].nextPSGMode.val;
}
if (isMuted[c.chan]) {
@ -628,9 +629,14 @@ int DivPlatformAY8910::dispatch(DivCommand c) {
immWrite(14+(c.value?1:0),(c.value?portBVal:portAVal));
break;
case DIV_CMD_SAMPLE_MODE:
chan[c.chan].nextPSGMode.dac=(c.value>0)?1:0;
if (c.value>0) {
chan[c.chan].nextPSGMode.val|=8;
} else {
chan[c.chan].nextPSGMode.val&=~8;
}
if (chan[c.chan].active) {
chan[c.chan].curPSGMode.dac=chan[c.chan].nextPSGMode.dac;
chan[c.chan].curPSGMode.val&=~8;
chan[c.chan].curPSGMode.val|=chan[c.chan].nextPSGMode.val&8;
}
break;
case DIV_CMD_SAMPLE_BANK:
@ -673,7 +679,7 @@ void DivPlatformAY8910::muteChannel(int ch, bool mute) {
isMuted[ch]=mute;
if (isMuted[ch]) {
rWrite(0x08+ch,0);
} else if (chan[ch].active && chan[ch].nextPSGMode.dac) {
} else if (chan[ch].active && (chan[ch].nextPSGMode.val&8)) {
rWrite(0x08+ch,chan[ch].dac.out);
} else {
if (intellivision && (chan[ch].nextPSGMode.getEnvelope()) && chan[ch].active) {

View file

@ -31,29 +31,25 @@ class DivPlatformAY8910: public DivDispatch {
inline unsigned char regRemap(unsigned char reg) { return intellivision?AY8914RegRemap[reg&0x0f]:reg&0x0f; }
struct Channel: public SharedChannel<int> {
struct PSGMode {
union {
struct {
unsigned char tone: 1;
unsigned char noise: 1;
unsigned char envelope: 1;
unsigned char dac: 1;
};
unsigned char val=1;
};
// bit 3: DAC
// bit 2: envelope
// bit 1: noise
// bit 0: tone
unsigned char val;
unsigned char getTone() {
return dac?0:(tone<<0);
return (val&8)?0:(val&1);
}
unsigned char getNoise() {
return dac?0:(noise<<1);
return (val&8)?0:(val&2);
}
unsigned char getEnvelope() {
return dac?0:(envelope<<2);
return (val&8)?0:(val&4);
}
PSGMode(unsigned char v=0):
PSGMode(unsigned char v=1):
val(v) {}
};
PSGMode curPSGMode;
@ -61,7 +57,7 @@ class DivPlatformAY8910: public DivDispatch {
struct DAC {
int sample, rate, period, pos, out;
unsigned char furnaceDAC: 1;
bool furnaceDAC;
DAC():
sample(-1),
@ -69,7 +65,7 @@ class DivPlatformAY8910: public DivDispatch {
period(0),
pos(0),
out(0),
furnaceDAC(0) {}
furnaceDAC(false) {}
} dac;
unsigned char autoEnvNum, autoEnvDen;

View file

@ -111,7 +111,7 @@ const unsigned char dacLogTableAY8930[256]={
void DivPlatformAY8930::runDAC() {
for (int i=0; i<3; i++) {
if (chan[i].active && chan[i].curPSGMode.dac && chan[i].dac.sample!=-1) {
if (chan[i].active && (chan[i].curPSGMode.val&8) && chan[i].dac.sample!=-1) {
chan[i].dac.period+=chan[i].dac.rate;
bool end=false;
bool changed=false;
@ -235,7 +235,7 @@ void DivPlatformAY8930::tick(bool sysTick) {
if (chan[i].std.vol.had) {
chan[i].outVol=MIN(31,chan[i].std.vol.val)-(31-(chan[i].vol&31));
if (chan[i].outVol<0) chan[i].outVol=0;
if (!chan[i].nextPSGMode.dac) {
if (!(chan[i].nextPSGMode.val&8)) {
if (isMuted[i]) {
rWrite(0x08+i,0);
} else {
@ -255,7 +255,7 @@ void DivPlatformAY8930::tick(bool sysTick) {
rWrite(0x06,chan[i].std.duty.val);
}
if (chan[i].std.wave.had) {
if (!chan[i].nextPSGMode.dac) {
if (!(chan[i].nextPSGMode.val&8)) {
chan[i].nextPSGMode.val=(chan[i].std.wave.val+1)&7;
if (chan[i].active) {
chan[i].curPSGMode.val=chan[i].nextPSGMode.val;
@ -278,7 +278,7 @@ void DivPlatformAY8930::tick(bool sysTick) {
}
if (chan[i].std.phaseReset.had) {
if (chan[i].std.phaseReset.val==1) {
if (chan[i].nextPSGMode.dac) {
if (chan[i].nextPSGMode.val&8) {
if (dumpWrites) addWrite(0xffff0002+(i<<8),0);
if (chan[i].dac.sample<0 || chan[i].dac.sample>=parent->song.sampleLen) {
if (dumpWrites) {
@ -337,7 +337,7 @@ void DivPlatformAY8930::tick(bool sysTick) {
if (chan[i].freq<0) chan[i].freq=0;
if (chan[i].freq>65535) chan[i].freq=65535;
if (chan[i].keyOn) {
if (!chan[i].nextPSGMode.dac) {
if (!(chan[i].nextPSGMode.val&8)) {
chan[i].curPSGMode.val=chan[i].nextPSGMode.val;
}
if (chan[i].insChanged) {
@ -397,11 +397,11 @@ int DivPlatformAY8930::dispatch(DivCommand c) {
case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_AY8930);
if (ins->type==DIV_INS_AMIGA || ins->amiga.useSample) {
chan[c.chan].nextPSGMode.dac=true;
chan[c.chan].nextPSGMode.val|=8;
} else if (chan[c.chan].dac.furnaceDAC) {
chan[c.chan].nextPSGMode.dac=false;
chan[c.chan].nextPSGMode.val&=~8;
}
if (chan[c.chan].nextPSGMode.dac) {
if (chan[c.chan].nextPSGMode.val&8) {
if (skipRegisterWrites) break;
if (ins->type==DIV_INS_AMIGA || ins->amiga.useSample) {
if (c.value!=DIV_NOTE_NULL) {
@ -453,7 +453,8 @@ int DivPlatformAY8930::dispatch(DivCommand c) {
}
chan[c.chan].dac.furnaceDAC=false;
}
chan[c.chan].curPSGMode.dac=chan[c.chan].nextPSGMode.dac;
chan[c.chan].curPSGMode.val&=~8;
chan[c.chan].curPSGMode.val|=chan[c.chan].nextPSGMode.val&8;
break;
}
if (c.value!=DIV_NOTE_NULL) {
@ -467,7 +468,7 @@ int DivPlatformAY8930::dispatch(DivCommand c) {
if (!parent->song.brokenOutVol && !chan[c.chan].std.vol.will) {
chan[c.chan].outVol=chan[c.chan].vol;
}
if (!chan[c.chan].nextPSGMode.dac) {
if (!(chan[c.chan].nextPSGMode.val&8)) {
if (isMuted[c.chan]) {
rWrite(0x08+c.chan,0);
} else {
@ -479,7 +480,7 @@ int DivPlatformAY8930::dispatch(DivCommand c) {
case DIV_CMD_NOTE_OFF:
chan[c.chan].dac.sample=-1;
if (dumpWrites) addWrite(0xffff0002+(c.chan<<8),0);
chan[c.chan].nextPSGMode.dac=false;
chan[c.chan].nextPSGMode.val&=~8;
chan[c.chan].keyOff=true;
chan[c.chan].active=false;
chan[c.chan].macroInit(NULL);
@ -493,7 +494,7 @@ int DivPlatformAY8930::dispatch(DivCommand c) {
if (!chan[c.chan].std.vol.has) {
chan[c.chan].outVol=c.value;
}
if (!chan[c.chan].nextPSGMode.dac) {
if (!(chan[c.chan].nextPSGMode.val&8)) {
if (isMuted[c.chan]) {
rWrite(0x08+c.chan,0);
} else {
@ -548,7 +549,7 @@ int DivPlatformAY8930::dispatch(DivCommand c) {
}
case DIV_CMD_STD_NOISE_MODE:
if (c.value<0x10) {
if (!chan[c.chan].nextPSGMode.dac) {
if (!(chan[c.chan].nextPSGMode.val&8)) {
chan[c.chan].nextPSGMode.val=(c.value+1)&7;
if (chan[c.chan].active) {
chan[c.chan].curPSGMode.val=chan[c.chan].nextPSGMode.val;
@ -571,11 +572,11 @@ int DivPlatformAY8930::dispatch(DivCommand c) {
chan[c.chan].envelope.mode=c.value>>4;
rWrite(regMode[c.chan],chan[c.chan].envelope.mode);
if (c.value&15) {
chan[c.chan].nextPSGMode.envelope|=1;
chan[c.chan].nextPSGMode.val|=4;
} else {
chan[c.chan].nextPSGMode.envelope&=~1;
chan[c.chan].nextPSGMode.val&=~4;
}
if (!chan[c.chan].nextPSGMode.dac && chan[c.chan].active) {
if (!(chan[c.chan].nextPSGMode.val&8) && chan[c.chan].active) {
chan[c.chan].curPSGMode.val=chan[c.chan].nextPSGMode.val;
}
if (isMuted[c.chan]) {
@ -630,8 +631,15 @@ int DivPlatformAY8930::dispatch(DivCommand c) {
immWrite(14+(c.value?1:0),(c.value?portBVal:portAVal));
break;
case DIV_CMD_SAMPLE_MODE:
chan[c.chan].nextPSGMode.dac=(c.value>0)?1:0;
chan[c.chan].curPSGMode.dac=chan[c.chan].nextPSGMode.dac;
if (c.value>0) {
chan[c.chan].nextPSGMode.val|=8;
} else {
chan[c.chan].nextPSGMode.val&=~8;
}
if (chan[c.chan].active) {
chan[c.chan].curPSGMode.val&=~8;
chan[c.chan].curPSGMode.val|=chan[c.chan].nextPSGMode.val&8;
}
break;
case DIV_CMD_SAMPLE_BANK:
sampleBank=c.value;
@ -672,7 +680,7 @@ void DivPlatformAY8930::muteChannel(int ch, bool mute) {
if (isMuted[ch]) {
rWrite(0x08+ch,0);
} else if (chan[ch].active) {
if (chan[ch].nextPSGMode.dac) {
if (chan[ch].nextPSGMode.val&8) {
rWrite(0x08+ch,chan[ch].dac.out&31);
} else {
rWrite(0x08+ch,(chan[ch].outVol&31)|((chan[ch].nextPSGMode.getEnvelope())<<3));

View file

@ -39,29 +39,25 @@ class DivPlatformAY8930: public DivDispatch {
} envelope;
struct PSGMode {
union {
struct {
unsigned char tone: 1;
unsigned char noise: 1;
unsigned char envelope: 1;
unsigned char dac: 1;
};
unsigned char val=1;
};
// bit 3: DAC
// bit 2: envelope
// bit 1: noise
// bit 0: tone
unsigned char val;
unsigned char getTone() {
return dac?0:(tone<<0);
return (val&8)?0:(val&1);
}
unsigned char getNoise() {
return dac?0:(noise<<1);
return (val&8)?0:(val&2);
}
unsigned char getEnvelope() {
return dac?0:(envelope<<2);
return (val&8)?0:(val&4);
}
PSGMode(unsigned char v=0):
PSGMode(unsigned char v=1):
val(v) {}
};
PSGMode curPSGMode;
@ -69,7 +65,7 @@ class DivPlatformAY8930: public DivDispatch {
struct DAC {
int sample, rate, period, pos, out;
unsigned char furnaceDAC: 1;
bool furnaceDAC;
DAC():
sample(-1),
@ -77,7 +73,7 @@ class DivPlatformAY8930: public DivDispatch {
period(0),
pos(0),
out(0),
furnaceDAC(0) {}
furnaceDAC(false) {}
} dac;
unsigned char autoEnvNum, autoEnvDen, duty;

View file

@ -0,0 +1,513 @@
/**
* Furnace Tracker - multi-system chiptune tracker
* Copyright (C) 2021-2023 tildearrow and contributors
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "c140.h"
#include "../engine.h"
#include "../../ta-log.h"
#include <math.h>
#include <map>
#define CHIP_FREQBASE 12582912
#define rWrite(a,v) {if(!skipRegisterWrites) {writes.push(QueuedWrite(a,v)); if(dumpWrites) addWrite(a,v); }}
const char* regCheatSheetC140[]={
"CHx_RVol", "00+x*10",
"CHx_LVol", "01+x*10",
"CHx_FreqH", "02+x*10",
"CHx_FreqL", "03+x*10",
"CHx_Bank", "04+x*10",
"CHx_Ctrl", "05+x*10",
"CHx_StartH", "06+x*10",
"CHx_StartL", "07+x*10",
"CHx_EndH", "08+x*10",
"CHx_EndL", "09+x*10",
"CHx_LoopH", "0A+x*10",
"CHx_LoopL", "0B+x*10",
"Timer", "1FA",
"IRQ", "1FE",
NULL
};
const char** DivPlatformC140::getRegisterSheet() {
return regCheatSheetC140;
}
void DivPlatformC140::acquire(short** buf, size_t len) {
for (size_t h=0; h<len; h++) {
while (!writes.empty()) {
QueuedWrite w=writes.front();
c140_write(&c140, w.addr,w.val);
regPool[w.addr&0x1ff]=w.val;
writes.pop();
}
c140_tick(&c140, 1);
// scale as 16bit
c140.lout >>= 10;
c140.rout >>= 10;
if (c140.lout<-32768) c140.lout=-32768;
if (c140.lout>32767) c140.lout=32767;
if (c140.rout<-32768) c140.rout=-32768;
if (c140.rout>32767) c140.rout=32767;
buf[0][h]=c140.lout;
buf[1][h]=c140.rout;
for (int i=0; i<24; i++) {
oscBuf[i]->data[oscBuf[i]->needle++]=(c140.voice[i].lout+c140.voice[i].rout)>>10;
}
}
}
void DivPlatformC140::tick(bool sysTick) {
for (int i=0; i<24; i++) {
chan[i].std.next();
if (chan[i].std.vol.had) {
chan[i].outVol=(chan[i].vol*MIN(chan[i].macroVolMul,chan[i].std.vol.val))/chan[i].macroVolMul;
chan[i].volChangedL=true;
chan[i].volChangedR=true;
}
if (NEW_ARP_STRAT) {
chan[i].handleArp();
} else if (chan[i].std.arp.had) {
if (!chan[i].inPorta) {
chan[i].baseFreq=NOTE_FREQUENCY(parent->calcArp(chan[i].note,chan[i].std.arp.val));
}
chan[i].freqChanged=true;
}
if (chan[i].std.pitch.had) {
if (chan[i].std.pitch.mode) {
chan[i].pitch2+=chan[i].std.pitch.val;
CLAMP_VAR(chan[i].pitch2,-32768,32767);
} else {
chan[i].pitch2=chan[i].std.pitch.val;
}
chan[i].freqChanged=true;
}
if (chan[i].std.panL.had) {
chan[i].chPanL=(255*(chan[i].std.panL.val&255))/chan[i].macroPanMul;
chan[i].volChangedL=true;
}
if (chan[i].std.panR.had) {
chan[i].chPanR=(255*(chan[i].std.panR.val&255))/chan[i].macroPanMul;
chan[i].volChangedR=true;
}
if (chan[i].std.phaseReset.had) {
if ((chan[i].std.phaseReset.val==1) && chan[i].active) {
chan[i].audPos=0;
chan[i].setPos=true;
}
}
if (chan[i].volChangedL) {
chan[i].chVolL=(chan[i].outVol*chan[i].chPanL)/255;
rWrite(1+(i<<4),chan[i].chVolL);
chan[i].volChangedL=false;
}
if (chan[i].volChangedR) {
chan[i].chVolR=(chan[i].outVol*chan[i].chPanR)/255;
rWrite(0+(i<<4),chan[i].chVolR);
chan[i].volChangedR=false;
}
if (chan[i].setPos) {
// force keyon
chan[i].keyOn=true;
chan[i].setPos=false;
} else {
chan[i].audPos=0;
}
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
bool writeCtrl=false;
DivSample* s=parent->getSample(chan[i].sample);
unsigned char ctrl=0;
double off=(s->centerRate>=1)?((double)s->centerRate/8363.0):1.0;
chan[i].freq=(int)(off*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 (chan[i].freq<0) chan[i].freq=0;
if (chan[i].freq>65535) chan[i].freq=65535;
ctrl|=(chan[i].active?0x80:0)|((s->isLoopable())?0x10:0)|((s->depth==DIV_SAMPLE_DEPTH_MULAW)?0x08:0);
if (chan[i].keyOn) {
unsigned int bank=0;
unsigned int start=0;
unsigned int loop=0;
unsigned int end=0;
if (chan[i].sample>=0 && chan[i].sample<parent->song.sampleLen) {
bank=(sampleOff[chan[i].sample]>>16)&0xff;
start=sampleOff[chan[i].sample]&0xffff;
end=MIN(start+s->length8-1,65535);
}
if (chan[i].audPos>0) {
start=MIN(start+MIN(chan[i].audPos,s->length8),65535);
}
if (s->isLoopable()) {
loop=MIN(start+s->loopStart,65535);
end=MIN(start+s->loopEnd-1,65535);
}
rWrite(0x05+(i<<4),0); // force keyoff first
rWrite(0x04+(i<<4),bank);
rWrite(0x06+(i<<4),(start>>8)&0xff);
rWrite(0x07+(i<<4),start&0xff);
rWrite(0x08+(i<<4),(end>>8)&0xff);
rWrite(0x09+(i<<4),end&0xff);
rWrite(0x0a+(i<<4),(loop>>8)&0xff);
rWrite(0x0b+(i<<4),loop&0xff);
if (!chan[i].std.vol.had) {
chan[i].outVol=chan[i].vol;
chan[i].volChangedL=true;
chan[i].volChangedR=true;
}
writeCtrl=true;
chan[i].keyOn=false;
}
if (chan[i].keyOff) {
writeCtrl=true;
chan[i].keyOff=false;
}
if (chan[i].freqChanged) {
rWrite(0x02+(i<<4),chan[i].freq>>8);
rWrite(0x03+(i<<4),chan[i].freq&0xff);
chan[i].freqChanged=false;
}
if (writeCtrl) {
rWrite(0x05+(i<<4),ctrl);
}
}
}
}
int DivPlatformC140::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_AMIGA);
chan[c.chan].macroVolMul=ins->type==DIV_INS_AMIGA?64:255;
chan[c.chan].macroPanMul=ins->type==DIV_INS_AMIGA?127:255;
if (c.value!=DIV_NOTE_NULL) {
chan[c.chan].sample=ins->amiga.getSample(c.value);
c.value=ins->amiga.getFreq(c.value);
}
if (c.value!=DIV_NOTE_NULL) {
chan[c.chan].baseFreq=NOTE_FREQUENCY(c.value);
}
if (chan[c.chan].sample<0 || chan[c.chan].sample>=parent->song.sampleLen) {
chan[c.chan].sample=-1;
}
if (c.value!=DIV_NOTE_NULL) {
chan[c.chan].freqChanged=true;
chan[c.chan].note=c.value;
}
chan[c.chan].active=true;
chan[c.chan].keyOn=true;
chan[c.chan].macroInit(ins);
if (!parent->song.brokenOutVol && !chan[c.chan].std.vol.will) {
chan[c.chan].outVol=chan[c.chan].vol;
chan[c.chan].volChangedL=true;
chan[c.chan].volChangedR=true;
}
break;
}
case DIV_CMD_NOTE_OFF:
chan[c.chan].sample=-1;
chan[c.chan].active=false;
chan[c.chan].keyOff=true;
chan[c.chan].macroInit(NULL);
break;
case DIV_CMD_NOTE_OFF_ENV:
case DIV_CMD_ENV_RELEASE:
chan[c.chan].std.release();
break;
case DIV_CMD_INSTRUMENT:
if (chan[c.chan].ins!=c.value || c.value2==1) {
chan[c.chan].ins=c.value;
}
break;
case DIV_CMD_VOLUME:
chan[c.chan].vol=c.value;
if (!chan[c.chan].std.vol.has) {
chan[c.chan].outVol=c.value;
}
chan[c.chan].volChangedL=true;
chan[c.chan].volChangedR=true;
break;
case DIV_CMD_GET_VOLUME:
if (chan[c.chan].std.vol.has) {
return chan[c.chan].vol;
}
return chan[c.chan].outVol;
break;
case DIV_CMD_PANNING:
chan[c.chan].chPanL=c.value;
chan[c.chan].chPanR=c.value2;
chan[c.chan].volChangedL=true;
chan[c.chan].volChangedR=true;
break;
case DIV_CMD_PITCH:
chan[c.chan].pitch=c.value;
chan[c.chan].freqChanged=true;
break;
case DIV_CMD_NOTE_PORTA: {
int destFreq=NOTE_FREQUENCY(c.value2);
bool return2=false;
if (destFreq>chan[c.chan].baseFreq) {
chan[c.chan].baseFreq+=c.value;
if (chan[c.chan].baseFreq>=destFreq) {
chan[c.chan].baseFreq=destFreq;
return2=true;
}
} else {
chan[c.chan].baseFreq-=c.value;
if (chan[c.chan].baseFreq<=destFreq) {
chan[c.chan].baseFreq=destFreq;
return2=true;
}
}
chan[c.chan].freqChanged=true;
if (return2) {
chan[c.chan].inPorta=false;
return 2;
}
break;
}
case DIV_CMD_LEGATO: {
chan[c.chan].baseFreq=NOTE_FREQUENCY(c.value+((HACKY_LEGATO_MESS)?(chan[c.chan].std.arp.val-12):(0)));
chan[c.chan].freqChanged=true;
chan[c.chan].note=c.value;
break;
}
case DIV_CMD_PRE_PORTA:
if (chan[c.chan].active && c.value2) {
if (parent->song.resetMacroOnPorta) chan[c.chan].macroInit(parent->getIns(chan[c.chan].ins,DIV_INS_AMIGA));
}
if (!chan[c.chan].inPorta && c.value && !parent->song.brokenPortaArp && chan[c.chan].std.arp.will && !NEW_ARP_STRAT) chan[c.chan].baseFreq=NOTE_FREQUENCY(chan[c.chan].note);
chan[c.chan].inPorta=c.value;
break;
case DIV_CMD_SAMPLE_POS:
chan[c.chan].audPos=c.value;
chan[c.chan].setPos=true;
break;
case DIV_CMD_GET_VOLMAX:
return 255;
break;
case DIV_CMD_MACRO_OFF:
chan[c.chan].std.mask(c.value,true);
break;
case DIV_CMD_MACRO_ON:
chan[c.chan].std.mask(c.value,false);
break;
case DIV_ALWAYS_SET_VOLUME:
return 1;
break;
default:
break;
}
return 1;
}
void DivPlatformC140::muteChannel(int ch, bool mute) {
isMuted[ch]=mute;
c140.voice[ch].muted=mute;
}
void DivPlatformC140::forceIns() {
for (int i=0; i<24; i++) {
chan[i].insChanged=true;
chan[i].freqChanged=true;
chan[i].volChangedL=true;
chan[i].volChangedR=true;
chan[i].sample=-1;
}
}
void* DivPlatformC140::getChanState(int ch) {
return &chan[ch];
}
DivMacroInt* DivPlatformC140::getChanMacroInt(int ch) {
return &chan[ch].std;
}
DivDispatchOscBuffer* DivPlatformC140::getOscBuffer(int ch) {
return oscBuf[ch];
}
void DivPlatformC140::reset() {
while (!writes.empty()) writes.pop();
memset(regPool,0,512);
c140_reset(&c140);
for (int i=0; i<24; i++) {
chan[i]=DivPlatformC140::Channel();
chan[i].std.setEngine(parent);
rWrite(0x05+(i<<4),0);
}
}
int DivPlatformC140::getOutputCount() {
return 2;
}
void DivPlatformC140::notifyInsChange(int ins) {
for (int i=0; i<24; i++) {
if (chan[i].ins==ins) {
chan[i].insChanged=true;
}
}
}
void DivPlatformC140::notifyWaveChange(int wave) {
// TODO when wavetables are added
// TODO they probably won't be added unless the samples reside in RAM
}
void DivPlatformC140::notifyInsDeletion(void* ins) {
for (int i=0; i<24; i++) {
chan[i].std.notifyInsDeletion((DivInstrument*)ins);
}
}
void DivPlatformC140::poke(unsigned int addr, unsigned short val) {
rWrite(addr,val);
}
void DivPlatformC140::poke(std::vector<DivRegWrite>& wlist) {
for (DivRegWrite& i: wlist) rWrite(i.addr,i.val);
}
unsigned char* DivPlatformC140::getRegisterPool() {
return regPool;
}
int DivPlatformC140::getRegisterPoolSize() {
return 512;
}
float DivPlatformC140::getPostAmp() {
return 3.0f;
}
const void* DivPlatformC140::getSampleMem(int index) {
return index == 0 ? sampleMem : NULL;
}
size_t DivPlatformC140::getSampleMemCapacity(int index) {
return index == 0 ? 16777216 : 0;
}
size_t DivPlatformC140::getSampleMemUsage(int index) {
return index == 0 ? sampleMemLen : 0;
}
bool DivPlatformC140::isSampleLoaded(int index, int sample) {
if (index!=0) return false;
if (sample<0 || sample>255) return false;
return sampleLoaded[sample];
}
void DivPlatformC140::renderSamples(int sysID) {
memset(sampleMem,0,getSampleMemCapacity());
memset(sampleOff,0,256*sizeof(unsigned int));
memset(sampleLoaded,0,256*sizeof(bool));
size_t memPos=0;
for (int i=0; i<parent->song.sampleLen; i++) {
DivSample* s=parent->song.sample[i];
if (!s->renderOn[0][sysID]) {
sampleOff[i]=0;
continue;
}
unsigned int length=s->length16;
// fit sample size to single bank size
if (length>(131072)) {
length=131072;
}
if ((memPos&0xfe0000)!=((memPos+length)&0xfe0000)) {
memPos=((memPos+0x1ffff)&0xfe0000);
}
if (memPos>=(getSampleMemCapacity())) {
logW("out of C140 memory for sample %d!",i);
break;
}
// why is C140 not G.711-compliant? this weird bit mangling had me puzzled for 3 hours...
if (memPos+length>=(getSampleMemCapacity())) {
if (s->depth==DIV_SAMPLE_DEPTH_MULAW) {
for (unsigned int i=0; i<(getSampleMemCapacity())-memPos; i++) {
unsigned char x=s->dataMuLaw[i]^0xff;
if (x&0x80) x^=15;
unsigned char c140Mu=(x&0x80)|((x&15)<<3)|((x&0x70)>>4);
sampleMem[i+(memPos/sizeof(short))]=((c140Mu)<<8);
}
} else {
memcpy(sampleMem+(memPos/sizeof(short)),s->data16,(getSampleMemCapacity())-memPos);
}
logW("out of C140 memory for sample %d!",i);
} else {
if (s->depth==DIV_SAMPLE_DEPTH_MULAW) {
for (unsigned int i=0; i<length; i++) {
unsigned char x=s->dataMuLaw[i]^0xff;
if (x&0x80) x^=15;
unsigned char c140Mu=(x&0x80)|((x&15)<<3)|((x&0x70)>>4);
sampleMem[i+(memPos/sizeof(short))]=((c140Mu)<<8);
}
} else {
memcpy(sampleMem+(memPos/sizeof(short)),s->data16,length);
}
}
sampleOff[i]=memPos>>1;
sampleLoaded[i]=true;
memPos+=length;
}
sampleMemLen=memPos+256;
}
void DivPlatformC140::setFlags(const DivConfig& flags) {
chipClock=32000*256; // 8.192MHz and 12.288MHz input, verified from Assault Schematics
CHECK_CUSTOM_CLOCK;
rate=chipClock/192;
for (int i=0; i<24; i++) {
oscBuf[i]->rate=rate;
}
}
int DivPlatformC140::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p;
dumpWrites=false;
skipRegisterWrites=false;
for (int i=0; i<24; i++) {
isMuted[i]=false;
oscBuf[i]=new DivDispatchOscBuffer;
}
sampleMem=new short[getSampleMemCapacity()>>1];
sampleMemLen=0;
c140_init(&c140);
c140.sample_mem=sampleMem;
setFlags(flags);
reset();
return 24;
}
void DivPlatformC140::quit() {
delete[] sampleMem;
for (int i=0; i<24; i++) {
delete oscBuf[i];
}
}

103
src/engine/platform/c140.h Normal file
View file

@ -0,0 +1,103 @@
/**
* Furnace Tracker - multi-system chiptune tracker
* Copyright (C) 2021-2023 tildearrow and contributors
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef _C140_H
#define _C140_H
#include "../dispatch.h"
#include "sound/c140.h"
#include "../fixedQueue.h"
class DivPlatformC140: public DivDispatch {
struct Channel: public SharedChannel<int> {
unsigned int audPos;
int sample, wave;
bool setPos, volChangedL, volChangedR;
int chPanL, chPanR;
int chVolL, chVolR;
int macroVolMul;
int macroPanMul;
Channel():
SharedChannel<int>(255),
audPos(0),
sample(-1),
wave(-1),
setPos(false),
volChangedL(false),
volChangedR(false),
chPanL(255),
chPanR(255),
chVolL(255),
chVolR(255),
macroVolMul(64),
macroPanMul(127) {}
};
Channel chan[24];
DivDispatchOscBuffer* oscBuf[24];
bool isMuted[24];
unsigned int sampleOff[256];
bool sampleLoaded[256];
signed short* sampleMem;
size_t sampleMemLen;
struct QueuedWrite {
unsigned short addr;
unsigned char val;
bool addrOrVal;
QueuedWrite(): addr(0), val(0), addrOrVal(false) {}
QueuedWrite(unsigned short a, unsigned char v): addr(a), val(v), addrOrVal(false) {}
};
FixedQueue<QueuedWrite,2048> writes;
struct c140_t c140;
unsigned char regPool[512];
friend void putDispatchChip(void*,int);
friend void putDispatchChan(void*,int,int);
public:
void acquire(short** buf, size_t len);
int dispatch(DivCommand c);
void* getChanState(int chan);
DivMacroInt* getChanMacroInt(int ch);
DivDispatchOscBuffer* getOscBuffer(int chan);
unsigned char* getRegisterPool();
int getRegisterPoolSize();
float getPostAmp();
void reset();
void forceIns();
void tick(bool sysTick=true);
void muteChannel(int ch, bool mute);
int getOutputCount();
void notifyInsChange(int ins);
void notifyWaveChange(int wave);
void notifyInsDeletion(void* ins);
void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet();
const void* getSampleMem(int index = 0);
size_t getSampleMemCapacity(int index = 0);
size_t getSampleMemUsage(int index = 0);
bool isSampleLoaded(int index, int sample);
void renderSamples(int chipID);
void setFlags(const DivConfig& flags);
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit();
private:
};
#endif

View file

@ -566,6 +566,10 @@ bool DivPlatformC64::getWantPreNote() {
return true;
}
bool DivPlatformC64::isVolGlobal() {
return true;
}
float DivPlatformC64::getPostAmp() {
return (sidCore==1)?3.0f:1.0f;
}

View file

@ -105,6 +105,7 @@ class DivPlatformC64: public DivDispatch {
void notifyInsChange(int ins);
bool getDCOffRequired();
bool getWantPreNote();
bool isVolGlobal();
float getPostAmp();
DivMacroInt* getChanMacroInt(int ch);
void notifyInsDeletion(void* ins);

View file

@ -105,15 +105,17 @@ class DivPlatformFMBase: public DivDispatch {
}
}
}
// only used by OPN2 for DAC writes
inline void urgentWrite(unsigned short a, unsigned char v) {
if (!skipRegisterWrites && !flushFirst) {
if (writes.empty()) {
writes.push_back(QueuedWrite(a,v));
} else if (writes.size()>16 || writes.front().addrOrVal) {
writes.push_back(QueuedWrite(a,v));
} else {
writes.push_front(QueuedWrite(a,v));
if (!writes.empty()) {
// check for hard reset
if (writes.front().addr==0xf0) {
// replace hard reset with DAC write
writes.pop_front();
}
}
writes.push_front(QueuedWrite(a,v));
if (dumpWrites) {
addWrite(a,v);
}

View file

@ -81,7 +81,6 @@ void DivPlatformGB::acquire(short** buf, size_t len) {
}
void DivPlatformGB::updateWave() {
logV("WAVE UPDATE");
rWrite(0x1a,0);
for (int i=0; i<16; i++) {
int nibble1=ws.output[((i<<1)+antiClickWavePos)&31];

View file

@ -96,32 +96,22 @@ void DivPlatformGenesis::processDAC(int iRate) {
//sample>>=1;
if (sample<-128) sample=-128;
if (sample>127) sample=127;
urgentWrite(0x2a,(unsigned char)sample+0x80);
dacWrite=(unsigned char)(sample+0x80);
}
} else {
if (!chan[5].dacReady) {
chan[5].dacDelay+=32000;
if (chan[5].dacDelay>=iRate) {
chan[5].dacDelay-=iRate;
chan[5].dacReady=true;
}
}
if (chan[5].dacMode && chan[5].dacSample!=-1) {
chan[5].dacPeriod+=chan[5].dacRate;
if (chan[5].dacPeriod>=iRate) {
DivSample* s=parent->getSample(chan[5].dacSample);
if (s->samples>0 && chan[5].dacPos<s->samples) {
if (!isMuted[5]) {
if (chan[5].dacReady && writes.size()<16) {
int sample;
if (parent->song.noOPN2Vol) {
sample=s->data8[chan[5].dacDirection?(s->samples-chan[5].dacPos-1):chan[5].dacPos];
} else {
sample=(s->data8[chan[5].dacDirection?(s->samples-chan[5].dacPos-1):chan[5].dacPos]*dacVolTable[chan[5].outVol])>>7;
}
urgentWrite(0x2a,(unsigned char)sample+0x80);
chan[5].dacReady=false;
int sample;
if (parent->song.noOPN2Vol) {
sample=s->data8[chan[5].dacDirection?(s->samples-chan[5].dacPos-1):chan[5].dacPos];
} else {
sample=(s->data8[chan[5].dacDirection?(s->samples-chan[5].dacPos-1):chan[5].dacPos]*dacVolTable[chan[5].outVol])>>7;
}
dacWrite=(unsigned char)(sample+0x80);
}
chan[5].dacPos++;
if (!chan[5].dacDirection && (s->isLoopable() && chan[5].dacPos>=(unsigned int)s->loopEnd)) {
@ -151,24 +141,34 @@ void DivPlatformGenesis::acquire_nuked(short** buf, size_t len) {
os[0]=0; os[1]=0;
for (int i=0; i<6; i++) {
if (!writes.empty()) {
if (--delay<0) {
delay=0;
QueuedWrite& w=writes.front();
if (w.addrOrVal) {
//logV("%.3x = %.2x",w.addr,w.val);
OPN2_Write(&fm,0x1+((w.addr>>8)<<1),w.val);
lastBusy=0;
regPool[w.addr&0x1ff]=w.val;
writes.pop_front();
} else {
lastBusy++;
if (fm.write_busy==0) {
OPN2_Write(&fm,0x0+((w.addr>>8)<<1),w.addr);
w.addrOrVal=true;
QueuedWrite& w=writes.front();
if (w.addrOrVal) {
//logV("%.3x = %.2x",w.addr,w.val);
OPN2_Write(&fm,0x1+((w.addr>>8)<<1),w.val);
regPool[w.addr&0x1ff]=w.val;
writes.pop_front();
if (dacWrite>=0) {
if (!canWriteDAC) {
canWriteDAC=true;
} else {
urgentWrite(0x2a,dacWrite);
dacWrite=-1;
canWriteDAC=writes.empty();
}
}
} else {
if (fm.write_busy==0) {
OPN2_Write(&fm,0x0+((w.addr>>8)<<1),w.addr);
w.addrOrVal=true;
}
}
} else {
canWriteDAC=true;
if (dacWrite>=0) {
urgentWrite(0x2a,dacWrite);
dacWrite=-1;
}
flushFirst=false;
}
@ -227,8 +227,22 @@ void DivPlatformGenesis::acquire_ymfm(short** buf, size_t len) {
fm_ymfm->write(0x1+((w.addr>>8)<<1),w.val);
regPool[w.addr&0x1ff]=w.val;
writes.pop_front();
lastBusy=1;
if (dacWrite>=0) {
if (!canWriteDAC) {
canWriteDAC=true;
} else {
urgentWrite(0x2a,dacWrite);
dacWrite=-1;
canWriteDAC=writes.empty();
}
}
} else {
canWriteDAC=true;
if (dacWrite>=0) {
urgentWrite(0x2a,dacWrite);
dacWrite=-1;
}
flushFirst=false;
}
@ -288,6 +302,11 @@ void DivPlatformGenesis::fillStream(std::vector<DivDelayedWrite>& stream, int sR
for (size_t i=0; i<len; i++) {
processDAC(sRate);
if (dacWrite>=0) {
urgentWrite(0x2a,dacWrite);
dacWrite=-1;
}
while (!writes.empty()) {
QueuedWrite& w=writes.front();
stream.push_back(DivDelayedWrite(i,w.addr,w.val));
@ -953,6 +972,7 @@ int DivPlatformGenesis::dispatch(DivCommand c) {
}
case DIV_CMD_FM_EXTCH: {
if (extSys) {
if (extMode==(bool)c.value) break;
extMode=c.value;
immWrite(0x27,extMode?0x40:0);
}
@ -1314,11 +1334,12 @@ void DivPlatformGenesis::reset() {
pendingWrites[i]=-1;
}
lastBusy=60;
lfoValue=8;
softPCMTimer=0;
extMode=false;
flushFirst=false;
dacWrite=-1;
canWriteDAC=true;
if (softPCM) {
chan[5].dacMode=true;
@ -1330,8 +1351,6 @@ void DivPlatformGenesis::reset() {
// LFO
immWrite(0x22,lfoValue);
delay=0;
}
int DivPlatformGenesis::getOutputCount() {

View file

@ -55,7 +55,6 @@ class DivPlatformGenesis: public DivPlatformOPN {
unsigned int dacPos;
int dacSample;
int dacDelay;
bool dacReady;
bool dacDirection;
bool setPos;
unsigned char sampleBank;
@ -69,7 +68,6 @@ class DivPlatformGenesis: public DivPlatformOPN {
dacPos(0),
dacSample(-1),
dacDelay(0),
dacReady(true),
dacDirection(false),
setPos(false),
sampleBank(0),
@ -86,8 +84,9 @@ class DivPlatformGenesis: public DivPlatformOPN {
int softPCMTimer;
bool extMode, softPCM, noExtMacros, useYMFM;
bool extMode, softPCM, noExtMacros, useYMFM, canWriteDAC;
unsigned char chipType;
short dacWrite;
unsigned char dacVolTable[128];

View file

@ -19,6 +19,7 @@
#include "genesisext.h"
#include "../engine.h"
#include "../../ta-log.h"
#include <math.h>
#define CHIP_FREQBASE fmFreqBase
@ -143,6 +144,7 @@ int DivPlatformGenesisExt::dispatch(DivCommand c) {
opChan[ch].insChanged=true;
}
opChan[ch].ins=c.value;
chan[extChanOffs].ins=opChan[ch].ins;
break;
case DIV_CMD_PANNING: {
if (c.value==0 && c.value2==0) {
@ -218,8 +220,15 @@ int DivPlatformGenesisExt::dispatch(DivCommand c) {
break;
}
case DIV_CMD_FM_EXTCH: {
if (extMode==(bool)c.value) break;
extMode=c.value;
immWrite(0x27,extMode?0x40:0);
if (!extMode) {
for (int i=0; i<4; i++) {
opChan[i].insChanged=true;
}
chan[extChanOffs].insChanged=true;
}
break;
}
case DIV_CMD_FM_LFO: {
@ -430,17 +439,21 @@ void DivPlatformGenesisExt::muteChannel(int ch, bool mute) {
return;
}
isOpMuted[ch-2]=mute;
int ordch=orderedOps[ch-2];
unsigned short baseAddr=chanOffs[2]|opOffs[ordch];
DivInstrumentFM::Operator op=chan[2].state.op[ordch];
if (isOpMuted[ch-2] || !op.enable) {
rWrite(baseAddr+0x40,127);
} else {
rWrite(baseAddr+0x40,127-VOL_SCALE_LOG_BROKEN(127-op.tl,opChan[ch-2].outVol&0x7f,127));
}
rWrite(chanOffs[2]+0xb4,(IS_EXTCH_MUTED?0:(opChan[ch-2].pan<<6))|(chan[2].state.fms&7)|((chan[2].state.ams&3)<<4));
DivPlatformGenesis::muteChannel(extChanOffs,IS_EXTCH_MUTED);
if (extMode) {
int ordch=orderedOps[ch-2];
unsigned short baseAddr=chanOffs[2]|opOffs[ordch];
DivInstrumentFM::Operator op=chan[2].state.op[ordch];
if (isOpMuted[ch-2] || !op.enable) {
rWrite(baseAddr+0x40,127);
} else {
rWrite(baseAddr+0x40,127-VOL_SCALE_LOG_BROKEN(127-op.tl,opChan[ch-2].outVol&0x7f,127));
}
rWrite(chanOffs[2]+0xb4,(IS_EXTCH_MUTED?0:(opChan[ch-2].pan<<6))|(chan[2].state.fms&7)|((chan[2].state.ams&3)<<4));
}
}
static int opChanOffsL[4]={
@ -476,13 +489,6 @@ void DivPlatformGenesisExt::tick(bool sysTick) {
if (chan[csmChan].active) { // CSM
writeMask^=0xf0;
}
/*printf(
"Mask: %c %c %c %c\n",
(writeMask&0x10)?'1':'-',
(writeMask&0x20)?'2':'-',
(writeMask&0x40)?'3':'-',
(writeMask&0x80)?'4':'-'
);*/
immWrite(0x28,writeMask);
}
}
@ -518,6 +524,39 @@ void DivPlatformGenesisExt::tick(bool sysTick) {
opChan[i].freqChanged=true;
}
// channel macros
if (opChan[i].std.alg.had) {
chan[extChanOffs].state.alg=opChan[i].std.alg.val;
rWrite(chanOffs[extChanOffs]+ADDR_FB_ALG,(chan[extChanOffs].state.alg&7)|(chan[extChanOffs].state.fb<<3));
if (!parent->song.algMacroBehavior) for (int j=0; j<4; j++) {
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[j];
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[j];
if (isOpMuted[j] || !op.enable) {
rWrite(baseAddr+0x40,127);
} else {
rWrite(baseAddr+0x40,127-VOL_SCALE_LOG_BROKEN(127-op.tl,opChan[j].outVol&0x7f,127));
}
}
}
if (i==0 || fbAllOps) {
if (opChan[i].std.fb.had) {
chan[extChanOffs].state.fb=opChan[i].std.fb.val;
rWrite(chanOffs[extChanOffs]+ADDR_FB_ALG,(chan[extChanOffs].state.alg&7)|(chan[extChanOffs].state.fb<<3));
}
}
if (opChan[i].std.fms.had) {
chan[extChanOffs].state.fms=opChan[i].std.fms.val;
rWrite(chanOffs[extChanOffs]+ADDR_LRAF,(IS_EXTCH_MUTED?0:(opChan[i].pan<<6))|(chan[extChanOffs].state.fms&7)|((chan[extChanOffs].state.ams&3)<<4));
}
if (opChan[i].std.ams.had) {
chan[extChanOffs].state.ams=opChan[i].std.ams.val;
rWrite(chanOffs[extChanOffs]+ADDR_LRAF,(IS_EXTCH_MUTED?0:(opChan[i].pan<<6))|(chan[extChanOffs].state.fms&7)|((chan[extChanOffs].state.ams&3)<<4));
}
if (opChan[i].std.ex3.had) {
lfoValue=(opChan[i].std.ex3.val>7)?0:(8|(opChan[i].std.ex3.val&7));
rWrite(0x22,lfoValue);
}
// param macros
unsigned short baseAddr=chanOffs[2]|opOffs[orderedOps[i]];
DivInstrumentFM::Operator& op=chan[2].state.op[orderedOps[i]];
@ -576,6 +615,7 @@ void DivPlatformGenesisExt::tick(bool sysTick) {
bool writeNoteOn=false;
unsigned char writeMask=2;
unsigned char hardResetMask=0;
if (extMode) for (int i=0; i<4; i++) {
if (opChan[i].freqChanged) {
if (parent->song.linearPitch==2) {
@ -603,8 +643,13 @@ void DivPlatformGenesisExt::tick(bool sysTick) {
writeNoteOn=true;
if (opChan[i].mask) {
writeMask|=1<<(4+i);
if (opChan[i].hardReset) {
hardResetMask|=1<<(4+i);
}
}
if (!opChan[i].hardReset) {
opChan[i].keyOn=false;
}
opChan[i].keyOn=false;
}
}
@ -631,14 +676,9 @@ void DivPlatformGenesisExt::tick(bool sysTick) {
if (chan[csmChan].active) { // CSM
writeMask^=0xf0;
}
/*printf(
"Mask: %c %c %c %c\n",
(writeMask&0x10)?'1':'-',
(writeMask&0x20)?'2':'-',
(writeMask&0x40)?'3':'-',
(writeMask&0x80)?'4':'-'
);*/
writeMask^=hardResetMask;
immWrite(0x28,writeMask);
writeMask^=hardResetMask;
// hard reset handling
if (mustHardReset) {
@ -651,6 +691,7 @@ void DivPlatformGenesisExt::tick(bool sysTick) {
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[i];
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[i];
immWrite(baseAddr+ADDR_SL_RR,(op.rr&15)|(op.sl<<4));
opChan[i].keyOn=false;
}
}
immWrite(0x28,writeMask);

View file

@ -145,15 +145,15 @@ void DivPlatformK053260::tick(bool sysTick) {
off=8363.0/s->centerRate;
}
}
DivSample* s=parent->getSample(chan[i].sample);
DivSample* s=parent->getSample(sample);
chan[i].freq=0x1000-(int)(off*parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,true,0,chan[i].pitch2,chipClock,CHIP_DIVIDER));
if (chan[i].freq>4095) chan[i].freq=4095;
if (chan[i].freq<0) chan[i].freq=0;
if (chan[i].keyOn) {
unsigned int start=0;
unsigned int length=0;
if (chan[i].sample>=0 && chan[i].sample<parent->song.sampleLen) {
start=sampleOffK053260[chan[i].sample];
if (sample>=0 && sample<parent->song.sampleLen) {
start=sampleOffK053260[sample];
length=s->length8;
if (chan[i].reverse) {
start+=length;
@ -163,8 +163,7 @@ void DivPlatformK053260::tick(bool sysTick) {
if (chan[i].audPos>0) {
if (chan[i].reverse) {
start=start-MIN(chan[i].audPos,s->length8);
}
else {
} else {
start=start+MIN(chan[i].audPos,s->length8);
}
length=MAX(1,length-chan[i].audPos);

View file

@ -571,7 +571,7 @@ void DivPlatformNamcoWSG::setFlags(const DivConfig& flags) {
chipClock=3072000;
CHECK_CUSTOM_CLOCK;
rate=chipClock/32;
namco->device_clock_changed(rate);
namco->device_clock_changed(96000);
for (int i=0; i<chans; i++) {
oscBuf[i]->rate=rate;
}

View file

@ -130,9 +130,9 @@ void DivPlatformNES::acquire_NSFPlay(short** buf, size_t len) {
for (size_t i=0; i<len; i++) {
doPCM;
nes1_NP->Tick(1);
nes2_NP->TickFrameSequence(1);
nes2_NP->Tick(1);
nes1_NP->Tick(8);
nes2_NP->TickFrameSequence(8);
nes2_NP->Tick(8);
nes1_NP->Render(out1);
nes2_NP->Render(out2);
@ -140,7 +140,7 @@ void DivPlatformNES::acquire_NSFPlay(short** buf, size_t len) {
if (sample>32767) sample=32767;
if (sample<-32768) sample=-32768;
buf[0][i]=sample;
if (++writeOscBuf>=32) {
if (++writeOscBuf>=4) {
writeOscBuf=0;
oscBuf[0]->data[oscBuf[0]->needle++]=nes1_NP->out[0]<<11;
oscBuf[1]->data[oscBuf[1]->needle++]=nes1_NP->out[1]<<11;
@ -332,7 +332,7 @@ void DivPlatformNES::tick(bool sysTick) {
if (chan[4].keyOn) {
if (dpcmMode && !skipRegisterWrites && dacSample>=0 && dacSample<parent->song.sampleLen) {
unsigned int dpcmAddr=sampleOffDPCM[dacSample];
unsigned int dpcmLen=(parent->getSample(dacSample)->lengthDPCM+15)>>4;
unsigned int dpcmLen=parent->getSample(dacSample)->lengthDPCM>>4;
if (dpcmLen>255) dpcmLen=255;
goingToLoop=parent->getSample(dacSample)->isLoopable();
// write DPCM
@ -749,8 +749,11 @@ void DivPlatformNES::setFlags(const DivConfig& flags) {
}
CHECK_CUSTOM_CLOCK;
rate=chipClock;
if (useNP) {
rate/=8;
}
for (int i=0; i<5; i++) {
oscBuf[i]->rate=rate/32;
oscBuf[i]->rate=rate/(useNP?4:32);
}
dpcmModeDefault=flags.getBool("dpcmMode",true);

View file

@ -275,11 +275,20 @@ void DivPlatformOPL::acquire_nuked(short** buf, size_t len) {
if (os[3]>32767) os[3]=32767;
buf[0][h]=os[0];
if (oplType==3 || oplType==759) {
if (totalOutputs>1) {
buf[1][h]=os[1];
}
if (totalOutputs>2) {
buf[2][h]=os[2];
}
if (totalOutputs>3) {
buf[3][h]=os[3];
}
if (totalOutputs==6) {
// placeholder for OPL4
buf[4][h]=0;
buf[5][h]=0;
}
}
}
@ -1590,7 +1599,7 @@ void DivPlatformOPL::reset() {
}
*/
if (downsample) {
const unsigned int downsampledRate=(unsigned int)((double)rate*rate/chipRateBase);
const unsigned int downsampledRate=(unsigned int)((double)rate*round(COLOR_NTSC/72.0)/(double)chipRateBase);
OPL3_Reset(&fm,downsampledRate);
} else {
OPL3_Reset(&fm,rate);
@ -1671,7 +1680,7 @@ void DivPlatformOPL::reset() {
}
int DivPlatformOPL::getOutputCount() {
return (oplType==3 || oplType==759)?4:1;
return totalOutputs;
}
bool DivPlatformOPL::keyOffAffectsArp(int ch) {
@ -1730,6 +1739,7 @@ void DivPlatformOPL::setOPLType(int type, bool drums) {
if (type==8950) {
adpcmChan=drums?11:9;
}
totalOutputs=1;
break;
case 3: case 4: case 759:
slotsNonDrums=slotsOPL3;
@ -1748,6 +1758,7 @@ void DivPlatformOPL::setOPLType(int type, bool drums) {
chipFreqBase=32768*684;
downsample=true;
}
totalOutputs=(type==4)?6:4;
break;
}
chipType=type;
@ -1829,14 +1840,36 @@ void DivPlatformOPL::setFlags(const DivConfig& flags) {
case 0x04:
chipClock=15000000.0;
break;
case 0x05:
chipClock=33868800.0;
break;
default:
chipClock=COLOR_NTSC*4.0;
break;
}
CHECK_CUSTOM_CLOCK;
rate=chipClock/288;
chipRateBase=rate;
compatPan=flags.getBool("compatPan",false);
switch (flags.getInt("chipType",0)) {
case 1: // YMF289B
chipFreqBase=32768*684;
rate=chipClock/768;
chipRateBase=chipClock/684;
downsample=true;
totalOutputs=2; // Stereo output only
break;
default: // YMF262
chipFreqBase=32768*288;
rate=chipClock/288;
chipRateBase=rate;
downsample=false;
totalOutputs=4;
break;
}
if (downsample) {
const unsigned int downsampledRate=(unsigned int)((double)rate*round(COLOR_NTSC/72.0)/(double)chipRateBase);
OPL3_Resample(&fm,downsampledRate);
} else {
OPL3_Resample(&fm,rate);
}
break;
case 4:
switch (flags.getInt("clockSel",0)) {
@ -1860,6 +1893,7 @@ void DivPlatformOPL::setFlags(const DivConfig& flags) {
chipClock=rate*288;
break;
}
compatPan=flags.getBool("compatPan",false);
for (int i=0; i<20; i++) {
oscBuf[i]->rate=rate;

View file

@ -82,7 +82,7 @@ class DivPlatformOPL: public DivDispatch {
const unsigned short* chanMap;
const unsigned char* outChanMap;
int chipFreqBase, chipRateBase;
int delay, chipType, oplType, chans, melodicChans, totalChans, adpcmChan, sampleBank;
int delay, chipType, oplType, chans, melodicChans, totalChans, adpcmChan, sampleBank, totalOutputs;
unsigned char lastBusy;
unsigned char drumState;
unsigned char drumVol[5];

View file

@ -28,6 +28,8 @@
#define CHIP_FREQBASE 1180068
#define DRUM_VOL(_x) (drumActivated[_x]?drumVol[_x]:15)
const unsigned char cycleMapOPLL[18]={
8, 7, 6, 7, 8, 7, 8, 6, 0, 1, 2, 7, 8, 9, 3, 4, 5, 9
};
@ -52,7 +54,7 @@ void DivPlatformOPLL::acquire_nuked(short** buf, size_t len) {
QueuedWrite& w=writes.front();
if (w.addrOrVal) {
OPLL_Write(&fm,1,w.val);
//printf("write: %x = %.2x\n",w.addr,w.val);
//logV("write: %x = %.2x",w.addr,w.val);
regPool[w.addr&0xff]=w.val;
writes.pop();
delay=21;
@ -104,10 +106,10 @@ void DivPlatformOPLL::tick(bool sysTick) {
if (i>=6 && properDrums) {
drumVol[i-6]=15-chan[i].outVol;
rWrite(0x36,drumVol[0]);
rWrite(0x37,drumVol[1]|(drumVol[4]<<4));
rWrite(0x38,drumVol[3]|(drumVol[2]<<4));
} else if (i<6 || !drums) {
rWrite(0x36,DRUM_VOL(0));
rWrite(0x37,DRUM_VOL(1)|(DRUM_VOL(4)<<4));
rWrite(0x38,DRUM_VOL(3)|(DRUM_VOL(2)<<4));
} else if (i<6 || !crapDrums) {
if (i<9) {
rWrite(0x30+i,((15-VOL_SCALE_LOG_BROKEN(chan[i].outVol,15-chan[i].state.op[1].tl,15))&15)|(chan[i].state.opllPreset<<4));
}
@ -230,16 +232,16 @@ void DivPlatformOPLL::tick(bool sysTick) {
if (i>=6 && properDrums) {
drumState&=~(0x10>>(i-6));
immWrite(0x0e,0x20|drumState);
logV("properDrums %d",i);
} else if (i>=6 && drums) {
//logV("properDrums %d",i);
} else if (i>=6 && crapDrums) {
drumState&=~(0x10>>(chan[i].note%12));
immWrite(0x0e,0x20|drumState);
logV("drums %d",i);
//logV("drums %d",i);
} else {
if (i<9) {
immWrite(0x20+i,(chan[i].freqH)|(chan[i].state.alg?0x20:0));
}
logV("normal %d",i);
//logV("normal %d",i);
}
//chan[i].keyOn=false;
chan[i].keyOff=false;
@ -265,7 +267,21 @@ void DivPlatformOPLL::tick(bool sysTick) {
if (i>=6 && properDrums && (i<9 || !noTopHatFreq)) {
immWrite(0x10+drumSlot[i],freqt&0xff);
immWrite(0x20+drumSlot[i],freqt>>8);
} else if (i<6 || !drums) {
switch (i) {
case 7:
lastFreqSH=0;
break;
case 8:
lastFreqTT=0;
break;
case 9:
lastFreqTT=1;
break;
case 19:
lastFreqSH=1;
break;
}
} else if (i<6 || !crapDrums) {
if (i<9) {
immWrite(0x10+i,freqt&0xff);
}
@ -278,7 +294,7 @@ void DivPlatformOPLL::tick(bool sysTick) {
immWrite(0x0e,0x20|drumState);
}
chan[i].keyOn=false;
} else if (chan[i].keyOn && i>=6 && drums) {
} else if (chan[i].keyOn && i>=6 && crapDrums) {
//printf("%d\n",chan[i].note%12);
drumState|=(0x10>>(chan[i].note%12));
immWrite(0x0e,0x20|drumState);
@ -365,22 +381,24 @@ void DivPlatformOPLL::commitState(int ch, DivInstrument* ins) {
}
if (chan[ch].state.opllPreset==16) { // compatible drums mode
if (ch>=6) {
drums=true;
immWrite(0x16,0x20);
immWrite(0x26,0x05);
immWrite(0x16,0x20);
immWrite(0x26,0x05);
immWrite(0x17,0x50);
immWrite(0x27,0x05);
immWrite(0x17,0x50);
immWrite(0x27,0x05);
immWrite(0x18,0xC0);
immWrite(0x28,0x01);
if (!properDrumsSys) {
crapDrums=true;
immWrite(0x16,0x20);
immWrite(0x26,0x05);
immWrite(0x16,0x20);
immWrite(0x26,0x05);
immWrite(0x17,0x50);
immWrite(0x27,0x05);
immWrite(0x17,0x50);
immWrite(0x27,0x05);
immWrite(0x18,0xC0);
immWrite(0x28,0x01);
}
}
} else {
if (ch>=6) {
if (drums) {
drums=false;
if (crapDrums) {
crapDrums=false;
immWrite(0x0e,0);
drumState=0;
}
@ -392,6 +410,45 @@ void DivPlatformOPLL::commitState(int ch, DivInstrument* ins) {
}
}
void DivPlatformOPLL::switchMode(bool mode) {
if (mode==properDrums) return;
if (mode) {
//logV("mode switch to DRUMS");
for (int i=0; i<5; i++) {
drumActivated[i]=chan[6+i].keyOn;
}
immWrite(0x26,0);
immWrite(0x27,0);
immWrite(0x28,0);
immWrite(0x16,0);
immWrite(0x17,0);
immWrite(0x18,0);
immWrite(0x0e,0x20);
rWrite(0x36,DRUM_VOL(0));
rWrite(0x37,DRUM_VOL(1)|(DRUM_VOL(4)<<4));
rWrite(0x38,DRUM_VOL(3)|(DRUM_VOL(2)<<4));
oldWrites[0x36]=-1;
oldWrites[0x37]=-1;
oldWrites[0x38]=-1;
} else {
//logV("mode switch to NORMAL");
immWrite(0x0e,0x20);
immWrite(0x0e,0x00);
for (int i=6; i<9; i++) {
if (chan[i].active) {
chan[i].freqChanged=true;
chan[i].keyOff=false;
chan[i].keyOn=true;
oldWrites[0x30+i]=-1;
}
chan[i].insChanged=true;
}
}
properDrums=mode;
drumState=0;
}
int DivPlatformOPLL::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
@ -408,18 +465,31 @@ int DivPlatformOPLL::dispatch(DivCommand c) {
if (c.chan>=6 && properDrums) { // drums mode
chan[c.chan].insChanged=false;
drumActivated[c.chan-6]=true;
if (c.value!=DIV_NOTE_NULL) {
if (chan[c.chan].state.opllPreset==16 && chan[c.chan].state.fixedDrums) {
switch (c.chan) {
case 6:
chan[c.chan].fixedFreq=(chan[c.chan].state.kickFreq&511)<<(chan[c.chan].state.kickFreq>>9);
break;
case 7: case 10:
chan[c.chan].fixedFreq=(chan[c.chan].state.snareHatFreq&511)<<(chan[c.chan].state.snareHatFreq>>9);
break;
case 8: case 9:
chan[c.chan].fixedFreq=(chan[c.chan].state.tomTopFreq&511)<<(chan[c.chan].state.tomTopFreq>>9);
break;
if (fixedAll) {
chan[6].fixedFreq=(chan[c.chan].state.kickFreq&511)<<(chan[c.chan].state.kickFreq>>9);
chan[7].fixedFreq=(chan[c.chan].state.snareHatFreq&511)<<(chan[c.chan].state.snareHatFreq>>9);
chan[8].fixedFreq=(chan[c.chan].state.tomTopFreq&511)<<(chan[c.chan].state.tomTopFreq>>9);
chan[9].fixedFreq=(chan[c.chan].state.tomTopFreq&511)<<(chan[c.chan].state.tomTopFreq>>9);
chan[10].fixedFreq=(chan[c.chan].state.snareHatFreq&511)<<(chan[c.chan].state.snareHatFreq>>9);
chan[7].freqChanged=true;
chan[8].freqChanged=true;
chan[9].freqChanged=true;
} else {
switch (c.chan) {
case 6:
chan[c.chan].fixedFreq=(chan[c.chan].state.kickFreq&511)<<(chan[c.chan].state.kickFreq>>9);
break;
case 7: case 10:
chan[c.chan].fixedFreq=(chan[c.chan].state.snareHatFreq&511)<<(chan[c.chan].state.snareHatFreq>>9);
break;
case 8: case 9:
chan[c.chan].fixedFreq=(chan[c.chan].state.tomTopFreq&511)<<(chan[c.chan].state.tomTopFreq>>9);
break;
}
}
} else {
chan[c.chan].baseFreq=NOTE_FREQUENCY(c.value);
@ -429,6 +499,10 @@ int DivPlatformOPLL::dispatch(DivCommand c) {
}
chan[c.chan].keyOn=true;
chan[c.chan].active=true;
rWrite(0x36,DRUM_VOL(0));
rWrite(0x37,DRUM_VOL(1)|(DRUM_VOL(4)<<4));
rWrite(0x38,DRUM_VOL(3)|(DRUM_VOL(2)<<4));
break;
}
@ -439,7 +513,7 @@ int DivPlatformOPLL::dispatch(DivCommand c) {
chan[c.chan].baseFreq=NOTE_FREQUENCY(c.value);
chan[c.chan].note=c.value;
if (c.chan>=6 && drums) {
if (c.chan>=6 && crapDrums) {
switch (chan[c.chan].note%12) {
case 0: // kick
drumVol[0]=(15-(chan[c.chan].outVol*(15-chan[c.chan].state.op[1].tl))/15);
@ -457,9 +531,9 @@ int DivPlatformOPLL::dispatch(DivCommand c) {
drumVol[4]=(15-(chan[c.chan].outVol*(15-chan[c.chan].state.op[1].tl))/15);
break;
}
rWrite(0x36,drumVol[0]);
rWrite(0x37,drumVol[1]|(drumVol[4]<<4));
rWrite(0x38,drumVol[3]|(drumVol[2]<<4));
rWrite(0x36,DRUM_VOL(0));
rWrite(0x37,DRUM_VOL(1)|(DRUM_VOL(4)<<4));
rWrite(0x38,DRUM_VOL(3)|(DRUM_VOL(2)<<4));
}
chan[c.chan].freqChanged=true;
}
@ -494,11 +568,11 @@ int DivPlatformOPLL::dispatch(DivCommand c) {
}
if (c.chan>=6 && properDrums) {
drumVol[c.chan-6]=15-chan[c.chan].outVol;
rWrite(0x36,drumVol[0]);
rWrite(0x37,drumVol[1]|(drumVol[4]<<4));
rWrite(0x38,drumVol[3]|(drumVol[2]<<4));
rWrite(0x36,DRUM_VOL(0));
rWrite(0x37,DRUM_VOL(1)|(DRUM_VOL(4)<<4));
rWrite(0x38,DRUM_VOL(3)|(DRUM_VOL(2)<<4));
break;
} else if (c.chan<6 || !drums) {
} else if (c.chan<6 || !crapDrums) {
if (c.chan<9) {
rWrite(0x30+c.chan,((15-VOL_SCALE_LOG_BROKEN(chan[c.chan].outVol,15-chan[c.chan].state.op[1].tl,15))&15)|(chan[c.chan].state.opllPreset<<4));
}
@ -556,7 +630,7 @@ int DivPlatformOPLL::dispatch(DivCommand c) {
}
case DIV_CMD_LEGATO: {
if (c.chan>=9 && !properDrums) return 0;
if (c.chan<6 || (!drums && !properDrums)) {
if (c.chan<6 || (!crapDrums && !properDrums)) {
if (chan[c.chan].insChanged) {
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_OPLL);
commitState(c.chan,ins);
@ -771,20 +845,7 @@ int DivPlatformOPLL::dispatch(DivCommand c) {
case DIV_CMD_FM_EXTCH:
if (!properDrumsSys) break;
if ((int)properDrums==c.value) break;
if (c.value) {
properDrums=true;
immWrite(0x0e,0x20);
drumState=0;
} else {
properDrums=false;
immWrite(0x0e,0x00);
drumState=0;
}
chan[6].freqChanged=true;
chan[7].freqChanged=true;
chan[8].freqChanged=true;
chan[9].freqChanged=true;
chan[10].freqChanged=true;
switchMode(c.value);
break;
case DIV_CMD_MACRO_OFF:
chan[c.chan].std.mask(c.value,true);
@ -839,7 +900,7 @@ void DivPlatformOPLL::forceIns() {
}
}
}
if (drums) { // WHAT?! FIX THIS!
if (crapDrums) { // WHAT?! FIX THIS!
immWrite(0x16,0x20);
immWrite(0x26,0x05);
immWrite(0x16,0x20);
@ -851,11 +912,25 @@ void DivPlatformOPLL::forceIns() {
immWrite(0x18,0xC0);
immWrite(0x28,0x01);
}
// restore drum volumes
// restore drum volumes and state
if (properDrums) {
rWrite(0x36,drumVol[0]);
rWrite(0x37,drumVol[1]|(drumVol[4]<<4));
rWrite(0x38,drumVol[3]|(drumVol[2]<<4));
rWrite(0x36,DRUM_VOL(0));
rWrite(0x37,DRUM_VOL(1)|(DRUM_VOL(4)<<4));
rWrite(0x38,DRUM_VOL(3)|(DRUM_VOL(2)<<4));
if (lastFreqSH==0) {
chan[7].freqChanged=true;
} else if (lastFreqSH==1) {
chan[10].freqChanged=true;
}
if (lastFreqTT==0) {
chan[8].freqChanged=true;
} else if (lastFreqTT==1) {
chan[9].freqChanged=true;
}
chan[6].freqChanged=true;
}
drumState=0;
}
@ -936,16 +1011,18 @@ void DivPlatformOPLL::reset() {
drumState=0;
lastCustomMemory=-1;
drumVol[0]=0;
drumVol[1]=0;
drumVol[2]=0;
drumVol[3]=0;
drumVol[4]=0;
for (int i=0; i<5; i++) {
drumVol[i]=0;
drumActivated[i]=true;
}
delay=0;
drums=false;
crapDrums=false;
properDrums=properDrumsSys;
lastFreqSH=-1;
lastFreqTT=-1;
if (properDrums) {
immWrite(0x0e,0x20);
}
@ -1011,6 +1088,7 @@ void DivPlatformOPLL::setFlags(const DivConfig& flags) {
oscBuf[i]->rate=rate/2;
}
noTopHatFreq=flags.getBool("noTopHatFreq",false);
fixedAll=flags.getBool("fixedAll",false);
}
int DivPlatformOPLL::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {

View file

@ -59,12 +59,18 @@ class DivPlatformOPLL: public DivDispatch {
unsigned char lastBusy;
unsigned char drumState;
unsigned char drumVol[5];
bool drumActivated[5];
// -1: undefined
// 0: snare/tom
// 1: hi-hat/top
signed char lastFreqSH, lastFreqTT;
unsigned char regPool[256];
bool useYMFM;
bool drums;
bool properDrums, properDrumsSys, noTopHatFreq;
bool crapDrums;
bool properDrums, properDrumsSys, noTopHatFreq, fixedAll;
bool vrc7;
unsigned char patchSet;
@ -75,6 +81,7 @@ class DivPlatformOPLL: public DivDispatch {
int octave(int freq);
int toFreq(int freq);
void commitState(int ch, DivInstrument* ins);
void switchMode(bool mode);
friend void putDispatchChip(void*,int);
friend void putDispatchChan(void*,int,int);

View file

@ -17,9 +17,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#define _USE_MATH_DEFINES
#include "pcspkr.h"
#include "../engine.h"
#include "../../ta-log.h"
#include <math.h>
#ifdef __linux__
@ -190,9 +192,6 @@ const char** DivPlatformPCSpeaker::getRegisterSheet() {
return regCheatSheetPCSpeaker;
}
const float cut=0.05;
const float reso=0.06;
void DivPlatformPCSpeaker::acquire_unfilt(short** buf, size_t len) {
int out=0;
for (size_t i=0; i<len; i++) {
@ -229,8 +228,8 @@ void DivPlatformPCSpeaker::acquire_cone(short** buf, size_t len) {
}
}
float next=(pos>((freq+16)>>1) && !isMuted[0])?1:0;
low+=0.04*band;
band+=0.04*(next-low-band);
low+=cut*band;
band+=cut*(next-low-band);
float out=(low+band)*0.75;
if (out>1.0) out=1.0;
if (out<-1.0) out=-1.0;
@ -612,6 +611,17 @@ void DivPlatformPCSpeaker::setFlags(const DivConfig& flags) {
rate=chipClock/PCSPKR_DIVIDER;
speakerType=flags.getInt("speakerType",0)&3;
oscBuf->rate=rate;
switch (speakerType) {
case 1:
cut=2.0*sin(M_PI*1900.0/rate);
reso=0.0;
break;
default:
cut=2.0*sin(M_PI*2375.0/rate);
reso=0.06;
break;
}
}
void DivPlatformPCSpeaker::notifyInsDeletion(void* ins) {

View file

@ -57,6 +57,9 @@ class DivPlatformPCSpeaker: public DivDispatch {
float low, band;
float low2, high2, band2;
float low3, band3;
float cut;
float reso;
unsigned short freq, lastFreq;
unsigned char regPool[2];

View file

@ -296,6 +296,10 @@ void DivPlatformSMS::tick(bool sysTick) {
rWrite(0,0x90|(i<<5)|(isMuted[i]?15:(15-(chan[i].outVol&15))));
chan[i].writeVol=false;
}
if (chan[i].keyOff) {
rWrite(0,0x9f|i<<5);
chan[i].keyOff=false;
}
}
}
@ -309,6 +313,7 @@ int DivPlatformSMS::dispatch(DivCommand c) {
chan[c.chan].actualNote=c.value;
}
chan[c.chan].active=true;
chan[c.chan].keyOff=false;
//if (!parent->song.brokenOutVol2) {
chan[c.chan].writeVol=true;
chan[c.chan].outVol=chan[c.chan].vol;
@ -321,7 +326,7 @@ int DivPlatformSMS::dispatch(DivCommand c) {
break;
case DIV_CMD_NOTE_OFF:
chan[c.chan].active=false;
rWrite(0,0x9f|c.chan<<5);
chan[c.chan].keyOff=true;
chan[c.chan].macroInit(NULL);
break;
case DIV_CMD_NOTE_OFF_ENV:

View file

@ -733,6 +733,7 @@ int DivPlatformSNES::getRegisterPoolSize() {
void DivPlatformSNES::initEcho() {
unsigned char esa=0xf8-(echoDelay<<3);
unsigned char control=(noiseFreq&0x1f)|(echoOn?0:0x20);
if (echoOn) {
rWrite(0x6d,esa);
rWrite(0x7d,echoDelay);
@ -742,13 +743,14 @@ void DivPlatformSNES::initEcho() {
for (int i=0; i<8; i++) {
rWrite(0x0f+(i<<4),echoFIR[i]);
}
rWrite(0x6c,control);
} else {
rWrite(0x6d,0);
rWrite(0x7d,0);
rWrite(0x2c,0);
rWrite(0x3c,0);
rWrite(0x6c,control);
rWrite(0x7d,0);
rWrite(0x6d,0xff);
}
writeControl=true;
}
void DivPlatformSNES::reset() {

View file

@ -0,0 +1,205 @@
/*
============================================================================
MODIFIED Namco C140 sound emulator - MODIFIED VERSION
by cam900
MODIFICATION by tildearrow - adds muting function
THIS IS NOT THE ORIGINAL VERSION - you can find the original one in
commit 72d04777c013988ed8cf6da27c62a9d784a59dff
This file is licensed under zlib license.
============================================================================
zlib License
(C) 2023-present cam900 and contributors
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
============================================================================
TODO:
- unknown registers (Bit 6 of control register, etc)
- Internal timer
*/
#include "c140.h"
static int c140_max(int a, int b) { return (a > b) ? a : b; }
static int c140_min(int a, int b) { return (a < b) ? a : b; }
static int c140_clamp(int v, int min, int max) { return c140_min(c140_max(v,min),max); }
static int c140_bit(int val, int bit) { return (val >> bit) & 1; }
static int c140_bitfield(int val, int bit, int len) { return (val >> bit) & ((1 << len) - 1);}
void c140_tick(struct c140_t *c140, const int cycle)
{
c140->lout = 0;
c140->rout = 0;
for (int i = 0; i < 24; i++)
{
c140_voice_tick(c140, i, cycle);
c140->lout += c140->voice[i].lout;
c140->rout += c140->voice[i].rout;
}
}
void c140_voice_tick(struct c140_t *c140, const unsigned char v, const int cycle)
{
struct c140_voice_t *voice = &c140->voice[v];
if (voice->busy && voice->keyon)
{
for (int c = 0; c < cycle; c++)
{
voice->frac += voice->freq;
if (voice->frac > 0xffff)
{
voice->addr += voice->frac >> 16;
if (voice->addr > voice->end_addr)
{
if (voice->loop)
{
voice->addr = (voice->addr + voice->loop_addr) - voice->end_addr;
}
else
{
voice->keyon = false;
voice->lout = 0;
voice->rout = 0;
return;
}
}
voice->frac &= 0xffff;
}
}
if (!voice->muted)
{
// fetch 12 bit sample
signed short s1 = c140->sample_mem[((unsigned int)(voice->bank) << 16) | voice->addr] & ~0xf;
signed short s2 = c140->sample_mem[((unsigned int)(voice->bank) << 16) | ((voice->addr + 1) & 0xffff)] & ~0xf;
if (voice->compressed)
{
s1 = c140->mulaw[(s1 >> 8) & 0xff];
s2 = c140->mulaw[(s2 >> 8) & 0xff];
}
// interpolate
signed int sample = s1 + (((voice->frac) * (s2 - s1)) >> 16);
voice->lout = sample * voice->lvol;
voice->rout = sample * voice->rvol;
}
else
{
voice->lout = 0;
voice->rout = 0;
}
}
else
{
voice->lout = 0;
voice->rout = 0;
}
}
void c140_keyon(struct c140_voice_t *c140_voice)
{
c140_voice->busy = true;
c140_voice->keyon = true;
c140_voice->frac = 0;
c140_voice->addr = c140_voice->start_addr;
}
void c140_init(struct c140_t *c140)
{
// u-law table verified from Wii Virtual Console Arcade Starblade
for (int i = 0; i < 256; i++)
{
const unsigned char exponent = c140_bitfield(i, 0, 3);
const unsigned char mantissa = c140_bitfield(i, 3, 4);
if (c140_bit(i, 7))
{
c140->mulaw[i] = (signed short)(((exponent ? 0xfe00 : 0xff00) | (mantissa << 4))
<< (exponent ? exponent - 1 : 0));
}
else
{
c140->mulaw[i] = (signed short)(((exponent ? 0x100 : 0) | (mantissa << 4))
<< (exponent ? exponent - 1 : 0));
}
}
for (int i = 0; i < 24; i++)
{
c140->voice[i].muted = false;
}
}
void c140_reset(struct c140_t *c140)
{
for (int i = 0; i < 24; i++)
{
c140->voice[i].busy = false;
c140->voice[i].keyon = false;
c140->voice[i].freq = 0;
c140->voice[i].bank = 0;
c140->voice[i].start_addr = 0;
c140->voice[i].loop_addr = 0;
c140->voice[i].end_addr = 0;
c140->voice[i].lvol = 0;
c140->voice[i].rvol = 0;
c140->voice[i].compressed = false;
c140->voice[i].loop = false;
c140->voice[i].addr = 0;
c140->voice[i].frac = 0;
c140->voice[i].lout = 0;
c140->voice[i].rout = 0;
}
}
void c140_write(struct c140_t *c140, const unsigned short addr, const unsigned char data)
{
// voice register
if (addr < 0x180)
{
struct c140_voice_t *voice = &c140->voice[addr >> 4];
switch (addr & 0xf)
{
case 0x0: voice->rvol = data; break;
case 0x1: voice->lvol = data; break;
case 0x2: voice->freq = (voice->freq & ~0xff00) | (unsigned int)(data << 8); break;
case 0x3: voice->freq = (voice->freq & ~0x00ff) | data; break;
case 0x4: voice->bank = data; break;
case 0x5:
voice->compressed = c140_bit(data, 3);
voice->loop = c140_bit(data, 4);
if (data & 0x80)
c140_keyon(voice);
else
voice->busy = false;
break;
case 0x6: voice->start_addr = (voice->start_addr & ~0xff00) | (unsigned int)(data << 8); break;
case 0x7: voice->start_addr = (voice->start_addr & ~0x00ff) | data; break;
case 0x8: voice->end_addr = (voice->end_addr & ~0xff00) | (unsigned int)(data << 8); break;
case 0x9: voice->end_addr = (voice->end_addr & ~0x00ff) | data; break;
case 0xa: voice->loop_addr = (voice->loop_addr & ~0xff00) | (unsigned int)(data << 8); break;
case 0xb: voice->loop_addr = (voice->loop_addr & ~0x00ff) | data; break;
default: break;
}
}
// Timer
}

View file

@ -0,0 +1,96 @@
/*
============================================================================
MODIFIED Namco C140 sound emulator - MODIFIED VERSION
by cam900
MODIFICATION by tildearrow - adds muting function
THIS IS NOT THE ORIGINAL VERSION - you can find the original one in
commit 72d04777c013988ed8cf6da27c62a9d784a59dff
This file is licensed under zlib license.
============================================================================
zlib License
(C) 2023-present cam900 and contributors
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
============================================================================
TODO:
- unknown registers (Bit 6 of control register, etc)
- Internal timer
*/
#ifndef _C140_EMU_H
#define _C140_EMU_H
#include <stdbool.h>
#ifdef __cplusplus
extern "C"
{
#endif
struct c140_voice_t
{
bool muted; // muted - can be set by user
bool busy; // busy flag
bool keyon; // key on flag
unsigned short freq; // sample frequency
unsigned char bank; // sample bank
unsigned short start_addr; // sample start address
unsigned short loop_addr; // sample loop address
unsigned short end_addr; // sample end address
int lvol, rvol; // left/right volume
bool compressed; // compressed sample flag
bool loop; // loop flag
unsigned short addr; // sample address
int frac; // frequency counter (.16 fixed point)
int lout, rout; // left/right output
};
struct c140_t
{
struct c140_voice_t voice[24];
signed int lout, rout;
signed short mulaw[256];
signed short *sample_mem;
};
void c140_tick(struct c140_t *c140, const int cycle);
void c140_voice_tick(struct c140_t *c140, const unsigned char v, const int cycle);
void c140_keyon(struct c140_voice_t *c140_voice);
void c140_write(struct c140_t *c140, const unsigned short addr, const unsigned char data);
void c140_init(struct c140_t *c140);
void c140_reset(struct c140_t *c140);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // _C140_EMU_H

View file

@ -257,6 +257,10 @@ void DivPlatformTED::forceIns() {
updateCtrl=true;
}
bool DivPlatformTED::isVolGlobal() {
return true;
}
void* DivPlatformTED::getChanState(int ch) {
return &chan[ch];
}

View file

@ -54,6 +54,7 @@ class DivPlatformTED: public DivDispatch {
public:
void acquire(short** buf, size_t len);
int dispatch(DivCommand c);
bool isVolGlobal();
void* getChanState(int chan);
DivMacroInt* getChanMacroInt(int ch);
DivDispatchOscBuffer* getOscBuffer(int chan);

View file

@ -356,12 +356,12 @@ void DivPlatformTIA::poke(std::vector<DivRegWrite>& wlist) {
void DivPlatformTIA::setFlags(const DivConfig& flags) {
if (flags.getInt("clockSel",0)) {
rate=COLOR_PAL*4.0/5.0;
chipClock=COLOR_PAL*4.0/5.0;
} else {
rate=COLOR_NTSC;
chipClock=COLOR_NTSC;
}
CHECK_CUSTOM_CLOCK;
chipClock=rate;
rate=chipClock;
mixingType=flags.getInt("mixingType",0)&3;
for (int i=0; i<2; i++) {
oscBuf[i]->rate=rate/114;

View file

@ -278,6 +278,10 @@ void DivPlatformVIC20::forceIns() {
}
}
bool DivPlatformVIC20::isVolGlobal() {
return true;
}
void* DivPlatformVIC20::getChanState(int ch) {
return &chan[ch];
}

View file

@ -46,6 +46,7 @@ class DivPlatformVIC20: public DivDispatch {
public:
void acquire(short** buf, size_t len);
int dispatch(DivCommand c);
bool isVolGlobal();
void* getChanState(int chan);
DivMacroInt* getChanMacroInt(int ch);
DivDispatchOscBuffer* getOscBuffer(int chan);

View file

@ -670,6 +670,7 @@ int DivPlatformYM2203::dispatch(DivCommand c) {
}
case DIV_CMD_FM_EXTCH: {
if (extSys) {
if (extMode==(bool)c.value) break;
extMode=c.value;
immWrite(0x27,extMode?0x40:0);
}

View file

@ -138,6 +138,7 @@ int DivPlatformYM2203Ext::dispatch(DivCommand c) {
opChan[ch].insChanged=true;
}
opChan[ch].ins=c.value;
chan[extChanOffs].ins=opChan[ch].ins;
break;
case DIV_CMD_PITCH: {
opChan[ch].pitch=c.value;
@ -182,8 +183,15 @@ int DivPlatformYM2203Ext::dispatch(DivCommand c) {
break;
}
case DIV_CMD_FM_EXTCH: {
if (extMode==(bool)c.value) break;
extMode=c.value;
immWrite(0x27,extMode?0x40:0);
if (!extMode) {
for (int i=0; i<4; i++) {
opChan[i].insChanged=true;
}
chan[extChanOffs].insChanged=true;
}
break;
}
case DIV_CMD_FM_FB: {
@ -355,6 +363,9 @@ int DivPlatformYM2203Ext::dispatch(DivCommand c) {
}
break;
}
case DIV_CMD_FM_HARD_RESET:
opChan[ch].hardReset=c.value;
break;
case DIV_CMD_GET_VOLMAX:
return 127;
break;
@ -385,6 +396,9 @@ static int opChanOffsH[4]={
};
void DivPlatformYM2203Ext::tick(bool sysTick) {
int hardResetElapsed=0;
bool mustHardReset=false;
if (extMode) {
bool writeSomething=false;
unsigned char writeMask=2;
@ -395,6 +409,12 @@ void DivPlatformYM2203Ext::tick(bool sysTick) {
writeMask&=~(1<<(4+i));
opChan[i].keyOff=false;
}
if (opChan[i].hardReset && opChan[i].keyOn) {
mustHardReset=true;
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[i];
immWrite(baseAddr+ADDR_SL_RR,0x0f);
hardResetElapsed++;
}
}
if (writeSomething) {
immWrite(0x28,writeMask);
@ -432,6 +452,27 @@ void DivPlatformYM2203Ext::tick(bool sysTick) {
opChan[i].freqChanged=true;
}
// channel macros
if (opChan[i].std.alg.had) {
chan[extChanOffs].state.alg=opChan[i].std.alg.val;
rWrite(chanOffs[extChanOffs]+ADDR_FB_ALG,(chan[extChanOffs].state.alg&7)|(chan[extChanOffs].state.fb<<3));
if (!parent->song.algMacroBehavior) for (int j=0; j<4; j++) {
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[j];
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[j];
if (isOpMuted[j] || !op.enable) {
rWrite(baseAddr+0x40,127);
} else {
rWrite(baseAddr+0x40,127-VOL_SCALE_LOG_BROKEN(127-op.tl,opChan[j].outVol&0x7f,127));
}
}
}
if (i==0 || fbAllOps) {
if (opChan[i].std.fb.had) {
chan[extChanOffs].state.fb=opChan[i].std.fb.val;
rWrite(chanOffs[extChanOffs]+ADDR_FB_ALG,(chan[extChanOffs].state.alg&7)|(chan[extChanOffs].state.fb<<3));
}
}
// param macros
unsigned short baseAddr=chanOffs[2]|opOffs[orderedOps[i]];
DivInstrumentFM::Operator& op=chan[2].state.op[orderedOps[i]];
@ -491,6 +532,7 @@ void DivPlatformYM2203Ext::tick(bool sysTick) {
bool writeNoteOn=false;
unsigned char writeMask=2;
unsigned char hardResetMask=0;
if (extMode) for (int i=0; i<4; i++) {
if (opChan[i].freqChanged) {
if (parent->song.linearPitch==2) {
@ -517,12 +559,36 @@ void DivPlatformYM2203Ext::tick(bool sysTick) {
writeNoteOn=true;
if (opChan[i].mask) {
writeMask|=1<<(4+i);
if (opChan[i].hardReset) {
hardResetMask|=1<<(4+i);
}
}
if (!opChan[i].hardReset) {
opChan[i].keyOn=false;
}
opChan[i].keyOn=false;
}
}
if (writeNoteOn) {
writeMask^=hardResetMask;
immWrite(0x28,writeMask);
writeMask^=hardResetMask;
// hard reset handling
if (mustHardReset) {
for (unsigned int i=hardResetElapsed; i<hardResetCycles; i++) {
immWrite(0xf0,i&0xff);
}
for (int i=0; i<4; i++) {
if (opChan[i].keyOn && opChan[i].hardReset) {
// restore SL/RR
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[i];
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[i];
immWrite(baseAddr+ADDR_SL_RR,(op.rr&15)|(op.sl<<4));
opChan[i].keyOn=false;
}
}
immWrite(0x28,writeMask);
}
}
}
@ -537,13 +603,17 @@ void DivPlatformYM2203Ext::muteChannel(int ch, bool mute) {
}
isOpMuted[ch-2]=mute;
int ordch=orderedOps[ch-2];
unsigned short baseAddr=chanOffs[2]|opOffs[ordch];
DivInstrumentFM::Operator op=chan[2].state.op[ordch];
if (isOpMuted[ch-2] || !op.enable) {
rWrite(baseAddr+0x40,127);
} else {
rWrite(baseAddr+0x40,127-VOL_SCALE_LOG_BROKEN(127-op.tl,opChan[ch-2].outVol&0x7f,127));
DivPlatformYM2203::muteChannel(extChanOffs,IS_EXTCH_MUTED);
if (extMode) {
int ordch=orderedOps[ch-2];
unsigned short baseAddr=chanOffs[2]|opOffs[ordch];
DivInstrumentFM::Operator op=chan[2].state.op[ordch];
if (isOpMuted[ch-2] || !op.enable) {
rWrite(baseAddr+0x40,127);
} else {
rWrite(baseAddr+0x40,127-VOL_SCALE_LOG_BROKEN(127-op.tl,opChan[ch-2].outVol&0x7f,127));
}
}
}

View file

@ -1153,6 +1153,7 @@ int DivPlatformYM2608::dispatch(DivCommand c) {
}
case DIV_CMD_FM_EXTCH: {
if (extSys) {
if (extMode==(bool)c.value) break;
extMode=c.value;
immWrite(0x27,extMode?0x40:0);
}

View file

@ -141,6 +141,7 @@ int DivPlatformYM2608Ext::dispatch(DivCommand c) {
opChan[ch].insChanged=true;
}
opChan[ch].ins=c.value;
chan[extChanOffs].ins=opChan[ch].ins;
break;
case DIV_CMD_PANNING: {
if (c.value==0 && c.value2==0) {
@ -200,8 +201,15 @@ int DivPlatformYM2608Ext::dispatch(DivCommand c) {
break;
}
case DIV_CMD_FM_EXTCH: {
if (extMode==(bool)c.value) break;
extMode=c.value;
immWrite(0x27,extMode?0x40:0);
if (!extMode) {
for (int i=0; i<4; i++) {
opChan[i].insChanged=true;
}
chan[extChanOffs].insChanged=true;
}
break;
}
case DIV_CMD_FM_LFO: {
@ -378,6 +386,9 @@ int DivPlatformYM2608Ext::dispatch(DivCommand c) {
}
break;
}
case DIV_CMD_FM_HARD_RESET:
opChan[ch].hardReset=c.value;
break;
case DIV_CMD_GET_VOLMAX:
return 127;
break;
@ -408,6 +419,9 @@ static int opChanOffsH[4]={
};
void DivPlatformYM2608Ext::tick(bool sysTick) {
int hardResetElapsed=0;
bool mustHardReset=false;
if (extMode) {
bool writeSomething=false;
unsigned char writeMask=2;
@ -418,6 +432,12 @@ void DivPlatformYM2608Ext::tick(bool sysTick) {
writeMask&=~(1<<(4+i));
opChan[i].keyOff=false;
}
if (opChan[i].hardReset && opChan[i].keyOn) {
mustHardReset=true;
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[i];
immWrite(baseAddr+ADDR_SL_RR,0x0f);
hardResetElapsed++;
}
}
if (writeSomething) {
immWrite(0x28,writeMask);
@ -455,6 +475,40 @@ void DivPlatformYM2608Ext::tick(bool sysTick) {
opChan[i].freqChanged=true;
}
// channel macros
if (opChan[i].std.alg.had) {
chan[extChanOffs].state.alg=opChan[i].std.alg.val;
rWrite(chanOffs[extChanOffs]+ADDR_FB_ALG,(chan[extChanOffs].state.alg&7)|(chan[extChanOffs].state.fb<<3));
if (!parent->song.algMacroBehavior) for (int j=0; j<4; j++) {
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[j];
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[j];
if (isOpMuted[j] || !op.enable) {
rWrite(baseAddr+0x40,127);
} else {
rWrite(baseAddr+0x40,127-VOL_SCALE_LOG_BROKEN(127-op.tl,opChan[j].outVol&0x7f,127));
}
}
}
if (i==0 || fbAllOps) {
if (opChan[i].std.fb.had) {
chan[extChanOffs].state.fb=opChan[i].std.fb.val;
rWrite(chanOffs[extChanOffs]+ADDR_FB_ALG,(chan[extChanOffs].state.alg&7)|(chan[extChanOffs].state.fb<<3));
}
}
if (opChan[i].std.fms.had) {
chan[extChanOffs].state.fms=opChan[i].std.fms.val;
rWrite(chanOffs[extChanOffs]+ADDR_LRAF,(IS_EXTCH_MUTED?0:(opChan[i].pan<<6))|(chan[extChanOffs].state.fms&7)|((chan[extChanOffs].state.ams&3)<<4));
}
if (opChan[i].std.ams.had) {
chan[extChanOffs].state.ams=opChan[i].std.ams.val;
rWrite(chanOffs[extChanOffs]+ADDR_LRAF,(IS_EXTCH_MUTED?0:(opChan[i].pan<<6))|(chan[extChanOffs].state.fms&7)|((chan[extChanOffs].state.ams&3)<<4));
}
if (opChan[i].std.ex3.had) {
lfoValue=(opChan[i].std.ex3.val>7)?0:(8|(opChan[i].std.ex3.val&7));
rWrite(0x22,lfoValue);
}
// param macros
unsigned short baseAddr=chanOffs[2]|opOffs[orderedOps[i]];
DivInstrumentFM::Operator& op=chan[2].state.op[orderedOps[i]];
@ -513,6 +567,7 @@ void DivPlatformYM2608Ext::tick(bool sysTick) {
bool writeNoteOn=false;
unsigned char writeMask=2;
unsigned char hardResetMask=0;
if (extMode) for (int i=0; i<4; i++) {
if (opChan[i].freqChanged) {
if (parent->song.linearPitch==2) {
@ -539,12 +594,36 @@ void DivPlatformYM2608Ext::tick(bool sysTick) {
writeNoteOn=true;
if (opChan[i].mask) {
writeMask|=1<<(4+i);
if (opChan[i].hardReset) {
hardResetMask|=1<<(4+i);
}
}
if (!opChan[i].hardReset) {
opChan[i].keyOn=false;
}
opChan[i].keyOn=false;
}
}
if (writeNoteOn) {
writeMask^=hardResetMask;
immWrite(0x28,writeMask);
writeMask^=hardResetMask;
// hard reset handling
if (mustHardReset) {
for (unsigned int i=hardResetElapsed; i<hardResetCycles; i++) {
immWrite(0xf0,i&0xff);
}
for (int i=0; i<4; i++) {
if (opChan[i].keyOn && opChan[i].hardReset) {
// restore SL/RR
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[i];
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[i];
immWrite(baseAddr+ADDR_SL_RR,(op.rr&15)|(op.sl<<4));
opChan[i].keyOn=false;
}
}
immWrite(0x28,writeMask);
}
}
}
@ -559,16 +638,20 @@ void DivPlatformYM2608Ext::muteChannel(int ch, bool mute) {
}
isOpMuted[ch-2]=mute;
int ordch=orderedOps[ch-2];
unsigned short baseAddr=chanOffs[2]|opOffs[ordch];
DivInstrumentFM::Operator op=chan[2].state.op[ordch];
if (isOpMuted[ch-2] || !op.enable) {
rWrite(baseAddr+0x40,127);
} else {
rWrite(baseAddr+0x40,127-VOL_SCALE_LOG_BROKEN(127-op.tl,opChan[ch-2].outVol&0x7f,127));
}
DivPlatformYM2608::muteChannel(extChanOffs,IS_EXTCH_MUTED);
if (extMode) {
int ordch=orderedOps[ch-2];
unsigned short baseAddr=chanOffs[2]|opOffs[ordch];
DivInstrumentFM::Operator op=chan[2].state.op[ordch];
if (isOpMuted[ch-2] || !op.enable) {
rWrite(baseAddr+0x40,127);
} else {
rWrite(baseAddr+0x40,127-VOL_SCALE_LOG_BROKEN(127-op.tl,opChan[ch-2].outVol&0x7f,127));
}
rWrite(chanOffs[2]+0xb4,(IS_EXTCH_MUTED?0:(opChan[ch-2].pan<<6))|(chan[2].state.fms&7)|((chan[2].state.ams&3)<<4));
rWrite(chanOffs[2]+0xb4,(IS_EXTCH_MUTED?0:(opChan[ch-2].pan<<6))|(chan[2].state.fms&7)|((chan[2].state.ams&3)<<4));
}
}
void DivPlatformYM2608Ext::forceIns() {

View file

@ -1125,6 +1125,7 @@ int DivPlatformYM2610::dispatch(DivCommand c) {
}
case DIV_CMD_FM_EXTCH: {
if (extSys) {
if (extMode==(bool)c.value) break;
extMode=c.value;
immWrite(0x27,extMode?0x40:0);
}

View file

@ -1192,6 +1192,7 @@ int DivPlatformYM2610B::dispatch(DivCommand c) {
}
case DIV_CMD_FM_EXTCH: {
if (extSys) {
if (extMode==(bool)c.value) break;
extMode=c.value;
immWrite(0x27,extMode?0x40:0);
}

View file

@ -137,6 +137,7 @@ int DivPlatformYM2610BExt::dispatch(DivCommand c) {
opChan[ch].insChanged=true;
}
opChan[ch].ins=c.value;
chan[extChanOffs].ins=opChan[ch].ins;
break;
case DIV_CMD_PANNING: {
if (c.value==0 && c.value2==0) {
@ -196,8 +197,15 @@ int DivPlatformYM2610BExt::dispatch(DivCommand c) {
break;
}
case DIV_CMD_FM_EXTCH: {
if (extMode==(bool)c.value) break;
extMode=c.value;
immWrite(0x27,extMode?0x40:0);
if (!extMode) {
for (int i=0; i<4; i++) {
opChan[i].insChanged=true;
}
chan[extChanOffs].insChanged=true;
}
break;
}
case DIV_CMD_FM_LFO: {
@ -374,6 +382,9 @@ int DivPlatformYM2610BExt::dispatch(DivCommand c) {
}
break;
}
case DIV_CMD_FM_HARD_RESET:
opChan[ch].hardReset=c.value;
break;
case DIV_CMD_GET_VOLMAX:
return 127;
break;
@ -404,6 +415,9 @@ static int opChanOffsH[4]={
};
void DivPlatformYM2610BExt::tick(bool sysTick) {
int hardResetElapsed=0;
bool mustHardReset=false;
if (extMode) {
bool writeSomething=false;
unsigned char writeMask=2;
@ -414,6 +428,12 @@ void DivPlatformYM2610BExt::tick(bool sysTick) {
writeMask&=~(1<<(4+i));
opChan[i].keyOff=false;
}
if (opChan[i].hardReset && opChan[i].keyOn) {
mustHardReset=true;
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[i];
immWrite(baseAddr+ADDR_SL_RR,0x0f);
hardResetElapsed++;
}
}
if (writeSomething) {
immWrite(0x28,writeMask);
@ -451,6 +471,39 @@ void DivPlatformYM2610BExt::tick(bool sysTick) {
opChan[i].freqChanged=true;
}
// channel macros
if (opChan[i].std.alg.had) {
chan[extChanOffs].state.alg=opChan[i].std.alg.val;
rWrite(chanOffs[extChanOffs]+ADDR_FB_ALG,(chan[extChanOffs].state.alg&7)|(chan[extChanOffs].state.fb<<3));
if (!parent->song.algMacroBehavior) for (int j=0; j<4; j++) {
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[j];
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[j];
if (isOpMuted[j] || !op.enable) {
rWrite(baseAddr+0x40,127);
} else {
rWrite(baseAddr+0x40,127-VOL_SCALE_LOG_BROKEN(127-op.tl,opChan[j].outVol&0x7f,127));
}
}
}
if (i==0 || fbAllOps) {
if (opChan[i].std.fb.had) {
chan[extChanOffs].state.fb=opChan[i].std.fb.val;
rWrite(chanOffs[extChanOffs]+ADDR_FB_ALG,(chan[extChanOffs].state.alg&7)|(chan[extChanOffs].state.fb<<3));
}
}
if (opChan[i].std.fms.had) {
chan[extChanOffs].state.fms=opChan[i].std.fms.val;
rWrite(chanOffs[extChanOffs]+ADDR_LRAF,(IS_EXTCH_MUTED?0:(opChan[i].pan<<6))|(chan[extChanOffs].state.fms&7)|((chan[extChanOffs].state.ams&3)<<4));
}
if (opChan[i].std.ams.had) {
chan[extChanOffs].state.ams=opChan[i].std.ams.val;
rWrite(chanOffs[extChanOffs]+ADDR_LRAF,(IS_EXTCH_MUTED?0:(opChan[i].pan<<6))|(chan[extChanOffs].state.fms&7)|((chan[extChanOffs].state.ams&3)<<4));
}
if (opChan[i].std.ex3.had) {
lfoValue=(opChan[i].std.ex3.val>7)?0:(8|(opChan[i].std.ex3.val&7));
rWrite(0x22,lfoValue);
}
// param macros
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[orderedOps[i]];
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[orderedOps[i]];
@ -509,6 +562,7 @@ void DivPlatformYM2610BExt::tick(bool sysTick) {
bool writeNoteOn=false;
unsigned char writeMask=2;
unsigned char hardResetMask=0;
if (extMode) for (int i=0; i<4; i++) {
if (opChan[i].freqChanged) {
if (parent->song.linearPitch==2) {
@ -535,12 +589,36 @@ void DivPlatformYM2610BExt::tick(bool sysTick) {
writeNoteOn=true;
if (opChan[i].mask) {
writeMask|=1<<(4+i);
if (opChan[i].hardReset) {
hardResetMask|=1<<(4+i);
}
}
if (!opChan[i].hardReset) {
opChan[i].keyOn=false;
}
opChan[i].keyOn=false;
}
}
if (writeNoteOn) {
writeMask^=hardResetMask;
immWrite(0x28,writeMask);
writeMask^=hardResetMask;
// hard reset handling
if (mustHardReset) {
for (unsigned int i=hardResetElapsed; i<hardResetCycles; i++) {
immWrite(0xf0,i&0xff);
}
for (int i=0; i<4; i++) {
if (opChan[i].keyOn && opChan[i].hardReset) {
// restore SL/RR
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[i];
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[i];
immWrite(baseAddr+ADDR_SL_RR,(op.rr&15)|(op.sl<<4));
opChan[i].keyOn=false;
}
}
immWrite(0x28,writeMask);
}
}
}
@ -555,16 +633,20 @@ void DivPlatformYM2610BExt::muteChannel(int ch, bool mute) {
}
isOpMuted[ch-extChanOffs]=mute;
int ordch=orderedOps[ch-extChanOffs];
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[ordch];
DivInstrumentFM::Operator op=chan[extChanOffs].state.op[ordch];
if (isOpMuted[ch-extChanOffs] || !op.enable) {
rWrite(baseAddr+0x40,127);
} else {
rWrite(baseAddr+0x40,127-VOL_SCALE_LOG_BROKEN(127-op.tl,opChan[ch-extChanOffs].outVol&0x7f,127));
}
DivPlatformYM2610B::muteChannel(extChanOffs,IS_EXTCH_MUTED);
if (extMode) {
int ordch=orderedOps[ch-extChanOffs];
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[ordch];
DivInstrumentFM::Operator op=chan[extChanOffs].state.op[ordch];
if (isOpMuted[ch-extChanOffs] || !op.enable) {
rWrite(baseAddr+0x40,127);
} else {
rWrite(baseAddr+0x40,127-VOL_SCALE_LOG_BROKEN(127-op.tl,opChan[ch-extChanOffs].outVol&0x7f,127));
}
rWrite(chanOffs[extChanOffs]+0xb4,(IS_EXTCH_MUTED?0:(opChan[ch-extChanOffs].pan<<6))|(chan[extChanOffs].state.fms&7)|((chan[extChanOffs].state.ams&3)<<4));
rWrite(chanOffs[extChanOffs]+0xb4,(IS_EXTCH_MUTED?0:(opChan[ch-extChanOffs].pan<<6))|(chan[extChanOffs].state.fms&7)|((chan[extChanOffs].state.ams&3)<<4));
}
}
void DivPlatformYM2610BExt::forceIns() {

View file

@ -137,6 +137,7 @@ int DivPlatformYM2610Ext::dispatch(DivCommand c) {
opChan[ch].insChanged=true;
}
opChan[ch].ins=c.value;
chan[extChanOffs].ins=opChan[ch].ins;
break;
case DIV_CMD_PANNING: {
if (c.value==0 && c.value2==0) {
@ -196,8 +197,15 @@ int DivPlatformYM2610Ext::dispatch(DivCommand c) {
break;
}
case DIV_CMD_FM_EXTCH: {
if (extMode==(bool)c.value) break;
extMode=c.value;
immWrite(0x27,extMode?0x40:0);
if (!extMode) {
for (int i=0; i<4; i++) {
opChan[i].insChanged=true;
}
chan[extChanOffs].insChanged=true;
}
break;
}
case DIV_CMD_FM_LFO: {
@ -374,6 +382,9 @@ int DivPlatformYM2610Ext::dispatch(DivCommand c) {
}
break;
}
case DIV_CMD_FM_HARD_RESET:
opChan[ch].hardReset=c.value;
break;
case DIV_CMD_GET_VOLMAX:
return 127;
break;
@ -404,6 +415,9 @@ static int opChanOffsH[4]={
};
void DivPlatformYM2610Ext::tick(bool sysTick) {
int hardResetElapsed=0;
bool mustHardReset=false;
if (extMode) {
bool writeSomething=false;
unsigned char writeMask=2;
@ -414,6 +428,12 @@ void DivPlatformYM2610Ext::tick(bool sysTick) {
writeMask&=~(1<<(4+i));
opChan[i].keyOff=false;
}
if (opChan[i].hardReset && opChan[i].keyOn) {
mustHardReset=true;
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[i];
immWrite(baseAddr+ADDR_SL_RR,0x0f);
hardResetElapsed++;
}
}
if (writeSomething) {
immWrite(0x28,writeMask);
@ -451,6 +471,39 @@ void DivPlatformYM2610Ext::tick(bool sysTick) {
opChan[i].freqChanged=true;
}
// channel macros
if (opChan[i].std.alg.had) {
chan[extChanOffs].state.alg=opChan[i].std.alg.val;
rWrite(chanOffs[extChanOffs]+ADDR_FB_ALG,(chan[extChanOffs].state.alg&7)|(chan[extChanOffs].state.fb<<3));
if (!parent->song.algMacroBehavior) for (int j=0; j<4; j++) {
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[j];
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[j];
if (isOpMuted[j] || !op.enable) {
rWrite(baseAddr+0x40,127);
} else {
rWrite(baseAddr+0x40,127-VOL_SCALE_LOG_BROKEN(127-op.tl,opChan[j].outVol&0x7f,127));
}
}
}
if (i==0 || fbAllOps) {
if (opChan[i].std.fb.had) {
chan[extChanOffs].state.fb=opChan[i].std.fb.val;
rWrite(chanOffs[extChanOffs]+ADDR_FB_ALG,(chan[extChanOffs].state.alg&7)|(chan[extChanOffs].state.fb<<3));
}
}
if (opChan[i].std.fms.had) {
chan[extChanOffs].state.fms=opChan[i].std.fms.val;
rWrite(chanOffs[extChanOffs]+ADDR_LRAF,(IS_EXTCH_MUTED?0:(opChan[i].pan<<6))|(chan[extChanOffs].state.fms&7)|((chan[extChanOffs].state.ams&3)<<4));
}
if (opChan[i].std.ams.had) {
chan[extChanOffs].state.ams=opChan[i].std.ams.val;
rWrite(chanOffs[extChanOffs]+ADDR_LRAF,(IS_EXTCH_MUTED?0:(opChan[i].pan<<6))|(chan[extChanOffs].state.fms&7)|((chan[extChanOffs].state.ams&3)<<4));
}
if (opChan[i].std.ex3.had) {
lfoValue=(opChan[i].std.ex3.val>7)?0:(8|(opChan[i].std.ex3.val&7));
rWrite(0x22,lfoValue);
}
// param macros
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[orderedOps[i]];
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[orderedOps[i]];
@ -509,6 +562,7 @@ void DivPlatformYM2610Ext::tick(bool sysTick) {
bool writeNoteOn=false;
unsigned char writeMask=2;
unsigned char hardResetMask=0;
if (extMode) for (int i=0; i<4; i++) {
if (opChan[i].freqChanged) {
if (parent->song.linearPitch==2) {
@ -535,12 +589,36 @@ void DivPlatformYM2610Ext::tick(bool sysTick) {
writeNoteOn=true;
if (opChan[i].mask) {
writeMask|=1<<(4+i);
if (opChan[i].hardReset) {
hardResetMask|=1<<(4+i);
}
}
if (!opChan[i].hardReset) {
opChan[i].keyOn=false;
}
opChan[i].keyOn=false;
}
}
if (writeNoteOn) {
writeMask^=hardResetMask;
immWrite(0x28,writeMask);
writeMask^=hardResetMask;
// hard reset handling
if (mustHardReset) {
for (unsigned int i=hardResetElapsed; i<hardResetCycles; i++) {
immWrite(0xf0,i&0xff);
}
for (int i=0; i<4; i++) {
if (opChan[i].keyOn && opChan[i].hardReset) {
// restore SL/RR
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[i];
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[i];
immWrite(baseAddr+ADDR_SL_RR,(op.rr&15)|(op.sl<<4));
opChan[i].keyOn=false;
}
}
immWrite(0x28,writeMask);
}
}
}
@ -555,16 +633,20 @@ void DivPlatformYM2610Ext::muteChannel(int ch, bool mute) {
}
isOpMuted[ch-extChanOffs]=mute;
int ordch=orderedOps[ch-extChanOffs];
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[ordch];
DivInstrumentFM::Operator op=chan[extChanOffs].state.op[ordch];
if (isOpMuted[ch-extChanOffs] || !op.enable) {
rWrite(baseAddr+0x40,127);
} else {
rWrite(baseAddr+0x40,127-VOL_SCALE_LOG_BROKEN(127-op.tl,opChan[ch-extChanOffs].outVol&0x7f,127));
}
DivPlatformYM2610::muteChannel(extChanOffs,IS_EXTCH_MUTED);
if (extMode) {
int ordch=orderedOps[ch-extChanOffs];
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[ordch];
DivInstrumentFM::Operator op=chan[extChanOffs].state.op[ordch];
if (isOpMuted[ch-extChanOffs] || !op.enable) {
rWrite(baseAddr+0x40,127);
} else {
rWrite(baseAddr+0x40,127-VOL_SCALE_LOG_BROKEN(127-op.tl,opChan[ch-extChanOffs].outVol&0x7f,127));
}
rWrite(chanOffs[extChanOffs]+0xb4,(IS_EXTCH_MUTED?0:(opChan[ch-extChanOffs].pan<<6))|(chan[extChanOffs].state.fms&7)|((chan[extChanOffs].state.ams&3)<<4));
rWrite(chanOffs[extChanOffs]+0xb4,(IS_EXTCH_MUTED?0:(opChan[ch-extChanOffs].pan<<6))|(chan[extChanOffs].state.fms&7)|((chan[extChanOffs].state.ams&3)<<4));
}
}
void DivPlatformYM2610Ext::forceIns() {

View file

@ -1307,7 +1307,7 @@ bool DivEngine::nextTick(bool noAccum, bool inhibitLowLat) {
} else {
DivMacroInt* macroInt=disCont[dispatchOfChan[note.channel]].dispatch->getChanMacroInt(dispatchChanOfChan[note.channel]);
if (macroInt!=NULL) {
if (macroInt->hasRelease) {
if (macroInt->hasRelease && !disCont[dispatchOfChan[note.channel]].dispatch->isVolGlobal()) {
dispatchCmd(DivCommand(DIV_CMD_NOTE_OFF_ENV,note.channel));
} else {
dispatchCmd(DivCommand(DIV_CMD_NOTE_OFF,note.channel));
@ -1967,8 +1967,8 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi
if (cycles<=0) {
// we have to tick
if (nextTick()) {
totalTicks=0;
totalSeconds=0;
/*totalTicks=0;
totalSeconds=0;*/
lastLoopPos=size-(runLeftG>>MASTER_CLOCK_PREC);
logD("last loop pos: %d for a size of %d and runLeftG of %d",lastLoopPos,size,runLeftG);
totalLoops++;

View file

@ -207,7 +207,7 @@ DivDataErrors DivSample::readSampleData(SafeReader& reader, short version) {
// render data
if (depth!=DIV_SAMPLE_DEPTH_8BIT && depth!=DIV_SAMPLE_DEPTH_16BIT) {
logW("sample depth is wrong! (%d)",depth);
logW("sample depth is wrong! (%d)",(int)depth);
depth=DIV_SAMPLE_DEPTH_16BIT;
}
samples=(double)samples/samplePitchesSD[pitch];
@ -269,6 +269,9 @@ int DivSample::getSampleOffset(int offset, int length, DivSampleDepth depth) {
case DIV_SAMPLE_DEPTH_VOX:
off=(offset+1)/2;
break;
case DIV_SAMPLE_DEPTH_MULAW:
off=offset;
break;
case DIV_SAMPLE_DEPTH_16BIT:
off=offset*2;
break;
@ -316,6 +319,10 @@ int DivSample::getSampleOffset(int offset, int length, DivSampleDepth depth) {
off=(offset+1)/2;
len=(length+1)/2;
break;
case DIV_SAMPLE_DEPTH_MULAW:
off=offset;
len=length;
break;
case DIV_SAMPLE_DEPTH_16BIT:
off=offset*2;
len=length*2;
@ -365,6 +372,9 @@ int DivSample::getEndPosition(DivSampleDepth depth) {
case DIV_SAMPLE_DEPTH_VOX:
off=lengthVOX;
break;
case DIV_SAMPLE_DEPTH_MULAW:
off=lengthMuLaw;
break;
case DIV_SAMPLE_DEPTH_16BIT:
off=length16;
break;
@ -480,6 +490,7 @@ bool DivSample::saveRaw(const char* path) {
// 16-bit memory is padded to 512, to make things easier for ADPCM-A/B.
bool DivSample::initInternal(DivSampleDepth d, int count) {
logV("initInternal(%d,%d)",(int)d,count);
switch (d) {
case DIV_SAMPLE_DEPTH_1BIT: // 1-bit
if (data1!=NULL) delete[] data1;
@ -489,7 +500,7 @@ bool DivSample::initInternal(DivSampleDepth d, int count) {
break;
case DIV_SAMPLE_DEPTH_1BIT_DPCM: // DPCM
if (dataDPCM!=NULL) delete[] dataDPCM;
lengthDPCM=1+((((count+7)/8)+15)&(~15));
lengthDPCM=1+((((count-1)/8)+15)&(~15));
dataDPCM=new unsigned char[lengthDPCM];
memset(dataDPCM,0xaa,lengthDPCM);
break;
@ -537,6 +548,12 @@ bool DivSample::initInternal(DivSampleDepth d, int count) {
dataVOX=new unsigned char[lengthVOX];
memset(dataVOX,0,lengthVOX);
break;
case DIV_SAMPLE_DEPTH_MULAW: // 8-bit µ-law
if (dataMuLaw!=NULL) delete[] dataMuLaw;
lengthMuLaw=count;
dataMuLaw=new unsigned char[(count+4095)&(~0xfff)];
memset(dataMuLaw,0,(count+4095)&(~0xfff));
break;
case DIV_SAMPLE_DEPTH_16BIT: // 16-bit
if (data16!=NULL) delete[] data16;
length16=count*2;
@ -748,7 +765,11 @@ void DivSample::convert(DivSampleDepth newDepth) {
setSampleCount((samples+7)&(~7));
break;
case DIV_SAMPLE_DEPTH_1BIT_DPCM:
setSampleCount((1+((((samples+7)/8)+15)&(~15)))<<3);
if (samples) {
setSampleCount((1+((((samples-1)/8)+15)&(~15)))<<3);
} else {
setSampleCount(8);
}
break;
case DIV_SAMPLE_DEPTH_YMZ_ADPCM:
setSampleCount(((lengthZ+3)&(~0x03))*2);
@ -1107,6 +1128,11 @@ bool DivSample::resample(double sRate, double tRate, int filter) {
#define NOT_IN_FORMAT(x) (depth!=x && formatMask&(1U<<(unsigned int)x))
union IntFloat {
unsigned int i;
float f;
};
void DivSample::render(unsigned int formatMask) {
// step 1: convert to 16-bit if needed
if (depth!=DIV_SAMPLE_DEPTH_16BIT) {
@ -1150,6 +1176,14 @@ void DivSample::render(unsigned int formatMask) {
case DIV_SAMPLE_DEPTH_VOX: // VOX
oki_decode(dataVOX,data16,samples);
break;
case DIV_SAMPLE_DEPTH_MULAW: // 8-bit µ-law PCM
for (unsigned int i=0; i<samples; i++) {
IntFloat s;
s.i=(dataMuLaw[i]^0xff);
s.i=0x3f800000+(((s.i<<24)&0x80000000)|((s.i&0x7f)<<19));
data16[i]=(short)(s.f*128.0f);
}
break;
default:
return;
}
@ -1168,7 +1202,7 @@ void DivSample::render(unsigned int formatMask) {
if (!initInternal(DIV_SAMPLE_DEPTH_1BIT_DPCM,samples)) return;
int accum=63;
int next=63;
for (unsigned int i=0; i<samples; i++) {
for (unsigned int i=0; (i<samples && (i>>3)<lengthDPCM); i++) {
next=((unsigned short)(data16[i]^0x8000))>>9;
if (next>accum) {
dataDPCM[i>>3]|=1<<(i&7);
@ -1228,6 +1262,17 @@ void DivSample::render(unsigned int formatMask) {
if (!initInternal(DIV_SAMPLE_DEPTH_VOX,samples)) return;
oki_encode(data16,dataVOX,samples);
}
if (NOT_IN_FORMAT(DIV_SAMPLE_DEPTH_MULAW)) { // µ-law
if (!initInternal(DIV_SAMPLE_DEPTH_MULAW,samples)) return;
for (unsigned int i=0; i<samples; i++) {
IntFloat s;
s.f=fabs(data16[i]);
s.f/=128.0f;
s.f+=1.0f;
s.i-=0x3f800000;
dataMuLaw[i]=(((data16[i]<0)?0x80:0)|(s.i&0x03f80000)>>19)^0xff;
}
}
}
void* DivSample::getCurBuf() {
@ -1250,6 +1295,8 @@ void* DivSample::getCurBuf() {
return dataBRR;
case DIV_SAMPLE_DEPTH_VOX:
return dataVOX;
case DIV_SAMPLE_DEPTH_MULAW:
return dataMuLaw;
case DIV_SAMPLE_DEPTH_16BIT:
return data16;
default:
@ -1278,6 +1325,8 @@ unsigned int DivSample::getCurBufLen() {
return lengthBRR;
case DIV_SAMPLE_DEPTH_VOX:
return lengthVOX;
case DIV_SAMPLE_DEPTH_MULAW:
return lengthMuLaw;
case DIV_SAMPLE_DEPTH_16BIT:
return length16;
default:
@ -1387,4 +1436,5 @@ DivSample::~DivSample() {
if (dataB) delete[] dataB;
if (dataBRR) delete[] dataBRR;
if (dataVOX) delete[] dataVOX;
if (dataMuLaw) delete[] dataMuLaw;
}

View file

@ -43,6 +43,7 @@ enum DivSampleDepth: unsigned char {
DIV_SAMPLE_DEPTH_8BIT=8,
DIV_SAMPLE_DEPTH_BRR=9,
DIV_SAMPLE_DEPTH_VOX=10,
DIV_SAMPLE_DEPTH_MULAW=11,
DIV_SAMPLE_DEPTH_16BIT=16,
DIV_SAMPLE_DEPTH_MAX // boundary for sample depth
};
@ -108,6 +109,7 @@ struct DivSample {
// - 8: 8-bit PCM
// - 9: BRR (SNES)
// - 10: VOX ADPCM
// - 11: 8-bit µ-law PCM
// - 16: 16-bit PCM
DivSampleDepth depth;
bool loop, brrEmphasis, dither;
@ -130,8 +132,9 @@ struct DivSample {
unsigned char* dataB; // 6
unsigned char* dataBRR; // 9
unsigned char* dataVOX; // 10
unsigned char* dataMuLaw; // 11
unsigned int length8, length16, length1, lengthDPCM, lengthZ, lengthQSoundA, lengthA, lengthB, lengthBRR, lengthVOX;
unsigned int length8, length16, length1, lengthDPCM, lengthZ, lengthQSoundA, lengthA, lengthB, lengthBRR, lengthVOX, lengthMuLaw;
unsigned int samples;
@ -337,6 +340,7 @@ struct DivSample {
dataB(NULL),
dataBRR(NULL),
dataVOX(NULL),
dataMuLaw(NULL),
length8(0),
length16(0),
length1(0),
@ -347,6 +351,7 @@ struct DivSample {
lengthB(0),
lengthBRR(0),
lengthVOX(0),
lengthMuLaw(0),
samples(0) {
for (int i=0; i<DIV_MAX_CHIPS; i++) {
for (int j=0; j<DIV_MAX_SAMPLE_TYPE; j++) {

View file

@ -129,7 +129,8 @@ enum DivSystem {
DIV_SYSTEM_SM8521,
DIV_SYSTEM_PV1000,
DIV_SYSTEM_K053260,
DIV_SYSTEM_TED
DIV_SYSTEM_TED,
DIV_SYSTEM_C140
};
enum DivEffectType: unsigned short {

View file

@ -451,7 +451,7 @@ void DivEngine::registerSystems() {
EffectHandlerMap fmOPN2EffectHandlerMap(fmEffectHandlerMap);
fmOPN2EffectHandlerMap.insert({
{0x17, {DIV_CMD_SAMPLE_MODE, "17xx: Toggle PCM mode"}},
{0x17, {DIV_CMD_SAMPLE_MODE, "17xx: Toggle PCM mode (LEGACY)"}},
{0xdf, {DIV_CMD_SAMPLE_DIR, "DFxx: Set sample playback direction (0: normal; 1: reverse)"}},
});
@ -681,7 +681,7 @@ void DivEngine::registerSystems() {
{0x11, {DIV_CMD_STD_NOISE_MODE, "11xx: Toggle noise mode"}},
{0x12, {DIV_CMD_PCE_LFO_MODE, "12xx: Setup LFO (0: disabled; 1: 1x depth; 2: 16x depth; 3: 256x depth)"}},
{0x13, {DIV_CMD_PCE_LFO_SPEED, "13xx: Set LFO speed"}},
{0x17, {DIV_CMD_SAMPLE_MODE, "17xx: Toggle PCM mode"}}
{0x17, {DIV_CMD_SAMPLE_MODE, "17xx: Toggle PCM mode (LEGACY)"}}
}
);
@ -939,7 +939,7 @@ void DivEngine::registerSystems() {
{DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_NULL},
{
{0x12, {DIV_CMD_STD_NOISE_MODE, "12xx: Set duty cycle (pulse: 0 to 7)"}},
{0x17, {DIV_CMD_SAMPLE_MODE, "17xx: Toggle PCM mode (pulse channel)"}},
{0x17, {DIV_CMD_SAMPLE_MODE, "17xx: Toggle PCM mode (LEGACY)"}},
}
);
@ -1182,7 +1182,7 @@ void DivEngine::registerSystems() {
{0x11, {DIV_CMD_STD_NOISE_MODE, "11xx: Setup noise mode (0: disabled; 1-8: enabled/tap)"}},
{0x12, {DIV_CMD_WS_SWEEP_TIME, "12xx: Setup sweep period (0: disabled; 1-20: enabled/period)"}},
{0x13, {DIV_CMD_WS_SWEEP_AMOUNT, "13xx: Set sweep amount"}},
{0x17, {DIV_CMD_SAMPLE_MODE, "17xx: Toggle PCM mode"}},
{0x17, {DIV_CMD_SAMPLE_MODE, "17xx: Toggle PCM mode (LEGACY)"}},
}
);
@ -1497,7 +1497,7 @@ void DivEngine::registerSystems() {
{0x10, {DIV_CMD_WAVE, "10xx: Set waveform"}},
{0x11, {DIV_CMD_X1_010_ENVELOPE_SHAPE, "11xx: Set envelope shape"}},
{0x12, {DIV_CMD_X1_010_SAMPLE_BANK_SLOT, "12xx: Set sample bank slot (0 to 7)"}},
{0x17, {DIV_CMD_SAMPLE_MODE, "17xx: Toggle PCM mode"}},
{0x17, {DIV_CMD_SAMPLE_MODE, "17xx: Toggle PCM mode (LEGACY)"}},
},
{
{0x20, {DIV_CMD_SAMPLE_FREQ, "20xx: Set PCM frequency (1 to FF)"}},
@ -1872,6 +1872,17 @@ void DivEngine::registerSystems() {
{}
);
sysDefs[DIV_SYSTEM_C140]=new DivSysDef(
"Namco C140", NULL, 0xce, 0, 24, false, true, 0x161, false, (1U<<DIV_SAMPLE_DEPTH_MULAW)|(1U<<DIV_SAMPLE_DEPTH_8BIT),
"Namco's first PCM chip from 1987.",
{"Channel 1", "Channel 2", "Channel 3", "Channel 4", "Channel 5", "Channel 6", "Channel 7", "Channel 8", "Channel 9", "Channel 10", "Channel 11", "Channel 12", "Channel 13", "Channel 14", "Channel 15", "Channel 16", "Channel 17", "Channel 18", "Channel 19", "Channel 20", "Channel 21", "Channel 22", "Channel 23", "Channel 24"},
{"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24"},
{DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM},
{DIV_INS_C140, DIV_INS_C140, DIV_INS_C140, DIV_INS_C140, DIV_INS_C140, DIV_INS_C140, DIV_INS_C140, DIV_INS_C140, DIV_INS_C140, DIV_INS_C140, DIV_INS_C140, DIV_INS_C140, DIV_INS_C140, DIV_INS_C140, DIV_INS_C140, DIV_INS_C140, DIV_INS_C140, DIV_INS_C140, DIV_INS_C140, DIV_INS_C140, DIV_INS_C140, DIV_INS_C140, DIV_INS_C140, DIV_INS_C140},
{DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA},
{}
);
sysDefs[DIV_SYSTEM_DUMMY]=new DivSysDef(
"Dummy System", NULL, 0xfd, 0, 8, false, true, 0, false, 0,
"this is a system designed for testing purposes.",

View file

@ -583,6 +583,19 @@ void DivEngine::performVGMWrite(SafeWriter* w, DivSystem sys, DivRegWrite& write
w->writeC(0);
}
break;
case DIV_SYSTEM_C140:
for (int i=0; i<24; i++) {
w->writeC(0xd4); // mute
w->writeS(baseAddr2S|(i<<4)|0);
w->writeC(0);
w->writeC(0xd4);
w->writeS(baseAddr2S|(i<<4)|1);
w->writeC(0);
w->writeC(0xd4); // keyoff
w->writeS(baseAddr2S|(i<<4)|5);
w->writeC(0);
}
break;
default:
break;
}
@ -1044,6 +1057,11 @@ void DivEngine::performVGMWrite(SafeWriter* w, DivSystem sys, DivRegWrite& write
w->writeC(baseAddr2|(write.addr&0x3f));
w->writeC(write.val&0xff);
break;
case DIV_SYSTEM_C140:
w->writeC(0xd4);
w->writeS_BE(baseAddr2S|(write.addr&0x1ff));
w->writeC(write.val&0xff);
break;
default:
logW("write not handled!");
break;
@ -1217,6 +1235,7 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool p
DivDispatch* writeMSM6295[2]={NULL,NULL};
DivDispatch* writeGA20[2]={NULL,NULL};
DivDispatch* writeK053260[2]={NULL,NULL};
DivDispatch* writeC140[2]={NULL,NULL};
DivDispatch* writeNES[2]={NULL,NULL};
int writeNESIndex[2]={0,0};
@ -1765,6 +1784,22 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool p
willExport[i]=true;
}
break;
case DIV_SYSTEM_C140:
if (!hasNamco) {
// ?!?!?!
hasNamco=disCont[i].dispatch->rate/2;
CHIP_VOL(40,1.0);
willExport[i]=true;
writeC140[0]=disCont[i].dispatch;
} else if (!(hasNamco&0x40000000)) {
isSecond[i]=true;
CHIP_VOL_SECOND(40,1.0);
willExport[i]=true;
writeC140[1]=disCont[i].dispatch;
hasNamco|=0x40000000;
howManyChips++;
}
break;
default:
break;
}
@ -2163,6 +2198,19 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool p
w->writeI(0);
w->write(writeES5506[i]->getSampleMem(),writeES5506[i]->getSampleMemUsage());
}
if (writeC140[i]!=NULL && writeC140[i]->getSampleMemUsage()>0) {
w->writeC(0x67);
w->writeC(0x66);
w->writeC(0x8d);
unsigned short* mem=(unsigned short*)writeC140[i]->getSampleMem();
size_t memLen=writeC140[i]->getSampleMemUsage()>>1;
w->writeI((memLen+8)|(i*0x80000000));
w->writeI(writeC140[i]->getSampleMemCapacity());
w->writeI(0);
for (size_t i=0; i<memLen; i++) {
w->writeC(mem[i]>>8);
}
}
}
// initialize streams
@ -2514,7 +2562,7 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool p
ws=utf8To16(song.authorJ.c_str());
w->writeWString(ws,false); // japanese author name
w->writeS(0); // date
w->writeWString(L"Furnace Tracker",false); // ripper
w->writeWString(L"Furnace (chiptune tracker)",false); // ripper
w->writeS(0); // notes
int gd3Len=w->tell()-gd3Off-12;

View file

@ -66,6 +66,8 @@ void DivZSM::init(unsigned int rate) {
// Channel masks
ymMask=0;
psgMask=0;
// Optimize writes
optimize=true;
}
int DivZSM::getoffset() {
@ -116,17 +118,18 @@ void DivZSM::writeYM(unsigned char a, unsigned char v) {
}
}
void DivZSM::writeSync(unsigned char a, unsigned char v) {
return syncCache.push_back(DivRegWrite(a,v));
}
void DivZSM::writePSG(unsigned char a, unsigned char v) {
// TODO: suppress writes to PSG voice that is not audible (volume=0)
// ^ Let's leave these alone, ZSMKit has a feature that can benefit
// from silent channels.
if (a>=69) {
logD("ZSM: ignoring VERA PSG write a=%02x v=%02x",a,v);
return;
} else if (a==68) {
// Sync event
numWrites++;
return syncCache.push_back(v);
return writeSync(0x00,v);
} else if (a>=64) {
return writePCM(a-64,v);
}
@ -209,6 +212,10 @@ void DivZSM::setLoopPoint() {
}
}
void DivZSM::setOptimize(bool o) {
optimize=o;
}
SafeWriter* DivZSM::finish() {
tick(0); // flush any pending writes / ticks
flushTicks(); // flush ticks in case there were no writes pending
@ -274,6 +281,11 @@ void DivZSM::flushWrites() {
flushTicks(); // only flush ticks if there are writes pending.
for (unsigned char i=0; i<64; i++) {
if (psgState[psg_NEW][i]==psgState[psg_PREV][i]) continue;
// if optimize=true, suppress writes to PSG voices that are not audible (volume=0 or R+L=0)
// ZSMKit has a feature that can benefit from having silent channels
// updated, so this is something that can be toggled off or on for export
if (optimize && (i&3)!=2 && (psgState[psg_NEW][(i&0x3c)+2]&0x3f)==0) continue; // vol
if (optimize && (i&3)!=2 && (psgState[psg_NEW][(i&0x3c)+2]&0xc0)==0) continue; // R+L
psgState[psg_PREV][i]=psgState[psg_NEW][i];
w->writeC(i);
w->writeC(psgState[psg_NEW][i]);
@ -390,15 +402,18 @@ void DivZSM::flushWrites() {
}
}
n=0;
while (n<(long)syncCache.size()) { // we have one or more sync events to write
int writes=syncCache.size()-n;
w->writeC(ZSM_EXT);
if (writes>ZSM_SYNC_MAX_WRITES) writes=ZSM_SYNC_MAX_WRITES;
w->writeC(ZSM_EXT_SYNC|(writes<<1));
for (; writes>0; writes--) {
w->writeC(0x00); // 0x00 = Arbitrary sync message
w->writeC(syncCache[n++]);
for (DivRegWrite& write: syncCache) {
if (n%ZSM_SYNC_MAX_WRITES==0) {
w->writeC(ZSM_EXT);
if (syncCache.size()-n>ZSM_SYNC_MAX_WRITES) {
w->writeC((unsigned char)(ZSM_EXT_SYNC|(ZSM_SYNC_MAX_WRITES<<1)));
} else {
w->writeC((unsigned char)(ZSM_EXT_SYNC|((syncCache.size()-n)<<1)));
}
}
n++;
w->writeC(write.addr);
w->writeC(write.val);
}
syncCache.clear();
numWrites=0;

View file

@ -63,13 +63,14 @@ class DivZSM {
std::vector<unsigned char> pcmData;
std::vector<unsigned char> pcmCache;
std::vector<S_pcmInst> pcmInsts;
std::vector<unsigned char> syncCache;
std::vector<DivRegWrite> syncCache;
int loopOffset;
int numWrites;
int ticks;
int tickRate;
int ymMask;
int psgMask;
bool optimize;
public:
DivZSM();
~DivZSM();
@ -78,6 +79,8 @@ class DivZSM {
void writeYM(unsigned char a, unsigned char v);
void writePSG(unsigned char a, unsigned char v);
void writePCM(unsigned char a, unsigned char v);
void writeSync(unsigned char a, unsigned char v);
void setOptimize(bool o);
void tick(int numticks = 1);
void setLoopPoint();
SafeWriter* finish();

View file

@ -26,7 +26,7 @@
constexpr int MASTER_CLOCK_PREC=(sizeof(void*)==8)?8:0;
constexpr int MASTER_CLOCK_MASK=(sizeof(void*)==8)?0xff:0;
SafeWriter* DivEngine::saveZSM(unsigned int zsmrate, bool loop) {
SafeWriter* DivEngine::saveZSM(unsigned int zsmrate, bool loop, bool optimize) {
int VERA=-1;
int YM=-1;
int IGNORED=0;
@ -52,7 +52,7 @@ SafeWriter* DivEngine::saveZSM(unsigned int zsmrate, bool loop) {
break;
default:
IGNORED++;
logD("Ignoring chip %d systemID %d",i,song.system[i]);
logD("Ignoring chip %d systemID %d",i,(int)song.system[i]);
break;
}
}
@ -94,6 +94,7 @@ SafeWriter* DivEngine::saveZSM(unsigned int zsmrate, bool loop) {
playSub(false);
//size_t tickCount=0;
bool done=false;
bool loopNow=false;
int loopPos=-1;
int fracWait=0; // accumulates fractional ticks
if (VERA>=0) disCont[VERA].dispatch->toggleRegisterDump(true);
@ -106,12 +107,34 @@ SafeWriter* DivEngine::saveZSM(unsigned int zsmrate, bool loop) {
// TODO: incorporate the Furnace meta-command for init data and filter
// out writes to otherwise-unused channels.
}
// Indicate the song's tuning as a sync meta-event
// specified in terms of how many 1/256th semitones
// the song is offset from standard A-440 tuning.
// This is mainly to benefit visualizations in players
// for non-standard tunings so that they can avoid
// displaying the entire song held in pitch bend.
// Tunings offsets that exceed a half semitone
// will simply be represented in a different key
// by nature of overflowing the signed char value
signed char tuningoffset=(signed char)(round(3072*(log(song.tuning/440.0)/log(2))))&0xff;
zsm.writeSync(0x01,tuningoffset);
// Set optimize flag, which mainly buffers PSG writes
// whenever the channel is silent
zsm.setOptimize(optimize);
while (!done) {
if (loopPos==-1) {
if (loopOrder==curOrder && loopRow==curRow && ticks==1 && loop) {
loopPos=zsm.getoffset();
zsm.setLoopPoint();
if (loopOrder==curOrder && loopRow==curRow && loop)
loopNow=true;
if (loopNow) {
// If Virtual Tempo is in use, our exact loop point
// might be skipped due to quantization error.
// If this happens, the tick immediately following is our loop point.
if (ticks==1 || !(loopOrder==curOrder && loopRow==curRow)) {
loopPos=zsm.getoffset();
zsm.setLoopPoint();
loopNow=false;
}
}
}
if (nextTick() || !playing) {

View file

@ -84,7 +84,7 @@ const char* aboutLine[]={
"djtuBIG-MaliceX",
"dumbut",
"Eknous-P",
"ElectricKeet",
"Electric Keet",
"EpicTyphlosion",
"FΛDE",
"Forte",
@ -121,6 +121,7 @@ const char* aboutLine[]={
"SwapXFO",
"TakuikaNinja",
"TCORPStudios",
"Teuthida",
"The Blender Fiddler",
"TheDuccinator",
"theloredev",
@ -137,6 +138,7 @@ const char* aboutLine[]={
"ZoomTen (Zumi)",
"",
"-- additional feedback/fixes --",
"Electric Keet",
"fd",
"GENATARi",
"host12prog",
@ -190,12 +192,10 @@ const char* aboutLine[]={
"mzpokeysnd POKEY emulator by Michael Borisov",
"ASAP POKEY emulator by Piotr Fusik",
"ported by laoo to C++",
"K005289 emulator by cam900",
"Namco 163 emulator by cam900",
"Seta X1-010 emulator by cam900",
"Konami VRC6 emulator by cam900",
"Konami SCC emulator by cam900",
"MSM6295 emulator by cam900",
"vgsound_emu (second version, modified version) by cam900",
"SM8521 emulator (modified version) by cam900",
"D65010G031 emulator (modified version) by cam900",
"Namco C140 (modified version) emulator by cam900",
"",
"greetings to:",
"NEOART Costa Rica",

View file

@ -41,6 +41,13 @@ const char* chanOscRefs[]={
"Note Trigger"
};
const char* autoColsTypes[]={
"Off",
"Mode 1",
"Mode 2",
"Mode 3"
};
float FurnaceGUI::computeGradPos(int type, int chan) {
switch (type) {
case GUI_OSCREF_NONE:
@ -124,6 +131,7 @@ void FurnaceGUI::drawChanOsc() {
if (ImGui::BeginTable("ChanOscSettings",3)) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("Columns");
ImGui::SameLine();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
@ -146,9 +154,24 @@ void FurnaceGUI::drawChanOsc() {
centerSettingReset=true;
}
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("Automatic columns");
ImGui::SameLine();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
const char* previewColType=autoColsTypes[chanOscAutoColsType&3];
if (ImGui::BeginCombo("##AutoCols",previewColType)) {
for (int j=0; j<4; j++) {
const bool isSelected=(chanOscAutoColsType==j);
if (ImGui::Selectable(autoColsTypes[j],isSelected)) chanOscAutoColsType=j;
if (isSelected) ImGui::SetItemDefaultFocus();
}
ImGui::EndCombo();
}
ImGui::EndTable();
}
ImGui::AlignTextToFramePadding();
ImGui::Text("Amplitude");
ImGui::SameLine();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
@ -241,6 +264,7 @@ void FurnaceGUI::drawChanOsc() {
if (ImGui::ColorPicker4("Color",(float*)&i.color)) {
updateChanOscGradTex=true;
}
ImGui::AlignTextToFramePadding();
ImGui::Text("Distance");
ImGui::SameLine();
float pDist=i.distance*100.0f;
@ -249,6 +273,7 @@ void FurnaceGUI::drawChanOsc() {
updateChanOscGradTex=true;
}
ImGui::AlignTextToFramePadding();
ImGui::Text("Spread");
ImGui::SameLine();
float pSpread=i.spread*100.0f;
@ -293,6 +318,7 @@ void FurnaceGUI::drawChanOsc() {
ImGui::ColorPicker4("Color",(float*)&chanOscColor);
}
ImGui::AlignTextToFramePadding();
ImGui::Text("Text format:");
ImGui::SameLine();
ImGui::InputText("##TextFormat",&chanOscTextFormat);
@ -304,6 +330,7 @@ void FurnaceGUI::drawChanOsc() {
"- %C: channel short name\n"
"- %d: channel number (starting from 0)\n"
"- %D: channel number (starting from 1)\n"
"- %n: channel note\n"
"- %i: instrument name\n"
"- %I: instrument number (decimal)\n"
"- %x: instrument number (hex)\n"
@ -345,6 +372,25 @@ void FurnaceGUI::drawChanOsc() {
oscChans.push_back(i);
}
}
// 0: none
// 1: sqrt(chans)
// 2: sqrt(chans+1)
// 3: sqrt(chans)+1
switch (chanOscAutoColsType) {
case 1:
chanOscCols=sqrt(oscChans.size());
break;
case 2:
chanOscCols=sqrt(oscChans.size()+1);
break;
case 3:
chanOscCols=sqrt(oscChans.size())+1;
break;
}
if (chanOscCols<1) chanOscCols=1;
if (chanOscCols>64) chanOscCols=64;
int rows=(oscBufs.size()+(chanOscCols-1))/chanOscCols;
for (size_t i=0; i<oscBufs.size(); i++) {
@ -539,6 +585,15 @@ void FurnaceGUI::drawChanOsc() {
text+=fmt::sprintf("%.2X",chanState->volume>>8);
break;
}
case 'n': {
DivChannelState* chanState=e->getChanState(ch);
if (chanState==NULL || !(chanState->keyOn)) break;
short tempNote=chanState->note; //all of this conversion is necessary because notes 100-102 are special chars
short noteMod=tempNote%12+12; //also note 0 is a BUG, hence +12 on the note and -1 on the octave
short oct=tempNote/12-1;
text+=fmt::sprintf("%s",noteName(noteMod,oct));
break;
}
case '%':
text+='%';
break;

View file

@ -69,6 +69,7 @@ void FurnaceGUI::drawChannels() {
if (dragItem->IsDataType("FUR_CHAN")) {
if (chanToMove!=i && chanToMove>=0) {
e->swapChannelsP(chanToMove,i);
MARK_MODIFIED;
}
chanToMove=-1;
}

View file

@ -199,6 +199,7 @@ void FurnaceGUI::drawCompatFlags() {
}
if (ImGui::BeginTabItem("Pitch/Playback")) {
ImGui::Text("Pitch linearity:");
ImGui::Indent();
if (ImGui::RadioButton("None",e->song.linearPitch==0)) {
e->song.linearPitch=0;
}
@ -217,6 +218,7 @@ void FurnaceGUI::drawCompatFlags() {
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("like Impulse Tracker");
}
ImGui::Unindent();
if (e->song.linearPitch==2) {
ImGui::SameLine();
@ -228,6 +230,7 @@ void FurnaceGUI::drawCompatFlags() {
}
ImGui::Text("Loop modality:");
ImGui::Indent();
if (ImGui::RadioButton("Reset channels",e->song.loopModality==0)) {
e->song.loopModality=0;
}
@ -246,8 +249,10 @@ void FurnaceGUI::drawCompatFlags() {
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("select to not reset channels on loop.");
}
ImGui::Unindent();
ImGui::Text("Cut/delay effect policy:");
ImGui::Indent();
if (ImGui::RadioButton("Strict",e->song.delayBehavior==0)) {
e->song.delayBehavior=0;
}
@ -266,8 +271,10 @@ void FurnaceGUI::drawCompatFlags() {
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("no checks");
}
ImGui::Unindent();
ImGui::Text("Simultaneous jump (0B+0D) treatment:");
ImGui::Indent();
if (ImGui::RadioButton("Normal",e->song.jumpTreatment==0)) {
e->song.jumpTreatment=0;
}
@ -286,6 +293,7 @@ void FurnaceGUI::drawCompatFlags() {
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("only accept 0Dxx");
}
ImGui::Unindent();
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Other")) {

View file

@ -286,6 +286,10 @@ void FurnaceGUI::insListItem(int i, int dir, int asset) {
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_INSTR_TED]);
name=fmt::sprintf(ICON_FA_BAR_CHART "##_INS%d",i);
break;
case DIV_INS_C140:
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_INSTR_C140]);
name=fmt::sprintf(ICON_FA_VOLUME_UP "##_INS%d",i);
break;
default:
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_INSTR_UNKNOWN]);
name=fmt::sprintf(ICON_FA_QUESTION "##_INS%d",i);
@ -330,9 +334,6 @@ void FurnaceGUI::insListItem(int i, int dir, int asset) {
if (ImGui::MenuItem("save")) {
doAction(GUI_ACTION_INS_LIST_SAVE);
}
if (ImGui::MenuItem("save (legacy .fui)")) {
doAction(GUI_ACTION_INS_LIST_SAVE_OLD);
}
if (ImGui::MenuItem("save (.dmp)")) {
doAction(GUI_ACTION_INS_LIST_SAVE_DMP);
}
@ -410,13 +411,10 @@ void FurnaceGUI::sampleListItem(int i, int dir, int asset) {
lastAssetType=2;
}
if (ImGui::IsItemHovered() && !mobileUI) {
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_TEXT]);
ImGui::SetTooltip("(legacy bank %d: %s)",i/12,sampleNote[i%12]);
if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) {
sampleEditOpen=true;
nextWindow=GUI_WINDOW_SAMPLE_EDIT;
}
ImGui::PopStyleColor();
}
if (sampleListDir || (settings.unifiedDataView && insListDir)) {
DRAG_SOURCE(dir,asset,"FUR_SDIR");

View file

@ -54,6 +54,7 @@
#include "../engine/platform/sm8521.h"
#include "../engine/platform/pv1000.h"
#include "../engine/platform/k053260.h"
#include "../engine/platform/c140.h"
#include "../engine/platform/dummy.h"
#define COMMON_CHIP_DEBUG \
@ -62,7 +63,6 @@
#define FM_CHIP_DEBUG \
COMMON_CHIP_DEBUG; \
ImGui::Text("- lastBusy: %d",ch->lastBusy); \
ImGui::Text("- delay: %d",ch->delay);
#define FM_OPN_CHIP_DEBUG \
@ -167,7 +167,6 @@
ImGui::TextColored(ch->hardReset?colorOn:colorOff,">> hardReset"); \
ImGui::TextColored(ch->opMaskChanged?colorOn:colorOff,">> opMaskChanged"); \
ImGui::TextColored(ch->dacMode?colorOn:colorOff,">> DACMode"); \
ImGui::TextColored(ch->dacReady?colorOn:colorOff,">> DACReady"); \
ImGui::TextColored(ch->dacDirection?colorOn:colorOff,">> DACDirection");
#define GENESIS_OPCHAN_DEBUG \
@ -381,7 +380,6 @@ void putDispatchChip(void* data, int type) {
ImGui::Text("- pcmR: %d",ch->pcmR);
ImGui::Text("- pcmCycles: %d",ch->pcmCycles);
ImGui::Text("- sampleBank: %d",ch->sampleBank);
ImGui::Text("- lastBusy: %d",ch->lastBusy);
COMMON_CHIP_DEBUG_BOOL;
break;
}
@ -389,7 +387,6 @@ void putDispatchChip(void* data, int type) {
DivPlatformAY8910* ch=(DivPlatformAY8910*)data;
ImGui::Text("> AY-3-8910");
COMMON_CHIP_DEBUG;
ImGui::Text("- lastBusy: %d",ch->lastBusy);
ImGui::Text("- sampleBank: %d",ch->sampleBank);
ImGui::Text("- stereoSep: %d",ch->stereoSep);
ImGui::Text("- delay: %d",ch->delay);
@ -550,6 +547,13 @@ void putDispatchChip(void* data, int type) {
COMMON_CHIP_DEBUG_BOOL;
break;
}
case DIV_SYSTEM_C140: {
DivPlatformC140* ch=(DivPlatformC140*)data;
ImGui::Text("> C140");
COMMON_CHIP_DEBUG;
COMMON_CHIP_DEBUG_BOOL;
break;
}
default:
ImGui::Text("Unimplemented chip! Help!");
break;
@ -765,17 +769,6 @@ void putDispatchChan(void* data, int chanNum, int type) {
DivPlatformAY8910::Channel* ch=(DivPlatformAY8910::Channel*)data;
ImGui::Text("> AY-3-8910");
COMMON_CHAN_DEBUG;
ImGui::Text("* psgMode:");
ImGui::Text(" * curr:");
ImGui::Text(" - tone: %d",ch->curPSGMode.tone);
ImGui::Text(" - noise: %d",ch->curPSGMode.noise);
ImGui::Text(" - envelope: %d",ch->curPSGMode.envelope);
ImGui::Text(" - dac: %d",ch->curPSGMode.dac);
ImGui::Text(" * next:");
ImGui::Text(" - tone: %d",ch->nextPSGMode.tone);
ImGui::Text(" - noise: %d",ch->nextPSGMode.noise);
ImGui::Text(" - envelope: %d",ch->nextPSGMode.envelope);
ImGui::Text(" - dac: %d",ch->nextPSGMode.dac);
ImGui::Text("* DAC:");
ImGui::Text(" - sample: %d",ch->dac.sample);
ImGui::Text(" - rate: %d",ch->dac.rate);
@ -793,22 +786,6 @@ void putDispatchChan(void* data, int chanNum, int type) {
ImGui::Text("> AY8930");
COMMON_CHAN_DEBUG;
ImGui::Text("- duty: %d",ch->duty);
ImGui::Text("* envelope:");
ImGui::Text(" - mode: %d",ch->envelope.mode);
ImGui::Text(" - period: %d",ch->envelope.period);
ImGui::Text(" * slide: %d",ch->envelope.slide);
ImGui::Text(" - low: %d",ch->envelope.slideLow);
ImGui::Text("* psgMode:");
ImGui::Text(" * curr:");
ImGui::Text(" - tone: %d",ch->curPSGMode.tone);
ImGui::Text(" - noise: %d",ch->curPSGMode.noise);
ImGui::Text(" - envelope: %d",ch->curPSGMode.envelope);
ImGui::Text(" - dac: %d",ch->curPSGMode.dac);
ImGui::Text(" * next:");
ImGui::Text(" - tone: %d",ch->nextPSGMode.tone);
ImGui::Text(" - noise: %d",ch->nextPSGMode.noise);
ImGui::Text(" - envelope: %d",ch->nextPSGMode.envelope);
ImGui::Text(" - dac: %d",ch->nextPSGMode.dac);
ImGui::Text("* DAC:");
ImGui::Text(" - sample: %d",ch->dac.sample);
ImGui::Text(" - rate: %d",ch->dac.rate);
@ -1097,6 +1074,24 @@ void putDispatchChan(void* data, int chanNum, int type) {
ImGui::TextColored(ch->reverse?colorOn:colorOff,">> Reverse");
break;
}
case DIV_SYSTEM_C140: {
DivPlatformC140::Channel* ch=(DivPlatformC140::Channel*)data;
ImGui::Text("> C140");
COMMON_CHAN_DEBUG;
ImGui::Text("* Sample: %d",ch->sample);
ImGui::Text(" - pos: %d",ch->audPos);
ImGui::Text("- chPanL: %.2x",ch->chPanL);
ImGui::Text("- chPanR: %.2x",ch->chPanR);
ImGui::Text("- chVolL: %.2x",ch->chVolL);
ImGui::Text("- chVolR: %.2x",ch->chVolR);
ImGui::Text("- macroVolMul: %.2x",ch->macroVolMul);
ImGui::Text("- macroPanMul: %.2x",ch->macroPanMul);
COMMON_CHAN_DEBUG_BOOL;
ImGui::TextColored(ch->volChangedL?colorOn:colorOff,">> VolChangedL");
ImGui::TextColored(ch->volChangedR?colorOn:colorOff,">> VolChangedR");
ImGui::TextColored(ch->setPos?colorOn:colorOff,">> SetPos");
break;
}
default:
ImGui::Text("Unimplemented chip! Help!");
break;

View file

@ -486,6 +486,7 @@ void FurnaceGUI::drawDebug() {
pgProgram.clear();
}
ImGui::AlignTextToFramePadding();
ImGui::Text("Address");
ImGui::SameLine();
ImGui::SetNextItemWidth(100.0f*dpiScale);

View file

@ -589,14 +589,34 @@ void FurnaceGUI::doAction(int what) {
case GUI_ACTION_PAT_EXPAND_SONG:
doExpandSong(collapseAmount);
break;
case GUI_ACTION_PAT_LATCH: // TODO
case GUI_ACTION_PAT_LATCH: {
DivPattern* pat=e->curPat[cursor.xCoarse].getPattern(e->curOrders->ord[cursor.xCoarse][curOrder],true);
latchIns=pat->data[cursor.y][2];
latchVol=pat->data[cursor.y][3];
latchEffect=pat->data[cursor.y][4];
latchEffectVal=pat->data[cursor.y][5];
latchTarget=0;
latchNibble=false;
break;
case GUI_ACTION_PAT_SCROLL_MODE: // TODO
break;
case GUI_ACTION_PAT_CLEAR_LATCH: // TODO
}
case GUI_ACTION_PAT_CLEAR_LATCH:
latchIns=-2;
latchVol=-1;
latchEffect=-1;
latchEffectVal=-1;
latchTarget=0;
latchNibble=false;
break;
case GUI_ACTION_INS_LIST_ADD:
if (settings.insTypeMenu) {
makeInsTypeList=e->getPossibleInsTypes();
if (makeInsTypeList.size()>1) {
displayInsTypeList=true;
displayInsTypeListMakeInsSample=-1;
break;
}
}
curIns=e->addInstrument(cursor.xCoarse);
if (curIns==-1) {
showError("too many instruments!");
@ -642,9 +662,6 @@ void FurnaceGUI::doAction(int what) {
case GUI_ACTION_INS_LIST_SAVE:
if (curIns>=0 && curIns<(int)e->song.ins.size()) openFileDialog(GUI_FILE_INS_SAVE);
break;
case GUI_ACTION_INS_LIST_SAVE_OLD:
if (curIns>=0 && curIns<(int)e->song.ins.size()) openFileDialog(GUI_FILE_INS_SAVE_OLD);
break;
case GUI_ACTION_INS_LIST_SAVE_DMP:
if (curIns>=0 && curIns<(int)e->song.ins.size()) openFileDialog(GUI_FILE_INS_SAVE_DMP);
break;
@ -1268,7 +1285,7 @@ void FurnaceGUI::doAction(int what) {
} else if (sample->depth==DIV_SAMPLE_DEPTH_8BIT) {
for (unsigned int i=start; i<end; i++) {
sample->data8[i]=-sample->data8[i];
if (sample->data16[i]==-128) sample->data16[i]=127;
if (sample->data8[i]==-128) sample->data8[i]=127;
}
}
@ -1379,7 +1396,8 @@ void FurnaceGUI::doAction(int what) {
i==DIV_INS_ES5506 ||
i==DIV_INS_K007232 ||
i==DIV_INS_GA20 ||
i==DIV_INS_K053260) {
i==DIV_INS_K053260 ||
i==DIV_INS_C140) {
makeInsTypeList.push_back(i);
}
}

View file

@ -619,6 +619,7 @@ void FurnaceGUI::drawMobileControls() {
"Furnace Amiga emulator is working properly by\n"
"comparing it with real Amiga output."
);
ImGui::AlignTextToFramePadding();
ImGui::Text("Directory");
ImGui::SameLine();
ImGui::InputText("##AVDPath",&workingDirROMExport);
@ -717,6 +718,7 @@ void FurnaceGUI::drawEditControls() {
e->setMetronome(metro);
}
ImGui::AlignTextToFramePadding();
ImGui::Text("Follow");
ImGui::SameLine();
unimportant(ImGui::Checkbox("Orders",&followOrders));
@ -1063,6 +1065,7 @@ void FurnaceGUI::drawEditControls() {
if (ImGui::Begin("Edit Controls",&editControlsOpen,globalWinFlags)) {
ImGui::Columns(2);
ImGui::AlignTextToFramePadding();
ImGui::Text("Octave");
ImGui::SameLine();
float cursor=ImGui::GetCursorPosX();
@ -1078,6 +1081,7 @@ void FurnaceGUI::drawEditControls() {
}
}
ImGui::AlignTextToFramePadding();
ImGui::Text("Step");
ImGui::SameLine();
ImGui::SetCursorPosX(cursor);

View file

@ -68,7 +68,7 @@ void FurnaceGUI::prepareUndo(ActionType action) {
}
break;
case GUI_UNDO_PATTERN_COLLAPSE_SONG:
case GUI_UNDO_PATTERN_EXPAND_SONG: // TODO
case GUI_UNDO_PATTERN_EXPAND_SONG: // this is handled by doCollapseSong/doExpandSong
break;
case GUI_UNDO_REPLACE: // this is handled by doReplace()
break;
@ -134,7 +134,7 @@ void FurnaceGUI::makeUndo(ActionType action) {
}
break;
case GUI_UNDO_PATTERN_COLLAPSE_SONG:
case GUI_UNDO_PATTERN_EXPAND_SONG: // TODO
case GUI_UNDO_PATTERN_EXPAND_SONG: // this is handled by doCollapseSong/doExpandSong
break;
case GUI_UNDO_REPLACE: // this is handled by doReplace()
break;

View file

@ -1,6 +1,7 @@
#include "gui.h"
#include "guiConst.h"
#include <imgui.h>
#include "IconsFontAwesome4.h"
void FurnaceGUI::drawEffectList() {
if (nextWindow==GUI_WINDOW_EFFECT_LIST) {
@ -11,7 +12,28 @@ void FurnaceGUI::drawEffectList() {
if (!effectListOpen) return;
ImGui::SetNextWindowSizeConstraints(ImVec2(60.0f*dpiScale,20.0f*dpiScale),ImVec2(canvasW,canvasH));
if (ImGui::Begin("Effect List",&effectListOpen,globalWinFlags)) {
ImGui::Text("Chip at cursor: %s",e->getSystemName(e->sysOfChan[cursor.xCoarse]));
float availB=ImGui::GetContentRegionAvail().x-ImGui::GetFrameHeightWithSpacing();
if (availB>0) {
ImGui::PushTextWrapPos(availB);
ImGui::TextWrapped("Chip at cursor: %s",e->getSystemName(e->sysOfChan[cursor.xCoarse]));
ImGui::PopTextWrapPos();
ImGui::SameLine();
}
ImGui::Button(ICON_FA_BARS "##SortEffects");
if (ImGui::BeginPopupContextItem("effectSort",ImGuiPopupFlags_MouseButtonLeft)) {
for (int i=0; i<9; i++) {
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[fxColorsSort[i]]);
ImGui::Checkbox(fxColorsNames[i],&effectsShow[i]);
ImGui::PopStyleColor();
}
if (ImGui::Button("All")) memset(effectsShow,1,sizeof(bool)*10);
ImGui::SameLine();
if (ImGui::Button("None")) memset(effectsShow,0,sizeof(bool)*10);
ImGui::EndPopup();
}
if (ImGui::BeginTable("effectList",2)) {
ImGui::TableSetupColumn("c0",ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthStretch);
@ -25,11 +47,58 @@ void FurnaceGUI::drawEffectList() {
const char* prevName=NULL;
for (int i=0; i<256; i++) {
const char* name=e->getEffectDesc(i,cursor.xCoarse);
bool effectShow=true;
if (name==prevName) {
continue;
}
prevName=name;
if (name!=NULL) {
switch (fxColors[i]) {
case GUI_COLOR_PATTERN_EFFECT_MISC:
effectShow=effectsShow[8];
break;
case GUI_COLOR_PATTERN_EFFECT_SONG:
effectShow=effectsShow[1];
break;
case GUI_COLOR_PATTERN_EFFECT_SPEED:
effectShow=effectsShow[3];
break;
case GUI_COLOR_PATTERN_EFFECT_TIME:
effectShow=effectsShow[2];
break;
case GUI_COLOR_PATTERN_EFFECT_PITCH:
effectShow=effectsShow[0];
break;
case GUI_COLOR_PATTERN_EFFECT_PANNING:
effectShow=effectsShow[4];
break;
case GUI_COLOR_PATTERN_EFFECT_VOLUME:
effectShow=effectsShow[5];
break;
case GUI_COLOR_PATTERN_EFFECT_SYS_PRIMARY:
effectShow=effectsShow[6];
break;
case GUI_COLOR_PATTERN_EFFECT_SYS_SECONDARY:
effectShow=effectsShow[7];
break;
default:
effectShow=true;
break;
}
if (fxColors[i]==GUI_COLOR_PATTERN_EFFECT_PANNING) {
DivDispatch* dispatch=e->getDispatch(e->dispatchOfChan[cursor.xCoarse]);
if (dispatch!=NULL) {
int outputs=dispatch->getOutputCount();
if (outputs<2) {
effectShow=false;
}
if (outputs<3) {
if (i>=0x88 && i<=0x8f) {
effectShow=false;
}
}
}
}
if (name!=NULL && effectShow) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::PushFont(patFont);

View file

@ -28,7 +28,6 @@ struct NFDState {
}
};
// TODO: filter
void _nfdThread(const NFDState state, std::atomic<bool>* ok, std::vector<String>* result, bool* errorOutput) {
nfdchar_t* out=NULL;
nfdresult_t ret=NFD_CANCEL;

View file

@ -595,6 +595,7 @@ void FurnaceGUI::drawFindReplace() {
ImGui::TableSetupColumn("c3",ImGuiTableColumnFlags_WidthStretch,0.25);
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("Note");
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
@ -662,6 +663,7 @@ void FurnaceGUI::drawFindReplace() {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("Ins");
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
@ -697,6 +699,7 @@ void FurnaceGUI::drawFindReplace() {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("Volume");
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
@ -734,6 +737,7 @@ void FurnaceGUI::drawFindReplace() {
ImGui::PushID(0x1000+j);
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("Effect");
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
@ -769,6 +773,7 @@ void FurnaceGUI::drawFindReplace() {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("Value");
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);

View file

@ -77,6 +77,14 @@ bool Particle::update(float frameTime) {
return (life>0);
}
void FurnaceGUI::centerNextWindow(const char* name, float w, float h) {
if (ImGui::IsPopupOpen(name)) {
if (settings.centerPopup) {
ImGui::SetNextWindowPos(ImVec2(w*0.5,h*0.5),ImGuiCond_Always,ImVec2(0.5,0.5));
}
}
}
void FurnaceGUI::bindEngine(DivEngine* eng) {
e=eng;
wavePreview.setEngine(e);
@ -1128,18 +1136,22 @@ void FurnaceGUI::stopPreviewNote(SDL_Scancode scancode, bool autoNote) {
void FurnaceGUI::noteInput(int num, int key, int vol) {
DivPattern* pat=e->curPat[cursor.xCoarse].getPattern(e->curOrders->ord[cursor.xCoarse][curOrder],true);
bool removeIns=false;
prepareUndo(GUI_UNDO_PATTERN_EDIT);
if (key==GUI_NOTE_OFF) { // note off
pat->data[cursor.y][0]=100;
pat->data[cursor.y][1]=0;
removeIns=true;
} else if (key==GUI_NOTE_OFF_RELEASE) { // note off + env release
pat->data[cursor.y][0]=101;
pat->data[cursor.y][1]=0;
removeIns=true;
} else if (key==GUI_NOTE_RELEASE) { // env release only
pat->data[cursor.y][0]=102;
pat->data[cursor.y][1]=0;
removeIns=true;
} else {
pat->data[cursor.y][0]=num%12;
pat->data[cursor.y][1]=num/12;
@ -1165,6 +1177,14 @@ void FurnaceGUI::noteInput(int num, int key, int vol) {
if (latchEffect!=-1) pat->data[cursor.y][4]=latchEffect;
if (latchEffectVal!=-1) pat->data[cursor.y][5]=latchEffectVal;
}
if (removeIns) {
if (settings.removeInsOff) {
pat->data[cursor.y][2]=-1;
}
if (settings.removeVolOff) {
pat->data[cursor.y][3]=-1;
}
}
makeUndo(GUI_UNDO_PATTERN_EDIT);
editAdvance();
curNibble=false;
@ -1438,8 +1458,8 @@ void FurnaceGUI::keyDown(SDL_Event& ev) {
e->curOrders->ord[orderCursor][curOrder]=((e->curOrders->ord[orderCursor][curOrder]<<4)|num);
});
MARK_MODIFIED;
curNibble=!curNibble;
if (orderEditMode==2 || orderEditMode==3) {
curNibble=!curNibble;
if (!curNibble) {
if (orderEditMode==2) {
orderCursor++;
@ -1653,16 +1673,6 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
dpiScale
);
break;
case GUI_FILE_INS_SAVE_OLD:
if (!dirExists(workingDirIns)) workingDirIns=getHomeDir();
hasOpened=fileDialog->openSave(
"Save Instrument",
{"Furnace instrument", "*.fui"},
"Furnace instrument{.fui}",
workingDirIns,
dpiScale
);
break;
case GUI_FILE_INS_SAVE_DMP:
if (!dirExists(workingDirIns)) workingDirIns=getHomeDir();
hasOpened=fileDialog->openSave(
@ -1845,6 +1855,16 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
dpiScale
);
break;
case GUI_FILE_LOAD_HEAD_FONT:
if (!dirExists(workingDirFont)) workingDirFont=getHomeDir();
hasOpened=fileDialog->openLoad(
"Select Font",
{"compatible files", "*.ttf *.otf *.ttc"},
"compatible files{.ttf,.otf,.ttc}",
workingDirFont,
dpiScale
);
break;
case GUI_FILE_LOAD_PAT_FONT:
if (!dirExists(workingDirFont)) workingDirFont=getHomeDir();
hasOpened=fileDialog->openLoad(
@ -2100,6 +2120,7 @@ int FurnaceGUI::save(String path, int dmfVersion) {
}
int FurnaceGUI::load(String path) {
bool wasPlaying=e->isPlaying();
if (!path.empty()) {
logI("loading module...");
FILE* f=ps_fopen(path.c_str(),"rb");
@ -2176,6 +2197,12 @@ int FurnaceGUI::load(String path) {
showWarning(e->getWarnings(),GUI_WARN_GENERIC);
}
pushRecentFile(path);
// do not auto-play a backup
if (path.find(backupPath)!=0) {
if (settings.playOnLoad==2 || (settings.playOnLoad==1 && wasPlaying)) {
play();
}
}
return 0;
}
@ -2764,6 +2791,7 @@ void FurnaceGUI::editOptions(bool topMenu) {
if (ImGui::MenuItem("values up (+16)",BIND_FOR(GUI_ACTION_PAT_VALUE_UP_COARSE))) doTranspose(16,opMaskTransposeValue);
if (ImGui::MenuItem("values down (-16)",BIND_FOR(GUI_ACTION_PAT_VALUE_DOWN_COARSE))) doTranspose(-16,opMaskTransposeValue);
ImGui::Separator();
ImGui::AlignTextToFramePadding();
ImGui::Text("transpose");
ImGui::SameLine();
ImGui::SetNextItemWidth(120.0f*dpiScale);
@ -3856,6 +3884,7 @@ bool FurnaceGUI::loop() {
mainFont=ImGui::GetIO().Fonts->AddFontDefault();
patFont=mainFont;
bigFont=mainFont;
headFont=mainFont;
if (rend) rend->destroyFontsTexture();
if (!ImGui::GetIO().Fonts->Build()) {
logE("error again while building font atlas!");
@ -3885,7 +3914,7 @@ bool FurnaceGUI::loop() {
if (!mobileUI) {
ImGui::BeginMainMenuBar();
if (ImGui::BeginMenu("file")) {
if (ImGui::BeginMenu(settings.capitalMenuBar?"File":"file")) {
if (ImGui::MenuItem("new...",BIND_FOR(GUI_ACTION_NEW))) {
if (modified) {
showWarning("Unsaved changes! Save changes before creating a new song?",GUI_WARN_NEW);
@ -3980,6 +4009,7 @@ bool FurnaceGUI::loop() {
ImGui::Checkbox("loop",&vgmExportLoop);
if (vgmExportLoop && e->song.loopModality==2) {
ImGui::Text("loop trail:");
ImGui::Indent();
if (ImGui::RadioButton("auto-detect",vgmExportTrailingTicks==-1)) {
vgmExportTrailingTicks=-1;
}
@ -3995,6 +4025,7 @@ bool FurnaceGUI::loop() {
if (vgmExportTrailingTicks<0) vgmExportTrailingTicks=0;
}
}
ImGui::Unindent();
}
ImGui::Checkbox("add pattern change hints",&vgmExportPatternHints);
if (ImGui::IsItemHovered()) {
@ -4064,6 +4095,8 @@ bool FurnaceGUI::loop() {
}
ImGui::Checkbox("loop",&zsmExportLoop);
ImGui::SameLine();
ImGui::Checkbox("optimize size",&zsmExportOptimize);
ImGui::SameLine();
if (ImGui::Button("Begin Export")) {
openFileDialog(GUI_FILE_EXPORT_ZSM);
ImGui::CloseCurrentPopup();
@ -4083,6 +4116,7 @@ bool FurnaceGUI::loop() {
"Furnace Amiga emulator is working properly by\n"
"comparing it with real Amiga output."
);
ImGui::AlignTextToFramePadding();
ImGui::Text("Directory");
ImGui::SameLine();
ImGui::InputText("##AVDPath",&workingDirROMExport);
@ -4146,7 +4180,7 @@ bool FurnaceGUI::loop() {
exitDisabledTimer=1;
for (int i=0; i<e->song.systemLen; i++) {
if (ImGui::TreeNode(fmt::sprintf("%d. %s##_SYSP%d",i+1,getSystemName(e->song.system[i]),i).c_str())) {
drawSysConf(i,e->song.system[i],e->song.systemFlags[i],true);
drawSysConf(i,e->song.system[i],e->song.systemFlags[i],true,true);
ImGui::TreePop();
}
}
@ -4208,7 +4242,7 @@ bool FurnaceGUI::loop() {
} else {
exitDisabledTimer=0;
}
if (ImGui::BeginMenu("edit")) {
if (ImGui::BeginMenu(settings.capitalMenuBar?"Edit":"edit")) {
ImGui::Text("...");
ImGui::Separator();
if (ImGui::MenuItem("undo",BIND_FOR(GUI_ACTION_UNDO))) doUndo();
@ -4221,7 +4255,7 @@ bool FurnaceGUI::loop() {
}
ImGui::EndMenu();
}
if (ImGui::BeginMenu("settings")) {
if (ImGui::BeginMenu(settings.capitalMenuBar?"Settings":"settings")) {
#ifndef IS_MOBILE
if (ImGui::MenuItem("full screen",BIND_FOR(GUI_ACTION_FULLSCREEN),fullScreen)) {
doAction(GUI_ACTION_FULLSCREEN);
@ -4257,7 +4291,7 @@ bool FurnaceGUI::loop() {
}
ImGui::EndMenu();
}
if (ImGui::BeginMenu("window")) {
if (ImGui::BeginMenu(settings.capitalMenuBar?"Window":"window")) {
if (ImGui::MenuItem("song information",BIND_FOR(GUI_ACTION_WINDOW_SONG_INFO),songInfoOpen)) songInfoOpen=!songInfoOpen;
if (ImGui::MenuItem("subsongs",BIND_FOR(GUI_ACTION_WINDOW_SUBSONGS),subSongsOpen)) subSongsOpen=!subSongsOpen;
if (ImGui::MenuItem("speed",BIND_FOR(GUI_ACTION_WINDOW_SPEED),speedOpen)) speedOpen=!speedOpen;
@ -4299,7 +4333,7 @@ bool FurnaceGUI::loop() {
ImGui::EndMenu();
}
if (ImGui::BeginMenu("help")) {
if (ImGui::BeginMenu(settings.capitalMenuBar?"Help":"help")) {
if (ImGui::MenuItem("effect list",BIND_FOR(GUI_ACTION_WINDOW_EFFECT_LIST),effectListOpen)) effectListOpen=!effectListOpen;
if (ImGui::MenuItem("debug menu",BIND_FOR(GUI_ACTION_WINDOW_DEBUG))) debugOpen=!debugOpen;
if (ImGui::MenuItem("inspector",BIND_FOR(GUI_ACTION_WINDOW_DEBUG))) inspectorOpen=!inspectorOpen;
@ -4395,6 +4429,10 @@ bool FurnaceGUI::loop() {
MEASURE(calcChanOsc,calcChanOsc());
if (followPattern) {
curOrder=e->getOrder();
}
if (mobileUI) {
globalWinFlags=ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoBringToFrontOnFocus;
//globalWinFlags=ImGuiWindowFlags_NoTitleBar;
@ -4473,17 +4511,6 @@ bool FurnaceGUI::loop() {
}
MEASURE(songInfo,drawSongInfo());
MEASURE(orders,drawOrders());
if (introMonOpen) {
int totalTicks=e->getTotalTicks();
int totalSeconds=e->getTotalSeconds();
double newMonitorPos=totalSeconds+((double)totalTicks/1000000.0);
if (fabs(newMonitorPos-monitorPos)>0.08) monitorPos=newMonitorPos;
drawIntro(monitorPos,true);
if (e->isPlaying()) monitorPos+=ImGui::GetIO().DeltaTime;
}
MEASURE(sampleList,drawSampleList());
MEASURE(sampleEdit,drawSampleEdit());
MEASURE(waveList,drawWaveList());
@ -4533,6 +4560,11 @@ bool FurnaceGUI::loop() {
}
}
for (int i=0; i<e->getTotalChannelCount(); i++) {
keyHit1[i]-=0.2f;
if (keyHit1[i]<0.0f) keyHit1[i]=0.0f;
}
activateTutorial(GUI_TUTORIAL_OVERVIEW);
if (inspectorOpen) ImGui::ShowMetricsWindow(&inspectorOpen);
@ -4594,7 +4626,6 @@ bool FurnaceGUI::loop() {
case GUI_FILE_INS_OPEN:
case GUI_FILE_INS_OPEN_REPLACE:
case GUI_FILE_INS_SAVE:
case GUI_FILE_INS_SAVE_OLD:
case GUI_FILE_INS_SAVE_DMP:
workingDirIns=fileDialog->getPath()+DIR_SEPARATOR_STR;
break;
@ -4630,6 +4661,7 @@ bool FurnaceGUI::loop() {
workingDirROMExport=fileDialog->getPath()+DIR_SEPARATOR_STR;
break;
case GUI_FILE_LOAD_MAIN_FONT:
case GUI_FILE_LOAD_HEAD_FONT:
case GUI_FILE_LOAD_PAT_FONT:
workingDirFont=fileDialog->getPath()+DIR_SEPARATOR_STR;
break;
@ -4697,9 +4729,6 @@ bool FurnaceGUI::loop() {
if (curFileDialog==GUI_FILE_INS_SAVE) {
checkExtension(".fui");
}
if (curFileDialog==GUI_FILE_INS_SAVE_OLD) {
checkExtension(".fui");
}
if (curFileDialog==GUI_FILE_INS_SAVE_DMP) {
checkExtension(".dmp");
}
@ -4793,11 +4822,6 @@ bool FurnaceGUI::loop() {
e->song.ins[curIns]->save(copyOfName.c_str(),false,&e->song);
}
break;
case GUI_FILE_INS_SAVE_OLD:
if (curIns>=0 && curIns<(int)e->song.ins.size()) {
e->song.ins[curIns]->save(copyOfName.c_str(),true);
}
break;
case GUI_FILE_INS_SAVE_DMP:
if (curIns>=0 && curIns<(int)e->song.ins.size()) {
if (!e->song.ins[curIns]->saveDMP(copyOfName.c_str())) {
@ -5051,7 +5075,7 @@ bool FurnaceGUI::loop() {
break;
}
case GUI_FILE_EXPORT_ZSM: {
SafeWriter* w=e->saveZSM(zsmExportTickRate,zsmExportLoop);
SafeWriter* w=e->saveZSM(zsmExportTickRate,zsmExportLoop,zsmExportOptimize);
if (w!=NULL) {
FILE* f=ps_fopen(copyOfName.c_str(),"wb");
if (f!=NULL) {
@ -5099,6 +5123,9 @@ bool FurnaceGUI::loop() {
case GUI_FILE_LOAD_MAIN_FONT:
settings.mainFontPath=copyOfName;
break;
case GUI_FILE_LOAD_HEAD_FONT:
settings.headFontPath=copyOfName;
break;
case GUI_FILE_LOAD_PAT_FONT:
settings.patFontPath=copyOfName;
break;
@ -5226,6 +5253,7 @@ bool FurnaceGUI::loop() {
MEASURE_BEGIN(popup);
centerNextWindow("Rendering...",canvasW,canvasH);
if (ImGui::BeginPopupModal("Rendering...",NULL,ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui::Text("Please wait...");
if (ImGui::Button("Abort")) {
@ -5253,6 +5281,7 @@ bool FurnaceGUI::loop() {
ImGui::EndPopup();
}
centerNextWindow("Error",canvasW,canvasH);
if (ImGui::BeginPopupModal("Error",NULL,ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui::Text("%s",errorString.c_str());
if (ImGui::Button("OK")) {
@ -5261,6 +5290,7 @@ bool FurnaceGUI::loop() {
ImGui::EndPopup();
}
centerNextWindow("Warning",canvasW,canvasH);
if (ImGui::BeginPopupModal("Warning",NULL,ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui::Text("%s",warnString.c_str());
switch (warnAction) {
@ -5619,6 +5649,19 @@ bool FurnaceGUI::loop() {
wavePreviewInit=true;
updateFMPreview=true;
}
if (settings.blankIns) {
e->song.ins[curIns]->fm.fb=0;
for (int i=0; i<4; i++) {
e->song.ins[curIns]->fm.op[i]=DivInstrumentFM::Operator();
e->song.ins[curIns]->fm.op[i].ar=31;
e->song.ins[curIns]->fm.op[i].dr=31;
e->song.ins[curIns]->fm.op[i].rr=15;
e->song.ins[curIns]->fm.op[i].tl=127;
e->song.ins[curIns]->fm.op[i].dt=3;
}
}
MARK_MODIFIED;
}
}
@ -5629,11 +5672,13 @@ bool FurnaceGUI::loop() {
// TODO:
// - multiple selection
// - replace instrument
centerNextWindow("Select Instrument",canvasW,canvasH);
if (ImGui::BeginPopupModal("Select Instrument",NULL,ImGuiWindowFlags_AlwaysAutoResize)) {
bool quitPlease=false;
if (pendingInsSingle) {
ImGui::Text("this is an instrument bank! select which one to use:");
} else {
ImGui::AlignTextToFramePadding();
ImGui::Text("this is an instrument bank! select which ones to load:");
ImGui::SameLine();
if (ImGui::Button("All")) {
@ -5706,6 +5751,7 @@ bool FurnaceGUI::loop() {
ImGui::EndPopup();
}
centerNextWindow("Import Raw Sample",canvasW,canvasH);
if (ImGui::BeginPopupModal("Import Raw Sample",NULL,ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui::Text("Data type:");
for (int i=0; i<DIV_SAMPLE_DEPTH_MAX; i++) {
@ -5721,6 +5767,7 @@ bool FurnaceGUI::loop() {
}
ImGui::BeginDisabled(pendingRawSampleDepth!=DIV_SAMPLE_DEPTH_8BIT && pendingRawSampleDepth!=DIV_SAMPLE_DEPTH_16BIT);
ImGui::AlignTextToFramePadding();
ImGui::Text("Channels");
ImGui::SameLine();
if (ImGui::InputInt("##RSChans",&pendingRawSampleChannels)) {
@ -6027,6 +6074,7 @@ bool FurnaceGUI::loop() {
mainFont=ImGui::GetIO().Fonts->AddFontDefault();
patFont=mainFont;
bigFont=mainFont;
headFont=mainFont;
if (rend) rend->destroyFontsTexture();
if (!ImGui::GetIO().Fonts->Build()) {
logE("error again while building font atlas!");
@ -6095,7 +6143,6 @@ bool FurnaceGUI::init() {
clockOpen=e->getConfBool("clockOpen",false);
speedOpen=e->getConfBool("speedOpen",true);
groovesOpen=e->getConfBool("groovesOpen",false);
introMonOpen=e->getConfBool("introMonOpen",false);
regViewOpen=e->getConfBool("regViewOpen",false);
logOpen=e->getConfBool("logOpen",false);
effectListOpen=e->getConfBool("effectListOpen",true);
@ -6154,6 +6201,7 @@ bool FurnaceGUI::init() {
pianoInputPadMode=e->getConfInt("pianoInputPadMode",pianoInputPadMode);
chanOscCols=e->getConfInt("chanOscCols",3);
chanOscAutoColsType=e->getConfInt("chanOscAutoColsType",0);
chanOscColorX=e->getConfInt("chanOscColorX",GUI_OSCREF_CENTER);
chanOscColorY=e->getConfInt("chanOscColorY",GUI_OSCREF_CENTER);
chanOscTextX=e->getConfFloat("chanOscTextX",0.0f);
@ -6482,6 +6530,7 @@ bool FurnaceGUI::init() {
mainFont=ImGui::GetIO().Fonts->AddFontDefault();
patFont=mainFont;
bigFont=mainFont;
headFont=mainFont;
if (rend) rend->destroyFontsTexture();
if (!ImGui::GetIO().Fonts->Build()) {
logE("error again while building font atlas!");
@ -6613,7 +6662,6 @@ void FurnaceGUI::commitState() {
e->setConf("clockOpen",clockOpen);
e->setConf("speedOpen",speedOpen);
e->setConf("groovesOpen",groovesOpen);
e->setConf("introMonOpen",introMonOpen);
e->setConf("regViewOpen",regViewOpen);
e->setConf("logOpen",logOpen);
e->setConf("effectListOpen",effectListOpen);
@ -6672,6 +6720,7 @@ void FurnaceGUI::commitState() {
// commit per-chan osc state
e->setConf("chanOscCols",chanOscCols);
e->setConf("chanOscAutoColsType",chanOscAutoColsType);
e->setConf("chanOscColorX",chanOscColorX);
e->setConf("chanOscColorY",chanOscColorY);
e->setConf("chanOscTextX",chanOscTextX);
@ -6716,6 +6765,13 @@ bool FurnaceGUI::finish() {
SDL_HapticClose(vibrator);
}
for (int i=0; i<DIV_MAX_OUTPUTS; i++) {
if (oscValues[i]) {
delete[] oscValues[i];
oscValues[i]=NULL;
}
}
for (int i=0; i<DIV_MAX_CHANS; i++) {
delete oldPat[i];
}
@ -6751,6 +6807,7 @@ FurnaceGUI::FurnaceGUI():
displayExporting(false),
vgmExportLoop(true),
zsmExportLoop(true),
zsmExportOptimize(true),
vgmExportPatternHints(false),
vgmExportDirectStream(false),
displayInsTypeList(false),
@ -6828,6 +6885,7 @@ FurnaceGUI::FurnaceGUI():
iconFont(NULL),
patFont(NULL),
bigFont(NULL),
headFont(NULL),
fontRange(NULL),
prevInsData(NULL),
curIns(0),
@ -6897,7 +6955,6 @@ FurnaceGUI::FurnaceGUI():
clockOpen(false),
speedOpen(true),
groovesOpen(false),
introMonOpen(false),
basicMode(true),
shortIntro(false),
insListDir(false),
@ -7112,10 +7169,14 @@ FurnaceGUI::FurnaceGUI():
displayInternalPorts(false),
subPortPos(0.0f,0.0f),
oscTotal(0),
oscWidth(512),
oscZoom(0.5f),
oscWindowSize(20.0f),
oscInput(0.0f),
oscInput1(0.0f),
oscZoomSlider(false),
chanOscCols(3),
chanOscAutoColsType(0),
chanOscColorX(GUI_OSCREF_CENTER),
chanOscColorY(GUI_OSCREF_CENTER),
chanOscWindowSize(20.0f),
@ -7226,7 +7287,7 @@ FurnaceGUI::FurnaceGUI():
memset(patChanX,0,sizeof(float)*(DIV_MAX_CHANS+1));
memset(patChanSlideY,0,sizeof(float)*(DIV_MAX_CHANS+1));
memset(lastIns,-1,sizeof(int)*DIV_MAX_CHANS);
memset(oscValues,0,sizeof(float)*512);
memset(oscValues,0,sizeof(void*)*DIV_MAX_OUTPUTS);
memset(chanOscLP0,0,sizeof(float)*DIV_MAX_CHANS);
memset(chanOscLP1,0,sizeof(float)*DIV_MAX_CHANS);
@ -7290,6 +7351,8 @@ FurnaceGUI::FurnaceGUI():
memset(macroRelLabel,0,32);
memset(emptyLabel,0,32);
memset(emptyLabel2,0,32);
//effect sorting
memset(effectsShow,1,sizeof(bool)*10);
strncpy(noteOffLabel,"OFF",32);
strncpy(noteRelLabel,"===",32);

View file

@ -152,6 +152,22 @@ enum FurnaceGUIColors {
GUI_COLOR_OSC_BORDER,
GUI_COLOR_OSC_WAVE,
GUI_COLOR_OSC_WAVE_PEAK,
GUI_COLOR_OSC_WAVE_CH0,
GUI_COLOR_OSC_WAVE_CH1,
GUI_COLOR_OSC_WAVE_CH2,
GUI_COLOR_OSC_WAVE_CH3,
GUI_COLOR_OSC_WAVE_CH4,
GUI_COLOR_OSC_WAVE_CH5,
GUI_COLOR_OSC_WAVE_CH6,
GUI_COLOR_OSC_WAVE_CH7,
GUI_COLOR_OSC_WAVE_CH8,
GUI_COLOR_OSC_WAVE_CH9,
GUI_COLOR_OSC_WAVE_CH10,
GUI_COLOR_OSC_WAVE_CH11,
GUI_COLOR_OSC_WAVE_CH12,
GUI_COLOR_OSC_WAVE_CH13,
GUI_COLOR_OSC_WAVE_CH14,
GUI_COLOR_OSC_WAVE_CH15,
GUI_COLOR_OSC_REF,
GUI_COLOR_OSC_GUIDE,
@ -242,6 +258,7 @@ enum FurnaceGUIColors {
GUI_COLOR_INSTR_K053260,
GUI_COLOR_INSTR_SCSP,
GUI_COLOR_INSTR_TED,
GUI_COLOR_INSTR_C140,
GUI_COLOR_INSTR_UNKNOWN,
GUI_COLOR_CHANNEL_BG,
@ -402,7 +419,6 @@ enum FurnaceGUIFileDialogs {
GUI_FILE_INS_OPEN,
GUI_FILE_INS_OPEN_REPLACE,
GUI_FILE_INS_SAVE,
GUI_FILE_INS_SAVE_OLD,
GUI_FILE_INS_SAVE_DMP,
GUI_FILE_WAVE_OPEN,
GUI_FILE_WAVE_OPEN_REPLACE,
@ -424,6 +440,7 @@ enum FurnaceGUIFileDialogs {
GUI_FILE_EXPORT_CMDSTREAM_BINARY,
GUI_FILE_EXPORT_ROM,
GUI_FILE_LOAD_MAIN_FONT,
GUI_FILE_LOAD_HEAD_FONT,
GUI_FILE_LOAD_PAT_FONT,
GUI_FILE_IMPORT_COLORS,
GUI_FILE_IMPORT_KEYBINDS,
@ -607,7 +624,6 @@ enum FurnaceGUIActions {
GUI_ACTION_INS_LIST_OPEN,
GUI_ACTION_INS_LIST_OPEN_REPLACE,
GUI_ACTION_INS_LIST_SAVE,
GUI_ACTION_INS_LIST_SAVE_OLD,
GUI_ACTION_INS_LIST_SAVE_DMP,
GUI_ACTION_INS_LIST_MOVE_UP,
GUI_ACTION_INS_LIST_MOVE_DOWN,
@ -1309,7 +1325,7 @@ class FurnaceGUI {
std::vector<String> availRenderDrivers;
std::vector<String> availAudioDrivers;
bool quit, warnQuit, willCommit, edit, modified, displayError, displayExporting, vgmExportLoop, zsmExportLoop, vgmExportPatternHints;
bool quit, warnQuit, willCommit, edit, modified, displayError, displayExporting, vgmExportLoop, zsmExportLoop, zsmExportOptimize, vgmExportPatternHints;
bool vgmExportDirectStream, displayInsTypeList;
bool portrait, injectBackUp, mobileMenuOpen, warnColorPushed;
bool wantCaptureKeyboard, oldWantCaptureKeyboard, displayMacroMenu;
@ -1371,6 +1387,7 @@ class FurnaceGUI {
ImFont* iconFont;
ImFont* patFont;
ImFont* bigFont;
ImFont* headFont;
ImWchar* fontRange;
ImVec4 uiColors[GUI_COLOR_MAX];
ImVec4 volColors[128];
@ -1389,7 +1406,7 @@ class FurnaceGUI {
char emptyLabel2[32];
struct Settings {
int mainFontSize, patFontSize, iconSize;
int mainFontSize, patFontSize, headFontSize, iconSize;
int audioEngine;
int audioQuality;
int audioChans;
@ -1406,6 +1423,7 @@ class FurnaceGUI {
String tg100Path;
String mu5Path;
int mainFont;
int headFont;
int patFont;
int audioRate;
int audioBufSize;
@ -1460,6 +1478,8 @@ class FurnaceGUI {
int oscTakesEntireWindow;
int oscBorder;
int oscEscapesBoundary;
int oscMono;
int oscAntiAlias;
int separateFMColors;
int insEditColorize;
int metroVol;
@ -1525,8 +1545,16 @@ class FurnaceGUI {
int newSongBehavior;
int memUsageUnit;
int cursorFollowsWheel;
int noDMFCompat;
int removeInsOff;
int removeVolOff;
int playOnLoad;
int insTypeMenu;
int capitalMenuBar;
int centerPopup;
unsigned int maxUndoSteps;
String mainFontPath;
String headFontPath;
String patFontPath;
String audioDevice;
String midiInDevice;
@ -1545,6 +1573,7 @@ class FurnaceGUI {
Settings():
mainFontSize(18),
patFontSize(18),
headFontSize(27),
iconSize(16),
audioEngine(DIV_AUDIO_SDL),
audioQuality(0),
@ -1615,6 +1644,8 @@ class FurnaceGUI {
oscTakesEntireWindow(0),
oscBorder(1),
oscEscapesBoundary(0),
oscMono(1),
oscAntiAlias(1),
separateFMColors(0),
insEditColorize(0),
metroVol(100),
@ -1679,8 +1710,16 @@ class FurnaceGUI {
newSongBehavior(0),
memUsageUnit(1),
cursorFollowsWheel(0),
noDMFCompat(0),
removeInsOff(0),
removeVolOff(0),
playOnLoad(0),
insTypeMenu(1),
capitalMenuBar(0),
centerPopup(1),
maxUndoSteps(100),
mainFontPath(""),
headFontPath(""),
patFontPath(""),
audioDevice(""),
midiInDevice(""),
@ -1727,7 +1766,7 @@ class FurnaceGUI {
bool mixerOpen, debugOpen, inspectorOpen, oscOpen, volMeterOpen, statsOpen, compatFlagsOpen;
bool pianoOpen, notesOpen, channelsOpen, regViewOpen, logOpen, effectListOpen, chanOscOpen;
bool subSongsOpen, findOpen, spoilerOpen, patManagerOpen, sysManagerOpen, clockOpen, speedOpen;
bool groovesOpen, introMonOpen;
bool groovesOpen;
bool basicMode, shortIntro;
bool insListDir, waveListDir, sampleListDir;
@ -1963,14 +2002,15 @@ class FurnaceGUI {
ImVec2 subPortPos;
// oscilloscope
int oscTotal;
float oscValues[512];
int oscTotal, oscWidth;
float* oscValues[DIV_MAX_OUTPUTS];
float oscZoom;
float oscWindowSize;
float oscInput, oscInput1;
bool oscZoomSlider;
// per-channel oscilloscope
int chanOscCols, chanOscColorX, chanOscColorY;
int chanOscCols, chanOscAutoColsType, chanOscColorX, chanOscColorY;
float chanOscWindowSize, chanOscTextX, chanOscTextY, chanOscAmplify;
bool chanOscWaveCorr, chanOscOptions, updateChanOscGradTex, chanOscUseGrad, chanOscNormalize;
String chanOscTextFormat;
@ -2031,6 +2071,9 @@ class FurnaceGUI {
bool pianoReadonly;
int pianoOffset, pianoOffsetEdit;
int pianoView, pianoInputPadMode;
//effect sorting
bool effectsShow[10];
// TX81Z
bool hasACED;
@ -2074,7 +2117,7 @@ class FurnaceGUI {
void drawAlgorithm(unsigned char alg, FurnaceGUIFMAlgs algType, const ImVec2& size);
void drawFMEnv(unsigned char tl, unsigned char ar, unsigned char dr, unsigned char d2r, unsigned char rr, unsigned char sl, unsigned char sus, unsigned char egt, unsigned char algOrGlobalSus, float maxTl, float maxArDr, float maxRr, const ImVec2& size, unsigned short instType);
void drawGBEnv(unsigned char vol, unsigned char len, unsigned char sLen, bool dir, const ImVec2& size);
bool drawSysConf(int chan, DivSystem type, DivConfig& flags, bool modifyOnChange);
bool drawSysConf(int chan, DivSystem type, DivConfig& flags, bool modifyOnChange, bool fromMenu=false);
void kvsConfig(DivInstrument* ins);
void drawFMPreview(const ImVec2& size);
void renderFMPreview(const DivInstrumentFM& params, int pos=0);
@ -2099,6 +2142,8 @@ class FurnaceGUI {
ImVec4 channelColor(int ch);
ImVec4 channelTextColor(int ch);
void centerNextWindow(const char* name, float w, float h);
void readOsc();
void calcChanOsc();

View file

@ -170,6 +170,7 @@ const char* insTypes[DIV_INS_MAX+1]={
"K053260",
"SCSP",
"TED",
"C140",
NULL
};
@ -191,7 +192,7 @@ const char* sampleDepths[DIV_SAMPLE_DEPTH_MAX]={
"8-bit PCM",
"BRR",
"VOX",
NULL,
"8-bit µ-law PCM",
NULL,
NULL,
NULL,
@ -208,6 +209,32 @@ const char* resampleStrats[]={
"best possible"
};
const FurnaceGUIColors fxColorsSort[]={//used for sorting
GUI_COLOR_PATTERN_EFFECT_PITCH,
GUI_COLOR_PATTERN_EFFECT_SONG,
GUI_COLOR_PATTERN_EFFECT_TIME,
GUI_COLOR_PATTERN_EFFECT_SPEED,
GUI_COLOR_PATTERN_EFFECT_PANNING,
GUI_COLOR_PATTERN_EFFECT_VOLUME,
GUI_COLOR_PATTERN_EFFECT_SYS_PRIMARY,
GUI_COLOR_PATTERN_EFFECT_SYS_SECONDARY,
GUI_COLOR_PATTERN_EFFECT_MISC,
GUI_COLOR_PATTERN_EFFECT_INVALID
};
const char* fxColorsNames[]={
"Pitch",
"Song",
"Time",
"Speed",
"Panning",
"Volume",
"System Primary",
"System Secondary",
"Miscellaneous",
"Invalid"
};
const FurnaceGUIColors fxColors[256]={
GUI_COLOR_PATTERN_EFFECT_MISC, // 00
GUI_COLOR_PATTERN_EFFECT_PITCH, // 01
@ -641,7 +668,6 @@ const FurnaceGUIActionDef guiActions[GUI_ACTION_MAX]={
D("INS_LIST_OPEN", "Open", 0),
D("INS_LIST_OPEN_REPLACE", "Open (replace current)", 0),
D("INS_LIST_SAVE", "Save", 0),
D("INS_LIST_SAVE_OLD", "Save (legacy .fui)", 0),
D("INS_LIST_SAVE_DMP", "Save (.dmp)", 0),
D("INS_LIST_MOVE_UP", "Move up", FURKMOD_SHIFT|SDLK_UP),
D("INS_LIST_MOVE_DOWN", "Move down", FURKMOD_SHIFT|SDLK_DOWN),
@ -803,6 +829,22 @@ const FurnaceGUIColorDef guiColors[GUI_COLOR_MAX]={
D(GUI_COLOR_OSC_BORDER,"",ImVec4(0.4f,0.6f,0.95f,1.0f)),
D(GUI_COLOR_OSC_WAVE,"",ImVec4(0.95f,0.95f,1.0f,1.0f)),
D(GUI_COLOR_OSC_WAVE_PEAK,"",ImVec4(0.95f,0.95f,1.0f,1.0f)),
D(GUI_COLOR_OSC_WAVE_CH0,"",ImVec4(1.0f,1.0f,1.0f,1.0f)),
D(GUI_COLOR_OSC_WAVE_CH1,"",ImVec4(1.0f,0.2f,0.2f,1.0f)),
D(GUI_COLOR_OSC_WAVE_CH2,"",ImVec4(0.1f,0.5f,1.0f,1.0f)),
D(GUI_COLOR_OSC_WAVE_CH3,"",ImVec4(0.5f,0.5f,0.5f,1.0f)),
D(GUI_COLOR_OSC_WAVE_CH4,"",ImVec4(0.7f,0.2f,0.7f,1.0f)),
D(GUI_COLOR_OSC_WAVE_CH5,"",ImVec4(0.2f,1.0f,0.2f,1.0f)),
D(GUI_COLOR_OSC_WAVE_CH6,"",ImVec4(1.0f,1.0f,0.1f,1.0f)),
D(GUI_COLOR_OSC_WAVE_CH7,"",ImVec4(1.0f,0.5f,0.1f,1.0f)),
D(GUI_COLOR_OSC_WAVE_CH8,"",ImVec4(0.9f,1.0f,0.1f,1.0f)),
D(GUI_COLOR_OSC_WAVE_CH9,"",ImVec4(0.8f,1.0f,0.1f,1.0f)),
D(GUI_COLOR_OSC_WAVE_CH10,"",ImVec4(0.7f,1.0f,0.1f,1.0f)),
D(GUI_COLOR_OSC_WAVE_CH11,"",ImVec4(0.6f,1.0f,0.1f,1.0f)),
D(GUI_COLOR_OSC_WAVE_CH12,"",ImVec4(0.5f,1.0f,0.1f,1.0f)),
D(GUI_COLOR_OSC_WAVE_CH13,"",ImVec4(0.4f,1.0f,0.1f,1.0f)),
D(GUI_COLOR_OSC_WAVE_CH14,"",ImVec4(0.3f,1.0f,0.1f,1.0f)),
D(GUI_COLOR_OSC_WAVE_CH15,"",ImVec4(0.2f,1.0f,0.1f,1.0f)),
D(GUI_COLOR_OSC_REF,"",ImVec4(0.3,0.65f,1.0f,0.15f)),
D(GUI_COLOR_OSC_GUIDE,"",ImVec4(0.3,0.65f,1.0f,0.13f)),
@ -893,6 +935,7 @@ const FurnaceGUIColorDef guiColors[GUI_COLOR_MAX]={
D(GUI_COLOR_INSTR_K053260,"",ImVec4(1.0f,0.8f,0.1f,1.0f)),
D(GUI_COLOR_INSTR_SCSP,"",ImVec4(0.5f,0.5f,0.5f,1.0f)),
D(GUI_COLOR_INSTR_TED,"",ImVec4(0.7f,0.6f,1.0f,1.0f)),
D(GUI_COLOR_INSTR_C140,"",ImVec4(1.0f,1.0f,0.0f,1.0f)),
D(GUI_COLOR_INSTR_UNKNOWN,"",ImVec4(0.3f,0.3f,0.3f,1.0f)),
D(GUI_COLOR_CHANNEL_BG,"",ImVec4(0.4f,0.6f,0.8f,1.0f)),
@ -1078,6 +1121,7 @@ const int availableSystems[]={
DIV_SYSTEM_PV1000,
DIV_SYSTEM_K053260,
DIV_SYSTEM_TED,
DIV_SYSTEM_C140,
DIV_SYSTEM_PCM_DAC,
DIV_SYSTEM_PONG,
0 // don't remove this last one!
@ -1188,6 +1232,7 @@ const int chipsSample[]={
DIV_SYSTEM_PCM_DAC,
DIV_SYSTEM_ES5506,
DIV_SYSTEM_K053260,
DIV_SYSTEM_C140,
0 // don't remove this last one!
};

View file

@ -57,4 +57,6 @@ extern const FurnaceGUIActionDef guiActions[];
extern const FurnaceGUIColorDef guiColors[];
extern const int altValues[24];
extern const int vgmVersions[7];
extern const FurnaceGUIColors fxColors[256];
extern const FurnaceGUIColors fxColors[256];
extern const FurnaceGUIColors fxColorsSort[10];
extern const char* fxColorsNames[10];

View file

@ -2288,9 +2288,6 @@ void FurnaceGUI::drawInsEdit() {
ImGui::SetTooltip("Save");
}
if (ImGui::BeginPopupContextItem("InsSaveFormats",ImGuiMouseButton_Right)) {
if (ImGui::MenuItem("save in legacy format...")) {
doAction(GUI_ACTION_INS_LIST_SAVE_OLD);
}
if (ImGui::MenuItem("save as .dmp...")) {
doAction(GUI_ACTION_INS_LIST_SAVE_DMP);
}
@ -4267,6 +4264,7 @@ void FurnaceGUI::drawInsEdit() {
ImGui::EndTabItem();
}
if (ins->type==DIV_INS_C64) if (ImGui::BeginTabItem("C64")) {
ImGui::AlignTextToFramePadding();
ImGui::Text("Waveform");
ImGui::SameLine();
pushToggleColors(ins->c64.triOn);
@ -4351,6 +4349,7 @@ void FurnaceGUI::drawInsEdit() {
P(CWSliderScalar("Cutoff",ImGuiDataType_U16,&ins->c64.cut,&_ZERO,&_TWO_THOUSAND_FORTY_SEVEN)); rightClickable
P(CWSliderScalar("Resonance",ImGuiDataType_U8,&ins->c64.res,&_ZERO,&_FIFTEEN)); rightClickable
ImGui::AlignTextToFramePadding();
ImGui::Text("Filter Mode");
ImGui::SameLine();
pushToggleColors(ins->c64.lp);
@ -4414,7 +4413,8 @@ void FurnaceGUI::drawInsEdit() {
ins->type==DIV_INS_ES5506 ||
ins->type==DIV_INS_K007232 ||
ins->type==DIV_INS_GA20 ||
ins->type==DIV_INS_K053260) {
ins->type==DIV_INS_K053260 ||
ins->type==DIV_INS_C140) {
if (ImGui::BeginTabItem((ins->type==DIV_INS_SU)?"Sound Unit":"Sample")) {
String sName;
bool wannaOpenSMPopup=false;
@ -4516,6 +4516,7 @@ void FurnaceGUI::drawInsEdit() {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg,ImGui::GetColorU32(ImGuiCol_TableHeaderBg));
ImGui::AlignTextToFramePadding();
ImGui::Text("%s",noteNames[60+i]);
ImGui::TableNextColumn();
if (sampleMap.map<0 || sampleMap.map>=e->song.sampleLen) {
@ -4525,6 +4526,7 @@ void FurnaceGUI::drawInsEdit() {
sName=fmt::sprintf("%3d##SM%d",sampleMap.map,i);
}
ImGui::PushFont(patFont);
ImGui::AlignTextToFramePadding();
ImGui::SetNextItemWidth(ImGui::CalcTextSize("00000").x);
ImGui::Selectable(sName.c_str(),(sampleMapWaitingInput && sampleMapColumn==0 && i>=sampleMapMin && i<=sampleMapMax));
if (ImGui::IsItemClicked(ImGuiMouseButton_Left)) {
@ -4575,6 +4577,7 @@ void FurnaceGUI::drawInsEdit() {
}
sName+=fmt::sprintf("##SN%d",i);
ImGui::PushFont(patFont);
ImGui::AlignTextToFramePadding();
ImGui::SetNextItemWidth(ImGui::CalcTextSize("00000").x);
ImGui::Selectable(sName.c_str(),(sampleMapWaitingInput && sampleMapColumn==1 && i>=sampleMapMin && i<=sampleMapMax));
if (ImGui::IsItemClicked(ImGuiMouseButton_Left)) {
@ -4619,9 +4622,25 @@ void FurnaceGUI::drawInsEdit() {
ImGui::PopFont();
ImGui::TableNextColumn();
String prevName="---";
if (sampleMap.map>=0 && sampleMap.map<e->song.sampleLen) {
ImGui::TextUnformatted(e->song.sample[sampleMap.map]->name.c_str());
prevName=e->song.sample[sampleMap.map]->name;
}
ImGui::PushID(i+2);
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (ImGui::BeginCombo("##SMSample",prevName.c_str())) {
if (ImGui::Selectable("---")) {
sampleMap.map=-1;
}
for (int k=0; k<e->song.sampleLen; k++) {
String itemName=fmt::sprintf("%d: %s",k,e->song.sample[k]->name);
if (ImGui::Selectable(itemName.c_str())) {
sampleMap.map=k;
}
}
ImGui::EndCombo();
}
ImGui::PopID();
}
ImGui::PopStyleColor(2);
ImGui::EndTable();
@ -4688,7 +4707,7 @@ void FurnaceGUI::drawInsEdit() {
ImGui::Separator();
P(ImGui::Checkbox("Per-channel wave offset/length",&ins->n163.perChanPos));
P(ImGui::Checkbox("Per-channel wave position/length",&ins->n163.perChanPos));
if (ins->n163.perChanPos) {
if (ImGui::BeginTable("N1PerChPos",3)) {
@ -4700,7 +4719,7 @@ void FurnaceGUI::drawInsEdit() {
ImGui::TableNextColumn();
ImGui::Text("Ch");
ImGui::TableNextColumn();
ImGui::Text("Offset");
ImGui::Text("Position");
ImGui::TableNextColumn();
ImGui::Text("Length");
@ -4732,7 +4751,7 @@ void FurnaceGUI::drawInsEdit() {
ImGui::EndTable();
}
} else {
if (ImGui::InputInt("Offset##WAVEPOS",&ins->n163.wavePos,1,16)) { PARAMETER
if (ImGui::InputInt("Position##WAVEPOS",&ins->n163.wavePos,1,16)) { PARAMETER
if (ins->n163.wavePos<0) ins->n163.wavePos=0;
if (ins->n163.wavePos>255) ins->n163.wavePos=255;
}
@ -5253,6 +5272,7 @@ void FurnaceGUI::drawInsEdit() {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("Wave 1");
ImGui::SameLine();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
@ -5263,6 +5283,7 @@ void FurnaceGUI::drawInsEdit() {
}
if (isSingleWaveFX) {
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("Wave 2");
ImGui::SameLine();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
@ -5400,7 +5421,7 @@ void FurnaceGUI::drawInsEdit() {
volMax=31;
}
if (ins->type==DIV_INS_ADPCMB || ins->type==DIV_INS_YMZ280B || ins->type==DIV_INS_RF5C68 ||
ins->type==DIV_INS_GA20) {
ins->type==DIV_INS_GA20 || ins->type==DIV_INS_C140) {
volMax=255;
}
if (ins->type==DIV_INS_QSOUND) {
@ -5460,7 +5481,8 @@ void FurnaceGUI::drawInsEdit() {
if (ins->type==DIV_INS_TIA || ins->type==DIV_INS_AMIGA || ins->type==DIV_INS_SCC ||
ins->type==DIV_INS_PET || ins->type==DIV_INS_SEGAPCM ||
ins->type==DIV_INS_FM || ins->type==DIV_INS_K007232 || ins->type==DIV_INS_GA20 ||
ins->type==DIV_INS_SM8521 || ins->type==DIV_INS_PV1000 || ins->type==DIV_INS_K053260) {
ins->type==DIV_INS_SM8521 || ins->type==DIV_INS_PV1000 || ins->type==DIV_INS_K053260 ||
ins->type==DIV_INS_C140) {
dutyMax=0;
}
if (ins->type==DIV_INS_VBOY) {
@ -5568,6 +5590,7 @@ void FurnaceGUI::drawInsEdit() {
if (ins->type==DIV_INS_K053260) waveMax=0;
if (ins->type==DIV_INS_POKEMINI) waveMax=0;
if (ins->type==DIV_INS_TED) waveMax=0;
if (ins->type==DIV_INS_C140) waveMax=0;
if (ins->type==DIV_INS_SU || ins->type==DIV_INS_POKEY) waveMax=7;
if (ins->type==DIV_INS_PET) {
waveMax=8;
@ -5698,6 +5721,10 @@ void FurnaceGUI::drawInsEdit() {
panMin=0;
panMax=127;
}
if (ins->type==DIV_INS_C140) {
panMin=0;
panMax=255;
}
if (ins->type==DIV_INS_ES5506) {
panMax=4095;
}
@ -5783,6 +5810,7 @@ void FurnaceGUI::drawInsEdit() {
ins->type==DIV_INS_K007232 ||
ins->type==DIV_INS_GA20 ||
ins->type==DIV_INS_K053260 ||
ins->type==DIV_INS_C140 ||
ins->type==DIV_INS_TED) {
macroList.push_back(FurnaceGUIMacroDesc("Phase Reset",&ins->std.phaseResetMacro,0,1,32,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true));
}

View file

@ -104,10 +104,7 @@ void FurnaceGUI::endIntroTune() {
void FurnaceGUI::drawIntro(double introTime, bool monitor) {
if (monitor) {
if (introTime<0.0) introTime=0.0;
if (introTime>11.0) introTime=11.0;
if (!introMonOpen) return;
if (introPos<(shortIntro?1.0:11.0)) return;
return;
}
if (introPos<(shortIntro?1.0:11.0) || monitor) {
if (!monitor) {
@ -117,7 +114,7 @@ void FurnaceGUI::drawIntro(double introTime, bool monitor) {
ImGui::SetNextWindowSize(ImVec2(canvasW,canvasH));
if (introPos<0.1) ImGui::SetNextWindowFocus();
}
if (ImGui::Begin(monitor?"IntroMon X":"Intro",monitor?(&introMonOpen):NULL,monitor?globalWinFlags:(ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoDocking|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoBackground))) {
if (ImGui::Begin(monitor?"IntroMon X":"Intro",NULL,monitor?globalWinFlags:(ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoDocking|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoBackground))) {
if (monitor) {
if (ImGui::Button("Preview")) {
introPos=0;

View file

@ -244,6 +244,7 @@ void FurnaceGUI::drawMixer() {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("%d. %s",i+1,getSystemName(e->song.system[i]));
ImGui::TableNextColumn();
if (ImGui::Checkbox("Invert",&doInvert)) {

View file

@ -20,6 +20,8 @@
#include "gui.h"
#include "imgui_internal.h"
#include <imgui.h>
#include "../ta-log.h"
#include "../engine/filter.h"
void FurnaceGUI::readOsc() {
int writePos=e->oscWritePos;
@ -47,19 +49,52 @@ void FurnaceGUI::readOsc() {
int winSize=e->getAudioDescGot().rate*(oscWindowSize/1000.0);
int oscReadPos=(writePos-winSize)&0x7fff;
for (int i=0; i<512; i++) {
int pos=(oscReadPos+(i*winSize/512))&0x7fff;
oscValues[i]=0;
for (int j=0; j<e->getAudioDescGot().outChans; j++) {
oscValues[i]+=e->oscBuf[j][pos];
}
oscValues[i]/=e->getAudioDescGot().outChans;
if (oscValues[i]>0.001f || oscValues[i]<-0.001f) {
WAKE_UP;
for (int ch=0; ch<e->getAudioDescGot().outChans; ch++) {
if (oscValues[ch]==NULL) {
oscValues[ch]=new float[1024];
}
memset(oscValues[ch],0,1024*sizeof(float));
float* sincITable=DivFilterTables::getSincIntegralTable();
float posFrac=0.0;
int posInt=oscReadPos;
float factor=(float)oscWidth/(float)winSize;
for (int i=0; i<oscWidth; i++) {
oscValues[ch][i]+=e->oscBuf[ch][posInt&0x7fff];
posFrac+=1.0;
while (posFrac>=1.0) {
unsigned int n=((unsigned int)(posFrac*8192.0))&8191;
posFrac-=factor;
posInt++;
float* t1=&sincITable[(8191-n)<<3];
float* t2=&sincITable[n<<3];
float delta=e->oscBuf[ch][posInt&0x7fff]-e->oscBuf[ch][(posInt-1)&0x7fff];
for (int j=0; j<8; j++) {
if (i-j>0) {
oscValues[ch][i-j]+=t1[j]*-delta;
}
if (i+j+1<oscWidth) {
oscValues[ch][i+j+1]+=t2[j]*delta;
}
}
}
}
for (int i=0; i<oscWidth; i++) {
if (oscValues[ch][i]>0.001f || oscValues[ch][i]<-0.001f) {
WAKE_UP;
}
}
}
/*for (int i=0; i<oscWidth; i++) {
oscValues[i]=(i&1)?0.3:0;
}*/
float peakDecay=0.05f*60.0f*ImGui::GetIO().DeltaTime;
for (int i=0; i<e->getAudioDescGot().outChans; i++) {
peak[i]*=1.0-peakDecay;
@ -124,7 +159,7 @@ void FurnaceGUI::drawOsc() {
ImDrawList* dl=ImGui::GetWindowDrawList();
ImGuiWindow* window=ImGui::GetCurrentWindow();
ImVec2 waveform[512];
ImVec2 waveform[1024];
ImVec2 size=ImGui::GetContentRegionAvail();
ImVec2 minArea=window->DC.CursorPos;
@ -211,22 +246,67 @@ void FurnaceGUI::drawOsc() {
dpiScale
);
for (size_t i=0; i<512; i++) {
float x=(float)i/512.0f;
float y=oscValues[i]*oscZoom;
if (!settings.oscEscapesBoundary) {
if (y<-0.5f) y=-0.5f;
if (y>0.5f) y=0.5f;
oscWidth=round(inRect.Max.x-inRect.Min.x);
if (oscWidth<1) oscWidth=1;
if (oscWidth>1024) oscWidth=1024;
ImDrawListFlags prevFlags=dl->Flags;
if (!settings.oscAntiAlias) {
dl->Flags&=~(ImDrawListFlags_AntiAliasedLines|ImDrawListFlags_AntiAliasedLinesUseTex);
}
if (settings.oscMono) {
for (int i=0; i<oscWidth; i++) {
float x=(float)i/(float)oscWidth;
float avg=0;
for (int j=0; j<e->getAudioDescGot().outChans; j++) {
avg+=oscValues[j][i];
}
avg/=e->getAudioDescGot().outChans;
float y=avg*oscZoom;
if (!settings.oscEscapesBoundary) {
if (y<-0.5f) y=-0.5f;
if (y>0.5f) y=0.5f;
}
waveform[i]=ImLerp(inRect.Min,inRect.Max,ImVec2(x,0.5f-y));
}
if (settings.oscEscapesBoundary) {
dl->PushClipRectFullScreen();
dl->AddPolyline(waveform,oscWidth,color,ImDrawFlags_None,dpiScale);
dl->PopClipRect();
} else {
dl->AddPolyline(waveform,oscWidth,color,ImDrawFlags_None,dpiScale);
}
waveform[i]=ImLerp(inRect.Min,inRect.Max,ImVec2(x,0.5f-y));
}
if (settings.oscEscapesBoundary) {
dl->PushClipRectFullScreen();
dl->AddPolyline(waveform,512,color,ImDrawFlags_None,dpiScale);
dl->PopClipRect();
} else {
dl->AddPolyline(waveform,512,color,ImDrawFlags_None,dpiScale);
for (int ch=0; ch<e->getAudioDescGot().outChans; ch++) {
for (int i=0; i<oscWidth; i++) {
float x=(float)i/(float)oscWidth;
float y=oscValues[ch][i]*oscZoom;
if (!settings.oscEscapesBoundary) {
if (y<-0.5f) y=-0.5f;
if (y>0.5f) y=0.5f;
}
waveform[i]=ImLerp(inRect.Min,inRect.Max,ImVec2(x,0.5f-y));
}
if (!isClipping) {
color=ImGui::GetColorU32(uiColors[GUI_COLOR_OSC_WAVE_CH0+ch]);
}
if (settings.oscEscapesBoundary) {
dl->PushClipRectFullScreen();
dl->AddPolyline(waveform,oscWidth,color,ImDrawFlags_None,dpiScale);
dl->PopClipRect();
} else {
dl->AddPolyline(waveform,oscWidth,color,ImDrawFlags_None,dpiScale);
}
}
}
dl->Flags=prevFlags;
if (settings.oscBorder) {
dl->AddRect(inRect.Min,inRect.Max,borderColor,settings.oscRoundedCorners?(8.0f*dpiScale):0.0f,0,1.5f*dpiScale);
}

View file

@ -420,9 +420,6 @@ void FurnaceGUI::drawPattern() {
//char id[32];
ImGui::PushFont(patFont);
int ord=oldOrder;
if (followPattern) {
curOrder=e->getOrder();
}
oldOrder=curOrder;
int chans=e->getTotalChannelCount();
int displayChans=0;
@ -829,8 +826,6 @@ void FurnaceGUI::drawPattern() {
ImGui::GetColorU32(chanHeadBase)
);
}
keyHit1[i]-=0.2f;
if (keyHit1[i]<0.0f) keyHit1[i]=0.0f;
}
}

View file

@ -100,6 +100,7 @@ void FurnaceGUI::drawPiano() {
}
if (ImGui::BeginPopupContextItem("PianoOptions",ImGuiPopupFlags_MouseButtonLeft)) {
ImGui::Text("Key layout:");
ImGui::Indent();
if (ImGui::RadioButton("Automatic",pianoView==PIANO_LAYOUT_AUTOMATIC)) {
pianoView=PIANO_LAYOUT_AUTOMATIC;
}
@ -109,7 +110,9 @@ void FurnaceGUI::drawPiano() {
if (ImGui::RadioButton("Continuous",pianoView==PIANO_LAYOUT_CONTINUOUS)) {
pianoView=PIANO_LAYOUT_CONTINUOUS;
}
ImGui::Unindent();
ImGui::Text("Value input pad:");
ImGui::Indent();
if (ImGui::RadioButton("Disabled",pianoInputPadMode==PIANO_INPUT_PAD_DISABLE)) {
pianoInputPadMode=PIANO_INPUT_PAD_DISABLE;
}
@ -122,6 +125,7 @@ void FurnaceGUI::drawPiano() {
if (ImGui::RadioButton("Split (always visible)",pianoInputPadMode==PIANO_INPUT_PAD_SPLIT_VISIBLE)) {
pianoInputPadMode=PIANO_INPUT_PAD_SPLIT_VISIBLE;
}
ImGui::Unindent();
ImGui::Checkbox("Share play/edit offset/range",&pianoSharePosition);
ImGui::Checkbox("Read-only (can't input notes)",&pianoReadonly);
ImGui::EndPopup();
@ -377,7 +381,6 @@ void FurnaceGUI::drawPiano() {
pianoOptions=!pianoOptions;
}
// TODO: wave and sample preview
// first check released keys
for (int i=0; i<180; i++) {
int note=i-60;

View file

@ -991,7 +991,7 @@ void FurnaceGUI::initSystemPresets() {
}
);
ENTRY(
"PC + AdLib/Sound Blaster (drums mode)", {
"PC + Sound Blaster (drums mode)", {
CH(DIV_SYSTEM_OPL2_DRUMS, 1.0f, 0, ""),
CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, ""),
CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0,
@ -1407,28 +1407,40 @@ void FurnaceGUI::initSystemPresets() {
"Sega System 32", {
CH(DIV_SYSTEM_YM2612, 1.0f, 0, "clockSel=4"), // discrete 8.05MHz YM3438
CH(DIV_SYSTEM_YM2612, 1.0f, 0, "clockSel=4"), // ^^
CH(DIV_SYSTEM_RF5C68, 1.0f, 0, "clockSel=2") // 12.5MHz
CH(DIV_SYSTEM_RF5C68, 1.0f, 0,
"clockSel=2\n"
"chipType=1\n"
) // 12.5MHz
}
);
ENTRY(
"Sega System 32 (extended channel 3 on first OPN2C)", {
CH(DIV_SYSTEM_YM2612_EXT, 1.0f, 0, "clockSel=4"), // discrete 8.05MHz YM3438
CH(DIV_SYSTEM_YM2612, 1.0f, 0, "clockSel=4"), // ^^
CH(DIV_SYSTEM_RF5C68, 1.0f, 0, "clockSel=2") // 12.5MHz
CH(DIV_SYSTEM_RF5C68, 1.0f, 0,
"clockSel=2\n"
"chipType=1\n"
) // 12.5MHz
}
);
ENTRY(
"Sega System 32 (extended channel 3 on second OPN2C)", {
CH(DIV_SYSTEM_YM2612, 1.0f, 0, "clockSel=4"), // discrete 8.05MHz YM3438
CH(DIV_SYSTEM_YM2612_EXT, 1.0f, 0, "clockSel=4"), // ^^
CH(DIV_SYSTEM_RF5C68, 1.0f, 0, "clockSel=2") // 12.5MHz
CH(DIV_SYSTEM_RF5C68, 1.0f, 0,
"clockSel=2\n"
"chipType=1\n"
) // 12.5MHz
}
);
ENTRY(
"Sega System 32 (extended channel 3 on both OPN2Cs)", {
CH(DIV_SYSTEM_YM2612_EXT, 1.0f, 0, "clockSel=4"), // discrete 8.05MHz YM3438
CH(DIV_SYSTEM_YM2612_EXT, 1.0f, 0, "clockSel=4"), // ^^
CH(DIV_SYSTEM_RF5C68, 1.0f, 0, "clockSel=2") // 12.5MHz
CH(DIV_SYSTEM_RF5C68, 1.0f, 0,
"clockSel=2\n"
"chipType=1\n"
) // 12.5MHz
}
);
ENTRY(
@ -2012,6 +2024,12 @@ void FurnaceGUI::initSystemPresets() {
) // ""
}
);
ENTRY(
"Namco System 2", {
CH(DIV_SYSTEM_YM2151, 1.0f, 0, ""),
CH(DIV_SYSTEM_C140, 1.0f, 0, "")
}
);
ENTRY(
"Taito Arcade", {
CH(DIV_SYSTEM_YM2610B, 1.0f, 0, "")
@ -2322,6 +2340,22 @@ void FurnaceGUI::initSystemPresets() {
CH(DIV_SYSTEM_OPL3_DRUMS, 1.0f, 0, "")
}
);
ENTRY(
"Yamaha YMF289B (OPL3-L)", {
CH(DIV_SYSTEM_OPL3, 1.0f, 0,
"clockSel=5\n"
"chipType=1\n"
)
}
);
ENTRY(
"Yamaha YMF289B (drums mode)", {
CH(DIV_SYSTEM_OPL3_DRUMS, 1.0f, 0,
"clockSel=5\n"
"chipType=1\n"
)
}
);
if (settings.hiddenSystems) {
ENTRY(
"Yamaha YMU759 (MA-2)", {
@ -2518,6 +2552,11 @@ void FurnaceGUI::initSystemPresets() {
CH(DIV_SYSTEM_K053260, 1.0f, 0, "")
}
);
ENTRY(
"Namco C140", {
CH(DIV_SYSTEM_C140, 1.0f, 0, "")
}
);
CATEGORY_END;
CATEGORY_BEGIN("Wavetable","chips which use user-specified waveforms to generate sound.");

View file

@ -277,6 +277,11 @@ void FurnaceGUI::drawSampleEdit() {
SAMPLE_WARN(warnLength,"K053260: maximum sample length is 65535");
}
break;
case DIV_SYSTEM_C140:
if (sample->samples>65535) {
SAMPLE_WARN(warnLength,"C140: maximum sample length is 65535");
}
break;
default:
break;
}
@ -372,6 +377,7 @@ void FurnaceGUI::drawSampleEdit() {
if (sampleInfo) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("Type");
ImGui::SameLine();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
@ -445,6 +451,7 @@ void FurnaceGUI::drawSampleEdit() {
bool coarseChanged=false;
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("Hz");
ImGui::SameLine();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
@ -459,6 +466,7 @@ void FurnaceGUI::drawSampleEdit() {
}
}
ImGui::AlignTextToFramePadding();
ImGui::Text("Note");
ImGui::SameLine();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
@ -501,6 +509,7 @@ void FurnaceGUI::drawSampleEdit() {
}
}
ImGui::AlignTextToFramePadding();
ImGui::Text("Fine");
ImGui::SameLine();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
@ -537,6 +546,7 @@ void FurnaceGUI::drawSampleEdit() {
ImGui::TableNextColumn();
ImGui::BeginDisabled(!(doLoop || keepLoopAlive));
keepLoopAlive=false;
ImGui::AlignTextToFramePadding();
ImGui::Text("Mode");
ImGui::SameLine();
pushWarningColor(!warnLoopMode.empty());
@ -560,6 +570,7 @@ void FurnaceGUI::drawSampleEdit() {
popWarningColor();
pushWarningColor(!warnLoopPos.empty());
ImGui::AlignTextToFramePadding();
ImGui::Text("Start");
ImGui::SameLine();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
@ -585,6 +596,7 @@ void FurnaceGUI::drawSampleEdit() {
ImGui::SetTooltip("%s",warnLoopPos.c_str());
}
ImGui::AlignTextToFramePadding();
ImGui::Text("End");
ImGui::SameLine();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
@ -1018,6 +1030,7 @@ void FurnaceGUI::drawSampleEdit() {
if (sampleFilterRes<0.0f) sampleFilterRes=0.0f;
if (sampleFilterRes>0.99f) sampleFilterRes=0.99f;
}
ImGui::AlignTextToFramePadding();
ImGui::Text("Power");
ImGui::SameLine();
if (ImGui::RadioButton("1x",sampleFilterPower==1)) {
@ -1601,7 +1614,7 @@ void FurnaceGUI::drawSampleEdit() {
posX=samplePos+pos.x*sampleZoom;
if (posX>(int)sample->samples) posX=-1;
}
posY=(0.5-pos.y/rectSize.y)*((sample->depth==DIV_SAMPLE_DEPTH_8BIT)?255:32767);
posY=(0.5-pos.y/rectSize.y)*((sample->depth==DIV_SAMPLE_DEPTH_8BIT)?255:65535);
if (posX>=0) {
statusBar2=fmt::sprintf("(%d, %d)",posX,posY);
}

File diff suppressed because it is too large Load diff

View file

@ -36,6 +36,7 @@ void FurnaceGUI::drawSongInfo(bool asChild) {
ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthStretch,0.0);
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("Name");
ImGui::TableNextColumn();
float avail=ImGui::GetContentRegionAvail().x;
@ -59,6 +60,7 @@ void FurnaceGUI::drawSongInfo(bool asChild) {
}
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("Author");
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(avail);
@ -68,6 +70,7 @@ void FurnaceGUI::drawSongInfo(bool asChild) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("Album");
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(avail);
@ -77,6 +80,7 @@ void FurnaceGUI::drawSongInfo(bool asChild) {
if (!basicMode) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("System");
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(MAX(16.0f*dpiScale,avail-autoButtonSize-ImGui::GetStyle().ItemSpacing.x));
@ -112,6 +116,7 @@ void FurnaceGUI::drawSongInfo(bool asChild) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("Tuning (A-4)");
ImGui::TableNextColumn();
float tune=e->song.tuning;

View file

@ -37,6 +37,7 @@ void FurnaceGUI::drawSpeed(bool asChild) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
if (ImGui::SmallButton(tempoView?"Base Tempo##TempoOrHz":"Tick Rate##TempoOrHz")) {
tempoView=!tempoView;
}
@ -74,6 +75,7 @@ void FurnaceGUI::drawSpeed(bool asChild) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
if (keepGrooveAlive || e->curSubSong->speeds.len>2) {
if (ImGui::SmallButton("Groove")) {
e->lockEngine([this]() {
@ -163,6 +165,7 @@ void FurnaceGUI::drawSpeed(bool asChild) {
if (!basicMode) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("Virtual Tempo");
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(halfAvail);
@ -185,6 +188,7 @@ void FurnaceGUI::drawSpeed(bool asChild) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("Divider");
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(halfAvail);
@ -200,6 +204,7 @@ void FurnaceGUI::drawSpeed(bool asChild) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("Highlight");
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(halfAvail);
@ -222,6 +227,7 @@ void FurnaceGUI::drawSpeed(bool asChild) {
ImGui::TableSetupColumn("c2",ImGuiTableColumnFlags_WidthStretch,0.0);
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("Pattern Length");
ImGui::TableNextColumn();
float avail=ImGui::GetContentRegionAvail().x;
@ -236,6 +242,7 @@ void FurnaceGUI::drawSpeed(bool asChild) {
if (!basicMode) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("Song Length");
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(avail);

View file

@ -32,6 +32,7 @@ void FurnaceGUI::drawStats() {
size_t lastProcTime=e->processTime;
double maxGot=1000000000.0*(double)e->getAudioDescGot().bufsize/(double)e->getAudioDescGot().rate;
String procStr=fmt::sprintf("%.1f%%",100.0*((double)lastProcTime/(double)maxGot));
ImGui::AlignTextToFramePadding();
ImGui::Text("Audio load");
ImGui::SameLine();
ImGui::ProgressBar((double)lastProcTime/maxGot,ImVec2(-FLT_MIN,0),procStr.c_str());
@ -47,6 +48,7 @@ void FurnaceGUI::drawStats() {
} else {
usageStr=fmt::sprintf("%d/%d",usage,capacity);
}
ImGui::AlignTextToFramePadding();
ImGui::Text("%s [%d]", e->getSystemName(e->song.system[i]), j);
ImGui::SameLine();
ImGui::ProgressBar(((float)usage)/((float)capacity),ImVec2(-FLT_MIN,0),usageStr.c_str());

View file

@ -127,6 +127,7 @@ void FurnaceGUI::drawSubSongs(bool asChild) {
ImGui::SetTooltip("Remove");
}
ImGui::AlignTextToFramePadding();
ImGui::Text("Name");
ImGui::SameLine();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);

View file

@ -22,7 +22,7 @@
#include "misc/cpp/imgui_stdlib.h"
#include <imgui.h>
bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool modifyOnChange) {
bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool modifyOnChange, bool fromMenu) {
bool altered=false;
bool restart=settings.restartOnFlagChange && modifyOnChange;
bool supportsCustomRate=true;
@ -44,6 +44,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
bool fbAllOps=flags.getBool("fbAllOps",false);
ImGui::Text("Clock rate:");
ImGui::Indent();
if (ImGui::RadioButton("NTSC (7.67MHz)",clockSel==0)) {
clockSel=0;
altered=true;
@ -64,8 +65,10 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
clockSel=4;
altered=true;
}
ImGui::Unindent();
ImGui::Text("Chip type:");
ImGui::Indent();
if (ImGui::RadioButton("YM3438 (9-bit DAC)",chipType==0)) {
chipType=0;
altered=true;
@ -78,6 +81,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
chipType=2;
altered=true;
}
ImGui::Unindent();
if (type==DIV_SYSTEM_YM2612_EXT || type==DIV_SYSTEM_YM2612_DUALPCM_EXT || type==DIV_SYSTEM_YM2612_CSM) {
if (ImGui::Checkbox("Disable ExtCh FM macros (compatibility)",&noExtMacros)) {
@ -105,6 +109,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
bool noEasyNoise=flags.getBool("noEasyNoise",false);
ImGui::Text("Clock rate:");
ImGui::Indent();
if (ImGui::RadioButton("3.58MHz (NTSC)",clockSel==0)) {
clockSel=0;
altered=true;
@ -133,7 +138,9 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
clockSel=6;
altered=true;
}
ImGui::Unindent();
ImGui::Text("Chip type:");
ImGui::Indent();
if (ImGui::RadioButton("Sega VDP/Master System",chipType==0)) {
chipType=0;
altered=true;
@ -174,6 +181,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
chipType=9;
altered=true;
}
ImGui::Unindent();
if (ImGui::Checkbox("Disable noise period change phase reset",&noPhaseReset)) {
altered=true;
@ -205,6 +213,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
altered=true;
}
ImGui::Text("Chip revision:");
ImGui::Indent();
if (ImGui::RadioButton("HuC6280 (original)",chipType==0)) {
chipType=0;
altered=true;
@ -213,6 +222,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
chipType=1;
altered=true;
}
ImGui::Unindent();
if (altered) {
e->lockSave([&]() {
@ -235,6 +245,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
int echoVol=(signed char)flags.getInt("echoVol",0);
ImGui::Text("CPU rate:");
ImGui::Indent();
if (ImGui::RadioButton("6.18MHz (NTSC)",clockSel==0)) {
clockSel=0;
altered=true;
@ -243,7 +254,9 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
clockSel=1;
altered=true;
}
ImGui::Unindent();
ImGui::Text("Sample memory:");
ImGui::Indent();
if (ImGui::RadioButton("8K (rev A/B/E)",sampleMemSize==0)) {
sampleMemSize=0;
altered=true;
@ -252,7 +265,9 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
sampleMemSize=1;
altered=true;
}
ImGui::Unindent();
ImGui::Text("DAC resolution:");
ImGui::Indent();
if (ImGui::RadioButton("16-bit (rev A/B/D/F)",pdm==0)) {
pdm=false;
altered=true;
@ -261,6 +276,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
pdm=true;
altered=true;
}
ImGui::Unindent();
if (ImGui::Checkbox("Enable echo",&echo)) {
altered=true;
}
@ -317,6 +333,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
altered=true;
}
ImGui::Text("Chip revision:");
ImGui::Indent();
if (ImGui::RadioButton("Original (DMG)",chipType==0)) {
chipType=0;
altered=true;
@ -333,8 +350,10 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
chipType=3;
altered=true;
}
ImGui::Unindent();
ImGui::Text("Wave channel orientation:");
if (chipType==3) {
ImGui::Indent();
if (ImGui::RadioButton("Normal",!invertWave)) {
invertWave=false;
altered=true;
@ -343,7 +362,9 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
invertWave=true;
altered=true;
}
ImGui::Unindent();
} else {
ImGui::Indent();
if (ImGui::RadioButton("Exact data (inverted)",!invertWave)) {
invertWave=false;
altered=true;
@ -352,6 +373,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
invertWave=true;
altered=true;
}
ImGui::Unindent();
}
if (ImGui::Checkbox("Pretty please one more compat flag when I use arpeggio and my sound length",&enoughAlready)) {
altered=true;
@ -373,8 +395,10 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
int clockSel=flags.getInt("clockSel",0);
int patchSet=flags.getInt("patchSet",0);
bool noTopHatFreq=flags.getBool("noTopHatFreq",false);
bool fixedAll=flags.getBool("fixedAll",false);
ImGui::Text("Clock rate:");
ImGui::Indent();
if (ImGui::RadioButton("NTSC (3.58MHz)",clockSel==0)) {
clockSel=0;
altered=true;
@ -391,8 +415,10 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
clockSel=3;
altered=true;
}
ImGui::Unindent();
if (type!=DIV_SYSTEM_VRC7) {
ImGui::Text("Patch set:");
ImGui::Indent();
if (ImGui::RadioButton("Yamaha YM2413",patchSet==0)) {
patchSet=0;
altered=true;
@ -409,12 +435,16 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
patchSet=3;
altered=true;
}
ImGui::Unindent();
}
if (type==DIV_SYSTEM_OPLL_DRUMS) {
if (ImGui::Checkbox("Ignore top/hi-hat frequency changes",&noTopHatFreq)) {
altered=true;
}
if (ImGui::Checkbox("Apply fixed frequency to all drums at once",&fixedAll)) {
altered=true;
}
}
if (altered) {
@ -424,6 +454,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
flags.set("patchSet",patchSet);
}
flags.set("noTopHatFreq",noTopHatFreq);
flags.set("fixedAll",fixedAll);
});
}
break;
@ -431,6 +462,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
case DIV_SYSTEM_YM2151: {
int clockSel=flags.getInt("clockSel",0);
ImGui::Indent();
if (ImGui::RadioButton("NTSC/X16 (3.58MHz)",clockSel==0)) {
clockSel=0;
altered=true;
@ -443,6 +475,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
clockSel=2;
altered=true;
}
ImGui::Unindent();
if (altered) {
e->lockSave([&]() {
@ -460,6 +493,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
ImGui::Text("Clock rate:");
ImGui::Indent();
if (ImGui::RadioButton("NTSC (1.79MHz)",clockSel==0)) {
clockSel=0;
altered=true;
@ -472,9 +506,11 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
clockSel=2;
altered=true;
}
ImGui::Unindent();
ImGui::Text("DPCM channel mode:");
ImGui::Indent();
if (ImGui::RadioButton("DPCM (muffled samples; low CPU usage)",dpcmMode)) {
dpcmMode=true;
altered=true;
@ -483,6 +519,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
dpcmMode=false;
altered=true;
}
ImGui::Unindent();
if (altered) {
e->lockSave([&]() {
@ -503,6 +540,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
ImGui::Text("Clock rate:");
ImGui::Indent();
if (ImGui::RadioButton("NTSC (1.02MHz)",clockSel==0)) {
clockSel=0;
altered=true;
@ -515,9 +553,11 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
clockSel=2;
altered=true;
}
ImGui::Unindent();
ImGui::Text("Global parameter priority:");
ImGui::Indent();
if (ImGui::RadioButton("Left to right",!keyPriority)) {
keyPriority=false;
altered=true;
@ -526,6 +566,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
keyPriority=true;
altered=true;
}
ImGui::Unindent();
ImGui::Text("Hard reset envelope:");
@ -576,6 +617,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
int ssgVol=flags.getInt("ssgVol",128);
int fmVol=flags.getInt("fmVol",256);
ImGui::Indent();
if (ImGui::RadioButton("8MHz (Neo Geo MVS)",clockSel==0)) {
clockSel=0;
altered=true;
@ -584,6 +626,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
clockSel=1;
altered=true;
}
ImGui::Unindent();
if (type==DIV_SYSTEM_YM2610_EXT || type==DIV_SYSTEM_YM2610_FULL_EXT || type==DIV_SYSTEM_YM2610B_EXT || type==DIV_SYSTEM_YM2610_CSM || type==DIV_SYSTEM_YM2610B_CSM) {
if (ImGui::Checkbox("Disable ExtCh FM macros (compatibility)",&noExtMacros)) {
@ -626,6 +669,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
int stereoSep=flags.getInt("stereoSep",0);
ImGui::Text("Clock rate:");
ImGui::Indent();
if (ImGui::RadioButton("1.79MHz (ZX Spectrum NTSC/MSX)",clockSel==0)) {
clockSel=0;
altered=true;
@ -686,8 +730,10 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
clockSel=14;
altered=true;
}
ImGui::Unindent();
if (type==DIV_SYSTEM_AY8910) {
ImGui::Text("Chip type:");
ImGui::Indent();
if (ImGui::RadioButton("AY-3-8910",chipType==0)) {
chipType=0;
altered=true;
@ -704,6 +750,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
chipType=3;
altered=true;
}
ImGui::Unindent();
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("note: AY-3-8914 is not supported by the VGM format!");
}
@ -744,6 +791,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
case DIV_SYSTEM_SAA1099: {
int clockSel=flags.getInt("clockSel",0);
ImGui::Indent();
if (ImGui::RadioButton("SAM Coupé (8MHz)",clockSel==0)) {
clockSel=0;
altered=true;
@ -756,6 +804,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
clockSel=2;
altered=true;
}
ImGui::Unindent();
if (altered) {
e->lockSave([&]() {
@ -779,6 +828,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
} rightClickable
ImGui::Text("Model:");
ImGui::Indent();
if (ImGui::RadioButton("Amiga 500 (OCS)",chipType==0)) {
chipType=0;
altered=true;
@ -787,8 +837,10 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
chipType=1;
altered=true;
}
ImGui::Unindent();
ImGui::Text("Chip memory:");
ImGui::Indent();
if (ImGui::RadioButton("2MB (ECS/AGA max)",chipMem==21)) {
chipMem=21;
altered=true;
@ -805,6 +857,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
chipMem=18;
altered=true;
}
ImGui::Unindent();
if (ImGui::Checkbox("PAL",&clockSel)) {
@ -830,6 +883,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
int mixingType=flags.getInt("mixingType",0);
ImGui::Text("Mixing mode:");
ImGui::Indent();
if (ImGui::RadioButton("Mono",mixingType==0)) {
mixingType=0;
altered=true;
@ -842,6 +896,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
mixingType=2;
altered=true;
}
ImGui::Unindent();
if (ImGui::Checkbox("PAL",&clockSel)) {
altered=true;
@ -860,6 +915,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
int speakerType=flags.getInt("speakerType",0);
ImGui::Text("Clock rate:");
ImGui::Indent();
if (ImGui::RadioButton("1.19MHz (PC)",clockSel==0)) {
clockSel=0;
altered=true;
@ -872,8 +928,10 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
clockSel=2;
altered=true;
}
ImGui::Unindent();
ImGui::Text("Speaker type:");
ImGui::Indent();
if (ImGui::RadioButton("Unfiltered",speakerType==0)) {
speakerType=0;
altered=true;
@ -890,6 +948,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
speakerType=3;
altered=true;
}
ImGui::Unindent();
if (altered) {
e->lockSave([&]() {
@ -933,6 +992,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
bool stereo=flags.getBool("stereo",false);
ImGui::Text("Clock rate:");
ImGui::Indent();
if (ImGui::RadioButton("16MHz (Seta 1)",clockSel==0)) {
clockSel=0;
altered=true;
@ -945,6 +1005,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
clockSel=2;
altered=true;
}
ImGui::Unindent();
if (ImGui::Checkbox("Stereo",&stereo)) {
altered=true;
@ -965,6 +1026,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
bool lenCompensate=flags.getBool("lenCompensate",false);
ImGui::Text("Clock rate:");
ImGui::Indent();
if (ImGui::RadioButton("NTSC (1.79MHz)",clockSel==0)) {
clockSel=0;
altered=true;
@ -977,6 +1039,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
clockSel=2;
altered=true;
}
ImGui::Unindent();
ImGui::Text("Initial channel limit:");
if (CWSliderInt("##N163_InitialChannelLimit",&channels,1,8)) {
if (channels<1) channels=1;
@ -1037,6 +1100,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
int fmVol=flags.getInt("fmVol",256);
ImGui::Text("Clock rate:");
ImGui::Indent();
if (ImGui::RadioButton("3.58MHz (NTSC)",clockSel==0)) {
clockSel=0;
altered=true;
@ -1061,7 +1125,9 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
clockSel=5;
altered=true;
}
ImGui::Unindent();
ImGui::Text("Output rate:");
ImGui::Indent();
if (ImGui::RadioButton("FM: clock / 72, SSG: clock / 16",prescale==0)) {
prescale=0;
altered=true;
@ -1074,6 +1140,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
prescale=2;
altered=true;
}
ImGui::Unindent();
if (CWSliderInt("SSG Volume",&ssgVol,0,256)) {
if (ssgVol<0) ssgVol=0;
@ -1119,6 +1186,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
int fmVol=flags.getInt("fmVol",256);
ImGui::Text("Clock rate:");
ImGui::Indent();
if (ImGui::RadioButton("8MHz (Arcade)",clockSel==0)) {
clockSel=0;
altered=true;
@ -1127,7 +1195,9 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
clockSel=1;
altered=true;
}
ImGui::Unindent();
ImGui::Text("Output rate:");
ImGui::Indent();
if (ImGui::RadioButton("FM: clock / 144, SSG: clock / 32",prescale==0)) {
prescale=0;
altered=true;
@ -1140,6 +1210,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
prescale=2;
altered=true;
}
ImGui::Unindent();
if (CWSliderInt("SSG Volume",&ssgVol,0,256)) {
if (ssgVol<0) ssgVol=0;
@ -1179,6 +1250,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
int chipType=flags.getInt("chipType",0);
ImGui::Text("Clock rate:");
ImGui::Indent();
if (ImGui::RadioButton("8MHz (FM Towns)",clockSel==0)) {
clockSel=0;
altered=true;
@ -1191,7 +1263,9 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
clockSel=2;
altered=true;
}
ImGui::Unindent();
ImGui::Text("Chip type:");
ImGui::Indent();
if (ImGui::RadioButton("RF5C68 (10-bit output)",chipType==0)) {
chipType=0;
altered=true;
@ -1200,6 +1274,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
chipType=1;
altered=true;
}
ImGui::Unindent();
if (altered) {
e->lockSave([&]() {
@ -1213,6 +1288,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
int clockSel=flags.getInt("clockSel",0);
ImGui::Text("Clock rate:");
ImGui::Indent();
if (ImGui::RadioButton("4MHz",clockSel==0)) {
clockSel=0;
altered=true;
@ -1229,6 +1305,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
clockSel=3;
altered=true;
}
ImGui::Unindent();
if (altered) {
e->lockSave([&]() {
@ -1242,6 +1319,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
bool rateSel=flags.getBool("rateSel",false);
ImGui::Text("Clock rate:");
ImGui::Indent();
if (ImGui::RadioButton("1MHz",clockSel==0)) {
clockSel=0;
altered=true;
@ -1302,7 +1380,9 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
clockSel=14;
altered=true;
}
ImGui::Unindent();
ImGui::Text("Output rate:");
ImGui::Indent();
if (ImGui::RadioButton("clock / 132",rateSel==0)) {
rateSel=false;
altered=true;
@ -1311,6 +1391,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
rateSel=true;
altered=true;
}
ImGui::Unindent();
if (altered) {
e->lockSave([&]() {
@ -1325,6 +1406,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
int clockSel=flags.getInt("clockSel",0);
ImGui::Text("Clock rate:");
ImGui::Indent();
if (ImGui::RadioButton("1.79MHz (NTSC/MSX)",clockSel==0)) {
clockSel=0;
altered=true;
@ -1341,6 +1423,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
clockSel=3;
altered=true;
}
ImGui::Unindent();
if (altered) {
e->lockSave([&]() {
@ -1358,6 +1441,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
int clockSel=flags.getInt("clockSel",0);
ImGui::Text("Clock rate:");
ImGui::Indent();
if (ImGui::RadioButton("3.58MHz (NTSC)",clockSel==0)) {
clockSel=0;
altered=true;
@ -1382,6 +1466,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
clockSel=5;
altered=true;
}
ImGui::Unindent();
if (altered) {
e->lockSave([&]() {
@ -1393,9 +1478,11 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
case DIV_SYSTEM_OPL3:
case DIV_SYSTEM_OPL3_DRUMS: {
int clockSel=flags.getInt("clockSel",0);
int chipType=flags.getInt("chipType",0);
bool compatPan=flags.getBool("compatPan",false);
ImGui::Text("Clock rate:");
ImGui::Indent();
if (ImGui::RadioButton("14.32MHz (NTSC)",clockSel==0)) {
clockSel=0;
altered=true;
@ -1416,6 +1503,20 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
clockSel=4;
altered=true;
}
if (ImGui::RadioButton("33.8688MHz (OPL3-L)",clockSel==5)) {
clockSel=5;
altered=true;
}
ImGui::Text("Chip type:");
if (ImGui::RadioButton("OPL3 (YMF262)",chipType==0)) {
chipType=0;
altered=true;
}
if (ImGui::RadioButton("OPL3-L (YMF289B)",chipType==1)) {
chipType=1;
altered=true;
}
ImGui::Unindent();
if (ImGui::Checkbox("Compatible panning (0800)",&compatPan)) {
altered=true;
@ -1424,6 +1525,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
if (altered) {
e->lockSave([&]() {
flags.set("clockSel",clockSel);
flags.set("chipType",chipType);
flags.set("compatPan",compatPan);
});
}
@ -1433,6 +1535,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
int clockSel=flags.getInt("clockSel",0);
ImGui::Text("Clock rate:");
ImGui::Indent();
if (ImGui::RadioButton("16.9344MHz",clockSel==0)) {
clockSel=0;
altered=true;
@ -1457,6 +1560,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
clockSel=5;
altered=true;
}
ImGui::Unindent();
if (altered) {
e->lockSave([&]() {
@ -1489,6 +1593,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
}
ImGui::Text("Interpolation:");
ImGui::Indent();
if (ImGui::RadioButton("None",interpolation==0)) {
interpolation=0;
altered=true;
@ -1505,6 +1610,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
interpolation=3;
altered=true;
}
ImGui::Unindent();
if (altered) {
e->lockSave([&]() {
@ -1516,7 +1622,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
}
break;
}
case DIV_SYSTEM_SNES: { // TODO: echo
case DIV_SYSTEM_SNES: {
char temp[64];
int vsL=127-(flags.getInt("volScaleL",0)&127);
int vsR=127-(flags.getInt("volScaleR",0)&127);
@ -1564,7 +1670,13 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
}
altered=true;
}
if (i<7) ImGui::SameLine();
if (i<7) {
if (fromMenu) {
ImGui::SameLine();
} else {
sameLineMaybe();
}
}
}
if (CWSliderInt("Delay##EchoDelay",&echoDelay,0,15)) {
@ -1735,6 +1847,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
}
ImGui::Text("Envelope mode (channel 1-4):");
ImGui::Indent();
if (ImGui::RadioButton("Capacitor (attack/decay)##EM00",groupEnv[0])) {
groupEnv[0]=true;
altered=true;
@ -1743,8 +1856,10 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
groupEnv[0]=false;
altered=true;
}
ImGui::Unindent();
ImGui::Text("Envelope mode (channel 5-8):");
ImGui::Indent();
if (ImGui::RadioButton("Capacitor (attack/decay)##EM10",groupEnv[1])) {
groupEnv[1]=true;
altered=true;
@ -1753,6 +1868,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
groupEnv[1]=false;
altered=true;
}
ImGui::Unindent();
ImGui::Text("Global vibrato:");
@ -1828,6 +1944,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
bool romMode=flags.getBool("romMode",false);
ImGui::Text("Waveform storage mode:");
ImGui::Indent();
if (ImGui::RadioButton("RAM",!romMode)) {
romMode=false;
altered=true;
@ -1836,6 +1953,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
romMode=true;
altered=true;
}
ImGui::Unindent();
if (altered) {
e->lockSave([&]() {
@ -1891,6 +2009,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
int clockSel=flags.getInt("clockSel",0);
ImGui::Text("Clock rate:");
ImGui::Indent();
if (ImGui::RadioButton("3.58MHz (NTSC)",clockSel==0)) {
clockSel=0;
altered=true;
@ -1899,6 +2018,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
clockSel=1;
altered=true;
}
ImGui::Unindent();
if (altered) {
e->lockSave([&]() {
@ -1913,6 +2033,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
ImGui::Text("Clock rate:");
ImGui::Indent();
if (ImGui::RadioButton("NTSC (1.79MHz)",clockSel==0)) {
clockSel=0;
altered=true;
@ -1921,9 +2042,11 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
clockSel=1;
altered=true;
}
ImGui::Unindent();
ImGui::Text("Global parameter priority:");
ImGui::Indent();
if (ImGui::RadioButton("Left to right",!keyPriority)) {
keyPriority=false;
altered=true;
@ -1932,6 +2055,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
keyPriority=true;
altered=true;
}
ImGui::Unindent();
if (altered) {
e->lockSave([&]() {
@ -1948,6 +2072,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
case DIV_SYSTEM_GA20:
case DIV_SYSTEM_PV1000:
case DIV_SYSTEM_VERA:
case DIV_SYSTEM_C140:
break;
case DIV_SYSTEM_YMU759:
supportsCustomRate=false;
@ -1982,11 +2107,13 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
}
altered=true;
}
ImGui::Indent();
if (ImGui::InputInt("Hz",&customClock)) {
if (customClock<MIN_CUSTOM_CLOCK) customClock=0;
if (customClock>MAX_CUSTOM_CLOCK) customClock=MAX_CUSTOM_CLOCK;
altered=true;
}
ImGui::Unindent();
if (altered) {
e->lockSave([&]() {

View file

@ -60,8 +60,7 @@ bool FurnaceGUI::parseSysEx(unsigned char* data, size_t len) {
op.rs=reader.readC();
reader.readC(); // EBS - ignore
op.am=reader.readC();
// TODO: don't ignore after I add KVS to Furnace
reader.readC(); // KVS - ignore
op.kvs=(reader.readC()>2)?1:0;
op.tl=3+((99-reader.readC())*124)/99;
unsigned char freq=reader.readC();
logV("OP%d freq: %d",i,freq);

View file

@ -156,9 +156,15 @@ const char* FurnaceGUI::getSystemPartNumber(DivSystem sys, DivConfig& flags) {
return "YM3812";
break;
case DIV_SYSTEM_OPL3:
case DIV_SYSTEM_OPL3_DRUMS:
return "YMF262";
case DIV_SYSTEM_OPL3_DRUMS:{
int chipType=flags.getInt("chipType",0);
if (chipType==1) {
return "YMF289B";
} else {
return "YMF262";
}
break;
}
case DIV_SYSTEM_OPL4:
case DIV_SYSTEM_OPL4_DRUMS:
return "YMF278";
@ -265,6 +271,9 @@ const char* FurnaceGUI::getSystemPartNumber(DivSystem sys, DivConfig& flags) {
case DIV_SYSTEM_TED:
return "TED";
break;
case DIV_SYSTEM_C140:
return "C140";
break;
default:
return FurnaceGUI::getSystemName(sys);
break;

View file

@ -593,6 +593,7 @@ void FurnaceGUI::drawWaveEdit() {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("Duty");
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
@ -602,6 +603,7 @@ void FurnaceGUI::drawWaveEdit() {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("Exponent");
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
@ -611,6 +613,7 @@ void FurnaceGUI::drawWaveEdit() {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("XOR Point");
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
@ -630,6 +633,7 @@ void FurnaceGUI::drawWaveEdit() {
for (int i=0; i<16; i++) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("%d",i+1);
ImGui::TableNextColumn();
ImGui::PushID(140+i);
@ -683,6 +687,7 @@ void FurnaceGUI::drawWaveEdit() {
for (int i=0; i<4; i++) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("%d",i+1);
ImGui::TableNextColumn();
@ -727,6 +732,7 @@ void FurnaceGUI::drawWaveEdit() {
for (int i=0; i<4; i++) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("%d",i+1);
ImGui::TableNextColumn();
@ -760,6 +766,7 @@ void FurnaceGUI::drawWaveEdit() {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("1");
ImGui::TableNextColumn();
if (ImGui::Checkbox("##ConO1",&waveGenFMCon0[0])) {
@ -784,6 +791,7 @@ void FurnaceGUI::drawWaveEdit() {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("2");
ImGui::TableNextColumn();
if (ImGui::Checkbox("##Con11",&waveGenFMCon1[0])) {
@ -808,6 +816,7 @@ void FurnaceGUI::drawWaveEdit() {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("3");
ImGui::TableNextColumn();
if (ImGui::Checkbox("##Con21",&waveGenFMCon2[0])) {
@ -832,6 +841,7 @@ void FurnaceGUI::drawWaveEdit() {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("4");
ImGui::TableNextColumn();
if (ImGui::Checkbox("##Con31",&waveGenFMCon3[0])) {

View file

@ -208,6 +208,9 @@ TAParamResult pVersion(String) {
printf("- MAME GA20 core by Acho A. Tang, R. Belmont, Valley Bell (BSD 3-clause)\n");
printf("- Atari800 mzpokeysnd POKEY emulator by Michael Borisov (GPLv2)\n");
printf("- ASAP POKEY emulator by Piotr Fusik ported to C++ by laoo (GPLv2)\n");
printf("- SM8521 emulator (modified version) by cam900 (zlib license)\n");
printf("- D65010G031 emulator (modified version) by cam900 (zlib license)\n");
printf("- C140 emulator (modified version) by cam900 (zlib license)\n");
return TA_PARAM_QUIT;
}