diff --git a/Source/DXLookNFeel.cpp b/Source/DXLookNFeel.cpp index 85d70bd2..c5861ec9 100644 --- a/Source/DXLookNFeel.cpp +++ b/Source/DXLookNFeel.cpp @@ -106,7 +106,7 @@ DXLookNFeel::DXLookNFeel() { } } } - +#ifdef IMPLEMENT_DEADCODE_DXLookNFeel // TODO: THIS IS DEAD CODE. NOBODY IS USING THIS. forEachXmlChildElementWithTagName(*root, image, "image") { String name = image->getStringAttribute("id", ""); @@ -156,6 +156,8 @@ DXLookNFeel::DXLookNFeel() { continue; } } +TRACE("WARNING! Dead code snippet is implemented!"); +#endif // IMPLEMENT_DEADCODE_DXLookNFeel } Typeface::Ptr DXLookNFeel::getTypefaceForFont(const Font &) { diff --git a/Source/DXLookNFeel.h b/Source/DXLookNFeel.h index dfb8cbe7..02811970 100644 --- a/Source/DXLookNFeel.h +++ b/Source/DXLookNFeel.h @@ -23,6 +23,13 @@ #include "../JuceLibraryCode/JuceHeader.h" +/// If the macro ''IMPLEMENT_DEADCODE_DXLookAndFeel'' is defined as any NONZERO value, +/// then a recently unused code snippet in constuctor ''DXLookNFeel::DXLookNFeel()'' +/// in file ''DXLookNFeel.cpp'', is implemented. +/// Use 0 to exclude the related source snippets. +/// WARNING: this code snippet mentioned is very likely a candidate for deprecation/obsolescence. +#define IMPLEMENT_DEADCODE_DXLookNFeel 0 + class LightedToggleButton : public ToggleButton { public: LightedToggleButton(const char*l) : ToggleButton(l) { } diff --git a/Source/GlobalEditor.cpp b/Source/GlobalEditor.cpp index 31cf644a..eab185e5 100644 --- a/Source/GlobalEditor.cpp +++ b/Source/GlobalEditor.cpp @@ -31,14 +31,19 @@ * Ugly but useful midi monitor to know if you are really sending/receiving something from the DX7 * If the midi is not configured this component wont show up * + */ +#if IMPLEMENT_MidiMonitor class MidiMonitor : public Component { SysexComm *midi; Image light; + SharedResourcePointer lookAndFeel; public: MidiMonitor(SysexComm *sysexComm) { midi = sysexComm; - light = DXLookNFeel::getLookAndFeel()->imageLight; + light = lookAndFeel->imageLight; + + TRACE("WARNING! This functionality is a candidate for deprecation/obsolescence!"); } void paint(Graphics &g) { @@ -58,13 +63,14 @@ class MidiMonitor : public Component { midi->outActivity = false; } } -};*/ +}; +#endif // IMPLEMENT_MidiMonitor class AboutBox : public DialogWindow { public: Image logo_png; std::unique_ptr dexed; // changed to std::unique_ptr from juce::ScopedPointer - std::unique_ptr surge; // changed to std__unique_ptr from juce::ScopedPointer + std::unique_ptr surge; // changed to std::unique_ptr from juce::ScopedPointer AboutBox(Component *parent) : DialogWindow("About", Colour(0xFF000000), true), dexed(std::make_unique("https://asb2m10.github.io/dexed/", URL("https://asb2m10.github.io/dexed/"))), @@ -708,9 +714,11 @@ void GlobalEditor::bind(DexedAudioProcessorEditor *edit) { editor = edit; - //midiMonitor = new MidiMonitor(&(processor->sysexComm)); - //addAndMakeVisible(midiMonitor); - //midiMonitor->setBounds(155, 21, 80, 45); +#if IMPLEMENT_MidiMonitor + midiMonitor = std::make_unique(&(processor->sysexComm)); + addAndMakeVisible(*midiMonitor); + midiMonitor->setBounds(116, 14, 80, 45); //midiMonitor->setBounds(155, 21, 80, 45); +#endif //IMPLEMENT_MidiMonitor repaint(); } @@ -736,7 +744,10 @@ void GlobalEditor::updatePitchPos(int pos) { void GlobalEditor::updateVu(float f) { m_vuMeterMain->v = f; m_vuMeterMain->repaint(); - //midiMonitor->repaint(); + +#if IMPLEMENT_MidiMonitor + midiMonitor->repaint(); +#endif } void GlobalEditor::setMonoState(bool state) { diff --git a/Source/GlobalEditor.h b/Source/GlobalEditor.h index 34ced5ae..c04aafaf 100644 --- a/Source/GlobalEditor.h +++ b/Source/GlobalEditor.h @@ -24,6 +24,9 @@ #include "PluginProcessor.h" #include "DXComponents.h" #include "AlgoDisplay.h" +#ifdef IMPLEMENT_MidiMonitor +#include "SysexComm.h" +#endif // IMPLEMENT_MidiMonitor class DexedAudioProcessorEditor; //[/Headers] @@ -59,7 +62,10 @@ class GlobalEditor : public Component, void setMonoState(bool state); ProgramSelector *programs; - //std::unique_ptr midiMonitor; + +#if IMPLEMENT_MidiMonitor + std::unique_ptr midiMonitor; +#endif //IMPLEMENT_MidiMonitor void mouseDown(const MouseEvent& e) override; //[/UserMethods] diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index 8b0ed610..cf5642b5 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -613,7 +613,9 @@ void DexedAudioProcessor::handleIncomingMidiMessage(MidiInput* source, const Mid if ( message.isActiveSense() ) return; +#if IMPLEMENT_MidiMonitor sysexComm.inActivity = true; +#endif IMPLEMENT_MidiMonitor const uint8 *buf = message.getRawData(); int sz = message.getRawDataSize(); diff --git a/Source/SysexComm.cpp b/Source/SysexComm.cpp index c4e70aee..5caf7273 100644 --- a/Source/SysexComm.cpp +++ b/Source/SysexComm.cpp @@ -31,6 +31,11 @@ SysexComm::SysexComm() { input = NULL; output = NULL; inputOutput = false; + +#if IMPLEMENT_MidiMonitor + inActivity = false; + outActivity = false; +#endif //IMPLEMENT_MidiMonitor } String SysexComm::getInput() { @@ -132,7 +137,11 @@ void SysexComm::setChl(int chl) { int SysexComm::send(const MidiMessage &message) { if ( output == NULL ) return 2; + +#if IMPLEMENT_MidiMonitor outActivity = true; +#endif // IMPLEMENT_MidiMonitor + output->sendMessageNow(message); return 0; } diff --git a/Source/SysexComm.h b/Source/SysexComm.h index 871266b3..0f1c7d77 100644 --- a/Source/SysexComm.h +++ b/Source/SysexComm.h @@ -23,6 +23,13 @@ #include "../JuceLibraryCode/JuceHeader.h" +// If the macro ''IMPLEMENT_MidiMonitor'' is defined as any NONZREO value, +// then the class ''MidiMonitor'' and its related variables +// and invocations occurring in other classes are implemented. +// Use 0 to exclude the related source snippets (RECOMMENDED!). +// WARNING: this class and related variables and invocations are very likely candidates for deprecation / obsolescence. +#define IMPLEMENT_MidiMonitor 0 + class SysexComm { std::unique_ptr input; std::unique_ptr output; @@ -35,8 +42,10 @@ class SysexComm { MidiBuffer noteOutput; public : MidiInputCallback *listener; +#if IMPLEMENT_MidiMonitor bool inActivity; bool outActivity; +#endif //IMPLEMENT_MidiMonitor SysexComm();