@@ -90,6 +90,9 @@ carla-discovery-posix64 | |||||
carla-frontend | carla-frontend | ||||
carla-lv2-export | carla-lv2-export | ||||
rev1-ui | |||||
zynaddsubfx-ui | |||||
data/stoat-callgraph.png | data/stoat-callgraph.png | ||||
data/linux/unzipfx2cat32 | data/linux/unzipfx2cat32 | ||||
data/linux/unzipfx2cat64 | data/linux/unzipfx2cat64 | ||||
@@ -529,6 +529,10 @@ ifeq ($(EXPERIMENTAL_PLUGINS),true) | |||||
install -m 644 \ | install -m 644 \ | ||||
bin/resources/rev1/*.png \ | bin/resources/rev1/*.png \ | ||||
$(DESTDIR)$(PREFIX)/share/carla/resources/rev1/ | $(DESTDIR)$(PREFIX)/share/carla/resources/rev1/ | ||||
install -m 755 \ | |||||
bin/resources/rev1-ui \ | |||||
$(DESTDIR)$(PREFIX)/share/carla/resources/ | |||||
endif | endif | ||||
install -m 644 \ | install -m 644 \ | ||||
@@ -29,7 +29,7 @@ ifeq ($(HAVE_NTK),true) | |||||
FLUID = ntk-fluid | FLUID = ntk-fluid | ||||
ZYN_CXX_FLAGS += -DNTK_GUI | ZYN_CXX_FLAGS += -DNTK_GUI | ||||
ZYN_CXX_FLAGS += $(shell pkg-config --cflags ntk_images ntk) | ZYN_CXX_FLAGS += $(shell pkg-config --cflags ntk_images ntk) | ||||
ZYN_LD_FLAGS += $(shell pkg-config --libs ntk_images ntk) -ldl | |||||
ZYN_LD_FLAGS += $(shell pkg-config --libs ntk_images ntk) | |||||
else # HAVE_NTK | else # HAVE_NTK | ||||
FLUID = fluid | FLUID = fluid | ||||
ZYN_CXX_FLAGS += -DFLTK_GUI | ZYN_CXX_FLAGS += -DFLTK_GUI | ||||
@@ -155,6 +155,8 @@ OBJS += \ | |||||
$(OBJDIR)/zita-at1.cpp.o \ | $(OBJDIR)/zita-at1.cpp.o \ | ||||
$(OBJDIR)/zita-bls1.cpp.o \ | $(OBJDIR)/zita-bls1.cpp.o \ | ||||
$(OBJDIR)/zita-rev1.cpp.o | $(OBJDIR)/zita-rev1.cpp.o | ||||
TARGETS += resources/rev1-ui$(APP_EXT) | |||||
endif | endif | ||||
# ---------------------------------------------------------------------------------------------------------------------------- | # ---------------------------------------------------------------------------------------------------------------------------- | ||||
@@ -177,10 +179,15 @@ $(MODULEDIR)/$(MODULENAME).a: $(OBJS) | |||||
@rm -f $@ | @rm -f $@ | ||||
@$(AR) crs $@ $^ | @$(AR) crs $@ $^ | ||||
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 -o $@ | |||||
resources/zynaddsubfx-ui$(APP_EXT): $(OBJDIR)/zynaddsubfx-ui.cpp.o | resources/zynaddsubfx-ui$(APP_EXT): $(OBJDIR)/zynaddsubfx-ui.cpp.o | ||||
-@mkdir -p $(OBJDIR) | -@mkdir -p $(OBJDIR) | ||||
@echo "Linking zynaddsubfx-ui" | @echo "Linking zynaddsubfx-ui" | ||||
@$(CXX) $^ $(ZYN_LD_FLAGS) -o $@ | |||||
@$(CXX) $^ $(ZYN_LD_FLAGS) -ldl -lpthread -o $@ | |||||
# ---------------------------------------------------------------------------------------------------------------------------- | # ---------------------------------------------------------------------------------------------------------------------------- | ||||
@@ -287,7 +294,12 @@ $(OBJDIR)/zita-bls1.cpp.o: zita-bls1.cpp | |||||
$(OBJDIR)/zita-rev1.cpp.o: zita-rev1.cpp | $(OBJDIR)/zita-rev1.cpp.o: zita-rev1.cpp | ||||
-@mkdir -p $(OBJDIR) | -@mkdir -p $(OBJDIR) | ||||
@echo "Compiling $<" | @echo "Compiling $<" | ||||
@$(CXX) $< $(BUILD_CXX_FLAGS) $(shell pkg-config --cflags fftw3f x11 xft) -Wno-unused-parameter -Wno-unused-result -c -o $@ | |||||
@$(CXX) $< $(BUILD_CXX_FLAGS) $(shell pkg-config --cflags fftw3f) -Wno-unused-parameter -c -o $@ | |||||
$(OBJDIR)/zita-rev1-ui.cpp.o: zita-rev1-ui.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 $@ | |||||
# ---------------------------------------------------------------------------------------------------------------------------- | # ---------------------------------------------------------------------------------------------------------------------------- | ||||
@@ -299,6 +311,7 @@ $(OBJDIR)/%.cpp.o: %.cpp | |||||
# ---------------------------------------------------------------------------------------------------------------------------- | # ---------------------------------------------------------------------------------------------------------------------------- | ||||
-include $(OBJS:%.o=%.d) | -include $(OBJS:%.o=%.d) | ||||
-include $(OBJDIR)/zita-rev-ui.cpp.d | |||||
-include $(OBJDIR)/zynaddsubfx-ui.cpp.d | -include $(OBJDIR)/zynaddsubfx-ui.cpp.d | ||||
# ---------------------------------------------------------------------------------------------------------------------------- | # ---------------------------------------------------------------------------------------------------------------------------- |
@@ -0,0 +1,196 @@ | |||||
/* | |||||
* 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-rev1/png2img.cc" | |||||
#include "zita-rev1/guiclass.cc" | |||||
#include "zita-rev1/mainwin.cc" | |||||
#include "zita-rev1/rotary.cc" | |||||
#include "zita-rev1/styles.cc" | |||||
using namespace REV1; | |||||
static Mainwin* mainwin = nullptr; | |||||
// -------------------------------------------------------------------------------------------- | |||||
class ZitaPipeClient : public CarlaPipeClient, | |||||
public Mainwin::ValueChangedCallback | |||||
{ | |||||
public: | |||||
ZitaPipeClient() noexcept | |||||
: CarlaPipeClient(), | |||||
fQuitReceived(false) {} | |||||
~ZitaPipeClient() noexcept override | |||||
{ | |||||
if (fQuitReceived) | |||||
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); | |||||
if (index == Mainwin::R_OPMIX && mainwin->_ambis) | |||||
index = Mainwin::R_RGXYZ; | |||||
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 (index == Mainwin::R_RGXYZ) | |||||
index = Mainwin::R_OPMIX; | |||||
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; | |||||
bool ambisonic = false; | |||||
const char* uiTitle = "Test UI"; | |||||
if (argc > 1) | |||||
{ | |||||
ambisonic = std::strcmp(argv[1], "true") == 0; | |||||
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, ambisonic, &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(); | |||||
pipe.idlePipe(); | |||||
} | |||||
} | |||||
while (ev != EV_EXIT && ! pipe.quitRequested()); | |||||
styles_fini(display); | |||||
delete handler; | |||||
delete rootwin; | |||||
delete display; | |||||
return 0; | |||||
} | |||||
// -------------------------------------------------------------------------------------------- |
@@ -15,21 +15,14 @@ | |||||
* For a full copy of the GNU General Public License see the doc/GPL.txt file. | * 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 "CarlaJuceUtils.hpp" | ||||
#include "juce_audio_basics.h" | #include "juce_audio_basics.h" | ||||
#include "zita-common.hpp" | |||||
#include "zita-rev1/guiclass.cc" | |||||
#include "zita-rev1/jclient.cc" | #include "zita-rev1/jclient.cc" | ||||
#include "zita-rev1/mainwin.cc" | |||||
#include "zita-rev1/pareq.cc" | #include "zita-rev1/pareq.cc" | ||||
#include "zita-rev1/png2img.cc" | |||||
#include "zita-rev1/reverb.cc" | #include "zita-rev1/reverb.cc" | ||||
#include "zita-rev1/rotary.cc" | |||||
#include "zita-rev1/styles.cc" | |||||
using juce::FloatVectorOperations; | using juce::FloatVectorOperations; | ||||
using juce::ScopedPointer; | using juce::ScopedPointer; | ||||
@@ -39,9 +32,7 @@ using namespace REV1; | |||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
// REV1 Plugin | // REV1 Plugin | ||||
class REV1Plugin : public NativePluginClass, | |||||
public X_handler_thread<Mainwin>::SetValueCallback, | |||||
private Mainwin::ValueChangedCallback | |||||
class REV1Plugin : public NativePluginAndUiClass | |||||
{ | { | ||||
public: | public: | ||||
enum Parameters { | enum Parameters { | ||||
@@ -59,18 +50,12 @@ public: | |||||
}; | }; | ||||
REV1Plugin(const NativeHostDescriptor* const host, const bool isAmbisonic) | REV1Plugin(const NativeHostDescriptor* const host, const bool isAmbisonic) | ||||
: NativePluginClass(host), | |||||
: NativePluginAndUiClass(host, "rev1-ui"), | |||||
kIsAmbisonic(isAmbisonic), | kIsAmbisonic(isAmbisonic), | ||||
kNumInputs(2), | kNumInputs(2), | ||||
kNumOutputs(isAmbisonic ? 4 : 2), | kNumOutputs(isAmbisonic ? 4 : 2), | ||||
fJackClient(), | fJackClient(), | ||||
xresman(), | |||||
jclient(nullptr), | jclient(nullptr), | ||||
display(nullptr), | |||||
rootwin(nullptr), | |||||
mainwin(nullptr), | |||||
handler(nullptr), | |||||
handlerThread(this), | |||||
leakDetector_REV1Plugin() | leakDetector_REV1Plugin() | ||||
{ | { | ||||
CARLA_SAFE_ASSERT(host != nullptr); | CARLA_SAFE_ASSERT(host != nullptr); | ||||
@@ -81,11 +66,7 @@ public: | |||||
fJackClient.bufferSize = getBufferSize(); | fJackClient.bufferSize = getBufferSize(); | ||||
fJackClient.sampleRate = getSampleRate(); | fJackClient.sampleRate = getSampleRate(); | ||||
int argc = 1; | |||||
char* argv[] = { (char*)"rev1" }; | |||||
xresman.init(&argc, argv, (char*)"rev1", nullptr, 0); | |||||
jclient = new Jclient(xresman.rname(), &fJackClient, isAmbisonic); | |||||
jclient = new Jclient(&fJackClient, isAmbisonic); | |||||
// set initial values | // set initial values | ||||
fParameters[kParameterDELAY] = 0.04f; | fParameters[kParameterDELAY] = 0.04f; | ||||
@@ -319,78 +300,6 @@ public: | |||||
fJackClient.processCallback(frames, fJackClient.processPtr); | 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 | // Plugin dispatcher calls | ||||
@@ -404,45 +313,35 @@ public: | |||||
fJackClient.sampleRate = sampleRate; | 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 rindex, double value) override | |||||
{ | |||||
uint32_t index = rindex; | |||||
if (kIsAmbisonic && rindex == kParameterNROTARY) | |||||
index = kParameterOPMIXorRGXYZ; | |||||
fParameters[index] = value; | |||||
uiParameterChanged(index, value); | |||||
} | |||||
// ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
// X_handler_thread callbacks | |||||
// Plugin UI calls | |||||
void setParameterValueFromHandlerThread(uint32_t index, float value) override | |||||
void uiShow(const bool show) override | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(mainwin != nullptr,); | |||||
if (show) | |||||
{ | |||||
if (isPipeRunning()) | |||||
{ | |||||
const CarlaMutexLocker cml(getPipeLock()); | |||||
writeMessage("focus\n", 6); | |||||
flushMessages(); | |||||
return; | |||||
} | |||||
uint32_t rindex = index; | |||||
carla_stdout("Trying to start UI using \"%s\"", getExtUiPath()); | |||||
if (kIsAmbisonic && index == kParameterOPMIXorRGXYZ) | |||||
rindex += 1; | |||||
CarlaExternalUI::setData(getExtUiPath(), kIsAmbisonic ? "true" : "false", getUiName()); | |||||
mainwin->_rotary[rindex]->set_value(value); | |||||
if (! CarlaExternalUI::startPipeServer(true)) | |||||
{ | |||||
uiClosed(); | |||||
hostUiUnavailable(); | |||||
} | |||||
} | |||||
else | |||||
{ | |||||
CarlaExternalUI::stopPipeServer(2000); | |||||
} | |||||
} | } | ||||
// ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
@@ -456,13 +355,7 @@ private: | |||||
jack_client_t fJackClient; | jack_client_t fJackClient; | ||||
// Zita stuff (core) | // 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; | |||||
float fParameters[kParameterNROTARY]; | float fParameters[kParameterNROTARY]; | ||||
@@ -492,8 +385,7 @@ static const NativePluginDescriptor rev1AmbisonicDesc = { | |||||
/* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_RTSAFE | /* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_RTSAFE | ||||
|NATIVE_PLUGIN_HAS_UI | |NATIVE_PLUGIN_HAS_UI | ||||
|NATIVE_PLUGIN_NEEDS_FIXED_BUFFERS | |NATIVE_PLUGIN_NEEDS_FIXED_BUFFERS | ||||
|NATIVE_PLUGIN_NEEDS_UI_MAIN_THREAD | |||||
|NATIVE_PLUGIN_USES_PARENT_ID), | |||||
|NATIVE_PLUGIN_NEEDS_UI_MAIN_THREAD), | |||||
/* supports */ static_cast<NativePluginSupports>(0x0), | /* supports */ static_cast<NativePluginSupports>(0x0), | ||||
/* audioIns */ 2, | /* audioIns */ 2, | ||||
/* audioOuts */ 4, | /* audioOuts */ 4, | ||||
@@ -534,8 +426,7 @@ static const NativePluginDescriptor rev1StereoDesc = { | |||||
/* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_RTSAFE | /* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_RTSAFE | ||||
|NATIVE_PLUGIN_HAS_UI | |NATIVE_PLUGIN_HAS_UI | ||||
|NATIVE_PLUGIN_NEEDS_FIXED_BUFFERS | |NATIVE_PLUGIN_NEEDS_FIXED_BUFFERS | ||||
|NATIVE_PLUGIN_NEEDS_UI_MAIN_THREAD | |||||
|NATIVE_PLUGIN_USES_PARENT_ID), | |||||
|NATIVE_PLUGIN_NEEDS_UI_MAIN_THREAD), | |||||
/* supports */ static_cast<NativePluginSupports>(0x0), | /* supports */ static_cast<NativePluginSupports>(0x0), | ||||
/* audioIns */ 2, | /* audioIns */ 2, | ||||
/* audioOuts */ 2, | /* audioOuts */ 2, | ||||
@@ -2,7 +2,7 @@ | |||||
// | // | ||||
// Copyright (C) 2010 Fons Adriaensen <fons@kokkinizita.net> | // Copyright (C) 2010 Fons Adriaensen <fons@kokkinizita.net> | ||||
// Modified by falkTX on Jan 2015 for inclusion in Carla | // Modified by falkTX on Jan 2015 for inclusion in Carla | ||||
// | |||||
// | |||||
// This program is free software; you can redistribute it and/or modify | // 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 | // it under the terms of the GNU General Public License as published by | ||||
// the Free Software Foundation; either version 2 of the License, or | // the Free Software Foundation; either version 2 of the License, or | ||||
@@ -2,7 +2,7 @@ | |||||
// | // | ||||
// Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | // Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | ||||
// Modified by falkTX on Jan 2015 for inclusion in Carla | // Modified by falkTX on Jan 2015 for inclusion in Carla | ||||
// | |||||
// | |||||
// This program is free software; you can redistribute it and/or modify | // 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 | // it under the terms of the GNU General Public License as published by | ||||
// the Free Software Foundation; either version 2 of the License, or | // the Free Software Foundation; either version 2 of the License, or | ||||
@@ -158,4 +158,3 @@ int Rlogctl::set_count (int u) | |||||
} | } | ||||
@@ -2,7 +2,7 @@ | |||||
// | // | ||||
// Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | // Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | ||||
// Modified by falkTX on Jan 2015 for inclusion in Carla | // Modified by falkTX on Jan 2015 for inclusion in Carla | ||||
// | |||||
// | |||||
// This program is free software; you can redistribute it and/or modify | // 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 | // it under the terms of the GNU General Public License as published by | ||||
// the Free Software Foundation; either version 2 of the License, or | // the Free Software Foundation; either version 2 of the License, or | ||||
@@ -99,5 +99,4 @@ private: | |||||
} | } | ||||
#endif | #endif |
@@ -2,7 +2,7 @@ | |||||
// | // | ||||
// Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | // Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | ||||
// Modified by falkTX on Jan 2015 for inclusion in Carla | // Modified by falkTX on Jan 2015 for inclusion in Carla | ||||
// | |||||
// | |||||
// This program is free software; you can redistribute it and/or modify | // 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 | // it under the terms of the GNU General Public License as published by | ||||
// the Free Software Foundation; either version 2 of the License, or | // the Free Software Foundation; either version 2 of the License, or | ||||
@@ -25,14 +25,13 @@ | |||||
namespace REV1 { | namespace REV1 { | ||||
Jclient::Jclient (const char *jname, jack_client_t *jclient, bool ambis) : | |||||
Jclient::Jclient (jack_client_t *jclient, bool ambis) : | |||||
A_thread ("Jclient"), | A_thread ("Jclient"), | ||||
_jack_client (jclient), | _jack_client (jclient), | ||||
_active (false), | _active (false), | ||||
_jname (0), | |||||
_ambis (ambis) | _ambis (ambis) | ||||
{ | { | ||||
init_jack (jname); | |||||
init_jack (); | |||||
} | } | ||||
@@ -42,16 +41,11 @@ Jclient::~Jclient (void) | |||||
} | } | ||||
void Jclient::init_jack (const char *jname) | |||||
void Jclient::init_jack (void) | |||||
{ | { | ||||
jack_set_process_callback (_jack_client, jack_static_process, (void *) this); | jack_set_process_callback (_jack_client, jack_static_process, (void *) this); | ||||
jack_on_shutdown (_jack_client, jack_static_shutdown, (void *) this); | jack_on_shutdown (_jack_client, jack_static_shutdown, (void *) this); | ||||
if (jack_activate (_jack_client)) | |||||
{ | |||||
fprintf(stderr, "Can't activate JACK.\n"); | |||||
exit (1); | |||||
} | |||||
_jname = jack_get_client_name (_jack_client); | |||||
jack_activate (_jack_client); | |||||
_fsamp = jack_get_sample_rate (_jack_client); | _fsamp = jack_get_sample_rate (_jack_client); | ||||
_fragm = 1024; | _fragm = 1024; | ||||
@@ -2,7 +2,7 @@ | |||||
// | // | ||||
// Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | // Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | ||||
// Modified by falkTX on Jan 2015 for inclusion in Carla | // Modified by falkTX on Jan 2015 for inclusion in Carla | ||||
// | |||||
// | |||||
// This program is free software; you can redistribute it and/or modify | // 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 | // it under the terms of the GNU General Public License as published by | ||||
// the Free Software Foundation; either version 2 of the License, or | // the Free Software Foundation; either version 2 of the License, or | ||||
@@ -36,15 +36,14 @@ class Jclient : public A_thread | |||||
{ | { | ||||
public: | public: | ||||
Jclient (const char *jname, jack_client_t *jclient, bool ambis); | |||||
Jclient (jack_client_t *jclient, bool ambis); | |||||
~Jclient (void); | ~Jclient (void); | ||||
const char *jname (void) const { return _jname; } | |||||
Reverb *reverb (void) const { return (Reverb *) &_reverb; } | Reverb *reverb (void) const { return (Reverb *) &_reverb; } | ||||
private: | private: | ||||
void init_jack (const char *jname); | |||||
void init_jack (void); | |||||
void close_jack (void); | void close_jack (void); | ||||
void jack_shutdown (void); | void jack_shutdown (void); | ||||
int jack_process (int nframes); | int jack_process (int nframes); | ||||
@@ -55,7 +54,6 @@ private: | |||||
jack_port_t *_inpports [2]; | jack_port_t *_inpports [2]; | ||||
jack_port_t *_outports [4]; | jack_port_t *_outports [4]; | ||||
bool _active; | bool _active; | ||||
const char *_jname; | |||||
unsigned int _fsamp; | unsigned int _fsamp; | ||||
bool _ambis; | bool _ambis; | ||||
int _fragm; | int _fragm; | ||||
@@ -2,7 +2,7 @@ | |||||
// | // | ||||
// Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | // Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | ||||
// Modified by falkTX on Jan 2015 for inclusion in Carla | // Modified by falkTX on Jan 2015 for inclusion in Carla | ||||
// | |||||
// | |||||
// This program is free software; you can redistribute it and/or modify | // 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 | // it under the terms of the GNU General Public License as published by | ||||
// the Free Software Foundation; either version 2 of the License, or | // the Free Software Foundation; either version 2 of the License, or | ||||
@@ -30,24 +30,21 @@ | |||||
namespace REV1 { | namespace REV1 { | ||||
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, bool ambisonic, ValueChangedCallback* valuecb) : | |||||
A_thread ("Main"), | A_thread ("Main"), | ||||
X_window (parent, xp, yp, XSIZE, YSIZE, XftColors [C_MAIN_BG]->pixel), | X_window (parent, xp, yp, XSIZE, YSIZE, XftColors [C_MAIN_BG]->pixel), | ||||
_stop (false), | _stop (false), | ||||
_ambis (ambisonic), | |||||
_xres (xres), | _xres (xres), | ||||
_jclient (jclient), | |||||
_valuecb (valuecb) | _valuecb (valuecb) | ||||
{ | { | ||||
X_hints H; | X_hints H; | ||||
char s [256]; | |||||
int i, x; | int i, x; | ||||
_atom = XInternAtom (dpy (), "WM_DELETE_WINDOW", True); | _atom = XInternAtom (dpy (), "WM_DELETE_WINDOW", True); | ||||
XSetWMProtocols (dpy (), win (), &_atom, 1); | XSetWMProtocols (dpy (), win (), &_atom, 1); | ||||
_atom = XInternAtom (dpy (), "WM_PROTOCOLS", True); | _atom = XInternAtom (dpy (), "WM_PROTOCOLS", True); | ||||
sprintf (s, "%s", jclient->jname ()); | |||||
x_set_title (s); | |||||
H.position (xp, yp); | H.position (xp, yp); | ||||
H.minsize (XSIZE, YSIZE); | H.minsize (XSIZE, YSIZE); | ||||
H.maxsize (XSIZE, YSIZE); | H.maxsize (XSIZE, YSIZE); | ||||
@@ -55,7 +52,7 @@ Mainwin::Mainwin (X_rootwin *parent, X_resman *xres, int xp, int yp, Jclient *jc | |||||
H.rclas (xres->rclas ()); | H.rclas (xres->rclas ()); | ||||
x_apply (&H); | x_apply (&H); | ||||
_ambis = xres->getb (".ambisonic", false); | |||||
RotaryCtl::init (disp ()); | |||||
x = 0; | x = 0; | ||||
_rotary [R_DELAY] = new Rlinctl (this, this, &r_delay_img, x, 0, 160, 5, 0.02, 0.100, 0.04, R_DELAY); | _rotary [R_DELAY] = new Rlinctl (this, this, &r_delay_img, x, 0, 160, 5, 0.02, 0.100, 0.04, R_DELAY); | ||||
_rotary [R_XOVER] = new Rlogctl (this, this, &r_xover_img, x, 0, 200, 5, 50.0, 1000.0, 200.0, R_XOVER); | _rotary [R_XOVER] = new Rlogctl (this, this, &r_xover_img, x, 0, 200, 5, 50.0, 1000.0, 200.0, R_XOVER); | ||||
@@ -78,12 +75,13 @@ Mainwin::Mainwin (X_rootwin *parent, X_resman *xres, int xp, int yp, Jclient *jc | |||||
x_add_events (ExposureMask); | x_add_events (ExposureMask); | ||||
x_map (); | x_map (); | ||||
set_time (0); | set_time (0); | ||||
inc_time (250000); | |||||
inc_time (50000); | |||||
} | } | ||||
Mainwin::~Mainwin (void) | Mainwin::~Mainwin (void) | ||||
{ | { | ||||
RotaryCtl::fini (); | |||||
} | } | ||||
@@ -134,8 +132,8 @@ void Mainwin::clmesg (XClientMessageEvent *E) | |||||
void Mainwin::handle_time (void) | void Mainwin::handle_time (void) | ||||
{ | { | ||||
inc_time (500000); | |||||
XFlush (dpy ()); | |||||
inc_time (5000); | |||||
XFlush (dpy ()); | |||||
} | } | ||||
@@ -170,50 +168,41 @@ void Mainwin::handle_callb (int type, X_window *W, XEvent *E) | |||||
{ | { | ||||
case R_DELAY: | case R_DELAY: | ||||
v = _rotary [R_DELAY]->value (); | v = _rotary [R_DELAY]->value (); | ||||
_jclient->reverb ()->set_delay (v); | |||||
_valuecb->valueChangedCallback (R_DELAY, v); | _valuecb->valueChangedCallback (R_DELAY, v); | ||||
break; | break; | ||||
case R_XOVER: | case R_XOVER: | ||||
v = _rotary [R_XOVER]->value (); | v = _rotary [R_XOVER]->value (); | ||||
_jclient->reverb ()->set_xover (v); | |||||
_valuecb->valueChangedCallback (R_XOVER, v); | _valuecb->valueChangedCallback (R_XOVER, v); | ||||
break; | break; | ||||
case R_RTLOW: | case R_RTLOW: | ||||
v = _rotary [R_RTLOW]->value (); | v = _rotary [R_RTLOW]->value (); | ||||
_jclient->reverb ()->set_rtlow (v); | |||||
_valuecb->valueChangedCallback (R_RTLOW, v); | _valuecb->valueChangedCallback (R_RTLOW, v); | ||||
break; | break; | ||||
case R_RTMID: | case R_RTMID: | ||||
v = _rotary [R_RTMID]->value (); | v = _rotary [R_RTMID]->value (); | ||||
_jclient->reverb ()->set_rtmid (v); | |||||
_valuecb->valueChangedCallback (R_RTMID, v); | _valuecb->valueChangedCallback (R_RTMID, v); | ||||
break; | break; | ||||
case R_FDAMP: | case R_FDAMP: | ||||
v = _rotary [R_FDAMP]->value (); | v = _rotary [R_FDAMP]->value (); | ||||
_jclient->reverb ()->set_fdamp (v); | |||||
_valuecb->valueChangedCallback (R_FDAMP, v); | _valuecb->valueChangedCallback (R_FDAMP, v); | ||||
break; | break; | ||||
case R_OPMIX: | case R_OPMIX: | ||||
v = _rotary [R_OPMIX]->value (); | v = _rotary [R_OPMIX]->value (); | ||||
_jclient->reverb ()->set_opmix (v); | |||||
_valuecb->valueChangedCallback (R_OPMIX, v); | _valuecb->valueChangedCallback (R_OPMIX, v); | ||||
break; | break; | ||||
case R_RGXYZ: | case R_RGXYZ: | ||||
v = _rotary [R_RGXYZ]->value (); | v = _rotary [R_RGXYZ]->value (); | ||||
_jclient->reverb ()->set_rgxyz (v); | |||||
_valuecb->valueChangedCallback (R_RGXYZ, v); | _valuecb->valueChangedCallback (R_RGXYZ, v); | ||||
break; | break; | ||||
case R_EQ1FR: | case R_EQ1FR: | ||||
case R_EQ1GN: | case R_EQ1GN: | ||||
v = _rotary [R_EQ1FR]->value (), v2 = _rotary [R_EQ1GN]->value (); | v = _rotary [R_EQ1FR]->value (), v2 = _rotary [R_EQ1GN]->value (); | ||||
_jclient->reverb ()->set_eq1 (v, v2); | |||||
_valuecb->valueChangedCallback (R_EQ1FR, v); | _valuecb->valueChangedCallback (R_EQ1FR, v); | ||||
_valuecb->valueChangedCallback (R_EQ1GN, v2); | _valuecb->valueChangedCallback (R_EQ1GN, v2); | ||||
break; | break; | ||||
case R_EQ2FR: | case R_EQ2FR: | ||||
case R_EQ2GN: | case R_EQ2GN: | ||||
v = _rotary [R_EQ2FR]->value (), v2 = _rotary [R_EQ2GN]->value (); | v = _rotary [R_EQ2FR]->value (), v2 = _rotary [R_EQ2GN]->value (); | ||||
_jclient->reverb ()->set_eq2 (v, v2); | |||||
_valuecb->valueChangedCallback (R_EQ2FR, v); | _valuecb->valueChangedCallback (R_EQ2FR, v); | ||||
_valuecb->valueChangedCallback (R_EQ2GN, v2); | _valuecb->valueChangedCallback (R_EQ2GN, v2); | ||||
break; | break; | ||||
@@ -2,7 +2,7 @@ | |||||
// | // | ||||
// Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | // Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | ||||
// Modified by falkTX on Jan 2015 for inclusion in Carla | // Modified by falkTX on Jan 2015 for inclusion in Carla | ||||
// | |||||
// | |||||
// This program is free software; you can redistribute it and/or modify | // 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 | // it under the terms of the GNU General Public License as published by | ||||
// the Free Software Foundation; either version 2 of the License, or | // the Free Software Foundation; either version 2 of the License, or | ||||
@@ -29,7 +29,7 @@ | |||||
#include "jclient.h" | #include "jclient.h" | ||||
#include "global.h" | #include "global.h" | ||||
class REV1Plugin; | |||||
class ZitaPipeClient; | |||||
namespace REV1 { | namespace REV1 { | ||||
@@ -44,9 +44,9 @@ public: | |||||
}; | }; | ||||
enum { XSIZE = 540, YSIZE = 75 }; | |||||
enum { XSIZE = 620, 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, bool ambisonic, ValueChangedCallback* valuecb); | |||||
~Mainwin (void); | ~Mainwin (void); | ||||
Mainwin (const Mainwin&); | Mainwin (const Mainwin&); | ||||
Mainwin& operator=(const Mainwin&); | Mainwin& operator=(const Mainwin&); | ||||
@@ -74,12 +74,11 @@ private: | |||||
bool _stop; | bool _stop; | ||||
bool _ambis; | bool _ambis; | ||||
X_resman *_xres; | X_resman *_xres; | ||||
Jclient *_jclient; | |||||
RotaryCtl *_rotary [NROTARY]; | RotaryCtl *_rotary [NROTARY]; | ||||
ValueChangedCallback* _valuecb; | ValueChangedCallback* _valuecb; | ||||
friend class ::REV1Plugin; | |||||
friend class ::ZitaPipeClient; | |||||
}; | }; | ||||
@@ -2,7 +2,7 @@ | |||||
// | // | ||||
// Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | // Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | ||||
// Modified by falkTX on Jan 2015 for inclusion in Carla | // Modified by falkTX on Jan 2015 for inclusion in Carla | ||||
// | |||||
// | |||||
// This program is free software; you can redistribute it and/or modify | // 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 | // it under the terms of the GNU General Public License as published by | ||||
// the Free Software Foundation; either version 2 of the License, or | // the Free Software Foundation; either version 2 of the License, or | ||||
@@ -2,7 +2,7 @@ | |||||
// | // | ||||
// Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | // Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | ||||
// Modified by falkTX on Jan 2015 for inclusion in Carla | // Modified by falkTX on Jan 2015 for inclusion in Carla | ||||
// | |||||
// | |||||
// This program is free software; you can redistribute it and/or modify | // 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 | // it under the terms of the GNU General Public License as published by | ||||
// the Free Software Foundation; either version 2 of the License, or | // the Free Software Foundation; either version 2 of the License, or | ||||
@@ -2,7 +2,7 @@ | |||||
// | // | ||||
// Copyright (C) 2007-2010 Fons Adriaensen <fons@linuxaudio.org> | // Copyright (C) 2007-2010 Fons Adriaensen <fons@linuxaudio.org> | ||||
// Modified by falkTX on Jan 2015 for inclusion in Carla | // Modified by falkTX on Jan 2015 for inclusion in Carla | ||||
// | |||||
// | |||||
// This program is free software; you can redistribute it and/or modify | // 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 | // it under the terms of the GNU General Public License as published by | ||||
// the Free Software Foundation; either version 2 of the License, or | // the Free Software Foundation; either version 2 of the License, or | ||||
@@ -2,7 +2,7 @@ | |||||
// | // | ||||
// Copyright (C) 2007-2010 Fons Adriaensen <fons@linuxaudio.org> | // Copyright (C) 2007-2010 Fons Adriaensen <fons@linuxaudio.org> | ||||
// Modified by falkTX on Jan 2015 for inclusion in Carla | // Modified by falkTX on Jan 2015 for inclusion in Carla | ||||
// | |||||
// | |||||
// This program is free software; you can redistribute it and/or modify | // 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 | // it under the terms of the GNU General Public License as published by | ||||
// the Free Software Foundation; either version 2 of the License, or | // the Free Software Foundation; either version 2 of the License, or | ||||
@@ -2,7 +2,7 @@ | |||||
// | // | ||||
// Copyright (C) 2003-2010 Fons Adriaensen <fons@linuxaudio.org> | // Copyright (C) 2003-2010 Fons Adriaensen <fons@linuxaudio.org> | ||||
// Modified by falkTX on Jan 2015 for inclusion in Carla | // Modified by falkTX on Jan 2015 for inclusion in Carla | ||||
// | |||||
// | |||||
// This program is free software; you can redistribute it and/or modify | // 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 | // it under the terms of the GNU General Public License as published by | ||||
// the Free Software Foundation; either version 2 of the License, or | // the Free Software Foundation; either version 2 of the License, or | ||||
@@ -2,7 +2,7 @@ | |||||
// | // | ||||
// Copyright (C) 2003-2011 Fons Adriaensen <fons@linuxaudio.org> | // Copyright (C) 2003-2011 Fons Adriaensen <fons@linuxaudio.org> | ||||
// Modified by falkTX on Jan 2015 for inclusion in Carla | // Modified by falkTX on Jan 2015 for inclusion in Carla | ||||
// | |||||
// | |||||
// This program is free software; you can redistribute it and/or modify | // 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 | // it under the terms of the GNU General Public License as published by | ||||
// the Free Software Foundation; either version 2 of the License, or | // the Free Software Foundation; either version 2 of the License, or | ||||
@@ -2,7 +2,7 @@ | |||||
// | // | ||||
// Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | // Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | ||||
// Modified by falkTX on Jan 2015 for inclusion in Carla | // Modified by falkTX on Jan 2015 for inclusion in Carla | ||||
// | |||||
// | |||||
// This program is free software; you can redistribute it and/or modify | // 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 | // it under the terms of the GNU General Public License as published by | ||||
// the Free Software Foundation; either version 2 of the License, or | // the Free Software Foundation; either version 2 of the License, or | ||||
@@ -28,6 +28,9 @@ | |||||
namespace REV1 { | namespace REV1 { | ||||
cairo_t *RotaryCtl::_cairotype = 0; | |||||
cairo_surface_t *RotaryCtl::_cairosurf = 0; | |||||
int RotaryCtl::_wb_up = 4; | int RotaryCtl::_wb_up = 4; | ||||
int RotaryCtl::_wb_dn = 5; | int RotaryCtl::_wb_dn = 5; | ||||
int RotaryCtl::_keymod = 0; | int RotaryCtl::_keymod = 0; | ||||
@@ -58,10 +61,6 @@ RotaryCtl::RotaryCtl (X_window *parent, | |||||
{ | { | ||||
x_add_events ( ExposureMask | x_add_events ( ExposureMask | ||||
| Button1MotionMask | ButtonPressMask | ButtonReleaseMask); | | Button1MotionMask | ButtonPressMask | ButtonReleaseMask); | ||||
_cairo->initIfNeeded(parent->disp()); | |||||
_cairotype = _cairo->type; | |||||
_cairosurf = _cairo->surf; | |||||
} | } | ||||
@@ -70,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) | void RotaryCtl::handle_event (XEvent *E) | ||||
{ | { | ||||
switch (E->type) | switch (E->type) | ||||
@@ -2,7 +2,7 @@ | |||||
// | // | ||||
// Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | // Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | ||||
// Modified by falkTX on Jan 2015 for inclusion in Carla | // Modified by falkTX on Jan 2015 for inclusion in Carla | ||||
// | |||||
// | |||||
// This program is free software; you can redistribute it and/or modify | // 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 | // it under the terms of the GNU General Public License as published by | ||||
// the Free Software Foundation; either version 2 of the License, or | // the Free Software Foundation; either version 2 of the License, or | ||||
@@ -28,7 +28,6 @@ | |||||
#include <cairo/cairo-xlib.h> | #include <cairo/cairo-xlib.h> | ||||
#include <clxclient.h> | #include <clxclient.h> | ||||
namespace REV1 { | namespace REV1 { | ||||
@@ -72,6 +71,9 @@ public: | |||||
virtual void set_value (double v) = 0; | virtual void set_value (double v) = 0; | ||||
virtual void get_string (char *p, int n) {} | 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_up; | ||||
static int _wb_dn; | static int _wb_dn; | ||||
@@ -106,9 +108,8 @@ private: | |||||
virtual int handle_motion (int dx, int dy) = 0; | virtual int handle_motion (int dx, int dy) = 0; | ||||
virtual int handle_mwheel (int dw) = 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; | |||||
}; | }; | ||||
@@ -2,7 +2,7 @@ | |||||
// | // | ||||
// Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | // Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | ||||
// Modified by falkTX on Jan 2015 for inclusion in Carla | // Modified by falkTX on Jan 2015 for inclusion in Carla | ||||
// | |||||
// | |||||
// This program is free software; you can redistribute it and/or modify | // 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 | // it under the terms of the GNU General Public License as published by | ||||
// the Free Software Foundation; either version 2 of the License, or | // the Free Software Foundation; either version 2 of the License, or | ||||
@@ -24,6 +24,7 @@ | |||||
#include "png2img.h" | #include "png2img.h" | ||||
#include "CarlaString.hpp" | #include "CarlaString.hpp" | ||||
#include <dlfcn.h> | |||||
namespace REV1 { | namespace REV1 { | ||||
@@ -47,23 +48,34 @@ RotaryImg r_opmix_img; | |||||
RotaryImg r_rgxyz_img; | RotaryImg r_rgxyz_img; | ||||
int styles_init (X_display *disp, X_resman *xrm, const char *resdir) | |||||
static CarlaString getResourceDir() | |||||
{ | |||||
Dl_info exeInfo; | |||||
dladdr((void*)getResourceDir, &exeInfo); | |||||
CarlaString filename(exeInfo.dli_fname); | |||||
return filename.truncate(filename.rfind("-ui")); | |||||
} | |||||
void 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_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_MAIN_FG] = disp->alloc_xftcolor (1.0f, 1.0f, 1.0f, 1.0f); | ||||
const CarlaString SHARED = CarlaString(resdir)+"/rev1"; | |||||
revsect_img = png2img (SHARED+"/revsect.png", disp, XftColors [C_MAIN_BG]); | |||||
eq1sect_img = png2img (SHARED+"/eq1sect.png", disp, XftColors [C_MAIN_BG]); | |||||
eq2sect_img = png2img (SHARED+"/eq2sect.png", disp, XftColors [C_MAIN_BG]); | |||||
mixsect_img = png2img (SHARED+"/mixsect.png", disp, XftColors [C_MAIN_BG]); | |||||
ambsect_img = png2img (SHARED+"/ambsect.png", disp, XftColors [C_MAIN_BG]); | |||||
revsect_img = png2img (resourceDir+"/revsect.png", disp, XftColors [C_MAIN_BG]); | |||||
eq1sect_img = png2img (resourceDir+"/eq1sect.png", disp, XftColors [C_MAIN_BG]); | |||||
eq2sect_img = png2img (resourceDir+"/eq2sect.png", disp, XftColors [C_MAIN_BG]); | |||||
mixsect_img = png2img (resourceDir+"/mixsect.png", disp, XftColors [C_MAIN_BG]); | |||||
ambsect_img = png2img (resourceDir+"/ambsect.png", disp, XftColors [C_MAIN_BG]); | |||||
if (!revsect_img || !mixsect_img || !ambsect_img | |||||
if (!revsect_img || !mixsect_img || !ambsect_img | |||||
|| !eq1sect_img || !eq2sect_img) | || !eq1sect_img || !eq2sect_img) | ||||
{ | { | ||||
fprintf (stderr, "Can't load images from '%s'.\n", SHARED.buffer()); | |||||
return 1; | |||||
fprintf (stderr, "Can't load images from '%s'.\n", resourceDir.buffer()); | |||||
exit (1); | |||||
} | } | ||||
r_delay_img._backg = XftColors [C_MAIN_BG]; | r_delay_img._backg = XftColors [C_MAIN_BG]; | ||||
@@ -164,13 +176,21 @@ int styles_init (X_display *disp, X_resman *xrm, const char *resdir) | |||||
r_rgxyz_img._xref = 11.5; | r_rgxyz_img._xref = 11.5; | ||||
r_rgxyz_img._yref = 11.5; | r_rgxyz_img._yref = 11.5; | ||||
r_rgxyz_img._rad = 11; | r_rgxyz_img._rad = 11; | ||||
return 0; | |||||
} | } | ||||
void styles_fini (X_display *disp) | void styles_fini (X_display *disp) | ||||
{ | { | ||||
revsect_img->data = 0; | |||||
mixsect_img->data = 0; | |||||
ambsect_img->data = 0; | |||||
eq1sect_img->data = 0; | |||||
eq2sect_img->data = 0; | |||||
XDestroyImage (revsect_img); | |||||
XDestroyImage (mixsect_img); | |||||
XDestroyImage (ambsect_img); | |||||
XDestroyImage (eq1sect_img); | |||||
XDestroyImage (eq2sect_img); | |||||
} | } | ||||
@@ -2,7 +2,7 @@ | |||||
// | // | ||||
// Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | // Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | ||||
// Modified by falkTX on Jan 2015 for inclusion in Carla | // Modified by falkTX on Jan 2015 for inclusion in Carla | ||||
// | |||||
// | |||||
// This program is free software; you can redistribute it and/or modify | // 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 | // it under the terms of the GNU General Public License as published by | ||||
// the Free Software Foundation; either version 2 of the License, or | // 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 void styles_init (X_display *disp, X_resman *xrm); | |||||
extern void styles_fini (X_display *disp); | extern void styles_fini (X_display *disp); | ||||
extern XftColor *XftColors [NXFTCOLORS]; | extern XftColor *XftColors [NXFTCOLORS]; | ||||
@@ -180,6 +180,7 @@ protected: | |||||
} | } | ||||
carla_stderr("ZynPipeClient::msgReceived : %s", msg); | carla_stderr("ZynPipeClient::msgReceived : %s", msg); | ||||
return false; | |||||
} | } | ||||
private: | private: | ||||