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 - if macros have release, note off should release them
- add ability to move selection by dragging - add ability to move selection by dragging
- find and replace - find and replace
- add mono/poly note preview button
- (maybe) add default patch selection - (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 // 2. find a free channel
do { 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].midiNote=note;
chan[finalChan].midiAge=midiAgeCounter++; chan[finalChan].midiAge=midiAgeCounter++;
pendingNotes.push(DivNoteEvent(finalChan,ins,note,vol,true)); 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) { void DivEngine::setOrder(unsigned char order) {
BUSY_BEGIN_SOFT; BUSY_BEGIN_SOFT;
curOrder=order; curOrder=order;

View File

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

View File

@ -150,6 +150,14 @@ void FurnaceGUI::drawEditControls() {
e->stepOne(cursor.y); e->stepOne(cursor.y);
pendingStepUpdate=true; 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; if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_EDIT_CONTROLS;
ImGui::End(); ImGui::End();
@ -227,6 +235,14 @@ void FurnaceGUI::drawEditControls() {
unimportant(ImGui::Checkbox("Orders",&followOrders)); unimportant(ImGui::Checkbox("Orders",&followOrders));
ImGui::SameLine(); ImGui::SameLine();
unimportant(ImGui::Checkbox("Pattern",&followPattern)); 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; if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_EDIT_CONTROLS;
ImGui::End(); ImGui::End();
@ -302,6 +318,13 @@ void FurnaceGUI::drawEditControls() {
followPattern=!followPattern; followPattern=!followPattern;
} }
ImGui::PopStyleColor(); 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; if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_EDIT_CONTROLS;
ImGui::End(); ImGui::End();
@ -357,6 +380,14 @@ void FurnaceGUI::drawEditControls() {
e->setRepeatPattern(!repeatPattern); e->setRepeatPattern(!repeatPattern);
} }
ImGui::PopStyleColor(); 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; if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_EDIT_CONTROLS;
ImGui::End(); ImGui::End();

View File

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

View File

@ -815,7 +815,7 @@ class FurnaceGUI {
String mmlStringW; String mmlStringW;
bool quit, warnQuit, willCommit, edit, modified, displayError, displayExporting, vgmExportLoop, wantCaptureKeyboard, oldWantCaptureKeyboard, displayMacroMenu; 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]; bool willExport[32];
int vgmExportVersion; int vgmExportVersion;
int drawHalt; int drawHalt;