mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-25 14:05:12 +00:00
OPZ: code style fixes
This commit is contained in:
parent
dc47194e3d
commit
838646800a
3 changed files with 33 additions and 52 deletions
|
@ -300,48 +300,46 @@ void DivPlatformTX81Z::tick(bool sysTick) {
|
|||
}
|
||||
|
||||
// fixed pitch
|
||||
bool freqChangeOp = false;
|
||||
bool freqChangeOp=false;
|
||||
|
||||
if(op.egt)
|
||||
{
|
||||
if (op.egt) {
|
||||
if (op.sus) {
|
||||
chan[i].handleArpFmOp(freqChangeOp, 0, j); //arp and pitch macros
|
||||
chan[i].handlePitchFmOp(freqChangeOp, j);
|
||||
chan[i].handleArpFmOp(freqChangeOp,0,j); // arp and pitch macros
|
||||
chan[i].handlePitchFmOp(freqChangeOp,j);
|
||||
} else {
|
||||
if (m.ssg.had) { //block and f-num macros
|
||||
if (m.ssg.had) { // block and f-num macros
|
||||
op.dt=m.ssg.val&7;
|
||||
rWrite(baseAddr+ADDR_MULT_DT,(op.mult&15)|((op.egt?(op.dt&7):dtTable[op.dt&7])<<4));
|
||||
}
|
||||
if (m.sus.had) {
|
||||
op.mult=(m.sus.val & 0xff) >> 4;
|
||||
op.dvb=(m.sus.val & 0xf);
|
||||
op.mult=(m.sus.val&0xff)>>4;
|
||||
op.dvb=(m.sus.val&0xf);
|
||||
rWrite(baseAddr+ADDR_MULT_DT,(op.mult&15)|((op.egt?(op.dt&7):dtTable[op.dt&7])<<4));
|
||||
rWrite(baseAddr+ADDR_WS_FINE,(op.dvb&15)|(op.ws<<4));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(freqChangeOp)
|
||||
{
|
||||
if (freqChangeOp) {
|
||||
int arp=chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff;
|
||||
int pitch2=chan[i].pitch2;
|
||||
int fixedArp=chan[i].fixedArp;
|
||||
if(chan[i].opsState[j].hasOpArp) {
|
||||
if (chan[i].opsState[j].hasOpArp) {
|
||||
arp=chan[i].opsState[j].fixedArp?chan[i].opsState[j].baseNoteOverride:chan[i].opsState[j].arpOff;
|
||||
fixedArp=chan[i].opsState[j].fixedArp;
|
||||
}
|
||||
if(chan[i].opsState[j].hasOpPitch) {
|
||||
if (chan[i].opsState[j].hasOpPitch) {
|
||||
pitch2=chan[i].opsState[j].pitch2;
|
||||
}
|
||||
int opFreq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,arp,fixedArp,false,2, pitch2,chipClock,(524288.0 / 4.0) * 2093.0 / 2192.0 * chipClock / 4000000.0,0);
|
||||
int opFreq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,arp,fixedArp,false,2,pitch2,chipClock,(524288.0/4.0)*2093.0/2192.0*chipClock/4000000.0,0);
|
||||
if (opFreq<0) opFreq=0;
|
||||
if (opFreq>65280) opFreq=65280;
|
||||
int freqt=toFreq(opFreq);
|
||||
|
||||
op.dt=(freqt >> 8) & 7;
|
||||
op.dt=(freqt>>8)&7;
|
||||
|
||||
op.mult=(freqt & 0xff) >> 4;
|
||||
op.dvb=(freqt & 0xf);
|
||||
op.mult=(freqt&0xff)>>4;
|
||||
op.dvb=(freqt&0xf);
|
||||
|
||||
rWrite(baseAddr+ADDR_MULT_DT,(op.mult&15)|((op.egt?(op.dt&7):dtTable[op.dt&7])<<4));
|
||||
rWrite(baseAddr+ADDR_WS_FINE,(op.dvb&15)|(op.ws<<4));
|
||||
|
@ -501,7 +499,7 @@ int DivPlatformTX81Z::dispatch(DivCommand c) {
|
|||
case DIV_CMD_NOTE_ON: {
|
||||
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_OPZ);
|
||||
|
||||
memset(chan[c.chan].opsState, 0, sizeof(chan[c.chan].opsState));
|
||||
memset(chan[c.chan].opsState,0,sizeof(chan[c.chan].opsState));
|
||||
chan[c.chan].macroInit(ins);
|
||||
if (!chan[c.chan].std.vol.will) {
|
||||
chan[c.chan].outVol=chan[c.chan].vol;
|
||||
|
|
|
@ -68,17 +68,13 @@ class DivPlatformTX81Z: public DivPlatformOPM {
|
|||
opsState[o].fixedArp=false;
|
||||
}
|
||||
}
|
||||
freqChange = true;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
freqChange=true;
|
||||
} else {
|
||||
opsState[o].hasOpArp=false;
|
||||
}
|
||||
}
|
||||
|
||||
void handlePitchFmOp(bool& freqChange, int o)
|
||||
{
|
||||
void handlePitchFmOp(bool& freqChange, int o) {
|
||||
DivMacroInt::IntOp& m=this->std.op[o];
|
||||
|
||||
if (m.sus.had) {
|
||||
|
@ -90,11 +86,8 @@ class DivPlatformTX81Z: public DivPlatformOPM {
|
|||
} else {
|
||||
opsState[o].pitch2=m.sus.val;
|
||||
}
|
||||
freqChange = true;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
freqChange=true;
|
||||
} else {
|
||||
opsState[o].hasOpPitch=false;
|
||||
}
|
||||
}
|
||||
|
@ -102,8 +95,8 @@ class DivPlatformTX81Z: public DivPlatformOPM {
|
|||
FMChannel(),
|
||||
chVolL(1),
|
||||
chVolR(1) {
|
||||
memset(opsState, 0, sizeof(opsState));
|
||||
}
|
||||
memset(opsState,0,sizeof(opsState));
|
||||
}
|
||||
};
|
||||
Channel chan[8];
|
||||
DivDispatchOscBuffer* oscBuf[8];
|
||||
|
|
|
@ -4432,8 +4432,7 @@ void FurnaceGUI::insTabFM(DivInstrument* ins) {
|
|||
ImGui::TableNextColumn();
|
||||
CENTER_VSLIDER;
|
||||
bool egtOn=op.egt;
|
||||
if(!egtOn)
|
||||
{
|
||||
if (!egtOn) {
|
||||
P(CWVSliderScalar("##FINE",ImVec2(20.0f*dpiScale,sliderHeight),ImGuiDataType_U8,&op.dvb,&_ZERO,&_FIFTEEN)); rightClickable
|
||||
}
|
||||
}
|
||||
|
@ -4483,8 +4482,7 @@ void FurnaceGUI::insTabFM(DivInstrument* ins) {
|
|||
ins->std.opMacros[i].ssgMacro.vZoom=-1;
|
||||
ins->std.opMacros[i].susMacro.vZoom=-1;
|
||||
}
|
||||
if(ImGui::IsItemHovered())
|
||||
{
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip(_("Use op's arpeggio and pitch macros control instead of block/f-num macros"));
|
||||
}
|
||||
}
|
||||
|
@ -5093,8 +5091,7 @@ void FurnaceGUI::insTabFM(DivInstrument* ins) {
|
|||
// params
|
||||
ImGui::Separator();
|
||||
if (egtOn) {
|
||||
if(!op.sus)
|
||||
{
|
||||
if (!op.sus) {
|
||||
int block=op.dt;
|
||||
int freqNum=(op.mult<<4)|(op.dvb&15);
|
||||
ImGui::Text(_("Block"));
|
||||
|
@ -5240,9 +5237,7 @@ void FurnaceGUI::insTabFM(DivInstrument* ins) {
|
|||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
snprintf(tempID,1024,"%s: %%d",FM_NAME(FM_FINE));
|
||||
P(CWSliderScalar("##FINE",ImGuiDataType_U8,&op.dvb,&_ZERO,&_FIFTEEN,tempID)); rightClickable
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
bool susOn=op.sus;
|
||||
if (ImGui::Checkbox("Pitch control",&susOn)) { PARAMETER
|
||||
op.sus=susOn;
|
||||
|
@ -5250,8 +5245,7 @@ void FurnaceGUI::insTabFM(DivInstrument* ins) {
|
|||
ins->std.opMacros[i].ssgMacro.vZoom=-1;
|
||||
ins->std.opMacros[i].susMacro.vZoom=-1;
|
||||
}
|
||||
if(ImGui::IsItemHovered())
|
||||
{
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip(_("Use op's arpeggio and pitch macros control instead of block/f-num macros"));
|
||||
}
|
||||
}
|
||||
|
@ -5560,8 +5554,7 @@ void FurnaceGUI::insTabFM(DivInstrument* ins) {
|
|||
op.egt=fixedOn;
|
||||
}
|
||||
bool susOn=op.sus;
|
||||
if(fixedOn)
|
||||
{
|
||||
if (fixedOn) {
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Checkbox("Pitch control",&susOn)) { PARAMETER
|
||||
op.sus=susOn;
|
||||
|
@ -5569,8 +5562,7 @@ void FurnaceGUI::insTabFM(DivInstrument* ins) {
|
|||
ins->std.opMacros[i].ssgMacro.vZoom=-1;
|
||||
ins->std.opMacros[i].susMacro.vZoom=-1;
|
||||
}
|
||||
if(ImGui::IsItemHovered())
|
||||
{
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip(_("Use op's arpeggio and pitch macros control instead of block/f-num macros"));
|
||||
}
|
||||
}
|
||||
|
@ -5693,8 +5685,7 @@ void FurnaceGUI::insTabFM(DivInstrument* ins) {
|
|||
if (ins->type==DIV_INS_OPZ) {
|
||||
if (op.egt) {
|
||||
bool susOn=op.sus;
|
||||
if(!susOn)
|
||||
{
|
||||
if (!susOn) {
|
||||
int block=op.dt;
|
||||
int freqNum=(op.mult<<4)|(op.dvb&15);
|
||||
|
||||
|
@ -6713,7 +6704,7 @@ void FurnaceGUI::drawInsEdit() {
|
|||
macroList.push_back(FurnaceGUIMacroDesc(FM_NAME(FM_KSR),&ins->std.opMacros[ordi].ksrMacro,0,1,32,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true));
|
||||
macroList.push_back(FurnaceGUIMacroDesc(FM_NAME(FM_SUS),&ins->std.opMacros[ordi].susMacro,0,1,32,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true));
|
||||
macroList.push_back(FurnaceGUIMacroDesc(_("Op. Panning"),&ins->std.opMacros[ordi].rsMacro,0,2,40,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true,panBits));
|
||||
} else if(ins->type==DIV_INS_FM || ins->type==DIV_INS_OPM) {
|
||||
} else if (ins->type==DIV_INS_FM || ins->type==DIV_INS_OPM) {
|
||||
macroList.push_back(FurnaceGUIMacroDesc(FM_NAME(FM_TL),&ins->std.opMacros[ordi].tlMacro,0,maxTl,128,uiColors[GUI_COLOR_MACRO_VOLUME]));
|
||||
macroList.push_back(FurnaceGUIMacroDesc(FM_NAME(FM_AR),&ins->std.opMacros[ordi].arMacro,0,maxArDr,64,uiColors[GUI_COLOR_MACRO_ENVELOPE]));
|
||||
macroList.push_back(FurnaceGUIMacroDesc(FM_NAME(FM_DR),&ins->std.opMacros[ordi].drMacro,0,maxArDr,64,uiColors[GUI_COLOR_MACRO_ENVELOPE]));
|
||||
|
@ -6731,10 +6722,9 @@ void FurnaceGUI::drawInsEdit() {
|
|||
if (ins->type==DIV_INS_FM) {
|
||||
macroList.push_back(FurnaceGUIMacroDesc(FM_NAME(FM_SSG),&ins->std.opMacros[ordi].ssgMacro,0,4,64,uiColors[GUI_COLOR_MACRO_ENVELOPE],false,NULL,NULL,true,ssgEnvBits));
|
||||
}
|
||||
} else if(ins->type==DIV_INS_OPZ) {
|
||||
} else if (ins->type==DIV_INS_OPZ) {
|
||||
macroList.push_back(FurnaceGUIMacroDesc(FM_NAME(FM_TL),&ins->std.opMacros[ordi].tlMacro,0,maxTl,128,uiColors[GUI_COLOR_MACRO_VOLUME]));
|
||||
if (ins->fm.op[ordi].egt)
|
||||
{
|
||||
if (ins->fm.op[ordi].egt) {
|
||||
if (!ins->fm.op[ordi].sus) {
|
||||
macroList.push_back(FurnaceGUIMacroDesc(_("Block"),&ins->std.opMacros[ordi].ssgMacro,0,7,64,uiColors[GUI_COLOR_MACRO_PITCH],true));
|
||||
macroList.push_back(FurnaceGUIMacroDesc(_("FreqNum"),&ins->std.opMacros[ordi].susMacro,0,255,160,uiColors[GUI_COLOR_MACRO_PITCH]));
|
||||
|
|
Loading…
Reference in a new issue