C219: noise/invert/surround effects/macro

This commit is contained in:
tildearrow 2023-08-28 17:59:34 -05:00
parent 980c93aac4
commit 2fddd9e4d4
4 changed files with 43 additions and 9 deletions

View File

@ -150,6 +150,15 @@ void DivPlatformC140::tick(bool sysTick) {
}
chan[i].freqChanged=true;
}
if (is219) {
if (chan[i].std.duty.had) {
chan[i].noise=chan[i].std.duty.val&1;
chan[i].invert=chan[i].std.duty.val&2;
chan[i].surround=chan[i].std.duty.val&4;
chan[i].freqChanged=true;
chan[i].writeCtrl=true;
}
}
if (chan[i].std.pitch.had) {
if (chan[i].std.pitch.mode) {
chan[i].pitch2+=chan[i].std.pitch.val;
@ -193,7 +202,6 @@ void DivPlatformC140::tick(bool sysTick) {
chan[i].audPos=0;
}
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
bool writeCtrl=false;
DivSample* s=parent->getSample(chan[i].sample);
unsigned char ctrl=0;
double off=(s->centerRate>=1)?((double)s->centerRate/8363.0):1.0;
@ -264,11 +272,11 @@ void DivPlatformC140::tick(bool sysTick) {
chan[i].volChangedL=true;
chan[i].volChangedR=true;
}
writeCtrl=true;
chan[i].writeCtrl=true;
chan[i].keyOn=false;
}
if (chan[i].keyOff) {
writeCtrl=true;
chan[i].writeCtrl=true;
chan[i].keyOff=false;
}
if (chan[i].freqChanged) {
@ -276,8 +284,9 @@ void DivPlatformC140::tick(bool sysTick) {
rWrite(0x03+(i<<4),chan[i].freq&0xff);
chan[i].freqChanged=false;
}
if (writeCtrl) {
if (chan[i].writeCtrl) {
rWrite(0x05+(i<<4),ctrl);
chan[i].writeCtrl=false;
}
}
}
@ -342,6 +351,17 @@ int DivPlatformC140::dispatch(DivCommand c) {
}
return chan[c.chan].outVol;
break;
case DIV_CMD_STD_NOISE_MODE:
if (!is219) break;
chan[c.chan].noise=c.value;
chan[c.chan].writeCtrl=true;
break;
case DIV_CMD_SNES_INVERT:
if (!is219) break;
chan[c.chan].invert=c.value&15;
chan[c.chan].surround=c.value>>4;
chan[c.chan].writeCtrl=true;
break;
case DIV_CMD_PANNING:
chan[c.chan].chPanL=c.value;
chan[c.chan].chPanR=c.value2;

View File

@ -28,7 +28,7 @@ class DivPlatformC140: public DivDispatch {
struct Channel: public SharedChannel<int> {
unsigned int audPos;
int sample, wave;
bool setPos, invert, surround, noise, volChangedL, volChangedR;
bool setPos, invert, surround, noise, volChangedL, volChangedR, writeCtrl;
int chPanL, chPanR;
int chVolL, chVolR;
int macroVolMul;
@ -44,6 +44,7 @@ class DivPlatformC140: public DivDispatch {
noise(false),
volChangedL(false),
volChangedR(false),
writeCtrl(false),
chPanL(255),
chPanR(255),
chVolL(255),

View File

@ -1897,7 +1897,8 @@ void DivEngine::registerSystems() {
{DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA, DIV_INS_AMIGA},
{},
{
{0x10, {DIV_CMD_STD_NOISE_MODE, "10xx: Set noise/invert mode (bit 0: noise; bit 1: invert left output; bit 2: invert output)"}}
{0x11, {DIV_CMD_STD_NOISE_MODE, "11xx: Set noise mode"}},
{0x12, {DIV_CMD_SNES_INVERT, "12xy: Set invert mode (x: surround; y: invert)"}},
}
);

View File

@ -272,6 +272,10 @@ const char* tedControlBits[3]={
"square", "noise", NULL
};
const char* c219ControlBits[4]={
"noise", "invert", "surround", NULL
};
const char* x1_010EnvBits[8]={
"enable", "oneshot", "split L/R", "HinvR", "VinvR", "HinvL", "VinvL", NULL
};
@ -4510,7 +4514,8 @@ void FurnaceGUI::drawInsEdit() {
ins->type==DIV_INS_K007232 ||
ins->type==DIV_INS_GA20 ||
ins->type==DIV_INS_K053260 ||
ins->type==DIV_INS_C140) {
ins->type==DIV_INS_C140 ||
ins->type==DIV_INS_C219) {
if (ImGui::BeginTabItem((ins->type==DIV_INS_SU)?"Sound Unit":"Sample")) {
String sName;
bool wannaOpenSMPopup=false;
@ -5538,7 +5543,7 @@ void FurnaceGUI::drawInsEdit() {
volMax=31;
}
if (ins->type==DIV_INS_ADPCMB || ins->type==DIV_INS_YMZ280B || ins->type==DIV_INS_RF5C68 ||
ins->type==DIV_INS_GA20 || ins->type==DIV_INS_C140) {
ins->type==DIV_INS_GA20 || ins->type==DIV_INS_C140 || ins->type==DIV_INS_C219) {
volMax=255;
}
if (ins->type==DIV_INS_QSOUND) {
@ -5584,6 +5589,10 @@ void FurnaceGUI::drawInsEdit() {
dutyLabel="Group Ctrl";
dutyMax=5;
}
if (ins->type==DIV_INS_C219) {
dutyLabel="Control";
dutyMax=3;
}
if (ins->type==DIV_INS_BEEPER || ins->type==DIV_INS_POKEMINI) {
dutyLabel="Pulse Width";
dutyMax=255;
@ -5709,6 +5718,7 @@ void FurnaceGUI::drawInsEdit() {
if (ins->type==DIV_INS_POKEMINI) waveMax=0;
if (ins->type==DIV_INS_TED) waveMax=0;
if (ins->type==DIV_INS_C140) waveMax=0;
if (ins->type==DIV_INS_C219) waveMax=0;
if (ins->type==DIV_INS_SU || ins->type==DIV_INS_POKEY) waveMax=7;
if (ins->type==DIV_INS_PET) {
waveMax=8;
@ -5839,7 +5849,7 @@ void FurnaceGUI::drawInsEdit() {
panMin=0;
panMax=127;
}
if (ins->type==DIV_INS_C140) {
if (ins->type==DIV_INS_C140 || ins->type==DIV_INS_C219) {
panMin=0;
panMax=255;
}
@ -5864,6 +5874,8 @@ void FurnaceGUI::drawInsEdit() {
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) {
macroList.push_back(FurnaceGUIMacroDesc(dutyLabel,&ins->std.dutyMacro,dutyMin,dutyMax,160,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,&macroHoverES5506FilterMode));
} else if (ins->type==DIV_INS_C219) {
macroList.push_back(FurnaceGUIMacroDesc(dutyLabel,&ins->std.dutyMacro,0,dutyMax,120,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true,c219ControlBits));
} else {
macroList.push_back(FurnaceGUIMacroDesc(dutyLabel,&ins->std.dutyMacro,dutyMin,dutyMax,160,uiColors[GUI_COLOR_MACRO_OTHER]));
}