Compare commits

..

10 commits

Author SHA1 Message Date
Natt Akuma dcf784c43f Kurumitsu-8L: add (nonstandard) VGM export 2025-06-28 01:19:25 +07:00
Natt Akuma 434fc96bba Kurumitsu-8L: add echo and PCM sample 2025-06-28 00:57:32 +07:00
Natt Akuma 37b2a058c3 Kurumitsu-8L: change channel volume handling
In order to keep the same modulation output, it now scales with pan instead of envelope
2025-06-28 00:55:44 +07:00
Natt Akuma d7984896d8 Add Kurumitsu-8L support
No sample playback yet
2025-06-28 00:55:43 +07:00
suno lili So b7c50b272d handling DivNoteEvent also sets the channel's note 2025-06-16 03:59:38 -05:00
tildearrow 12a352cbd4 and another retired entry 2025-06-15 23:06:47 -05:00
tildearrow e91c102710 author retired entry 2025-06-15 13:51:32 -05:00
tildearrow 9ff85bc544 GUI: reset macro zoom when replacing ins
issue #2535
2025-06-14 19:09:47 -05:00
tildearrow d856580f90 VGM export: fix OPNAB CSM
issue #2557
2025-06-14 18:09:12 -05:00
tildearrow 4089fd6594 corrections 2025-06-14 17:50:13 -05:00
27 changed files with 973 additions and 10 deletions

View file

@ -814,6 +814,7 @@ src/engine/platform/nds.cpp
src/engine/platform/bifurcator.cpp
src/engine/platform/sid2.cpp
src/engine/platform/sid3.cpp
src/engine/platform/kurumitsu8l.cpp
src/engine/platform/pcmdac.cpp
src/engine/platform/dummy.cpp

View file

@ -84,6 +84,7 @@ these demo songs are not under the GPL. all rights are reserved to the original
- Miker
- Molkirill
- MrCoolDude
- Mr. Saturn
- NeoWar
- Nerreave
- niffuM
@ -92,6 +93,7 @@ these demo songs are not under the GPL. all rights are reserved to the original
- Notakin
- nwcr
- NyaongI
- OddPandemonium
- PeyPey
- PichuMario
- pixelated
@ -145,7 +147,6 @@ these demo songs are not under the GPL. all rights are reserved to the original
- Wegfrei
- Xan
- Yuzugure!
- z1cmr40
- Zabir
- Zaxinoth Digital
- Zaxolotl

Binary file not shown.

BIN
demos/blank/map01.fur Normal file

Binary file not shown.

Binary file not shown.

View file

@ -93,6 +93,7 @@
#include "platform/bifurcator.h"
#include "platform/sid2.h"
#include "platform/sid3.h"
#include "platform/kurumitsu8l.h"
#include "platform/dummy.h"
#include "../ta-log.h"
#include "song.h"
@ -787,6 +788,9 @@ void DivDispatchContainer::init(DivSystem sys, DivEngine* eng, int chanCount, do
((DivPlatformOPL*)dispatch)->setCore(eng->getConfInt("opl4Core",0));
}
break;
case DIV_SYSTEM_KURUMITSU_8L:
dispatch=new DivPlatformKurumitsu8L;
break;
case DIV_SYSTEM_DUMMY:
dispatch=new DivPlatformDummy;
break;

View file

