MSM5232: noise macro

This commit is contained in:
tildearrow 2022-10-01 03:40:06 -05:00
parent aed738e0d5
commit 62f022eea0
3 changed files with 11 additions and 8 deletions

View file

@ -79,10 +79,6 @@ const int decayMap[16]={
void DivPlatformMSM5232::tick(bool sysTick) {
for (int i=0; i<8; i++) {
chan[i].std.next();
if (chan[i].std.vol.had) {
chan[i].outVol=VOL_SCALE_LOG(chan[i].vol&31,MIN(31,chan[i].std.vol.val),31);
// MSM5232 doesn't even have volume control :<
}
if (chan[i].std.arp.had) {
if (!chan[i].inPorta) {
chan[i].baseFreq=NOTE_LINEAR(parent->calcArp(chan[i].note,chan[i].std.arp.val));
@ -98,6 +94,10 @@ void DivPlatformMSM5232::tick(bool sysTick) {
if (chan[i].std.ex2.had) { // decay
rWrite(10+(i>>2),decayMap[chan[i].std.ex2.val&15]);
}
if (chan[i].std.ex3.had) { // noise
chan[i].noise=chan[i].std.ex3.val;
chan[i].freqChanged=true;
}
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
//DivInstrument* ins=parent->getIns(chan[i].ins,DIV_INS_PCE);
chan[i].freq=chan[i].baseFreq+chan[i].pitch+chan[i].pitch2-(12<<7);
@ -108,7 +108,7 @@ void DivPlatformMSM5232::tick(bool sysTick) {
//chWrite(i,0x04,0x80|chan[i].vol);
}
if (chan[i].active) {
rWrite(i,0x80|(chan[i].freq>>7));
rWrite(i,chan[i].noise?0xd8:(0x80|(chan[i].freq>>7)));
}
if (chan[i].keyOff) {
rWrite(i,0);
@ -213,7 +213,7 @@ int DivPlatformMSM5232::dispatch(DivCommand c) {
chan[c.chan].inPorta=c.value;
break;
case DIV_CMD_GET_VOLMAX:
return 31;
return 1;
break;
case DIV_ALWAYS_SET_VOLUME:
return 1;

View file

@ -50,8 +50,8 @@ class DivPlatformMSM5232: public DivDispatch {
keyOff(false),
inPorta(false),
noise(false),
vol(31),
outVol(31) {}
vol(1),
outVol(1) {}
};
Channel chan[8];
DivDispatchOscBuffer* oscBuf[8];

View file

@ -4749,6 +4749,9 @@ void FurnaceGUI::drawInsEdit() {
if (ins->type==DIV_INS_SNES) {
macroList.push_back(FurnaceGUIMacroDesc("Gain Rate",&ins->std.ex3Macro,0,127,160,uiColors[GUI_COLOR_MACRO_VOLUME]));
}
if (ins->type==DIV_INS_MSM5232) {
macroList.push_back(FurnaceGUIMacroDesc("Noise",&ins->std.ex3Macro,0,1,32,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true));
}
drawMacros(macroList);
ImGui::EndTabItem();