Merge branch 'master' of https://github.com/tildearrow/furnace into es5506_alt
* 'master' of https://github.com/tildearrow/furnace: dev94 - add a full linear pitch mode, part 1 YM2610(B): use f-num/block baseFreq calculation GUI: remove insLoadAlwaysReplace setting GUI: right click menu for open instrument GUI: add a threshold for macro right click OPZ: remove debug printf GUI: add macro right click menu GUI: prepare for macro right click menu update gitignore add something prepare for something did i fix macOS build? GUI: macro edit improvements
This commit is contained in:
commit
54e78699a7
84 changed files with 6364 additions and 337 deletions
|
|
@ -27,10 +27,6 @@
|
|||
#include <imgui.h>
|
||||
#include "plot_nolerp.h"
|
||||
|
||||
const unsigned char avRequest[15]={
|
||||
0xf0, 0x43, 0x20, 0x7e, 0x4c, 0x4d, 0x20, 0x20, 0x38, 0x39, 0x37, 0x36, 0x41, 0x45, 0xf7
|
||||
};
|
||||
|
||||
const char* ssgEnvTypes[8]={
|
||||
"Down Down Down", "Down.", "Down Up Down Up", "Down UP", "Up Up Up", "Up.", "Up Down Up Down", "Up DOWN"
|
||||
};
|
||||
|
|
@ -1214,6 +1210,9 @@ void FurnaceGUI::drawMacros(std::vector<FurnaceGUIMacroDesc>& macros) {
|
|||
if (i.macro->name=="arp") {
|
||||
i.macro->vZoom=24;
|
||||
i.macro->vScroll=120-12;
|
||||
} else if (i.macro->name=="pitch") {
|
||||
i.macro->vZoom=64;
|
||||
i.macro->vScroll=1024-32;
|
||||
} else {
|
||||
i.macro->vZoom=i.max-i.min;
|
||||
i.macro->vScroll=0;
|
||||
|
|
@ -1248,6 +1247,7 @@ void FurnaceGUI::drawMacros(std::vector<FurnaceGUIMacroDesc>& macros) {
|
|||
macroDragChar=false;
|
||||
macroDragLineMode=(i.isBitfield)?false:ImGui::IsItemClicked(ImGuiMouseButton_Right);
|
||||
macroDragLineInitial=ImVec2(0,0);
|
||||
lastMacroDesc=i;
|
||||
processDrags(ImGui::GetMousePos().x,ImGui::GetMousePos().y);
|
||||
}
|
||||
if (i.macro->open) {
|
||||
|
|
@ -1419,7 +1419,6 @@ void FurnaceGUI::drawInsEdit() {
|
|||
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
// TODO: load replace
|
||||
if (ImGui::Button(ICON_FA_FOLDER_OPEN "##IELoad")) {
|
||||
doAction(GUI_ACTION_INS_LIST_OPEN_REPLACE);
|
||||
}
|
||||
|
|
@ -1444,6 +1443,48 @@ void FurnaceGUI::drawInsEdit() {
|
|||
for (DivInstrumentType i: e->getPossibleInsTypes()) {
|
||||
if (ImGui::Selectable(insTypes[i],insType==i)) {
|
||||
ins->type=i;
|
||||
|
||||
// reset macro zoom
|
||||
ins->std.volMacro.vZoom=-1;
|
||||
ins->std.dutyMacro.vZoom=-1;
|
||||
ins->std.waveMacro.vZoom=-1;
|
||||
ins->std.ex1Macro.vZoom=-1;
|
||||
ins->std.ex2Macro.vZoom=-1;
|
||||
ins->std.ex3Macro.vZoom=-1;
|
||||
ins->std.ex4Macro.vZoom=-1;
|
||||
ins->std.ex5Macro.vZoom=-1;
|
||||
ins->std.ex6Macro.vZoom=-1;
|
||||
ins->std.ex7Macro.vZoom=-1;
|
||||
ins->std.ex8Macro.vZoom=-1;
|
||||
ins->std.panLMacro.vZoom=-1;
|
||||
ins->std.panRMacro.vZoom=-1;
|
||||
ins->std.phaseResetMacro.vZoom=-1;
|
||||
ins->std.algMacro.vZoom=-1;
|
||||
ins->std.fbMacro.vZoom=-1;
|
||||
ins->std.fmsMacro.vZoom=-1;
|
||||
ins->std.amsMacro.vZoom=-1;
|
||||
for (int j=0; j<4; j++) {
|
||||
ins->std.opMacros[j].amMacro.vZoom=-1;
|
||||
ins->std.opMacros[j].arMacro.vZoom=-1;
|
||||
ins->std.opMacros[j].drMacro.vZoom=-1;
|
||||
ins->std.opMacros[j].multMacro.vZoom=-1;
|
||||
ins->std.opMacros[j].rrMacro.vZoom=-1;
|
||||
ins->std.opMacros[j].slMacro.vZoom=-1;
|
||||
ins->std.opMacros[j].tlMacro.vZoom=-1;
|
||||
ins->std.opMacros[j].dt2Macro.vZoom=-1;
|
||||
ins->std.opMacros[j].rsMacro.vZoom=-1;
|
||||
ins->std.opMacros[j].dtMacro.vZoom=-1;
|
||||
ins->std.opMacros[j].d2rMacro.vZoom=-1;
|
||||
ins->std.opMacros[j].ssgMacro.vZoom=-1;
|
||||
ins->std.opMacros[j].damMacro.vZoom=-1;
|
||||
ins->std.opMacros[j].dvbMacro.vZoom=-1;
|
||||
ins->std.opMacros[j].egtMacro.vZoom=-1;
|
||||
ins->std.opMacros[j].kslMacro.vZoom=-1;
|
||||
ins->std.opMacros[j].susMacro.vZoom=-1;
|
||||
ins->std.opMacros[j].vibMacro.vZoom=-1;
|
||||
ins->std.opMacros[j].wsMacro.vZoom=-1;
|
||||
ins->std.opMacros[j].ksrMacro.vZoom=-1;
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
|
|
@ -1490,14 +1531,7 @@ void FurnaceGUI::drawInsEdit() {
|
|||
ImGui::TableNextColumn();
|
||||
drawAlgorithm(ins->fm.alg,FM_ALGS_4OP,ImVec2(ImGui::GetContentRegionAvail().x,48.0*dpiScale));
|
||||
if (ImGui::Button("Request from TX81Z")) {
|
||||
TAMidiMessage msg;
|
||||
msg.type=TA_MIDI_SYSEX;
|
||||
msg.sysExData.reset(new unsigned char[15]);
|
||||
msg.sysExLen=15;
|
||||
memcpy(msg.sysExData.get(),avRequest,15);
|
||||
if (!e->sendMidiMessage(msg)) {
|
||||
showError("Error while sending request (MIDI output not configured?)");
|
||||
}
|
||||
doAction(GUI_ACTION_TX81Z_REQUEST);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Send to TX81Z")) {
|
||||
|
|
@ -3387,6 +3421,110 @@ void FurnaceGUI::drawInsEdit() {
|
|||
popAccentColors();
|
||||
}
|
||||
}
|
||||
if (displayMacroMenu) {
|
||||
displayMacroMenu=false;
|
||||
if (lastMacroDesc.macro!=NULL) {
|
||||
ImGui::OpenPopup("macroMenu");
|
||||
}
|
||||
}
|
||||
if (ImGui::BeginPopup("macroMenu",ImGuiWindowFlags_NoMove|ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoSavedSettings)) {
|
||||
if (ImGui::MenuItem("copy")) {
|
||||
String mmlStr;
|
||||
encodeMMLStr(mmlStr,lastMacroDesc.macro->val,lastMacroDesc.macro->len,lastMacroDesc.macro->loop,lastMacroDesc.macro->rel);
|
||||
SDL_SetClipboardText(mmlStr.c_str());
|
||||
}
|
||||
if (ImGui::MenuItem("paste")) {
|
||||
String mmlStr;
|
||||
char* clipText=SDL_GetClipboardText();
|
||||
if (clipText!=NULL) {
|
||||
if (clipText[0]) {
|
||||
mmlStr=clipText;
|
||||
}
|
||||
SDL_free(clipText);
|
||||
}
|
||||
if (!mmlStr.empty()) {
|
||||
decodeMMLStr(mmlStr,lastMacroDesc.macro->val,lastMacroDesc.macro->len,lastMacroDesc.macro->loop,lastMacroDesc.min,(lastMacroDesc.isBitfield)?((1<<(lastMacroDesc.isBitfield?lastMacroDesc.max:0))-1):lastMacroDesc.max,lastMacroDesc.macro->rel);
|
||||
}
|
||||
}
|
||||
ImGui::Separator();
|
||||
if (ImGui::MenuItem("clear")) {
|
||||
lastMacroDesc.macro->len=0;
|
||||
lastMacroDesc.macro->loop=-1;
|
||||
lastMacroDesc.macro->rel=-1;
|
||||
for (int i=0; i<256; i++) {
|
||||
lastMacroDesc.macro->val[i]=0;
|
||||
}
|
||||
}
|
||||
if (ImGui::MenuItem("clear contents")) {
|
||||
for (int i=0; i<256; i++) {
|
||||
lastMacroDesc.macro->val[i]=0;
|
||||
}
|
||||
}
|
||||
ImGui::Separator();
|
||||
if (ImGui::BeginMenu("offset...")) {
|
||||
ImGui::InputInt("X",¯oOffX,1,10);
|
||||
ImGui::InputInt("Y",¯oOffY,1,10);
|
||||
if (ImGui::Button("offset")) {
|
||||
int oldData[256];
|
||||
memset(oldData,0,256*sizeof(int));
|
||||
memcpy(oldData,lastMacroDesc.macro->val,lastMacroDesc.macro->len*sizeof(int));
|
||||
|
||||
for (int i=0; i<lastMacroDesc.macro->len; i++) {
|
||||
int val=0;
|
||||
if ((i-macroOffX)>=0 && (i-macroOffX)<lastMacroDesc.macro->len) {
|
||||
val=oldData[i-macroOffX]+macroOffY;
|
||||
if (val<lastMacroDesc.min) val=lastMacroDesc.min;
|
||||
if (val>lastMacroDesc.max) val=lastMacroDesc.max;
|
||||
}
|
||||
lastMacroDesc.macro->val[i]=val;
|
||||
}
|
||||
|
||||
if (lastMacroDesc.macro->loop>=0 && lastMacroDesc.macro->loop<lastMacroDesc.macro->len) {
|
||||
lastMacroDesc.macro->loop+=macroOffX;
|
||||
} else {
|
||||
lastMacroDesc.macro->loop=-1;
|
||||
}
|
||||
if ((lastMacroDesc.macro->rel+macroOffX)>=0 && (lastMacroDesc.macro->rel+macroOffX)<lastMacroDesc.macro->len) {
|
||||
lastMacroDesc.macro->rel+=macroOffX;
|
||||
} else {
|
||||
lastMacroDesc.macro->rel=-1;
|
||||
}
|
||||
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
if (ImGui::BeginMenu("scale...")) {
|
||||
if (ImGui::InputFloat("X",¯oScaleX,1.0f,10.0f,"%.2f%%")) {
|
||||
if (macroScaleX<0.1) macroScaleX=0.1;
|
||||
if (macroScaleX>12800.0) macroScaleX=12800.0;
|
||||
}
|
||||
ImGui::InputFloat("Y",¯oScaleY,1.0f,10.0f,"%.2f%%");
|
||||
if (ImGui::Button("scale")) {
|
||||
int oldData[256];
|
||||
memset(oldData,0,256*sizeof(int));
|
||||
memcpy(oldData,lastMacroDesc.macro->val,lastMacroDesc.macro->len*sizeof(int));
|
||||
|
||||
lastMacroDesc.macro->len=MIN(128,((double)lastMacroDesc.macro->len*(macroScaleX/100.0)));
|
||||
|
||||
for (int i=0; i<lastMacroDesc.macro->len; i++) {
|
||||
int val=0;
|
||||
double posX=round((double)i*(100.0/macroScaleX)-0.01);
|
||||
if (posX>=0 && posX<lastMacroDesc.macro->len) {
|
||||
val=round((double)oldData[(int)posX]*(macroScaleY/100.0));
|
||||
if (val<lastMacroDesc.min) val=lastMacroDesc.min;
|
||||
if (val>lastMacroDesc.max) val=lastMacroDesc.max;
|
||||
}
|
||||
lastMacroDesc.macro->val[i]=val;
|
||||
}
|
||||
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
}
|
||||
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_INS_EDIT;
|
||||
ImGui::End();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue