Merge branch 'master' into ymf289b
This commit is contained in:
commit
b58fe36356
228 changed files with 8248 additions and 3664 deletions
|
|
@ -237,56 +237,60 @@ bool DivConfig::loadFromBase64(const char* buf) {
|
|||
}
|
||||
|
||||
bool DivConfig::getBool(String key, bool fallback) const {
|
||||
try {
|
||||
String val=conf.at(key);
|
||||
if (val=="true") {
|
||||
auto val=conf.find(key);
|
||||
if (val!=conf.cend()) {
|
||||
if (val->second=="true") {
|
||||
return true;
|
||||
} else if (val=="false") {
|
||||
} else if (val->second=="false") {
|
||||
return false;
|
||||
}
|
||||
} catch (std::out_of_range& e) {
|
||||
}
|
||||
return fallback;
|
||||
}
|
||||
|
||||
int DivConfig::getInt(String key, int fallback) const {
|
||||
try {
|
||||
String val=conf.at(key);
|
||||
int ret=std::stoi(val);
|
||||
return ret;
|
||||
} catch (std::out_of_range& e) {
|
||||
} catch (std::invalid_argument& e) {
|
||||
auto val=conf.find(key);
|
||||
if (val!=conf.cend()) {
|
||||
try {
|
||||
int ret=std::stoi(val->second);
|
||||
return ret;
|
||||
} catch (std::out_of_range& e) {
|
||||
} catch (std::invalid_argument& e) {
|
||||
}
|
||||
}
|
||||
return fallback;
|
||||
}
|
||||
|
||||
float DivConfig::getFloat(String key, float fallback) const {
|
||||
try {
|
||||
String val=conf.at(key);
|
||||
float ret=std::stof(val);
|
||||
return ret;
|
||||
} catch (std::out_of_range& e) {
|
||||
} catch (std::invalid_argument& e) {
|
||||
auto val=conf.find(key);
|
||||
if (val!=conf.cend()) {
|
||||
try {
|
||||
float ret=std::stof(val->second);
|
||||
return ret;
|
||||
} catch (std::out_of_range& e) {
|
||||
} catch (std::invalid_argument& e) {
|
||||
}
|
||||
}
|
||||
return fallback;
|
||||
}
|
||||
|
||||
double DivConfig::getDouble(String key, double fallback) const {
|
||||
try {
|
||||
String val=conf.at(key);
|
||||
double ret=std::stod(val);
|
||||
return ret;
|
||||
} catch (std::out_of_range& e) {
|
||||
} catch (std::invalid_argument& e) {
|
||||
auto val=conf.find(key);
|
||||
if (val!=conf.cend()) {
|
||||
try {
|
||||
double ret=std::stod(val->second);
|
||||
return ret;
|
||||
} catch (std::out_of_range& e) {
|
||||
} catch (std::invalid_argument& e) {
|
||||
}
|
||||
}
|
||||
return fallback;
|
||||
}
|
||||
|
||||
String DivConfig::getString(String key, String fallback) const {
|
||||
try {
|
||||
String val=conf.at(key);
|
||||
return val;
|
||||
} catch (std::out_of_range& e) {
|
||||
auto val=conf.find(key);
|
||||
if (val!=conf.cend()) {
|
||||
return val->second;
|
||||
}
|
||||
return fallback;
|
||||
}
|
||||
|
|
@ -294,37 +298,34 @@ String DivConfig::getString(String key, String fallback) const {
|
|||
std::vector<int> DivConfig::getIntList(String key, std::initializer_list<int> fallback) const {
|
||||
String next;
|
||||
std::vector<int> ret;
|
||||
try {
|
||||
String val=conf.at(key);
|
||||
|
||||
for (char i: val) {
|
||||
if (i==',') {
|
||||
auto val=conf.find(key);
|
||||
if (val!=conf.cend()) {
|
||||
try {
|
||||
for (char i: val->second) {
|
||||
if (i==',') {
|
||||
int num=std::stoi(next);
|
||||
ret.push_back(num);
|
||||
next="";
|
||||
} else {
|
||||
next+=i;
|
||||
}
|
||||
}
|
||||
if (!next.empty()) {
|
||||
int num=std::stoi(next);
|
||||
ret.push_back(num);
|
||||
next="";
|
||||
} else {
|
||||
next+=i;
|
||||
}
|
||||
}
|
||||
if (!next.empty()) {
|
||||
int num=std::stoi(next);
|
||||
ret.push_back(num);
|
||||
}
|
||||
|
||||
return ret;
|
||||
} catch (std::out_of_range& e) {
|
||||
} catch (std::invalid_argument& e) {
|
||||
return ret;
|
||||
} catch (std::out_of_range& e) {
|
||||
} catch (std::invalid_argument& e) {
|
||||
}
|
||||
}
|
||||
return fallback;
|
||||
}
|
||||
|
||||
bool DivConfig::has(String key) const {
|
||||
try {
|
||||
String test=conf.at(key);
|
||||
} catch (std::out_of_range& e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
auto val=conf.find(key);
|
||||
return (val!=conf.cend());
|
||||
}
|
||||
|
||||
void DivConfig::set(String key, bool value) {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@
|
|||
#include "platform/sm8521.h"
|
||||
#include "platform/pv1000.h"
|
||||
#include "platform/k053260.h"
|
||||
#include "platform/ted.h"
|
||||
#include "platform/pcmdac.h"
|
||||
#include "platform/dummy.h"
|
||||
#include "../ta-log.h"
|
||||
|
|
@ -215,13 +216,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) {
|
||||
|
|
@ -478,7 +472,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:
|
||||
|
|
@ -507,6 +501,9 @@ void DivDispatchContainer::init(DivSystem sys, DivEngine* eng, int chanCount, do
|
|||
case DIV_SYSTEM_K053260:
|
||||
dispatch=new DivPlatformK053260;
|
||||
break;
|
||||
case DIV_SYSTEM_TED:
|
||||
dispatch=new DivPlatformTED;
|
||||
break;
|
||||
case DIV_SYSTEM_PCM_DAC:
|
||||
dispatch=new DivPlatformPCMDAC;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
@ -927,12 +927,13 @@ void DivEngine::runExportThread() {
|
|||
}
|
||||
}
|
||||
|
||||
float* outBuf[2];
|
||||
float* outBuf[DIV_MAX_OUTPUTS];
|
||||
memset(outBuf,0,sizeof(void*)*DIV_MAX_OUTPUTS);
|
||||
outBuf[0]=new float[EXPORT_BUFSIZE];
|
||||
outBuf[1]=new float[EXPORT_BUFSIZE];
|
||||
short* sysBuf[DIV_MAX_CHIPS];
|
||||
for (int i=0; i<song.systemLen; i++) {
|
||||
sysBuf[i]=new short[EXPORT_BUFSIZE*2];
|
||||
sysBuf[i]=new short[EXPORT_BUFSIZE*disCont[i].dispatch->getOutputCount()];
|
||||
}
|
||||
|
||||
// take control of audio output
|
||||
|
|
@ -3112,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;
|
||||
|
|
@ -3850,6 +3853,23 @@ void DivEngine::delSample(int index) {
|
|||
song.sampleLen=song.sample.size();
|
||||
removeAsset(song.sampleDir,index);
|
||||
checkAssetDir(song.sampleDir,song.sample.size());
|
||||
|
||||
// compensate
|
||||
for (DivInstrument* i: song.ins) {
|
||||
if (i->amiga.initSample==index) {
|
||||
i->amiga.initSample=-1;
|
||||
} else if (i->amiga.initSample>index) {
|
||||
i->amiga.initSample--;
|
||||
}
|
||||
for (int j=0; j<120; j++) {
|
||||
if (i->amiga.noteMap[j].map==index) {
|
||||
i->amiga.noteMap[j].map=-1;
|
||||
} else if (i->amiga.noteMap[j].map>index) {
|
||||
i->amiga.noteMap[j].map--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
renderSamples();
|
||||
}
|
||||
saveLock.unlock();
|
||||
|
|
@ -4041,6 +4061,27 @@ void DivEngine::exchangeIns(int one, int two) {
|
|||
}
|
||||
}
|
||||
|
||||
void DivEngine::exchangeWave(int one, int two) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void DivEngine::exchangeSample(int one, int two) {
|
||||
for (DivInstrument* i: song.ins) {
|
||||
if (i->amiga.initSample==one) {
|
||||
i->amiga.initSample=two;
|
||||
} else if (i->amiga.initSample==two) {
|
||||
i->amiga.initSample=one;
|
||||
}
|
||||
for (int j=0; j<120; j++) {
|
||||
if (i->amiga.noteMap[j].map==one) {
|
||||
i->amiga.noteMap[j].map=two;
|
||||
} else if (i->amiga.noteMap[j].map==two) {
|
||||
i->amiga.noteMap[j].map=one;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool DivEngine::moveInsUp(int which) {
|
||||
if (which<1 || which>=(int)song.ins.size()) return false;
|
||||
BUSY_BEGIN;
|
||||
|
|
@ -4063,6 +4104,7 @@ bool DivEngine::moveWaveUp(int which) {
|
|||
song.wave[which]=song.wave[which-1];
|
||||
song.wave[which-1]=prev;
|
||||
moveAsset(song.waveDir,which,which-1);
|
||||
exchangeWave(which,which-1);
|
||||
saveLock.unlock();
|
||||
BUSY_END;
|
||||
return true;
|
||||
|
|
@ -4079,6 +4121,7 @@ bool DivEngine::moveSampleUp(int which) {
|
|||
song.sample[which]=song.sample[which-1];
|
||||
song.sample[which-1]=prev;
|
||||
moveAsset(song.sampleDir,which,which-1);
|
||||
exchangeSample(which,which-1);
|
||||
saveLock.unlock();
|
||||
renderSamples();
|
||||
BUSY_END;
|
||||
|
|
@ -4106,6 +4149,7 @@ bool DivEngine::moveWaveDown(int which) {
|
|||
saveLock.lock();
|
||||
song.wave[which]=song.wave[which+1];
|
||||
song.wave[which+1]=prev;
|
||||
exchangeWave(which,which+1);
|
||||
moveAsset(song.waveDir,which,which+1);
|
||||
saveLock.unlock();
|
||||
BUSY_END;
|
||||
|
|
@ -4122,6 +4166,7 @@ bool DivEngine::moveSampleDown(int which) {
|
|||
saveLock.lock();
|
||||
song.sample[which]=song.sample[which+1];
|
||||
song.sample[which+1]=prev;
|
||||
exchangeSample(which,which+1);
|
||||
moveAsset(song.sampleDir,which,which+1);
|
||||
saveLock.unlock();
|
||||
renderSamples();
|
||||
|
|
|
|||
|
|
@ -56,8 +56,8 @@
|
|||
|
||||
#define DIV_UNSTABLE
|
||||
|
||||
#define DIV_VERSION "dev164"
|
||||
#define DIV_ENGINE_VERSION 164
|
||||
#define DIV_VERSION "dev165"
|
||||
#define DIV_ENGINE_VERSION 165
|
||||
// for imports
|
||||
#define DIV_VERSION_MOD 0xff01
|
||||
#define DIV_VERSION_FC 0xff02
|
||||
|
|
@ -531,6 +531,9 @@ class DivEngine {
|
|||
void initSongWithDesc(const char* description, bool inBase64=true, bool oldVol=false);
|
||||
|
||||
void exchangeIns(int one, int two);
|
||||
void exchangeWave(int one, int two);
|
||||
void exchangeSample(int one, int two);
|
||||
|
||||
void swapChannels(int src, int dest);
|
||||
void stompChannel(int ch);
|
||||
|
||||
|
|
@ -602,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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
@ -1937,8 +1939,8 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
|
|||
ds.system[i]=systemFromFileFur(sysID);
|
||||
logD("- %d: %.2x (%s)",i,sysID,getSystemName(ds.system[i]));
|
||||
if (sysID!=0 && systemToFileFur(ds.system[i])==0) {
|
||||
logE("unrecognized system ID %.2x",ds.system[i]);
|
||||
lastError=fmt::sprintf("unrecognized system ID %.2x!",ds.system[i]);
|
||||
logE("unrecognized system ID %.2x",sysID);
|
||||
lastError=fmt::sprintf("unrecognized system ID %.2x!",sysID);
|
||||
delete[] file;
|
||||
return false;
|
||||
}
|
||||
|
|
@ -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();
|
||||
|
|
@ -2941,6 +2943,15 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
|
|||
}
|
||||
}
|
||||
|
||||
// Namco 163 pitch compensation compat
|
||||
if (ds.version<165) {
|
||||
for (int i=0; i<ds.systemLen; i++) {
|
||||
if (ds.system[i]==DIV_SYSTEM_N163) {
|
||||
ds.systemFlags[i].set("lenCompensate",true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (active) quitDispatch();
|
||||
BUSY_BEGIN_SOFT;
|
||||
saveLock.lock();
|
||||
|
|
|
|||
|
|
@ -961,6 +961,8 @@ void DivInstrument::putInsData2(SafeWriter* w, bool fui, const DivSong* song) {
|
|||
featureSM=true;
|
||||
featureSL=true;
|
||||
break;
|
||||
case DIV_INS_TED:
|
||||
break;
|
||||
|
||||
case DIV_INS_MAX:
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -81,6 +81,8 @@ enum DivInstrumentType: unsigned short {
|
|||
DIV_INS_SM8521=48,
|
||||
DIV_INS_PV1000=49,
|
||||
DIV_INS_K053260=50,
|
||||
// DIV_INS_YMF292=51,
|
||||
DIV_INS_TED=52,
|
||||
DIV_INS_MAX,
|
||||
DIV_INS_NULL
|
||||
};
|
||||
|
|
|
|||
|
|
@ -86,6 +86,10 @@ bool DivDispatch::keyOffAffectsPorta(int ch) {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool DivDispatch::isVolGlobal() {
|
||||
return false;
|
||||
}
|
||||
|
||||
int DivDispatch::getPortaFloor(int ch) {
|
||||
return 0x00;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -809,6 +809,8 @@ void DivPlatformAmiga::setFlags(const DivConfig& flags) {
|
|||
} else {
|
||||
chipClock=COLOR_NTSC;
|
||||
}
|
||||
CHECK_CUSTOM_CLOCK;
|
||||
|
||||
rate=chipClock/AMIGA_DIVIDER;
|
||||
for (int i=0; i<4; i++) {
|
||||
oscBuf[i]->rate=rate;
|
||||
|
|
|
|||
|
|
@ -566,6 +566,10 @@ bool DivPlatformC64::getWantPreNote() {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool DivPlatformC64::isVolGlobal() {
|
||||
return true;
|
||||
}
|
||||
|
||||
float DivPlatformC64::getPostAmp() {
|
||||
return (sidCore==1)?3.0f:1.0f;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -360,26 +360,6 @@ void DivPlatformES5506::tick(bool sysTick) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (chan[i].pcm.isNoteMap) {
|
||||
// note map macros
|
||||
if (chan[i].std.wave.had) {
|
||||
if (chan[i].std.wave.val>=0 && chan[i].std.wave.val<120) {
|
||||
if (chan[i].pcm.next!=chan[i].std.wave.val) {
|
||||
chan[i].pcm.next=chan[i].std.wave.val;
|
||||
chan[i].pcmChanged.index=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (!chan[i].pcm.isNoteMap) {
|
||||
if (chan[i].std.wave.had) {
|
||||
if (chan[i].std.wave.val>=0 && chan[i].std.wave.val<parent->song.sampleLen) {
|
||||
if (chan[i].pcm.next!=chan[i].std.wave.val) {
|
||||
chan[i].pcm.next=chan[i].std.wave.val;
|
||||
chan[i].pcmChanged.index=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// update registers
|
||||
if (chan[i].volChanged.changed) {
|
||||
// calculate volume (16 bit)
|
||||
|
|
@ -432,7 +412,7 @@ void DivPlatformES5506::tick(bool sysTick) {
|
|||
off=(double)center/8363.0;
|
||||
}
|
||||
if (ins->amiga.useNoteMap) {
|
||||
chan[i].pcm.note=next;
|
||||
//chan[i].pcm.note=next;
|
||||
}
|
||||
// get loop mode
|
||||
DivSampleLoopMode loopMode=s->isLoopable()?s->loopMode:DIV_SAMPLE_LOOP_MAX;
|
||||
|
|
@ -748,13 +728,13 @@ int DivPlatformES5506::dispatch(DivCommand c) {
|
|||
if (((ins->amiga.useNoteMap) && (c.value>=0 && c.value<120)) ||
|
||||
((!ins->amiga.useNoteMap) && (ins->amiga.initSample>=0 && ins->amiga.initSample<parent->song.sampleLen))) {
|
||||
int sample=ins->amiga.getSample(c.value);
|
||||
c.value=ins->amiga.getFreq(c.value);
|
||||
if (sample>=0 && sample<parent->song.sampleLen) {
|
||||
sampleValid=true;
|
||||
chan[c.chan].volMacroMax=ins->type==DIV_INS_AMIGA?64:0xfff;
|
||||
chan[c.chan].panMacroMax=ins->type==DIV_INS_AMIGA?127:0xfff;
|
||||
chan[c.chan].pcm.note=c.value;
|
||||
chan[c.chan].pcm.next=ins->amiga.useNoteMap?c.value:sample;
|
||||
c.value=ins->amiga.getFreq(c.value);
|
||||
chan[c.chan].pcm.note=c.value;
|
||||
chan[c.chan].filter=ins->es5506.filter;
|
||||
chan[c.chan].envelope=ins->es5506.envelope;
|
||||
}
|
||||
|
|
@ -870,20 +850,6 @@ int DivPlatformES5506::dispatch(DivCommand c) {
|
|||
chan[c.chan].pitch=c.value;
|
||||
chan[c.chan].freqChanged=true;
|
||||
break;
|
||||
// sample commands
|
||||
case DIV_CMD_WAVE:
|
||||
if (!chan[c.chan].useWave) {
|
||||
if (chan[c.chan].active) {
|
||||
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_ES5506);
|
||||
if (((ins->amiga.useNoteMap) && (c.value>=0 && c.value<120)) ||
|
||||
((!ins->amiga.useNoteMap) && (c.value>=0 && c.value<parent->song.sampleLen))) {
|
||||
chan[c.chan].pcm.next=c.value;
|
||||
chan[c.chan].pcmChanged.index=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
// reserved for useWave
|
||||
break;
|
||||
// Filter commands
|
||||
case DIV_CMD_ES5506_FILTER_MODE:
|
||||
if (!chan[c.chan].active) {
|
||||
|
|
@ -1253,6 +1219,7 @@ int DivPlatformES5506::init(DivEngine* p, int channels, int sugRate, const DivCo
|
|||
dumpWrites=false;
|
||||
skipRegisterWrites=false;
|
||||
volScale=0;
|
||||
curPage=0;
|
||||
|
||||
for (int i=0; i<32; i++) {
|
||||
isMuted[i]=false;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
@ -255,7 +254,7 @@ void DivPlatformGB::tick(bool sysTick) {
|
|||
chan[i].sweepChanged=true;
|
||||
break;
|
||||
case DivInstrumentGB::DIV_GB_HWCMD_WAIT:
|
||||
chan[i].hwSeqDelay=data+1;
|
||||
chan[i].hwSeqDelay=(data+1)*parent->tickMult;
|
||||
leave=true;
|
||||
break;
|
||||
case DivInstrumentGB::DIV_GB_HWCMD_WAIT_REL:
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -56,10 +56,10 @@ void DivPlatformMSM5232::acquire(short** buf, size_t len) {
|
|||
|
||||
for (int i=0; i<8; i++) {
|
||||
int o=(
|
||||
((regPool[12+(i>>4)]&1)?((msm->vo16[i]*partVolume[3+(i&4)])>>8):0)+
|
||||
((regPool[12+(i>>4)]&2)?((msm->vo8[i]*partVolume[2+(i&4)])>>8):0)+
|
||||
((regPool[12+(i>>4)]&4)?((msm->vo4[i]*partVolume[1+(i&4)])>>8):0)+
|
||||
((regPool[12+(i>>4)]&8)?((msm->vo2[i]*partVolume[i&4])>>8):0)
|
||||
((regPool[12+(i>>2)]&1)?((msm->vo16[i]*partVolume[3+(i&4)])>>8):0)+
|
||||
((regPool[12+(i>>2)]&2)?((msm->vo8[i]*partVolume[2+(i&4)])>>8):0)+
|
||||
((regPool[12+(i>>2)]&4)?((msm->vo4[i]*partVolume[1+(i&4)])>>8):0)+
|
||||
((regPool[12+(i>>2)]&8)?((msm->vo2[i]*partVolume[i&4])>>8):0)
|
||||
)<<2;
|
||||
oscBuf[i]->data[oscBuf[i]->needle++]=CLAMP(o,-32768,32767);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,10 +31,6 @@ const char** DivPlatformMSM6258::getRegisterSheet() {
|
|||
}
|
||||
|
||||
void DivPlatformMSM6258::acquire(short** buf, size_t len) {
|
||||
short* outs[2]={
|
||||
&msmOut,
|
||||
NULL
|
||||
};
|
||||
for (size_t h=0; h<len; h++) {
|
||||
if (--msmClockCount<0) {
|
||||
if (--msmDividerCount<=0) {
|
||||
|
|
@ -71,7 +67,7 @@ void DivPlatformMSM6258::acquire(short** buf, size_t len) {
|
|||
}
|
||||
}
|
||||
|
||||
msm->sound_stream_update(outs,1);
|
||||
msm->sound_stream_update(&msmOut,1);
|
||||
msmDividerCount=msmDivider;
|
||||
}
|
||||
msmClockCount=msmClock;
|
||||
|
|
@ -390,6 +386,9 @@ int DivPlatformMSM6258::init(DivEngine* p, int channels, int sugRate, const DivC
|
|||
oscBuf[i]=new DivDispatchOscBuffer;
|
||||
}
|
||||
msm=new okim6258_device(4000000);
|
||||
msm->set_start_div(okim6258_device::FOSC_DIV_BY_1024);
|
||||
msm->set_type(okim6258_device::TYPE_4BITS);
|
||||
msm->set_outbits(okim6258_device::OUTPUT_12BITS);
|
||||
msm->device_start();
|
||||
setFlags(flags);
|
||||
reset();
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ class DivPlatformMSM6258: public DivDispatch {
|
|||
};
|
||||
FixedQueue<QueuedWrite,256> writes;
|
||||
okim6258_device* msm;
|
||||
unsigned char lastBusy;
|
||||
|
||||
unsigned char sampleBank, msmPan, msmDivider, rateSel, msmClock, clockSel;
|
||||
signed char msmDividerCount, msmClockCount;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
rWriteMask(0x78-(c<<3)+(a&7),v,m) \
|
||||
}
|
||||
|
||||
#define CHIP_FREQBASE (15*32768)
|
||||
#define CHIP_FREQBASE (15*524288)
|
||||
|
||||
const char* regCheatSheetN163[]={
|
||||
"FreqL7", "40",
|
||||
|
|
@ -256,7 +256,12 @@ void DivPlatformN163::tick(bool sysTick) {
|
|||
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
|
||||
// TODO: what is this mess?
|
||||
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,chipClock,CHIP_FREQBASE);
|
||||
chan[i].freq=(((chan[i].freq*chan[i].curWaveLen)*(chanMax+1))/16);
|
||||
if (lenCompensate) {
|
||||
chan[i].freq=(((chan[i].freq*chan[i].curWaveLen)*(chanMax+1))/256);
|
||||
} else {
|
||||
chan[i].freq*=(chanMax+1);
|
||||
chan[i].freq>>=3;
|
||||
}
|
||||
if (chan[i].freq<0) chan[i].freq=0;
|
||||
if (chan[i].freq>0x3ffff) chan[i].freq=0x3ffff;
|
||||
if (chan[i].keyOn) {
|
||||
|
|
@ -359,13 +364,13 @@ int DivPlatformN163::dispatch(DivCommand c) {
|
|||
int destFreq=NOTE_FREQUENCY(c.value2);
|
||||
bool return2=false;
|
||||
if (destFreq>chan[c.chan].baseFreq) {
|
||||
chan[c.chan].baseFreq+=c.value;
|
||||
chan[c.chan].baseFreq+=c.value*((parent->song.linearPitch==2)?1:16);
|
||||
if (chan[c.chan].baseFreq>=destFreq) {
|
||||
chan[c.chan].baseFreq=destFreq;
|
||||
return2=true;
|
||||
}
|
||||
} else {
|
||||
chan[c.chan].baseFreq-=c.value;
|
||||
chan[c.chan].baseFreq-=c.value*((parent->song.linearPitch==2)?1:16);
|
||||
if (chan[c.chan].baseFreq<=destFreq) {
|
||||
chan[c.chan].baseFreq=destFreq;
|
||||
return2=true;
|
||||
|
|
@ -570,6 +575,8 @@ void DivPlatformN163::setFlags(const DivConfig& flags) {
|
|||
oscBuf[i]->rate=rate/(initChanMax+1);
|
||||
}
|
||||
|
||||
lenCompensate=flags.getBool("lenCompensate",false);
|
||||
|
||||
// needed to make sure changing channel count won't trigger glitches
|
||||
reset();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ class DivPlatformN163: public DivDispatch {
|
|||
unsigned char initChanMax;
|
||||
unsigned char chanMax;
|
||||
short loadWave, loadPos;
|
||||
bool multiplex;
|
||||
bool multiplex, lenCompensate;
|
||||
|
||||
n163_core n163;
|
||||
unsigned char regPool[128];
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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,13 +232,16 @@ void DivPlatformOPLL::tick(bool sysTick) {
|
|||
if (i>=6 && properDrums) {
|
||||
drumState&=~(0x10>>(i-6));
|
||||
immWrite(0x0e,0x20|drumState);
|
||||
} 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);
|
||||
} else {
|
||||
if (i<9) {
|
||||
immWrite(0x20+i,(chan[i].freqH)|(chan[i].state.alg?0x20:0));
|
||||
}
|
||||
//logV("normal %d",i);
|
||||
}
|
||||
//chan[i].keyOn=false;
|
||||
chan[i].keyOff=false;
|
||||
|
|
@ -253,7 +258,7 @@ void DivPlatformOPLL::tick(bool sysTick) {
|
|||
for (int i=0; i<11; i++) {
|
||||
if (chan[i].freqChanged) {
|
||||
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,octave(chan[i].baseFreq)*2,chan[i].pitch2,chipClock,CHIP_FREQBASE);
|
||||
if (chan[i].fixedFreq>0) chan[i].freq=chan[i].fixedFreq;
|
||||
if (chan[i].fixedFreq>0 && properDrums) chan[i].freq=chan[i].fixedFreq;
|
||||
if (chan[i].freq<0) chan[i].freq=0;
|
||||
if (chan[i].freq>65535) chan[i].freq=65535;
|
||||
int freqt=toFreq(chan[i].freq);
|
||||
|
|
@ -262,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);
|
||||
}
|
||||
|
|
@ -275,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);
|
||||
|
|
@ -362,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;
|
||||
}
|
||||
|
|
@ -389,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: {
|
||||
|
|
@ -405,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);
|
||||
|
|
@ -426,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;
|
||||
}
|
||||
|
||||
|
|
@ -436,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);
|
||||
|
|
@ -454,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;
|
||||
}
|
||||
|
|
@ -491,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));
|
||||
}
|
||||
|
|
@ -553,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);
|
||||
|
|
@ -768,14 +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);
|
||||
} else {
|
||||
properDrums=false;
|
||||
immWrite(0x0e,0x00);
|
||||
drumState=0;
|
||||
}
|
||||
switchMode(c.value);
|
||||
break;
|
||||
case DIV_CMD_MACRO_OFF:
|
||||
chan[c.chan].std.mask(c.value,true);
|
||||
|
|
@ -830,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);
|
||||
|
|
@ -842,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;
|
||||
}
|
||||
|
|
@ -927,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);
|
||||
}
|
||||
|
|
@ -1002,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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
||||
|
|
|
|||
|
|
@ -283,6 +283,7 @@ void DivPlatformPET::reset() {
|
|||
memset(regPool,0,16);
|
||||
chan[0]=Channel();
|
||||
chan[0].std.setEngine(parent);
|
||||
rWrite(10,chan[0].wave);
|
||||
}
|
||||
|
||||
int DivPlatformPET::getOutputCount() {
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -135,9 +135,9 @@ void okim6258_device::device_reset()
|
|||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void okim6258_device::sound_stream_update(short** outputs, int len)
|
||||
void okim6258_device::sound_stream_update(short* output, int len)
|
||||
{
|
||||
short* buffer = outputs[0];
|
||||
short* buffer = output;
|
||||
|
||||
if (m_status & STATUS_PLAYING)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public:
|
|||
void device_clock_changed();
|
||||
|
||||
// sound stream updates
|
||||
void sound_stream_update(short** outputs, int len);
|
||||
void sound_stream_update(short* output, int len);
|
||||
|
||||
private:
|
||||
int16_t clock_adpcm(uint8_t nibble);
|
||||
|
|
|
|||
231
src/engine/platform/sound/ted-sound.c
Normal file
231
src/engine/platform/sound/ted-sound.c
Normal file
|
|
@ -0,0 +1,231 @@
|
|||
/*
|
||||
* ted-sound.c
|
||||
*
|
||||
* Written by
|
||||
* Andreas Boose <viceteam@t-online.de>
|
||||
* Tibor Biczo <crown @ axelero . hu>
|
||||
* Marco van den Heuvel <blackystardust68@yahoo.com>
|
||||
*
|
||||
* This file is part of VICE, the Versatile Commodore Emulator.
|
||||
* See README for copyright notice.
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA
|
||||
* 02111-1307 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "ted-sound.h"
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/* FIXME: Find proper volume multiplier. */
|
||||
const int16_t volume_tab[16] = {
|
||||
0x0000, 0x0800, 0x1000, 0x1800, 0x2000, 0x2800, 0x3000, 0x3800,
|
||||
0x3fff, 0x3fff, 0x3fff, 0x3fff, 0x3fff, 0x3fff, 0x3fff, 0x3fff
|
||||
};
|
||||
|
||||
int ted_sound_machine_calculate_samples(struct plus4_sound_s* snd, int16_t *pbuf, int nr, int scc)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
int16_t volume;
|
||||
|
||||
if (snd->digital) {
|
||||
for (i = 0; i < nr; i++) {
|
||||
pbuf[i] = (snd->volume * (snd->voice0_output_enabled + snd->voice1_output_enabled));
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < nr; i++) {
|
||||
snd->sample_position_remainder += snd->sample_length_remainder;
|
||||
if (snd->sample_position_remainder >= snd->speed) {
|
||||
snd->sample_position_remainder -= snd->speed;
|
||||
snd->sample_position_integer++;
|
||||
}
|
||||
snd->sample_position_integer += snd->sample_length_integer;
|
||||
if (snd->sample_position_integer >= 8) {
|
||||
/* Advance state engine */
|
||||
uint32_t ticks = snd->sample_position_integer >> 3;
|
||||
if (snd->voice0_accu <= ticks) {
|
||||
uint32_t delay = ticks - snd->voice0_accu;
|
||||
snd->voice0_sign ^= 1;
|
||||
snd->voice0_accu = 1023 - snd->voice0_reload;
|
||||
if (snd->voice0_accu == 0) {
|
||||
snd->voice0_accu = 1024;
|
||||
}
|
||||
if (delay >= snd->voice0_accu) {
|
||||
snd->voice0_sign = ((delay / snd->voice0_accu)
|
||||
& 1) ? snd->voice0_sign ^ 1
|
||||
: snd->voice0_sign;
|
||||
snd->voice0_accu = snd->voice0_accu - (delay % snd->voice0_accu);
|
||||
} else {
|
||||
snd->voice0_accu -= delay;
|
||||
}
|
||||
} else {
|
||||
snd->voice0_accu -= ticks;
|
||||
}
|
||||
|
||||
if (snd->voice1_accu <= ticks) {
|
||||
uint32_t delay = ticks - snd->voice1_accu;
|
||||
snd->voice1_sign ^= 1;
|
||||
snd->noise_shift_register
|
||||
= (snd->noise_shift_register << 1) +
|
||||
( 1 ^ ((snd->noise_shift_register >> 7) & 1) ^
|
||||
((snd->noise_shift_register >> 5) & 1) ^
|
||||
((snd->noise_shift_register >> 4) & 1) ^
|
||||
((snd->noise_shift_register >> 1) & 1));
|
||||
snd->voice1_accu = 1023 - snd->voice1_reload;
|
||||
if (snd->voice1_accu == 0) {
|
||||
snd->voice1_accu = 1024;
|
||||
}
|
||||
if (delay >= snd->voice1_accu) {
|
||||
snd->voice1_sign = ((delay / snd->voice1_accu)
|
||||
& 1) ? snd->voice1_sign ^ 1
|
||||
: snd->voice1_sign;
|
||||
for (j = 0; j < (int)(delay / snd->voice1_accu);
|
||||
j++) {
|
||||
snd->noise_shift_register
|
||||
= (snd->noise_shift_register << 1) +
|
||||
( 1 ^ ((snd->noise_shift_register >> 7) & 1) ^
|
||||
((snd->noise_shift_register >> 5) & 1) ^
|
||||
((snd->noise_shift_register >> 4) & 1) ^
|
||||
((snd->noise_shift_register >> 1) & 1));
|
||||
}
|
||||
snd->voice1_accu = snd->voice1_accu - (delay % snd->voice1_accu);
|
||||
} else {
|
||||
snd->voice1_accu -= delay;
|
||||
}
|
||||
} else {
|
||||
snd->voice1_accu -= ticks;
|
||||
}
|
||||
}
|
||||
snd->sample_position_integer = snd->sample_position_integer & 7;
|
||||
|
||||
volume = 0;
|
||||
|
||||
if (snd->voice0_output_enabled && snd->voice0_sign) {
|
||||
volume += snd->volume;
|
||||
}
|
||||
if (snd->voice1_output_enabled && !snd->noise && snd->voice1_sign) {
|
||||
volume += snd->volume;
|
||||
}
|
||||
if (snd->voice1_output_enabled && snd->noise && (!(snd->noise_shift_register & 1))) {
|
||||
volume += snd->volume;
|
||||
}
|
||||
|
||||
pbuf[i] = volume;
|
||||
}
|
||||
}
|
||||
return nr;
|
||||
}
|
||||
|
||||
int ted_sound_machine_init(struct plus4_sound_s* snd, int speed, int cycles_per_sec)
|
||||
{
|
||||
uint8_t val;
|
||||
memset(snd,0,sizeof(struct plus4_sound_s));
|
||||
|
||||
snd->speed = speed;
|
||||
snd->sample_length_integer = cycles_per_sec / speed;
|
||||
snd->sample_length_remainder = cycles_per_sec % speed;
|
||||
snd->sample_position_integer = 0;
|
||||
snd->sample_position_remainder = 0;
|
||||
snd->noise_shift_register = 0;
|
||||
|
||||
snd->voice0_reload = (snd->plus4_sound_data[0] | (snd->plus4_sound_data[4] << 8));
|
||||
snd->voice1_reload = (snd->plus4_sound_data[1] | (snd->plus4_sound_data[2] << 8));
|
||||
val = snd->plus4_sound_data[3];
|
||||
snd->volume = volume_tab[val & 0x0f];
|
||||
snd->voice0_output_enabled = (val & 0x10) ? 1 : 0;
|
||||
snd->voice1_output_enabled = (val & 0x60) ? 1 : 0;
|
||||
snd->noise = ((val & 0x60) == 0x40) ? 1 : 0;
|
||||
snd->digital = val & 0x80;
|
||||
if (snd->digital) {
|
||||
snd->voice0_sign = 1;
|
||||
snd->voice0_accu = 0;
|
||||
snd->voice1_sign = 1;
|
||||
snd->voice1_accu = 0;
|
||||
snd->noise_shift_register = 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void ted_sound_machine_store(struct plus4_sound_s* snd, uint16_t addr, uint8_t val)
|
||||
{
|
||||
switch (addr) {
|
||||
case 0x0e:
|
||||
snd->plus4_sound_data[0] = val;
|
||||
snd->voice0_reload = (snd->plus4_sound_data[0] | (snd->plus4_sound_data[4] << 8));
|
||||
break;
|
||||
case 0x0f:
|
||||
snd->plus4_sound_data[1] = val;
|
||||
snd->voice1_reload = (snd->plus4_sound_data[1] | (snd->plus4_sound_data[2] << 8));
|
||||
break;
|
||||
case 0x10:
|
||||
snd->plus4_sound_data[2] = val & 3;
|
||||
snd->voice1_reload = (snd->plus4_sound_data[1] | (snd->plus4_sound_data[2] << 8));
|
||||
break;
|
||||
case 0x11:
|
||||
snd->volume = volume_tab[val & 0x0f];
|
||||
snd->voice0_output_enabled = (val & 0x10) ? 1 : 0;
|
||||
snd->voice1_output_enabled = (val & 0x60) ? 1 : 0;
|
||||
snd->noise = ((val & 0x60) == 0x40) ? 1 : 0;
|
||||
snd->digital = val & 0x80;
|
||||
if (snd->digital) {
|
||||
snd->voice0_sign = 1;
|
||||
snd->voice0_accu = 0;
|
||||
snd->voice1_sign = 1;
|
||||
snd->voice1_accu = 0;
|
||||
snd->noise_shift_register = 0;
|
||||
}
|
||||
snd->plus4_sound_data[3] = val;
|
||||
break;
|
||||
case 0x12:
|
||||
snd->plus4_sound_data[4] = val & 3;
|
||||
snd->voice0_reload = (snd->plus4_sound_data[0] | (snd->plus4_sound_data[4] << 8));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t ted_sound_machine_read(struct plus4_sound_s* snd, uint16_t addr)
|
||||
{
|
||||
switch (addr) {
|
||||
case 0x0e:
|
||||
return snd->plus4_sound_data[0];
|
||||
case 0x0f:
|
||||
return snd->plus4_sound_data[1];
|
||||
case 0x10:
|
||||
return snd->plus4_sound_data[2] | 0xc0;
|
||||
case 0x11:
|
||||
return snd->plus4_sound_data[3];
|
||||
case 0x12:
|
||||
return snd->plus4_sound_data[4];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ted_sound_reset(struct plus4_sound_s* snd)
|
||||
{
|
||||
uint16_t i;
|
||||
|
||||
snd->noise_shift_register = 0;
|
||||
for (i = 0x0e; i <= 0x12; i++) {
|
||||
ted_sound_machine_store(snd,i,0);
|
||||
}
|
||||
}
|
||||
81
src/engine/platform/sound/ted-sound.h
Normal file
81
src/engine/platform/sound/ted-sound.h
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* ted-sound.h
|
||||
*
|
||||
* Written by
|
||||
* Andreas Boose <viceteam@t-online.de>
|
||||
* Marco van den Heuvel <blackystardust68@yahoo.com>
|
||||
*
|
||||
* This file is part of VICE, the Versatile Commodore Emulator.
|
||||
* See README for copyright notice.
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA
|
||||
* 02111-1307 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef VICE_TEDSOUND_H
|
||||
#define VICE_TEDSOUND_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct plus4_sound_s {
|
||||
/* Voice 0 collect number of cycles elapsed */
|
||||
uint32_t voice0_accu;
|
||||
/* Voice 0 toggle sign and reload accu if accu reached 0 */
|
||||
uint32_t voice0_reload;
|
||||
/* Voice 0 sign of the square wave */
|
||||
int16_t voice0_sign;
|
||||
uint8_t voice0_output_enabled;
|
||||
|
||||
/* Voice 1 collect number of cycles elapsed */
|
||||
uint32_t voice1_accu;
|
||||
/* Voice 1 toggle sign and reload accu if accu reached 0 */
|
||||
uint32_t voice1_reload;
|
||||
/* Voice 1 sign of the square wave */
|
||||
int16_t voice1_sign;
|
||||
uint8_t voice1_output_enabled;
|
||||
|
||||
/* Volume multiplier */
|
||||
int16_t volume;
|
||||
/* 8 cycles units per sample */
|
||||
uint32_t speed;
|
||||
uint32_t sample_position_integer;
|
||||
uint32_t sample_position_remainder;
|
||||
uint32_t sample_length_integer;
|
||||
uint32_t sample_length_remainder;
|
||||
/* Digital output? */
|
||||
uint8_t digital;
|
||||
/* Noise generator active? */
|
||||
uint8_t noise;
|
||||
uint8_t noise_shift_register;
|
||||
|
||||
/* Registers */
|
||||
uint8_t plus4_sound_data[5];
|
||||
};
|
||||
|
||||
int ted_sound_machine_init(struct plus4_sound_s* snd, int speed, int cycles_per_sec);
|
||||
int ted_sound_machine_calculate_samples(struct plus4_sound_s* snd, int16_t *pbuf, int nr, int sound_chip_channels);
|
||||
void ted_sound_machine_store(struct plus4_sound_s* snd, uint16_t addr, uint8_t val);
|
||||
uint8_t ted_sound_machine_read(struct plus4_sound_s* snd, uint16_t addr);
|
||||
void ted_sound_reset(struct plus4_sound_s* snd);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -626,7 +626,7 @@ void DivPlatformSoundUnit::quit() {
|
|||
delete oscBuf[i];
|
||||
}
|
||||
delete su;
|
||||
delete sampleMem;
|
||||
delete[] sampleMem;
|
||||
}
|
||||
|
||||
DivPlatformSoundUnit::~DivPlatformSoundUnit() {
|
||||
|
|
|
|||
358
src/engine/platform/ted.cpp
Normal file
358
src/engine/platform/ted.cpp
Normal file
|
|
@ -0,0 +1,358 @@
|
|||
/**
|
||||
* 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 "ted.h"
|
||||
#include "../engine.h"
|
||||
#include <math.h>
|
||||
|
||||
//#define rWrite(a,v) pendingWrites[a]=v;
|
||||
#define rWrite(a,v) if (!skipRegisterWrites) {writes.push(QueuedWrite(a,v)); if (dumpWrites) {addWrite(a,v);} }
|
||||
|
||||
#define CHIP_DIVIDER 8
|
||||
|
||||
const char* regCheatSheetTED[]={
|
||||
"Freq0L", "0e",
|
||||
"Freq1L", "0f",
|
||||
"Freq1H", "10",
|
||||
"Control", "11",
|
||||
"Freq0H", "12",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char** DivPlatformTED::getRegisterSheet() {
|
||||
return regCheatSheetTED;
|
||||
}
|
||||
|
||||
void DivPlatformTED::acquire(short** buf, size_t len) {
|
||||
for (size_t h=0; h<len; h++) {
|
||||
while (!writes.empty()) {
|
||||
QueuedWrite w=writes.front();
|
||||
ted_sound_machine_store(&ted,w.addr,w.val);
|
||||
regPool[(w.addr-0x0e)&7]=w.val;
|
||||
writes.pop();
|
||||
}
|
||||
|
||||
ted_sound_machine_calculate_samples(&ted,&buf[0][h],1,1);
|
||||
oscBuf[0]->data[oscBuf[0]->needle++]=(ted.voice0_output_enabled && ted.voice0_sign)?(ted.volume<<1):0;
|
||||
oscBuf[1]->data[oscBuf[1]->needle++]=(ted.voice1_output_enabled && ((ted.noise && (!(ted.noise_shift_register&1))) || (!ted.noise && ted.voice1_sign)))?(ted.volume<<1):0;
|
||||
}
|
||||
}
|
||||
|
||||
void DivPlatformTED::tick(bool sysTick) {
|
||||
bool resetPhase=false;
|
||||
|
||||
for (int _i=0; _i<2; _i++) {
|
||||
int i=chanOrder[_i];
|
||||
|
||||
chan[i].std.next();
|
||||
if (chan[i].std.vol.had) {
|
||||
chan[i].outVol=VOL_SCALE_LINEAR(chan[i].vol,MIN(8,chan[i].std.vol.val),8);
|
||||
updateCtrl=true;
|
||||
vol=chan[i].outVol;
|
||||
}
|
||||
if (chan[i].std.duty.had) {
|
||||
chan[i].noise=chan[i].std.duty.val&2;
|
||||
chan[i].square=chan[i].std.duty.val&1;
|
||||
chan[i].freqChanged=true;
|
||||
updateCtrl=true;
|
||||
}
|
||||
if (NEW_ARP_STRAT) {
|
||||
chan[i].handleArp();
|
||||
} else if (chan[i].std.arp.had) {
|
||||
if (!chan[i].inPorta) {
|
||||
chan[i].baseFreq=NOTE_PERIODIC(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].freqChanged || chan[i].keyOn || chan[i].keyOff) {
|
||||
chan[i].freq=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)-1;
|
||||
if (i==1 && chan[i].noise && !chan[i].square) chan[i].freq>>=4;
|
||||
if (chan[i].freq<0) chan[i].freq=0;
|
||||
if (chan[i].freq>1023) chan[i].freq=1023;
|
||||
|
||||
if (i==1) {
|
||||
rWrite(0x0f,(1022-chan[i].freq)&0xff);
|
||||
rWrite(0x10,((1022-chan[i].freq)>>8)&0xff);
|
||||
} else {
|
||||
rWrite(0x0e,(1022-chan[i].freq)&0xff);
|
||||
rWrite(0x12,((1022-chan[i].freq)>>8)&0xff);
|
||||
}
|
||||
|
||||
if (chan[i].keyOn) {
|
||||
updateCtrl=true;
|
||||
}
|
||||
if (chan[i].keyOff) {
|
||||
updateCtrl=true;
|
||||
}
|
||||
if (chan[i].keyOn) chan[i].keyOn=false;
|
||||
if (chan[i].keyOff) chan[i].keyOff=false;
|
||||
chan[i].freqChanged=false;
|
||||
}
|
||||
if (chan[i].std.phaseReset.had && chan[i].std.phaseReset.val==1) {
|
||||
resetPhase=true;
|
||||
updateCtrl=true;
|
||||
}
|
||||
}
|
||||
|
||||
if (resetPhase) {
|
||||
rWrite(0x11,0x80);
|
||||
}
|
||||
|
||||
if (updateCtrl) {
|
||||
updateCtrl=false;
|
||||
rWrite(0x11,(vol&15)|((chan[0].active && chan[0].square && !isMuted[0])?0x10:0)|((chan[1].active && chan[1].square && !isMuted[1])?0x20:0)|((chan[1].active && chan[1].noise && !isMuted[1])?0x40:0));
|
||||
}
|
||||
}
|
||||
|
||||
int DivPlatformTED::dispatch(DivCommand c) {
|
||||
switch (c.cmd) {
|
||||
case DIV_CMD_NOTE_ON: {
|
||||
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_TED);
|
||||
if (c.value!=DIV_NOTE_NULL) {
|
||||
chan[c.chan].baseFreq=NOTE_PERIODIC(c.value);
|
||||
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].insChanged=false;
|
||||
if (keyPriority) {
|
||||
if (chanOrder[0]==c.chan) {
|
||||
chanOrder[0]=chanOrder[1];
|
||||
chanOrder[1]=c.chan;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DIV_CMD_NOTE_OFF:
|
||||
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;
|
||||
chan[c.chan].insChanged=true;
|
||||
}
|
||||
break;
|
||||
case DIV_CMD_VOLUME:
|
||||
if (chan[c.chan].vol!=c.value) {
|
||||
chan[c.chan].vol=c.value;
|
||||
if (!chan[c.chan].std.vol.has) {
|
||||
chan[c.chan].outVol=c.value;
|
||||
}
|
||||
vol=chan[c.chan].outVol;
|
||||
updateCtrl=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_PITCH:
|
||||
chan[c.chan].pitch=c.value;
|
||||
chan[c.chan].freqChanged=true;
|
||||
break;
|
||||
case DIV_CMD_NOTE_PORTA: {
|
||||
int destFreq=NOTE_PERIODIC(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_STD_NOISE_MODE:
|
||||
chan[c.chan].noise=c.value;
|
||||
chan[c.chan].freqChanged=true;
|
||||
break;
|
||||
case DIV_CMD_LEGATO:
|
||||
chan[c.chan].baseFreq=NOTE_PERIODIC(c.value+((HACKY_LEGATO_MESS)?(chan[c.chan].std.arp.val):(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_TED));
|
||||
}
|
||||
if (!chan[c.chan].inPorta && c.value && !parent->song.brokenPortaArp && chan[c.chan].std.arp.will && !NEW_ARP_STRAT) chan[c.chan].baseFreq=NOTE_PERIODIC(chan[c.chan].note);
|
||||
chan[c.chan].inPorta=c.value;
|
||||
break;
|
||||
case DIV_CMD_GET_VOLMAX:
|
||||
return 8;
|
||||
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 DivPlatformTED::muteChannel(int ch, bool mute) {
|
||||
isMuted[ch]=mute;
|
||||
updateCtrl=true;
|
||||
}
|
||||
|
||||
void DivPlatformTED::forceIns() {
|
||||
for (int i=0; i<2; i++) {
|
||||
chan[i].freqChanged=true;
|
||||
}
|
||||
updateCtrl=true;
|
||||
}
|
||||
|
||||
bool DivPlatformTED::isVolGlobal() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void* DivPlatformTED::getChanState(int ch) {
|
||||
return &chan[ch];
|
||||
}
|
||||
|
||||
DivMacroInt* DivPlatformTED::getChanMacroInt(int ch) {
|
||||
return &chan[ch].std;
|
||||
}
|
||||
|
||||
DivDispatchOscBuffer* DivPlatformTED::getOscBuffer(int ch) {
|
||||
return oscBuf[ch];
|
||||
}
|
||||
|
||||
unsigned char* DivPlatformTED::getRegisterPool() {
|
||||
return regPool;
|
||||
}
|
||||
|
||||
int DivPlatformTED::getRegisterPoolSize() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
void DivPlatformTED::reset() {
|
||||
writes.clear();
|
||||
memset(regPool,0,8);
|
||||
for (int i=0; i<2; i++) {
|
||||
chan[i]=DivPlatformTED::Channel();
|
||||
chan[i].std.setEngine(parent);
|
||||
}
|
||||
if (dumpWrites) {
|
||||
addWrite(0xffffffff,0);
|
||||
}
|
||||
ted_sound_machine_init(&ted,1,8);
|
||||
updateCtrl=true;
|
||||
vol=15;
|
||||
|
||||
chanOrder[0]=0;
|
||||
chanOrder[1]=1;
|
||||
}
|
||||
|
||||
int DivPlatformTED::getOutputCount() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool DivPlatformTED::keyOffAffectsArp(int ch) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void DivPlatformTED::notifyInsDeletion(void* ins) {
|
||||
for (int i=0; i<2; i++) {
|
||||
chan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
||||
}
|
||||
}
|
||||
|
||||
void DivPlatformTED::setFlags(const DivConfig& flags) {
|
||||
if (flags.getInt("clockSel",0)) {
|
||||
chipClock=COLOR_PAL*2.0/5.0;
|
||||
} else {
|
||||
chipClock=COLOR_NTSC/2.0;
|
||||
}
|
||||
CHECK_CUSTOM_CLOCK;
|
||||
rate=chipClock/8;
|
||||
for (int i=0; i<2; i++) {
|
||||
oscBuf[i]->rate=rate;
|
||||
}
|
||||
keyPriority=flags.getBool("keyPriority",true);
|
||||
}
|
||||
|
||||
void DivPlatformTED::poke(unsigned int addr, unsigned short val) {
|
||||
rWrite(addr,val);
|
||||
}
|
||||
|
||||
void DivPlatformTED::poke(std::vector<DivRegWrite>& wlist) {
|
||||
for (DivRegWrite& i: wlist) rWrite(i.addr,i.val);
|
||||
}
|
||||
|
||||
int DivPlatformTED::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
|
||||
parent=p;
|
||||
dumpWrites=false;
|
||||
skipRegisterWrites=false;
|
||||
for (int i=0; i<2; i++) {
|
||||
isMuted[i]=false;
|
||||
oscBuf[i]=new DivDispatchOscBuffer;
|
||||
}
|
||||
setFlags(flags);
|
||||
reset();
|
||||
return 2;
|
||||
}
|
||||
|
||||
void DivPlatformTED::quit() {
|
||||
for (int i=0; i<2; i++) {
|
||||
delete oscBuf[i];
|
||||
}
|
||||
}
|
||||
|
||||
DivPlatformTED::~DivPlatformTED() {
|
||||
}
|
||||
79
src/engine/platform/ted.h
Normal file
79
src/engine/platform/ted.h
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
/**
|
||||
* 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 _TED_H
|
||||
#define _TED_H
|
||||
|
||||
#include "../dispatch.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "sound/ted-sound.h"
|
||||
|
||||
class DivPlatformTED: public DivDispatch {
|
||||
struct Channel: public SharedChannel<signed char> {
|
||||
bool noise, square;
|
||||
Channel():
|
||||
SharedChannel<signed char>(8),
|
||||
noise(false),
|
||||
square(true) {}
|
||||
};
|
||||
Channel chan[2];
|
||||
DivDispatchOscBuffer* oscBuf[2];
|
||||
bool isMuted[2];
|
||||
struct QueuedWrite {
|
||||
unsigned char addr;
|
||||
unsigned char val;
|
||||
QueuedWrite(): addr(0), val(0) {}
|
||||
QueuedWrite(unsigned char a, unsigned char v): addr(a), val(v) {}
|
||||
};
|
||||
FixedQueue<QueuedWrite,64> writes;
|
||||
|
||||
struct plus4_sound_s ted;
|
||||
unsigned char vol;
|
||||
bool updateCtrl, keyPriority;
|
||||
|
||||
unsigned char chanOrder[2];
|
||||
unsigned char regPool[8];
|
||||
friend void putDispatchChip(void*,int);
|
||||
friend void putDispatchChan(void*,int,int);
|
||||
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);
|
||||
unsigned char* getRegisterPool();
|
||||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
int getOutputCount();
|
||||
bool keyOffAffectsArp(int ch);
|
||||
void setFlags(const DivConfig& flags);
|
||||
void notifyInsDeletion(void* ins);
|
||||
void poke(unsigned int addr, unsigned short val);
|
||||
void poke(std::vector<DivRegWrite>& wlist);
|
||||
const char** getRegisterSheet();
|
||||
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
|
||||
void quit();
|
||||
~DivPlatformTED();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -278,6 +278,10 @@ void DivPlatformVIC20::forceIns() {
|
|||
}
|
||||
}
|
||||
|
||||
bool DivPlatformVIC20::isVolGlobal() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void* DivPlatformVIC20::getChanState(int ch) {
|
||||
return &chan[ch];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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++;
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
@ -480,6 +480,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 +490,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;
|
||||
|
|
@ -748,7 +749,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);
|
||||
|
|
@ -1168,7 +1173,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);
|
||||
|
|
|
|||
|
|
@ -128,7 +128,8 @@ enum DivSystem {
|
|||
DIV_SYSTEM_YM2608_CSM,
|
||||
DIV_SYSTEM_SM8521,
|
||||
DIV_SYSTEM_PV1000,
|
||||
DIV_SYSTEM_K053260
|
||||
DIV_SYSTEM_K053260,
|
||||
DIV_SYSTEM_TED
|
||||
};
|
||||
|
||||
enum DivEffectType: unsigned short {
|
||||
|
|
|
|||
|
|
@ -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)"}},
|
||||
|
|
@ -1542,7 +1542,6 @@ void DivEngine::registerSystems() {
|
|||
);
|
||||
|
||||
EffectHandlerMap es5506PreEffectHandlerMap={
|
||||
{0x10, {DIV_CMD_WAVE, "10xx: Change waveform (00 to FF)",effectVal}},
|
||||
{0x11, {DIV_CMD_ES5506_FILTER_MODE, "11xx: Set filter mode (00 to 03)",effectValAnd<3>}},
|
||||
{0x14, {DIV_CMD_ES5506_FILTER_K1, "14xx: Set filter coefficient K1 low byte (00 to FF)",effectValShift<0>,constVal<0x00ff>}},
|
||||
{0x15, {DIV_CMD_ES5506_FILTER_K1, "15xx: Set filter coefficient K1 high byte (00 to FF)",effectValShift<8>,constVal<0xff00>}},
|
||||
|
|
@ -1863,6 +1862,16 @@ void DivEngine::registerSystems() {
|
|||
}
|
||||
);
|
||||
|
||||
sysDefs[DIV_SYSTEM_TED]=new DivSysDef(
|
||||
"MOS Technology TED", NULL, 0xcd, 0, 2, false, true, 0, false, 0,
|
||||
"two square waves (one may be turned into noise). used in the Commodore Plus/4, 16 and 116.",
|
||||
{"Channel 1", "Channel 2"},
|
||||
{"CH1", "CH2"},
|
||||
{DIV_CH_PULSE, DIV_CH_PULSE},
|
||||
{DIV_INS_TED, DIV_INS_TED},
|
||||
{}
|
||||
);
|
||||
|
||||
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.",
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ const char* aboutLine[]={
|
|||
"akumanatt",
|
||||
"cam900",
|
||||
"djtuBIG-MaliceX",
|
||||
"Eknous-P",
|
||||
"laoo",
|
||||
"MooingLemur",
|
||||
"OPNA2608",
|
||||
|
|
@ -83,7 +84,7 @@ const char* aboutLine[]={
|
|||
"djtuBIG-MaliceX",
|
||||
"dumbut",
|
||||
"Eknous-P",
|
||||
"ElectricKeet",
|
||||
"Electric Keet",
|
||||
"EpicTyphlosion",
|
||||
"FΛDE",
|
||||
"Forte",
|
||||
|
|
@ -114,11 +115,13 @@ const char* aboutLine[]={
|
|||
"potatoTeto",
|
||||
"psxdominator",
|
||||
"Raijin",
|
||||
"railzen7",
|
||||
"SnugglyBun",
|
||||
"SuperJet Spade",
|
||||
"SwapXFO",
|
||||
"TakuikaNinja",
|
||||
"TCORPStudios",
|
||||
"Teuthida",
|
||||
"The Blender Fiddler",
|
||||
"TheDuccinator",
|
||||
"theloredev",
|
||||
|
|
@ -135,6 +138,7 @@ const char* aboutLine[]={
|
|||
"ZoomTen (Zumi)",
|
||||
"",
|
||||
"-- additional feedback/fixes --",
|
||||
"Electric Keet",
|
||||
"fd",
|
||||
"GENATARi",
|
||||
"host12prog",
|
||||
|
|
@ -182,6 +186,8 @@ const char* aboutLine[]={
|
|||
"Stella by Stella Team",
|
||||
"QSound emulator by superctr and Valley Bell",
|
||||
"VICE VIC-20 sound core by Rami Rasanen and viznut",
|
||||
"VICE TED sound core by Andreas Boose, Tibor Biczo",
|
||||
"and Marco van den Heuvel",
|
||||
"VERA sound core by Frank van den Hoef",
|
||||
"mzpokeysnd POKEY emulator by Michael Borisov",
|
||||
"ASAP POKEY emulator by Piotr Fusik",
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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")) {
|
||||
|
|
|
|||
|
|
@ -282,6 +282,10 @@ void FurnaceGUI::insListItem(int i, int dir, int asset) {
|
|||
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_INSTR_K053260]);
|
||||
name=fmt::sprintf(ICON_FA_BAR_CHART "##_INS%d",i);
|
||||
break;
|
||||
case DIV_INS_TED:
|
||||
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_INSTR_TED]);
|
||||
name=fmt::sprintf(ICON_FA_BAR_CHART "##_INS%d",i);
|
||||
break;
|
||||
default:
|
||||
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_INSTR_UNKNOWN]);
|
||||
name=fmt::sprintf(ICON_FA_QUESTION "##_INS%d",i);
|
||||
|
|
@ -326,9 +330,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);
|
||||
}
|
||||
|
|
@ -406,13 +407,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");
|
||||
|
|
|
|||
|
|
@ -62,7 +62,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 +166,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 +379,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 +386,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);
|
||||
|
|
|
|||
|
|
@ -486,6 +486,7 @@ void FurnaceGUI::drawDebug() {
|
|||
pgProgram.clear();
|
||||
}
|
||||
|
||||
ImGui::AlignTextToFramePadding();
|
||||
ImGui::Text("Address");
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(100.0f*dpiScale);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
341
src/gui/gui.cpp
341
src/gui/gui.cpp
|
|
@ -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);
|
||||
|
|
@ -98,6 +106,10 @@ const char* FurnaceGUI::noteName(short note, short octave) {
|
|||
if (seek<0 || seek>=180) {
|
||||
return "???";
|
||||
}
|
||||
if (settings.flatNotes) {
|
||||
if (settings.germanNotation) return noteNamesGF[seek];
|
||||
return noteNamesF[seek];
|
||||
}
|
||||
if (settings.germanNotation) return noteNamesG[seek];
|
||||
return noteNames[seek];
|
||||
}
|
||||
|
|
@ -606,10 +618,11 @@ void FurnaceGUI::autoDetectSystem() {
|
|||
std::map<DivSystem,int> sysCountMap;
|
||||
std::map<DivSystem,DivConfig> sysConfMap;
|
||||
for (int i=0; i<e->song.systemLen; i++) {
|
||||
try {
|
||||
sysCountMap.at(e->song.system[i])++;
|
||||
} catch (std::exception& ex) {
|
||||
auto it=sysCountMap.find(e->song.system[i]);
|
||||
if (it==sysCountMap.cend()) {
|
||||
sysCountMap[e->song.system[i]]=1;
|
||||
} else {
|
||||
it->second++;
|
||||
}
|
||||
sysConfMap[e->song.system[i]]=e->song.systemFlags[i];
|
||||
}
|
||||
|
|
@ -627,10 +640,11 @@ void FurnaceGUI::autoDetectSystem() {
|
|||
defCountMap.clear();
|
||||
defConfMap.clear();
|
||||
for (FurnaceGUISysDefChip& k: j.orig) {
|
||||
try {
|
||||
defCountMap.at(k.sys)++;
|
||||
} catch (std::exception& ex) {
|
||||
auto it=defCountMap.find(k.sys);
|
||||
if (it==defCountMap.cend()) {
|
||||
defCountMap[k.sys]=1;
|
||||
} else {
|
||||
it->second++;
|
||||
}
|
||||
DivConfig dc;
|
||||
dc.loadFromMemory(k.flags);
|
||||
|
|
@ -643,27 +657,37 @@ void FurnaceGUI::autoDetectSystem() {
|
|||
logV("- %s: %d",e->getSystemName(k.first),k.second);
|
||||
}*/
|
||||
for (std::pair<DivSystem,int> k: defCountMap) {
|
||||
try {
|
||||
if (sysCountMap.at(k.first)!=k.second) {
|
||||
isMatch=false;
|
||||
break;
|
||||
}
|
||||
DivConfig& sysDC=sysConfMap.at(k.first);
|
||||
for (std::pair<String,String> l: defConfMap.at(k.first).configMap()) {
|
||||
if (!sysDC.has(l.first)) {
|
||||
isMatch=false;
|
||||
break;
|
||||
}
|
||||
if (sysDC.getString(l.first,"")!=l.second) {
|
||||
isMatch=false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isMatch) break;
|
||||
} catch (std::exception& ex) {
|
||||
auto countI=sysCountMap.find(k.first);
|
||||
if (countI==sysCountMap.cend()) {
|
||||
isMatch=false;
|
||||
break;
|
||||
} else if (countI->second!=k.second) {
|
||||
isMatch=false;
|
||||
break;
|
||||
}
|
||||
|
||||
auto confI=sysConfMap.find(k.first);
|
||||
if (confI==sysConfMap.cend()) {
|
||||
isMatch=false;
|
||||
break;
|
||||
}
|
||||
DivConfig& sysDC=confI->second;
|
||||
auto defConfI=defConfMap.find(k.first);
|
||||
if (defConfI==defConfMap.cend()) {
|
||||
isMatch=false;
|
||||
break;
|
||||
}
|
||||
for (std::pair<String,String> l: defConfI->second.configMap()) {
|
||||
if (!sysDC.has(l.first)) {
|
||||
isMatch=false;
|
||||
break;
|
||||
}
|
||||
if (sysDC.getString(l.first,"")!=l.second) {
|
||||
isMatch=false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isMatch) break;
|
||||
}
|
||||
if (isMatch) {
|
||||
logV("match found!");
|
||||
|
|
@ -1093,8 +1117,9 @@ void FurnaceGUI::previewNote(int refChan, int note, bool autoNote) {
|
|||
}
|
||||
|
||||
void FurnaceGUI::stopPreviewNote(SDL_Scancode scancode, bool autoNote) {
|
||||
try {
|
||||
int key=noteKeys.at(scancode);
|
||||
auto it=noteKeys.find(scancode);
|
||||
if (it!=noteKeys.cend()) {
|
||||
int key=it->second;
|
||||
int num=12*curOctave+key;
|
||||
if (num<-60) num=-60; // C-(-5)
|
||||
if (num>119) num=119; // B-9
|
||||
|
|
@ -1106,24 +1131,27 @@ void FurnaceGUI::stopPreviewNote(SDL_Scancode scancode, bool autoNote) {
|
|||
e->synchronized([this,num]() {
|
||||
e->autoNoteOff(-1,num);
|
||||
});
|
||||
} catch (std::out_of_range& e) {
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
@ -1149,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;
|
||||
|
|
@ -1306,8 +1342,9 @@ void FurnaceGUI::keyDown(SDL_Event& ev) {
|
|||
break;
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
int num=valueKeys.at(ev.key.keysym.sym);
|
||||
auto it=valueKeys.find(ev.key.keysym.sym);
|
||||
if (it!=valueKeys.cend()) {
|
||||
int num=it->second;
|
||||
switch (latchTarget) {
|
||||
case 1: // instrument
|
||||
changeLatch(latchIns);
|
||||
|
|
@ -1322,7 +1359,6 @@ void FurnaceGUI::keyDown(SDL_Event& ev) {
|
|||
changeLatch(latchEffectVal);
|
||||
break;
|
||||
}
|
||||
} catch (std::out_of_range& e) {
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
|
@ -1335,8 +1371,9 @@ void FurnaceGUI::keyDown(SDL_Event& ev) {
|
|||
alterSampleMap(true,-1);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
int key=noteKeys.at(ev.key.keysym.scancode);
|
||||
auto it=noteKeys.find(ev.key.keysym.scancode);
|
||||
if (it!=noteKeys.cend()) {
|
||||
int key=it->second;
|
||||
int num=12*curOctave+key;
|
||||
|
||||
if (num<-60) num=-60; // C-(-5)
|
||||
|
|
@ -1344,7 +1381,6 @@ void FurnaceGUI::keyDown(SDL_Event& ev) {
|
|||
|
||||
alterSampleMap(true,num);
|
||||
return;
|
||||
} catch (std::out_of_range& e) {
|
||||
}
|
||||
} else {
|
||||
// TODO: map?
|
||||
|
|
@ -1352,34 +1388,35 @@ void FurnaceGUI::keyDown(SDL_Event& ev) {
|
|||
alterSampleMap(false,-1);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
int num=valueKeys.at(ev.key.keysym.sym);
|
||||
auto it=valueKeys.find(ev.key.keysym.sym);
|
||||
if (it!=valueKeys.cend()) {
|
||||
int num=it->second;
|
||||
if (num<10) {
|
||||
alterSampleMap(false,num);
|
||||
return;
|
||||
}
|
||||
} catch (std::out_of_range& e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PER-WINDOW KEYS
|
||||
switch (curWindow) {
|
||||
case GUI_WINDOW_PATTERN:
|
||||
try {
|
||||
int action=actionMapPat.at(mapped);
|
||||
case GUI_WINDOW_PATTERN: {
|
||||
auto actionI=actionMapPat.find(mapped);
|
||||
if (actionI!=actionMapPat.cend()) {
|
||||
int action=actionI->second;
|
||||
if (action>0) {
|
||||
doAction(action);
|
||||
return;
|
||||
}
|
||||
} catch (std::out_of_range& e) {
|
||||
}
|
||||
// pattern input otherwise
|
||||
if (mapped&(FURKMOD_ALT|FURKMOD_CTRL|FURKMOD_META|FURKMOD_SHIFT)) break;
|
||||
if (!ev.key.repeat) {
|
||||
if (cursor.xFine==0) { // note
|
||||
try {
|
||||
int key=noteKeys.at(ev.key.keysym.scancode);
|
||||
auto it=noteKeys.find(ev.key.keysym.scancode);
|
||||
if (it!=noteKeys.cend()) {
|
||||
int key=it->second;
|
||||
int num=12*curOctave+key;
|
||||
|
||||
if (num<-60) num=-60; // C-(-5)
|
||||
|
|
@ -1388,39 +1425,41 @@ void FurnaceGUI::keyDown(SDL_Event& ev) {
|
|||
if (edit) {
|
||||
noteInput(num,key);
|
||||
}
|
||||
} catch (std::out_of_range& e) {
|
||||
}
|
||||
} else if (edit) { // value
|
||||
try {
|
||||
int num=valueKeys.at(ev.key.keysym.sym);
|
||||
auto it=valueKeys.find(ev.key.keysym.sym);
|
||||
if (it!=valueKeys.cend()) {
|
||||
int num=it->second;
|
||||
valueInput(num);
|
||||
} catch (std::out_of_range& e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GUI_WINDOW_ORDERS:
|
||||
try {
|
||||
int action=actionMapOrders.at(mapped);
|
||||
}
|
||||
case GUI_WINDOW_ORDERS: {
|
||||
auto actionI=actionMapOrders.find(mapped);
|
||||
if (actionI!=actionMapOrders.cend()) {
|
||||
int action=actionI->second;
|
||||
if (action>0) {
|
||||
doAction(action);
|
||||
return;
|
||||
}
|
||||
} catch (std::out_of_range& e) {
|
||||
}
|
||||
// order input otherwise
|
||||
if (mapped&(FURKMOD_ALT|FURKMOD_CTRL|FURKMOD_META|FURKMOD_SHIFT)) break;
|
||||
if (orderEditMode!=0) {
|
||||
try {
|
||||
int num=valueKeys.at(ev.key.keysym.sym);
|
||||
auto it=valueKeys.find(ev.key.keysym.sym);
|
||||
if (it!=valueKeys.cend()) {
|
||||
int num=it->second;
|
||||
if (orderCursor>=0 && orderCursor<e->getTotalChannelCount()) {
|
||||
prepareUndo(GUI_UNDO_CHANGE_ORDER);
|
||||
e->lockSave([this,num]() {
|
||||
if (!curNibble && !settings.pushNibble) e->curOrders->ord[orderCursor][curOrder]=0;
|
||||
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++;
|
||||
|
|
@ -1435,62 +1474,66 @@ void FurnaceGUI::keyDown(SDL_Event& ev) {
|
|||
e->walkSong(loopOrder,loopRow,loopEnd);
|
||||
makeUndo(GUI_UNDO_CHANGE_ORDER);
|
||||
}
|
||||
} catch (std::out_of_range& e) {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GUI_WINDOW_SAMPLE_EDIT:
|
||||
try {
|
||||
int action=actionMapSample.at(mapped);
|
||||
}
|
||||
case GUI_WINDOW_SAMPLE_EDIT: {
|
||||
auto actionI=actionMapSample.find(mapped);
|
||||
if (actionI!=actionMapSample.cend()) {
|
||||
int action=actionI->second;
|
||||
if (action>0) {
|
||||
doAction(action);
|
||||
return;
|
||||
}
|
||||
} catch (std::out_of_range& e) {
|
||||
}
|
||||
break;
|
||||
case GUI_WINDOW_INS_LIST:
|
||||
try {
|
||||
int action=actionMapInsList.at(mapped);
|
||||
}
|
||||
case GUI_WINDOW_INS_LIST: {
|
||||
auto actionI=actionMapInsList.find(mapped);
|
||||
if (actionI!=actionMapInsList.cend()) {
|
||||
int action=actionI->second;
|
||||
if (action>0) {
|
||||
doAction(action);
|
||||
return;
|
||||
}
|
||||
} catch (std::out_of_range& e) {
|
||||
}
|
||||
break;
|
||||
case GUI_WINDOW_WAVE_LIST:
|
||||
try {
|
||||
int action=actionMapWaveList.at(mapped);
|
||||
}
|
||||
case GUI_WINDOW_WAVE_LIST: {
|
||||
auto actionI=actionMapWaveList.find(mapped);
|
||||
if (actionI!=actionMapWaveList.cend()) {
|
||||
int action=actionI->second;
|
||||
if (action>0) {
|
||||
doAction(action);
|
||||
return;
|
||||
}
|
||||
} catch (std::out_of_range& e) {
|
||||
}
|
||||
break;
|
||||
case GUI_WINDOW_SAMPLE_LIST:
|
||||
try {
|
||||
int action=actionMapSampleList.at(mapped);
|
||||
}
|
||||
case GUI_WINDOW_SAMPLE_LIST: {
|
||||
auto actionI=actionMapSampleList.find(mapped);
|
||||
if (actionI!=actionMapSampleList.cend()) {
|
||||
int action=actionI->second;
|
||||
if (action>0) {
|
||||
doAction(action);
|
||||
return;
|
||||
}
|
||||
} catch (std::out_of_range& e) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// GLOBAL KEYS
|
||||
try {
|
||||
int action=actionMapGlobal.at(mapped);
|
||||
auto actionI=actionMapGlobal.find(mapped);
|
||||
if (actionI!=actionMapGlobal.cend()) {
|
||||
int action=actionI->second;
|
||||
if (action>0) {
|
||||
doAction(action);
|
||||
return;
|
||||
}
|
||||
} catch (std::out_of_range& e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1630,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(
|
||||
|
|
@ -1822,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(
|
||||
|
|
@ -2077,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");
|
||||
|
|
@ -2153,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;
|
||||
}
|
||||
|
||||
|
|
@ -2741,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);
|
||||
|
|
@ -2976,9 +3027,10 @@ int FurnaceGUI::processEvent(SDL_Event* ev) {
|
|||
if (settings.notePreviewBehavior==0) return 1;
|
||||
switch (curWindow) {
|
||||
case GUI_WINDOW_SAMPLE_EDIT:
|
||||
case GUI_WINDOW_SAMPLE_LIST:
|
||||
try {
|
||||
int key=noteKeys.at(ev->key.keysym.scancode);
|
||||
case GUI_WINDOW_SAMPLE_LIST: {
|
||||
auto it=noteKeys.find(ev->key.keysym.scancode);
|
||||
if (it!=noteKeys.cend()) {
|
||||
int key=it->second;
|
||||
int num=12*curOctave+key;
|
||||
if (key!=100 && key!=101 && key!=102) {
|
||||
int pStart=-1;
|
||||
|
|
@ -2999,13 +3051,14 @@ int FurnaceGUI::processEvent(SDL_Event* ev) {
|
|||
samplePreviewKey=ev->key.keysym.scancode;
|
||||
samplePreviewNote=num;
|
||||
}
|
||||
} catch (std::out_of_range& e) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GUI_WINDOW_WAVE_LIST:
|
||||
case GUI_WINDOW_WAVE_EDIT:
|
||||
try {
|
||||
int key=noteKeys.at(ev->key.keysym.scancode);
|
||||
case GUI_WINDOW_WAVE_EDIT: {
|
||||
auto it=noteKeys.find(ev->key.keysym.scancode);
|
||||
if (it!=noteKeys.cend()) {
|
||||
int key=it->second;
|
||||
int num=12*curOctave+key;
|
||||
if (key!=100 && key!=101 && key!=102) {
|
||||
e->previewWave(curWave,num);
|
||||
|
|
@ -3013,9 +3066,9 @@ int FurnaceGUI::processEvent(SDL_Event* ev) {
|
|||
wavePreviewKey=ev->key.keysym.scancode;
|
||||
wavePreviewNote=num;
|
||||
}
|
||||
} catch (std::out_of_range& e) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GUI_WINDOW_ORDERS: // ignore here
|
||||
break;
|
||||
case GUI_WINDOW_PATTERN:
|
||||
|
|
@ -3025,9 +3078,10 @@ int FurnaceGUI::processEvent(SDL_Event* ev) {
|
|||
if (edit && cursor.xFine!=0) break;
|
||||
}
|
||||
// fall-through
|
||||
default:
|
||||
try {
|
||||
int key=noteKeys.at(ev->key.keysym.scancode);
|
||||
default: {
|
||||
auto it=noteKeys.find(ev->key.keysym.scancode);
|
||||
if (it!=noteKeys.cend()) {
|
||||
int key=it->second;
|
||||
int num=12*curOctave+key;
|
||||
|
||||
if (num<-60) num=-60; // C-(-5)
|
||||
|
|
@ -3036,9 +3090,9 @@ int FurnaceGUI::processEvent(SDL_Event* ev) {
|
|||
if (key!=100 && key!=101 && key!=102) {
|
||||
previewNote(cursor.xCoarse,num);
|
||||
}
|
||||
} catch (std::out_of_range& e) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (ev->type==SDL_KEYUP) {
|
||||
|
|
@ -3843,6 +3897,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!");
|
||||
|
|
@ -3872,7 +3927,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);
|
||||
|
|
@ -3967,6 +4022,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;
|
||||
}
|
||||
|
|
@ -3982,6 +4038,7 @@ bool FurnaceGUI::loop() {
|
|||
if (vgmExportTrailingTicks<0) vgmExportTrailingTicks=0;
|
||||
}
|
||||
}
|
||||
ImGui::Unindent();
|
||||
}
|
||||
ImGui::Checkbox("add pattern change hints",&vgmExportPatternHints);
|
||||
if (ImGui::IsItemHovered()) {
|
||||
|
|
@ -4051,6 +4108,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();
|
||||
|
|
@ -4070,6 +4129,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);
|
||||
|
|
@ -4133,7 +4193,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();
|
||||
}
|
||||
}
|
||||
|
|
@ -4195,7 +4255,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();
|
||||
|
|
@ -4208,7 +4268,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);
|
||||
|
|
@ -4244,7 +4304,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;
|
||||
|
|
@ -4286,7 +4346,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;
|
||||
|
|
@ -4382,6 +4442,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;
|
||||
|
|
@ -4460,17 +4524,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());
|
||||
|
|
@ -4505,6 +4558,11 @@ bool FurnaceGUI::loop() {
|
|||
MEASURE(effectList,drawEffectList());
|
||||
}
|
||||
|
||||
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);
|
||||
|
|
@ -4566,7 +4624,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;
|
||||
|
|
@ -4602,6 +4659,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;
|
||||
|
|
@ -4669,9 +4727,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");
|
||||
}
|
||||
|
|
@ -4765,11 +4820,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())) {
|
||||
|
|
@ -5023,7 +5073,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) {
|
||||
|
|
@ -5071,6 +5121,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;
|
||||
|
|
@ -5198,6 +5251,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")) {
|
||||
|
|
@ -5225,6 +5279,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")) {
|
||||
|
|
@ -5233,6 +5288,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) {
|
||||
|
|
@ -5591,6 +5647,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;
|
||||
}
|
||||
}
|
||||
|
|
@ -5601,11 +5670,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")) {
|
||||
|
|
@ -5678,6 +5749,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++) {
|
||||
|
|
@ -5693,6 +5765,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)) {
|
||||
|
|
@ -5999,6 +6072,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!");
|
||||
|
|
@ -6067,7 +6141,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);
|
||||
|
|
@ -6126,6 +6199,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);
|
||||
|
|
@ -6454,6 +6528,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!");
|
||||
|
|
@ -6585,7 +6660,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);
|
||||
|
|
@ -6644,6 +6718,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);
|
||||
|
|
@ -6688,6 +6763,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];
|
||||
}
|
||||
|
|
@ -6723,6 +6805,7 @@ FurnaceGUI::FurnaceGUI():
|
|||
displayExporting(false),
|
||||
vgmExportLoop(true),
|
||||
zsmExportLoop(true),
|
||||
zsmExportOptimize(true),
|
||||
vgmExportPatternHints(false),
|
||||
vgmExportDirectStream(false),
|
||||
displayInsTypeList(false),
|
||||
|
|
@ -6800,6 +6883,7 @@ FurnaceGUI::FurnaceGUI():
|
|||
iconFont(NULL),
|
||||
patFont(NULL),
|
||||
bigFont(NULL),
|
||||
headFont(NULL),
|
||||
fontRange(NULL),
|
||||
prevInsData(NULL),
|
||||
curIns(0),
|
||||
|
|
@ -6869,7 +6953,6 @@ FurnaceGUI::FurnaceGUI():
|
|||
clockOpen(false),
|
||||
speedOpen(true),
|
||||
groovesOpen(false),
|
||||
introMonOpen(false),
|
||||
basicMode(true),
|
||||
shortIntro(false),
|
||||
insListDir(false),
|
||||
|
|
@ -7084,10 +7167,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),
|
||||
|
|
@ -7198,7 +7285,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);
|
||||
|
|
@ -7262,6 +7349,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);
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
||||
|
|
@ -240,6 +256,8 @@ enum FurnaceGUIColors {
|
|||
GUI_COLOR_INSTR_SM8521,
|
||||
GUI_COLOR_INSTR_PV1000,
|
||||
GUI_COLOR_INSTR_K053260,
|
||||
GUI_COLOR_INSTR_SCSP,
|
||||
GUI_COLOR_INSTR_TED,
|
||||
GUI_COLOR_INSTR_UNKNOWN,
|
||||
|
||||
GUI_COLOR_CHANNEL_BG,
|
||||
|
|
@ -400,7 +418,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,
|
||||
|
|
@ -422,6 +439,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,
|
||||
|
|
@ -605,7 +623,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,
|
||||
|
|
@ -1307,7 +1324,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;
|
||||
|
|
@ -1369,6 +1386,7 @@ class FurnaceGUI {
|
|||
ImFont* iconFont;
|
||||
ImFont* patFont;
|
||||
ImFont* bigFont;
|
||||
ImFont* headFont;
|
||||
ImWchar* fontRange;
|
||||
ImVec4 uiColors[GUI_COLOR_MAX];
|
||||
ImVec4 volColors[128];
|
||||
|
|
@ -1387,7 +1405,7 @@ class FurnaceGUI {
|
|||
char emptyLabel2[32];
|
||||
|
||||
struct Settings {
|
||||
int mainFontSize, patFontSize, iconSize;
|
||||
int mainFontSize, patFontSize, headFontSize, iconSize;
|
||||
int audioEngine;
|
||||
int audioQuality;
|
||||
int audioChans;
|
||||
|
|
@ -1404,6 +1422,7 @@ class FurnaceGUI {
|
|||
String tg100Path;
|
||||
String mu5Path;
|
||||
int mainFont;
|
||||
int headFont;
|
||||
int patFont;
|
||||
int audioRate;
|
||||
int audioBufSize;
|
||||
|
|
@ -1419,6 +1438,7 @@ class FurnaceGUI {
|
|||
int chipNames;
|
||||
int overflowHighlight;
|
||||
int partyTime;
|
||||
int flatNotes;
|
||||
int germanNotation;
|
||||
int stepOnDelete;
|
||||
int scrollStep;
|
||||
|
|
@ -1457,6 +1477,8 @@ class FurnaceGUI {
|
|||
int oscTakesEntireWindow;
|
||||
int oscBorder;
|
||||
int oscEscapesBoundary;
|
||||
int oscMono;
|
||||
int oscAntiAlias;
|
||||
int separateFMColors;
|
||||
int insEditColorize;
|
||||
int metroVol;
|
||||
|
|
@ -1522,8 +1544,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;
|
||||
|
|
@ -1542,6 +1572,7 @@ class FurnaceGUI {
|
|||
Settings():
|
||||
mainFontSize(18),
|
||||
patFontSize(18),
|
||||
headFontSize(27),
|
||||
iconSize(16),
|
||||
audioEngine(DIV_AUDIO_SDL),
|
||||
audioQuality(0),
|
||||
|
|
@ -1612,6 +1643,8 @@ class FurnaceGUI {
|
|||
oscTakesEntireWindow(0),
|
||||
oscBorder(1),
|
||||
oscEscapesBoundary(0),
|
||||
oscMono(1),
|
||||
oscAntiAlias(1),
|
||||
separateFMColors(0),
|
||||
insEditColorize(0),
|
||||
metroVol(100),
|
||||
|
|
@ -1676,8 +1709,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(""),
|
||||
|
|
@ -1724,7 +1765,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;
|
||||
|
|
@ -1960,14 +2001,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;
|
||||
|
|
@ -2028,6 +2070,9 @@ class FurnaceGUI {
|
|||
bool pianoReadonly;
|
||||
int pianoOffset, pianoOffsetEdit;
|
||||
int pianoView, pianoInputPadMode;
|
||||
|
||||
//effect sorting
|
||||
bool effectsShow[10];
|
||||
|
||||
// TX81Z
|
||||
bool hasACED;
|
||||
|
|
@ -2071,7 +2116,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);
|
||||
|
|
@ -2096,6 +2141,8 @@ class FurnaceGUI {
|
|||
ImVec4 channelColor(int ch);
|
||||
ImVec4 channelTextColor(int ch);
|
||||
|
||||
void centerNextWindow(const char* name, float w, float h);
|
||||
|
||||
void readOsc();
|
||||
void calcChanOsc();
|
||||
|
||||
|
|
|
|||
|
|
@ -62,6 +62,42 @@ const char* noteNamesG[180]={
|
|||
"C-9", "C#9", "D-9", "D#9", "E-9", "F-9", "F#9", "G-9", "G#9", "A-9", "A#9", "H-9"
|
||||
};
|
||||
|
||||
const char* noteNamesF[180]={
|
||||
"c_5", "dd5", "d_5", "ed5", "e_5", "f_5", "gd5", "g_5", "ad5", "a_5", "bd5", "b_5",
|
||||
"c_4", "dd4", "d_4", "ed4", "e_4", "f_4", "gd4", "g_4", "ad4", "a_4", "bd4", "b_4",
|
||||
"c_3", "dd3", "d_3", "ed3", "e_3", "f_3", "gd3", "g_3", "ad3", "a_3", "bd3", "b_3",
|
||||
"c_2", "dd2", "d_2", "ed2", "e_2", "f_2", "gd2", "g_2", "ad2", "a_2", "bd2", "b_2",
|
||||
"c_1", "dd1", "d_1", "ed1", "e_1", "f_1", "gd1", "g_1", "ad1", "a_1", "bd1", "b_1",
|
||||
"C-0", "Db0", "D-0", "Eb0", "E-0", "F-0", "Gb0", "G-0", "Ab0", "A-0", "Bb0", "B-0",
|
||||
"C-1", "Db1", "D-1", "Eb1", "E-1", "F-1", "Gb1", "G-1", "Ab1", "A-1", "Bb1", "B-1",
|
||||
"C-2", "Db2", "D-2", "Eb2", "E-2", "F-2", "Gb2", "G-2", "Ab2", "A-2", "Bb2", "B-2",
|
||||
"C-3", "Db3", "D-3", "Eb3", "E-3", "F-3", "Gb3", "G-3", "Ab3", "A-3", "Bb3", "B-3",
|
||||
"C-4", "Db4", "D-4", "Eb4", "E-4", "F-4", "Gb4", "G-4", "Ab4", "A-4", "Bb4", "B-4",
|
||||
"C-5", "Db5", "D-5", "Eb5", "E-5", "F-5", "Gb5", "G-5", "Ab5", "A-5", "Bb5", "B-5",
|
||||
"C-6", "Db6", "D-6", "Eb6", "E-6", "F-6", "Gb6", "G-6", "Ab6", "A-6", "Bb6", "B-6",
|
||||
"C-7", "Db7", "D-7", "Eb7", "E-7", "F-7", "Gb7", "G-7", "Ab7", "A-7", "Bb7", "B-7",
|
||||
"C-8", "Db8", "D-8", "Eb8", "E-8", "F-8", "Gb8", "G-8", "Ab8", "A-8", "Bb8", "B-8",
|
||||
"C-9", "Db9", "D-9", "Eb9", "E-9", "F-9", "Gb9", "G-9", "Ab9", "A-9", "Bb9", "B-9"
|
||||
};
|
||||
|
||||
const char* noteNamesGF[180]={
|
||||
"c_5", "dd5", "d_5", "ed5", "e_5", "f_5", "gd5", "g_5", "ad5", "a_5", "b_5", "h_5",
|
||||
"c_4", "dd4", "d_4", "ed4", "e_4", "f_4", "gd4", "g_4", "ad4", "a_4", "b_4", "h_4",
|
||||
"c_3", "dd3", "d_3", "ed3", "e_3", "f_3", "gd3", "g_3", "ad3", "a_3", "b_3", "h_3",
|
||||
"c_2", "dd2", "d_2", "ed2", "e_2", "f_2", "gd2", "g_2", "ad2", "a_2", "b_2", "h_2",
|
||||
"c_1", "dd1", "d_1", "ed1", "e_1", "f_1", "gd1", "g_1", "ad1", "a_1", "b_1", "h_1",
|
||||
"C-0", "Db0", "D-0", "Eb0", "E-0", "F-0", "Gb0", "G-0", "Ab0", "A-0", "B-0", "H-0",
|
||||
"C-1", "Db1", "D-1", "Eb1", "E-1", "F-1", "Gb1", "G-1", "Ab1", "A-1", "B-1", "H-1",
|
||||
"C-2", "Db2", "D-2", "Eb2", "E-2", "F-2", "Gb2", "G-2", "Ab2", "A-2", "B-2", "H-2",
|
||||
"C-3", "Db3", "D-3", "Eb3", "E-3", "F-3", "Gb3", "G-3", "Ab3", "A-3", "B-3", "H-3",
|
||||
"C-4", "Db4", "D-4", "Eb4", "E-4", "F-4", "Gb4", "G-4", "Ab4", "A-4", "B-4", "H-4",
|
||||
"C-5", "Db5", "D-5", "Eb5", "E-5", "F-5", "Gb5", "G-5", "Ab5", "A-5", "B-5", "H-5",
|
||||
"C-6", "Db6", "D-6", "Eb6", "E-6", "F-6", "Gb6", "G-6", "Ab6", "A-6", "B-6", "H-6",
|
||||
"C-7", "Db7", "D-7", "Eb7", "E-7", "F-7", "Gb7", "G-7", "Ab7", "A-7", "B-7", "H-7",
|
||||
"C-8", "Db8", "D-8", "Eb8", "E-8", "F-8", "Gb8", "G-8", "Ab8", "A-8", "B-8", "H-8",
|
||||
"C-9", "Db9", "D-9", "Eb9", "E-9", "F-9", "Gb9", "G-9", "Ab9", "A-9", "B-9", "H-9"
|
||||
};
|
||||
|
||||
const char* pitchLabel[11]={
|
||||
"1/6", "1/5", "1/4", "1/3", "1/2", "1x", "2x", "3x", "4x", "5x", "6x"
|
||||
};
|
||||
|
|
@ -132,6 +168,8 @@ const char* insTypes[DIV_INS_MAX+1]={
|
|||
"SM8521",
|
||||
"PV-1000",
|
||||
"K053260",
|
||||
"SCSP",
|
||||
"TED",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
@ -170,6 +208,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
|
||||
|
|
@ -603,7 +667,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),
|
||||
|
|
@ -765,6 +828,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)),
|
||||
|
||||
|
|
@ -853,6 +932,8 @@ const FurnaceGUIColorDef guiColors[GUI_COLOR_MAX]={
|
|||
D(GUI_COLOR_INSTR_SM8521,"",ImVec4(0.5f,0.55f,0.6f,1.0f)),
|
||||
D(GUI_COLOR_INSTR_PV1000,"",ImVec4(0.4f,0.6f,0.7f,1.0f)),
|
||||
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_UNKNOWN,"",ImVec4(0.3f,0.3f,0.3f,1.0f)),
|
||||
|
||||
D(GUI_COLOR_CHANNEL_BG,"",ImVec4(0.4f,0.6f,0.8f,1.0f)),
|
||||
|
|
@ -1037,6 +1118,7 @@ const int availableSystems[]={
|
|||
DIV_SYSTEM_SM8521,
|
||||
DIV_SYSTEM_PV1000,
|
||||
DIV_SYSTEM_K053260,
|
||||
DIV_SYSTEM_TED,
|
||||
DIV_SYSTEM_PCM_DAC,
|
||||
DIV_SYSTEM_PONG,
|
||||
0 // don't remove this last one!
|
||||
|
|
@ -1087,6 +1169,7 @@ const int chipsSquare[]={
|
|||
DIV_SYSTEM_MSM5232,
|
||||
DIV_SYSTEM_T6W28,
|
||||
DIV_SYSTEM_PV1000,
|
||||
DIV_SYSTEM_TED,
|
||||
0 // don't remove this last one!
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ struct FurnaceGUIColorDef {
|
|||
extern const int opOrder[4];
|
||||
extern const char* noteNames[180];
|
||||
extern const char* noteNamesG[180];
|
||||
extern const char* noteNamesF[180];
|
||||
extern const char* noteNamesGF[180];
|
||||
extern const char* pitchLabel[11];
|
||||
extern const char* insTypes[];
|
||||
extern const char* sampleLoopModes[];
|
||||
|
|
@ -55,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];
|
||||
|
|
@ -267,6 +267,10 @@ const char* msm5232ControlBits[7]={
|
|||
"16'", "8'", "4'", "2'", "sustain", NULL
|
||||
};
|
||||
|
||||
const char* tedControlBits[3]={
|
||||
"square", "noise", NULL
|
||||
};
|
||||
|
||||
const char* x1_010EnvBits[8]={
|
||||
"enable", "oneshot", "split L/R", "HinvR", "VinvR", "HinvL", "VinvL", NULL
|
||||
};
|
||||
|
|
@ -2284,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);
|
||||
}
|
||||
|
|
@ -4263,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);
|
||||
|
|
@ -4347,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);
|
||||
|
|
@ -4684,7 +4687,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)) {
|
||||
|
|
@ -4696,7 +4699,7 @@ void FurnaceGUI::drawInsEdit() {
|
|||
ImGui::TableNextColumn();
|
||||
ImGui::Text("Ch");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("Offset");
|
||||
ImGui::Text("Position");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("Length");
|
||||
|
||||
|
|
@ -4728,7 +4731,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;
|
||||
}
|
||||
|
|
@ -5249,6 +5252,7 @@ void FurnaceGUI::drawInsEdit() {
|
|||
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::AlignTextToFramePadding();
|
||||
ImGui::Text("Wave 1");
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
|
|
@ -5259,6 +5263,7 @@ void FurnaceGUI::drawInsEdit() {
|
|||
}
|
||||
if (isSingleWaveFX) {
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::AlignTextToFramePadding();
|
||||
ImGui::Text("Wave 2");
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
|
|
@ -5389,7 +5394,7 @@ void FurnaceGUI::drawInsEdit() {
|
|||
if (ins->type==DIV_INS_MSM6258) {
|
||||
volMax=0;
|
||||
}
|
||||
if (ins->type==DIV_INS_MSM6295) {
|
||||
if (ins->type==DIV_INS_MSM6295 || ins->type==DIV_INS_TED) {
|
||||
volMax=8;
|
||||
}
|
||||
if (ins->type==DIV_INS_ADPCMA) {
|
||||
|
|
@ -5475,6 +5480,10 @@ void FurnaceGUI::drawInsEdit() {
|
|||
dutyLabel="On/Off";
|
||||
dutyMax=1;
|
||||
}
|
||||
if (ins->type==DIV_INS_TED) {
|
||||
dutyLabel="Square/Noise";
|
||||
dutyMax=2;
|
||||
}
|
||||
if (ins->type==DIV_INS_SWAN) {
|
||||
dutyLabel="Noise";
|
||||
dutyMax=ins->amiga.useSample?0:8;
|
||||
|
|
@ -5555,9 +5564,11 @@ void FurnaceGUI::drawInsEdit() {
|
|||
if (ins->type==DIV_INS_MSM6295) waveMax=0;
|
||||
if (ins->type==DIV_INS_SEGAPCM) waveMax=0;
|
||||
if (ins->type==DIV_INS_K007232) waveMax=0;
|
||||
if (ins->type==DIV_INS_ES5506) waveMax=0;
|
||||
if (ins->type==DIV_INS_GA20) waveMax=0;
|
||||
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_SU || ins->type==DIV_INS_POKEY) waveMax=7;
|
||||
if (ins->type==DIV_INS_PET) {
|
||||
waveMax=8;
|
||||
|
|
@ -5703,6 +5714,8 @@ void FurnaceGUI::drawInsEdit() {
|
|||
macroList.push_back(FurnaceGUIMacroDesc(dutyLabel,&ins->std.dutyMacro,0,dutyMax,160,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true,mikeyFeedbackBits));
|
||||
} else if (ins->type==DIV_INS_POKEY) {
|
||||
macroList.push_back(FurnaceGUIMacroDesc(dutyLabel,&ins->std.dutyMacro,0,dutyMax,160,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true,pokeyCtlBits));
|
||||
} else if (ins->type==DIV_INS_TED) {
|
||||
macroList.push_back(FurnaceGUIMacroDesc(dutyLabel,&ins->std.dutyMacro,0,dutyMax,80,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true,tedControlBits));
|
||||
} else if (ins->type==DIV_INS_MSM5232) {
|
||||
macroList.push_back(FurnaceGUIMacroDesc(dutyLabel,&ins->std.dutyMacro,0,dutyMax,160,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true,msm5232ControlBits));
|
||||
} else if (ins->type==DIV_INS_ES5506) {
|
||||
|
|
@ -5770,7 +5783,8 @@ void FurnaceGUI::drawInsEdit() {
|
|||
(ins->type==DIV_INS_X1_010 && ins->amiga.useSample) ||
|
||||
ins->type==DIV_INS_K007232 ||
|
||||
ins->type==DIV_INS_GA20 ||
|
||||
ins->type==DIV_INS_K053260) {
|
||||
ins->type==DIV_INS_K053260 ||
|
||||
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));
|
||||
}
|
||||
if (ex1Max>0) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)) {
|
||||
|
|
@ -337,9 +338,11 @@ void FurnaceGUI::drawMixer() {
|
|||
if (selectedSubPort>=0) {
|
||||
portDragActive=true;
|
||||
ImGui::InhibitInertialScroll();
|
||||
try {
|
||||
subPortPos=portPos.at((selectedPortSet<<4)|selectedSubPort);
|
||||
} catch (std::out_of_range& e) {
|
||||
|
||||
auto subPortI=portPos.find((selectedPortSet<<4)|selectedSubPort);
|
||||
if (subPortI!=portPos.cend()) {
|
||||
subPortPos=subPortI->second;
|
||||
} else {
|
||||
portDragActive=false;
|
||||
}
|
||||
}
|
||||
|
|
@ -353,9 +356,10 @@ void FurnaceGUI::drawMixer() {
|
|||
if (selectedSubPort>=0) {
|
||||
portDragActive=true;
|
||||
ImGui::InhibitInertialScroll();
|
||||
try {
|
||||
subPortPos=portPos.at((selectedPortSet<<4)|selectedSubPort);
|
||||
} catch (std::out_of_range& e) {
|
||||
auto subPortI=portPos.find((selectedPortSet<<4)|selectedSubPort);
|
||||
if (subPortI!=portPos.cend()) {
|
||||
subPortPos=subPortI->second;
|
||||
} else {
|
||||
portDragActive=false;
|
||||
}
|
||||
}
|
||||
|
|
@ -365,9 +369,10 @@ void FurnaceGUI::drawMixer() {
|
|||
if (selectedSubPort>=0) {
|
||||
portDragActive=true;
|
||||
ImGui::InhibitInertialScroll();
|
||||
try {
|
||||
subPortPos=portPos.at((selectedPortSet<<4)|selectedSubPort);
|
||||
} catch (std::out_of_range& e) {
|
||||
auto subPortI=portPos.find((selectedPortSet<<4)|selectedSubPort);
|
||||
if (subPortI!=portPos.cend()) {
|
||||
subPortPos=subPortI->second;
|
||||
} else {
|
||||
portDragActive=false;
|
||||
}
|
||||
}
|
||||
|
|
@ -380,9 +385,10 @@ void FurnaceGUI::drawMixer() {
|
|||
if (selectedSubPort>=0) {
|
||||
portDragActive=true;
|
||||
ImGui::InhibitInertialScroll();
|
||||
try {
|
||||
subPortPos=portPos.at((selectedPortSet<<4)|selectedSubPort);
|
||||
} catch (std::out_of_range& e) {
|
||||
auto subPortI=portPos.find((selectedPortSet<<4)|selectedSubPort);
|
||||
if (subPortI!=portPos.cend()) {
|
||||
subPortPos=subPortI->second;
|
||||
} else {
|
||||
portDragActive=false;
|
||||
}
|
||||
}
|
||||
|
|
@ -415,22 +421,24 @@ void FurnaceGUI::drawMixer() {
|
|||
// draw connections
|
||||
for (unsigned int i: e->song.patchbay) {
|
||||
if ((i>>20)==selectedPortSet) continue;
|
||||
try {
|
||||
ImVec2 portSrc=portPos.at(i>>16);
|
||||
ImVec2 portDest=portPos.at(0x10000|(i&0xffff));
|
||||
auto portSrcI=portPos.find(i>>16);
|
||||
auto portDestI=portPos.find(0x10000|(i&0xffff));
|
||||
if (portSrcI!=portPos.cend() && portDestI!=portPos.cend()) {
|
||||
ImVec2 portSrc=portSrcI->second;
|
||||
ImVec2 portDest=portDestI->second;
|
||||
dl->AddLine(portSrc,portDest,ImGui::GetColorU32(uiColors[GUI_COLOR_PATCHBAY_CONNECTION_BG]),2.0f*dpiScale);
|
||||
} catch (std::out_of_range& e) {
|
||||
}
|
||||
}
|
||||
|
||||
// foreground
|
||||
for (unsigned int i: e->song.patchbay) {
|
||||
if ((i>>20)!=selectedPortSet) continue;
|
||||
try {
|
||||
ImVec2 portSrc=portPos.at(i>>16);
|
||||
ImVec2 portDest=portPos.at(0x10000|(i&0xffff));
|
||||
auto portSrcI=portPos.find(i>>16);
|
||||
auto portDestI=portPos.find(0x10000|(i&0xffff));
|
||||
if (portSrcI!=portPos.cend() && portDestI!=portPos.cend()) {
|
||||
ImVec2 portSrc=portSrcI->second;
|
||||
ImVec2 portDest=portDestI->second;
|
||||
dl->AddLine(portSrc,portDest,ImGui::GetColorU32(uiColors[GUI_COLOR_PATCHBAY_CONNECTION]),2.0f*dpiScale);
|
||||
} catch (std::out_of_range& e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
126
src/gui/osc.cpp
126
src/gui/osc.cpp
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -440,7 +437,7 @@ void FurnaceGUI::drawPattern() {
|
|||
ImGui::SetCursorPosX(ImGui::GetCursorPosX()+centerOff);
|
||||
}
|
||||
}
|
||||
if (ImGui::BeginTable("PatternView",displayChans+2,ImGuiTableFlags_BordersInnerV|ImGuiTableFlags_ScrollX|ImGuiTableFlags_ScrollY|ImGuiTableFlags_NoPadInnerX|ImGuiTableFlags_NoBordersInFrozenArea)) {
|
||||
if (ImGui::BeginTable("PatternView",displayChans+2,ImGuiTableFlags_BordersInnerV|ImGuiTableFlags_ScrollX|ImGuiTableFlags_ScrollY|ImGuiTableFlags_NoPadInnerX|ImGuiTableFlags_NoBordersInFrozenArea|(settings.cursorFollowsWheel?ImGuiTableFlags_NoScrollWithMouse:0))) {
|
||||
ImGui::TableSetupColumn("pos",ImGuiTableColumnFlags_WidthFixed);
|
||||
char chanID[2048];
|
||||
float lineHeight=(ImGui::GetTextLineHeight()+2*dpiScale);
|
||||
|
|
@ -829,8 +826,6 @@ void FurnaceGUI::drawPattern() {
|
|||
ImGui::GetColorU32(chanHeadBase)
|
||||
);
|
||||
}
|
||||
keyHit1[i]-=0.2f;
|
||||
if (keyHit1[i]<0.0f) keyHit1[i]=0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -278,6 +278,12 @@ void FurnaceGUI::initSystemPresets() {
|
|||
ENTRY(
|
||||
"Commodore VIC-20", {
|
||||
CH(DIV_SYSTEM_VIC20, 1.0f, 0, "clockSel=1")
|
||||
},
|
||||
"tickRate=50"
|
||||
);
|
||||
ENTRY(
|
||||
"Commodore Plus/4", {
|
||||
CH(DIV_SYSTEM_TED, 1.0f, 0, "")
|
||||
}
|
||||
);
|
||||
ENTRY(
|
||||
|
|
@ -985,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,
|
||||
|
|
@ -1401,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(
|
||||
|
|
@ -2449,6 +2467,11 @@ void FurnaceGUI::initSystemPresets() {
|
|||
CH(DIV_SYSTEM_PV1000, 1.0f, 0, "")
|
||||
}
|
||||
);
|
||||
ENTRY(
|
||||
"MOS Technology TED", {
|
||||
CH(DIV_SYSTEM_TED, 1.0f, 0, "clockSel=1")
|
||||
}
|
||||
);
|
||||
CATEGORY_END;
|
||||
|
||||
CATEGORY_BEGIN("Sample","chips/systems which use PCM or ADPCM samples for sound synthesis.");
|
||||
|
|
|
|||
|
|
@ -372,6 +372,7 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
if (sampleInfo) {
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::AlignTextToFramePadding();
|
||||
ImGui::Text("Type");
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
|
|
@ -445,6 +446,7 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
bool coarseChanged=false;
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::AlignTextToFramePadding();
|
||||
ImGui::Text("Hz");
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
|
|
@ -459,6 +461,7 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
}
|
||||
}
|
||||
|
||||
ImGui::AlignTextToFramePadding();
|
||||
ImGui::Text("Note");
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
|
|
@ -501,6 +504,7 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
}
|
||||
}
|
||||
|
||||
ImGui::AlignTextToFramePadding();
|
||||
ImGui::Text("Fine");
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
|
|
@ -537,6 +541,7 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
ImGui::TableNextColumn();
|
||||
ImGui::BeginDisabled(!(doLoop || keepLoopAlive));
|
||||
keepLoopAlive=false;
|
||||
ImGui::AlignTextToFramePadding();
|
||||
ImGui::Text("Mode");
|
||||
ImGui::SameLine();
|
||||
pushWarningColor(!warnLoopMode.empty());
|
||||
|
|
@ -560,6 +565,7 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
popWarningColor();
|
||||
|
||||
pushWarningColor(!warnLoopPos.empty());
|
||||
ImGui::AlignTextToFramePadding();
|
||||
ImGui::Text("Start");
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
|
|
@ -585,6 +591,7 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
ImGui::SetTooltip("%s",warnLoopPos.c_str());
|
||||
}
|
||||
|
||||
ImGui::AlignTextToFramePadding();
|
||||
ImGui::Text("End");
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
|
|
@ -1018,6 +1025,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 +1609,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);
|
||||
}
|
||||
|
|
|
|||
4857
src/gui/settings.cpp
4857
src/gui/settings.cpp
File diff suppressed because it is too large
Load diff
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ void FurnaceGUI::drawSubSongs(bool asChild) {
|
|||
ImGui::SetTooltip("Remove");
|
||||
}
|
||||
|
||||
ImGui::AlignTextToFramePadding();
|
||||
ImGui::Text("Name");
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -962,8 +1023,10 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
|||
int clockSel=flags.getInt("clockSel",0);
|
||||
int channels=flags.getInt("channels",0)+1;
|
||||
bool multiplex=flags.getBool("multiplex",false);
|
||||
bool lenCompensate=flags.getBool("lenCompensate",false);
|
||||
|
||||
ImGui::Text("Clock rate:");
|
||||
ImGui::Indent();
|
||||
if (ImGui::RadioButton("NTSC (1.79MHz)",clockSel==0)) {
|
||||
clockSel=0;
|
||||
altered=true;
|
||||
|
|
@ -976,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;
|
||||
|
|
@ -985,12 +1049,16 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
|||
if (ImGui::Checkbox("Disable hissing",&multiplex)) {
|
||||
altered=true;
|
||||
}
|
||||
if (ImGui::Checkbox("Scale frequency to wave length",&lenCompensate)) {
|
||||
altered=true;
|
||||
}
|
||||
|
||||
if (altered) {
|
||||
e->lockSave([&]() {
|
||||
flags.set("clockSel",clockSel);
|
||||
flags.set("channels",channels-1);
|
||||
flags.set("multiplex",multiplex);
|
||||
flags.set("lenCompensate",lenCompensate);
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
|
@ -1032,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;
|
||||
|
|
@ -1056,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;
|
||||
|
|
@ -1069,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;
|
||||
|
|
@ -1114,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;
|
||||
|
|
@ -1122,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;
|
||||
|
|
@ -1135,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;
|
||||
|
|
@ -1174,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;
|
||||
|
|
@ -1186,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;
|
||||
|
|
@ -1195,6 +1274,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
|||
chipType=1;
|
||||
altered=true;
|
||||
}
|
||||
ImGui::Unindent();
|
||||
|
||||
if (altered) {
|
||||
e->lockSave([&]() {
|
||||
|
|
@ -1208,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;
|
||||
|
|
@ -1224,6 +1305,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
|||
clockSel=3;
|
||||
altered=true;
|
||||
}
|
||||
ImGui::Unindent();
|
||||
|
||||
if (altered) {
|
||||
e->lockSave([&]() {
|
||||
|
|
@ -1237,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;
|
||||
|
|
@ -1297,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;
|
||||
|
|
@ -1306,6 +1391,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
|||
rateSel=true;
|
||||
altered=true;
|
||||
}
|
||||
ImGui::Unindent();
|
||||
|
||||
if (altered) {
|
||||
e->lockSave([&]() {
|
||||
|
|
@ -1320,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;
|
||||
|
|
@ -1336,6 +1423,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
|||
clockSel=3;
|
||||
altered=true;
|
||||
}
|
||||
ImGui::Unindent();
|
||||
|
||||
if (altered) {
|
||||
e->lockSave([&]() {
|
||||
|
|
@ -1353,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;
|
||||
|
|
@ -1377,6 +1466,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
|||
clockSel=5;
|
||||
altered=true;
|
||||
}
|
||||
ImGui::Unindent();
|
||||
|
||||
if (altered) {
|
||||
e->lockSave([&]() {
|
||||
|
|
@ -1392,6 +1482,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
|||
bool compatPan=flags.getBool("compatPan",false);
|
||||
|
||||
ImGui::Text("Clock rate:");
|
||||
ImGui::Indent();
|
||||
if (ImGui::RadioButton("14.32MHz (NTSC)",clockSel==0)) {
|
||||
clockSel=0;
|
||||
altered=true;
|
||||
|
|
@ -1425,6 +1516,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
|||
chipType=1;
|
||||
altered=true;
|
||||
}
|
||||
ImGui::Unindent();
|
||||
|
||||
if (ImGui::Checkbox("Compatible panning (0800)",&compatPan)) {
|
||||
altered=true;
|
||||
|
|
@ -1443,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;
|
||||
|
|
@ -1467,6 +1560,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
|||
clockSel=5;
|
||||
altered=true;
|
||||
}
|
||||
ImGui::Unindent();
|
||||
|
||||
if (altered) {
|
||||
e->lockSave([&]() {
|
||||
|
|
@ -1499,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;
|
||||
|
|
@ -1515,6 +1610,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
|||
interpolation=3;
|
||||
altered=true;
|
||||
}
|
||||
ImGui::Unindent();
|
||||
|
||||
if (altered) {
|
||||
e->lockSave([&]() {
|
||||
|
|
@ -1526,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);
|
||||
|
|
@ -1574,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)) {
|
||||
|
|
@ -1745,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;
|
||||
|
|
@ -1753,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;
|
||||
|
|
@ -1763,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:");
|
||||
|
||||
|
|
@ -1838,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;
|
||||
|
|
@ -1846,6 +1953,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
|||
romMode=true;
|
||||
altered=true;
|
||||
}
|
||||
ImGui::Unindent();
|
||||
|
||||
if (altered) {
|
||||
e->lockSave([&]() {
|
||||
|
|
@ -1901,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;
|
||||
|
|
@ -1909,6 +2018,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
|||
clockSel=1;
|
||||
altered=true;
|
||||
}
|
||||
ImGui::Unindent();
|
||||
|
||||
if (altered) {
|
||||
e->lockSave([&]() {
|
||||
|
|
@ -1917,6 +2027,44 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
|||
}
|
||||
break;
|
||||
}
|
||||
case DIV_SYSTEM_TED: {
|
||||
int clockSel=flags.getInt("clockSel",0);
|
||||
bool keyPriority=flags.getBool("keyPriority",true);
|
||||
|
||||
ImGui::Text("Clock rate:");
|
||||
|
||||
ImGui::Indent();
|
||||
if (ImGui::RadioButton("NTSC (1.79MHz)",clockSel==0)) {
|
||||
clockSel=0;
|
||||
altered=true;
|
||||
}
|
||||
if (ImGui::RadioButton("PAL (1.77MHz)",clockSel==1)) {
|
||||
clockSel=1;
|
||||
altered=true;
|
||||
}
|
||||
ImGui::Unindent();
|
||||
|
||||
ImGui::Text("Global parameter priority:");
|
||||
|
||||
ImGui::Indent();
|
||||
if (ImGui::RadioButton("Left to right",!keyPriority)) {
|
||||
keyPriority=false;
|
||||
altered=true;
|
||||
}
|
||||
if (ImGui::RadioButton("Last used channel",keyPriority)) {
|
||||
keyPriority=true;
|
||||
altered=true;
|
||||
}
|
||||
ImGui::Unindent();
|
||||
|
||||
if (altered) {
|
||||
e->lockSave([&]() {
|
||||
flags.set("clockSel",clockSel);
|
||||
flags.set("keyPriority",keyPriority);
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DIV_SYSTEM_SWAN:
|
||||
case DIV_SYSTEM_BUBSYS_WSG:
|
||||
case DIV_SYSTEM_PET:
|
||||
|
|
@ -1958,11 +2106,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([&]() {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -77,9 +77,6 @@ const char* FurnaceGUI::getSystemPartNumber(DivSystem sys, DivConfig& flags) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case DIV_SYSTEM_AMIGA:
|
||||
return "Amiga";
|
||||
break;
|
||||
case DIV_SYSTEM_YM2151:
|
||||
return "YM2151";
|
||||
break;
|
||||
|
|
@ -170,10 +167,10 @@ const char* FurnaceGUI::getSystemPartNumber(DivSystem sys, DivConfig& flags) {
|
|||
}
|
||||
case DIV_SYSTEM_OPL4:
|
||||
case DIV_SYSTEM_OPL4_DRUMS:
|
||||
return "OPL4";
|
||||
return "YMF278";
|
||||
break;
|
||||
case DIV_SYSTEM_MULTIPCM:
|
||||
return "MultiPCM";
|
||||
return "YMW258-F";
|
||||
break;
|
||||
case DIV_SYSTEM_RF5C68:{
|
||||
int chipType=flags.getInt("chipType",0);
|
||||
|
|
@ -220,9 +217,6 @@ const char* FurnaceGUI::getSystemPartNumber(DivSystem sys, DivConfig& flags) {
|
|||
case DIV_SYSTEM_QSOUND:
|
||||
return "QSound";
|
||||
break;
|
||||
case DIV_SYSTEM_VERA:
|
||||
return "VERA";
|
||||
break;
|
||||
case DIV_SYSTEM_X1_010:
|
||||
return "X1-010";
|
||||
break;
|
||||
|
|
@ -247,9 +241,6 @@ const char* FurnaceGUI::getSystemPartNumber(DivSystem sys, DivConfig& flags) {
|
|||
case DIV_SYSTEM_YMZ280B:
|
||||
return "YMZ280B";
|
||||
break;
|
||||
case DIV_SYSTEM_NAMCO:
|
||||
return "Namco WSG";
|
||||
break;
|
||||
case DIV_SYSTEM_NAMCO_15XX:
|
||||
return "C15";
|
||||
break;
|
||||
|
|
@ -259,9 +250,6 @@ const char* FurnaceGUI::getSystemPartNumber(DivSystem sys, DivConfig& flags) {
|
|||
case DIV_SYSTEM_MSM5232:
|
||||
return "MSM5232";
|
||||
break;
|
||||
case DIV_SYSTEM_T6W28:
|
||||
return "T6W28";
|
||||
break;
|
||||
case DIV_SYSTEM_K007232:
|
||||
return "K007232";
|
||||
break;
|
||||
|
|
@ -280,6 +268,9 @@ const char* FurnaceGUI::getSystemPartNumber(DivSystem sys, DivConfig& flags) {
|
|||
case DIV_SYSTEM_K053260:
|
||||
return "K053260";
|
||||
break;
|
||||
case DIV_SYSTEM_TED:
|
||||
return "TED";
|
||||
break;
|
||||
default:
|
||||
return FurnaceGUI::getSystemName(sys);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -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])) {
|
||||
|
|
|
|||
|
|
@ -191,6 +191,7 @@ TAParamResult pVersion(String) {
|
|||
printf("- MAME SegaPCM core by Hiromitsu Shioya and Olivier Galibert (BSD 3-clause)\n");
|
||||
printf("- QSound core by superctr (BSD 3-clause)\n");
|
||||
printf("- VICE VIC-20 by Rami Rasanen and viznut (GPLv2)\n");
|
||||
printf("- VICE TED by Andreas Boose, Tibor Biczo and Marco van den Heuvel (GPLv2)\n");
|
||||
printf("- VERA core by Frank van den Hoef (BSD 2-clause)\n");
|
||||
printf("- SAASound by Dave Hooper and Simon Owen (BSD 3-clause)\n");
|
||||
printf("- SameBoy by Lior Halphon (MIT)\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue