| @@ -23,7 +23,7 @@ HAVE_LINUXSAMPLER = $(shell pkg-config --exists linuxsampler && echo true) | |||
| endif | |||
| HAVE_ZYN_DEPS = $(shell pkg-config --exists fftw3 mxml && echo true) | |||
| HAVE_ZYN_GUI_DEPS = $(shell pkg-config --exists ntk && echo true) | |||
| HAVE_ZYN_GUI_DEPS = $(shell pkg-config --exists ntk ntk_images && echo true) | |||
| # -------------------------------------------------------------- | |||
| @@ -72,7 +72,7 @@ ifeq ($(HAVE_ZYN_DEPS),true) | |||
| LINK_FLAGS += $(shell pkg-config --libs fftw3 mxml) | |||
| ifeq ($(HAVE_ZYN_GUI_DEPS),true) | |||
| LINK_FLAGS += $(shell pkg-config --libs ntk) | |||
| LINK_FLAGS += $(shell pkg-config --libs ntk ntk_images) | |||
| endif | |||
| endif | |||
| @@ -7,7 +7,7 @@ | |||
| include ../Makefile.mk | |||
| HAVE_ZYN_DEPS = $(shell pkg-config --exists fftw3 mxml && echo true) | |||
| HAVE_ZYN_GUI_DEPS = $(shell pkg-config --exists ntk && echo true) | |||
| HAVE_ZYN_GUI_DEPS = $(shell pkg-config --exists ntk ntk_images && echo true) | |||
| # -------------------------------------------------------------- | |||
| @@ -19,7 +19,7 @@ ifeq ($(HAVE_ZYN_DEPS),true) | |||
| BUILD_CXX_FLAGS += $(shell pkg-config --cflags fftw3 mxml) -DWANT_ZYNADDSUBFX | |||
| ifeq ($(HAVE_ZYN_GUI_DEPS),true) | |||
| BUILD_CXX_FLAGS += $(shell pkg-config --cflags ntk) -DWANT_ZYNADDSUBFX_GUI | |||
| BUILD_CXX_FLAGS += $(shell pkg-config --cflags ntk ntk_images) -DWANT_ZYNADDSUBFX_GUI | |||
| endif | |||
| endif | |||
| @@ -1,6 +1,6 @@ | |||
| # QtCreator project file | |||
| QT = core gui | |||
| QT = core # gui | |||
| CONFIG = debug | |||
| CONFIG += static | |||
| @@ -11,7 +11,7 @@ DEFINES += QTCREATOR_TEST | |||
| DEFINES += WANT_ZYNADDSUBFX WANT_ZYNADDSUBFX_GUI | |||
| PKGCONFIG = fftw3 mxml ntk | |||
| PKGCONFIG = fftw3 mxml ntk ntk_images | |||
| TARGET = carla_native | |||
| TEMPLATE = app #lib | |||
| @@ -42,6 +42,9 @@ INCLUDEPATH = . distrho \ | |||
| ../carla-utils \ | |||
| ../distrho-plugin-toolkit | |||
| # FIX | |||
| INCLUDEPATH += /usr/include/ntk | |||
| LIBS = -lGL | |||
| QMAKE_CFLAGS *= -std=c99 | |||
| @@ -19,7 +19,7 @@ | |||
| # include "carla_utils.hpp" | |||
| # include "carla_native.h" | |||
| # include <vector> | |||
| # include <QApplication> | |||
| //# include <QApplication> | |||
| #endif | |||
| #if defined(__WIN32__) || defined(__WIN64__) | |||
| @@ -67,9 +67,15 @@ void carla_register_native_plugin(const PluginDescriptor* desc) | |||
| descs.push_back(desc); | |||
| } | |||
| #include <FL/Fl.H> | |||
| int main(int argc, char* argv[]) | |||
| { | |||
| QApplication app(argc, argv, true); | |||
| //QApplication app(argc, argv, true); | |||
| Fl::args(argc, argv); | |||
| //QDialog guiTest; | |||
| // Available plugins | |||
| carla_register_native_plugin_bypass(); | |||
| @@ -88,6 +94,7 @@ int main(int argc, char* argv[]) | |||
| ui_parameter_changed, ui_custom_data_changed | |||
| }; | |||
| #if 0 | |||
| // test fast init & cleanup | |||
| for (auto it = descs.begin(); it != descs.end(); it++) | |||
| { | |||
| @@ -137,6 +144,28 @@ int main(int argc, char* argv[]) | |||
| if (desc->cleanup) | |||
| desc->cleanup(handle); | |||
| } | |||
| #endif | |||
| const PluginDescriptor* zynDesc = descs[2]; | |||
| PluginHandle zynHandle = zynDesc->instantiate(zynDesc, &host); | |||
| zynDesc->activate(zynHandle); | |||
| zynDesc->ui_show(zynHandle, true); | |||
| // close app when this dialog is closed | |||
| //guiTest.show(); | |||
| //fl_display | |||
| //int ret = app.exec(); | |||
| Fl::redraw(); | |||
| int ret = Fl::run(); | |||
| zynDesc->ui_show(zynHandle, false); | |||
| zynDesc->activate(zynHandle); | |||
| zynDesc->cleanup(zynHandle); | |||
| return ret; | |||
| // test 3BandEQ GUI | |||
| // TODO | |||
| @@ -1,4 +1,9 @@ | |||
| #define NTK_GUI 1 | |||
| #define PIXMAP_PATH "/usr/share/zynaddsubfx/pixmaps/" | |||
| #define SOURCE_DIR "/usr/share/zynaddsubfx/pixmaps/nothing-here" | |||
| // zynaddsubfx includes | |||
| #include "zynaddsubfx/DSP/AnalogFilter.cpp" | |||
| #include "zynaddsubfx/DSP/FFTwrapper.cpp" | |||
| @@ -56,3 +61,25 @@ | |||
| #include "zynaddsubfx/Synth/Resonance.cpp" | |||
| #include "zynaddsubfx/Synth/SUBnote.cpp" | |||
| #include "zynaddsubfx/Synth/SynthNote.cpp" | |||
| #ifdef WANT_ZYNADDSUBFX_GUI | |||
| # include "zynaddsubfx/UI/NioUI.h" | |||
| # include "zynaddsubfx/UI/ADnoteUI.cc" | |||
| # include "zynaddsubfx/UI/BankUI.cc" | |||
| # include "zynaddsubfx/UI/ConfigUI.cc" | |||
| # include "zynaddsubfx/UI/EffUI.cc" | |||
| # include "zynaddsubfx/UI/EnvelopeUI.cc" | |||
| # include "zynaddsubfx/UI/FilterUI.cc" | |||
| # include "zynaddsubfx/UI/LFOUI.cc" | |||
| # include "zynaddsubfx/UI/MasterUI.cc" | |||
| # include "zynaddsubfx/UI/MicrotonalUI.cc" | |||
| # include "zynaddsubfx/UI/OscilGenUI.cc" | |||
| # include "zynaddsubfx/UI/PADnoteUI.cc" | |||
| # include "zynaddsubfx/UI/PartUI.cc" | |||
| # include "zynaddsubfx/UI/PresetsUI.cc" | |||
| # include "zynaddsubfx/UI/ResonanceUI.cc" | |||
| # include "zynaddsubfx/UI/SUBnoteUI.cc" | |||
| # include "zynaddsubfx/UI/VirKeyboard.cc" | |||
| # include "zynaddsubfx/UI/WidgetPDial.cpp" | |||
| # include "zynaddsubfx/UI/NioUI.cpp" | |||
| #endif | |||
| @@ -23,6 +23,29 @@ | |||
| #include <climits> | |||
| #ifdef WANT_ZYNADDSUBFX_GUI | |||
| # define PIXMAP_PATH "/usr/share/zynaddsubfx/pixmaps" | |||
| # define SOURCE_DIR "" | |||
| # include <FL/Fl.H> | |||
| # include <FL/Fl_Shared_Image.H> | |||
| # include <FL/Fl_Tiled_Image.H> | |||
| # include <FL/Fl_Dial.H> | |||
| # include "zynaddsubfx/UI/MasterUI.h" | |||
| // this is used to know wherever gui stuff is initialized | |||
| static Fl_Tiled_Image* s_moduleBackdrop = nullptr; | |||
| void set_module_parameters(Fl_Widget* o) | |||
| { | |||
| o->box(FL_DOWN_FRAME); | |||
| o->align(o->align() | FL_ALIGN_IMAGE_BACKDROP); | |||
| o->color(FL_BLACK ); | |||
| o->image(s_moduleBackdrop); | |||
| o->labeltype(FL_SHADOW_LABEL); | |||
| } | |||
| #endif | |||
| SYNTH_T* synth = nullptr; | |||
| class ZynAddSubFxPlugin : public PluginDescriptorClass | |||
| @@ -38,7 +61,11 @@ public: | |||
| { | |||
| qDebug("ZynAddSubFxPlugin::ZynAddSubFxPlugin(), s_instanceCount=%i", s_instanceCount); | |||
| m_master = new Master; | |||
| m_master = new Master; | |||
| #ifdef WANT_ZYNADDSUBFX_GUI | |||
| m_masterUI = nullptr; | |||
| m_uiClosed = 0; | |||
| #endif | |||
| // refresh banks | |||
| m_master->bank.rescanforbanks(); | |||
| @@ -70,8 +97,17 @@ public: | |||
| { | |||
| qDebug("ZynAddSubFxPlugin::~ZynAddSubFxPlugin(), s_instanceCount=%i", s_instanceCount); | |||
| //ensure that everything has stopped with the mutex wait | |||
| pthread_mutex_lock(&m_master->mutex); | |||
| pthread_mutex_unlock(&m_master->mutex); | |||
| m_programs.clear(); | |||
| #ifdef WANT_ZYNADDSUBFX_GUI | |||
| if (m_masterUI) | |||
| delete m_masterUI; | |||
| #endif | |||
| delete m_master; | |||
| } | |||
| @@ -183,6 +219,72 @@ protected: | |||
| } | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| // Plugin UI calls | |||
| #ifdef WANT_ZYNADDSUBFX_GUI | |||
| void uiShow(bool show) | |||
| { | |||
| if (! m_masterUI) | |||
| { | |||
| if (! s_moduleBackdrop) | |||
| { | |||
| fl_register_images(); | |||
| Fl_Dial::default_style(Fl_Dial::PIXMAP_DIAL); | |||
| if (Fl_Shared_Image* img = Fl_Shared_Image::get(PIXMAP_PATH "/knob.png")) | |||
| Fl_Dial::default_image(img); | |||
| else | |||
| Fl_Dial::default_image(Fl_Shared_Image::get(SOURCE_DIR "/../pixmaps/knob.png")); | |||
| if (Fl_Shared_Image* img = Fl_Shared_Image::get(PIXMAP_PATH "/window_backdrop.png")) | |||
| Fl::scheme_bg(new Fl_Tiled_Image(img)); | |||
| else | |||
| Fl::scheme_bg(new Fl_Tiled_Image(Fl_Shared_Image::get(SOURCE_DIR "/../pixmaps/window_backdrop.png"))); | |||
| if (Fl_Shared_Image* img = Fl_Shared_Image::get(PIXMAP_PATH "/module_backdrop.png")) | |||
| s_moduleBackdrop = new Fl_Tiled_Image(img); | |||
| else | |||
| s_moduleBackdrop = new Fl_Tiled_Image(Fl_Shared_Image::get(SOURCE_DIR "/../pixmaps/module_backdrop.png")); | |||
| Fl::background(50, 50, 50); | |||
| Fl::background2(70, 70, 70); | |||
| Fl::foreground(255, 255, 255); | |||
| } | |||
| m_masterUI = new MasterUI(m_master, &m_uiClosed); | |||
| } | |||
| if (show) | |||
| { | |||
| m_masterUI->showUI(); | |||
| } | |||
| else | |||
| { | |||
| // same as showUI | |||
| switch (config.cfg.UserInterfaceMode) | |||
| { | |||
| case 0: | |||
| m_masterUI->selectuiwindow->hide(); | |||
| break; | |||
| case 1: | |||
| m_masterUI->masterwindow->hide(); | |||
| break; | |||
| case 2: | |||
| m_masterUI->simplemasterwindow->hide(); | |||
| break; | |||
| }; | |||
| } | |||
| } | |||
| void uiIdle() | |||
| { | |||
| if (m_masterUI) | |||
| Fl::check(); | |||
| } | |||
| #endif | |||
| // ------------------------------------------------------------------- | |||
| // Plugin process calls | |||
| @@ -269,7 +371,11 @@ private: | |||
| }; | |||
| std::vector<ProgramInfo> m_programs; | |||
| Master* m_master; | |||
| Master* m_master; | |||
| #ifdef WANT_ZYNADDSUBFX_GUI | |||
| MasterUI* m_masterUI; | |||
| int m_uiClosed; | |||
| #endif | |||
| public: | |||
| static int s_instanceCount; | |||
| @@ -288,6 +394,8 @@ public: | |||
| config.cfg.SampleRate = synth->samplerate; | |||
| config.cfg.GzipCompression = 0; | |||
| //Nio::preferedSampleRate(synth->samplerate); | |||
| sprng(time(NULL)); | |||
| denormalkillbuf = new float [synth->buffersize]; | |||
| for (int i=0; i < synth->buffersize; i++) | |||
| @@ -305,6 +413,12 @@ public: | |||
| if (--s_instanceCount == 0) | |||
| { | |||
| if (s_moduleBackdrop) | |||
| { | |||
| delete s_moduleBackdrop; | |||
| s_moduleBackdrop = nullptr; | |||
| } | |||
| Master::deleteInstance(); | |||
| delete[] denormalkillbuf; | |||
| @@ -28,6 +28,7 @@ NioUI::NioUI() | |||
| //initialize midi list | |||
| { | |||
| #if 0 | |||
| set<string> midiList = Nio::getSources(); | |||
| string source = Nio::getSource(); | |||
| int midival = 0; | |||
| @@ -37,11 +38,15 @@ NioUI::NioUI() | |||
| if(*itr == source) | |||
| midival = midi->size() - 2; | |||
| } | |||
| #else | |||
| int midival = 0; | |||
| #endif | |||
| midi->value(midival); | |||
| } | |||
| //initialize audio list | |||
| { | |||
| #if 0 | |||
| set<string> audioList = Nio::getSinks(); | |||
| string sink = Nio::getSink(); | |||
| int audioval = 0; | |||
| @@ -51,6 +56,9 @@ NioUI::NioUI() | |||
| if(*itr == sink) | |||
| audioval = audio->size() - 2; | |||
| } | |||
| #else | |||
| int audioval = 0; | |||
| #endif | |||
| audio->value(audioval); | |||
| } | |||
| resizable(this); | |||
| @@ -1,4 +1,4 @@ | |||
| #ifndef NIOUI_H | |||
| #ifndef NIOUT_H | |||
| #define NIOUT_H | |||
| #include <FL/Fl.H> | |||