1 /* 2 * Author: Harry van Haaren 2013 3 * harryhaaren@gmail.com 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #ifndef LUPPP_GUI 20 #define LUPPP_GUI 21 22 #include <vector> 23 #include <string> 24 #include <memory> 25 26 #include <FL/Fl.H> 27 #include <FL/Fl_Double_Window.H> 28 29 #include "goptions.hxx" 30 31 #include "config.hxx" 32 #include "gtrack.hxx" 33 #include "gunittrack.hxx" 34 #include "gmastertrack.hxx" 35 #include "gaudioeditor.hxx" 36 37 #include "diskwriter.hxx" 38 #include "diskreader.hxx" 39 40 // non-session-manager integration 41 #include "nsm.h" 42 43 44 using namespace std; 45 46 class AudioBuffer; 47 48 class Gui 49 { 50 public: 51 Gui(const char* argZero); 52 ~Gui(); 53 54 int show(); 55 56 int quit(); 57 void askQuit(); 58 59 /// returns the options window 60 OptionsWindow* getOptionsWindow(); 61 62 /// open audio editor window with an AudioBuffer 63 AudioEditor* getAudioEditor(); 64 65 /// resets the state to "new" 66 void reset(); 67 68 /// sets up MIDI controllers: must be done *after* backend is started 69 void addMidiControllerToSetup(std::string); 70 void setupMidiControllers(); 71 72 std::shared_ptr<GTrack> getTrack(int id) const; getMasterTrack()73 GMasterTrack* getMasterTrack() 74 { 75 return master; 76 } 77 getDiskWriter()78 DiskWriter* getDiskWriter() 79 { 80 return diskWriter; 81 } getDiskReader()82 DiskReader* getDiskReader() 83 { 84 return diskReader; 85 } 86 87 /// used to load samples into the grid 88 void selectLoadSample( int track, int clip ); 89 void selectSaveSample( int track, int clip ); 90 char* selectSavePath(); 91 92 /// allows the user to select a Controller definition 93 static void selectLoadController(Fl_Widget* w, void*); 94 95 96 int samplerate; 97 98 ////Enable per track send and resturn jack ports 99 bool enablePerTrackOutput; 100 getWindowWidth()101 int getWindowWidth() 102 { 103 return window.w(); 104 } 105 getNsm()106 nsm_client_t* getNsm() 107 { 108 return nsm; 109 } 110 111 112 /// current special clip: 113 int specialTrack; 114 int specialScene; 115 116 /// The project directory is the default directoy which is shown upon load/save 117 void setProjectsDir(string dir); 118 string getProjectsDir(); 119 120 // save a particular sample to path 121 std::string saveBufferPath; 122 123 private: 124 vector<std::string> controllerVector; 125 126 Fl_Double_Window window; 127 128 Fl_Group* lupppGroup; 129 130 OptionsWindow* optionWindow; 131 132 std::string lupppProjectsDir; 133 134 AudioEditor* audioEditor; 135 136 DiskReader* diskReader; 137 DiskWriter* diskWriter; 138 139 GMasterTrack* master; 140 141 vector<std::shared_ptr<GTrack>> tracks; 142 143 // FIXME: refactor tooltip code out..? 144 std::string tooltip; 145 Fl_Box* tooltipLabel; 146 147 // non-session-manager 148 nsm_client_t* nsm; 149 150 static int keyboardHandler(int event); 151 }; 152 153 #endif // LUPPP_GUI 154