Merge branch 'tildearrow:master' into master
This commit is contained in:
commit
c9447dbff2
31 changed files with 285 additions and 345 deletions
|
|
@ -3851,6 +3851,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();
|
||||
|
|
@ -4042,6 +4059,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;
|
||||
|
|
@ -4064,6 +4102,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;
|
||||
|
|
@ -4080,6 +4119,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;
|
||||
|
|
@ -4107,6 +4147,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;
|
||||
|
|
@ -4123,6 +4164,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();
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -1937,8 +1937,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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -386,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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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>}},
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@ const char* aboutLine[]={
|
|||
"SwapXFO",
|
||||
"TakuikaNinja",
|
||||
"TCORPStudios",
|
||||
"Teuthida",
|
||||
"The Blender Fiddler",
|
||||
"TheDuccinator",
|
||||
"theloredev",
|
||||
|
|
|
|||
|
|
@ -330,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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -642,9 +642,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;
|
||||
|
|
|
|||
|
|
@ -1653,16 +1653,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(
|
||||
|
|
@ -4592,7 +4582,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;
|
||||
|
|
@ -4695,9 +4684,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");
|
||||
}
|
||||
|
|
@ -4791,11 +4777,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())) {
|
||||
|
|
|
|||
|
|
@ -402,7 +402,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,
|
||||
|
|
@ -607,7 +606,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,
|
||||
|
|
|
|||
|
|
@ -641,7 +641,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),
|
||||
|
|
|
|||
|
|
@ -2288,9 +2288,6 @@ void FurnaceGUI::drawInsEdit() {
|
|||
ImGui::SetTooltip("Save");
|
||||
}
|
||||
if (ImGui::BeginPopupContextItem("InsSaveFormats",ImGuiMouseButton_Right)) {
|
||||
if (ImGui::MenuItem("save in legacy format...")) {
|
||||
doAction(GUI_ACTION_INS_LIST_SAVE_OLD);
|
||||
}
|
||||
if (ImGui::MenuItem("save as .dmp...")) {
|
||||
doAction(GUI_ACTION_INS_LIST_SAVE_DMP);
|
||||
}
|
||||
|
|
@ -5563,6 +5560,7 @@ 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;
|
||||
|
|
|
|||
|
|
@ -991,7 +991,7 @@ void FurnaceGUI::initSystemPresets() {
|
|||
}
|
||||
);
|
||||
ENTRY(
|
||||
"PC + AdLib/Sound Blaster (drums mode)", {
|
||||
"PC + Sound Blaster (drums mode)", {
|
||||
CH(DIV_SYSTEM_OPL2_DRUMS, 1.0f, 0, ""),
|
||||
CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, ""),
|
||||
CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue