| @@ -90,6 +90,7 @@ carla-discovery-posix64 | |||
| carla-frontend | |||
| carla-lv2-export | |||
| bls1-ui | |||
| rev1-ui | |||
| zynaddsubfx-ui | |||
| @@ -412,7 +412,11 @@ ifeq ($(EXPERIMENTAL_PLUGINS),true) | |||
| install -d $(DESTDIR)$(PREFIX)/share/carla/resources/rev1/ | |||
| endif | |||
| install -d $(DESTDIR)$(PREFIX)/share/carla/resources/nekofilter/ | |||
| ifeq ($(HAVE_ZYN_DEPS),true) | |||
| ifeq ($(HAVE_ZYN_UI_DEPS),true) | |||
| install -d $(DESTDIR)$(PREFIX)/share/carla/resources/zynaddsubfx/ | |||
| endif | |||
| endif | |||
| install -d $(DESTDIR)$(PREFIX)/share/icons/hicolor/16x16/apps/ | |||
| install -d $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/ | |||
| install -d $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/ | |||
| @@ -531,6 +535,7 @@ ifeq ($(EXPERIMENTAL_PLUGINS),true) | |||
| $(DESTDIR)$(PREFIX)/share/carla/resources/rev1/ | |||
| install -m 755 \ | |||
| bin/resources/bls1-ui \ | |||
| bin/resources/rev1-ui \ | |||
| $(DESTDIR)$(PREFIX)/share/carla/resources/ | |||
| endif | |||
| @@ -541,13 +546,13 @@ endif | |||
| ifeq ($(HAVE_ZYN_DEPS),true) | |||
| ifeq ($(HAVE_ZYN_UI_DEPS),true) | |||
| install -m 755 \ | |||
| bin/resources/zynaddsubfx-ui \ | |||
| $(DESTDIR)$(PREFIX)/share/carla/resources/ | |||
| install -m 644 \ | |||
| bin/resources/zynaddsubfx/*.png \ | |||
| $(DESTDIR)$(PREFIX)/share/carla/resources/zynaddsubfx/ | |||
| install -m 755 \ | |||
| bin/resources/zynaddsubfx-ui \ | |||
| $(DESTDIR)$(PREFIX)/share/carla/resources/ | |||
| endif | |||
| endif | |||
| @@ -13,6 +13,19 @@ include ../modules/Makefile.mk | |||
| BUILD_C_FLAGS += -I.. | |||
| BUILD_CXX_FLAGS += -I.. -isystem $(CWD)/modules -I$(CWD)/modules/distrho | |||
| # ---------------------------------------------------------------------------------------------------------------------------- | |||
| # Flags for Zita UIs | |||
| ifeq ($(EXPERIMENTAL_PLUGINS),true) | |||
| ZITA_DSP_CXX_FLAGS = $(BUILD_CXX_FLAGS) -Wno-unused-parameter | |||
| ZITA_DSP_CXX_FLAGS += $(shell pkg-config --cflags fftw3f) | |||
| ZITA_UI_CXX_FLAGS = $(BUILD_CXX_FLAGS) -Wno-unused-parameter -Wno-ignored-qualifiers | |||
| ZITA_UI_CXX_FLAGS += $(shell pkg-config --cflags cairo libpng12 x11 xft zlib) | |||
| ZITA_UI_LINK_FLAGS = $(LINK_FLAGS) -lclxclient -lclthreads | |||
| ZITA_UI_LINK_FLAGS += $(shell pkg-config --libs cairo libpng12 x11 xft zlib) | |||
| ZITA_UI_LINK_FLAGS += -ldl -lpthread -lrt | |||
| endif # EXPERIMENTAL_PLUGINS | |||
| # ---------------------------------------------------------------------------------------------------------------------------- | |||
| # Flags for ZynAddSubFX | |||
| @@ -156,7 +169,9 @@ OBJS += \ | |||
| $(OBJDIR)/zita-bls1.cpp.o \ | |||
| $(OBJDIR)/zita-rev1.cpp.o | |||
| TARGETS += resources/rev1-ui$(APP_EXT) | |||
| TARGETS += \ | |||
| resources/bls1-ui$(APP_EXT) \ | |||
| resources/rev1-ui$(APP_EXT) | |||
| endif | |||
| # ---------------------------------------------------------------------------------------------------------------------------- | |||
| @@ -179,10 +194,15 @@ $(MODULEDIR)/$(MODULENAME).a: $(OBJS) | |||
| @rm -f $@ | |||
| @$(AR) crs $@ $^ | |||
| resources/bls1-ui$(APP_EXT): $(OBJDIR)/zita-bls1-ui.cpp.o | |||
| -@mkdir -p $(OBJDIR) | |||
| @echo "Linking zita-bls1-ui" | |||
| @$(CXX) $^ $(ZITA_UI_LINK_FLAGS) -o $@ | |||
| resources/rev1-ui$(APP_EXT): $(OBJDIR)/zita-rev1-ui.cpp.o | |||
| -@mkdir -p $(OBJDIR) | |||
| @echo "Linking zita-rev1-ui" | |||
| @$(CXX) $^ $(LINK_FLAGS) -lclxclient -lclthreads $(shell pkg-config --libs cairo libpng12 x11 xft zlib) -ldl -lpthread -lrt -o $@ | |||
| @$(CXX) $^ $(ZITA_UI_LINK_FLAGS) -o $@ | |||
| resources/zynaddsubfx-ui$(APP_EXT): $(OBJDIR)/zynaddsubfx-ui.cpp.o | |||
| -@mkdir -p $(OBJDIR) | |||
| @@ -281,25 +301,21 @@ $(OBJDIR)/zynaddsubfx-ui.cpp.o: zynaddsubfx-ui.cpp $(ZYN_UI_FILES_H) $(ZYN_UI_FI | |||
| # ---------------------------------------------------------------------------------------------------------------------------- | |||
| $(OBJDIR)/zita-at1.cpp.o: zita-at1.cpp | |||
| -@mkdir -p $(OBJDIR) | |||
| @echo "Compiling $<" | |||
| @$(CXX) $< $(BUILD_CXX_FLAGS) $(shell pkg-config --cflags fftw3f x11 xft) -Wno-unused-parameter -Wno-unused-result -c -o $@ | |||
| $(OBJDIR)/zita-bls1.cpp.o: zita-bls1.cpp | |||
| $(OBJDIR)/zita-%.cpp.o: zita-%.cpp | |||
| -@mkdir -p $(OBJDIR) | |||
| @echo "Compiling $<" | |||
| @$(CXX) $< $(BUILD_CXX_FLAGS) $(shell pkg-config --cflags fftw3f x11 xft) -Wno-unused-parameter -Wno-unused-result -c -o $@ | |||
| @$(CXX) $< $(ZITA_DSP_CXX_FLAGS) -c -o $@ | |||
| $(OBJDIR)/zita-rev1.cpp.o: zita-rev1.cpp | |||
| $(OBJDIR)/zita-%-ui.cpp.o: zita-%-ui.cpp | |||
| -@mkdir -p $(OBJDIR) | |||
| @echo "Compiling $<" | |||
| @$(CXX) $< $(BUILD_CXX_FLAGS) $(shell pkg-config --cflags fftw3f) -Wno-unused-parameter -c -o $@ | |||
| @$(CXX) $< $(ZITA_UI_CXX_FLAGS) -c -o $@ | |||
| $(OBJDIR)/zita-rev1-ui.cpp.o: zita-rev1-ui.cpp | |||
| # TODO | |||
| $(OBJDIR)/zita-at1.cpp.o: zita-at1.cpp | |||
| -@mkdir -p $(OBJDIR) | |||
| @echo "Compiling $<" | |||
| @$(CXX) $< $(BUILD_CXX_FLAGS) $(shell pkg-config --cflags cairo libpng12 x11 xft zlib) -Wno-unused-parameter -Wno-ignored-qualifiers -c -o $@ | |||
| @$(CXX) $< $(BUILD_CXX_FLAGS) $(shell pkg-config --cflags fftw3f x11 xft) -Wno-unused-parameter -Wno-unused-result -c -o $@ | |||
| # ---------------------------------------------------------------------------------------------------------------------------- | |||
| @@ -311,7 +327,8 @@ $(OBJDIR)/%.cpp.o: %.cpp | |||
| # ---------------------------------------------------------------------------------------------------------------------------- | |||
| -include $(OBJS:%.o=%.d) | |||
| -include $(OBJDIR)/zita-rev-ui.cpp.d | |||
| -include $(OBJDIR)/zita-bls1-ui.cpp.d | |||
| -include $(OBJDIR)/zita-rev1-ui.cpp.d | |||
| -include $(OBJDIR)/zynaddsubfx-ui.cpp.d | |||
| # ---------------------------------------------------------------------------------------------------------------------------- | |||
| @@ -0,0 +1,191 @@ | |||
| /* | |||
| * Carla Native Plugins | |||
| * Copyright (C) 2012-2015 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * 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 2 of | |||
| * the License, or 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. | |||
| * | |||
| * For a full copy of the GNU General Public License see the doc/GPL.txt file. | |||
| */ | |||
| #include "CarlaPipeUtils.cpp" | |||
| #include "zita-bls1/png2img.cc" | |||
| #include "zita-bls1/guiclass.cc" | |||
| #include "zita-bls1/mainwin.cc" | |||
| #include "zita-bls1/rotary.cc" | |||
| #include "zita-bls1/styles.cc" | |||
| using namespace BLS1; | |||
| static Mainwin* mainwin = nullptr; | |||
| // -------------------------------------------------------------------------------------------- | |||
| class ZitaPipeClient : public CarlaPipeClient, | |||
| public Mainwin::ValueChangedCallback | |||
| { | |||
| public: | |||
| ZitaPipeClient() noexcept | |||
| : CarlaPipeClient(), | |||
| fQuitReceived(false) {} | |||
| ~ZitaPipeClient() noexcept override | |||
| { | |||
| if (fQuitReceived || ! isPipeRunning()) | |||
| return; | |||
| const CarlaMutexLocker cml(getPipeLock()); | |||
| writeMessage("exiting\n"); | |||
| flushMessages(); | |||
| } | |||
| bool quitRequested() const noexcept | |||
| { | |||
| return fQuitReceived; | |||
| } | |||
| protected: | |||
| bool msgReceived(const char* const msg) noexcept override | |||
| { | |||
| if (std::strcmp(msg, "control") == 0) | |||
| { | |||
| uint index; | |||
| float value; | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(index), true); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsFloat(value), true); | |||
| mainwin->_rotary[index]->set_value(value); | |||
| return true; | |||
| } | |||
| if (std::strcmp(msg, "show") == 0) | |||
| { | |||
| mainwin->x_map(); | |||
| return true; | |||
| } | |||
| if (std::strcmp(msg, "hide") == 0) | |||
| { | |||
| mainwin->x_unmap(); | |||
| return true; | |||
| } | |||
| if (std::strcmp(msg, "focus") == 0) | |||
| { | |||
| mainwin->x_mapraised(); | |||
| return true; | |||
| } | |||
| if (std::strcmp(msg, "uiTitle") == 0) | |||
| { | |||
| const char* uiTitle; | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsString(uiTitle), true); | |||
| mainwin->x_set_title(uiTitle); | |||
| return true; | |||
| } | |||
| if (std::strcmp(msg, "quit") == 0) | |||
| { | |||
| fQuitReceived = true; | |||
| return true; | |||
| } | |||
| carla_stderr("ZitaPipeClient::msgReceived : %s", msg); | |||
| return false; | |||
| } | |||
| void valueChangedCallback(uint index, double value) override | |||
| { | |||
| if (isPipeRunning()) | |||
| writeControlMessage(index, value); | |||
| } | |||
| private: | |||
| bool fQuitReceived; | |||
| }; | |||
| // -------------------------------------------------------------------------------------------- | |||
| int main(int argc, const char* argv[]) | |||
| { | |||
| X_resman xresman; | |||
| X_display *display; | |||
| X_handler *handler; | |||
| X_rootwin *rootwin; | |||
| int ev, xp, yp, xs, ys; | |||
| int fake_argc = 1; | |||
| char* fake_argv[] = { (char*)"rev1" }; | |||
| xresman.init(&fake_argc, fake_argv, (char*)"rev1", nullptr, 0); | |||
| display = new X_display(nullptr); | |||
| if (display->dpy () == 0) | |||
| { | |||
| carla_stderr("Can't open display."); | |||
| delete display; | |||
| return 1; | |||
| } | |||
| ZitaPipeClient pipe; | |||
| const char* uiTitle = "Test UI"; | |||
| if (argc > 1) | |||
| { | |||
| uiTitle = argv[2]; | |||
| if (! pipe.initPipeClient(argv)) | |||
| return 1; | |||
| } | |||
| xp = yp = 100; | |||
| xs = Mainwin::XSIZE + 4; | |||
| ys = Mainwin::YSIZE + 30; | |||
| xresman.geometry(".geometry", display->xsize(), display->ysize(), 1, xp, yp, xs, ys); | |||
| styles_init(display, &xresman); | |||
| rootwin = new X_rootwin(display); | |||
| mainwin = new Mainwin(rootwin, &xresman, xp, yp, &pipe); | |||
| mainwin->x_set_title(uiTitle); | |||
| rootwin->handle_event(); | |||
| handler = new X_handler(display, mainwin, EV_X11); | |||
| handler->next_event(); | |||
| XFlush(display->dpy()); | |||
| do | |||
| { | |||
| ev = mainwin->process(); | |||
| if (ev == EV_X11) | |||
| { | |||
| rootwin->handle_event(); | |||
| handler->next_event(); | |||
| } | |||
| else if (ev == Esync::EV_TIME) | |||
| { | |||
| handler->next_event(); | |||
| if (pipe.isPipeRunning()) | |||
| pipe.idlePipe(); | |||
| } | |||
| } | |||
| while (ev != EV_EXIT && ! pipe.quitRequested()); | |||
| styles_fini(display); | |||
| delete handler; | |||
| delete rootwin; | |||
| delete display; | |||
| return 0; | |||
| } | |||
| // -------------------------------------------------------------------------------------------- | |||
| @@ -15,22 +15,15 @@ | |||
| * For a full copy of the GNU General Public License see the doc/GPL.txt file. | |||
| */ | |||
| #include "CarlaNative.hpp" | |||
| #include "CarlaMathUtils.hpp" | |||
| #include "CarlaNativeExtUI.hpp" | |||
| #include "CarlaJuceUtils.hpp" | |||
| #include "juce_audio_basics.h" | |||
| #include "zita-common.hpp" | |||
| #include "zita-bls1/guiclass.cc" | |||
| #include "zita-bls1/hp3filt.cc" | |||
| #include "zita-bls1/jclient.cc" | |||
| #include "zita-bls1/lfshelf2.cc" | |||
| #include "zita-bls1/mainwin.cc" | |||
| #include "zita-bls1/png2img.cc" | |||
| #include "zita-bls1/rotary.cc" | |||
| #include "zita-bls1/shuffler.cc" | |||
| #include "zita-bls1/styles.cc" | |||
| using juce::FloatVectorOperations; | |||
| using juce::ScopedPointer; | |||
| @@ -40,9 +33,7 @@ using namespace BLS1; | |||
| // ----------------------------------------------------------------------- | |||
| // BLS1 Plugin | |||
| class BLS1Plugin : public NativePluginClass, | |||
| public X_handler_thread<Mainwin>::SetValueCallback, | |||
| private Mainwin::ValueChangedCallback | |||
| class BLS1Plugin : public NativePluginAndUiClass | |||
| { | |||
| public: | |||
| static const uint32_t kNumInputs = 2; | |||
| @@ -59,15 +50,9 @@ public: | |||
| }; | |||
| BLS1Plugin(const NativeHostDescriptor* const host) | |||
| : NativePluginClass(host), | |||
| : NativePluginAndUiClass(host, "bls1-ui"), | |||
| fJackClient(), | |||
| xresman(), | |||
| jclient(nullptr), | |||
| display(nullptr), | |||
| rootwin(nullptr), | |||
| mainwin(nullptr), | |||
| handler(nullptr), | |||
| handlerThread(this), | |||
| leakDetector_BLS1Plugin() | |||
| { | |||
| CARLA_SAFE_ASSERT(host != nullptr); | |||
| @@ -78,12 +63,6 @@ public: | |||
| fJackClient.bufferSize = getBufferSize(); | |||
| fJackClient.sampleRate = getSampleRate(); | |||
| int argc = 1; | |||
| char* argv[] = { (char*)"bls1" }; | |||
| xresman.init(&argc, argv, (char*)"bls1", nullptr, 0); | |||
| jclient = new Jclient(xresman.rname(), &fJackClient); | |||
| // set initial values | |||
| fParameters[kParameterINPBAL] = 0.0f; | |||
| fParameters[kParameterHPFILT] = 40.0f; | |||
| @@ -92,10 +71,7 @@ public: | |||
| fParameters[kParameterLFFREQ] = 80.0f; | |||
| fParameters[kParameterLFGAIN] = 0.0f; | |||
| jclient->set_inpbal(fParameters[kParameterINPBAL]); | |||
| jclient->set_hpfilt(fParameters[kParameterHPFILT]); | |||
| jclient->shuffler()->prepare(fParameters[kParameterSHGAIN], fParameters[kParameterSHFREQ]); | |||
| jclient->set_loshelf(fParameters[kParameterLFGAIN], fParameters[kParameterLFFREQ]); | |||
| _recreateZitaClient(); | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| @@ -238,120 +214,19 @@ public: | |||
| fJackClient.processCallback(frames, fJackClient.processPtr); | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| // Plugin UI calls | |||
| void uiShow(const bool show) override | |||
| { | |||
| if (show) | |||
| { | |||
| if (display != nullptr) | |||
| return; | |||
| display = new X_display(nullptr); | |||
| if (display->dpy() == nullptr) | |||
| return hostUiUnavailable(); | |||
| styles_init(display, &xresman, getResourceDir()); | |||
| rootwin = new X_rootwin(display); | |||
| mainwin = new Mainwin(rootwin, &xresman, 0, 0, jclient, this); | |||
| rootwin->handle_event(); | |||
| mainwin->x_set_title(getUiName()); | |||
| handler = new X_handler(display, mainwin, EV_X11); | |||
| if (const uintptr_t winId = getUiParentId()) | |||
| XSetTransientForHint(display->dpy(), mainwin->win(), static_cast<Window>(winId)); | |||
| handler->next_event(); | |||
| XFlush(display->dpy()); | |||
| handlerThread.setupAndRun(handler, rootwin, mainwin); | |||
| } | |||
| else | |||
| { | |||
| if (handlerThread.isThreadRunning()) | |||
| handlerThread.stopThread(); | |||
| handler = nullptr; | |||
| mainwin = nullptr; | |||
| rootwin = nullptr; | |||
| display = nullptr; | |||
| } | |||
| } | |||
| void uiIdle() override | |||
| { | |||
| if (mainwin == nullptr) | |||
| return; | |||
| if (handlerThread.wasClosed()) | |||
| { | |||
| { | |||
| const CarlaMutexLocker cml(handlerThread.getLock()); | |||
| handler = nullptr; | |||
| mainwin = nullptr; | |||
| rootwin = nullptr; | |||
| display = nullptr; | |||
| } | |||
| uiClosed(); | |||
| } | |||
| } | |||
| void uiSetParameterValue(const uint32_t index, const float value) override | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(index < kParameterNROTARY,); | |||
| if (mainwin == nullptr) | |||
| return; | |||
| handlerThread.setParameterValueLater(index, value); | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| // Plugin dispatcher calls | |||
| void bufferSizeChanged(const uint32_t bufferSize) override | |||
| { | |||
| fJackClient.bufferSize = bufferSize; | |||
| _recreateZitaClient(); | |||
| } | |||
| void sampleRateChanged(const double sampleRate) override | |||
| { | |||
| fJackClient.sampleRate = sampleRate; | |||
| } | |||
| void uiNameChanged(const char* const uiName) override | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(uiName != nullptr && uiName[0] != '\0',); | |||
| if (mainwin == nullptr) | |||
| return; | |||
| const CarlaMutexLocker cml(handlerThread.getLock()); | |||
| mainwin->x_set_title(uiName); | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| // Mainwin callbacks | |||
| void valueChangedCallback(uint index, double value) override | |||
| { | |||
| fParameters[index] = value; | |||
| uiParameterChanged(index, value); | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| // X_handler_thread callbacks | |||
| void setParameterValueFromHandlerThread(uint32_t index, float value) override | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(mainwin != nullptr,); | |||
| mainwin->_rotary[index]->set_value(value); | |||
| _recreateZitaClient(); | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| @@ -361,16 +236,20 @@ private: | |||
| jack_client_t fJackClient; | |||
| // Zita stuff (core) | |||
| X_resman xresman; | |||
| ScopedPointer<Jclient> jclient; | |||
| ScopedPointer<X_display> display; | |||
| ScopedPointer<X_rootwin> rootwin; | |||
| ScopedPointer<Mainwin> mainwin; | |||
| ScopedPointer<X_handler> handler; | |||
| X_handler_thread<Mainwin> handlerThread; | |||
| ScopedPointer<Jclient> jclient; | |||
| // Parameters | |||
| float fParameters[kParameterNROTARY]; | |||
| void _recreateZitaClient() | |||
| { | |||
| jclient = new Jclient(&fJackClient); | |||
| jclient->set_inpbal(fParameters[kParameterINPBAL]); | |||
| jclient->set_hpfilt(fParameters[kParameterHPFILT]); | |||
| jclient->shuffler()->prepare(fParameters[kParameterSHGAIN], fParameters[kParameterSHFREQ]); | |||
| jclient->set_loshelf(fParameters[kParameterLFGAIN], fParameters[kParameterLFFREQ]); | |||
| } | |||
| PluginClassEND(BLS1Plugin) | |||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(BLS1Plugin) | |||
| }; | |||
| @@ -381,9 +260,7 @@ static const NativePluginDescriptor bls1Desc = { | |||
| /* category */ NATIVE_PLUGIN_CATEGORY_FILTER, | |||
| /* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_RTSAFE | |||
| |NATIVE_PLUGIN_HAS_UI | |||
| |NATIVE_PLUGIN_NEEDS_FIXED_BUFFERS | |||
| |NATIVE_PLUGIN_NEEDS_UI_MAIN_THREAD | |||
| |NATIVE_PLUGIN_USES_PARENT_ID), | |||
| |NATIVE_PLUGIN_NEEDS_FIXED_BUFFERS), | |||
| /* supports */ static_cast<NativePluginSupports>(0x0), | |||
| /* audioIns */ BLS1Plugin::kNumInputs, | |||
| /* audioOuts */ BLS1Plugin::kNumOutputs, | |||
| @@ -1,8 +1,8 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2011 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 2 of the License, or | |||
| @@ -1,8 +1,8 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2011 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 2 of the License, or | |||
| @@ -1,8 +1,8 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2011 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 2 of the License, or | |||
| @@ -1,8 +1,8 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2011 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 2 of the License, or | |||
| @@ -1,8 +1,8 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2011 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 2 of the License, or | |||
| @@ -1,8 +1,8 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2011 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 2 of the License, or | |||
| @@ -26,11 +26,10 @@ | |||
| namespace BLS1 { | |||
| Jclient::Jclient (const char *jname, jack_client_t *jclient) : | |||
| Jclient::Jclient (jack_client_t *jclient) : | |||
| A_thread ("Jclient"), | |||
| _jack_client (jclient), | |||
| _active (false), | |||
| _jname (0), | |||
| _inpbal0 (0), | |||
| _inpbal1 (0), | |||
| _ga (1.0f), | |||
| @@ -38,7 +37,7 @@ Jclient::Jclient (const char *jname, jack_client_t *jclient) : | |||
| _da (0.0f), | |||
| _db (0.0f) | |||
| { | |||
| init_jack (jname); | |||
| init_jack (); | |||
| } | |||
| @@ -48,37 +47,25 @@ Jclient::~Jclient (void) | |||
| } | |||
| void Jclient::init_jack (const char *jname) | |||
| void Jclient::init_jack (void) | |||
| { | |||
| struct sched_param spar; | |||
| int abspri, policy, k; | |||
| jack_set_process_callback (_jack_client, jack_static_process, (void *) this); | |||
| jack_on_shutdown (_jack_client, jack_static_shutdown, (void *) this); | |||
| jack_activate (_jack_client); | |||
| if (jack_activate (_jack_client)) | |||
| { | |||
| fprintf (stderr, "Can't activate JACK.\n"); | |||
| exit (1); | |||
| } | |||
| _jname = jack_get_client_name (_jack_client); | |||
| _fsamp = jack_get_sample_rate (_jack_client); | |||
| _psize = jack_get_buffer_size (_jack_client); | |||
| if (_psize > 4096) | |||
| { | |||
| fprintf (stderr, "Period size can't be more than 4096.\n"); | |||
| exit (1); | |||
| return; | |||
| } | |||
| if (_psize & (_psize - 1)) | |||
| { | |||
| fprintf (stderr, "Period size must be a power of 2.\n"); | |||
| exit (1); | |||
| return; | |||
| } | |||
| pthread_getschedparam (jack_client_thread_id (_jack_client), &policy, &spar); | |||
| abspri = spar.sched_priority; | |||
| _inpports [0] = jack_port_register (_jack_client, "inp.L", JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0); | |||
| _inpports [1] = jack_port_register (_jack_client, "inp.R", JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0); | |||
| _outports [0] = jack_port_register (_jack_client, "out.L", JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0); | |||
| @@ -87,10 +74,10 @@ void Jclient::init_jack (const char *jname) | |||
| _hpfilt.setfsamp (_fsamp); | |||
| _lshelf.setfsamp (_fsamp); | |||
| _lshelf.bypass (false); | |||
| _shuffl.init (_fsamp, _psize, abspri, policy); | |||
| _shuffl.init (_fsamp, _psize); | |||
| for (k = _fsamp, _fragm = 1024; k > 56000; k >>= 1, _fragm <<= 1); | |||
| for (int k = _fsamp, _fragm = 1024; k > 56000; k >>= 1, _fragm <<= 1); | |||
| _nsamp = 0; | |||
| _active = true; | |||
| } | |||
| @@ -1,8 +1,8 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2011 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 2 of the License, or | |||
| @@ -41,11 +41,9 @@ class Jclient : public A_thread | |||
| { | |||
| public: | |||
| Jclient (const char *jname, jack_client_t *jclient); | |||
| Jclient (jack_client_t *jclient); | |||
| ~Jclient (void); | |||
| const char *jname (void) const { return _jname; } | |||
| void set_inpbal (float diff) | |||
| { | |||
| _inpbal0 = diff; | |||
| @@ -68,7 +66,7 @@ public: | |||
| private: | |||
| void init_jack (const char *jname); | |||
| void init_jack (void); | |||
| void close_jack (void); | |||
| void jack_shutdown (void); | |||
| int jack_process (int nframes); | |||
| @@ -79,7 +77,6 @@ private: | |||
| jack_port_t *_inpports [2]; | |||
| jack_port_t *_outports [2]; | |||
| bool _active; | |||
| const char *_jname; | |||
| unsigned int _fsamp; | |||
| int _psize; | |||
| int _fragm; | |||
| @@ -1,8 +1,8 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2011 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 2 of the License, or | |||
| @@ -1,8 +1,8 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2011 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 2 of the License, or | |||
| @@ -1,8 +1,8 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2011 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 2 of the License, or | |||
| @@ -30,25 +30,21 @@ | |||
| namespace BLS1 { | |||
| Mainwin::Mainwin (X_rootwin *parent, X_resman *xres, int xp, int yp, Jclient *jclient, ValueChangedCallback* valuecb) : | |||
| Mainwin::Mainwin (X_rootwin *parent, X_resman *xres, int xp, int yp, ValueChangedCallback* valuecb) : | |||
| A_thread ("Main"), | |||
| X_window (parent, xp, yp, XSIZE, YSIZE, XftColors [C_MAIN_BG]->pixel), | |||
| _stop (false), | |||
| _xres (xres), | |||
| _jclient (jclient), | |||
| _touch (false), | |||
| _valuecb (valuecb) | |||
| { | |||
| X_hints H; | |||
| char s [1024]; | |||
| int i; | |||
| _atom = XInternAtom (dpy (), "WM_DELETE_WINDOW", True); | |||
| XSetWMProtocols (dpy (), win (), &_atom, 1); | |||
| _atom = XInternAtom (dpy (), "WM_PROTOCOLS", True); | |||
| sprintf (s, "%s", jclient->jname ()); | |||
| x_set_title (s); | |||
| H.position (xp, yp); | |||
| H.minsize (XSIZE, YSIZE); | |||
| H.maxsize (XSIZE, YSIZE); | |||
| @@ -56,6 +52,7 @@ Mainwin::Mainwin (X_rootwin *parent, X_resman *xres, int xp, int yp, Jclient *jc | |||
| H.rclas (xres->rclas ()); | |||
| x_apply (&H); | |||
| RotaryCtl::init (disp ()); | |||
| _rotary [INPBAL] = new Rlinctl (this, this, &inpbal_img, 20, 0, 120, 4, -3.0f, 3.0f, 0.0f, INPBAL); | |||
| _rotary [HPFILT] = new Rlogctl (this, this, &hpfilt_img, 20, 0, 120, 4, 10.0f, 320.0f, 40.0f, HPFILT); | |||
| _rotary [SHGAIN] = new Rlinctl (this, this, &shgain_img, 190, 0, 120, 5, 0.0f, 24.0f, 15.0f, SHGAIN); | |||
| @@ -78,6 +75,7 @@ Mainwin::Mainwin (X_rootwin *parent, X_resman *xres, int xp, int yp, Jclient *jc | |||
| Mainwin::~Mainwin (void) | |||
| { | |||
| RotaryCtl::fini (); | |||
| } | |||
| @@ -133,16 +131,15 @@ void Mainwin::handle_time (void) | |||
| if (--_timeout == 0) numdisp (-1); | |||
| } | |||
| if (_touch && _jclient->shuffler ()->ready ()) | |||
| if (_touch) | |||
| { | |||
| double v1 = _rotary [SHGAIN]->value (), v2 = _rotary [SHFREQ]->value (); | |||
| _jclient->shuffler ()->prepare (v1, v2); | |||
| _valuecb->valueChangedCallback (SHGAIN, v1); | |||
| _valuecb->valueChangedCallback (SHFREQ, v2); | |||
| _touch = 0; | |||
| } | |||
| inc_time (50000); | |||
| inc_time (5000); | |||
| XFlush (dpy ()); | |||
| } | |||
| @@ -178,12 +175,10 @@ void Mainwin::handle_callb (int type, X_window *W, XEvent *E) | |||
| { | |||
| case INPBAL: | |||
| v = _rotary [INPBAL]->value (); | |||
| _jclient->set_inpbal (v); | |||
| _valuecb->valueChangedCallback (INPBAL, v); | |||
| break; | |||
| case HPFILT: | |||
| v = _rotary [HPFILT]->value (); | |||
| _jclient->set_hpfilt (v); | |||
| _valuecb->valueChangedCallback (HPFILT, v); | |||
| break; | |||
| case SHGAIN: | |||
| @@ -194,7 +189,6 @@ void Mainwin::handle_callb (int type, X_window *W, XEvent *E) | |||
| case LFGAIN: | |||
| v = _rotary [LFGAIN]->value (); | |||
| v2 = _rotary [LFFREQ]->value (); | |||
| _jclient->set_loshelf (v, v2); | |||
| _valuecb->valueChangedCallback (LFGAIN, v); | |||
| _valuecb->valueChangedCallback (LFFREQ, v2); | |||
| break; | |||
| @@ -1,8 +1,8 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2011 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 2 of the License, or | |||
| @@ -29,7 +29,7 @@ | |||
| #include "jclient.h" | |||
| #include "global.h" | |||
| class BLS1Plugin; | |||
| class ZitaPipeClient; | |||
| namespace BLS1 { | |||
| @@ -43,9 +43,10 @@ public: | |||
| virtual void valueChangedCallback(uint, double) = 0; | |||
| }; | |||
| enum { XSIZE = 540, YSIZE = 75 }; | |||
| Mainwin (X_rootwin *parent, X_resman *xres, int xp, int yp, Jclient *jclient, ValueChangedCallback* valuecb); | |||
| Mainwin (X_rootwin *parent, X_resman *xres, int xp, int yp, ValueChangedCallback* valuecb); | |||
| ~Mainwin (void); | |||
| Mainwin (const Mainwin&); | |||
| Mainwin& operator=(const Mainwin&); | |||
| @@ -72,7 +73,6 @@ private: | |||
| Atom _atom; | |||
| bool _stop; | |||
| X_resman *_xres; | |||
| Jclient *_jclient; | |||
| RotaryCtl *_rotary [NROTARY]; | |||
| X_textip *_numtext; | |||
| int _parmind; | |||
| @@ -81,7 +81,7 @@ private: | |||
| ValueChangedCallback* _valuecb; | |||
| friend class ::BLS1Plugin; | |||
| friend class ::ZitaPipeClient; | |||
| }; | |||
| @@ -1,8 +1,8 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2007-2010 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 2 of the License, or | |||
| @@ -1,8 +1,8 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2007-2010 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 2 of the License, or | |||
| @@ -1,8 +1,8 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 2 of the License, or | |||
| @@ -28,6 +28,8 @@ | |||
| namespace BLS1 { | |||
| cairo_t *RotaryCtl::_cairotype = 0; | |||
| cairo_surface_t *RotaryCtl::_cairosurf = 0; | |||
| int RotaryCtl::_wb_up = 4; | |||
| int RotaryCtl::_wb_dn = 5; | |||
| @@ -59,10 +61,6 @@ RotaryCtl::RotaryCtl (X_window *parent, | |||
| { | |||
| x_add_events ( ExposureMask | |||
| | Button1MotionMask | ButtonPressMask | ButtonReleaseMask); | |||
| _cairo->initIfNeeded(parent->disp()); | |||
| _cairotype = _cairo->type; | |||
| _cairosurf = _cairo->surf; | |||
| } | |||
| @@ -71,6 +69,20 @@ RotaryCtl::~RotaryCtl (void) | |||
| } | |||
| void RotaryCtl::init (X_display *disp) | |||
| { | |||
| _cairosurf = cairo_xlib_surface_create (disp->dpy (), 0, disp->dvi (), 50, 50); | |||
| _cairotype = cairo_create (_cairosurf); | |||
| } | |||
| void RotaryCtl::fini (void) | |||
| { | |||
| cairo_destroy (_cairotype); | |||
| cairo_surface_destroy (_cairosurf); | |||
| } | |||
| void RotaryCtl::handle_event (XEvent *E) | |||
| { | |||
| switch (E->type) | |||
| @@ -1,8 +1,8 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 2 of the License, or | |||
| @@ -73,6 +73,9 @@ public: | |||
| virtual void set_value (double v) = 0; | |||
| virtual void get_string (char *p, int n) {} | |||
| static void init (X_display *disp); | |||
| static void fini (void); | |||
| static int _wb_up; | |||
| static int _wb_dn; | |||
| @@ -107,9 +110,8 @@ private: | |||
| virtual int handle_motion (int dx, int dy) = 0; | |||
| virtual int handle_mwheel (int dw) = 0; | |||
| juce::SharedResourcePointer<x_cairo_t> _cairo; | |||
| cairo_t *_cairotype; | |||
| cairo_surface_t *_cairosurf; | |||
| static cairo_t *_cairotype; | |||
| static cairo_surface_t *_cairosurf; | |||
| }; | |||
| @@ -1,8 +1,8 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2011 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 2 of the License, or | |||
| @@ -54,7 +54,7 @@ Shuffler::~Shuffler (void) | |||
| } | |||
| void Shuffler::init (int fsamp, int quant, int abspri, int policy) | |||
| void Shuffler::init (int fsamp, int quant) | |||
| { | |||
| int k; | |||
| @@ -80,7 +80,7 @@ void Shuffler::init (int fsamp, int quant, int abspri, int policy) | |||
| _convproc.configure (1, 1, _iplen, _quant, _minpt, _minpt); | |||
| _convproc.impdata_create (0, 0, 1, _fft_time, 0, _iplen); | |||
| _convproc.start_process (abspri, policy); | |||
| _convproc.start_process (35, SCHED_FIFO); | |||
| } | |||
| @@ -1,8 +1,8 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2011 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 2 of the License, or | |||
| @@ -37,7 +37,7 @@ public: | |||
| Shuffler (void); | |||
| ~Shuffler (void); | |||
| void init (int fsamp, int quant, int abspri, int policy); | |||
| void init (int fsamp, int quant); | |||
| void reset (void); | |||
| void prepare (float gain, float freq); | |||
| void process (int nsamp, float *inp [], float *out []); | |||
| @@ -1,8 +1,8 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2011 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 2 of the License, or | |||
| @@ -24,6 +24,7 @@ | |||
| #include "png2img.h" | |||
| #include "CarlaString.hpp" | |||
| #include <dlfcn.h> | |||
| namespace BLS1 { | |||
| @@ -44,9 +45,20 @@ RotaryImg lffreq_img; | |||
| RotaryImg lfgain_img; | |||
| static CarlaString getResourceDir() | |||
| { | |||
| Dl_info exeInfo; | |||
| dladdr((void*)getResourceDir, &exeInfo); | |||
| CarlaString filename(exeInfo.dli_fname); | |||
| return filename.truncate(filename.rfind("-ui")); | |||
| } | |||
| int styles_init (X_display *disp, X_resman *xrm, const char *resdir) | |||
| int styles_init (X_display *disp, X_resman *xrm) | |||
| { | |||
| CarlaString resourceDir(getResourceDir()); | |||
| XftColors [C_MAIN_BG] = disp->alloc_xftcolor (0.25f, 0.25f, 0.25f, 1.0f); | |||
| XftColors [C_MAIN_FG] = disp->alloc_xftcolor (1.0f, 1.0f, 1.0f, 1.0f); | |||
| XftColors [C_TEXT_BG] = disp->alloc_xftcolor (1.0f, 1.0f, 0.0f, 1.0f); | |||
| @@ -58,10 +70,9 @@ int styles_init (X_display *disp, X_resman *xrm, const char *resdir) | |||
| tstyle1.color.normal.bgnd = XftColors [C_TEXT_BG]->pixel; | |||
| tstyle1.color.normal.text = XftColors [C_TEXT_FG]; | |||
| const CarlaString SHARED = CarlaString(resdir)+"/bls1"; | |||
| inputsect = png2img (SHARED+"/inputsect.png", disp, XftColors [C_MAIN_BG]); | |||
| shuffsect = png2img (SHARED+"/shuffsect.png", disp, XftColors [C_MAIN_BG]); | |||
| lfshfsect = png2img (SHARED+"/lfshfsect.png", disp, XftColors [C_MAIN_BG]); | |||
| inputsect = png2img (resourceDir+"/inputsect.png", disp, XftColors [C_MAIN_BG]); | |||
| shuffsect = png2img (resourceDir+"/shuffsect.png", disp, XftColors [C_MAIN_BG]); | |||
| lfshfsect = png2img (resourceDir+"/lfshfsect.png", disp, XftColors [C_MAIN_BG]); | |||
| if (!inputsect || !shuffsect || !lfshfsect) return 1; | |||
| inpbal_img._backg = XftColors [C_MAIN_BG]; | |||
| @@ -1,8 +1,8 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2011 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 2 of the License, or | |||
| @@ -43,7 +43,7 @@ enum | |||
| }; | |||
| extern int styles_init (X_display *disp, X_resman *xrm, const char *resdir); | |||
| extern int styles_init (X_display *disp, X_resman *xrm); | |||
| extern void styles_fini (X_display *disp); | |||
| extern XftColor *XftColors [NXFTCOLORS]; | |||
| @@ -39,7 +39,7 @@ public: | |||
| ~ZitaPipeClient() noexcept override | |||
| { | |||
| if (fQuitReceived) | |||
| if (fQuitReceived || ! isPipeRunning()) | |||
| return; | |||
| const CarlaMutexLocker cml(getPipeLock()); | |||
| @@ -113,7 +113,8 @@ protected: | |||
| if (index == Mainwin::R_RGXYZ) | |||
| index = Mainwin::R_OPMIX; | |||
| writeControlMessage(index, value); | |||
| if (isPipeRunning()) | |||
| writeControlMessage(index, value); | |||
| } | |||
| private: | |||
| @@ -180,7 +181,9 @@ int main(int argc, const char* argv[]) | |||
| else if (ev == Esync::EV_TIME) | |||
| { | |||
| handler->next_event(); | |||
| pipe.idlePipe(); | |||
| if (pipe.isPipeRunning()) | |||
| pipe.idlePipe(); | |||
| } | |||
| } | |||
| while (ev != EV_EXIT && ! pipe.quitRequested()); | |||
| @@ -66,8 +66,6 @@ public: | |||
| fJackClient.bufferSize = getBufferSize(); | |||
| fJackClient.sampleRate = getSampleRate(); | |||
| jclient = new Jclient(&fJackClient, isAmbisonic); | |||
| // set initial values | |||
| fParameters[kParameterDELAY] = 0.04f; | |||
| fParameters[kParameterXOVER] = 200.0f; | |||
| @@ -84,27 +82,7 @@ public: | |||
| else | |||
| fParameters[kParameterOPMIXorRGXYZ] = 0.5f; | |||
| Reverb* const reverb(jclient->reverb()); | |||
| reverb->set_delay(fParameters[kParameterDELAY]); | |||
| reverb->set_xover(fParameters[kParameterXOVER]); | |||
| reverb->set_rtlow(fParameters[kParameterRTLOW]); | |||
| reverb->set_rtmid(fParameters[kParameterRTMID]); | |||
| reverb->set_fdamp(fParameters[kParameterFDAMP]); | |||
| if (isAmbisonic) | |||
| { | |||
| reverb->set_opmix(0.5); | |||
| reverb->set_rgxyz(fParameters[kParameterOPMIXorRGXYZ]); | |||
| } | |||
| else | |||
| { | |||
| reverb->set_opmix(fParameters[kParameterOPMIXorRGXYZ]); | |||
| reverb->set_rgxyz(0.0); | |||
| } | |||
| reverb->set_eq1(fParameters[kParameterEQ1FR], fParameters[kParameterEQ1GN]); | |||
| reverb->set_eq2(fParameters[kParameterEQ2FR], fParameters[kParameterEQ2GN]); | |||
| _recreateZitaClient(); | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| @@ -306,11 +284,13 @@ public: | |||
| void bufferSizeChanged(const uint32_t bufferSize) override | |||
| { | |||
| fJackClient.bufferSize = bufferSize; | |||
| _recreateZitaClient(); | |||
| } | |||
| void sampleRateChanged(const double sampleRate) override | |||
| { | |||
| fJackClient.sampleRate = sampleRate; | |||
| _recreateZitaClient(); | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| @@ -357,8 +337,36 @@ private: | |||
| // Zita stuff (core) | |||
| ScopedPointer<Jclient> jclient; | |||
| // Parameters | |||
| float fParameters[kParameterNROTARY]; | |||
| void _recreateZitaClient() | |||
| { | |||
| jclient = new Jclient(&fJackClient, kIsAmbisonic); | |||
| Reverb* const reverb(jclient->reverb()); | |||
| reverb->set_delay(fParameters[kParameterDELAY]); | |||
| reverb->set_xover(fParameters[kParameterXOVER]); | |||
| reverb->set_rtlow(fParameters[kParameterRTLOW]); | |||
| reverb->set_rtmid(fParameters[kParameterRTMID]); | |||
| reverb->set_fdamp(fParameters[kParameterFDAMP]); | |||
| if (kIsAmbisonic) | |||
| { | |||
| reverb->set_opmix(0.5); | |||
| reverb->set_rgxyz(fParameters[kParameterOPMIXorRGXYZ]); | |||
| } | |||
| else | |||
| { | |||
| reverb->set_opmix(fParameters[kParameterOPMIXorRGXYZ]); | |||
| reverb->set_rgxyz(0.0); | |||
| } | |||
| reverb->set_eq1(fParameters[kParameterEQ1FR], fParameters[kParameterEQ1GN]); | |||
| reverb->set_eq2(fParameters[kParameterEQ2FR], fParameters[kParameterEQ2GN]); | |||
| } | |||
| public: | |||
| static NativePluginHandle _instantiateAmbisonic(const NativeHostDescriptor* host) | |||
| { | |||
| @@ -384,8 +392,7 @@ static const NativePluginDescriptor rev1AmbisonicDesc = { | |||
| /* category */ NATIVE_PLUGIN_CATEGORY_DELAY, | |||
| /* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_RTSAFE | |||
| |NATIVE_PLUGIN_HAS_UI | |||
| |NATIVE_PLUGIN_NEEDS_FIXED_BUFFERS | |||
| |NATIVE_PLUGIN_NEEDS_UI_MAIN_THREAD), | |||
| |NATIVE_PLUGIN_NEEDS_FIXED_BUFFERS), | |||
| /* supports */ static_cast<NativePluginSupports>(0x0), | |||
| /* audioIns */ 2, | |||
| /* audioOuts */ 4, | |||
| @@ -425,8 +432,7 @@ static const NativePluginDescriptor rev1StereoDesc = { | |||
| /* category */ NATIVE_PLUGIN_CATEGORY_DELAY, | |||
| /* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_RTSAFE | |||
| |NATIVE_PLUGIN_HAS_UI | |||
| |NATIVE_PLUGIN_NEEDS_FIXED_BUFFERS | |||
| |NATIVE_PLUGIN_NEEDS_UI_MAIN_THREAD), | |||
| |NATIVE_PLUGIN_NEEDS_FIXED_BUFFERS), | |||
| /* supports */ static_cast<NativePluginSupports>(0x0), | |||
| /* audioIns */ 2, | |||
| /* audioOuts */ 2, | |||
| @@ -1,7 +1,7 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2010 Fons Adriaensen <fons@kokkinizita.net> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 | |||
| @@ -1,7 +1,7 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 | |||
| @@ -1,7 +1,7 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 | |||
| @@ -1,7 +1,7 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 | |||
| @@ -1,7 +1,7 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 | |||
| @@ -1,7 +1,7 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 | |||
| @@ -1,7 +1,7 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 | |||
| @@ -1,7 +1,7 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 | |||
| @@ -1,7 +1,7 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 | |||
| @@ -1,7 +1,7 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2007-2010 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 | |||
| @@ -1,7 +1,7 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2007-2010 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 | |||
| @@ -1,7 +1,7 @@ | |||
| // ----------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2003-2010 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 | |||
| @@ -1,7 +1,7 @@ | |||
| // ----------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2003-2011 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 | |||
| @@ -1,7 +1,7 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 | |||
| @@ -1,7 +1,7 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 | |||
| @@ -1,7 +1,7 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 | |||
| @@ -1,7 +1,7 @@ | |||
| // ---------------------------------------------------------------------- | |||
| // | |||
| // Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | |||
| // Modified by falkTX on Jan 2015 for inclusion in Carla | |||
| // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla | |||
| // | |||
| // 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 | |||
| @@ -509,7 +509,7 @@ protected: | |||
| void setCustomData(const char* const key, const char* const value) override | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(key != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(key != nullptr && key[0] != '\0',); | |||
| CARLA_SAFE_ASSERT_RETURN(value != nullptr,); | |||
| /**/ if (std::strcmp(key, "CarlaAlternateFile1") == 0) // xmz | |||