diff --git a/src/Dexed.ttl b/src/Dexed.ttl index bcad5c8..a1379d8 100644 --- a/src/Dexed.ttl +++ b/src/Dexed.ttl @@ -1866,6 +1866,15 @@ lv2:minimum 0 ; lv2:maximum 12 ; lv2:portProperty lv2:integer ; + ] , + [ + a lv2:InputPort, lv2:ControlPort ; + lv2:index 156 ; + lv2:symbol "master_tune" ; + lv2:name "MASTER TUNE" ; + lv2:default 0 ; + lv2:minimum -100.0 ; + lv2:maximum 100.0 ; ] ; doap:name "Dexed" ; diff --git a/src/dexed.cpp b/src/dexed.cpp index 950ad04..0fcac91 100644 --- a/src/dexed.cpp +++ b/src/dexed.cpp @@ -324,6 +324,7 @@ void Dexed::set_params(void) onParam(157,*p(p_pitch_bend_step)); onParam(158,*p(p_mod_wheel_range)); onParam(159,*p(p_mod_wheel_step)); + onParam(160,*p(p_master_tune)); if(_param_change_counter>PARAM_CHANGE_LEVEL) panic(); @@ -679,6 +680,12 @@ void Dexed::onParam(uint8_t param_num,float param_val) _param_change_counter++; + if(param_num==160) + { + controllers.masterTune=param_val; + return; + } + if(param_num==144 || param_num==134) panic(); diff --git a/src/dexed.h b/src/dexed.h index 9c8702f..fb97097 100644 --- a/src/dexed.h +++ b/src/dexed.h @@ -121,9 +121,9 @@ class Dexed : public lvtk::Synth double _rate; uint8_t _param_counter; uint8_t _param_change_counter; - float data_float[160]; + float data_float[161]; //uint8_t data[160]; - uint8_t data[160]={ + uint8_t data[161]={ 95, 29, 20, 50, 99, 95, 00, 00, 41, 00, 19, 00, 00, 03, 00, 06, 79, 00, 01, 00, 14, 95, 20, 20, 50, 99, 95, 00, 00, 00, 00, 00, 00, 00, 03, 00, 00, 99, 00, 01, 00, 00, 95, 29, 20, 50, 99, 95, 00, 00, 00, 00, 00, 00, 00, 03, 00, 06, 89, 00, 01, 00, 07, @@ -136,7 +136,7 @@ class Dexed : public lvtk::Synth 03, 24, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 63, - 12, 12, 12, 12}; + 12, 12, 12, 12, 00}; }; #endif // PLUGINPROCESSOR_H_INCLUDED diff --git a/src/trash/AlgoDisplay.cpp b/src/trash/AlgoDisplay.cpp deleted file mode 100644 index dc2c807..0000000 --- a/src/trash/AlgoDisplay.cpp +++ /dev/null @@ -1,379 +0,0 @@ -/** - * - * Copyright (c) 2014, 2015 Pascal Gauthier. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#include "AlgoDisplay.h" -#include "DXLookNFeel.h" -#include "Dexed.h" - -AlgoDisplay::AlgoDisplay() { - static char tmpAlgo = 0; - algo = &tmpAlgo; -} - -inline void displayOp(Graphics &g, char id, int x, int y, char link, char fb) { - const int LINE_SZ = 3; - String t(id); - - x *= 25; - x += 3; - y *= 21; - y += 5; - - g.setColour(Colours::white); - g.drawText(t, x, y, 16, 12, Justification::centred, true); - - g.setColour(DXLookNFeel::fillColour); - switch(link) { - case 0 : // LINE DOWN - g.drawLine(x+8, y+12, x+8, y+21, LINE_SZ); - break; - case 1: // ARROW TO RIGHT - g.drawLine(x+8, y+12, x+8, y+18, LINE_SZ); - g.drawLine(x+7, y+18, x+34, y+18, LINE_SZ); - break; - case 2: // ARROW TO RIGHT JOIN - g.drawLine(x+8, y+12, x+8, y+19, LINE_SZ); - break; - case 3: // ARROW TO RIGHT AND DOWN - g.drawLine(x+8, y+12, x+8, y+21, LINE_SZ); - g.drawLine(x+7, y+18, x+34, y+18, LINE_SZ); - g.drawLine(x+34, y+17, x+34, y+21, LINE_SZ); - break; - case 4: // ARROW TO RIGHT+LEFT AND DOWN - g.drawLine(x+8, y+12, x+8, y+21, LINE_SZ); - g.drawLine(x+7, y+18, x+34, y+18, LINE_SZ); - g.drawLine(x+34, y+17, x+34, y+21, LINE_SZ); - g.drawLine(x-17, y+18, x+8, y+18, LINE_SZ); - g.drawLine(x-17, y+17, x-17, y+21, LINE_SZ); - break; - case 6: - g.drawLine(x+8, y+12, x+8, y+18, LINE_SZ); - g.drawLine(x+7, y+18, x+58, y+18, LINE_SZ); - break; - case 7: // ARROW TO LEFT - g.drawLine(x+8, y+12, x+8, y+19, LINE_SZ); - g.drawLine(x-17, y+18, x+9, y+18, LINE_SZ); - break; - } - - switch(fb) { - case 0: - break; - case 1: - g.drawLine(x+7, y, x+8, y-5, LINE_SZ); - g.drawLine(x+8, y-4, x+21, y-4, LINE_SZ); - g.drawLine(x+20, y-4, x+20, y+15, LINE_SZ); - g.drawLine(x+19, y+15, x+20, y+16, LINE_SZ); - g.drawLine(x+8, y+15, x+20, y+15, LINE_SZ); - break; - case 2: // ALGO 4 - g.drawLine(x+7, y, x+8, y-5, LINE_SZ); - g.drawLine(x+8, y-4, x+20, y-4, LINE_SZ); - g.drawLine(x+19, y-4, x+19, y+59, LINE_SZ); - g.drawLine(x+8, y+58, x+19, y+58, LINE_SZ); - break; - case 3: // ALGO 6 - g.drawLine(x+7, y, x+8, y-5, LINE_SZ); - g.drawLine(x+8, y-4, x+20, y-4, LINE_SZ); - g.drawLine(x+19, y-4, x+19, y+37, LINE_SZ); - g.drawLine(x+8, y+36, x+19, y+36, LINE_SZ); - break; - case 4: - g.drawLine(x+7, y, x+8, y-5, LINE_SZ); - g.drawLine(x+8, y-4, x-4, y-4, LINE_SZ); - g.drawLine(x-3, y-4, x-3, y+15, LINE_SZ); - g.drawLine(x-3, y+15, x+8, y+15, LINE_SZ); - g.drawLine(x+8, y+15, x+8, y+12, LINE_SZ); - break; - } - -} - -void AlgoDisplay::paint(Graphics &g) { - - g.setColour(DXLookNFeel::fillColour); - g.fillRect(1, 3, 20, 15); - String n = String(*algo +1); - - g.setColour(Colours::white); - g.drawText(n, 1, 3, 20, 15, Justification::centred, true); - - switch(*algo) { - case 0: - displayOp(g, 6, 3, 0, 0, 1); - displayOp(g, 5, 3, 1, 0, 0); - displayOp(g, 4, 3, 2, 0, 0); - displayOp(g, 3, 3, 3, 2, 0); - displayOp(g, 2, 2, 2, 0, 0); - displayOp(g, 1, 2, 3, 1, 0); - break; - case 1: - displayOp(g, 6, 3, 0, 0, 0); - displayOp(g, 5, 3, 1, 0, 0); - displayOp(g, 4, 3, 2, 0, 0); - displayOp(g, 3, 3, 3, 2, 0); - displayOp(g, 2, 2, 2, 0, 1); - displayOp(g, 1, 2, 3, 1, 0); - break; - case 2: - displayOp(g, 6, 3, 1, 0, 1); - displayOp(g, 5, 3, 2, 0, 0); - displayOp(g, 4, 3, 3, 2, 0); - displayOp(g, 3, 2, 1, 0, 0); - displayOp(g, 2, 2, 2, 0, 0); - displayOp(g, 1, 2, 3, 1, 0); - break; - case 3: // - displayOp(g, 6, 3, 1, 0, 2); - displayOp(g, 5, 3, 2, 0, 0); - displayOp(g, 4, 3, 3, 2, 0); - displayOp(g, 3, 2, 1, 0, 0); - displayOp(g, 2, 2, 2, 0, 0); - displayOp(g, 1, 2, 3, 1, 0); - break; - case 4: - displayOp(g, 6, 4, 2, 0, 1); - displayOp(g, 5, 4, 3, 2, 0); - displayOp(g, 4, 3, 2, 0, 0); - displayOp(g, 3, 3, 3, 1, 0); - displayOp(g, 2, 2, 2, 0, 0); - displayOp(g, 1, 2, 3, 1, 0); - break; - case 5: // - displayOp(g, 6, 4, 2, 0, 3); - displayOp(g, 5, 4, 3, 2, 0); - displayOp(g, 4, 3, 2, 0, 0); - displayOp(g, 3, 3, 3, 1, 0); - displayOp(g, 2, 2, 2, 0, 0); - displayOp(g, 1, 2, 3, 1, 0); - break; - case 6: - displayOp(g, 6, 4, 1, 0, 1); - displayOp(g, 5, 4, 2, 7, 0); - displayOp(g, 4, 3, 2, 0, 0); - displayOp(g, 3, 3, 3, 2, 0); - displayOp(g, 2, 2, 2, 0, 0); - displayOp(g, 1, 2, 3, 1, 0); - break; - case 7: - displayOp(g, 6, 4, 1, 0, 0); - displayOp(g, 5, 4, 2, 7, 0); - displayOp(g, 4, 3, 2, 0, 4); - displayOp(g, 3, 3, 3, 2, 0); - displayOp(g, 2, 2, 2, 0, 0); - displayOp(g, 1, 2, 3, 1, 0); - break; - case 8: - displayOp(g, 6, 4, 1, 0, 0); - displayOp(g, 5, 4, 2, 7, 0); - displayOp(g, 4, 3, 2, 0, 0); - displayOp(g, 3, 3, 3, 2, 0); - displayOp(g, 2, 2, 2, 0, 1); - displayOp(g, 1, 2, 3, 1, 0); - break; - case 9: - displayOp(g, 6, 2, 2, 0, 0); - displayOp(g, 5, 1, 2, 1, 0); - displayOp(g, 4, 2, 3, 1, 0); - displayOp(g, 3, 3, 1, 0, 1); - displayOp(g, 2, 3, 2, 0, 0); - displayOp(g, 1, 3, 3, 2, 0); - break; - case 10: - displayOp(g, 6, 2, 2, 0, 1); - displayOp(g, 5, 1, 2, 1, 0); - displayOp(g, 4, 2, 3, 1, 0); - displayOp(g, 3, 3, 1, 0, 0); - displayOp(g, 2, 3, 2, 0, 0); - displayOp(g, 1, 3, 3, 2, 0); - break; - case 11: - displayOp(g, 6, 3, 2, 7, 0); - displayOp(g, 5, 2, 2, 0, 0); - displayOp(g, 4, 1, 2, 1, 0); - displayOp(g, 3, 2, 3, 6, 0); - displayOp(g, 2, 4, 2, 0, 1); - displayOp(g, 1, 4, 3, 2, 0); - break; - case 12: - displayOp(g, 6, 3, 2, 7, 1); - displayOp(g, 5, 2, 2, 0, 0); - displayOp(g, 4, 1, 2, 1, 0); - displayOp(g, 3, 2, 3, 6, 0); - displayOp(g, 2, 4, 2, 0, 0); - displayOp(g, 1, 4, 3, 2, 0); - break; - case 13: - displayOp(g, 6, 3, 1, 0, 1); - displayOp(g, 5, 2, 1, 1, 0); - displayOp(g, 4, 3, 2, 0, 0); - displayOp(g, 3, 3, 3, 2, 0); - displayOp(g, 2, 2, 2, 0, 0); - displayOp(g, 1, 2, 3, 1, 0); - break; - case 14: - displayOp(g, 6, 3, 1, 0, 0); - displayOp(g, 5, 2, 1, 1, 0); - displayOp(g, 4, 3, 2, 0, 0); - displayOp(g, 3, 3, 3, 2, 0); - displayOp(g, 2, 2, 2, 0, 4); - displayOp(g, 1, 2, 3, 1, 0); - break; - case 15: - displayOp(g, 6, 4, 1, 0, 1); - displayOp(g, 5, 4, 2, 7, 0); - displayOp(g, 4, 3, 1, 0, 0); - displayOp(g, 3, 3, 2, 0, 0); - displayOp(g, 2, 2, 2, 1, 0); - displayOp(g, 1, 3, 3, 0, 0); - break; - case 16: - displayOp(g, 6, 4, 1, 0, 0); - displayOp(g, 5, 4, 2, 7, 0); - displayOp(g, 4, 3, 1, 0, 0); - displayOp(g, 3, 3, 2, 0, 0); - displayOp(g, 2, 2, 2, 1, 4); - displayOp(g, 1, 3, 3, 0, 0); - break; - case 17: - displayOp(g, 6, 4, 0, 0, 0); - displayOp(g, 5, 4, 1, 0, 0); - displayOp(g, 4, 4, 2, 7, 0); - displayOp(g, 3, 3, 2, 0, 4); - displayOp(g, 2, 2, 2, 1, 0); - displayOp(g, 1, 3, 3, 0, 0); - break; - case 18: - displayOp(g, 6, 3, 2, 3, 1); - displayOp(g, 5, 4, 3, 2, 0); - displayOp(g, 4, 3, 3, 1, 0); - displayOp(g, 3, 2, 1, 0, 0); - displayOp(g, 2, 2, 2, 0, 0); - displayOp(g, 1, 2, 3, 1, 0); - break; - case 19: - displayOp(g, 6, 4, 2, 0, 0); - displayOp(g, 5, 3, 2, 1, 0); - displayOp(g, 4, 4, 3, 2, 0); - displayOp(g, 3, 1, 2, 3, 1); - displayOp(g, 2, 2, 3, 6, 0); - displayOp(g, 1, 1, 3, 1, 0); - break; - case 20: - displayOp(g, 6, 3, 2, 3, 0); - displayOp(g, 5, 4, 3, 2, 0); - displayOp(g, 4, 3, 3, 1, 0); - displayOp(g, 3, 1, 2, 3, 1); - displayOp(g, 2, 2, 3, 1, 0); - displayOp(g, 1, 1, 3, 1, 0); - break; - case 21: - displayOp(g, 6, 3, 2, 4, 1); - displayOp(g, 5, 4, 3, 2, 0); - displayOp(g, 4, 3, 3, 1, 0); - displayOp(g, 3, 2, 3, 1, 0); - displayOp(g, 2, 1, 2, 0, 0); - displayOp(g, 1, 1, 3, 1, 0); - break; - case 22: // CC - displayOp(g, 6, 3, 2, 3, 1); - displayOp(g, 5, 4, 3, 2, 0); - displayOp(g, 4, 3, 3, 1, 0); - displayOp(g, 3, 2, 2, 0, 0); - displayOp(g, 2, 2, 3, 1, 0); - displayOp(g, 1, 1, 3, 1, 0); - break; - case 23: // CC - displayOp(g, 6, 3, 2, 4, 1); - displayOp(g, 5, 4, 3, 2, 0); - displayOp(g, 4, 3, 3, 1, 0); - displayOp(g, 3, 2, 3, 1, 0); - displayOp(g, 2, 1, 3, 1, 0); - displayOp(g, 1, 0, 3, 1, 0); - break; - case 24: // CC - displayOp(g, 6, 3, 2, 3, 1); - displayOp(g, 5, 4, 3, 2, 0); - displayOp(g, 4, 3, 3, 1, 0); - displayOp(g, 3, 2, 3, 1, 0); - displayOp(g, 2, 1, 3, 1, 0); - displayOp(g, 1, 0, 3, 1, 0); - break; - case 25: - displayOp(g, 6, 4, 2, 0, 1); - displayOp(g, 5, 3, 2, 1, 0); - displayOp(g, 4, 4, 3, 2, 0); - displayOp(g, 3, 2, 2, 0, 0); - displayOp(g, 2, 2, 3, 6, 0); - displayOp(g, 1, 1, 3, 1, 0); - break; - case 26: - displayOp(g, 6, 4, 2, 0, 0); - displayOp(g, 5, 3, 2, 1, 0); - displayOp(g, 4, 4, 3, 2, 0); - displayOp(g, 3, 2, 2, 0, 1); - displayOp(g, 2, 2, 3, 6, 0); - displayOp(g, 1, 1, 3, 1, 0); - break; - case 27: - displayOp(g, 6, 4, 3, 2, 0); - displayOp(g, 5, 3, 1, 0, 1); - displayOp(g, 4, 3, 2, 0, 0); - displayOp(g, 3, 3, 3, 1, 0); - displayOp(g, 2, 2, 2, 0, 0); - displayOp(g, 1, 2, 3, 1, 0); - break; - case 28: - displayOp(g, 6, 4, 2, 0, 1); - displayOp(g, 5, 4, 3, 2, 0); - displayOp(g, 4, 3, 2, 0, 0); - displayOp(g, 3, 3, 3, 1, 0); - displayOp(g, 2, 2, 3, 1, 0); - displayOp(g, 1, 1, 3, 1, 0); - break; - case 29: - displayOp(g, 6, 4, 3, 2, 0); - displayOp(g, 5, 3, 1, 0, 1); - displayOp(g, 4, 3, 2, 0, 0); - displayOp(g, 3, 3, 3, 1, 0); - displayOp(g, 2, 2, 3, 1, 0); - displayOp(g, 1, 1, 3, 1, 0); - break; - case 30: - displayOp(g, 6, 4, 2, 0, 1); - displayOp(g, 5, 4, 3, 2, 0); - displayOp(g, 4, 3, 3, 1, 0); - displayOp(g, 3, 2, 3, 1, 0); - displayOp(g, 2, 1, 3, 1, 0); - displayOp(g, 1, 0, 3, 1, 0); - break; - case 31: - displayOp(g, 6, 5, 3, 2, 1); - displayOp(g, 5, 4, 3, 1, 0); - displayOp(g, 4, 3, 3, 1, 0); - displayOp(g, 3, 2, 3, 1, 0); - displayOp(g, 2, 1, 3, 1, 0); - displayOp(g, 1, 0, 3, 1, 0); - break; - default: - break; - } -} - diff --git a/src/trash/AlgoDisplay.h b/src/trash/AlgoDisplay.h deleted file mode 100644 index d1a4f54..0000000 --- a/src/trash/AlgoDisplay.h +++ /dev/null @@ -1,33 +0,0 @@ -/** - * - * Copyright (c) 2014 Pascal Gauthier. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#ifndef ALGODISPLAY_H_INCLUDED -#define ALGODISPLAY_H_INCLUDED - -#include "../JuceLibraryCode/JuceHeader.h" - -class AlgoDisplay : public Component { -public: - AlgoDisplay(); - char *algo; - void paint(Graphics &g); -}; - -#endif // ALGODISPLAY_H_INCLUDED diff --git a/src/trash/CartManager.cpp b/src/trash/CartManager.cpp deleted file mode 100644 index 0d35e2c..0000000 --- a/src/trash/CartManager.cpp +++ /dev/null @@ -1,359 +0,0 @@ -/** - * - * Copyright (c) 2015 Pascal Gauthier. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#include "PluginProcessor.h" -#include "PluginEditor.h" -#include "CartManager.h" -#include "DXLookNFeel.h" -#include "PluginData.h" - -#include -using namespace ::std; - -class SyxFileFilter : public FileFilter { -public: - SyxFileFilter() : FileFilter(".syx") {} - bool isFileSuitable(const File &file) const { - return file.getFileExtension().toLowerCase() == ".syx" && file.getSize() >= 4104; - } - bool isDirectorySuitable(const File &file) const { - return true; - }; -}; - -class FileTreeDrop : public FileTreeComponent { -public : - FileTreeDrop(DirectoryContentsList &listToShow) : FileTreeComponent(listToShow) {} - - bool isInterestedInFileDrag (const StringArray &files) override { - bool found = false; - - for(int i=0; isetBounds(28, 441, 800, 96); - activeCart->addListener(this); - - addAndMakeVisible(browserCart = new ProgramListBox("browserpgm", 2)); - browserCart->setBounds(635, 18, 200, 384); - browserCart->addListener(this); - - // ------------------------- - syxFileFilter = new SyxFileFilter(); - timeSliceThread = new TimeSliceThread("Cartridge Directory Scanner"); - timeSliceThread->startThread(); - cartBrowserList = new DirectoryContentsList(syxFileFilter, *timeSliceThread); - cartBrowserList->setDirectory(cartDir, true, true); - cartBrowser = new FileTreeDrop(*cartBrowserList); - cartBrowser->addKeyListener(this); - addAndMakeVisible(cartBrowser); - - cartBrowser->setBounds(23, 18, 590, 384); - cartBrowser->setDragAndDropDescription("Sysex Browser"); - cartBrowser->addListener(this); - - addAndMakeVisible(closeButton = new TextButton("CLOSE")); - closeButton->setBounds(4, 545, 50, 30); - closeButton->addListener(this); - - addAndMakeVisible(loadButton = new TextButton("LOAD")); - loadButton->setBounds(52, 545, 50, 30); - loadButton->addListener(this); - - addAndMakeVisible(saveButton = new TextButton("SAVE")); - saveButton->setBounds(100, 545, 50, 30); - saveButton->addListener(this); - - addAndMakeVisible(fileMgrButton = new TextButton("SHOW DIR")); - fileMgrButton->setBounds(148, 545, 70, 30); - fileMgrButton->addListener(this); -/* - * - * I've removed this since it only works on the DX7 II. TBC. - * - - addAndMakeVisible(getDXPgmButton = new TextButton("GET DX7 PGM")); - getDXPgmButton->setBounds(656, 545, 100, 30); - getDXPgmButton->addListener(this); - - addAndMakeVisible(getDXCartButton = new TextButton("GET DX7 CART")); - getDXCartButton->setBounds(755, 545, 100, 30); - getDXCartButton->addListener(this); -*/ -} - -CartManager::~CartManager() { - timeSliceThread->stopThread(500); - delete cartBrowser; - delete cartBrowserList; - delete timeSliceThread; -} - -void CartManager::paint(Graphics &g) { - g.fillAll(DXLookNFeel::lightBackground); - g.setColour(DXLookNFeel::roundBackground); - g.fillRoundedRectangle(8, 418, 843, 126, 15); - g.setColour(Colours::whitesmoke); - g.drawText("currently loaded cartridge", 38, 410, 150, 40, Justification::left); -} - -void CartManager::programSelected(ProgramListBox *source, int pos) { - if ( source == activeCart ) { - browserCart->setSelected(-1); - mainWindow->processor->setCurrentProgram(pos); - mainWindow->processor->updateHostDisplay(); - } else { - uint8_t unpackPgm[161]; - source->getCurrentCart().unpackProgram(unpackPgm, pos); - activeCart->setSelected(-1); - browserCart->setSelected(pos); - repaint(); - mainWindow->processor->updateProgramFromSysex((uint8_t *) unpackPgm); - mainWindow->processor->updateHostDisplay(); - } -} - -void CartManager::buttonClicked(juce::Button *buttonThatWasClicked) { - if ( buttonThatWasClicked == closeButton ) { - mainWindow->startTimer(100); - setVisible(false); - return; - } - - if ( buttonThatWasClicked == loadButton ) { - FileChooser fc ("Import original DX sysex...", File::nonexistent, "*.syx;*.SYX;*.*", 1); - - if ( fc.browseForFileToOpen()) - mainWindow->loadCart(fc.getResult()); - return; - } - - if ( buttonThatWasClicked == saveButton ) { - mainWindow->saveCart(); - } - - if ( buttonThatWasClicked == fileMgrButton ) { - cartDir.revealToUser(); - return; - } - - // THIS IS NOT USED - if ( buttonThatWasClicked == getDXPgmButton ) { - if ( mainWindow->processor->sysexComm.isInputActive() && mainWindow->processor->sysexComm.isOutputActive() ) { - unsigned char msg[] = { 0xF0, 0x43, 0x20, 0x09, 0xF7 }; - mainWindow->processor->sysexComm.send(MidiMessage(msg, 5)); - } else { - showSysexConfigMsg(); - } - return; - } - - if ( buttonThatWasClicked == getDXCartButton ) { - if ( mainWindow->processor->sysexComm.isInputActive() && mainWindow->processor->sysexComm.isOutputActive() ) { - unsigned char msg[] = { 0xF0, 0x43, 0x20, 0x00, 0xF7 }; - mainWindow->processor->sysexComm.send(MidiMessage(msg, 5)); - } else { - showSysexConfigMsg(); - } - return; - } -} - -void CartManager::fileDoubleClicked(const File& file) { - if ( file.isDirectory() ) - return; - mainWindow->loadCart(file); - activeCart->setCartridge(mainWindow->processor->currentCart); -} - -void CartManager::fileClicked(const File& file, const MouseEvent& e) { - if ( e.mods.isRightButtonDown() ) { - PopupMenu menu; - - menu.addItem(1000, "Open location"); - if ( ! file.isDirectory() ) { - menu.addItem(1010, "Send sysex cartridge to DX7"); - } - menu.addSeparator(); - menu.addItem(1020, "Refresh"); - - switch(menu.show()) { - case 1000: - file.revealToUser(); - break; - case 1010 : - mainWindow->processor->sendSysexCartridge(file); - break; - case 1020: - cartBrowserList->refresh(); - break; - } - return; - } -} - -void CartManager::setActiveProgram(int idx, String activeName) { - if ( activeCart->programNames[idx] == activeName ) { - activeCart->setSelected(idx); - browserCart->setSelected(-1); - } - activeCart->repaint(); -} - -void CartManager::resetActiveSysex() { - activeCart->setCartridge(mainWindow->processor->currentCart); -} - -void CartManager::selectionChanged() { - File file = cartBrowser->getSelectedFile(); - - if ( ! file.exists() ) - return; - - if ( file.isDirectory() ) - return; - - Cartridge browserSysex; - int rc = browserSysex.load(file); - if ( rc < 0 ) { - AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon, "Error", "Unable to open file"); - return; - } - - if ( rc != 0 ) { - browserCart->readOnly = true; - } else { - browserCart->readOnly = false; - } - browserCart->setSelected(-1); - browserCart->setCartridge(browserSysex); -} - -void CartManager::programRightClicked(ProgramListBox *source, int pos) { - PopupMenu menu; - - menu.addItem(1000, "Send program '" + source->programNames[pos] + "' to DX7"); - - if ( source == activeCart ) - menu.addItem(1010, "Send current sysex cartridge to DX7"); - - switch(menu.show()) { - case 1000: - uint8_t unpackPgm[161]; - - if ( source == activeCart ) { - mainWindow->processor->currentCart.unpackProgram(unpackPgm, pos); - } else { - source->getCurrentCart().unpackProgram(unpackPgm, pos); - } - - if ( mainWindow->processor->sysexComm.isOutputActive() ) { - uint8_t msg[163]; - exportSysexPgm(msg, unpackPgm); - mainWindow->processor->sysexComm.send(MidiMessage(msg, 163)); - } - break; - - case 1010: - mainWindow->processor->sendCurrentSysexCartridge(); - break; - } - -} - -void CartManager::programDragged(ProgramListBox *destListBox, int dest, char *packedPgm) { - if ( destListBox == activeCart ) { - char *sysex = mainWindow->processor->currentCart.getRawVoice(); - memcpy(sysex+(dest*128), packedPgm, 128); - mainWindow->updateUI(); - } else { - File file = cartBrowser->getSelectedFile(); - - if ( ! file.exists() ) - return; - - if ( file.isDirectory() ) - return; - if ( file.getSize() != 4104 ) - return; - - Cartridge cart; - cart.load(file); - memcpy(cart.getRawVoice()+(dest*128), packedPgm, 128); - cart.saveVoice(file); - browserCart->setCartridge(cart); - } -} - -void CartManager::initialFocus() { - cartBrowser->grabKeyboardFocus(); -} - -bool CartManager::keyPressed(const KeyPress& key, Component* originatingComponent) { - if ( key.getKeyCode() == 13 ) { - File file = cartBrowser->getSelectedFile(); - if ( file.isDirectory() ) - return true; - mainWindow->loadCart(file); - activeCart->setCartridge(mainWindow->processor->currentCart); - return true; - } - return false; -} - -void CartManager::showSysexConfigMsg() { - AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon, "Warning", "The DX7 midi interface is not configured correctly.\n\n" - "These buttons are used to 'ask' the DX7 to send the current program/cartridge.\n\n" - "In order to use this correctly, you need to connect your midi in and midi out of your DX7 to a midi interface and configure this midi interface with the [PARM] dialog. THIS ONLY WORKS ON A DX7-II"); -} - -// unused stuff from FileBrowserListener -void CartManager::browserRootChanged (const File& newRoot) {} - - diff --git a/src/trash/CartManager.h b/src/trash/CartManager.h deleted file mode 100644 index 7c358fe..0000000 --- a/src/trash/CartManager.h +++ /dev/null @@ -1,77 +0,0 @@ -/** - * - * Copyright (c) 2015 Pascal Gauthier. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#ifndef CARTMANAGER_H_INCLUDED -#define CARTMANAGER_H_INCLUDED - -#include "../JuceLibraryCode/JuceHeader.h" -#include "PluginData.h" -#include "ProgramListBox.h" -#include "PluginData.h" - -class CartManager : public Component, public ButtonListener, public DragAndDropContainer, public FileBrowserListener - , public ProgramListBoxListener, public KeyListener { - ScopedPointer newButton; - ScopedPointer loadButton; - ScopedPointer saveButton; - ScopedPointer closeButton; - ScopedPointer fileMgrButton; - ScopedPointer getDXPgmButton; - ScopedPointer getDXCartButton; - - ScopedPointer activeCart; - ScopedPointer browserCart; - - ScopedPointer syxFileFilter; - - FileTreeComponent *cartBrowser; - TimeSliceThread *timeSliceThread; - DirectoryContentsList *cartBrowserList; - - File cartDir; - - DexedAudioProcessorEditor *mainWindow; - - void showSysexConfigMsg(); - -public: - CartManager(DexedAudioProcessorEditor *editor); - virtual ~CartManager(); - void paint(Graphics& g) override; - void buttonClicked (Button* buttonThatWasClicked) override; - - void selectionChanged() override; - void fileClicked (const File& file, const MouseEvent& e) override; - void fileDoubleClicked (const File& file) override; - void browserRootChanged (const File& newRoot) override; - - void setActiveProgram(int idx, String activeName); - void resetActiveSysex(); - - virtual void programSelected(ProgramListBox *source, int pos) override; - virtual void programRightClicked(ProgramListBox *source, int pos) override; - virtual void programDragged(ProgramListBox *destListBox, int dest, char *packedPgm) override; - virtual bool keyPressed(const KeyPress& key, Component* originatingComponent) override; - - void initialFocus(); -}; - - -#endif // CARTMANAGER_H_INCLUDED diff --git a/src/trash/DXComponents.cpp b/src/trash/DXComponents.cpp deleted file mode 100644 index 7c2218d..0000000 --- a/src/trash/DXComponents.cpp +++ /dev/null @@ -1,442 +0,0 @@ -/** - * - * Copyright (c) 2014 Pascal Gauthier. - * - * DX7 Envelope Tables from legasynth-0.4.1 / DX7 Patch Editor - * Copyright (C) 2002 Juan Linietsky - * Copyright (C) 2006 Mark-André Hopf - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#include "Dexed.h" -#include "DXComponents.h" -#include "DXLookNFeel.h" -#include "PluginProcessor.h" -#include "msfa/pitchenv.h" - -static char TMP_LEVEL_PTR[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - -static float EG_rate_rise_duration[128] = { - 38.00000 ,34.96000 ,31.92000 ,28.88000 ,25.84000 , - 22.80000 ,20.64000 ,18.48000 ,16.32000 ,14.16000 , - 12.00000 ,11.10000 ,10.20000 ,9.30000 ,8.40000 , - 7.50000 ,6.96000 ,6.42000 ,5.88000 ,5.34000 , - 4.80000 ,4.38000 ,3.96000 ,3.54000 ,3.12000 , - 2.70000 ,2.52000 ,2.34000 ,2.16000 ,1.98000 , - 1.80000 ,1.70000 ,1.60000 ,1.50000 ,1.40000 , - 1.30000 ,1.22962 ,1.15925 ,1.08887 ,1.01850 , - 0.94813 ,0.87775 ,0.80737 ,0.73700 ,0.69633 , - 0.65567 ,0.61500 ,0.57833 ,0.54167 ,0.50500 , - 0.47300 ,0.44100 ,0.40900 ,0.37967 ,0.35033 , - 0.32100 ,0.28083 ,0.24067 ,0.20050 ,0.16033 , - 0.12017 ,0.08000 ,0.07583 ,0.07167 ,0.06750 , - 0.06333 ,0.05917 ,0.05500 ,0.04350 ,0.03200 , - 0.02933 ,0.02667 ,0.02400 ,0.02200 ,0.02000 , - 0.01800 ,0.01667 ,0.01533 ,0.01400 ,0.01300 , - 0.01200 ,0.01100 ,0.01000 ,0.00900 ,0.00800 , - 0.00800 ,0.00800 ,0.00800 ,0.00767 ,0.00733 , - 0.00700 ,0.00633 ,0.00567 ,0.00500 ,0.00433 , - 0.00367 ,0.00300 ,0.00300 ,0.00300 ,0.00300 , - 0.00300 ,0.00300 ,0.00300 ,0.00300 ,0.00300 , - 0.00300 ,0.00300 ,0.00300 ,0.00300 ,0.00300 , - 0.00300 ,0.00300 ,0.00300 ,0.00300 ,0.00300 , - 0.00300 ,0.00300 ,0.00300 ,0.00300 ,0.00300 , - 0.00300 ,0.00300 ,0.00300 ,0.00300 ,0.00300 , - 0.00300 ,0.00300 ,0.00300 -}; - -static float EG_rate_decay_duration[128] = { - 318.00000 ,283.75000 ,249.50000 ,215.25000 ,181.00000 , - 167.80000 ,154.60001 ,141.39999 ,128.20000 ,115.00000 , - 104.60000 ,94.20000 ,83.80000 ,73.40000 ,63.00000 , - 58.34000 ,53.68000 ,49.02000 ,44.36000 ,39.70000 , - 35.76000 ,31.82000 ,27.88000 ,23.94000 ,20.00000 , - 18.24000 ,16.48000 ,14.72000 ,12.96000 ,11.20000 , - 10.36000 ,9.52000 ,8.68000 ,7.84000 ,7.00000 , - 6.83250 ,6.66500 ,6.49750 ,6.33000 ,6.16250 , - 5.99500 ,5.82750 ,5.66000 ,5.10000 ,4.54000 , - 3.98000 ,3.64833 ,3.31667 ,2.98500 ,2.65333 , - 2.32167 ,1.99000 ,1.77333 ,1.55667 ,1.34000 , - 1.22333 ,1.10667 ,0.99000 ,0.89667 ,0.80333 , - 0.71000 ,0.65000 ,0.59000 ,0.53000 ,0.47000 , - 0.41000 ,0.32333 ,0.23667 ,0.15000 ,0.12700 , - 0.10400 ,0.08100 ,0.07667 ,0.07233 ,0.06800 , - 0.06100 ,0.05400 ,0.04700 ,0.04367 ,0.04033 , - 0.03700 ,0.03300 ,0.02900 ,0.02500 ,0.02333 , - 0.02167 ,0.02000 ,0.01767 ,0.01533 ,0.01300 , - 0.01133 ,0.00967 ,0.00800 ,0.00800 ,0.00800 , - 0.00800 ,0.00800 ,0.00800 ,0.00800 ,0.00800 , - 0.00800 ,0.00800 ,0.00800 ,0.00800 ,0.00800 , - 0.00800 ,0.00800 ,0.00800 ,0.00800 ,0.00800 , - 0.00800 ,0.00800 ,0.00800 ,0.00800 ,0.00800 , - 0.00800 ,0.00800 ,0.00800 ,0.00800 ,0.00800 , - 0.00800 ,0.00800 ,0.00800 ,0.00800 ,0.00800 , - 0.00800 ,0.00800 ,0.00800 -}; - -static float EG_rate_decay_percent[128] = { - 0.00001 ,0.00001 ,0.00001 ,0.00001 ,0.00001 , - 0.00001 ,0.00001 ,0.00001 ,0.00001 ,0.00001 , - 0.00001 ,0.00001 ,0.00001 ,0.00001 ,0.00001 , - 0.00001 ,0.00001 ,0.00001 ,0.00001 ,0.00001 , - 0.00001 ,0.00001 ,0.00001 ,0.00001 ,0.00001 , - 0.00001 ,0.00001 ,0.00001 ,0.00001 ,0.00001 , - 0.00001 ,0.00001 ,0.00501 ,0.01001 ,0.01500 , - 0.02000 ,0.02800 ,0.03600 ,0.04400 ,0.05200 , - 0.06000 ,0.06800 ,0.07600 ,0.08400 ,0.09200 , - 0.10000 ,0.10800 ,0.11600 ,0.12400 ,0.13200 , - 0.14000 ,0.15000 ,0.16000 ,0.17000 ,0.18000 , - 0.19000 ,0.20000 ,0.21000 ,0.22000 ,0.23000 , - 0.24000 ,0.25100 ,0.26200 ,0.27300 ,0.28400 , - 0.29500 ,0.30600 ,0.31700 ,0.32800 ,0.33900 , - 0.35000 ,0.36500 ,0.38000 ,0.39500 ,0.41000 , - 0.42500 ,0.44000 ,0.45500 ,0.47000 ,0.48500 , - 0.50000 ,0.52000 ,0.54000 ,0.56000 ,0.58000 , - 0.60000 ,0.62000 ,0.64000 ,0.66000 ,0.68000 , - 0.70000 ,0.73200 ,0.76400 ,0.79600 ,0.82800 , - 0.86000 ,0.89500 ,0.93000 ,0.96500 ,1.00000 , - 1.00000 ,1.00000 ,1.00000 ,1.00000 ,1.00000 , - 1.00000 ,1.00000 ,1.00000 ,1.00000 ,1.00000 , - 1.00000 ,1.00000 ,1.00000 ,1.00000 ,1.00000 , - 1.00000 ,1.00000 ,1.00000 ,1.00000 ,1.00000 , - 1.00000 ,1.00000 ,1.00000 ,1.00000 ,1.00000 , - 1.00000 ,1.00000 ,1.00000 - -}; - -static float EG_rate_rise_percent[128] = { - 0.00001 ,0.00001 ,0.00001 ,0.00001 ,0.00001 , - 0.00001 ,0.00001 ,0.00001 ,0.00001 ,0.00001 , - 0.00001 ,0.00001 ,0.00001 ,0.00001 ,0.00001 , - 0.00001 ,0.00001 ,0.00001 ,0.00001 ,0.00001 , - 0.00001 ,0.00001 ,0.00001 ,0.00001 ,0.00001 , - 0.00001 ,0.00001 ,0.00001 ,0.00001 ,0.00001 , - 0.00001 ,0.00001 ,0.00501 ,0.01001 ,0.01500 , - 0.02000 ,0.02800 ,0.03600 ,0.04400 ,0.05200 , - 0.06000 ,0.06800 ,0.07600 ,0.08400 ,0.09200 , - 0.10000 ,0.10800 ,0.11600 ,0.12400 ,0.13200 , - 0.14000 ,0.15000 ,0.16000 ,0.17000 ,0.18000 , - 0.19000 ,0.20000 ,0.21000 ,0.22000 ,0.23000 , - 0.24000 ,0.25100 ,0.26200 ,0.27300 ,0.28400 , - 0.29500 ,0.30600 ,0.31700 ,0.32800 ,0.33900 , - 0.35000 ,0.36500 ,0.38000 ,0.39500 ,0.41000 , - 0.42500 ,0.44000 ,0.45500 ,0.47000 ,0.48500 , - 0.50000 ,0.52000 ,0.54000 ,0.56000 ,0.58000 , - 0.60000 ,0.62000 ,0.64000 ,0.66000 ,0.68000 , - 0.70000 ,0.73200 ,0.76400 ,0.79600 ,0.82800 , - 0.86000 ,0.89500 ,0.93000 ,0.96500 ,1.00000 , - 1.00000 ,1.00000 ,1.00000 ,1.00000 ,1.00000 , - 1.00000 ,1.00000 ,1.00000 ,1.00000 ,1.00000 , - 1.00000 ,1.00000 ,1.00000 ,1.00000 ,1.00000 , - 1.00000 ,1.00000 ,1.00000 ,1.00000 ,1.00000 , - 1.00000 ,1.00000 ,1.00000 ,1.00000 ,1.00000 , - 1.00000 ,1.00000 ,1.00000 -}; - -static double getDuration(int p_rate, int p_level_l, int p_level_r) { - float *duration_table=(p_level_r>p_level_l) ? EG_rate_rise_duration : EG_rate_decay_duration; - double duration=duration_table[p_rate]; - - float* percent_table =(p_level_r>p_level_l) ? EG_rate_rise_percent : EG_rate_decay_percent; - duration *= fabs(percent_table[p_level_r]-percent_table[p_level_l]); - return duration; -} - -EnvDisplay::EnvDisplay() { - pvalues = (uint8_t *) &TMP_LEVEL_PTR; -} - -void EnvDisplay::paint(Graphics &g) { - int h = getHeight(); - uint8_t *rates = pvalues; - uint8_t *levels = pvalues + 4; - - double d[4]; - double keyoff = 0.0; - double release = 0.0; - d[0] = getDuration(rates[0], levels[3], levels[0]); - d[1] = getDuration(rates[1], levels[0], levels[1]); - d[2] = getDuration(rates[2], levels[1], levels[2]); - - double ko = 0.0; - for(int j=0; j<3; ++j) - ko += d[j]; - if (ko>keyoff) - keyoff=ko; - - d[3] = getDuration(rates[3], levels[2], levels[3]); - if ( d[3]>release ) { - release = d[3]; - } - keyoff += 10.0; - double w = getWidth() / (keyoff + release); - - g.setColour(Colour(0xF0000000)); - g.fillRoundedRectangle (keyoff*w, 0.0f, (float) getWidth(), (float) getHeight(), 1.0f); - g.setColour(Colours::white); - - int x, y; - - Path p; - p.startNewSubPath(0, 32); - - // 0 - x = 0; - y = h - h / 99.0 * levels[3]; - p.lineTo(x, y); - if ( vPos == 0 || vPos == 1 ) { - g.fillEllipse(x-2, y-2, 4, 4); - } - - // 1 - x = d[0]*w; - y = h - h / 99.0 * levels[0]; - p.lineTo( x, y ); - if ( vPos == 1 || vPos == 2 ) { - g.fillEllipse(x-2, y-2, 4, 4); - } - - // 2 - x = (d[0]+d[1])*w; - y = h - h / 99.0 * levels[1]; - p.lineTo( x, y ); - if ( vPos == 2 || vPos == 3 ) { - g.fillEllipse(x-2, y-2, 4, 4); - } - - // 3 - x = (d[0]+d[1]+d[2])*w; - y = h - h / 99.0 * levels[2]; - p.lineTo( x, y ); - if ( vPos == 3 || vPos == 4) { - g.fillEllipse(x-2, y-2, 4, 4); - } - - // 4 - x = keyoff*w; - y = h - h / 99.0 * levels[2]; - p.lineTo( x, y ); - if ( vPos == 4 ) { - g.fillEllipse(x-2, y-2, 4, 4); - } - - // 5 - p.lineTo( (d[0]+d[1]+d[2]+keyoff+d[3])*w, h - h / 99.0 * levels[3] ); - - p.lineTo(96,32); - p.lineTo(0, 32); - - g.setColour(DXLookNFeel::fillColour); - g.fillPath(p); - - g.setColour(Colour(0xFFFFFFFF)); - String len; - len << ((int) vPos); - g.drawText(len, 5, 1, 72, 14, Justification::left, true); -} - -PitchEnvDisplay::PitchEnvDisplay() { - pvalues = (uint8_t *) &TMP_LEVEL_PTR; - vPos = 0; -} - -void PitchEnvDisplay::paint(Graphics &g) { - g.setColour(Colours::white); - - uint8_t *levels = pvalues + 4; - uint8_t *rates = pvalues; - - float dist[4]; - float total = 0; - - int old = pitchenv_tab[levels[3]] + 128; - - // find the scale - for(int i=0;i<4;i++) { - int nw = pitchenv_tab[levels[i]] + 128; - dist[i] = ((float)abs(nw - old)) / pitchenv_rate[rates[i]]; - total += dist[i]; - old = nw; - } - - if ( total < 0.00001 ) { - dist[0] = dist[1] = dist[2] = dist[3] = 1; - total = 4; - } - - float ratio = 96 / total; - - Path p; - p.startNewSubPath(0, 32); - - int x = 0; - int y = 25 - (pitchenv_tab[levels[3]] + 128) / 10; - p.lineTo(0,y); - - int dx = x; - int dy = y; - - int i; - for(i=0;i<4;i++) { - if ( vPos == i ) { - dx = x; - dy = y; - } - - x = dist[i] * ratio + x; - y = 25 - (pitchenv_tab[levels[i]] + 128) / 10; - p.lineTo(x, y); - } - - if ( vPos == i ) { - dx = x; - dy = y; - } - - p.lineTo(96,32); - p.lineTo(0, 32); - g.setColour(DXLookNFeel::fillColour); - g.fillPath(p); - - g.setColour(Colours::white); - g.fillEllipse(dx-2, dy-2, 4, 4); -} - -void VuMeter::paint(Graphics &g) { - Image myStrip = ImageCache::getFromMemory(BinaryData::Meter_140x8_png, BinaryData::Meter_140x8_pngSize); - - g.drawImage(myStrip, 0, 0, 140, 8, 0, 0, 140, 8); - - if ( v <= 0 ) - return; - - const int totalBlocks = 46; - int numBlocks = roundToInt(totalBlocks * v); - - if ( numBlocks > 46 ) - numBlocks = totalBlocks; - int brkpoint = numBlocks * 3 + 2; - - g.drawImage(myStrip, 0, 0, brkpoint, 8, 0, 8, brkpoint, 8); -} - -LcdDisplay::LcdDisplay() { - paramMsg = "DEXED " DEXED_VERSION; -} - -void LcdDisplay::setSystemMsg(String msg) { - paramMsg = msg; -} - -void LcdDisplay::paint(Graphics &g) { - g.setColour (Colours::white); - g.drawText (paramMsg, - 0, 0, 140, 14, - Justification::centred, true); -} - -void ComboBoxImage::paint(Graphics &g) { - int idx = getSelectedItemIndex(); - if ( itemPos[0] != -1 ) { - if ( idx < 4 ) - idx = itemPos[idx]; - } - - g.drawImage(items, 0, 0, items.getWidth(), itemHeight, 0, idx * itemHeight, items.getWidth(), itemHeight); -} - -ComboBoxImage::ComboBoxImage() { - itemPos[0] = -1; -} - -static void comboBoxPopupMenuFinishedCallback (int result, ComboBoxImage* combo) { - if (combo != nullptr) { - combo->hidePopup(); - - if (result != 0) - combo->setSelectedId (result); - } -} - -void ComboBoxImage::showPopup() { - popup.showMenuAsync (PopupMenu::Options().withTargetComponent (this) - .withItemThatMustBeVisible(getSelectedId()) - .withMinimumWidth(getWidth()) - .withMaximumNumColumns(1) - .withStandardItemHeight(itemHeight), - ModalCallbackFunction::forComponent(comboBoxPopupMenuFinishedCallback, this)); -} - -void ComboBoxImage::setImage(Image image) { - items = image; - - int numItems = getNumItems(); - itemHeight = image.getHeight() / numItems; - - for(int i=0;i(0,itemHeight*i, image.getWidth(), itemHeight)); - popup.addItem(i+1, getItemText(i), true, false, tmp); - } -} - -void ComboBoxImage::setImage(Image image, int pos[]) { - items = image; - - int numItems = getNumItems(); - itemHeight = 26; - - for(int i=0;i(0,itemHeight*pos[i], image.getWidth(), itemHeight)); - popup.addItem(i+1, getItemText(i), true, false, tmp); - } - - for(int i=0;i<4;i++) - itemPos[i] = pos[i]; -} - -void ProgramSelector::mouseDown(const MouseEvent &event) { - if ( event.x < getWidth() - 8) { - ComboBox::mouseDown(event); - return; - } - - int cur = getSelectedItemIndex(); - if ( event.y < getHeight() / 2 ) { - if ( cur == 0 ) - cur = 31; - else - cur--; - } else { - if ( cur == 31 ) - cur = 0; - else - cur++; - } - setSelectedItemIndex(cur); -} - -void ProgramSelector::paint(Graphics &g) { - int x = getWidth(); - int y = getHeight(); - - Path path; - path.addTriangle(x-8, y/2-1, x-4, 2, x, y/2-1); - path.addTriangle(x-8, y/2+1, x-4, y-2, x, y/2+1); - - g.setColour(Colours::white); - g.fillPath(path); -} diff --git a/src/trash/DXComponents.h b/src/trash/DXComponents.h deleted file mode 100644 index 5c48f8b..0000000 --- a/src/trash/DXComponents.h +++ /dev/null @@ -1,78 +0,0 @@ -/** - * - * Copyright (c) 2014 Pascal Gauthier. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#ifndef DXCOMPONENTS_H_INCLUDED -#define DXCOMPONENTS_H_INCLUDED - -#include "../JuceLibraryCode/JuceHeader.h" -#include - -class EnvDisplay : public Component { -public: - EnvDisplay(); - uint8_t *pvalues; - char vPos; - void paint(Graphics &g); -}; - -class PitchEnvDisplay : public Component { - char rvalues[8]; -public: - PitchEnvDisplay(); - uint8_t *pvalues; - char vPos; - void paint(Graphics &g); -}; - -class VuMeter: public Component { - void paint(Graphics &g); -public : - float v; -}; - -class LcdDisplay : public Component { -public: - LcdDisplay(); - void setSystemMsg(String msg); - String paramMsg; - void paint(Graphics &g); -}; - -class ComboBoxImage : public ComboBox { - Image items; - int itemHeight; - PopupMenu popup; - int itemPos[4]; -public: - ComboBoxImage(); - - virtual void paint(Graphics &g) override; - virtual void showPopup() override; - void setImage(Image image); - void setImage(Image image, int pos[]); -}; - -class ProgramSelector : public ComboBox { -public: - void mouseDown(const MouseEvent &event) override; - virtual void paint(Graphics &g) override; -}; - -#endif // DXCOMPONENTS_H_INCLUDED diff --git a/src/trash/DXLookNFeel.cpp b/src/trash/DXLookNFeel.cpp deleted file mode 100644 index c57cee7..0000000 --- a/src/trash/DXLookNFeel.cpp +++ /dev/null @@ -1,255 +0,0 @@ -/** - * - * Copyright (c) 2013-2016 Pascal Gauthier. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#include "DXLookNFeel.h" -#include "DXComponents.h" -#include "Dexed.h" -#include "PluginProcessor.h" - -#define REG_COLOUR(id, value) setColour(id, value); colourMap.set(#id, id) - -Image findImage(String path) { - Image img; - if ( path.length() <= 3 ) - return img; - File imgFile(path); - img = ImageCache::getFromFile(imgFile); - return img; -} - -DXLookNFeel::DXLookNFeel() { - Colour ctrlBackground; - - DexedAudioProcessor::dexedAppDir.setAsCurrentWorkingDirectory(); - ctrlBackground = Colour(20,18,18); - - REG_COLOUR(TextButton::buttonColourId,Colour(0xFF0FC00F)); - REG_COLOUR(TextButton::textColourOnId, Colours::white); - REG_COLOUR(TextButton::textColourOffId, Colours::white); - REG_COLOUR(Slider::rotarySliderOutlineColourId,Colour(0xFF0FC00F)); - REG_COLOUR(Slider::rotarySliderFillColourId,Colour(0xFFFFFFFF)); - REG_COLOUR(AlertWindow::backgroundColourId,lightBackground); - REG_COLOUR(AlertWindow::textColourId, Colours::white); - REG_COLOUR(TextEditor::backgroundColourId,ctrlBackground); - REG_COLOUR(TextEditor::textColourId, Colours::white); - REG_COLOUR(TextEditor::highlightColourId, fillColour); - REG_COLOUR(TextEditor::outlineColourId, Colours::transparentBlack); - REG_COLOUR(ComboBox::backgroundColourId, ctrlBackground); - REG_COLOUR(ComboBox::textColourId, Colours::white); - REG_COLOUR(ComboBox::buttonColourId, Colours::white); - REG_COLOUR(PopupMenu::backgroundColourId, background); - REG_COLOUR(PopupMenu::textColourId, Colours::white); - REG_COLOUR(PopupMenu::highlightedTextColourId, Colours::white); - REG_COLOUR(PopupMenu::highlightedBackgroundColourId, fillColour); - REG_COLOUR(TreeView::backgroundColourId, background); - REG_COLOUR(DirectoryContentsDisplayComponent::highlightColourId, fillColour); - REG_COLOUR(DirectoryContentsDisplayComponent::textColourId, Colours::white); - - imageKnob = ImageCache::getFromMemory(BinaryData::Knob_34x34_png, BinaryData::Knob_34x34_pngSize); - imageSwitch = ImageCache::getFromMemory(BinaryData::Switch_48x26_png, BinaryData::Switch_48x26_pngSize); - imageSwitchOperator = ImageCache::getFromMemory(BinaryData::Switch_32x32_png, BinaryData::Switch_32x32_pngSize); - imageButton = ImageCache::getFromMemory(BinaryData::ButtonUnlabeled_50x30_png, BinaryData::ButtonUnlabeled_50x30_pngSize); - imageSlider = ImageCache::getFromMemory(BinaryData::Slider_26x26_png, BinaryData::Slider_26x26_pngSize); - imageScaling = ImageCache::getFromMemory(BinaryData::Scaling_36_26_png, BinaryData::Scaling_36_26_pngSize);; - imageLight = ImageCache::getFromMemory(BinaryData::Light_14x14_png, BinaryData::Light_14x14_pngSize); - imageLFO = ImageCache::getFromMemory(BinaryData::LFO_36_26_png, BinaryData::LFO_36_26_pngSize); - imageOperator = ImageCache::getFromMemory(BinaryData::OperatorEditor_287x218_png, BinaryData::OperatorEditor_287x218_pngSize); - imageGlobal = ImageCache::getFromMemory (BinaryData::GlobalEditor_864x144_png, BinaryData::GlobalEditor_864x144_pngSize); - - defaultFont = Typeface::createSystemTypefaceFor(BinaryData::NotoSansRegular_ttf, BinaryData::NotoSansRegular_ttfSize); - defaultFontBold = Typeface::createSystemTypefaceFor(BinaryData::NotoSansBold_ttf, BinaryData::NotoSansBold_ttfSize); - - File dexedTheme = DexedAudioProcessor::dexedAppDir.getChildFile("DexedTheme.xml"); - - if ( ! dexedTheme.existsAsFile() ) - return; - - XmlElement *root = XmlDocument::parse(dexedTheme); - if ( root == NULL ) - return; - - forEachXmlChildElementWithTagName(*root, colour, "colour") { - String name = colour->getStringAttribute("id", ""); - if ( name == "" ) - continue; - String value = colour->getStringAttribute("value", ""); - if ( value == "" ) - continue; - if ( value.length() < 8 ) - continue; - int conv = strtol(value.toRawUTF8(), NULL, 16); - if ( colourMap.contains(name) ) { - setColour(colourMap[name], Colour(conv)); - } else { - if ( name == "Dexed::backgroundId" ) { - background = Colour(conv); - continue; - } - if ( name == "Dexed::fillColourId" ) { - fillColour = Colour(conv); - continue; - } - } - } - - forEachXmlChildElementWithTagName(*root, image, "image") { - String name = image->getStringAttribute("id", ""); - String path = image->getStringAttribute("path", ""); - if ( name == "Knob_34x34.png" ) { - imageKnob = findImage(path); - continue; - } - if ( name == "Switch_48x26.png" ) { - imageSwitch = findImage(path); - continue; - } - if ( name == "Switch_32x64.png" ) { - imageSwitchOperator = findImage(path); - continue; - } - if ( name == "ButtonUnlabeled_50x30.png" ) { - imageButton = findImage(path); - continue; - } - if ( name == "Slider_26x26.png" ) { - imageSlider = findImage(path); - continue; - } - if ( name == "Scaling_36_26.png" ) { - imageScaling = findImage(path); - continue; - } - if ( name == "Light_14x14.png" ) { - imageLight = findImage(path); - continue; - } - if ( name == "LFO_36_26.png" ) { - imageLFO = findImage(path); - continue; - } - if ( name == "OperatorEditor_287x218.png" ) { - imageOperator = findImage(path); - continue; - } - if ( name == "GlobalEditor_864x144.png" ) { - imageGlobal = findImage(path); - continue; - } - } - - delete root; -} - -Typeface::Ptr DXLookNFeel::getTypefaceForFont(const Font &) { - return defaultFont; -} - -void DXLookNFeel::drawRotarySlider( Graphics &g, int x, int y, int width, int height, float sliderPosProportional, - float rotaryStartAngle, float rotaryEndAngle, Slider &slider ) { - if ( imageKnob.isNull() ) { - LookAndFeel_V3::drawRotarySlider(g, x, y, width, height, sliderPosProportional, rotaryStartAngle, rotaryEndAngle, slider); - return; - } - - const double fractRotation = (slider.getValue() - slider.getMinimum()) / (slider.getMaximum() - slider.getMinimum()); //value between 0 and 1 for current amount of rotation - const int nFrames = imageKnob.getHeight()/imageKnob.getWidth(); // number of frames for vertical film strip - const int frameIdx = (int)ceil(fractRotation * ((double)nFrames-1.0) ); // current index from 0 --> nFrames-1 - - const float radius = jmin (width / 2.0f, height / 2.0f) ; - const float centreX = x + width * 0.5f; - const float centreY = y + height * 0.5f; - const float rx = centreX - radius - 1.0f; - const float ry = centreY - radius - 1.0f; - - g.drawImage(imageKnob, (int)rx, (int)ry, 2*(int)radius, 2*(int)radius, 0, frameIdx*imageKnob.getWidth(), imageKnob.getWidth(), imageKnob.getWidth()); -}; - -void DXLookNFeel::drawToggleButton(Graphics& g, ToggleButton& button, bool isMouseOverButton, bool isButtonDown) { - if ( imageSwitch.isNull() ) { - LookAndFeel_V3::drawToggleButton(g, button, isMouseOverButton, isButtonDown); - return; - } - - g.drawImage(imageSwitch, 0, 0, 48, 26, 0, button.getToggleState() ? 0 : 26, 48, 26); -} - -void DXLookNFeel::drawButtonBackground(Graphics &g, Button &button, const Colour& backgroundColour, bool isMouseOverButton, bool isButtonDown) { - if ( imageButton.isNull() ) { - LookAndFeel_V3::drawButtonBackground(g, button, backgroundColour, isMouseOverButton, isButtonDown); - return; - } - - int w = button.getWidth(); - - // dx, dy, dw, dl, sx, sy, sw, sl - g.drawImage(imageButton, 0, 0, 3, 30, 0, isButtonDown ? 30 : 0, 3, 30); - g.drawImage(imageButton, 3, 0, w-6, 30, 3, isButtonDown ? 30 : 0, 44, 30); - g.drawImage(imageButton, w-3, 0, 3, 30, 47, isButtonDown ? 30 : 0, 47, 30); -} - -void DXLookNFeel::drawLinearSliderBackground (Graphics&, int x, int y, int width, int height, - float sliderPos, float minSliderPos, float maxSliderPos, - const Slider::SliderStyle st, Slider& s) { - // NOP -} - -void DXLookNFeel::drawLinearSliderThumb (Graphics& g, int x, int y, int width, int height, - float sliderPos, float minSliderPos, float maxSliderPos, - const Slider::SliderStyle st, Slider& s) { - if ( imageSlider.isNull() ) { - LookAndFeel_V3::drawLinearSliderThumb(g, x, y, width, height, sliderPos, minSliderPos, maxSliderPos, st, s); - return; - } - - int p = sliderPos - minSliderPos; - p -= 6; - g.drawImage(imageSlider, p, 0, 26, 26, 0, 0, 26, 26); -} - -Font DXLookNFeel::getTextButtonFont(TextButton& button, int buttonHeight) { - return Font(defaultFontBold); -} - -void DXLookNFeel::positionComboBoxText(ComboBox& box, Label& label) { - ComboBox *src = &box; - - // I'm not proud of this one, but really... it must be another way to do this.... - ComboBoxImage* img = dynamic_cast(src); - if( img != 0 ) { - return; - } - - LookAndFeel_V3::positionComboBoxText(box, label); -} - -CriticalSection DXLookNFeel::lock; -DXLookNFeel * DXLookNFeel::ins = NULL; -Colour DXLookNFeel::fillColour = Colour(77,159,151); -Colour DXLookNFeel::lightBackground = Colour(78,72,63); -Colour DXLookNFeel::background = Colour(60,50,47); -Colour DXLookNFeel::roundBackground = Colour(58,52,48); - -DXLookNFeel *DXLookNFeel::getLookAndFeel() { - const ScopedLock locker(lock); - if ( ins != NULL ) - return ins; - ins = new DXLookNFeel(); - return ins; -} \ No newline at end of file diff --git a/src/trash/DXLookNFeel.h b/src/trash/DXLookNFeel.h deleted file mode 100644 index 6e4c305..0000000 --- a/src/trash/DXLookNFeel.h +++ /dev/null @@ -1,63 +0,0 @@ -/** - * - * Copyright (c) 2013-2016 Pascal Gauthier. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#ifndef DXLOOKNFEEL_H_INCLUDED -#define DXLOOKNFEEL_H_INCLUDED - -#include "../JuceLibraryCode/JuceHeader.h" - -class DXLookNFeel : public LookAndFeel_V3 { - static CriticalSection lock; - static DXLookNFeel *ins; - DXLookNFeel(); - - HashMap colourMap; - -public: - Typeface::Ptr defaultFont; - Typeface::Ptr defaultFontBold; - - Image imageKnob, imageSwitch, imageButton, imageSlider, imageScaling, imageLight, imageLFO; - Image imageSwitchOperator; - Image imageOperator, imageGlobal; - - /* overriden methods */ - virtual void drawRotarySlider(Graphics &g, int x, int y, int width, int height, float sliderPosProportional, float rotaryStartAngle, float rotaryEndAngle, Slider &slider ) override; - virtual void drawToggleButton(Graphics& g, ToggleButton& button, bool isMouseOverButton, bool isButtonDown) override; - virtual void drawLinearSliderBackground (Graphics&, int x, int y, int width, int height, - float sliderPos, float minSliderPos, float maxSliderPos, - const Slider::SliderStyle, Slider&) override; - virtual void drawLinearSliderThumb (Graphics&, int x, int y, int width, int height, - float sliderPos, float minSliderPos, float maxSliderPos, - const Slider::SliderStyle, Slider&) override; - virtual void drawButtonBackground (Graphics&, Button&, const Colour& backgroundColour, - bool isMouseOverButton, bool isButtonDown) override; - virtual Font getTextButtonFont(TextButton&, int buttonHeight) override; - virtual Typeface::Ptr getTypefaceForFont(const Font &) override; - virtual void positionComboBoxText (ComboBox& box, Label& label) override; - - static DXLookNFeel *getLookAndFeel(); - static Colour fillColour; - static Colour lightBackground; - static Colour background; - static Colour roundBackground; -}; - -#endif // DXLOOKNFEEL_H_INCLUDED diff --git a/src/trash/GlobalEditor.cpp b/src/trash/GlobalEditor.cpp deleted file mode 100644 index cff5604..0000000 --- a/src/trash/GlobalEditor.cpp +++ /dev/null @@ -1,788 +0,0 @@ -/* - ============================================================================== - - This is an automatically generated GUI class created by the Introjucer! - - Be careful when adding custom code to these files, as only the code within - the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded - and re-saved. - - Created with Introjucer version: 3.2.0 - - ------------------------------------------------------------------------------ - - The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions" - Copyright (c) 2015 - ROLI Ltd. - - ============================================================================== -*/ - -//[Headers] You can add your own extra header files here... -#include "PluginEditor.h" -#include "DXLookNFeel.h" -//[/Headers] - -#include "GlobalEditor.h" - - -//[MiscUserDefs] You can add your own user definitions and misc code here... - -/** - * Ugly but usefull 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 - */ -class MidiMonitor : public Component { - SysexComm *midi; - Image light; - -public: - MidiMonitor(SysexComm *sysexComm) { - midi = sysexComm; - light = DXLookNFeel::getLookAndFeel()->imageLight; - } - - void paint(Graphics &g) { - if ( ! (midi->isInputActive() || midi->isOutputActive() ) ) - return; - g.setColour(Colours::white); - - if ( midi->isInputActive() ) { - g.drawSingleLineText("DX7 IN", 17,14); - g.drawImage(light, 0, 3, 14, 14, 0, midi->inActivity ? 14 : 0, 14, 14); - midi->inActivity = false; - } - - if ( midi->isOutputActive() ) { - g.drawSingleLineText("DX7 OUT", 17, 28); - g.drawImage(light, 0, 17, 14, 14, 0, midi->outActivity ? 14 : 0, 14, 14); - midi->outActivity = false; - } - } -}; - -class AboutBox : public DialogWindow { -public: - Image about_png; - - AboutBox(Component *parent) : DialogWindow("About", Colour(0xFF000000), true) { - setUsingNativeTitleBar(false); - setAlwaysOnTop(true); - about_png = ImageCache::getFromMemory(BinaryData::about_png, BinaryData::about_pngSize); - setSize(about_png.getWidth(), about_png.getHeight()); - centreAroundComponent (parent, getWidth(), getHeight()); - } - - void closeButtonPressed() { - setVisible (false); - } - - void paint(Graphics &g) { - g.drawImage (about_png, 0, 0, about_png.getWidth(), about_png.getHeight(), - 0, 0, about_png.getWidth(), about_png.getHeight()); - g.setColour(Colour(0xFF000000)); - String ver("Version " DEXED_VERSION " ; build date " __DATE__ ); - g.drawSingleLineText(ver, 18, 130); - } -}; -//[/MiscUserDefs] - -//============================================================================== -GlobalEditor::GlobalEditor () -{ - //[Constructor_pre] You can add your own custom stuff here.. - //[/Constructor_pre] - - addAndMakeVisible (lfoSpeed = new Slider ("lfoSpeed")); - lfoSpeed->setRange (0, 99, 1); - lfoSpeed->setSliderStyle (Slider::RotaryVerticalDrag); - lfoSpeed->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - lfoSpeed->addListener (this); - - addAndMakeVisible (lfoAmDepth = new Slider ("lfoAmDepth")); - lfoAmDepth->setRange (0, 99, 1); - lfoAmDepth->setSliderStyle (Slider::RotaryVerticalDrag); - lfoAmDepth->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - lfoAmDepth->addListener (this); - - addAndMakeVisible (lfoPitchDepth = new Slider ("lfoPitchDepth")); - lfoPitchDepth->setRange (0, 99, 1); - lfoPitchDepth->setSliderStyle (Slider::RotaryVerticalDrag); - lfoPitchDepth->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - lfoPitchDepth->addListener (this); - - addAndMakeVisible (lfoDelay = new Slider ("lfoDelay")); - lfoDelay->setRange (0, 99, 1); - lfoDelay->setSliderStyle (Slider::RotaryVerticalDrag); - lfoDelay->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - lfoDelay->addListener (this); - - addAndMakeVisible (cutoff = new Slider ("cutoff")); - cutoff->setRange (0, 1, 0); - cutoff->setSliderStyle (Slider::RotaryVerticalDrag); - cutoff->setTextBoxStyle (Slider::NoTextBox, true, 80, 20); - cutoff->addListener (this); - - addAndMakeVisible (reso = new Slider ("reso")); - reso->setRange (0, 1, 0); - reso->setSliderStyle (Slider::RotaryVerticalDrag); - reso->setTextBoxStyle (Slider::NoTextBox, true, 80, 20); - reso->addListener (this); - - addAndMakeVisible (pitchRate2 = new Slider ("pitchRate2")); - pitchRate2->setRange (0, 99, 1); - pitchRate2->setSliderStyle (Slider::RotaryVerticalDrag); - pitchRate2->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - pitchRate2->addListener (this); - - addAndMakeVisible (pitchRate3 = new Slider ("pitchRate3")); - pitchRate3->setRange (0, 99, 1); - pitchRate3->setSliderStyle (Slider::RotaryVerticalDrag); - pitchRate3->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - pitchRate3->addListener (this); - - addAndMakeVisible (pitchRate4 = new Slider ("pitchRate4")); - pitchRate4->setRange (0, 99, 1); - pitchRate4->setSliderStyle (Slider::RotaryVerticalDrag); - pitchRate4->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - pitchRate4->addListener (this); - - addAndMakeVisible (pitchRate1 = new Slider ("pitchRate1")); - pitchRate1->setRange (0, 99, 1); - pitchRate1->setSliderStyle (Slider::RotaryVerticalDrag); - pitchRate1->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - pitchRate1->addListener (this); - - addAndMakeVisible (pitchLevel2 = new Slider ("pitchLevel2")); - pitchLevel2->setRange (0, 99, 1); - pitchLevel2->setSliderStyle (Slider::RotaryVerticalDrag); - pitchLevel2->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - pitchLevel2->addListener (this); - - addAndMakeVisible (pitchLevel3 = new Slider ("pitchLevel3")); - pitchLevel3->setRange (0, 99, 1); - pitchLevel3->setSliderStyle (Slider::RotaryVerticalDrag); - pitchLevel3->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - pitchLevel3->addListener (this); - - addAndMakeVisible (pitchLevel4 = new Slider ("pitchLevel4")); - pitchLevel4->setRange (0, 99, 1); - pitchLevel4->setSliderStyle (Slider::RotaryVerticalDrag); - pitchLevel4->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - pitchLevel4->addListener (this); - - addAndMakeVisible (pitchLevel1 = new Slider ("pitchLevel1")); - pitchLevel1->setRange (0, 99, 1); - pitchLevel1->setSliderStyle (Slider::RotaryVerticalDrag); - pitchLevel1->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - pitchLevel1->addListener (this); - - addAndMakeVisible (transpose = new Slider ("transpose")); - transpose->setRange (0, 48, 1); - transpose->setSliderStyle (Slider::RotaryVerticalDrag); - transpose->setTextBoxStyle (Slider::NoTextBox, true, 80, 20); - transpose->addListener (this); - - addAndMakeVisible (oscSync = new ToggleButton ("oscSync")); - oscSync->setButtonText (String::empty); - oscSync->addListener (this); - - addAndMakeVisible (pitchModSens = new Slider ("pitchModSens")); - pitchModSens->setRange (0, 7, 1); - pitchModSens->setSliderStyle (Slider::RotaryVerticalDrag); - pitchModSens->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - pitchModSens->addListener (this); - - addAndMakeVisible (lfoSync = new ToggleButton ("lfoSync")); - lfoSync->setButtonText (String::empty); - lfoSync->addListener (this); - - addAndMakeVisible (pitchEnvDisplay = new PitchEnvDisplay()); - pitchEnvDisplay->setName ("pitchEnvDisplay"); - - addAndMakeVisible (algoDisplay = new AlgoDisplay()); - algoDisplay->setName ("algoDisplay"); - - addAndMakeVisible (feedback = new Slider ("feedback")); - feedback->setRange (0, 7, 1); - feedback->setSliderStyle (Slider::RotaryVerticalDrag); - feedback->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - feedback->addListener (this); - - addAndMakeVisible (algo = new Slider ("algo")); - algo->setRange (1, 32, 1); - algo->setSliderStyle (Slider::RotaryVerticalDrag); - algo->setTextBoxStyle (Slider::NoTextBox, true, 80, 20); - algo->addListener (this); - - addAndMakeVisible (lcdDisplay = new LcdDisplay()); - lcdDisplay->setName ("lcdDisplay"); - - addAndMakeVisible (output = new Slider ("output")); - output->setRange (0, 1, 0); - output->setSliderStyle (Slider::RotaryVerticalDrag); - output->setTextBoxStyle (Slider::NoTextBox, true, 80, 20); - output->addListener (this); - - addAndMakeVisible (vuOutput = new VuMeter()); - vuOutput->setName ("vuOutput"); - - addAndMakeVisible (initButton = new TextButton ("initButton")); - initButton->setButtonText (TRANS("INIT")); - initButton->addListener (this); - - addAndMakeVisible (parmButton = new TextButton ("parmButton")); - parmButton->setButtonText (TRANS("PARM")); - parmButton->addListener (this); - - addAndMakeVisible (cartButton = new TextButton ("cartButton")); - cartButton->setButtonText (TRANS("CART")); - cartButton->addListener (this); - - addAndMakeVisible (storeButton = new TextButton ("storeButton")); - storeButton->setButtonText (TRANS("STORE")); - storeButton->addListener (this); - - addAndMakeVisible (monoMode = new ToggleButton ("monoMode")); - monoMode->setButtonText (String::empty); - monoMode->addListener (this); - - addAndMakeVisible (lfoType = new ComboBoxImage()); - lfoType->setName ("lfoType"); - - addAndMakeVisible (programSelector = new ProgramSelector()); - programSelector->setName ("programSelector"); - - addAndMakeVisible (aboutButton = new ImageButton ("aboutButton")); - aboutButton->setButtonText (String::empty); - aboutButton->addListener (this); - - aboutButton->setImages (false, true, false, - Image(), 1.000f, Colour (0x00000000), - Image(), 1.000f, Colour (0x00000000), - Image(), 1.000f, Colour (0x00000000)); - addAndMakeVisible (tune = new Slider ("tune")); - tune->setRange (0, 1, 0); - tune->setSliderStyle (Slider::RotaryVerticalDrag); - tune->setTextBoxStyle (Slider::NoTextBox, true, 80, 20); - tune->addListener (this); - - - //[UserPreSize] - //[/UserPreSize] - - setSize (864, 144); - - - //[Constructor] You can add your own custom stuff here.. - lfoType->addItem("TRIANGLE", 1); - lfoType->addItem("SAW DOWN", 2); - lfoType->addItem("SAW UP", 3); - lfoType->addItem("SQUARE", 4); - lfoType->addItem("SINE", 5); - lfoType->addItem("S&HOLD", 6); - lfoType->setImage(DXLookNFeel::getLookAndFeel()->imageLFO); - - programs = programSelector; - - background = DXLookNFeel::getLookAndFeel()->imageGlobal; - imageLight = DXLookNFeel::getLookAndFeel()->imageLight; - //[/Constructor] -} - -GlobalEditor::~GlobalEditor() -{ - //[Destructor_pre]. You can add your own custom destruction code here.. - //[/Destructor_pre] - - lfoSpeed = nullptr; - lfoAmDepth = nullptr; - lfoPitchDepth = nullptr; - lfoDelay = nullptr; - cutoff = nullptr; - reso = nullptr; - pitchRate2 = nullptr; - pitchRate3 = nullptr; - pitchRate4 = nullptr; - pitchRate1 = nullptr; - pitchLevel2 = nullptr; - pitchLevel3 = nullptr; - pitchLevel4 = nullptr; - pitchLevel1 = nullptr; - transpose = nullptr; - oscSync = nullptr; - pitchModSens = nullptr; - lfoSync = nullptr; - pitchEnvDisplay = nullptr; - algoDisplay = nullptr; - feedback = nullptr; - algo = nullptr; - lcdDisplay = nullptr; - output = nullptr; - vuOutput = nullptr; - initButton = nullptr; - parmButton = nullptr; - cartButton = nullptr; - storeButton = nullptr; - monoMode = nullptr; - lfoType = nullptr; - programSelector = nullptr; - aboutButton = nullptr; - tune = nullptr; - - - //[Destructor]. You can add your own custom destruction code here.. - //[/Destructor] -} - -//============================================================================== -void GlobalEditor::paint (Graphics& g) -{ - //[UserPrePaint] Add your own custom painting code here.. - g.drawImage(background, 0, 0, 864, 144, 0, 0, 864, 144); - //[/UserPrePaint] - - //[UserPaint] Add your own custom painting code here.. - g.drawImage(imageLight, 300, 70, 14, 14, 0, monoMode->getToggleState() ? 14 : 0, 14, 14); - g.drawImage(imageLight, 619, 102, 14, 14, 0, lfoSync->getToggleState() ? 14 : 0, 14, 14); - g.drawImage(imageLight, 705, 102, 14, 14, 0, oscSync->getToggleState() ? 14 : 0, 14, 14); - //[/UserPaint] -} - -void GlobalEditor::resized() -{ - //[UserPreResize] Add your own custom resize code here.. - //[/UserPreResize] - - lfoSpeed->setBounds (564, 50, 34, 34); - lfoAmDepth->setBounds (686, 50, 34, 34); - lfoPitchDepth->setBounds (646, 50, 34, 34); - lfoDelay->setBounds (603, 50, 34, 34); - cutoff->setBounds (234, 9, 34, 34); - reso->setBounds (278, 9, 34, 34); - pitchRate2->setBounds (767, 96, 34, 34); - pitchRate3->setBounds (795, 96, 35, 34); - pitchRate4->setBounds (823, 96, 34, 34); - pitchRate1->setBounds (739, 96, 34, 34); - pitchLevel2->setBounds (767, 57, 34, 34); - pitchLevel3->setBounds (795, 56, 34, 34); - pitchLevel4->setBounds (823, 56, 34, 34); - pitchLevel1->setBounds (739, 57, 34, 34); - transpose->setBounds (202, 60, 34, 34); - oscSync->setBounds (650, 96, 48, 26); - pitchModSens->setBounds (666, 5, 34, 34); - lfoSync->setBounds (565, 96, 48, 26); - pitchEnvDisplay->setBounds (751, 10, 93, 30); - algoDisplay->setBounds (335, 30, 152, 91); - feedback->setBounds (501, 81, 34, 34); - algo->setBounds (501, 22, 34, 34); - lcdDisplay->setBounds (6, 87, 140, 13); - output->setBounds (157, 60, 34, 34); - vuOutput->setBounds (6, 103, 140, 8); - initButton->setBounds (100, 111, 50, 30); - parmButton->setBounds (52, 111, 50, 30); - cartButton->setBounds (3, 111, 50, 30); - storeButton->setBounds (270, 109, 50, 30); - monoMode->setBounds (249, 65, 48, 26); - lfoType->setBounds (583, 8, 36, 26); - programSelector->setBounds (153, 115, 112, 18); - aboutButton->setBounds (8, 11, 135, 46); - tune->setBounds (190, 9, 34, 34); - //[UserResized] Add your own custom resize handling here.. - //[/UserResized] -} - -void GlobalEditor::sliderValueChanged (Slider* sliderThatWasMoved) -{ - //[UsersliderValueChanged_Pre] - //[/UsersliderValueChanged_Pre] - - if (sliderThatWasMoved == lfoSpeed) - { - //[UserSliderCode_lfoSpeed] -- add your slider handling code here.. - //[/UserSliderCode_lfoSpeed] - } - else if (sliderThatWasMoved == lfoAmDepth) - { - //[UserSliderCode_lfoAmDepth] -- add your slider handling code here.. - //[/UserSliderCode_lfoAmDepth] - } - else if (sliderThatWasMoved == lfoPitchDepth) - { - //[UserSliderCode_lfoPitchDepth] -- add your slider handling code here.. - //[/UserSliderCode_lfoPitchDepth] - } - else if (sliderThatWasMoved == lfoDelay) - { - //[UserSliderCode_lfoDelay] -- add your slider handling code here.. - //[/UserSliderCode_lfoDelay] - } - else if (sliderThatWasMoved == cutoff) - { - //[UserSliderCode_cutoff] -- add your slider handling code here.. - //[/UserSliderCode_cutoff] - } - else if (sliderThatWasMoved == reso) - { - //[UserSliderCode_reso] -- add your slider handling code here.. - //[/UserSliderCode_reso] - } - else if (sliderThatWasMoved == pitchRate2) - { - //[UserSliderCode_pitchRate2] -- add your slider handling code here.. - pitchEnvDisplay->repaint(); - //[/UserSliderCode_pitchRate2] - } - else if (sliderThatWasMoved == pitchRate3) - { - //[UserSliderCode_pitchRate3] -- add your slider handling code here.. - pitchEnvDisplay->repaint(); - //[/UserSliderCode_pitchRate3] - } - else if (sliderThatWasMoved == pitchRate4) - { - //[UserSliderCode_pitchRate4] -- add your slider handling code here.. - pitchEnvDisplay->repaint(); - //[/UserSliderCode_pitchRate4] - } - else if (sliderThatWasMoved == pitchRate1) - { - //[UserSliderCode_pitchRate1] -- add your slider handling code here.. - pitchEnvDisplay->repaint(); - //[/UserSliderCode_pitchRate1] - } - else if (sliderThatWasMoved == pitchLevel2) - { - //[UserSliderCode_pitchLevel2] -- add your slider handling code here.. - pitchEnvDisplay->repaint(); - //[/UserSliderCode_pitchLevel2] - } - else if (sliderThatWasMoved == pitchLevel3) - { - //[UserSliderCode_pitchLevel3] -- add your slider handling code here.. - pitchEnvDisplay->repaint(); - //[/UserSliderCode_pitchLevel3] - } - else if (sliderThatWasMoved == pitchLevel4) - { - //[UserSliderCode_pitchLevel4] -- add your slider handling code here.. - pitchEnvDisplay->repaint(); - //[/UserSliderCode_pitchLevel4] - } - else if (sliderThatWasMoved == pitchLevel1) - { - //[UserSliderCode_pitchLevel1] -- add your slider handling code here.. - pitchEnvDisplay->repaint(); - //[/UserSliderCode_pitchLevel1] - } - else if (sliderThatWasMoved == transpose) - { - //[UserSliderCode_transpose] -- add your slider handling code here.. - //[/UserSliderCode_transpose] - } - else if (sliderThatWasMoved == pitchModSens) - { - //[UserSliderCode_pitchModSens] -- add your slider handling code here.. - //[/UserSliderCode_pitchModSens] - } - else if (sliderThatWasMoved == feedback) - { - //[UserSliderCode_feedback] -- add your slider handling code here.. - //[/UserSliderCode_feedback] - } - else if (sliderThatWasMoved == algo) - { - //[UserSliderCode_algo] -- add your slider handling code here.. - //[/UserSliderCode_algo] - } - else if (sliderThatWasMoved == output) - { - //[UserSliderCode_output] -- add your slider handling code here.. - //[/UserSliderCode_output] - } - else if (sliderThatWasMoved == tune) - { - //[UserSliderCode_tune] -- add your slider handling code here.. - //[/UserSliderCode_tune] - } - - //[UsersliderValueChanged_Post] - //[/UsersliderValueChanged_Post] -} - -void GlobalEditor::buttonClicked (Button* buttonThatWasClicked) -{ - //[UserbuttonClicked_Pre] - //[/UserbuttonClicked_Pre] - - if (buttonThatWasClicked == oscSync) - { - //[UserButtonCode_oscSync] -- add your button handler code here.. - repaint(); - //[/UserButtonCode_oscSync] - } - else if (buttonThatWasClicked == lfoSync) - { - //[UserButtonCode_lfoSync] -- add your button handler code here.. - repaint(); - //[/UserButtonCode_lfoSync] - } - else if (buttonThatWasClicked == initButton) - { - //[UserButtonCode_initButton] -- add your button handler code here.. - editor->initProgram(); - //[/UserButtonCode_initButton] - } - else if (buttonThatWasClicked == parmButton) - { - //[UserButtonCode_parmButton] -- add your button handler code here.. - editor->parmShow(); - //[/UserButtonCode_parmButton] - } - else if (buttonThatWasClicked == cartButton) - { - //[UserButtonCode_cartButton] -- add your button handler code here.. - editor->cartShow(); - //[/UserButtonCode_cartButton] - } - else if (buttonThatWasClicked == storeButton) - { - //[UserButtonCode_storeButton] -- add your button handler code here.. - editor->storeProgram(); - //[/UserButtonCode_storeButton] - } - else if (buttonThatWasClicked == monoMode) - { - //[UserButtonCode_monoMode] -- add your button handler code here.. - editor->processor->setMonoMode(monoMode->getToggleState()); - repaint(); - //[/UserButtonCode_monoMode] - } - else if (buttonThatWasClicked == aboutButton) - { - //[UserButtonCode_aboutButton] -- add your button handler code here.. - AboutBox about(this->getParentComponent()); - about.runModalLoop(); - //[/UserButtonCode_aboutButton] - } - - //[UserbuttonClicked_Post] - //[/UserbuttonClicked_Post] -} - - - -//[MiscUserCode] You can add your own definitions of your custom methods or any other code here... - -void GlobalEditor::bind(DexedAudioProcessorEditor *edit) { - processor = edit->processor; - processor->algo->bind(algo); - processor->lfoRate->bind(lfoSpeed); - processor->lfoDelay->bind(lfoDelay); - processor->lfoWaveform->bind(lfoType); - processor->lfoAmpDepth->bind(lfoAmDepth); - processor->lfoPitchDepth->bind(lfoPitchDepth); - processor->lfoSync->bind(lfoSync); - processor->oscSync->bind(oscSync); - processor->transpose->bind(transpose); - processor->feedback->bind(feedback); - processor->pitchModSens->bind(pitchModSens); - processor->pitchEgLevel[0]->bind(pitchLevel1); - processor->pitchEgLevel[1]->bind(pitchLevel2); - processor->pitchEgLevel[2]->bind(pitchLevel3); - processor->pitchEgLevel[3]->bind(pitchLevel4); - processor->pitchEgRate[0]->bind(pitchRate1); - processor->pitchEgRate[1]->bind(pitchRate2); - processor->pitchEgRate[2]->bind(pitchRate3); - processor->pitchEgRate[3]->bind(pitchRate4); - processor->fxCutoff->bind(cutoff); - processor->fxReso->bind(reso); - processor->output->bind(output); - processor->tune->bind(tune); - algoDisplay->algo = (char *) &(processor->data[134]); - pitchEnvDisplay->pvalues = &(processor->data[126]); - - editor = edit; - - midiMonitor = new MidiMonitor(&(processor->sysexComm)); - //addAndMakeVisible(midiMonitor); - //midiMonitor->setBounds(155, 21, 80, 45); - - repaint(); -} - -void GlobalEditor::setSystemMessage(String msg) { - lcdDisplay->setSystemMsg(msg); -} - -void GlobalEditor::setParamMessage(String msg) { - lcdDisplay->paramMsg = msg; -} - -void GlobalEditor::updateDisplay() { - repaint(); -} - -void GlobalEditor::updatePitchPos(int pos) { - pitchEnvDisplay->vPos = pos; - pitchEnvDisplay->repaint(); -} - -void GlobalEditor::updateVu(float f) { - vuOutput->v = f; - vuOutput->repaint(); - midiMonitor->repaint(); -} - -void GlobalEditor::setMonoState(bool state) { - monoMode->setToggleState(state ? Button::buttonDown : Button::buttonNormal, dontSendNotification); -} -//[/MiscUserCode] - - -//============================================================================== -#if 0 -/* -- Introjucer information section -- - - This is where the Introjucer stores the metadata that describe this GUI layout, so - make changes in here at your peril! - -BEGIN_JUCER_METADATA - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -END_JUCER_METADATA -*/ -#endif - - -//[EndFile] You can add extra defines here... -//[/EndFile] diff --git a/src/trash/GlobalEditor.h b/src/trash/GlobalEditor.h deleted file mode 100644 index 3b5d8fa..0000000 --- a/src/trash/GlobalEditor.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - ============================================================================== - - This is an automatically generated GUI class created by the Introjucer! - - Be careful when adding custom code to these files, as only the code within - the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded - and re-saved. - - Created with Introjucer version: 3.2.0 - - ------------------------------------------------------------------------------ - - The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions" - Copyright (c) 2015 - ROLI Ltd. - - ============================================================================== -*/ - -#ifndef __JUCE_HEADER_10638A2B49B704D0__ -#define __JUCE_HEADER_10638A2B49B704D0__ - -//[Headers] -- You can add your own extra header files here -- -#include "JuceHeader.h" -#include "PluginProcessor.h" -#include "DXComponents.h" -#include "AlgoDisplay.h" - -class DexedAudioProcessorEditor; -//[/Headers] - - - -//============================================================================== -/** - //[Comments] - An auto-generated component, created by the Introjucer. - - Describe your class and how it works here! - //[/Comments] -*/ -class GlobalEditor : public Component, - public SliderListener, - public ButtonListener -{ -public: - //============================================================================== - GlobalEditor (); - ~GlobalEditor(); - - //============================================================================== - //[UserMethods] -- You can add your own custom methods in this section. - void bind(DexedAudioProcessorEditor *processor); - void setSystemMessage(String msg); - void setParamMessage(String msg); - void updatePitchPos(int pos); - void updateVu(float v); - void updateDisplay(); - void repaintMsg(); - - void setMonoState(bool state); - ProgramSelector *programs; - ScopedPointer midiMonitor; - //[/UserMethods] - - void paint (Graphics& g); - void resized(); - void sliderValueChanged (Slider* sliderThatWasMoved); - void buttonClicked (Button* buttonThatWasClicked); - - - -private: - //[UserVariables] -- You can add your own custom variables in this section. - DexedAudioProcessorEditor *editor; - DexedAudioProcessor *processor; - - Image background; - Image imageLight; - //[/UserVariables] - - //============================================================================== - ScopedPointer lfoSpeed; - ScopedPointer lfoAmDepth; - ScopedPointer lfoPitchDepth; - ScopedPointer lfoDelay; - ScopedPointer cutoff; - ScopedPointer reso; - ScopedPointer pitchRate2; - ScopedPointer pitchRate3; - ScopedPointer pitchRate4; - ScopedPointer pitchRate1; - ScopedPointer pitchLevel2; - ScopedPointer pitchLevel3; - ScopedPointer pitchLevel4; - ScopedPointer pitchLevel1; - ScopedPointer transpose; - ScopedPointer oscSync; - ScopedPointer pitchModSens; - ScopedPointer lfoSync; - ScopedPointer pitchEnvDisplay; - ScopedPointer algoDisplay; - ScopedPointer feedback; - ScopedPointer algo; - ScopedPointer lcdDisplay; - ScopedPointer output; - ScopedPointer vuOutput; - ScopedPointer initButton; - ScopedPointer parmButton; - ScopedPointer cartButton; - ScopedPointer storeButton; - ScopedPointer monoMode; - ScopedPointer lfoType; - ScopedPointer programSelector; - ScopedPointer aboutButton; - ScopedPointer tune; - - - //============================================================================== - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (GlobalEditor) -}; - -//[EndFile] You can add extra defines here... -//[/EndFile] - -#endif // __JUCE_HEADER_10638A2B49B704D0__ diff --git a/src/trash/OperatorEditor.cpp b/src/trash/OperatorEditor.cpp deleted file mode 100644 index d4ebc88..0000000 --- a/src/trash/OperatorEditor.cpp +++ /dev/null @@ -1,660 +0,0 @@ -/* - ============================================================================== - - This is an automatically generated GUI class created by the Introjucer! - - Be careful when adding custom code to these files, as only the code within - the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded - and re-saved. - - Created with Introjucer version: 3.2.0 - - ------------------------------------------------------------------------------ - - The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions" - Copyright (c) 2015 - ROLI Ltd. - - ============================================================================== -*/ - -//[Headers] You can add your own extra header files here... -//[/Headers] - -#include "OperatorEditor.h" - - -//[MiscUserDefs] You can add your own user definitions and misc code here... -#ifndef M_LN10 -#define M_LN10 2.30258509299404568402 -#endif - -class OperatorSwitch : public ToggleButton { - Image image; -public : - OperatorSwitch() : ToggleButton("opSwitch") { - image = DXLookNFeel::getLookAndFeel()->imageSwitchOperator; - setSize(32, 32); - } - - void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown) { - g.drawImage(image, 0, 0, 32, 32, 0, getToggleState() ? 0 : 32, 32, 32); - } -}; - -//[/MiscUserDefs] - -//============================================================================== -OperatorEditor::OperatorEditor () -{ - //[Constructor_pre] You can add your own custom stuff here.. - //[/Constructor_pre] - - addAndMakeVisible (s_egl1 = new Slider ("egl1")); - s_egl1->setRange (0, 99, 1); - s_egl1->setSliderStyle (Slider::RotaryVerticalDrag); - s_egl1->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - s_egl1->addListener (this); - - addAndMakeVisible (s_egl2 = new Slider ("egl2")); - s_egl2->setRange (0, 99, 1); - s_egl2->setSliderStyle (Slider::RotaryVerticalDrag); - s_egl2->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - s_egl2->addListener (this); - - addAndMakeVisible (s_egl3 = new Slider ("egl3")); - s_egl3->setRange (0, 99, 1); - s_egl3->setSliderStyle (Slider::RotaryVerticalDrag); - s_egl3->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - s_egl3->addListener (this); - - addAndMakeVisible (s_egl4 = new Slider ("egl4")); - s_egl4->setRange (0, 99, 1); - s_egl4->setSliderStyle (Slider::RotaryVerticalDrag); - s_egl4->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - s_egl4->addListener (this); - - addAndMakeVisible (s_egv1 = new Slider ("egr1")); - s_egv1->setRange (0, 99, 1); - s_egv1->setSliderStyle (Slider::RotaryVerticalDrag); - s_egv1->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - s_egv1->addListener (this); - - addAndMakeVisible (s_egv2 = new Slider ("egr3")); - s_egv2->setRange (0, 99, 1); - s_egv2->setSliderStyle (Slider::RotaryVerticalDrag); - s_egv2->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - s_egv2->addListener (this); - - addAndMakeVisible (s_egv3 = new Slider ("egr3")); - s_egv3->setRange (0, 99, 1); - s_egv3->setSliderStyle (Slider::RotaryVerticalDrag); - s_egv3->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - s_egv3->addListener (this); - - addAndMakeVisible (s_egv4 = new Slider ("egr4")); - s_egv4->setRange (0, 99, 1); - s_egv4->setSliderStyle (Slider::RotaryVerticalDrag); - s_egv4->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - s_egv4->addListener (this); - - addAndMakeVisible (opLevel = new Slider ("opLevel")); - opLevel->setRange (0, 99, 1); - opLevel->setSliderStyle (Slider::RotaryVerticalDrag); - opLevel->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - opLevel->addListener (this); - - addAndMakeVisible (opFine = new Slider ("opFine")); - opFine->setRange (0, 99, 1); - opFine->setSliderStyle (Slider::RotaryVerticalDrag); - opFine->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - opFine->addListener (this); - - addAndMakeVisible (opCoarse = new Slider ("opCoarse")); - opCoarse->setRange (0, 31, 1); - opCoarse->setSliderStyle (Slider::RotaryVerticalDrag); - opCoarse->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - opCoarse->addListener (this); - - addAndMakeVisible (khzDisplay = new Label ("khz", - TRANS("1,000 kHz"))); - khzDisplay->setFont (Font (12.60f, Font::plain)); - khzDisplay->setJustificationType (Justification::centred); - khzDisplay->setEditable (false, false, false); - khzDisplay->setColour (Label::backgroundColourId, Colour (0x6a000000)); - khzDisplay->setColour (Label::textColourId, Colours::white); - khzDisplay->setColour (Label::outlineColourId, Colour (0x00000000)); - khzDisplay->setColour (TextEditor::textColourId, Colours::black); - khzDisplay->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); - - addAndMakeVisible (detune = new Slider ("detune")); - detune->setRange (-7, 7, 1); - detune->setSliderStyle (Slider::RotaryVerticalDrag); - detune->setTextBoxStyle (Slider::NoTextBox, true, 80, 20); - detune->addListener (this); - - addAndMakeVisible (envDisplay = new EnvDisplay()); - envDisplay->setName ("envDisplay"); - - addAndMakeVisible (sclLeftLevel = new Slider ("sclLeftLevel")); - sclLeftLevel->setTooltip (TRANS("Keyboard Scale Level Left Depth ")); - sclLeftLevel->setRange (0, 99, 1); - sclLeftLevel->setSliderStyle (Slider::RotaryVerticalDrag); - sclLeftLevel->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - sclLeftLevel->addListener (this); - - addAndMakeVisible (sclRightLevel = new Slider ("sclRightLevel")); - sclRightLevel->setTooltip (TRANS("Keyboard Scale Level Right Depth ")); - sclRightLevel->setRange (0, 99, 1); - sclRightLevel->setSliderStyle (Slider::RotaryVerticalDrag); - sclRightLevel->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - sclRightLevel->addListener (this); - - addAndMakeVisible (sclLvlBrkPt = new Slider ("sclLvlBrkPt")); - sclLvlBrkPt->setTooltip (TRANS("Scale Level Breakpoint")); - sclLvlBrkPt->setRange (0, 99, 1); - sclLvlBrkPt->setSliderStyle (Slider::LinearHorizontal); - sclLvlBrkPt->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - sclLvlBrkPt->addListener (this); - - addAndMakeVisible (sclRateScaling = new Slider ("sclRateScaling")); - sclRateScaling->setTooltip (TRANS("Keyboard Rate Scaling")); - sclRateScaling->setRange (0, 7, 1); - sclRateScaling->setSliderStyle (Slider::RotaryVerticalDrag); - sclRateScaling->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - sclRateScaling->addListener (this); - - addAndMakeVisible (keyVelSens = new Slider ("keyVelSens")); - keyVelSens->setRange (0, 7, 1); - keyVelSens->setSliderStyle (Slider::RotaryVerticalDrag); - keyVelSens->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - keyVelSens->addListener (this); - - addAndMakeVisible (ampModSens = new Slider ("ampModSens")); - ampModSens->setRange (0, 3, 1); - ampModSens->setSliderStyle (Slider::RotaryVerticalDrag); - ampModSens->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); - ampModSens->addListener (this); - - addAndMakeVisible (vu = new VuMeter()); - vu->setName ("vu"); - - addAndMakeVisible (opMode = new ToggleButton ("opMode")); - opMode->setButtonText (String::empty); - opMode->addListener (this); - - addAndMakeVisible (kbdLeftCurve = new ComboBoxImage()); - kbdLeftCurve->setName ("kbdLeftCurve"); - - addAndMakeVisible (kbdRightCurve = new ComboBoxImage()); - kbdRightCurve->setName ("kbdRightCurve"); - - - //[UserPreSize] - addAndMakeVisible(opSwitch = new OperatorSwitch()); - //[/UserPreSize] - - setSize (287, 218); - - - //[Constructor] You can add your own custom stuff here.. - light = DXLookNFeel::getLookAndFeel()->imageLight; - Image tmp = DXLookNFeel::getLookAndFeel()->imageScaling; - - kbdLeftCurve->addItem("-LN", 1); - kbdLeftCurve->addItem("-EX", 2); - kbdLeftCurve->addItem("+EX", 3); - kbdLeftCurve->addItem("+LN", 4); - int posLeft[] = {0,5,4,3}; - kbdLeftCurve->setImage(tmp, posLeft); - - kbdRightCurve->addItem("-LN", 1); - kbdRightCurve->addItem("-EX", 2); - kbdRightCurve->addItem("+EX", 3); - kbdRightCurve->addItem("+LN", 4); - int posRight[] = {3,2,1,0}; - kbdRightCurve->setImage(tmp, posRight); - - background = DXLookNFeel::getLookAndFeel()->imageOperator; - - //[/Constructor] -} - -OperatorEditor::~OperatorEditor() -{ - //[Destructor_pre]. You can add your own custom destruction code here.. - //[/Destructor_pre] - - s_egl1 = nullptr; - s_egl2 = nullptr; - s_egl3 = nullptr; - s_egl4 = nullptr; - s_egv1 = nullptr; - s_egv2 = nullptr; - s_egv3 = nullptr; - s_egv4 = nullptr; - opLevel = nullptr; - opFine = nullptr; - opCoarse = nullptr; - khzDisplay = nullptr; - detune = nullptr; - envDisplay = nullptr; - sclLeftLevel = nullptr; - sclRightLevel = nullptr; - sclLvlBrkPt = nullptr; - sclRateScaling = nullptr; - keyVelSens = nullptr; - ampModSens = nullptr; - vu = nullptr; - opMode = nullptr; - kbdLeftCurve = nullptr; - kbdRightCurve = nullptr; - - - //[Destructor]. You can add your own custom destruction code here.. - opSwitch = nullptr; - //[/Destructor] -} - -//============================================================================== -void OperatorEditor::paint (Graphics& g) -{ - //[UserPrePaint] Add your own custom painting code here.. - g.drawImage(background, 0, 0, 287, 218, 0, 0, 287, 218); - //[/UserPrePaint] - - //[UserPaint] Add your own custom painting code here.. - g.setColour (Colours::white); - g.setFont(Font (30.00f, Font::plain)); - g.drawText(opNum, 250, 14, 30, 30, Justification::centred, true); - - bool state = opMode->getToggleState(); - - // 129 x 24 - g.drawImage(light, 127, 24, 14, 14, 0, state ? 0 : 14, 14, 14); - // 199 x 24 - g.drawImage(light, 198, 24, 14, 14, 0, !state ? 0 : 14, 14, 14); - //[/UserPaint] -} - -void OperatorEditor::resized() -{ - //[UserPreResize] Add your own custom resize code here.. - //[/UserPreResize] - - s_egl1->setBounds (5, 128, 34, 34); - s_egl2->setBounds (33, 129, 34, 34); - s_egl3->setBounds (61, 128, 34, 34); - s_egl4->setBounds (89, 128, 34, 34); - s_egv1->setBounds (5, 169, 34, 34); - s_egv2->setBounds (33, 169, 34, 34); - s_egv3->setBounds (61, 169, 34, 34); - s_egv4->setBounds (89, 169, 34, 34); - opLevel->setBounds (245, 76, 34, 34); - opFine->setBounds (78, 24, 34, 34); - opCoarse->setBounds (43, 24, 34, 34); - khzDisplay->setBounds (15, 10, 95, 10); - detune->setBounds (6, 24, 34, 34); - envDisplay->setBounds (16, 83, 94, 30); - sclLeftLevel->setBounds (131, 115, 34, 34); - sclRightLevel->setBounds (241, 115, 34, 34); - sclLvlBrkPt->setBounds (178, 130, 54, 24); - sclRateScaling->setBounds (186, 179, 34, 34); - keyVelSens->setBounds (204, 76, 34, 34); - ampModSens->setBounds (140, 76, 34, 34); - vu->setBounds (132, 52, 140, 8); - opMode->setBounds (146, 19, 48, 26); - kbdLeftCurve->setBounds (128, 170, 36, 26); - kbdRightCurve->setBounds (240, 170, 36, 26); - //[UserResized] Add your own custom resize handling here.. - opSwitch->setBounds(226, 13, 64, 32); - //[/UserResized] -} - -void OperatorEditor::sliderValueChanged (Slider* sliderThatWasMoved) -{ - //[UsersliderValueChanged_Pre] - //[/UsersliderValueChanged_Pre] - - if (sliderThatWasMoved == s_egl1) - { - //[UserSliderCode_s_egl1] -- add your slider handling code here.. - envDisplay->repaint(); - //[/UserSliderCode_s_egl1] - } - else if (sliderThatWasMoved == s_egl2) - { - //[UserSliderCode_s_egl2] -- add your slider handling code here.. - envDisplay->repaint(); - //[/UserSliderCode_s_egl2] - } - else if (sliderThatWasMoved == s_egl3) - { - //[UserSliderCode_s_egl3] -- add your slider handling code here.. - envDisplay->repaint(); - //[/UserSliderCode_s_egl3] - } - else if (sliderThatWasMoved == s_egl4) - { - //[UserSliderCode_s_egl4] -- add your slider handling code here.. - envDisplay->repaint(); - //[/UserSliderCode_s_egl4] - } - else if (sliderThatWasMoved == s_egv1) - { - //[UserSliderCode_s_egv1] -- add your slider handling code here.. - envDisplay->repaint(); - //[/UserSliderCode_s_egv1] - } - else if (sliderThatWasMoved == s_egv2) - { - //[UserSliderCode_s_egv2] -- add your slider handling code here.. - envDisplay->repaint(); - //[/UserSliderCode_s_egv2] - } - else if (sliderThatWasMoved == s_egv3) - { - //[UserSliderCode_s_egv3] -- add your slider handling code here.. - envDisplay->repaint(); - //[/UserSliderCode_s_egv3] - } - else if (sliderThatWasMoved == s_egv4) - { - //[UserSliderCode_s_egv4] -- add your slider handling code here.. - envDisplay->repaint(); - //[/UserSliderCode_s_egv4] - } - else if (sliderThatWasMoved == opLevel) - { - //[UserSliderCode_opLevel] -- add your slider handling code here.. - //[/UserSliderCode_opLevel] - } - else if (sliderThatWasMoved == opFine) - { - //[UserSliderCode_opFine] -- add your slider handling code here.. - updateDisplay(); - //[/UserSliderCode_opFine] - } - else if (sliderThatWasMoved == opCoarse) - { - //[UserSliderCode_opCoarse] -- add your slider handling code here.. - updateDisplay(); - //[/UserSliderCode_opCoarse] - } - else if (sliderThatWasMoved == detune) - { - //[UserSliderCode_detune] -- add your slider handling code here.. - updateDisplay(); - //[/UserSliderCode_detune] - } - else if (sliderThatWasMoved == sclLeftLevel) - { - //[UserSliderCode_sclLeftLevel] -- add your slider handling code here.. - //[/UserSliderCode_sclLeftLevel] - } - else if (sliderThatWasMoved == sclRightLevel) - { - //[UserSliderCode_sclRightLevel] -- add your slider handling code here.. - //[/UserSliderCode_sclRightLevel] - } - else if (sliderThatWasMoved == sclLvlBrkPt) - { - //[UserSliderCode_sclLvlBrkPt] -- add your slider handling code here.. - //[/UserSliderCode_sclLvlBrkPt] - } - else if (sliderThatWasMoved == sclRateScaling) - { - //[UserSliderCode_sclRateScaling] -- add your slider handling code here.. - //[/UserSliderCode_sclRateScaling] - } - else if (sliderThatWasMoved == keyVelSens) - { - //[UserSliderCode_keyVelSens] -- add your slider handling code here.. - //[/UserSliderCode_keyVelSens] - } - else if (sliderThatWasMoved == ampModSens) - { - //[UserSliderCode_ampModSens] -- add your slider handling code here.. - //[/UserSliderCode_ampModSens] - } - - //[UsersliderValueChanged_Post] - //[/UsersliderValueChanged_Post] -} - -void OperatorEditor::buttonClicked (Button* buttonThatWasClicked) -{ - //[UserbuttonClicked_Pre] - //[/UserbuttonClicked_Pre] - - if (buttonThatWasClicked == opMode) - { - //[UserButtonCode_opMode] -- add your button handler code here.. - repaint(); - //[/UserButtonCode_opMode] - } - - //[UserbuttonClicked_Post] - //[/UserbuttonClicked_Post] -} - - - -//[MiscUserCode] You can add your own definitions of your custom methods or any other code here... -void OperatorEditor::bind(DexedAudioProcessor *parent, int op) { - parent->opCtrl[op].egLevel[0]->bind(s_egl1); - parent->opCtrl[op].egLevel[1]->bind(s_egl2); - parent->opCtrl[op].egLevel[2]->bind(s_egl3); - parent->opCtrl[op].egLevel[3]->bind(s_egl4); - parent->opCtrl[op].egRate[0]->bind(s_egv1); - parent->opCtrl[op].egRate[1]->bind(s_egv2); - parent->opCtrl[op].egRate[2]->bind(s_egv3); - parent->opCtrl[op].egRate[3]->bind(s_egv4); - parent->opCtrl[op].level->bind(opLevel); - parent->opCtrl[op].opMode->bind(opMode); - parent->opCtrl[op].fine->bind(opFine); - parent->opCtrl[op].coarse->bind(opCoarse); - parent->opCtrl[op].detune->bind(detune); - parent->opCtrl[op].sclBrkPt->bind(sclLvlBrkPt); - parent->opCtrl[op].sclLeftCurve->bind(kbdLeftCurve); - parent->opCtrl[op].sclRightCurve->bind(kbdRightCurve); - parent->opCtrl[op].sclLeftDepth->bind(sclLeftLevel); - parent->opCtrl[op].sclRightDepth->bind(sclRightLevel); - parent->opCtrl[op].sclRate->bind(sclRateScaling); - parent->opCtrl[op].ampModSens->bind(ampModSens); - parent->opCtrl[op].velModSens->bind(keyVelSens); - parent->opCtrl[op].opSwitch->bind(opSwitch); - - int offset = parent->opCtrl[op].egRate[0]->getOffset(); - envDisplay->pvalues = &(parent->data[offset]); - processor = parent; - - opNum << op + 1; - internalOp = 5-op; -} - -void OperatorEditor::updateGain(float v) { - vu->v = v; - vu->repaint(); -} - -void OperatorEditor::updateDisplay() { - float freq = opCoarse->getValue(); - float fine = opFine->getValue(); - String txtFreq; - - if (opMode->getToggleState() == 0) { - if ( freq == 0 ) - freq = 0.5; - txtFreq << "f = " << (freq + (freq * (fine/100))); - } else { - freq = pow(10,((int)freq)&3); - freq = freq * exp(M_LN10*(fine/100)); - txtFreq << freq << " Hz"; - } - - int det = detune->getValue(); - if ( det != 0 ) { - if ( det > 0 ) - txtFreq << " +" << det; - else - txtFreq << " " << det; - } - khzDisplay->setText(txtFreq, dontSendNotification); - repaint(); -} - - -void OperatorEditor::updateEnvPos(char pos) { - envDisplay->vPos = pos; - envDisplay->repaint(); -} - -void OperatorEditor::mouseDown(const MouseEvent &event) { - if ( event.mods.isRightButtonDown() ) { - PopupMenu popup; - - popup.addItem(1, "Copy Operator Values"); - popup.addItem(2, "Paste Envelope Values", processor->hasClipboardContent()); - popup.addItem(3, "Paste Operator Values", processor->hasClipboardContent()); - popup.addSeparator(); - popup.addItem(4, "Send current program to DX7"); - - switch(popup.show()) { - case 1: - processor->copyToClipboard(internalOp); - break; - - case 2: - processor->pasteEnvFromClipboard(internalOp); - break; - - case 3: - processor->pasteOpFromClipboard(internalOp); - break; - - case 4: - processor->sendCurrentSysexProgram(); - break; - } - - } -} - -//[/MiscUserCode] - - -//============================================================================== -#if 0 -/* -- Introjucer information section -- - - This is where the Introjucer stores the metadata that describe this GUI layout, so - make changes in here at your peril! - -BEGIN_JUCER_METADATA - - - - - - - - - - - - - - - - -END_JUCER_METADATA -*/ -#endif - - -//[EndFile] You can add extra defines here... -//[/EndFile] diff --git a/src/trash/OperatorEditor.h b/src/trash/OperatorEditor.h deleted file mode 100644 index 5576762..0000000 --- a/src/trash/OperatorEditor.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - ============================================================================== - - This is an automatically generated GUI class created by the Introjucer! - - Be careful when adding custom code to these files, as only the code within - the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded - and re-saved. - - Created with Introjucer version: 3.2.0 - - ------------------------------------------------------------------------------ - - The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions" - Copyright (c) 2015 - ROLI Ltd. - - ============================================================================== -*/ - -#ifndef __JUCE_HEADER_F21C2CC3FAD5D98E__ -#define __JUCE_HEADER_F21C2CC3FAD5D98E__ - -//[Headers] -- You can add your own extra header files here -- -#include "JuceHeader.h" -#include "PluginProcessor.h" -#include "DXComponents.h" -#include "DXLookNFeel.h" -//[/Headers] - - - -//============================================================================== -/** - //[Comments] - An auto-generated component, created by the Introjucer. - - Describe your class and how it works here! - //[/Comments] -*/ -class OperatorEditor : public Component, - public SliderListener, - public ButtonListener -{ -public: - //============================================================================== - OperatorEditor (); - ~OperatorEditor(); - - //============================================================================== - //[UserMethods] -- You can add your own custom methods in this section. - - void bind(DexedAudioProcessor *processor, int num); - void updateGain(float v); - void updateDisplay(); - void updateEnvPos(char pos); - void mouseDown(const MouseEvent& e) override; - //[/UserMethods] - - void paint (Graphics& g) override; - void resized() override; - void sliderValueChanged (Slider* sliderThatWasMoved) override; - void buttonClicked (Button* buttonThatWasClicked) override; - - - -private: - //[UserVariables] -- You can add your own custom variables in this section. - String opNum; - int internalOp; - Image light; - DexedAudioProcessor *processor; - Image background; - ScopedPointer opSwitch; - //[/UserVariables] - - //============================================================================== - ScopedPointer s_egl1; - ScopedPointer s_egl2; - ScopedPointer s_egl3; - ScopedPointer s_egl4; - ScopedPointer s_egv1; - ScopedPointer s_egv2; - ScopedPointer s_egv3; - ScopedPointer s_egv4; - ScopedPointer opLevel; - ScopedPointer opFine; - ScopedPointer opCoarse; - ScopedPointer