GUI: work on the drum UI

This commit is contained in:
tildearrow 2022-03-17 02:07:46 -05:00
parent 5579ef2bc1
commit dce68749d6
2 changed files with 50 additions and 57 deletions

View file

@ -75,7 +75,7 @@ const unsigned char slotsOPL3i[4][20]={
const unsigned char slotsOPL3Drumsi[4][20]={
{0, 6, 1, 7, 2, 8, 18, 24, 19, 25, 20, 26, 30, 31, 32, 12, 16, 14, 17, 13}, // OP1
{3, 9, 4, 10, 5, 11, 21, 27, 22, 28, 23, 29, 33, 34, 35, N, N, N, N, N}, // OP2
{3, 9, 4, 10, 5, 11, 21, 27, 22, 28, 23, 29, 33, 34, 35, 15, N, N, N, N}, // OP2
{6, N, 7, N, 8, N, 24, N, 25, N, 26, N, N, N, N, N, N, N, N, N}, // OP3
{9, N, 10, N, 11, N, 27, N, 28, N, 29, N, N, N, N, N, N, N, N, N} // OP4
};
@ -801,7 +801,6 @@ int DivPlatformOPL::dispatch(DivCommand c) {
melodicChans=properDrums?6:9;
totalChans=properDrums?11:9;
}
printf("CHANGING. DRUMS. MODE.\n");
break;
}
case DIV_ALWAYS_SET_VOLUME:

View file

@ -878,6 +878,39 @@ if (ImGui::BeginTable("MacroSpace",2)) { \
ImGui::EndTable(); \
}
#define DRUM_FREQ(name,db,df,prop) \
ImGui::TableNextRow(); \
ImGui::TableNextColumn(); \
if (ins->type==DIV_INS_OPLL) { \
block=(prop>>9)&7; \
fNum=prop&511; \
} else { \
block=(prop>>10)&7; \
fNum=prop&1023; \
} \
ImGui::Text(name); \
ImGui::TableNextColumn(); \
if (ImGui::InputInt(db,&block,1,1)) { \
if (block<0) block=0; \
if (block>7) block=7; \
if (ins->type==DIV_INS_OPLL) { \
prop=(block<<9)|fNum; \
} else { \
prop=(block<<10)|fNum; \
} \
} \
ImGui::TableNextColumn(); \
if (ImGui::InputInt(df,&fNum,1,1)) { \
if (fNum<0) fNum=0; \
if (ins->type==DIV_INS_OPLL) { \
if (fNum>511) fNum=511; \
prop=(block<<9)|fNum; \
} else { \
if (fNum>1023) fNum=1023; \
prop=(block<<10)|fNum; \
} \
}
void FurnaceGUI::drawInsEdit() {
if (nextWindow==GUI_WINDOW_INS_EDIT) {
insEditOpen=true;
@ -933,9 +966,11 @@ void FurnaceGUI::drawInsEdit() {
ImGui::TableNextColumn();
ins->fm.alg&=algMax;
P(ImGui::SliderScalar(FM_NAME(FM_FB),ImGuiDataType_U8,&ins->fm.fb,&_ZERO,&_SEVEN)); rightClickable
ImGui::BeginDisabled(ins->fm.opllPreset==16);
if (ImGui::Checkbox("4-op",&fourOp)) { PARAMETER
ins->fm.ops=fourOp?4:2;
}
ImGui::EndDisabled();
ImGui::TableNextColumn();
P(ImGui::SliderScalar(FM_NAME(FM_ALG),ImGuiDataType_U8,&ins->fm.alg,&_ZERO,&algMax)); rightClickable
if (ImGui::Checkbox("Drums",&drums)) { PARAMETER
@ -984,7 +1019,8 @@ void FurnaceGUI::drawInsEdit() {
ImGui::EndTable();
}
if (ins->type==DIV_INS_OPLL && ins->fm.opllPreset==16) {
if ((ins->type==DIV_INS_OPLL || ins->type==DIV_INS_OPL) && ins->fm.opllPreset==16) {
ins->fm.ops=2;
P(ImGui::Checkbox("Fixed frequency mode",&ins->fm.fixedDrums));
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("when enabled, drums will be set to the specified frequencies, ignoring the note.");
@ -1001,59 +1037,9 @@ void FurnaceGUI::drawInsEdit() {
ImGui::TableNextColumn();
ImGui::Text("FreqNum");
ImGui::TableNextRow();
ImGui::TableNextColumn();
block=(ins->fm.kickFreq>>9)&7;
fNum=ins->fm.kickFreq&511;
ImGui::Text("Kick");
ImGui::TableNextColumn();
if (ImGui::InputInt("##DBlock0",&block,1,1)) {
if (block<0) block=0;
if (block>7) block=7;
ins->fm.kickFreq=(block<<9)|fNum;
}
ImGui::TableNextColumn();
if (ImGui::InputInt("##DFreq0",&fNum,1,1)) {
if (fNum<0) fNum=0;
if (fNum>511) fNum=511;
ins->fm.kickFreq=(block<<9)|fNum;
}
ImGui::TableNextRow();
ImGui::TableNextColumn();
block=(ins->fm.snareHatFreq>>9)&7;
fNum=ins->fm.snareHatFreq&511;
ImGui::Text("Snare/Hi-hat");
ImGui::TableNextColumn();
if (ImGui::InputInt("##DBlock1",&block,1,1)) {
if (block<0) block=0;
if (block>7) block=7;
ins->fm.snareHatFreq=(block<<9)|fNum;
}
ImGui::TableNextColumn();
if (ImGui::InputInt("##DFreq1",&fNum,1,1)) {
if (fNum<0) fNum=0;
if (fNum>511) fNum=511;
ins->fm.snareHatFreq=(block<<9)|fNum;
}
ImGui::TableNextRow();
ImGui::TableNextColumn();
block=(ins->fm.tomTopFreq>>9)&7;
fNum=ins->fm.tomTopFreq&511;
ImGui::Text("Tom/Top");
ImGui::TableNextColumn();
if (ImGui::InputInt("##DBlock2",&block,1,1)) {
if (block<0) block=0;
if (block>7) block=7;
ins->fm.tomTopFreq=(block<<9)|fNum;
}
ImGui::TableNextColumn();
if (ImGui::InputInt("##DFreq2",&fNum,1,1)) {
if (fNum<0) fNum=0;
if (fNum>511) fNum=511;
ins->fm.tomTopFreq=(block<<9)|fNum;
}
DRUM_FREQ("Kick","##DBlock0","##DFreq0",ins->fm.kickFreq);
DRUM_FREQ("Snare/Hi-hat","##DBlock1","##DFreq1",ins->fm.snareHatFreq);
DRUM_FREQ("Tom/Top","##DBlock2","##DFreq2",ins->fm.tomTopFreq);
ImGui::EndTable();
}
}
@ -1073,7 +1059,15 @@ void FurnaceGUI::drawInsEdit() {
ImGui::Separator();
ImGui::PushID(fmt::sprintf("op%d",i).c_str());
ImGui::Dummy(ImVec2(dpiScale,dpiScale));
ImGui::Text("OP%d",i+1);
if (ins->type==DIV_INS_OPL && ins->fm.opllPreset==16) {
if (i==1) {
ImGui::Text("Envelope 2 (kick only)");
} else {
ImGui::Text("Envelope");
}
} else {
ImGui::Text("OP%d",i+1);
}
ImGui::SameLine();