gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

commit 32dd3081397936d303c13ad7e1ebcc7ef43d83df
parent 693afcfa2f84aba00be86680018ea82529a6286f
Author: trancy2k5 <63122430+trancy2k5@users.noreply.github.com>
Date:   Sun, 23 Jan 2022 13:21:48 +0100

Fix possibly compile error on git
Arrow keys -> and <- for preset change added
Added hyperlink for donation
Fix possibly for closing the plug-in
Fix showing in filemode false preset name on start
Added Get-Functions in PatchBrowser
Fix in Show Bankcount
Fix that the bank H is not displayed in the combo box

Diffstat:
Msource/jucePlugin/ui2/Ui_Utils.h | 2+-
Msource/jucePlugin/ui2/VirusEditor.cpp | 95++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------
Msource/jucePlugin/ui2/VirusEditor.h | 4+++-
Msource/jucePlugin/ui2/Virus_Panel5_PatchBrowser.cpp | 18+++++++++++++++++-
Msource/jucePlugin/ui2/Virus_Panel5_PatchBrowser.h | 8++++++--
5 files changed, 94 insertions(+), 33 deletions(-)

diff --git a/source/jucePlugin/ui2/Ui_Utils.h b/source/jucePlugin/ui2/Ui_Utils.h @@ -1,6 +1,6 @@ #include "Virus_LookAndFeel.h" #include "../VirusController.h" -#include "../virusLib/microcontrollerTypes.h" +#include "../../virusLib/microcontrollerTypes.h" constexpr auto knobSize = Virus::LookAndFeel::kKnobSize; constexpr auto knobSizeSmall = Virus::LookAndFeelSmallButton::kKnobSize; diff --git a/source/jucePlugin/ui2/VirusEditor.cpp b/source/jucePlugin/ui2/VirusEditor.cpp @@ -41,6 +41,10 @@ VirusEditor::VirusEditor(VirusParameterBinding &_parameterBinding, AudioPluginAu applyToSections([this](Component *s) { addChildComponent(s); }); + //Init Keyboard + setWantsKeyboardFocus(true); + addKeyListener(this); + // show/hide section from buttons.. m_mainButtons.updateSection = [this]() { if (m_mainButtons.m_arpSettings.getToggleState()) { @@ -162,6 +166,15 @@ VirusEditor::VirusEditor(VirusParameterBinding &_parameterBinding, AudioPluginAu m_RomName.setJustificationType(Justification::centred); addAndMakeVisible(m_RomName); + //Hyperlink + m_hyperLink.setBounds(900, 1115, 400, 35); + m_hyperLink.setColour(juce::Label::textColourId, juce::Colours::silver); + m_hyperLink.setFont(juce::Font("Arial", "Bold", 20.f), true, dontSendNotification); + m_hyperLink.setJustificationType(Justification::left); + m_hyperLink.setJustificationType(Justification::centred); + addAndMakeVisible(m_hyperLink); + + m_controller.onProgramChange = [this]() { updateParts(); @@ -182,15 +195,30 @@ VirusEditor::VirusEditor(VirusParameterBinding &_parameterBinding, AudioPluginAu VirusEditor::~VirusEditor() { + m_controller.onProgramChange = nullptr; m_mainMenu.onClick = nullptr; selectorMenu.setLookAndFeel(nullptr); SubSkinSizeSelector.setLookAndFeel(nullptr); m_mainMenu.setLookAndFeel (nullptr); selector.setLookAndFeel (nullptr); - m_controller.onProgramChange = nullptr; setLookAndFeel(nullptr); } +bool VirusEditor::keyPressed(const KeyPress &k, Component *c) +{ + if( k.getKeyCode() == 65573) + { + postCommandMessage(VirusEditor::Commands::PrevPatch); + } + if( k.getKeyCode() == 65575) + { + postCommandMessage(VirusEditor::Commands::NextPatch); + } + //43 + + //45 - + return true; +} + void VirusEditor::updateParts() { const auto multiMode = m_controller.isMultiMode(); @@ -199,27 +227,23 @@ void VirusEditor::updateParts() bool singlePartOrInMulti = pt == 0 || multiMode; if (pt == m_controller.getCurrentPart()) { - int CurrentPart = m_controller.getCurrentPartProgram(m_controller.getCurrentPart()); - - const auto patchName = m_controller.getCurrentPartPresetName(pt); - if(m_patchName.getText() != patchName) - { - String sZero; - if (m_patchBrowser->GetIsFileMode()) - { - m_patchName.setText("["+juce::String(m_controller.getCurrentPart()+1) - +"][FILE] " - + sZero.paddedLeft('0',(CurrentPart<10)?2:(CurrentPart<100)?1:0) - + juce::String(m_patchBrowser->m_patchList.getSelectedRow(0))+": " + patchName, dontSendNotification); - } - else - { + if (m_patchBrowser->GetIsFileMode()) + { + m_patchName.setText("["+juce::String(m_controller.getCurrentPart()+1) + +"][FILE] " + + juce::String(m_patchBrowser->GetTablePatchList()->getSelectedRow(0)+1)+": " + m_patchBrowser->GetLastPatchSelected(), dontSendNotification); + } + else + { + const auto patchName = m_controller.getCurrentPartPresetName(pt); + if(m_patchName.getText() != patchName) + { + String sZero; m_patchName.setText("["+juce::String(m_controller.getCurrentPart()+1) +"][" + getCurrentPartBankStr(m_controller.getCurrentPartBank(m_controller.getCurrentPart())) + "] " - + sZero.paddedLeft('0',(CurrentPart<10)?2:(CurrentPart<100)?1:0) + juce::String(processorRef.getController().getCurrentPartProgram(m_controller.getCurrentPart())+1)+": " + patchName, dontSendNotification); - } - } + } + } } } } @@ -372,17 +396,32 @@ void VirusEditor::handleCommandMessage(int commandId) { switch (commandId) { case Commands::Rebind: recreateControls(); - case Commands::UpdateParts: { updateParts(); m_arpEditor->refreshParts();}; break; - case Commands::InitPatches: { - m_patchBrowser->IntiPatches();}; break; - case Commands::PrevPatch: { - m_patchBrowser->m_patchList.selectRow(m_patchBrowser->m_patchList.getSelectedRow(0)-1,false,false); + case Commands::UpdateParts: + { + updateParts(); + m_arpEditor->refreshParts(); + }; break; + case Commands::InitPatches: + { + m_patchBrowser->IntiPatches(); + }; break; + case Commands::PrevPatch: + { + if (m_patchBrowser->GetTablePatchList()->getSelectedRow(0)>0) + { + m_patchBrowser->GetTablePatchList()->selectRow(m_patchBrowser->GetTablePatchList()->getSelectedRow(0)-1,false,false); + } };break; - case Commands::NextPatch: { - m_patchBrowser->m_patchList.selectRow(m_patchBrowser->m_patchList.getSelectedRow(0)+1,false,false); + case Commands::NextPatch: + { + if (m_patchBrowser->GetTablePatchList()->getSelectedRow(0)<m_patchBrowser->GetTablePatchList()->getNumRows()-1) + { + m_patchBrowser->GetTablePatchList()->selectRow(m_patchBrowser->GetTablePatchList()->getSelectedRow(0)+1,false,false); + } };break; - case Commands::SelectFirstPatch: { - m_patchBrowser->m_patchList.selectRow(0,false,false); + case Commands::SelectFirstPatch: + { + m_patchBrowser->GetTablePatchList()->selectRow(0,false,false); };break; default: return; diff --git a/source/jucePlugin/ui2/VirusEditor.h b/source/jucePlugin/ui2/VirusEditor.h @@ -15,7 +15,7 @@ class ArpEditor; class PatchBrowser; class AudioProcessorEditor; -class VirusEditor : public juce::Component +class VirusEditor : public juce::Component, private KeyListener { public: VirusEditor(VirusParameterBinding &_parameterBinding, AudioPluginAudioProcessor &_processorRef); @@ -26,6 +26,7 @@ public: void ShowMenuePatchList(); void ShowMainMenue(); void updateParts(); + bool keyPressed(const KeyPress &k, Component *c) override; enum Commands { None, @@ -45,6 +46,7 @@ private: juce::Label m_version; juce::Label m_SynthModel; + HyperlinkButton m_hyperLink { "donate: paypal.me/dsp56300", { "http://www.paypal.me/dsp56300" } }; juce::Label m_RomName; juce::Label m_patchName; juce::Label m_controlLabel; diff --git a/source/jucePlugin/ui2/Virus_Panel5_PatchBrowser.cpp b/source/jucePlugin/ui2/Virus_Panel5_PatchBrowser.cpp @@ -89,7 +89,7 @@ PatchBrowser::PatchBrowser(VirusParameterBinding & _parameterBinding, AudioPlugi addAndMakeVisible(m_bankList); m_ROMBankSelect.setBounds(510 - 961 / 2, 78 - 51 / 2, 961, 51); - for (int i=1; i<=m_controller.getBankCount()-1;i++) + for (int i=1; i<=m_controller.getBankCount();i++) { m_ROMBankSelect.addItem("BANK: " + getCurrentPartBankStr((virusLib::BankNumber)i),i+1); } @@ -156,6 +156,17 @@ void PatchBrowser::SaveSettings() } +juce::String PatchBrowser::GetLastPatchSelected() +{ + return m_LastPatchSelected; +} + +juce::TableListBox* PatchBrowser::GetTablePatchList() +{ + return &m_patchList; +} + + bool PatchBrowser::GetIsFileMode() { return m_bIsFileMode; @@ -474,6 +485,9 @@ void PatchBrowser::selectedRowsChanged(int lastRowSelected) { return; } + juce::Component *c; + c = m_patchList.getCellComponent(1,idx); + if (m_bIsFileMode) { uint8_t syxHeader[9] = {0xF0, 0x00, 0x20, 0x33, 0x01, 0x00, 0x10, 0x00, 0x00}; @@ -500,6 +514,8 @@ void PatchBrowser::selectedRowsChanged(int lastRowSelected) { syx.push_back(syxEof); m_controller.sendSysEx(syx); // send to edit buffer m_controller.parseMessage(syx); // update ui + + m_LastPatchSelected = parseAsciiText(data, 128 + 112); getParentComponent()->postCommandMessage(VirusEditor::Commands::UpdateParts); } else diff --git a/source/jucePlugin/ui2/Virus_Panel5_PatchBrowser.h b/source/jucePlugin/ui2/Virus_Panel5_PatchBrowser.h @@ -39,7 +39,9 @@ public: void loadBankFileToRom(const juce::File &file); void savePreset(); bool GetIsFileMode(); - juce::TableListBox m_patchList; + juce::String GetLastPatchSelected(); + juce::TableListBox* GetTablePatchList(); + void IntiPatches(); private: @@ -80,7 +82,9 @@ private: juce::ComboBox m_ROMBankSelect; juce::String m_previousPath; juce::String m_LastFileUsed; - //int m_LastPatchNoUsed; + juce::TableListBox m_patchList; + juce::String m_LastPatchSelected; + int m_LastBankRomNoUsed; bool m_bIsFileMode;