mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-27 06:53:01 +00:00
GUI: add modulation table string for FDS/VB
This commit is contained in:
parent
a0922c67e4
commit
3de621796e
3 changed files with 51 additions and 2 deletions
|
@ -5875,6 +5875,7 @@ FurnaceGUI::FurnaceGUI():
|
||||||
pendingInsSingle(false),
|
pendingInsSingle(false),
|
||||||
displayPendingRawSample(false),
|
displayPendingRawSample(false),
|
||||||
snesFilterHex(false),
|
snesFilterHex(false),
|
||||||
|
modTableHex(false),
|
||||||
mobileEdit(false),
|
mobileEdit(false),
|
||||||
vgmExportVersion(0x171),
|
vgmExportVersion(0x171),
|
||||||
vgmExportTrailingTicks(-1),
|
vgmExportTrailingTicks(-1),
|
||||||
|
|
|
@ -1137,7 +1137,7 @@ class FurnaceGUI {
|
||||||
String workingDirVGMExport, workingDirZSMExport, workingDirROMExport, workingDirFont, workingDirColors, workingDirKeybinds;
|
String workingDirVGMExport, workingDirZSMExport, workingDirROMExport, workingDirFont, workingDirColors, workingDirKeybinds;
|
||||||
String workingDirLayout, workingDirROM, workingDirTest;
|
String workingDirLayout, workingDirROM, workingDirTest;
|
||||||
String mmlString[32];
|
String mmlString[32];
|
||||||
String mmlStringW, mmlStringSNES, grooveString, grooveListString;
|
String mmlStringW, mmlStringSNES, grooveString, grooveListString, mmlStringModTable;
|
||||||
|
|
||||||
std::vector<DivSystem> sysSearchResults;
|
std::vector<DivSystem> sysSearchResults;
|
||||||
std::vector<FurnaceGUISysDef> newSongSearchResults;
|
std::vector<FurnaceGUISysDef> newSongSearchResults;
|
||||||
|
@ -1150,7 +1150,7 @@ class FurnaceGUI {
|
||||||
bool portrait, injectBackUp, mobileMenuOpen;
|
bool portrait, injectBackUp, mobileMenuOpen;
|
||||||
bool wantCaptureKeyboard, oldWantCaptureKeyboard, displayMacroMenu;
|
bool wantCaptureKeyboard, oldWantCaptureKeyboard, displayMacroMenu;
|
||||||
bool displayNew, fullScreen, preserveChanPos, wantScrollList, noteInputPoly;
|
bool displayNew, fullScreen, preserveChanPos, wantScrollList, noteInputPoly;
|
||||||
bool displayPendingIns, pendingInsSingle, displayPendingRawSample, snesFilterHex;
|
bool displayPendingIns, pendingInsSingle, displayPendingRawSample, snesFilterHex, modTableHex;
|
||||||
bool mobileEdit;
|
bool mobileEdit;
|
||||||
bool willExport[DIV_MAX_CHIPS];
|
bool willExport[DIV_MAX_CHIPS];
|
||||||
int vgmExportVersion;
|
int vgmExportVersion;
|
||||||
|
|
|
@ -4441,6 +4441,7 @@ void FurnaceGUI::drawInsEdit() {
|
||||||
}
|
}
|
||||||
if (ins->type==DIV_INS_FDS) if (ImGui::BeginTabItem("FDS")) {
|
if (ins->type==DIV_INS_FDS) if (ImGui::BeginTabItem("FDS")) {
|
||||||
float modTable[32];
|
float modTable[32];
|
||||||
|
int modTableInt[256];
|
||||||
ImGui::Checkbox("Compatibility mode",&ins->fds.initModTableWithFirstWave);
|
ImGui::Checkbox("Compatibility mode",&ins->fds.initModTableWithFirstWave);
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
ImGui::SetTooltip("only use for compatibility with .dmf modules!\n- initializes modulation table with first wavetable\n- does not alter modulation parameters on instrument change");
|
ImGui::SetTooltip("only use for compatibility with .dmf modules!\n- initializes modulation table with first wavetable\n- does not alter modulation parameters on instrument change");
|
||||||
|
@ -4456,6 +4457,7 @@ void FurnaceGUI::drawInsEdit() {
|
||||||
ImGui::Text("Modulation table");
|
ImGui::Text("Modulation table");
|
||||||
for (int i=0; i<32; i++) {
|
for (int i=0; i<32; i++) {
|
||||||
modTable[i]=ins->fds.modTable[i];
|
modTable[i]=ins->fds.modTable[i];
|
||||||
|
modTableInt[i]=ins->fds.modTable[i];
|
||||||
}
|
}
|
||||||
ImVec2 modTableSize=ImVec2(ImGui::GetContentRegionAvail().x,96.0f*dpiScale);
|
ImVec2 modTableSize=ImVec2(ImGui::GetContentRegionAvail().x,96.0f*dpiScale);
|
||||||
PlotCustom("ModTable",modTable,32,0,NULL,-4,3,modTableSize,sizeof(float),ImVec4(1.0f,1.0f,1.0f,1.0f),0,NULL,NULL,true);
|
PlotCustom("ModTable",modTable,32,0,NULL,-4,3,modTableSize,sizeof(float),ImVec4(1.0f,1.0f,1.0f,1.0f),0,NULL,NULL,true);
|
||||||
|
@ -4477,15 +4479,37 @@ void FurnaceGUI::drawInsEdit() {
|
||||||
processDrags(ImGui::GetMousePos().x,ImGui::GetMousePos().y);
|
processDrags(ImGui::GetMousePos().x,ImGui::GetMousePos().y);
|
||||||
ImGui::InhibitInertialScroll();
|
ImGui::InhibitInertialScroll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); // wavetable text input size found here
|
||||||
|
if (ImGui::InputText("##MMLModTable",&mmlStringModTable)) {
|
||||||
|
int discardIt=0;
|
||||||
|
memset(modTableInt,0,256*sizeof(int));
|
||||||
|
decodeMMLStrW(mmlStringModTable,modTableInt,discardIt,-4,3,false);
|
||||||
|
for (int i=0; i<32; i++) {
|
||||||
|
if (i>=discardIt) {
|
||||||
|
modTableInt[i]=0;
|
||||||
|
} else {
|
||||||
|
if (modTableInt[i]<-4) modTableInt[i]=-4;
|
||||||
|
if (modTableInt[i]>3) modTableInt[i]=3;
|
||||||
|
}
|
||||||
|
ins->fds.modTable[i]=modTableInt[i];
|
||||||
|
}
|
||||||
|
MARK_MODIFIED;
|
||||||
|
}
|
||||||
|
if (!ImGui::IsItemActive()) {
|
||||||
|
encodeMMLStr(mmlStringModTable,modTableInt,32,-1,-1,false);
|
||||||
|
}
|
||||||
ImGui::EndTabItem();
|
ImGui::EndTabItem();
|
||||||
}
|
}
|
||||||
if (ins->type==DIV_INS_VBOY) if (ImGui::BeginTabItem("Virtual Boy")) {
|
if (ins->type==DIV_INS_VBOY) if (ImGui::BeginTabItem("Virtual Boy")) {
|
||||||
float modTable[32];
|
float modTable[32];
|
||||||
|
int modTableInt[256];
|
||||||
P(ImGui::Checkbox("Set modulation table (channel 5 only)",&ins->fds.initModTableWithFirstWave));
|
P(ImGui::Checkbox("Set modulation table (channel 5 only)",&ins->fds.initModTableWithFirstWave));
|
||||||
|
|
||||||
ImGui::BeginDisabled(!ins->fds.initModTableWithFirstWave);
|
ImGui::BeginDisabled(!ins->fds.initModTableWithFirstWave);
|
||||||
for (int i=0; i<32; i++) {
|
for (int i=0; i<32; i++) {
|
||||||
modTable[i]=ins->fds.modTable[i];
|
modTable[i]=ins->fds.modTable[i];
|
||||||
|
modTableInt[i]=modTableHex?((unsigned char)ins->fds.modTable[i]):ins->fds.modTable[i];
|
||||||
}
|
}
|
||||||
ImVec2 modTableSize=ImVec2(ImGui::GetContentRegionAvail().x,256.0f*dpiScale);
|
ImVec2 modTableSize=ImVec2(ImGui::GetContentRegionAvail().x,256.0f*dpiScale);
|
||||||
PlotCustom("ModTable",modTable,32,0,NULL,-128,127,modTableSize,sizeof(float),ImVec4(1.0f,1.0f,1.0f,1.0f),0,NULL,NULL,true);
|
PlotCustom("ModTable",modTable,32,0,NULL,-128,127,modTableSize,sizeof(float),ImVec4(1.0f,1.0f,1.0f,1.0f),0,NULL,NULL,true);
|
||||||
|
@ -4507,6 +4531,30 @@ void FurnaceGUI::drawInsEdit() {
|
||||||
processDrags(ImGui::GetMousePos().x,ImGui::GetMousePos().y);
|
processDrags(ImGui::GetMousePos().x,ImGui::GetMousePos().y);
|
||||||
ImGui::InhibitInertialScroll();
|
ImGui::InhibitInertialScroll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ImGui::Button(modTableHex?"Hex##MTHex":"Dec##MTHex")) {
|
||||||
|
modTableHex=!modTableHex;
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); // wavetable text input size found here
|
||||||
|
if (ImGui::InputText("##MMLModTable",&mmlStringModTable)) {
|
||||||
|
int discardIt=0;
|
||||||
|
memset(modTableInt,0,256*sizeof(int));
|
||||||
|
decodeMMLStrW(mmlStringModTable,modTableInt,discardIt,modTableHex?0:-128,modTableHex?255:127,modTableHex);
|
||||||
|
for (int i=0; i<32; i++) {
|
||||||
|
if (i>=discardIt) {
|
||||||
|
modTableInt[i]=0;
|
||||||
|
} else {
|
||||||
|
if (modTableInt[i]>=128) modTableInt[i]-=256;
|
||||||
|
}
|
||||||
|
ins->fds.modTable[i]=modTableInt[i];
|
||||||
|
}
|
||||||
|
MARK_MODIFIED;
|
||||||
|
}
|
||||||
|
if (!ImGui::IsItemActive()) {
|
||||||
|
encodeMMLStr(mmlStringModTable,modTableInt,32,-1,-1,modTableHex);
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
|
||||||
ImGui::EndDisabled();
|
ImGui::EndDisabled();
|
||||||
ImGui::EndTabItem();
|
ImGui::EndTabItem();
|
||||||
|
|
Loading…
Reference in a new issue