diff --git a/Source/DXLookNFeel.cpp b/Source/DXLookNFeel.cpp index 6e8341f..b162c57 100644 --- a/Source/DXLookNFeel.cpp +++ b/Source/DXLookNFeel.cpp @@ -21,5 +21,4 @@ #include "DXLookNFeel.h" DXLookNFeel::DXLookNFeel() { - } \ No newline at end of file diff --git a/Source/DXLookNFeel.h b/Source/DXLookNFeel.h index 6b39843..25abacd 100644 --- a/Source/DXLookNFeel.h +++ b/Source/DXLookNFeel.h @@ -24,7 +24,8 @@ #include "../JuceLibraryCode/JuceHeader.h" -class DXLookNFeel : LookAndFeel_V3 { +class DXLookNFeel : public LookAndFeel_V3 { +public: DXLookNFeel(); }; diff --git a/Source/GlobalEditor.cpp b/Source/GlobalEditor.cpp index 09f1440..d4c190e 100644 --- a/Source/GlobalEditor.cpp +++ b/Source/GlobalEditor.cpp @@ -66,6 +66,12 @@ GlobalEditor::GlobalEditor () lfoPitchDepth->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); lfoPitchDepth->addListener (this); + addAndMakeVisible (lfoDelay = new Slider ("lfoDelay")); + lfoDelay->setRange (0, 99, 1); + lfoDelay->setSliderStyle (Slider::LinearVertical); + lfoDelay->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); + lfoDelay->addListener (this); + //[UserPreSize] //[/UserPreSize] @@ -87,6 +93,7 @@ GlobalEditor::~GlobalEditor() lfoSpeed = nullptr; lfoAmDepth = nullptr; lfoPitchDepth = nullptr; + lfoDelay = nullptr; //[Destructor]. You can add your own custom destruction code here.. @@ -110,6 +117,7 @@ void GlobalEditor::resized() lfoSpeed->setBounds (80, 8, 23, 56); lfoAmDepth->setBounds (208, 8, 32, 24); lfoPitchDepth->setBounds (176, 8, 32, 24); + lfoDelay->setBounds (104, 8, 23, 56); //[UserResized] Add your own custom resize handling here.. //[/UserResized] } @@ -139,6 +147,11 @@ void GlobalEditor::sliderValueChanged (Slider* sliderThatWasMoved) //[UserSliderCode_lfoPitchDepth] -- add your slider handling code here.. //[/UserSliderCode_lfoPitchDepth] } + else if (sliderThatWasMoved == lfoDelay) + { + //[UserSliderCode_lfoDelay] -- add your slider handling code here.. + //[/UserSliderCode_lfoDelay] + } //[UsersliderValueChanged_Post] //[/UsersliderValueChanged_Post] @@ -166,6 +179,7 @@ void GlobalEditor::comboBoxChanged (ComboBox* comboBoxThatHasChanged) void GlobalEditor::bind(DexedAudioProcessor *parent) { parent->algo->bind(algo); parent->lfoRate->bind(lfoSpeed); + parent->lfoDelay->bind(lfoDelay); parent->lfoWaveform->bind(lfoType); parent->lfoAmpDepth->bind(lfoAmDepth); parent->lfoPitchDepth->bind(lfoPitchDepth); @@ -208,6 +222,10 @@ BEGIN_JUCER_METADATA virtualName="" explicitFocusOrder="0" pos="176 8 32 24" min="0" max="99" int="1" style="Rotary" textBoxPos="NoTextBox" textBoxEditable="1" textBoxWidth="80" textBoxHeight="20" skewFactor="1"/> + END_JUCER_METADATA diff --git a/Source/GlobalEditor.h b/Source/GlobalEditor.h index ddd106a..855c4ef 100644 --- a/Source/GlobalEditor.h +++ b/Source/GlobalEditor.h @@ -67,6 +67,7 @@ private: ScopedPointer lfoSpeed; ScopedPointer lfoAmDepth; ScopedPointer lfoPitchDepth; + ScopedPointer lfoDelay; //============================================================================== diff --git a/Source/OperatorEditor.cpp b/Source/OperatorEditor.cpp index 0ca151b..095a781 100644 --- a/Source/OperatorEditor.cpp +++ b/Source/OperatorEditor.cpp @@ -30,7 +30,7 @@ OperatorEditor::OperatorEditor () { addAndMakeVisible (s_egl1 = new Slider ("egl1")); - s_egl1->setRange (0, 10, 0); + s_egl1->setRange (0, 99, 0); s_egl1->setSliderStyle (Slider::Rotary); s_egl1->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); s_egl1->addListener (this); @@ -40,43 +40,43 @@ OperatorEditor::OperatorEditor () toggleButton->addListener (this); addAndMakeVisible (s_egl2 = new Slider ("egl2")); - s_egl2->setRange (0, 10, 0); + s_egl2->setRange (0, 99, 0); s_egl2->setSliderStyle (Slider::Rotary); s_egl2->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); s_egl2->addListener (this); addAndMakeVisible (s_egl3 = new Slider ("egl3")); - s_egl3->setRange (0, 10, 0); + s_egl3->setRange (0, 99, 0); s_egl3->setSliderStyle (Slider::Rotary); s_egl3->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); s_egl3->addListener (this); addAndMakeVisible (s_egl4 = new Slider ("egl4")); - s_egl4->setRange (0, 10, 0); + s_egl4->setRange (0, 99, 0); s_egl4->setSliderStyle (Slider::Rotary); s_egl4->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); s_egl4->addListener (this); addAndMakeVisible (s_egv1 = new Slider ("egr1")); - s_egv1->setRange (0, 10, 0); + s_egv1->setRange (0, 99, 0); s_egv1->setSliderStyle (Slider::Rotary); s_egv1->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); s_egv1->addListener (this); addAndMakeVisible (s_egv2 = new Slider ("egr3")); - s_egv2->setRange (0, 10, 0); + s_egv2->setRange (0, 99, 0); s_egv2->setSliderStyle (Slider::Rotary); s_egv2->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); s_egv2->addListener (this); addAndMakeVisible (s_egv3 = new Slider ("egr3")); - s_egv3->setRange (0, 10, 0); + s_egv3->setRange (0, 99, 0); s_egv3->setSliderStyle (Slider::Rotary); s_egv3->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); s_egv3->addListener (this); addAndMakeVisible (s_egv4 = new Slider ("egr4")); - s_egv4->setRange (0, 10, 0); + s_egv4->setRange (0, 99, 0); s_egv4->setSliderStyle (Slider::Rotary); s_egv4->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); s_egv4->addListener (this); @@ -99,19 +99,19 @@ OperatorEditor::OperatorEditor () opId->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (opLevel = new Slider ("opLevel")); - opLevel->setRange (0, 10, 0); + opLevel->setRange (0, 99, 0); opLevel->setSliderStyle (Slider::Rotary); opLevel->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); opLevel->addListener (this); addAndMakeVisible (opFine = new Slider ("opFine")); - opFine->setRange (0, 10, 0); + opFine->setRange (0, 99, 0); opFine->setSliderStyle (Slider::Rotary); opFine->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); opFine->addListener (this); addAndMakeVisible (opCoarse = new Slider ("opCoarse")); - opCoarse->setRange (0, 10, 0); + opCoarse->setRange (0, 32, 0); opCoarse->setSliderStyle (Slider::Rotary); opCoarse->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); opCoarse->addListener (this); @@ -345,38 +345,38 @@ BEGIN_JUCER_METADATA fixedSize="1" initialWidth="250" initialHeight="70"> keyboardState, MidiKeyboardComponent::horizontalKeyboard) { + LookAndFeel::setDefaultLookAndFeel(&dx_lnf); // This is where our plugin's editor size is set. - setSize (800, 400); + setSize (765, 380); processor = ownerFilter; @@ -55,37 +56,40 @@ DexedAudioProcessorEditor::DexedAudioProcessorEditor (DexedAudioProcessor* owner // OPERATORS addAndMakeVisible(&(ops[0])); - ops[0].setBounds(20, 40, 250, 80); + ops[0].setBounds(5, 40, 250, 80); ops[0].bind(processor, 0); addAndMakeVisible(&(ops[1])); - ops[1].setBounds(270, 40, 250, 80); + ops[1].setBounds(255, 40, 250, 80); ops[1].bind(processor, 1); addAndMakeVisible(&(ops[2])); - ops[2].setBounds(520, 40, 250, 80); + ops[2].setBounds(505, 40, 250, 80); ops[2].bind(processor, 2); addAndMakeVisible(&(ops[3])); - ops[3].setBounds(20, 120, 250, 80); + ops[3].setBounds(5, 120, 250, 80); ops[3].bind(processor, 3); addAndMakeVisible(&(ops[4])); - ops[4].setBounds(270, 120, 250, 80); + ops[4].setBounds(255, 120, 250, 80); ops[4].bind(processor, 4); addAndMakeVisible(&(ops[5])); - ops[5].setBounds(520, 120, 250, 80); + ops[5].setBounds(505, 120, 250, 80); ops[5].bind(processor, 5); // add the midi keyboard component.. addAndMakeVisible (&midiKeyboard); + // The DX7 is a badass on the bass, keep it that way + midiKeyboard.setLowestVisibleKey(24); + const int keyboardHeight = 90; midiKeyboard.setBounds (4, getHeight() - keyboardHeight - 4, getWidth() - 8, keyboardHeight); addAndMakeVisible(&global); - global.setBounds(520,200,250,80); + global.setBounds(505,200,250,80); global.bind(processor); startTimer(100); @@ -120,10 +124,9 @@ void DexedAudioProcessorEditor::buttonClicked(Button *buttonThatWasClicked) { ifstream fp_in; fp_in.open(f.toRawUTF8(), ifstream::in); if (fp_in.fail()) { - AlertWindow::showMessageBoxAsync (AlertWindow::InfoIcon, + AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon, "Error", "Unable to open: " + f); - std::cerr << "error opening file" << std::endl; return; } fp_in.read((char *)syx_data, 4104); diff --git a/Source/PluginEditor.h b/Source/PluginEditor.h index 8600d25..1c3b41c 100755 --- a/Source/PluginEditor.h +++ b/Source/PluginEditor.h @@ -25,6 +25,7 @@ #include "PluginProcessor.h" #include "OperatorEditor.h" #include "GlobalEditor.h" +#include "DXLookNFeel.h" //============================================================================== /** @@ -40,6 +41,8 @@ class DexedAudioProcessorEditor : public AudioProcessorEditor, MidiKeyboardComponent midiKeyboard; + DXLookNFeel dx_lnf; + public: DexedAudioProcessorEditor (DexedAudioProcessor* ownerFilter); diff --git a/Source/PluginParam.cpp b/Source/PluginParam.cpp index 1c9269f..030876d 100755 --- a/Source/PluginParam.cpp +++ b/Source/PluginParam.cpp @@ -92,12 +92,14 @@ float CtrlInt::getValuePlugin() { } void CtrlInt::setValuePlugin(float f) { - if ( f >= 1 ) - f -= 0.00000001; setValue((f * steps)); } void CtrlInt::setValue(int v) { + if ( v >= steps ) { + TRACE("WARNING: value too big %s : %d", label.toRawUTF8(), v); + v = steps-1; + } value = v; if ( dxOffset >= 0 ) { if ( parent != NULL ) @@ -212,12 +214,12 @@ void DexedAudioProcessor::initCtrl() { lfoDelay = new CtrlInt("LFO-Delay", 100, 138); ctrl.add(lfoDelay); - lfoAmpDepth = new CtrlInt("LFO-AmpDepth", 100, 139); - ctrl.add(lfoAmpDepth); - - lfoPitchDepth = new CtrlInt("LFO-PitchDepth", 100, 140); + lfoPitchDepth = new CtrlInt("LFO-PitchDepth", 100, 139); ctrl.add(lfoPitchDepth); + lfoAmpDepth = new CtrlInt("LFO-AmpDepth", 100, 140); + ctrl.add(lfoAmpDepth); + lfoSync = new CtrlInt("LFO-Sync", 2, 141); ctrl.add(lfoSync); @@ -236,8 +238,16 @@ int DexedAudioProcessor::importSysex(const char *imported) { memcpy(patchNames[i], sysex + ((i*128)+118), 11); for(int j=0;j<10;j++) { - if ( patchNames[i][j] > 127 || patchNames[i][j] < 32 ) - patchNames[i][j] = ' '; + char c = (unsigned char)patchNames[i][j]; + switch (c) { + case 92: c = 'Y'; break; /* yen */ + case 126: c = '>'; break; /* >> */ + case 127: c = '<'; break; /* << */ + default: + if (c < 32 || c > 127) c = 32; + break; + } + patchNames[i][j] = c; } patchNames[i][11] = 0; } @@ -281,8 +291,6 @@ void DexedAudioProcessor::unpackSysex(int idx) { data[158] = 1; data[159] = 1; data[160] = 1; - - TRACE("The LFO is at %d", data[142]); } @@ -381,7 +389,6 @@ void DexedAudioProcessor::getStateInformation (MemoryBlock& destData) { // as intermediaries to make it easy to save and load complex data.*/ TRACE("getting state with %d", currentProgram); - destData.insert(data, 161, 0); } diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index 4389f44..5cf7759 100755 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -30,10 +30,10 @@ //============================================================================== DexedAudioProcessor::DexedAudioProcessor() { - Logger *tmp = Logger::getCurrentLogger(); + /*Logger *tmp = Logger::getCurrentLogger(); if ( tmp == NULL ) { Logger::setCurrentLogger(FileLogger::createDateStampedLogger("Dexed", "DebugSession-", "log", "DexedAudioProcessor Created")); - } + }*/ TRACE("Hi"); currentNote = -1; diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index d3fe99c..bda8b8f 100755 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -94,7 +94,12 @@ public : void unbindUI(); void updateUI(); - + + void processMidiMessage(const uint8_t *buf, int buf_size); + void keydown(uint8_t pitch, uint8_t velo); + void keyup(uint8_t pitch); + void processSamples(int n_samples, int16_t *buffer); + public: //============================================================================== DexedAudioProcessor(); @@ -158,10 +163,6 @@ private: //============================================================================== JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DexedAudioProcessor) - void processMidiMessage(const uint8_t *buf, int buf_size); - void keydown(uint8_t pitch, uint8_t velo); - void keyup(uint8_t pitch); - void processSamples(int n_samples, int16_t *buffer); }; #define TRACE(fmt, ...) DexedAudioProcessor::log(__PRETTY_FUNCTION__,fmt,##__VA_ARGS__)