@ -583,7 +583,7 @@ class DivEngine {
void processRow(int i, bool afterDelay);
void nextOrder();
void nextRow();
void performVGMWrite(SafeWriter* w, DivSystem sys, DivRegWrite& write, int streamOff, double* loopTimer, double* loopFreq, int* loopSample, bool* sampleDir, bool isSecond, int* pendingFreq, int* playingSample, int* setPos, unsigned int* sampleOff8, unsigned int* sampleLen8, size_t bankOffset, bool directStream, bool* sampleStoppable, bool dpcm07, DivDispatch** writeNES, int rateCorrection);
void performVGMWrite(SafeWriter* w, int disIdx, DivSystem sys, DivRegWrite& write, int streamOff, double* loopTimer, double* loopFreq, int* loopSample, bool* sampleDir, bool isSecond, int* pendingFreq, int* playingSample, int* setPos, unsigned int* sampleOff8, unsigned int* sampleLen8, size_t bankOffset, bool directStream, bool* sampleStoppable, bool dpcm07, DivDispatch** writeNES, int rateCorrection);
// returns true if end of song.
bool nextTick(bool noAccum=false, bool inhibitLowLat=false);
bool perSystemEffect(int ch, unsigned char effect, unsigned char effectVal);

View file

@ -34,6 +34,7 @@ enum DivROMExportOptions {
DIV_ROM_SAP_R,
DIV_ROM_IPOD,
DIV_ROM_GRUB,
DIV_ROM_KMM,
DIV_ROM_MAX
};

View file

@ -54,7 +54,7 @@ void DivExportGRUB::run() {
return;
}
if (IGNORED>0) {
logAppendf("WARNING: iPod .tone export ignoring %d unsupported system%c",IGNORED,IGNORED>1?'s':' ');
logAppendf("WARNING: GRUB export ignoring unsup sys count: %d",IGNORED);
}
size_t tickCount=0;

View file

@ -54,7 +54,7 @@ void DivExportiPod::run() {
return;
}
if (IGNORED>0) {
logAppendf("WARNING: iPod .tone export ignoring %d unsupported system%c",IGNORED,IGNORED>1?'s':' ');
logAppendf("WARNING: tone export ignoring unsup sys count: %d",IGNORED);
}
size_t tickCount=0;

View file

@ -1438,6 +1438,8 @@ void DivInstrument::putInsData2(SafeWriter* w, bool fui, const DivSong* song, bo
break;
case DIV_INS_UPD1771C:
break;
case DIV_INS_KURUMITSU_8L:
break;
case DIV_INS_MAX:
break;
case DIV_INS_NULL:

View file

@ -99,6 +99,7 @@ enum DivInstrumentType: unsigned short {
DIV_INS_SUPERVISION=64,
DIV_INS_UPD1771C=65,
DIV_INS_SID3=66,
DIV_INS_KURUMITSU_8L=67,
DIV_INS_MAX,
DIV_INS_NULL
};

View file

@ -0,0 +1,715 @@
/**
* Furnace Tracker - multi-system chiptune tracker
* Copyright (C) 2021-2025 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 "kurumitsu8l.h"
#include "../engine.h"
#include <math.h>
#define chRead(c,a) regPool[(c)*16+(a)]
#define chWrite(c,a,v) if (!skipRegisterWrites) {regPool[(c)*16+(a)]=v; if (dumpWrites) {addWrite(a,v);} }
#define chDWrite(c,a,v) regPool[(c)*16+(a)]=v;
#define CHIP_FREQBASE 67108864
const char* regCheatSheetKurumitsu8L[]={
"CHxAtt", "00+x*10",
"CHxPanL", "01+x*10",
"CHxPanR", "02+x*10",
"CHxMod", "03+x*10",
"CHxFreq", "04+x*10",
"CHxEcho", "07+x*10",
"CHxAcc", "08+x*10",
"CH7Bank", "73",
"CH7LoopE", "7C",
"CH7LoopL", "7E",
"EchoFB", "80",
"EchoVolL", "81",
"EchoVolR", "82",
NULL
};
const char** DivPlatformKurumitsu8L::getRegisterSheet() {
return regCheatSheetKurumitsu8L;
}
void DivPlatformKurumitsu8L::acquire(short** buf, size_t len) {
const int volTab[32]={
65535, 64130, 62756, 61411, 60095, 58808, 57547, 56314, 55108, 53927, 52771, 51640, 50534, 49451, 48391, 47354,
46340, 45347, 44375, 43424, 42494, 41583, 40692, 39820, 38967, 38132, 37315, 36515, 35733, 34967, 34218, 33485
};
for (int i=0; i<8; i++) {
oscBuf[i]->begin(len);
}
signed char echoFB=chRead(8,0);
signed char echoL=chRead(8,1);
signed char echoR=chRead(8,2);
for (size_t h=0; h<len; h++) {
int outE=((int)echoMem[echoPtr]*echoFB)<<11;
int outAL=((int)echoMem[echoPtr]*echoL)<<11;
int outAR=((int)echoMem[echoPtr]*echoR)<<11;
int modData=0;
for (int i=0; i<8; i++) {
unsigned char vol=chRead(i,0);
signed char panL=chRead(i,1);
signed char panR=chRead(i,2);
signed char echo=chRead(i,7);
unsigned freq=chRead(i,4)|((unsigned)chRead(i,5)<<8)|((unsigned)chRead(i,6)<<16)|((unsigned)chRead(i,7)<<24);
unsigned phase=chRead(i,8)|((unsigned)chRead(i,9)<<8)|((unsigned)chRead(i,10)<<16)|((unsigned)chRead(i,11)<<24);
int fbData=0;
int data=0;
if (i<7) {
unsigned char fb=chRead(i,3)&0xf;
unsigned char mod=(chRead(i,3)>>4)&0xf;
fbData=chRead(i,12)|((int)chRead(i,13)<<8)|((int)chRead(i,14)<<16)|((int)chRead(i,15)<<24);
unsigned phase_modded=phase;
phase_modded+=fbData>>fb;
phase_modded+=modData>>mod;
data=wtMem[i][(phase_modded>>16)&255];
phase+=freq;
} else {
unsigned loopE=chRead(i,12)|((unsigned)chRead(i,13)<<8);
unsigned loopL=chRead(i,14)|((unsigned)chRead(i,15)<<8);
data=sampleMem[(phase>>16)|(chRead(i,3)<<16)];
int64_t newPhase=phase+(freq&0x00ffffff);
if (newPhase>=(loopE<<16)) {
newPhase-=loopL<<16;
}
phase=newPhase;
}
int out=data*(volTab[vol&0x1f]>>(vol>>5));
outAL+=out*panL/256;
outAR+=out*panR/256;
outE+=out*echo/256;
oscBuf[i]->putSample(h,out*((int)abs(panL)+abs(panR))/65536);
chDWrite(i,8,phase&0xff);
chDWrite(i,9,(phase>>8)&0xff);
chDWrite(i,10,(phase>>16)&0xff);
chDWrite(i,11,(phase>>24)&0xff);
if (i<7) {
fbData=out;
modData=out;
chDWrite(i,12,fbData&0xff);
chDWrite(i,13,(fbData>>8)&0xff);
chDWrite(i,14,(fbData>>16)&0xff);
chDWrite(i,15,(fbData>>24)&0xff);
}
}
buf[0][h]=outAL>>10;
buf[1][h]=outAR>>10;
outE>>=18;
if (outE<0) outE++;
echoMem[echoPtr]=outE;
echoPtr=(echoPtr+1)&4095;
}
for (int i=0; i<8; i++) {
oscBuf[i]->end(len);
}
}
void DivPlatformKurumitsu8L::updateWave(int ch) {
if (ch>=7) return;
for (int i=0; i<256; i++) {
wtMem[ch][i]=chan[ch].ws.output[i]^128;
}
}
void DivPlatformKurumitsu8L::writePan(int ch) {
if (!isMuted[ch] && chan[ch].active) {
chWrite(ch,1,VOL_SCALE_LINEAR(chan[ch].panL,chan[ch].vol,127)*(chan[ch].invertL?-1:1));
chWrite(ch,2,VOL_SCALE_LINEAR(chan[ch].panR,chan[ch].vol,127)*(chan[ch].invertR?-1:1));
} else {
chWrite(ch,1,0);
chWrite(ch,2,0);
}
}
void DivPlatformKurumitsu8L::writeEcho(int ch) {
if (!isMuted[ch] && chan[ch].active) {
chWrite(ch,7,chan[ch].echo);
} else {
chWrite(ch,7,0);
}
}
void DivPlatformKurumitsu8L::tick(bool sysTick) {
for (int i=0; i<8; i++) {
bool panChanged=false;
bool echoChanged=false;
chan[i].std.next();
if (chan[i].std.vol.had) {
chan[i].outVol=chan[i].std.vol.val*(chan[i].isAmiga?4:1);
if (chan[i].outVol>255) chan[i].outVol=255;
if (!isMuted[i] && chan[i].active) {
chWrite(i,0,~chan[i].outVol&255);
}
}
if (NEW_ARP_STRAT) {
chan[i].handleArp();
} else if (chan[i].std.arp.had) {
if (!chan[i].inPorta) {
chan[i].baseFreq=NOTE_FREQUENCY(parent->calcArp(chan[i].note,chan[i].std.arp.val));
}
chan[i].freqChanged=true;
}
if (chan[i].std.duty.had) {
chan[i].echo=chan[i].std.duty.val;
echoChanged=true;
}
if (chan[i].std.wave.had) {
if (chan[i].wave!=chan[i].std.wave.val || chan[i].ws.activeChanged()) {
chan[i].wave=chan[i].std.wave.val;
chan[i].ws.changeWave1(chan[i].wave);
if (!chan[i].keyOff) chan[i].keyOn=true;
}
}
if (chan[i].std.panL.had) {
chan[i].panL=chan[i].std.panL.val;
panChanged=true;
}
if (chan[i].std.panR.had) {
chan[i].panR=chan[i].std.panR.val;
panChanged=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,-1048575,1048575);
} else {
chan[i].pitch2=chan[i].std.pitch.val;
}
chan[i].freqChanged=true;
}
if (chan[i].std.phaseReset.had) {
if (chan[i].std.phaseReset.val==1 && chan[i].active) {
if (i==7) {
chan[i].audPos=0;
chan[i].setPos=true;
} else {
chWrite(i,8,0);
chWrite(i,9,0);
chWrite(i,10,0);
chWrite(i,11,0);
}
}
}
if (i<7 && chan[i].std.ex1.had) {
unsigned char val=chRead(i,3)&0xf0;
chWrite(i,3,val|(~chan[i].std.ex1.val&0xf));
}
if (i<7 && chan[i].std.ex2.had) {
unsigned char val=chRead(i,3)&0x0f;
chWrite(i,3,val|((~chan[i].std.ex2.val&0xf)<<4));
}
if (chan[i].std.ex3.had) {
chan[i].invertL=chan[i].std.ex3.val&2;
chan[i].invertR=chan[i].std.ex3.val&1;
panChanged=true;
}
if (chan[i].setPos) {
// force keyon
chan[i].keyOn=true;
chan[i].setPos=false;
} else {
chan[i].audPos=0;
}
if (chan[i].active) {
if (chan[i].ws.tick() || (chan[i].std.phaseReset.had && chan[i].std.phaseReset.val==1)) {
updateWave(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,2,chan[i].pitch2,chipClock,CHIP_FREQBASE);
if (i==7) {
DivSample* s=parent->getSample(chan[i].sample);
double off=(s->centerRate>=1)?((double)s->centerRate/parent->getCenterRate()):1.0;
chan[i].freq*=off/16.;
}
if (chan[i].freq<0) chan[i].freq=0;
if (chan[i].freq>8388608) chan[i].freq=8388608;
chWrite(i,4,chan[i].freq&0xff);
chWrite(i,5,(chan[i].freq>>8)&0xff);
chWrite(i,6,(chan[i].freq>>16)&0xff);
chan[i].freqChanged=false;
}
if (chan[i].keyOn || chan[i].keyOff) {
if (!chan[i].std.vol.had) {
chan[i].outVol=255;
}
if (!isMuted[i] && chan[i].active) {
chWrite(i,0,~chan[i].outVol&255);
} else {
chWrite(i,0,255);
}
panChanged=true;
echoChanged=true;
if (chan[i].keyOn) {
chan[i].keyOn=false;
if (i==7) {
DivSample* s=parent->getSample(chan[i].sample);
unsigned int start, length, loop;
start=sampleOff[chan[i].sample];
if (s->isLoopable()) {
length=s->loopEnd;
loop=s->loopEnd-s->loopStart;
} else {
length=s->samples+16;
loop=16;
}
if (length>65535) length=65535;
if (chan[i].audPos>0) {
start=start+MIN(chan[i].audPos,length);
}
chWrite(i,8,0);
chWrite(i,9,0);
chWrite(i,10,start&0xff);
chWrite(i,11,(start>>8)&0xff);
chWrite(i,3,start>>16);
chWrite(i,12,(start+length)&0xff);
chWrite(i,13,((start+length)>>8)&0xff);
chWrite(i,14,loop&0xff);
chWrite(i,15,(loop>>8)&0xff);
}
}
if (chan[i].keyOff) chan[i].keyOff=false;
}
if (panChanged) writePan(i);
if (echoChanged) writeEcho(i);
}
}
int DivPlatformKurumitsu8L::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_AMIGA);
chan[c.chan].isAmiga=ins->type==DIV_INS_AMIGA;
if (c.chan==7 && c.value!=DIV_NOTE_NULL) {
chan[c.chan].sample=ins->amiga.getSample(c.value);
c.value=ins->amiga.getFreq(c.value);
} else {
if (chan[c.chan].wave<0) {
chan[c.chan].wave=0;
chan[c.chan].ws.changeWave1(chan[c.chan].wave);
}
chan[c.chan].ws.init(ins,256,255,chan[c.chan].insChanged);
}
if (c.chan!=7 || chan[c.chan].sample<0 || chan[c.chan].sample>=parent->song.sampleLen) {
chan[c.chan].sample=-1;
}
if (c.value!=DIV_NOTE_NULL) {
chan[c.chan].baseFreq=NOTE_FREQUENCY(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=255;
if (!isMuted[c.chan] && chan[c.chan].active) {
chWrite(c.chan,0,~chan[c.chan].outVol&255);
}
}
chan[c.chan].insChanged=false;
break;
}
case DIV_CMD_NOTE_OFF:
chan[c.chan].sample=-1;
chan[c.chan].active=false;
chan[c.chan].keyOff=true;
chan[c.chan].macroInit(NULL);
break;
case DIV_CMD_NOTE_OFF_ENV:
case DIV_CMD_ENV_RELEASE:
chan[c.chan].std.release();
break;
case DIV_CMD_INSTRUMENT:
if (chan[c.chan].ins!=c.value || c.value2==1) {
chan[c.chan].ins=c.value;
chan[c.chan].insChanged=true;
}
break;
case DIV_CMD_VOLUME:
if (chan[c.chan].vol!=c.value) {
chan[c.chan].vol=c.value;
writePan(c.chan);
}
break;
case DIV_CMD_GET_VOLUME:
return chan[c.chan].vol;
break;
case DIV_CMD_SNES_INVERT:
chan[c.chan].invertL=(c.value>>4);
chan[c.chan].invertR=c.value&15;
writePan(c.chan);
break;
case DIV_CMD_PITCH:
chan[c.chan].pitch=c.value;
chan[c.chan].freqChanged=true;
break;
case DIV_CMD_WAVE:
chan[c.chan].wave=c.value;
chan[c.chan].ws.changeWave1(chan[c.chan].wave);
chan[c.chan].keyOn=true;
break;
case DIV_CMD_NOTE_PORTA: {
int destFreq=NOTE_FREQUENCY(c.value2);
bool return2=false;
if (destFreq>chan[c.chan].baseFreq) {
chan[c.chan].baseFreq+=c.value*((parent->song.linearPitch==2)?1:8);
if (chan[c.chan].baseFreq>=destFreq) {
chan[c.chan].baseFreq=destFreq;
return2=true;
}
} else {
chan[c.chan].baseFreq-=c.value*((parent->song.linearPitch==2)?1:8);
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_PANNING: {
chan[c.chan].panL=c.value;
chan[c.chan].panR=c.value2;
writePan(c.chan);
break;
}
case DIV_CMD_LEGATO:
chan[c.chan].baseFreq=NOTE_FREQUENCY(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_PCE));
}
if (!chan[c.chan].inPorta && c.value && !parent->song.brokenPortaArp && chan[c.chan].std.arp.will && !NEW_ARP_STRAT) chan[c.chan].baseFreq=NOTE_FREQUENCY(chan[c.chan].note);
chan[c.chan].inPorta=c.value;
break;
case DIV_CMD_SAMPLE_POS:
chan[c.chan].audPos=c.value;
chan[c.chan].setPos=true;
break;
case DIV_CMD_FM_FB: {
if (c.chan>=7) break;
unsigned char val=chRead(c.chan,3)&0xf0;
chWrite(c.chan,3,val|(~c.value&0xf));
break;
}
case DIV_CMD_FM_PM_DEPTH: {
if (c.chan>=7) break;
unsigned char val=chRead(c.chan,3)&0x0f;
chWrite(c.chan,3,val|((~c.value&0xf)<<4));
break;
}
case DIV_CMD_SNES_ECHO:
chan[c.chan].echo=c.value;
writeEcho(c.chan);
break;
case DIV_CMD_SNES_ECHO_FEEDBACK:
chWrite(8,0,c.value);
break;
case DIV_CMD_SNES_ECHO_VOL_LEFT:
chWrite(8,1,c.value);
break;
case DIV_CMD_SNES_ECHO_VOL_RIGHT:
chWrite(8,2,c.value);
break;
case DIV_CMD_GET_VOLMAX:
return 127;
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_CMD_MACRO_RESTART:
chan[c.chan].std.restart(c.value);
break;
default:
break;
}
return 1;
}
void DivPlatformKurumitsu8L::muteChannel(int ch, bool mute) {
isMuted[ch]=mute;
if (!mute && chan[ch].active) {
chWrite(ch,0,~chan[ch].outVol&255);
writePan(ch);
writeEcho(ch);
} else {
chWrite(ch,0,255);
}
}
void DivPlatformKurumitsu8L::forceIns() {
for (int i=0; i<8; i++) {
chan[i].sample=-1;
chan[i].insChanged=true;
chan[i].freqChanged=true;
updateWave(i);
}
}
void* DivPlatformKurumitsu8L::getChanState(int ch) {
return &chan[ch];
}
DivMacroInt* DivPlatformKurumitsu8L::getChanMacroInt(int ch) {
return &chan[ch].std;
}
unsigned short DivPlatformKurumitsu8L::getPan(int ch) {
return (chRead(ch,1)<<8)|chRead(ch,2);
}
void DivPlatformKurumitsu8L::getPaired(int ch, std::vector<DivChannelPair>& ret) {
if (ch==0 || ch==7) return;
unsigned char mod=~(chRead(ch,3)>>4)&0xf;
if (mod>0) {
sprintf(modLabel[ch],"%d",mod);
ret.push_back(DivChannelPair(modLabel[ch],ch-1));
}
}
DivSamplePos DivPlatformKurumitsu8L::getSamplePos(int ch) {
if (ch!=7 || chan[ch].sample<0 ||
chan[ch].sample>=parent->song.sampleLen || !chan[ch].active
) {
return DivSamplePos();
}
return DivSamplePos(
chan[ch].sample,
(((int)regPool[0x7a]|((int)regPool[0x7b]<<8)|((int)regPool[0x73]<<16)))-sampleOff[chan[ch].sample],
(int64_t)chan[ch].freq*rate/0x10000
);
}
DivDispatchOscBuffer* DivPlatformKurumitsu8L::getOscBuffer(int ch) {
return oscBuf[ch];
}
unsigned char* DivPlatformKurumitsu8L::getRegisterPool() {
return regPool;
}
int DivPlatformKurumitsu8L::getRegisterPoolSize() {
return 16*8+3;
}
const void* DivPlatformKurumitsu8L::getSampleMem(int index) {
if (index == 0) return sampleMem;
if (index == 1) return wtMem;
return NULL;
}
size_t DivPlatformKurumitsu8L::getSampleMemCapacity(int index) {
return index == 0 ? 16777216 : 0;
}
size_t DivPlatformKurumitsu8L::getSampleMemUsage(int index) {
return index == 0 ? sampleMemLen : 0;
}
bool DivPlatformKurumitsu8L::isSampleLoaded(int index, int sample) {
if (index!=0) return false;
if (sample<0 || sample>255) return false;
return sampleLoaded[sample];
}
const DivMemoryComposition* DivPlatformKurumitsu8L::getMemCompo(int index) {
switch (index) {
case 0: return &romMemCompo;
case 1: return &wtMemCompo;
case 2: return &echoMemCompo;
}
return NULL;
}
void DivPlatformKurumitsu8L::renderSamples(int sysID) {
int maxPos=getSampleMemCapacity();
memset(sampleMem,0,maxPos);
romMemCompo.entries.clear();
romMemCompo.capacity=maxPos;
int memPos=0;
for (int i=0; i<parent->song.sampleLen; i++) {
DivSample* s=parent->song.sample[i];
if (!s->renderOn[0][sysID]) {
sampleOff[i]=0;
continue;
}
int length=s->isLoopable()?s->loopEnd:s->samples;
int actualLength=length;
// if it's one-shot, add 16 silent samples for looping area
// this should be enough for most cases even though the
// frequency register can make position jump by up to 256 samples
int oneShotPos=length;
if (!s->isLoopable()) actualLength+=16;
if (actualLength>65535) actualLength=65535;
if (!s->isLoopable()) oneShotPos=actualLength-16;
if (0x10000-(memPos&0xffff)<actualLength) {
memPos=(memPos+0x10000)&~0xffff;
if (memPos==maxPos) {
logW("out of Kurumitsu-8L PCM memory for sample %d!",i);
break;
}
}
sampleOff[i]=memPos;
memcpy(&sampleMem[memPos],s->data8,oneShotPos);
memPos+=actualLength;
romMemCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"PCM",i,sampleOff[i],memPos));
sampleLoaded[i]=true;
}
sampleMemLen=memPos;
romMemCompo.used=sampleMemLen;
}
void DivPlatformKurumitsu8L::reset() {
memset(regPool,0,sizeof(regPool));
memset(wtMem,0xff,sizeof(wtMem));
memset(echoMem,0,sizeof(echoMem));
echoPtr=0;
if (dumpWrites) {
addWrite(0xffffffff,0);
}
for (int i=0; i<8; i++) {
chan[i]=DivPlatformKurumitsu8L::Channel();
chan[i].std.setEngine(parent);
chan[i].ws.setEngine(parent);
chan[i].ws.init(NULL,256,255,false);
chWrite(i,0,0xff); // set env to min
if (i<7) chWrite(i,3,0xff); // set mod to min
}
chWrite(8,0,initEchoFeedback);
chWrite(8,1,initEchoVolL);
chWrite(8,2,initEchoVolR);
}
int DivPlatformKurumitsu8L::getOutputCount() {
return 2;
}
bool DivPlatformKurumitsu8L::keyOffAffectsArp(int ch) {
return true;
}
void DivPlatformKurumitsu8L::notifyWaveChange(int wave) {
for (int i=0; i<8; i++) {
if (chan[i].wave==wave) {
chan[i].ws.changeWave1(wave);
updateWave(i);
}
}
}
void DivPlatformKurumitsu8L::notifyInsDeletion(void* ins) {
for (int i=0; i<8; i++) {
chan[i].std.notifyInsDeletion((DivInstrument*)ins);
}
}
int DivPlatformKurumitsu8L::mapVelocity(int ch, float vel) {
// -0.19dB per step
if (vel==0) return 0;
if (vel>=1.0) return 255;
return CLAMP(roundf(256.f-(32.f-log2f(vel)*32.f)),0,255);
}
void DivPlatformKurumitsu8L::setFlags(const DivConfig& flags) {
chipClock=3072000;
CHECK_CUSTOM_CLOCK;
rate=chipClock/64;
for (int i=0; i<8; i++) {
oscBuf[i]->setRate(rate);
}
initEchoVolL=flags.getInt("echoVolL",0);
initEchoVolR=flags.getInt("echoVolR",0);
initEchoFeedback=flags.getInt("echoFeedback",0);
}
void DivPlatformKurumitsu8L::poke(unsigned int addr, unsigned short val) {
if (addr < (unsigned int)getRegisterPoolSize()) chWrite(addr>>4,addr&0xf,val);
}
void DivPlatformKurumitsu8L::poke(std::vector<DivRegWrite>& wlist) {
for (DivRegWrite& i: wlist) {
if (i.addr < (unsigned int)getRegisterPoolSize()) chWrite(i.addr>>4,i.addr&0xf,i.val);
}
}
int DivPlatformKurumitsu8L::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p;
dumpWrites=false;
skipRegisterWrites=false;
memset(modLabel,0,sizeof(modLabel));
for (int i=0; i<8; i++) {
isMuted[i]=false;
oscBuf[i]=new DivDispatchOscBuffer;
}
sampleMem=new signed char[getSampleMemCapacity()];
sampleMemLen=0;
romMemCompo=DivMemoryComposition();
romMemCompo.name="Sample ROM";
wtMemCompo=DivMemoryComposition();
wtMemCompo.name="Wavetable RAM";
wtMemCompo.capacity=256*7;
wtMemCompo.memory=(unsigned char*)wtMem;
wtMemCompo.waveformView=DIV_MEMORY_WAVE_8BIT_SIGNED;
echoMemCompo=DivMemoryComposition();
echoMemCompo.name="Echo Buffer";
echoMemCompo.capacity=4096;
echoMemCompo.memory=(unsigned char*)echoMem;
echoMemCompo.waveformView=DIV_MEMORY_WAVE_8BIT_SIGNED;
wtMemCompo.used=256*7;
echoMemCompo.used=4096;
wtMemCompo.entries.clear();
echoMemCompo.entries.clear();
for (int i=0; i<7; i++) {
wtMemCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_WAVE_RAM, fmt::sprintf("Channel %d",i+1),-1,i*256,i*256+256));
}
echoMemCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_ECHO, "Echo Buffer",-1,0,4096));
setFlags(flags);
reset();
return 8;
}
void DivPlatformKurumitsu8L::quit() {
for (int i=0; i<8; i++) {
delete oscBuf[i];
}
}
DivPlatformKurumitsu8L::~DivPlatformKurumitsu8L() {
}

View file

@ -0,0 +1,108 @@
/**
* Furnace Tracker - multi-system chiptune tracker
* Copyright (C) 2021-2025 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 _KURUMITSU_8L_H
#define _KURUMITSU_8L_H
#include "../dispatch.h"
#include "../../fixedQueue.h"
#include "../waveSynth.h"
class DivPlatformKurumitsu8L: public DivDispatch {
struct Channel: public SharedChannel<int> {
unsigned char panL, panR;
unsigned char echo;
unsigned int audPos;
int sample, wave;
bool invertL, invertR;
bool setPos, isAmiga;
DivWaveSynth ws;
Channel():
SharedChannel<int>(127),
panL(127),
panR(127),
echo(0),
audPos(0),
sample(-1),
wave(-1),
invertL(false),
invertR(false),
setPos(false),
isAmiga(false) {}
};
Channel chan[8];
DivDispatchOscBuffer* oscBuf[8];
bool isMuted[8];
unsigned int sampleOff[256];
bool sampleLoaded[256];
unsigned char regPool[8*16+3];
signed char wtMem[7][256];
signed char echoMem[4096];
int echoPtr;
char modLabel[8][4];
signed char initEchoVolL;
signed char initEchoVolR;
signed char initEchoFeedback;
signed char* sampleMem;
size_t sampleMemLen;
DivMemoryComposition romMemCompo;
DivMemoryComposition wtMemCompo;
DivMemoryComposition echoMemCompo;
void updateWave(int ch);
void writePan(int ch);
void writeEcho(int ch);
friend void putDispatchChip(void*,int);
friend void putDispatchChan(void*,int,int);
public:
void acquire(short** buf, size_t len);
int dispatch(DivCommand c);
void* getChanState(int chan);
DivMacroInt* getChanMacroInt(int ch);
unsigned short getPan(int chan);
void getPaired(int ch, std::vector<DivChannelPair>& ret);
DivSamplePos getSamplePos(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 notifyWaveChange(int wave);
void notifyInsDeletion(void* ins);
int mapVelocity(int ch, float vel);
void poke(unsigned int addr, unsigned short val);
void poke(std::vector<DivRegWrite>& wlist);
const char** getRegisterSheet();
const void* getSampleMem(int index = 0);
size_t getSampleMemCapacity(int index = 0);
size_t getSampleMemUsage(int index = 0);
bool isSampleLoaded(int index, int sample);
const DivMemoryComposition* getMemCompo(int index);
void renderSamples(int chipID);
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit();
~DivPlatformKurumitsu8L();
};
#endif

View file

@ -1616,6 +1616,7 @@ bool DivEngine::nextTick(bool noAccum, bool inhibitLowLat) {
}
dispatchCmd(DivCommand(DIV_CMD_NOTE_ON,note.channel,note.note));
keyHit[note.channel]=true;
chan[note.channel].note = note.note;
chan[note.channel].releasing=false;
chan[note.channel].noteOnInhibit=true;
chan[note.channel].lastIns=note.ins;

View file

@ -146,6 +146,7 @@ enum DivSystem {
DIV_SYSTEM_UPD1771C,
DIV_SYSTEM_SID3,
DIV_SYSTEM_C64_PCM,
DIV_SYSTEM_KURUMITSU_8L,
DIV_SYSTEM_MAX
};

View file

@ -2342,6 +2342,26 @@ void DivEngine::registerSystems() {
{DIV_INS_STD, DIV_INS_STD, DIV_INS_STD, DIV_INS_STD, DIV_INS_STD, DIV_INS_STD, DIV_INS_STD, DIV_INS_STD}
);
sysDefs[DIV_SYSTEM_KURUMITSU_8L]=new DivSysDef(
_("Kurumitsu-8L"), NULL, 0xfe, 0, 8, false, true, 0x151, false, 1U<<DIV_SAMPLE_DEPTH_8BIT, 256, 256,
_(":grins:"),
{_("Channel 1"), _("Channel 2"), _("Channel 3"), _("Channel 4"), _("Channel 5"), _("Channel 6"), _("Channel 7"), _("Sample")},
{"CH1", "CH2", "CH3", "CH4", "CH5", "CH6", "CH7", "CH8"},
{DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_PCM},
{DIV_INS_KURUMITSU_8L, DIV_INS_KURUMITSU_8L, DIV_INS_KURUMITSU_8L, DIV_INS_KURUMITSU_8L, DIV_INS_KURUMITSU_8L, DIV_INS_KURUMITSU_8L, DIV_INS_KURUMITSU_8L, DIV_INS_KURUMITSU_8L},
{},
{
{0x10, {DIV_CMD_WAVE, _("10xx: Set waveform")}},
{0x11, {DIV_CMD_FM_FB, _("11xx: Set feedback (0 to F)")}},
{0x12, {DIV_CMD_FM_PM_DEPTH, _("12xx: Set modulation (0 to F)")}},
{0x13, {DIV_CMD_SNES_ECHO, _("13xx: Set channel echo input volume")}},
{0x14, {DIV_CMD_SNES_INVERT, _("14xy: Toggle invert (x: left; y: right)")}},
{0x1a, {DIV_CMD_SNES_ECHO_VOL_LEFT, _("1Axx: Set left global echo output volume")}},
{0x1b, {DIV_CMD_SNES_ECHO_VOL_RIGHT, _("1Bxx: Set right global echo output volume")}},
{0x1c, {DIV_CMD_SNES_ECHO_FEEDBACK, _("1Cxx: Set global echo feedback")}},
}
);
for (int i=0; i<DIV_MAX_CHIP_DEFS; i++) {
if (sysDefs[i]==NULL) continue;
if (sysDefs[i]->id!=0) {

View file

@ -24,7 +24,7 @@
// this function is so long
// may as well make it something else
void DivEngine::performVGMWrite(SafeWriter* w, DivSystem sys, DivRegWrite& write, int streamOff, double* loopTimer, double* loopFreq, int* loopSample, bool* sampleDir, bool isSecond, int* pendingFreq, int* playingSample, int* setPos, unsigned int* sampleOff8, unsigned int* sampleLen8, size_t bankOffset, bool directStream, bool* sampleStoppable, bool dpcm07, DivDispatch** writeNES, int rateCorrection) {
void DivEngine::performVGMWrite(SafeWriter* w, int disIdx, DivSystem sys, DivRegWrite& write, int streamOff, double* loopTimer, double* loopFreq, int* loopSample, bool* sampleDir, bool isSecond, int* pendingFreq, int* playingSample, int* setPos, unsigned int* sampleOff8, unsigned int* sampleLen8, size_t bankOffset, bool directStream, bool* sampleStoppable, bool dpcm07, DivDispatch** writeNES, int rateCorrection) {
unsigned char baseAddr1=isSecond?0xa0:0x50;
unsigned char baseAddr2=isSecond?0x80:0;
unsigned short baseAddr2S=isSecond?0x8000:0;
@ -188,6 +188,8 @@ void DivEngine::performVGMWrite(SafeWriter* w, DivSystem sys, DivRegWrite& write
case DIV_SYSTEM_YM2610_EXT:
case DIV_SYSTEM_YM2610_FULL_EXT:
case DIV_SYSTEM_YM2610B_EXT:
case DIV_SYSTEM_YM2610_CSM:
case DIV_SYSTEM_YM2610B_CSM:
// TODO: YM2610B channels 1 and 4 and ADPCM-B
for (int i=0; i<2; i++) { // set SL and RR to highest
w->writeC(8|baseAddr1);
@ -264,6 +266,7 @@ void DivEngine::performVGMWrite(SafeWriter* w, DivSystem sys, DivRegWrite& write
break;
case DIV_SYSTEM_YM2203:
case DIV_SYSTEM_YM2203_EXT:
case DIV_SYSTEM_YM2203_CSM:
for (int i=0; i<3; i++) { // set SL and RR to highest
w->writeC(5|baseAddr1);
w->writeC(0x80+i);
@ -977,6 +980,8 @@ void DivEngine::performVGMWrite(SafeWriter* w, DivSystem sys, DivRegWrite& write
case DIV_SYSTEM_YM2610_EXT:
case DIV_SYSTEM_YM2610_FULL_EXT:
case DIV_SYSTEM_YM2610B_EXT:
case DIV_SYSTEM_YM2610_CSM:
case DIV_SYSTEM_YM2610B_CSM:
switch (write.addr>>8) {
case 0: // port 0
w->writeC(8|baseAddr1);
@ -992,12 +997,14 @@ void DivEngine::performVGMWrite(SafeWriter* w, DivSystem sys, DivRegWrite& write
break;
case DIV_SYSTEM_YM2203:
case DIV_SYSTEM_YM2203_EXT:
case DIV_SYSTEM_YM2203_CSM:
w->writeC(5|baseAddr1);
w->writeC(write.addr&0xff);
w->writeC(write.val);
break;
case DIV_SYSTEM_YM2608:
case DIV_SYSTEM_YM2608_EXT:
case DIV_SYSTEM_YM2608_CSM:
switch (write.addr>>8) {
case 0: // port 0
w->writeC(6|baseAddr1);
@ -1209,6 +1216,23 @@ void DivEngine::performVGMWrite(SafeWriter* w, DivSystem sys, DivRegWrite& write
w->writeC(write.addr&0xff);
w->writeC(write.val);
break;
case DIV_SYSTEM_KURUMITSU_8L: // HACK
if (write.addr>=0x10000) {
// wavetable writes
const signed char* wtMem=(const signed char*)disCont[disIdx].dispatch->getSampleMem(1);
w->writeC(0x67);
w->writeC(0x66);
w->writeC(0xc0);
w->writeI(write.val+2);
w->writeI(write.addr&0xffff);
w->write(&wtMem[write.addr&0xffff],write.val);
} else {
// register writes
w->writeC(0xa0);
w->writeC(baseAddr2|(write.addr&0xff));
w->writeC(write.val);
}
break;
default:
logW("write not handled!");
break;
@ -1516,6 +1540,8 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool p
case DIV_SYSTEM_YM2610_EXT:
case DIV_SYSTEM_YM2610_FULL_EXT:
case DIV_SYSTEM_YM2610B_EXT:
case DIV_SYSTEM_YM2610_CSM:
case DIV_SYSTEM_YM2610B_CSM:
if (!hasOPNB) {
hasOPNB=disCont[i].dispatch->chipClock;
CHIP_VOL(8,1.0);
@ -1531,7 +1557,7 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool p
hasOPNB|=0x40000000;
howManyChips++;
}
if (((song.system[i]==DIV_SYSTEM_YM2610B) || (song.system[i]==DIV_SYSTEM_YM2610B_EXT)) && (!(hasOPNB&0x80000000))) { // YM2610B flag
if (((song.system[i]==DIV_SYSTEM_YM2610B) || (song.system[i]==DIV_SYSTEM_YM2610B_EXT) || (song.system[i]==DIV_SYSTEM_YM2610B_CSM)) && (!(hasOPNB&0x80000000))) { // YM2610B flag
hasOPNB|=0x80000000;
}
break;
@ -1627,6 +1653,7 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool p
break;
case DIV_SYSTEM_YM2203:
case DIV_SYSTEM_YM2203_EXT:
case DIV_SYSTEM_YM2203_CSM:
if (!hasOPN) {
hasOPN=disCont[i].dispatch->chipClock;
willExport[i]=true;
@ -1643,6 +1670,7 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool p
break;
case DIV_SYSTEM_YM2608:
case DIV_SYSTEM_YM2608_EXT:
case DIV_SYSTEM_YM2608_CSM:
if (!hasOPNA) {
hasOPNA=disCont[i].dispatch->chipClock;
CHIP_VOL(7,1.0);
@ -2007,6 +2035,14 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool p
howManyChips++;
}
break;
// HACK
case DIV_SYSTEM_KURUMITSU_8L:
if (!hasAY) {
hasAY=disCont[i].dispatch->chipClock|0x40000000;
willExport[i]=true;
writeSegaPCM[0]=disCont[i].dispatch;
}
break;
default:
break;
}
@ -2840,7 +2876,7 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool p
lastOne=i.second.time;
}
// write write
performVGMWrite(w,song.system[i.first],i.second.write,streamIDs[i.first],loopTimer,loopFreq,loopSample,sampleDir,isSecond[i.first],pendingFreq,playingSample,setPos,sampleOff8,sampleLen8,bankOffset[i.first],directStream,sampleStoppable,dpcm07,writeNES,correctedRate);
performVGMWrite(w,i.first,song.system[i.first],i.second.write,streamIDs[i.first],loopTimer,loopFreq,loopSample,sampleDir,isSecond[i.first],pendingFreq,playingSample,setPos,sampleOff8,sampleLen8,bankOffset[i.first],directStream,sampleStoppable,dpcm07,writeNES,correctedRate);
writeCount++;
}
sortedWrites.clear();

View file

@ -34,8 +34,8 @@ const char* aboutLine[]={
"",
_N("-- program --"),
"tildearrow",
"AArt1256",
_N("A M 4 N (intro tune)"),
"AArt1256",
"Adam Lederer",
"akumanatt",
"asiekierka",

View file

@ -5591,6 +5591,8 @@ bool FurnaceGUI::loop() {
} else { // replace with the only instrument
if (curIns>=0 && curIns<(int)e->song.ins.size()) {
*e->song.ins[curIns]=*instruments[0];
// reset macro zoom
memset(e->song.ins[curIns]->temp.vZoom,-1,sizeof(e->song.ins[curIns]->temp.vZoom));
MARK_MODIFIED;
} else {
showError(_("...but you haven't selected an instrument!"));
@ -6787,6 +6789,8 @@ bool FurnaceGUI::loop() {
if (i.second) {
if (curIns>=0 && curIns<(int)e->song.ins.size()) {
*e->song.ins[curIns]=*i.first;
// reset macro zoom
memset(e->song.ins[curIns]->temp.vZoom,-1,sizeof(e->song.ins[curIns]->temp.vZoom));
} else {
showError(_("...but you haven't selected an instrument!"));
}

View file

@ -363,6 +363,7 @@ enum FurnaceGUIColors {
GUI_COLOR_INSTR_SUPERVISION,
GUI_COLOR_INSTR_UPD1771C,
GUI_COLOR_INSTR_SID3,
GUI_COLOR_INSTR_KURUMITSU_8L,
GUI_COLOR_INSTR_UNKNOWN,
GUI_COLOR_CHANNEL_BG,

View file

@ -187,6 +187,7 @@ const char* insTypes[DIV_INS_MAX+1][3]={
{"Watara Supervision",ICON_FA_GAMEPAD,ICON_FUR_INS_SUPERVISION},
{"NEC μPD1771C",ICON_FA_BAR_CHART,ICON_FUR_INS_UPD1771C},
{"SID3",ICON_FA_KEYBOARD_O,ICON_FUR_INS_SID3},
{"Kurumitsu-8L",ICON_FA_CALCULATOR,ICON_FA_QUESTION},
{NULL,ICON_FA_QUESTION,ICON_FA_QUESTION}
};
@ -1063,6 +1064,7 @@ const FurnaceGUIColorDef guiColors[GUI_COLOR_MAX]={
D(GUI_COLOR_INSTR_SUPERVISION,"",ImVec4(0.52f,1.0f,0.6f,1.0f)),
D(GUI_COLOR_INSTR_UPD1771C,"",ImVec4(0.94f,0.52f,0.6f,1.0f)),
D(GUI_COLOR_INSTR_SID3,"",ImVec4(0.6f,0.75f,0.6f,1.0f)),
D(GUI_COLOR_INSTR_KURUMITSU_8L,"",ImVec4(0.9f,0.3f,0.3f,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)),
@ -1321,6 +1323,7 @@ const int availableSystems[]={
DIV_SYSTEM_SUPERVISION,
DIV_SYSTEM_UPD1771C,
DIV_SYSTEM_SID3,
DIV_SYSTEM_KURUMITSU_8L,
0 // don't remove this last one!
};
@ -1394,6 +1397,7 @@ const int chipsWave[]={
DIV_SYSTEM_NAMCO,
DIV_SYSTEM_NAMCO_15XX,
DIV_SYSTEM_NAMCO_CUS30,
DIV_SYSTEM_KURUMITSU_8L,
0 // don't remove this last one!
};

View file

@ -8000,7 +8000,8 @@ void FurnaceGUI::drawInsEdit() {
ins->type==DIV_INS_SNES ||
ins->type==DIV_INS_NAMCO ||
ins->type==DIV_INS_SM8521 ||
(ins->type==DIV_INS_GBA_MINMOD && ins->amiga.useWave))
(ins->type==DIV_INS_GBA_MINMOD && ins->amiga.useWave) ||
ins->type==DIV_INS_KURUMITSU_8L)
{
insTabWavetable(ins);
}
@ -8685,6 +8686,19 @@ void FurnaceGUI::drawInsEdit() {
macroList.push_back(FurnaceGUIMacroDesc(_("Sample Mode"),&ins->std.opMacros[1].arMacro,0,1,32,uiColors[GUI_COLOR_MACRO_NOISE],false,NULL,NULL,true));
}
break;
case DIV_INS_KURUMITSU_8L:
macroList.push_back(FurnaceGUIMacroDesc(_("Envelope"),&ins->std.volMacro,0,255,160,uiColors[GUI_COLOR_MACRO_VOLUME]));
macroList.push_back(FurnaceGUIMacroDesc(_("Arpeggio"),&ins->std.arpMacro,-120,120,160,uiColors[GUI_COLOR_MACRO_PITCH],true,NULL,macroHoverNote,false,NULL,true,ins->std.arpMacro.val));
macroList.push_back(FurnaceGUIMacroDesc(_("Echo Level"),&ins->std.dutyMacro,-127,127,160,uiColors[GUI_COLOR_MACRO_OTHER]));
macroList.push_back(FurnaceGUIMacroDesc(_("Waveform"),&ins->std.waveMacro,0,waveCount,160,uiColors[GUI_COLOR_MACRO_WAVE],false,NULL,NULL,false,NULL));
macroList.push_back(FurnaceGUIMacroDesc(_("Panning (left)"),&ins->std.panLMacro,0,127,160,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL));
macroList.push_back(FurnaceGUIMacroDesc(_("Panning (right)"),&ins->std.panRMacro,0,127,160,uiColors[GUI_COLOR_MACRO_OTHER]));
macroList.push_back(FurnaceGUIMacroDesc(_("Pitch"),&ins->std.pitchMacro,-2048,2047,160,uiColors[GUI_COLOR_MACRO_PITCH],true,macroRelativeMode));
macroList.push_back(FurnaceGUIMacroDesc(_("Phase Reset"),&ins->std.phaseResetMacro,0,1,32,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true));
macroList.push_back(FurnaceGUIMacroDesc(_("Feedback"),&ins->std.ex1Macro,0,15,160,uiColors[GUI_COLOR_MACRO_VOLUME],false,NULL,NULL,false,NULL));
macroList.push_back(FurnaceGUIMacroDesc(_("Modulation"),&ins->std.ex2Macro,0,15,160,uiColors[GUI_COLOR_MACRO_VOLUME],false,NULL,NULL,false,NULL));
macroList.push_back(FurnaceGUIMacroDesc(_("Special"),&ins->std.ex3Macro,0,2,96,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true,minModModeBits));
break;
case DIV_INS_MAX:
case DIV_INS_NULL:
break;
@ -8732,7 +8746,8 @@ void FurnaceGUI::drawInsEdit() {
ins->type==DIV_INS_PCE ||
ins->type==DIV_INS_X1_010 ||
ins->type==DIV_INS_SWAN ||
ins->type==DIV_INS_VRC6) {
ins->type==DIV_INS_VRC6 ||
ins->type==DIV_INS_KURUMITSU_8L) {
insTabSample(ins);
}
if (ins->type>=DIV_INS_MAX) {

View file

@ -3611,6 +3611,11 @@ void FurnaceGUI::initSystemPresets() {
CH(DIV_SYSTEM_X1_010, 1.0f, 0, "")
}
);
ENTRY(
_("Kurumitsu-8L"), {
CH(DIV_SYSTEM_KURUMITSU_8L, 1.0f, 0, "")
}
);
CATEGORY_END;
CATEGORY_BEGIN(_("Specialized"),_("chips/systems with unique sound synthesis methods."));

View file

@ -432,6 +432,17 @@ void FurnaceGUI::drawSampleEdit() {
SAMPLE_WARN(warnLength,_("Supervision: maximum sample length is 8192"));
}
break;
case DIV_SYSTEM_KURUMITSU_8L:
if (sample->isLoopable()) {
if (sample->samples>65535) {
SAMPLE_WARN(warnLength,"Kurumitsu-8L: maximum sample length is 65535");
}
} else {
if (sample->samples>65519) {
SAMPLE_WARN(warnLength,"Kurumitsu-8L: maximum sample length is 65519");
}
}
break;
default:
break;
}

View file

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