a couple fixes

This commit is contained in:
tildearrow 2024-09-05 19:24:42 -05:00
parent eb95024fb9
commit 435c858dc9
8 changed files with 30 additions and 37 deletions

View file

@ -132,16 +132,16 @@ void DivPlatformSupervision::tick(bool sysTick) {
}
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
//DivInstrument* ins=parent->getIns(chan[i].ins,DIV_INS_PCE);
if (i < 2) {
if (i<2) {
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<<1,CHIP_DIVIDER);
if (chan[i].freq<1) chan[i].freq=1;
if (chan[i].freq>2047) chan[i].freq=2047;
if (chan[i].freqChanged || initWrite[i]) {
rWrite(0x10|(i<<2),chan[i].freq&0xff);
rWrite(0x11|(i<<2),(chan[i].freq>>8)&0x7);
if (chan[i].freqChanged || chan[i].initWrite) {
rWrite(0x10|(i<<2),chan[i].freq&0xff);
rWrite(0x11|(i<<2),(chan[i].freq>>8)&0x7);
}
initWrite[i]=0;
} else if (i == 3) {
chan[i].initWrite=false;
} else if (i==3) {
int ntPos=chan[i].baseFreq;
if (NEW_ARP_STRAT) {
if (chan[i].fixedArp) {
@ -193,15 +193,15 @@ void DivPlatformSupervision::tick(bool sysTick) {
}
}
}
if (chan[i].keyOn) kon[i]=1;
if (chan[i].keyOff) kon[i]=0;
if (chan[i].keyOn) chan[i].kon=true;
if (chan[i].keyOff) chan[i].kon=false;
if (chan[i].keyOn) chan[i].keyOn=false;
if (chan[i].keyOff) chan[i].keyOff=false;
chan[i].freqChanged=false;
}
if (kon[i]) {
if (i < 2) {
if (chan[i].kon) {
if (i<2) {
rWrite(0x12|(i<<2),(chan[i].outVol&0xf)|((chan[i].duty&3)<<4));
rWrite(0x13|(i<<2),0xc8);
} else if (i == 3) {
@ -446,8 +446,6 @@ void DivPlatformSupervision::reset() {
memset(tempR,0,32*sizeof(int));
memset(noiseReg,0,3*sizeof(unsigned char));
noiseReg[2]=0xff;
memset(kon,0,4*sizeof(unsigned char));
memset(initWrite,1,4*sizeof(unsigned char));
sampleOffset=0;
}
@ -566,6 +564,10 @@ void DivPlatformSupervision::renderSamples(int sysID) {
memCompo.used=sampleMemLen;
}
bool DivPlatformSupervision::getDCOffRequired() {
return true;
}
int DivPlatformSupervision::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p;
dumpWrites=false;

View file

@ -28,7 +28,7 @@ class DivPlatformSupervision: public DivDispatch {
struct Channel: public SharedChannel<signed char> {
unsigned int duty, len, pan, pcm; // pcm is channel 3 ONLY
int sample, hasOffset; // again, for channel 3 ONLY
bool setPos;
bool setPos, kon, initWrite;
Channel():
SharedChannel<signed char>(63),
duty(0),
@ -36,7 +36,9 @@ class DivPlatformSupervision: public DivDispatch {
pan(3),
pcm(false),
hasOffset(0),
setPos(false) {}
setPos(false),
kon(false),
initWrite(true) {}
};
Channel chan[4];
DivDispatchOscBuffer* oscBuf[4];
@ -64,8 +66,6 @@ class DivPlatformSupervision: public DivDispatch {
unsigned char otherFlags;
unsigned int sampleOffset;
unsigned char noiseReg[3];
unsigned char kon[4];
unsigned char initWrite[4];
struct svision_t svision;
friend void putDispatchChip(void*,int);
@ -95,6 +95,7 @@ class DivPlatformSupervision: public DivDispatch {
bool isSampleLoaded(int index, int sample);
const DivMemoryComposition* getMemCompo(int index);
void renderSamples(int chipID);
bool getDCOffRequired();
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit();
~DivPlatformSupervision();

View file

@ -26,7 +26,7 @@
//#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 32
#define CHIP_DIVIDER 64
const char* regCheatSheetUPD1771c[]={
NULL
@ -38,13 +38,6 @@ const char** DivPlatformUPD1771c::getRegisterSheet() {
void DivPlatformUPD1771c::acquire(short** buf, size_t len) {
for (size_t h=0; h<len; h++) {
/*
int mask_bits=0;
for (int i=0; i<4; i++)
mask_bits |= isMuted[i]?0:8>>i;
//upd1771c_set_mute_mask(mask_bits);
*/
while (!writes.empty()) {
QueuedWrite w=writes.front();
upd1771c_write_packet(&scv,w.addr&15,w.val);
@ -52,13 +45,9 @@ void DivPlatformUPD1771c::acquire(short** buf, size_t len) {
writes.pop();
}
signed short s = (upd1771c_sound_stream_update(&scv)<<3)*((isMuted[0]&1)^1);
for (int i=0; i<1; i++) {
oscBuf[i]->data[oscBuf[i]->needle++]=s;
}
//printf("tempL: %d tempR: %d\n",tempL,tempR);
short s=upd1771c_sound_stream_update(&scv)<<3;
if (isMuted[0]) s=0;
oscBuf[0]->data[oscBuf[0]->needle++]=s;
buf[0][h]=s;
buf[1][h]=s;
}
@ -135,7 +124,8 @@ void DivPlatformUPD1771c::tick(bool sysTick) {
if (chan[i].duty == 0) {
rWrite(0,2);
rWrite(1,(chan[i].wave<<5)|chan[i].pos);
float p = ((float)chan[i].freq)/((float)(31-chan[i].pos))*31.0;
// TODO: improve
float p = ((float)chan[i].freq)/((float)(32-chan[i].pos))*32.0;
rWrite(2,MIN(MAX((int)p,0),255));
rWrite(3,chan[i].outVol);
} else if (chan[i].duty == 1) {

View file

@ -26,7 +26,7 @@
class DivPlatformUPD1771c: public DivDispatch {
struct Channel: public SharedChannel<signed char> {
unsigned int wave; // pcm is channel 3 ONLY
unsigned int wave;
int pos, duty;
Channel():
SharedChannel<signed char>(15),
@ -50,7 +50,6 @@ class DivPlatformUPD1771c: public DivDispatch {
int tempR[32];
int coreQuality;
unsigned char regPool[16];
// I may add the 3 square waves in noise mode later...
unsigned char kon[1];
unsigned char initWrite[1];
struct upd1771c_t scv;

View file

@ -1932,7 +1932,7 @@ void DivEngine::registerSystems() {
);
sysDefs[DIV_SYSTEM_UPD1771C]=new DivSysDef(
_("NEC uPD1771C"), NULL, 0xe4, 0, 1, false, true, 0, false, 0, 0, 0,
_("NEC μPD1771C"), NULL, 0xe4, 0, 1, false, true, 0, false, 0, 0, 0,
_("this was an SoC with some funky wavetable/noise hardware"),
{_("Wave/Noise")},
{"W"},

View file

@ -185,7 +185,7 @@ const char* insTypes[DIV_INS_MAX+1][3]={
{"Bifurcator",ICON_FA_LINE_CHART,ICON_FUR_INS_BIFURCATOR},
{"SID2",ICON_FA_KEYBOARD_O,ICON_FUR_INS_SID2},
{"Watara Supervision",ICON_FA_GAMEPAD,ICON_FUR_INS_SUPERVISION},
{"NEC uPD1771C",ICON_FA_BAR_CHART,ICON_FUR_INS_UPD1771C},
{"NEC μPD1771C",ICON_FA_BAR_CHART,ICON_FUR_INS_UPD1771C},
{NULL,ICON_FA_QUESTION,ICON_FA_QUESTION}
};

View file

@ -7417,7 +7417,7 @@ void FurnaceGUI::drawInsEdit() {
macroList.push_back(FurnaceGUIMacroDesc(_("Volume"),&ins->std.volMacro,0,15,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(_("Duty/Noise"),&ins->std.dutyMacro,0,3,160,uiColors[GUI_COLOR_MACRO_NOISE]));
macroList.push_back(FurnaceGUIMacroDesc(_("Panning"),&ins->std.panLMacro,0,2,32,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true,panBits));
macroList.push_back(FurnaceGUIMacroDesc(_("Noise/PCM Pan"),&ins->std.panLMacro,0,2,32,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true,panBits));
macroList.push_back(FurnaceGUIMacroDesc(_("Pitch"),&ins->std.pitchMacro,-2048,2047,160,uiColors[GUI_COLOR_MACRO_PITCH],true,macroRelativeMode));
break;
case DIV_INS_SM8521:

View file

@ -2551,6 +2551,7 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
case DIV_SYSTEM_C219:
case DIV_SYSTEM_BIFURCATOR:
case DIV_SYSTEM_POWERNOISE:
case DIV_SYSTEM_UPD1771C:
break;
case DIV_SYSTEM_YMU759:
case DIV_SYSTEM_ESFM: