Merge branch 'master' of https://github.com/tildearrow/furnace into x1_010

This commit is contained in:
cam900 2022-03-10 03:21:02 +09:00
commit 3d13a7d446
2 changed files with 68 additions and 6 deletions

View File

@ -86,6 +86,14 @@ const char* opllInsNames[17]={
"Drums"
};
const char* oplWaveforms[8]={
"Sine", "Half Sine", "Absolute Sine", "Quarter Sine", "Squished Sine", "Squished AbsSine", "Square", "Derived Square"
};
const char* opzWaveforms[8]={
"Sine", "Triangle", "Cut Sine", "Cut Triangle", "Squished Sine", "Squished Triangle", "Squished AbsSine", "Squished AbsTriangle"
};
enum FMParams {
FM_ALG=0,
FM_FB=1,
@ -825,13 +833,19 @@ void FurnaceGUI::drawInsEdit() {
break;
case DIV_INS_OPL: {
bool fourOp=(ins->fm.ops==4);
bool drums=ins->fm.opllPreset==16;
int algMax=fourOp?3:1;
ImGui::TableNextColumn();
ins->fm.alg&=algMax;
P(ImGui::SliderScalar(FM_NAME(FM_FB),ImGuiDataType_U8,&ins->fm.fb,&_ZERO,&_SEVEN)); rightClickable
if (ImGui::Checkbox("4-op",&fourOp)) { PARAMETER
ins->fm.ops=fourOp?4:2;
}
ImGui::TableNextColumn();
P(ImGui::SliderScalar(FM_NAME(FM_ALG),ImGuiDataType_U8,&ins->fm.alg,&_ZERO,&_SEVEN)); rightClickable
P(ImGui::SliderScalar(FM_NAME(FM_ALG),ImGuiDataType_U8,&ins->fm.alg,&_ZERO,&algMax)); rightClickable
if (ImGui::Checkbox("Drums",&drums)) { PARAMETER
ins->fm.opllPreset=drums?16:0;
}
ImGui::TableNextColumn();
drawAlgorithm(ins->fm.alg&1,FM_ALGS_2OP_OPL,ImVec2(ImGui::GetContentRegionAvail().x,48.0*dpiScale));
break;
@ -983,18 +997,30 @@ void FurnaceGUI::drawInsEdit() {
maxTl=63;
}
}
if (ins->type==DIV_INS_OPL) {
maxTl=63;
}
int maxArDr=(ins->type==DIV_INS_FM || ins->type==DIV_INS_OPZ)?31:15;
bool ssgOn=op.ssgEnv&8;
bool ksrOn=op.ksr;
bool vibOn=op.vib;
bool susOn=op.sus; // don't you make fun of this one
unsigned char ssgEnv=op.ssgEnv&7;
if (ImGui::Checkbox((ins->type==DIV_INS_OPL || ins->type==DIV_INS_OPLL)?FM_NAME(FM_EGS):"SSG On",&ssgOn)) { PARAMETER
op.ssgEnv=(op.ssgEnv&7)|(ssgOn<<3);
if (ins->type!=DIV_INS_OPL && ins->type!=DIV_INS_OPZ) {
if (ImGui::Checkbox((ins->type==DIV_INS_OPLL)?FM_NAME(FM_EGS):"SSG On",&ssgOn)) { PARAMETER
op.ssgEnv=(op.ssgEnv&7)|(ssgOn<<3);
}
if (ins->type==DIV_INS_FM) {
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Only for Genesis and Neo Geo systems");
}
}
}
if (ins->type==DIV_INS_FM) {
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Only for Genesis and Neo Geo systems");
if (ins->type==DIV_INS_OPL) {
if (ImGui::Checkbox(FM_NAME(FM_SUS),&susOn)) { PARAMETER
op.sus=susOn;
}
}
@ -1108,6 +1134,18 @@ void FurnaceGUI::drawInsEdit() {
ImGui::TableNextColumn();
ImGui::Text("%s",FM_NAME(FM_SSG));
}
if (ins->type==DIV_INS_OPL || ins->type==DIV_INS_OPZ) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
P(ImGui::SliderScalar("##WS",ImGuiDataType_U8,&op.ws,&_ZERO,&_SEVEN,(ins->type==DIV_INS_OPZ)?opzWaveforms[op.ws&7]:oplWaveforms[op.ws&7])); rightClickable
if (ins->type==DIV_INS_OPL && ImGui::IsItemHovered()) {
ImGui::SetTooltip("OPL2/3 only (last 4 waveforms are OPL3 only)");
}
ImGui::TableNextColumn();
ImGui::Text("%s",FM_NAME(FM_WS));
}
ImGui::EndTable();
}

View File

@ -332,6 +332,7 @@ void FurnaceGUI::drawPattern() {
}
if (!patternOpen) return;
bool inhibitMenu=false;
float scrollX=0;
if (e->isPlaying() && followPattern) cursor.y=oldRow;
@ -411,6 +412,7 @@ void FurnaceGUI::drawPattern() {
}
if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) {
fancyPattern=!fancyPattern;
inhibitMenu=true;
e->enableCommandStream(fancyPattern);
e->getCommandStream(cmdStream);
cmdStream.clear();
@ -481,6 +483,7 @@ void FurnaceGUI::drawPattern() {
if (muted) ImGui::PopStyleColor();
ImGui::PopStyleColor(3);
if (settings.soloAction!=2) if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) {
inhibitMenu=true;
e->toggleSolo(i);
}
if (extraChannelButtons==2) {
@ -807,6 +810,27 @@ void FurnaceGUI::drawPattern() {
ImGui::PopFont();
}
ImGui::PopStyleVar();
if (patternOpen) {
if (!inhibitMenu && ImGui::IsItemClicked(ImGuiMouseButton_Right)) ImGui::OpenPopup("patternActionMenu");
if (ImGui::BeginPopup("patternActionMenu",ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoSavedSettings)) {
char id[4096];
ImGui::Selectable("cut");
ImGui::Selectable("copy");
ImGui::Selectable("paste");
if (ImGui::BeginMenu("change instrument...")) {
if (e->song.ins.empty()) {
ImGui::Text("no instruments available");
}
for (size_t i=0; i<e->song.ins.size(); i++) {
snprintf(id,4095,"%.2X: %s",(int)i,e->song.ins[i]->name.c_str());
if (ImGui::Selectable(id)) { // TODO
}
}
ImGui::EndMenu();
}
ImGui::EndPopup();
}
}
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_PATTERN;
ImGui::End();
}