mirror of
https://github.com/tildearrow/furnace.git
synced 2024-12-02 09:17:26 +00:00
fix independent noise freq (bad fix), add filter macros
This commit is contained in:
parent
402ff627ae
commit
03a6b608be
2 changed files with 95 additions and 6 deletions
|
@ -229,11 +229,13 @@ void DivPlatformSID3::tick(bool sysTick)
|
||||||
rWrite(SID3_REGISTER_SPECIAL_WAVE + i * SID3_REGISTERS_PER_CHANNEL, chan[i].special_wave);
|
rWrite(SID3_REGISTER_SPECIAL_WAVE + i * SID3_REGISTERS_PER_CHANNEL, chan[i].special_wave);
|
||||||
}
|
}
|
||||||
if (chan[i].std.op[3].am.had) { //noise arpeggio
|
if (chan[i].std.op[3].am.had) { //noise arpeggio
|
||||||
chan[i].handleArpNoise(0);
|
//chan[i].handleArpNoise(0);
|
||||||
chan[i].noiseFreqChanged = true;
|
chan[i].noiseFreqChanged = true;
|
||||||
}
|
}
|
||||||
if (chan[i].std.op[0].ar.had) { //noise pitch
|
chan[i].handleArpNoise(0);
|
||||||
chan[i].handlePitchNoise();
|
chan[i].handlePitchNoise();
|
||||||
|
if (chan[i].std.op[0].ar.had) { //noise pitch
|
||||||
|
//chan[i].handlePitchNoise();
|
||||||
chan[i].noiseFreqChanged = true;
|
chan[i].noiseFreqChanged = true;
|
||||||
}
|
}
|
||||||
if (chan[i].std.panL.had) {
|
if (chan[i].std.panL.had) {
|
||||||
|
@ -333,6 +335,61 @@ void DivPlatformSID3::tick(bool sysTick)
|
||||||
rWrite(SID3_REGISTER_MIXMODE + i * SID3_REGISTERS_PER_CHANNEL, chan[i].mix_mode); //mixmode
|
rWrite(SID3_REGISTER_MIXMODE + i * SID3_REGISTERS_PER_CHANNEL, chan[i].mix_mode); //mixmode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(int j = 0; j < SID3_NUM_FILTERS; j++) //filter macros
|
||||||
|
{
|
||||||
|
DivMacroInt::IntOp* op = &chan[i].std.op[j];
|
||||||
|
DivInstrument* ins=parent->getIns(chan[i].ins,DIV_INS_SID3);
|
||||||
|
DivPlatformSID3::Channel::Filter* ch_filt = &chan[i].filt[j];
|
||||||
|
DivInstrumentSID3::Filter* ins_filt = &ins->sid3.filt[j];
|
||||||
|
|
||||||
|
bool doUpdateFilter = false;
|
||||||
|
|
||||||
|
if (op->d2r.had) { //cutoff
|
||||||
|
if (ins_filt->absoluteCutoff) {
|
||||||
|
ch_filt->cutoff=op->d2r.val;
|
||||||
|
} else {
|
||||||
|
ch_filt->cutoff+=op->d2r.val;
|
||||||
|
}
|
||||||
|
ch_filt->cutoff&=65535;
|
||||||
|
doUpdateFilter = true;
|
||||||
|
}
|
||||||
|
if (op->dam.had) { //resonance
|
||||||
|
ch_filt->resonance=op->dam.val & 0xff;
|
||||||
|
doUpdateFilter = true;
|
||||||
|
}
|
||||||
|
if (op->dr.had) { //filter toggle
|
||||||
|
ch_filt->enabled=op->dr.val & 1;
|
||||||
|
doUpdateFilter = true;
|
||||||
|
}
|
||||||
|
if (op->dt2.had) { //distortion level
|
||||||
|
ch_filt->distortion_level=op->dt2.val & 0xff;
|
||||||
|
doUpdateFilter = true;
|
||||||
|
}
|
||||||
|
if (op->dt.had) { //output volume
|
||||||
|
ch_filt->output_volume=op->dt.val & 0xff;
|
||||||
|
doUpdateFilter = true;
|
||||||
|
}
|
||||||
|
if (op->dvb.had) { //connect to channel input
|
||||||
|
ch_filt->mode &= ~SID3_FILTER_CHANNEL_INPUT;
|
||||||
|
ch_filt->mode |= (op->dvb.val & 1) ? SID3_FILTER_CHANNEL_INPUT : 0;
|
||||||
|
doUpdateFilter = true;
|
||||||
|
}
|
||||||
|
if (op->egt.had) { //connect to channel output
|
||||||
|
ch_filt->mode &= ~SID3_FILTER_OUTPUT;
|
||||||
|
ch_filt->mode |= (op->egt.val & 1) ? SID3_FILTER_OUTPUT : 0;
|
||||||
|
doUpdateFilter = true;
|
||||||
|
}
|
||||||
|
if (op->ksl.had) { //connection matrix row
|
||||||
|
ch_filt->filter_matrix=op->ksl.val & 0xf;
|
||||||
|
doUpdateFilter = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(doUpdateFilter)
|
||||||
|
{
|
||||||
|
updateFilter(i, j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(panChanged)
|
if(panChanged)
|
||||||
{
|
{
|
||||||
updatePanning(i);
|
updatePanning(i);
|
||||||
|
@ -385,9 +442,11 @@ void DivPlatformSID3::tick(bool sysTick)
|
||||||
|
|
||||||
updateFreq(i);
|
updateFreq(i);
|
||||||
|
|
||||||
if(!chan[i].independentNoiseFreq)
|
|
||||||
{
|
|
||||||
chan[i].noiseFreqChanged = true;
|
chan[i].noiseFreqChanged = true;
|
||||||
|
|
||||||
|
if(chan[i].independentNoiseFreq)
|
||||||
|
{
|
||||||
|
chan[i].noise_pitch2 = chan[i].pitch2;
|
||||||
}
|
}
|
||||||
|
|
||||||
//rWrite(i*7,chan[i].freq&0xff);
|
//rWrite(i*7,chan[i].freq&0xff);
|
||||||
|
|
|
@ -450,6 +450,14 @@ const char* sid3ShapeBits[6]={
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const char* sid3FilterMatrixBits[5]={
|
||||||
|
_N("To filter 1"),
|
||||||
|
_N("To filter 2"),
|
||||||
|
_N("To filter 3"),
|
||||||
|
_N("To filter 4"),
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
const char* ayEnvBits[4]={
|
const char* ayEnvBits[4]={
|
||||||
_N("hold"),
|
_N("hold"),
|
||||||
_N("alternate"),
|
_N("alternate"),
|
||||||
|
@ -5834,6 +5842,8 @@ void FurnaceGUI::insTabFM(DivInstrument* ins) {
|
||||||
|
|
||||||
void FurnaceGUI::drawInsSID3(DivInstrument* ins)
|
void FurnaceGUI::drawInsSID3(DivInstrument* ins)
|
||||||
{
|
{
|
||||||
|
char buffer[40];
|
||||||
|
|
||||||
if (ImGui::BeginTabItem("SID3"))
|
if (ImGui::BeginTabItem("SID3"))
|
||||||
{
|
{
|
||||||
if (ImGui::BeginTable("sid3Waves",2,0))
|
if (ImGui::BeginTable("sid3Waves",2,0))
|
||||||
|
@ -5938,8 +5948,6 @@ void FurnaceGUI::drawInsSID3(DivInstrument* ins)
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
char buffer[40];
|
|
||||||
|
|
||||||
strncpy(buffer,macroSID3WaveMixMode(0,(float)ins->sid2.mixMode,NULL).c_str(),40);
|
strncpy(buffer,macroSID3WaveMixMode(0,(float)ins->sid2.mixMode,NULL).c_str(),40);
|
||||||
P(CWSliderScalar(_("Wave Mix Mode"),ImGuiDataType_U8,&ins->sid2.mixMode,&_ZERO,&_FOUR,buffer));
|
P(CWSliderScalar(_("Wave Mix Mode"),ImGuiDataType_U8,&ins->sid2.mixMode,&_ZERO,&_FOUR,buffer));
|
||||||
P(CWSliderScalar(_("Duty"),ImGuiDataType_U16,&ins->c64.duty,&_ZERO,&_SIXTY_FIVE_THOUSAND_FIVE_HUNDRED_THIRTY_FIVE)); rightClickable
|
P(CWSliderScalar(_("Duty"),ImGuiDataType_U16,&ins->c64.duty,&_ZERO,&_SIXTY_FIVE_THOUSAND_FIVE_HUNDRED_THIRTY_FIVE)); rightClickable
|
||||||
|
@ -6067,6 +6075,7 @@ void FurnaceGUI::drawInsSID3(DivInstrument* ins)
|
||||||
bool absCutoff=filt->absoluteCutoff;
|
bool absCutoff=filt->absoluteCutoff;
|
||||||
if (ImGui::Checkbox(buffer,&absCutoff)) { PARAMETER
|
if (ImGui::Checkbox(buffer,&absCutoff)) { PARAMETER
|
||||||
filt->absoluteCutoff = !filt->absoluteCutoff;
|
filt->absoluteCutoff = !filt->absoluteCutoff;
|
||||||
|
ins->std.opMacros[i].d2rMacro.vZoom=-1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6168,6 +6177,27 @@ void FurnaceGUI::drawInsSID3(DivInstrument* ins)
|
||||||
|
|
||||||
std::vector<FurnaceGUIMacroDesc> macroList;
|
std::vector<FurnaceGUIMacroDesc> macroList;
|
||||||
|
|
||||||
|
for(int i = 0; i < SID3_NUM_FILTERS; i++)
|
||||||
|
{
|
||||||
|
snprintf(buffer, 40, _("Filter %d macros"), i + 1);
|
||||||
|
|
||||||
|
if (ImGui::BeginTabItem(buffer))
|
||||||
|
{
|
||||||
|
macroList.push_back(FurnaceGUIMacroDesc(_("Cutoff"),&ins->std.opMacros[i].d2rMacro,ins->sid3.filt[i].absoluteCutoff?0:-65535,65535,160,uiColors[GUI_COLOR_MACRO_FILTER]));
|
||||||
|
macroList.push_back(FurnaceGUIMacroDesc(_("Resonance"),&ins->std.opMacros[i].damMacro,0,255,160,uiColors[GUI_COLOR_MACRO_FILTER]));
|
||||||
|
macroList.push_back(FurnaceGUIMacroDesc(_("Filter Toggle"),&ins->std.opMacros[i].drMacro,0,1,32,uiColors[GUI_COLOR_MACRO_FILTER],false,NULL,NULL,true));
|
||||||
|
macroList.push_back(FurnaceGUIMacroDesc(_("Distortion Level"),&ins->std.opMacros[i].dt2Macro,0,255,160,uiColors[GUI_COLOR_MACRO_FILTER]));
|
||||||
|
macroList.push_back(FurnaceGUIMacroDesc(_("Output Volume"),&ins->std.opMacros[i].dtMacro,0,255,160,uiColors[GUI_COLOR_MACRO_FILTER]));
|
||||||
|
macroList.push_back(FurnaceGUIMacroDesc(_("Channel Input Connection"),&ins->std.opMacros[i].dvbMacro,0,1,32,uiColors[GUI_COLOR_MACRO_FILTER],false,NULL,NULL,true));
|
||||||
|
macroList.push_back(FurnaceGUIMacroDesc(_("Channel Output Connection"),&ins->std.opMacros[i].egtMacro,0,1,32,uiColors[GUI_COLOR_MACRO_FILTER],false,NULL,NULL,true));
|
||||||
|
macroList.push_back(FurnaceGUIMacroDesc(_("Connection Matrix Row"),&ins->std.opMacros[i].kslMacro,0,4,16 * SID3_NUM_FILTERS,uiColors[GUI_COLOR_MACRO_FILTER],false,NULL,NULL,true,sid3FilterMatrixBits));
|
||||||
|
|
||||||
|
drawMacros(macroList,macroEditStateOP[i]);
|
||||||
|
|
||||||
|
ImGui::EndTabItem();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ImGui::BeginTabItem(_("Macros")))
|
if (ImGui::BeginTabItem(_("Macros")))
|
||||||
{
|
{
|
||||||
//ImGui::Text("Size of DivInstrument is too high... exactly %d bytes, of which SID3 shit takes %d bytes", sizeof(DivInstrument), sizeof(DivInstrumentSID3));
|
//ImGui::Text("Size of DivInstrument is too high... exactly %d bytes, of which SID3 shit takes %d bytes", sizeof(DivInstrument), sizeof(DivInstrumentSID3));
|
||||||
|
|
Loading…
Reference in a new issue