GUI: add mono/poly note preview button

This commit is contained in:
tildearrow 2022-06-03 18:05:07 -05:00
parent a6b33d0955
commit 1f1d2c85bd
6 changed files with 47 additions and 3 deletions

View file

@ -8,5 +8,4 @@
- if macros have release, note off should release them
- add ability to move selection by dragging
- find and replace
- add mono/poly note preview button
- (maybe) add default patch selection

View file

@ -2500,7 +2500,7 @@ void DivEngine::autoNoteOn(int ch, int ins, int note, int vol) {
// 2. find a free channel
do {
if (isViable[finalChan] && chan[finalChan].midiNote==-1 && (insInst->type==DIV_INS_OPL || getChannelType(finalChan)==finalChanType || notInViableChannel)) {
if ((!midiPoly) || (isViable[finalChan] && chan[finalChan].midiNote==-1 && (insInst->type==DIV_INS_OPL || getChannelType(finalChan)==finalChanType || notInViableChannel))) {
chan[finalChan].midiNote=note;
chan[finalChan].midiAge=midiAgeCounter++;
pendingNotes.push(DivNoteEvent(finalChan,ins,note,vol,true));
@ -2556,6 +2556,10 @@ void DivEngine::autoNoteOffAll() {
}
}
void DivEngine::setAutoNotePoly(bool poly) {
midiPoly=poly;
}
void DivEngine::setOrder(unsigned char order) {
BUSY_BEGIN_SOFT;
curOrder=order;

View file

@ -352,6 +352,7 @@ class DivEngine {
int reversePitchTable[4096];
int pitchTable[4096];
int midiBaseChan;
bool midiPoly;
size_t midiAgeCounter;
blip_buffer_t* samp_bb;
@ -725,6 +726,9 @@ class DivEngine {
void autoNoteOn(int chan, int ins, int note, int vol=-1);
void autoNoteOff(int chan, int note, int vol=-1);
void autoNoteOffAll();
// set whether autoNoteIn is mono or poly
void setAutoNotePoly(bool poly);
// go to order
void setOrder(unsigned char order);
@ -956,6 +960,7 @@ class DivEngine {
audioEngine(DIV_AUDIO_NULL),
exportMode(DIV_EXPORT_MODE_ONE),
midiBaseChan(0),
midiPoly(true),
midiAgeCounter(0),
samp_bb(NULL),
samp_bbInLen(0),

View file

@ -150,6 +150,14 @@ void FurnaceGUI::drawEditControls() {
e->stepOne(cursor.y);
pendingStepUpdate=true;
}
ImGui::SameLine();
ImGui::PushStyleColor(ImGuiCol_Button,TOGGLE_COLOR(noteInputPoly));
if (ImGui::Button(noteInputPoly?(ICON_FA_ALIGN_LEFT "##PolyInput"):(ICON_FA_SPACE_SHUTTLE "##PolyInput"))) {
noteInputPoly=!noteInputPoly;
e->setAutoNotePoly(noteInputPoly);
}
ImGui::PopStyleColor();
}
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_EDIT_CONTROLS;
ImGui::End();
@ -227,6 +235,14 @@ void FurnaceGUI::drawEditControls() {
unimportant(ImGui::Checkbox("Orders",&followOrders));
ImGui::SameLine();
unimportant(ImGui::Checkbox("Pattern",&followPattern));
ImGui::SameLine();
ImGui::PushStyleColor(ImGuiCol_Button,TOGGLE_COLOR(noteInputPoly));
if (ImGui::Button(noteInputPoly?(ICON_FA_ALIGN_LEFT "##PolyInput"):(ICON_FA_SPACE_SHUTTLE "##PolyInput"))) {
noteInputPoly=!noteInputPoly;
e->setAutoNotePoly(noteInputPoly);
}
ImGui::PopStyleColor();
}
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_EDIT_CONTROLS;
ImGui::End();
@ -302,6 +318,13 @@ void FurnaceGUI::drawEditControls() {
followPattern=!followPattern;
}
ImGui::PopStyleColor();
ImGui::PushStyleColor(ImGuiCol_Button,TOGGLE_COLOR(noteInputPoly));
if (ImGui::Button(noteInputPoly?(ICON_FA_ALIGN_LEFT "##PolyInput"):(ICON_FA_SPACE_SHUTTLE "##PolyInput"))) {
noteInputPoly=!noteInputPoly;
e->setAutoNotePoly(noteInputPoly);
}
ImGui::PopStyleColor();
}
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_EDIT_CONTROLS;
ImGui::End();
@ -357,6 +380,14 @@ void FurnaceGUI::drawEditControls() {
e->setRepeatPattern(!repeatPattern);
}
ImGui::PopStyleColor();
ImGui::SameLine();
ImGui::PushStyleColor(ImGuiCol_Button,TOGGLE_COLOR(noteInputPoly));
if (ImGui::Button(noteInputPoly?(ICON_FA_ALIGN_LEFT "##PolyInput"):(ICON_FA_SPACE_SHUTTLE "##PolyInput"))) {
noteInputPoly=!noteInputPoly;
e->setAutoNotePoly(noteInputPoly);
}
ImGui::PopStyleColor();
}
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_EDIT_CONTROLS;
ImGui::End();

View file

@ -3923,6 +3923,7 @@ bool FurnaceGUI::init() {
edit=e->getConfBool("edit",false);
followOrders=e->getConfBool("followOrders",true);
followPattern=e->getConfBool("followPattern",true);
noteInputPoly=e->getConfBool("noteInputPoly",true);
orderEditMode=e->getConfInt("orderEditMode",0);
if (orderEditMode<0) orderEditMode=0;
if (orderEditMode>3) orderEditMode=3;
@ -3949,6 +3950,8 @@ bool FurnaceGUI::init() {
initSystemPresets();
e->setAutoNotePoly(noteInputPoly);
#if !(defined(__APPLE__) || defined(_WIN32))
unsigned char* furIcon=getFurnaceIcon();
SDL_Surface* icon=SDL_CreateRGBSurfaceFrom(furIcon,256,256,32,256*4,0xff,0xff00,0xff0000,0xff000000);
@ -4142,6 +4145,7 @@ bool FurnaceGUI::finish() {
e->setConf("followOrders",followOrders);
e->setConf("followPattern",followPattern);
e->setConf("orderEditMode",orderEditMode);
e->setConf("noteInputPoly",noteInputPoly);
// commit oscilloscope state
e->setConf("oscZoom",oscZoom);
@ -4193,6 +4197,7 @@ FurnaceGUI::FurnaceGUI():
fullScreen(false),
preserveChanPos(false),
wantScrollList(false),
noteInputPoly(true),
vgmExportVersion(0x171),
drawHalt(10),
macroPointSize(16),

View file

@ -815,7 +815,7 @@ class FurnaceGUI {
String mmlStringW;
bool quit, warnQuit, willCommit, edit, modified, displayError, displayExporting, vgmExportLoop, wantCaptureKeyboard, oldWantCaptureKeyboard, displayMacroMenu;
bool displayNew, fullScreen, preserveChanPos, wantScrollList;
bool displayNew, fullScreen, preserveChanPos, wantScrollList, noteInputPoly;
bool willExport[32];
int vgmExportVersion;
int drawHalt;