diff --git a/TODO.md b/TODO.md index 2dc7bb8e..5b55743e 100644 --- a/TODO.md +++ b/TODO.md @@ -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 diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index f086d19c..07e74922 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -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; diff --git a/src/engine/engine.h b/src/engine/engine.h index 78a56178..3bd4fc28 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -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), diff --git a/src/gui/editControls.cpp b/src/gui/editControls.cpp index 671ca63b..ecd71c6e 100644 --- a/src/gui/editControls.cpp +++ b/src/gui/editControls.cpp @@ -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(); diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 7817d4ff..bc18ae3c 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -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), diff --git a/src/gui/gui.h b/src/gui/gui.h index da2ebc55..705f6827 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -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;