@@ -165,7 +165,7 @@ carla_backend: carla_lilv | |||||
$(MAKE) -C src/carla-backend | $(MAKE) -C src/carla-backend | ||||
carla_bridge: carla_lilv | carla_bridge: carla_lilv | ||||
$(MAKE) -C src/carla-bridge | |||||
# $(MAKE) -C src/carla-bridge | |||||
carla_discovery: | carla_discovery: | ||||
$(MAKE) -C src/carla-discovery unix$(_arch_n) NATIVE=1 | $(MAKE) -C src/carla-discovery unix$(_arch_n) NATIVE=1 | ||||
@@ -4,3 +4,10 @@ | |||||
Cadence is a set of tools useful for audio production. | Cadence is a set of tools useful for audio production. | ||||
It's being developed by falkTX, using Python and Qt (and some C++ where needed). | It's being developed by falkTX, using Python and Qt (and some C++ where needed). | ||||
needs: | |||||
pyqt4-dev-tools | |||||
libqt4-dev | |||||
liblo-dev | |||||
libgtk2.0-dev | |||||
python3-pyqt4 |
@@ -819,4 +819,4 @@ if __name__ == '__main__': | |||||
gui.show() | gui.show() | ||||
# Exit properly | # Exit properly | ||||
sys.exit(app.exec_()) | |||||
sys.exit(gui.systray.exec_(app)) |
@@ -20,7 +20,7 @@ CARLA_C_FLAGS = $(BASE_FLAGS) $(CFLAGS) | |||||
CARLA_CXX_FLAGS = $(BASE_FLAGS) -std=c++0x $(CXXFLAGS) | CARLA_CXX_FLAGS = $(BASE_FLAGS) -std=c++0x $(CXXFLAGS) | ||||
CARLA_CXX_FLAGS += $(shell pkg-config --cflags liblo QtCore QtGui) | CARLA_CXX_FLAGS += $(shell pkg-config --cflags liblo QtCore QtGui) | ||||
CARLA_CXX_FLAGS += -DNDEBUG -DQT_NO_DEBUG -DQT_NO_DEBUG_STREAM -DQT_NO_DEBUG_OUTPUT | CARLA_CXX_FLAGS += -DNDEBUG -DQT_NO_DEBUG -DQT_NO_DEBUG_STREAM -DQT_NO_DEBUG_OUTPUT | ||||
# CARLA_CXX_FLAGS += -DVESTIGE_HEADER -I../carla-includes/vestige # Comment this line to not use vestige header | |||||
CARLA_CXX_FLAGS += -DVESTIGE_HEADER -I../carla-includes/vestige # Comment this line to not use vestige header | |||||
CARLA_LD_FLAGS = -shared -ldl -lm -fPIC $(LDFLAGS) | CARLA_LD_FLAGS = -shared -ldl -lm -fPIC $(LDFLAGS) | ||||
CARLA_LD_FLAGS += $(shell pkg-config --libs liblo QtCore QtGui) | CARLA_LD_FLAGS += $(shell pkg-config --libs liblo QtCore QtGui) | ||||
@@ -21,6 +21,8 @@ | |||||
// TODO - setMidiProgram() | // TODO - setMidiProgram() | ||||
#ifdef WANT_LINUXSAMPLER | |||||
#include "carla_plugin.h" | #include "carla_plugin.h" | ||||
#include "carla_linuxsampler_includes.h" | #include "carla_linuxsampler_includes.h" | ||||
@@ -32,8 +34,6 @@ CARLA_BACKEND_START_NAMESPACE | |||||
} /* adjust editor indent */ | } /* adjust editor indent */ | ||||
#endif | #endif | ||||
#ifdef WANT_LINUXSAMPLER | |||||
/*! | /*! | ||||
* @defgroup CarlaBackendLinuxSamplerPlugin Carla Backend LinuxSampler Plugin | * @defgroup CarlaBackendLinuxSamplerPlugin Carla Backend LinuxSampler Plugin | ||||
* | * | ||||
@@ -57,8 +57,8 @@ public: | |||||
engine_channel = nullptr; | engine_channel = nullptr; | ||||
instrument = nullptr; | instrument = nullptr; | ||||
audioOutputDevice = new AudioOutputDevicePlugin(this); | |||||
midiInputDevice = new MidiInputDevicePlugin(sampler); | |||||
audioOutputDevice = new LinuxSampler::AudioOutputDevicePlugin(engine_, this); | |||||
midiInputDevice = new LinuxSampler::MidiInputDevicePlugin(sampler); | |||||
midiInputPort = midiInputDevice->CreateMidiPort(); | midiInputPort = midiInputDevice->CreateMidiPort(); | ||||
m_isGIG = isGIG; | m_isGIG = isGIG; | ||||
@@ -283,7 +283,7 @@ public: | |||||
for (i=0; i < MAX_MIDI_EVENTS && midiEventCount < MAX_MIDI_EVENTS; i++) | for (i=0; i < MAX_MIDI_EVENTS && midiEventCount < MAX_MIDI_EVENTS; i++) | ||||
{ | { | ||||
if (! extMidiNotes[i].valid) | |||||
if (extMidiNotes[i].channel < 0) | |||||
break; | break; | ||||
if (extMidiNotes[i].velo) | if (extMidiNotes[i].velo) | ||||
@@ -291,7 +291,7 @@ public: | |||||
else | else | ||||
midiInputPort->DispatchNoteOff(extMidiNotes[i].note, extMidiNotes[i].velo, cin_channel, framesOffset); | midiInputPort->DispatchNoteOff(extMidiNotes[i].note, extMidiNotes[i].velo, cin_channel, framesOffset); | ||||
extMidiNotes[i].valid = false; | |||||
extMidiNotes[i].channel = -1; | |||||
midiEventCount += 1; | midiEventCount += 1; | ||||
} | } | ||||
@@ -558,8 +558,8 @@ private: | |||||
LinuxSampler::InstrumentManager* instrument; | LinuxSampler::InstrumentManager* instrument; | ||||
std::vector<LinuxSampler::InstrumentManager::instrument_id_t> instrumentIds; | std::vector<LinuxSampler::InstrumentManager::instrument_id_t> instrumentIds; | ||||
AudioOutputDevicePlugin* audioOutputDevice; | |||||
MidiInputDevicePlugin* midiInputDevice; | |||||
LinuxSampler::AudioOutputDevicePlugin* audioOutputDevice; | |||||
LinuxSampler::MidiInputDevicePlugin* midiInputDevice; | |||||
LinuxSampler::MidiInputPort* midiInputPort; | LinuxSampler::MidiInputPort* midiInputPort; | ||||
bool m_isGIG; | bool m_isGIG; | ||||
@@ -571,7 +571,7 @@ CarlaPlugin* LinuxSamplerPlugin::newLinuxSampler(const initializer& init, bool i | |||||
{ | { | ||||
qDebug("LinuxSamplerPlugin::newLinuxSampler(%p, %s, %s, %s, %s)", init.engine, init.filename, init.name, init.label, bool2str(isGIG)); | qDebug("LinuxSamplerPlugin::newLinuxSampler(%p, %s, %s, %s, %s)", init.engine, init.filename, init.name, init.label, bool2str(isGIG)); | ||||
short id = init.engine->getNewPluginIndex(); | |||||
short id = init.engine->getNewPluginId(); | |||||
if (id < 0) | if (id < 0) | ||||
{ | { | ||||
@@ -592,29 +592,37 @@ CarlaPlugin* LinuxSamplerPlugin::newLinuxSampler(const initializer& init, bool i | |||||
return plugin; | return plugin; | ||||
} | } | ||||
#endif | |||||
CarlaPlugin* CarlaPlugin::newGIG(const initializer& init) | CarlaPlugin* CarlaPlugin::newGIG(const initializer& init) | ||||
{ | { | ||||
qDebug("CarlaPlugin::newGIG(%p, %s, %s, %s)", init.engine, init.filename, init.name, init.label); | qDebug("CarlaPlugin::newGIG(%p, %s, %s, %s)", init.engine, init.filename, init.name, init.label); | ||||
#ifdef WANT_LINUXSAMPLER | |||||
return LinuxSamplerPlugin::newLinuxSampler(init, true); | return LinuxSamplerPlugin::newLinuxSampler(init, true); | ||||
#else | |||||
} | |||||
CarlaPlugin* CarlaPlugin::newSFZ(const initializer& init) | |||||
{ | |||||
qDebug("CarlaPlugin::newSFZ(%p, %s, %s, %s)", init.engine, init.filename, init.name, init.label); | |||||
return LinuxSamplerPlugin::newLinuxSampler(init, false); | |||||
} | |||||
#else // WANT_LINUXSAMPLER | |||||
#include "carla_plugin.h" | |||||
CARLA_BACKEND_START_NAMESPACE | |||||
CarlaPlugin* CarlaPlugin::newGIG(const initializer& init) | |||||
{ | |||||
qDebug("CarlaPlugin::newGIG(%p, %s, %s, %s)", init.engine, init.filename, init.name, init.label); | |||||
setLastError("linuxsampler support not available"); | setLastError("linuxsampler support not available"); | ||||
return nullptr; | return nullptr; | ||||
#endif | |||||
} | } | ||||
CarlaPlugin* CarlaPlugin::newSFZ(const initializer& init) | CarlaPlugin* CarlaPlugin::newSFZ(const initializer& init) | ||||
{ | { | ||||
qDebug("CarlaPlugin::newSFZ(%p, %s, %s, %s)", init.engine, init.filename, init.name, init.label); | qDebug("CarlaPlugin::newSFZ(%p, %s, %s, %s)", init.engine, init.filename, init.name, init.label); | ||||
#ifdef WANT_LINUXSAMPLER | |||||
return LinuxSamplerPlugin::newLinuxSampler(init, false); | |||||
#else | |||||
setLastError("linuxsampler support not available"); | setLastError("linuxsampler support not available"); | ||||
return nullptr; | return nullptr; | ||||
#endif | |||||
} | } | ||||
#endif | |||||
/**@}*/ | /**@}*/ | ||||
@@ -3,8 +3,8 @@ | |||||
QT = core gui | QT = core gui | ||||
CONFIG = debug link_pkgconfig qt warn_on plugin shared | CONFIG = debug link_pkgconfig qt warn_on plugin shared | ||||
PKGCONFIG = jack liblo fluidsynth alsa libpulse-simple | |||||
# linuxsampler suil-0 | |||||
PKGCONFIG = jack liblo fluidsynth linuxsampler alsa libpulse-simple | |||||
# suil-0 | |||||
TARGET = carla_backend | TARGET = carla_backend | ||||
TEMPLATE = app | TEMPLATE = app | ||||
@@ -52,7 +52,7 @@ INCLUDEPATH = .. \ | |||||
#DEFINES += HAVE_SUIL | #DEFINES += HAVE_SUIL | ||||
DEFINES += WANT_FLUIDSYNTH | DEFINES += WANT_FLUIDSYNTH | ||||
#DEFINES += WANT_LINUXSAMPLER | |||||
DEFINES += WANT_LINUXSAMPLER | |||||
DEFINES += CARLA_ENGINE_JACK | DEFINES += CARLA_ENGINE_JACK | ||||
#DEFINES += CARLA_ENGINE_RTAUDIO | #DEFINES += CARLA_ENGINE_RTAUDIO | ||||
DEFINES += QTCREATOR_TEST | DEFINES += QTCREATOR_TEST | ||||
@@ -17,7 +17,6 @@ | |||||
#include "carla_includes.h" | #include "carla_includes.h" | ||||
#include "carla_lib_includes.h" | #include "carla_lib_includes.h" | ||||
#include "carla_vst_includes.h" | |||||
#include <cmath> | #include <cmath> | ||||
#include <cstdint> | #include <cstdint> | ||||
@@ -29,9 +28,11 @@ | |||||
#include <QtCore/QFileInfo> | #include <QtCore/QFileInfo> | ||||
#include <QtCore/QUrl> | #include <QtCore/QUrl> | ||||
#include "ladspa/ladspa.h" | |||||
#include "carla_ladspa_includes.h" | |||||
#include "carla_lv2_includes.h" | |||||
#include "carla_vst_includes.h" | |||||
#include "dssi/dssi.h" | #include "dssi/dssi.h" | ||||
#include "lv2_rdf.h" | |||||
#ifdef BUILD_NATIVE | #ifdef BUILD_NATIVE | ||||
# ifdef WANT_FLUIDSYNTH | # ifdef WANT_FLUIDSYNTH | ||||
@@ -40,21 +41,21 @@ | |||||
# warning fluidsynth not available (no SF2 support) | # warning fluidsynth not available (no SF2 support) | ||||
# endif | # endif | ||||
# ifdef WANT_LINUXSAMPLER | # ifdef WANT_LINUXSAMPLER | ||||
# include "linuxsampler/EngineFactory.h" | |||||
# define BUILD_BRIDGE // FIXME | |||||
# include "carla_linuxsampler_includes.h" | |||||
# undef BUILD_BRIDGE | |||||
# else | # else | ||||
# warning linuxsampler not available (no GIG and SFZ support) | # warning linuxsampler not available (no GIG and SFZ support) | ||||
# endif | # endif | ||||
#endif | #endif | ||||
#define CARLA_BACKEND_NO_EXPORTS | |||||
#define CARLA_BACKEND_NO_NAMESPACE | |||||
#include "carla_backend.h" | #include "carla_backend.h" | ||||
#define DISCOVERY_OUT(x, y) std::cout << "\ncarla-discovery::" << x << "::" << y << std::endl; | #define DISCOVERY_OUT(x, y) std::cout << "\ncarla-discovery::" << x << "::" << y << std::endl; | ||||
// fake values to test plugins with | // fake values to test plugins with | ||||
const uint32_t bufferSize = 512; | const uint32_t bufferSize = 512; | ||||
const double sampleRate = 44100.f; | |||||
const double sampleRate = 44100.0; | |||||
// Since discovery can find multi-architecture binaries, don't print ELF related errors | // Since discovery can find multi-architecture binaries, don't print ELF related errors | ||||
void print_lib_error(const char* filename) | void print_lib_error(const char* filename) | ||||
@@ -64,6 +65,8 @@ void print_lib_error(const char* filename) | |||||
DISCOVERY_OUT("error", error); | DISCOVERY_OUT("error", error); | ||||
} | } | ||||
using namespace CarlaBackend; | |||||
// ------------------------------ VST Stuff ------------------------------ | // ------------------------------ VST Stuff ------------------------------ | ||||
intptr_t VstCurrentUniqueId = 0; | intptr_t VstCurrentUniqueId = 0; | ||||
@@ -71,7 +74,7 @@ intptr_t VstCurrentUniqueId = 0; | |||||
intptr_t VstHostCallback(AEffect* effect, int32_t opcode, int32_t index, intptr_t value, void* ptr, float opt) | intptr_t VstHostCallback(AEffect* effect, int32_t opcode, int32_t index, intptr_t value, void* ptr, float opt) | ||||
{ | { | ||||
#if DEBUG | #if DEBUG | ||||
qDebug("VstHostCallback(%p, opcode: %s, index: %i, value: " P_INTPTR ", opt: %f", effect, VstOpcode2str(opcode), index, value, opt); | |||||
qDebug("VstHostCallback(%p, opcode: %s, index: %i, value: " P_INTPTR ", opt: %f", effect, VstMasterOpcode2str(opcode), index, value, opt); | |||||
#endif | #endif | ||||
switch (opcode) | switch (opcode) | ||||
@@ -177,7 +180,7 @@ intptr_t VstHostCallback(AEffect* effect, int32_t opcode, int32_t index, intptr_ | |||||
return kVstLangEnglish; | return kVstLangEnglish; | ||||
default: | default: | ||||
qDebug("VstHostCallback(%p, opcode: %s, index: %i, value: " P_INTPTR ", opt: %f", effect, VstOpcode2str(opcode), index, value, opt); | |||||
qDebug("VstHostCallback(%p, opcode: %s, index: %i, value: " P_INTPTR ", opt: %f", effect, VstMasterOpcode2str(opcode), index, value, opt); | |||||
break; | break; | ||||
} | } | ||||
@@ -25,19 +25,66 @@ | |||||
#if VESTIGE_HEADER | #if VESTIGE_HEADER | ||||
#warning Using vestige header | #warning Using vestige header | ||||
#define audioMasterGetOutputSpeakerArrangement audioMasterGetSpeakerArrangement | |||||
#define effFlagsProgramChunks (1 << 5) | #define effFlagsProgramChunks (1 << 5) | ||||
#define effSetProgramName 4 | |||||
#define effGetParamLabel 6 | #define effGetParamLabel 6 | ||||
#define effGetParamDisplay 7 | #define effGetParamDisplay 7 | ||||
#define effGetVu 9 | |||||
#define effEditDraw 16 | |||||
#define effEditMouse 17 | |||||
#define effEditKey 18 | |||||
#define effEditSleep 21 | |||||
#define effIdentify 22 | |||||
#define effGetChunk 23 | #define effGetChunk 23 | ||||
#define effSetChunk 24 | #define effSetChunk 24 | ||||
#define effCanBeAutomated 26 | #define effCanBeAutomated 26 | ||||
#define effString2Parameter 27 | |||||
#define effGetNumProgramCategories 28 | |||||
#define effGetProgramNameIndexed 29 | #define effGetProgramNameIndexed 29 | ||||
#define effCopyProgram 30 | |||||
#define effConnectInput 31 | |||||
#define effConnectOutput 32 | |||||
#define effGetInputProperties 33 | |||||
#define effGetOutputProperties 34 | |||||
#define effGetPlugCategory 35 | #define effGetPlugCategory 35 | ||||
#define effGetCurrentPosition 36 | |||||
#define effGetDestinationBuffer 37 | |||||
#define effOfflineNotify 38 | |||||
#define effOfflinePrepare 39 | |||||
#define effOfflineRun 40 | |||||
#define effProcessVarIo 41 | |||||
#define effSetSpeakerArrangement 42 | |||||
#define effSetBlockSizeAndSampleRate 43 | #define effSetBlockSizeAndSampleRate 43 | ||||
#define effSetBypass 44 | |||||
#define effGetErrorText 46 | |||||
#define effVendorSpecific 50 | |||||
#define effGetTailSize 52 | |||||
#define effIdle 53 | |||||
#define effGetIcon 54 | |||||
#define effSetViewPosition 55 | |||||
#define effKeysRequired 57 | |||||
#define effEditKeyDown 59 | |||||
#define effEditKeyUp 60 | |||||
#define effSetEditKnobMode 61 | |||||
#define effGetMidiProgramName 62 | |||||
#define effGetCurrentMidiProgram 63 | |||||
#define effGetMidiProgramCategory 64 | |||||
#define effHasMidiProgramsChanged 65 | |||||
#define effGetMidiKeyName 66 | |||||
#define effBeginSetProgram 67 | |||||
#define effEndSetProgram 68 | |||||
#define effGetSpeakerArrangement 69 | |||||
#define effShellGetNextPlugin 70 | #define effShellGetNextPlugin 70 | ||||
#define effStartProcess 71 | #define effStartProcess 71 | ||||
#define effStopProcess 72 | #define effStopProcess 72 | ||||
#define effSetTotalSampleToProcess 73 | |||||
#define effSetPanLaw 74 | |||||
#define effBeginLoadBank 75 | |||||
#define effBeginLoadProgram 76 | |||||
#define effSetProcessPrecision 77 | #define effSetProcessPrecision 77 | ||||
#define effGetNumMidiInputChannels 78 | |||||
#define effGetNumMidiOutputChannels 79 | |||||
#define kPlugCategSynth 2 | #define kPlugCategSynth 2 | ||||
#define kPlugCategAnalysis 3 | #define kPlugCategAnalysis 3 | ||||
#define kPlugCategMastering 4 | #define kPlugCategMastering 4 | ||||
@@ -52,7 +99,6 @@ | |||||
#define kVstProcessPrecision32 0 | #define kVstProcessPrecision32 0 | ||||
#define kVstTransportChanged 1 | #define kVstTransportChanged 1 | ||||
#define kVstVersion 2400 | #define kVstVersion 2400 | ||||
//#define audioMasterGetOutputSpeakerArrangement audioMasterGetSpeakerArrangement | |||||
struct ERect { | struct ERect { | ||||
short top, left, bottom, right; | short top, left, bottom, right; | ||||
}; | }; | ||||
@@ -332,11 +378,7 @@ const char* VstMasterOpcode2str(const int32_t opcode) | |||||
#if ! VST_FORCE_DEPRECATED | #if ! VST_FORCE_DEPRECATED | ||||
case audioMasterSetOutputSampleRate: | case audioMasterSetOutputSampleRate: | ||||
return "audioMasterSetOutputSampleRate"; | return "audioMasterSetOutputSampleRate"; | ||||
#ifdef VESTIGE_HEADER | |||||
case audioMasterGetSpeakerArrangement: | |||||
#else | |||||
case audioMasterGetOutputSpeakerArrangement: | case audioMasterGetOutputSpeakerArrangement: | ||||
#endif | |||||
return "audioMasterGetOutputSpeakerArrangement"; | return "audioMasterGetOutputSpeakerArrangement"; | ||||
#endif | #endif | ||||
case audioMasterGetVendorString: | case audioMasterGetVendorString: | ||||
@@ -3430,7 +3430,8 @@ class CarlaMainW(QMainWindow, ui_carla.Ui_CarlaMainW): | |||||
if event.timerId() == self.TIMER_GUI_STUFF: | if event.timerId() == self.TIMER_GUI_STUFF: | ||||
for pwidget in self.m_plugin_list: | for pwidget in self.m_plugin_list: | ||||
if pwidget: pwidget.check_gui_stuff() | if pwidget: pwidget.check_gui_stuff() | ||||
CarlaHost.idle_guis() | |||||
if CarlaHost.is_engine_running(): | |||||
CarlaHost.idle_guis() | |||||
elif event.timerId() == self.TIMER_GUI_STUFF2: | elif event.timerId() == self.TIMER_GUI_STUFF2: | ||||
for pwidget in self.m_plugin_list: | for pwidget in self.m_plugin_list: | ||||
if pwidget: pwidget.check_gui_stuff2() | if pwidget: pwidget.check_gui_stuff2() | ||||
@@ -3514,8 +3515,15 @@ if __name__ == '__main__': | |||||
if carla_bridge_vst_x11: | if carla_bridge_vst_x11: | ||||
CarlaHost.set_option(OPTION_PATH_BRIDGE_VST_X11, 0, carla_bridge_vst_x11) | CarlaHost.set_option(OPTION_PATH_BRIDGE_VST_X11, 0, carla_bridge_vst_x11) | ||||
# TEST | |||||
#count = CarlaHost.get_engine_driver_count() | |||||
#print(count) | |||||
#for i in range(0, count): | |||||
#dname = cString(CarlaHost.get_engine_driver_name(i)) | |||||
#print("%i - %s" % (i, dname)) | |||||
if not CarlaHost.engine_init("JACK", "Carla"): | if not CarlaHost.engine_init("JACK", "Carla"): | ||||
CustomMessageBox(None, QMessageBox.Critical, "Error", "Could not connect to JACK", | |||||
CustomMessageBox(None, QMessageBox.Critical, "Error", "Could not connect to Audio backend, possible reasons:", | |||||
cString(CarlaHost.get_last_error()), QMessageBox.Ok, QMessageBox.Ok) | cString(CarlaHost.get_last_error()), QMessageBox.Ok, QMessageBox.Ok) | ||||
sys.exit(1) | sys.exit(1) | ||||
@@ -779,6 +779,8 @@ class Host(object): | |||||
if lib_prefix_arg: | if lib_prefix_arg: | ||||
carla_library_path = os.path.join(lib_prefix_arg, "lib", "carla", carla_libname) | carla_library_path = os.path.join(lib_prefix_arg, "lib", "carla", carla_libname) | ||||
print("Host() - using carla-backend library '%s'" % carla_library_path) | |||||
self.lib = cdll.LoadLibrary(carla_library_path) | self.lib = cdll.LoadLibrary(carla_library_path) | ||||
self.lib.get_engine_driver_count.argtypes = None | self.lib.get_engine_driver_count.argtypes = None | ||||
@@ -1309,8 +1309,9 @@ if __name__ == '__main__': | |||||
else: | else: | ||||
DBus.jack = None | DBus.jack = None | ||||
DBus.a2j = None | |||||
DBus.a2j = None | |||||
a2j_client_name = None | a2j_client_name = None | ||||
print("Not using DBus") | |||||
# Show GUI | # Show GUI | ||||
gui = CatiaMainW() | gui = CatiaMainW() | ||||
@@ -17,8 +17,6 @@ | |||||
# For a full copy of the GNU General Public License see the COPYING file | # For a full copy of the GNU General Public License see the COPYING file | ||||
# Imports (Global) | # Imports (Global) | ||||
import dbus | |||||
from dbus.mainloop.qt import DBusQtMainLoop | |||||
from time import ctime | from time import ctime | ||||
from PyQt4.QtCore import QPointF, QSettings | from PyQt4.QtCore import QPointF, QSettings | ||||
from PyQt4.QtGui import QAction, QApplication, QMainWindow, QVBoxLayout, QTableWidgetItem, QTreeWidgetItem | from PyQt4.QtGui import QAction, QApplication, QMainWindow, QVBoxLayout, QTableWidgetItem, QTreeWidgetItem | ||||
@@ -40,6 +38,13 @@ try: | |||||
except: | except: | ||||
hasGL = False | hasGL = False | ||||
try: | |||||
import dbus | |||||
from dbus.mainloop.qt import DBusQtMainLoop | |||||
haveDBus = True | |||||
except: | |||||
haveDBus = False | |||||
# NOTE - set to true when supported | # NOTE - set to true when supported | ||||
USE_CLAUDIA_ADD_NEW = True | USE_CLAUDIA_ADD_NEW = True | ||||
@@ -2485,6 +2490,11 @@ if __name__ == '__main__': | |||||
app.setOrganizationName("Cadence") | app.setOrganizationName("Cadence") | ||||
app.setWindowIcon(QIcon(":/scalable/claudia.svg")) | app.setWindowIcon(QIcon(":/scalable/claudia.svg")) | ||||
if not haveDBus: | |||||
QMessageBox.critical(None, app.translate("ClaudiaMainW", "Error"), app.translate("ClaudiaMainW", | |||||
"DBus is not available, Claudia cannot start without it!")) | |||||
sys.exit(1) | |||||
DBus.loop = DBusQtMainLoop(set_as_default=True) | DBus.loop = DBusQtMainLoop(set_as_default=True) | ||||
DBus.bus = dbus.SessionBus(mainloop=DBus.loop) | DBus.bus = dbus.SessionBus(mainloop=DBus.loop) | ||||
DBus.jack = DBus.bus.get_object("org.jackaudio.service", "/org/jackaudio/Controller") | DBus.jack = DBus.bus.get_object("org.jackaudio.service", "/org/jackaudio/Controller") | ||||
@@ -139,7 +139,7 @@ if __name__ == '__main__': | |||||
# JACK initialization | # JACK initialization | ||||
jack_status = jacklib.jack_status_t(0) | jack_status = jacklib.jack_status_t(0) | ||||
client = jacklib.client_open("M", jacklib.JackSessionID, jacklib.pointer(jack_status)) | |||||
client = jacklib.client_open("M", jacklib.JackNoStartServer|jacklib.JackSessionID, jacklib.pointer(jack_status)) | |||||
if not client: | if not client: | ||||
errorString = get_jack_status_error_string(jack_status) | errorString = get_jack_status_error_string(jack_status) | ||||
@@ -56,9 +56,10 @@ class PixmapDial(QDial): | |||||
if self.palette().window().color().lightness() > 100: | if self.palette().window().color().lightness() > 100: | ||||
# Light background | # Light background | ||||
self.m_color1 = QColor(100, 100, 100, 255) | |||||
self.m_color2 = QColor(0, 0, 0, 0) | |||||
self.m_colorT = [self.palette().text().color(), self.palette().mid().color()] | |||||
c = self.palette().dark().color() | |||||
self.m_color1 = c | |||||
self.m_color2 = QColor(c.red(), c.green(), c.blue(), 0) | |||||
self.m_colorT = [self.palette().buttonText().color(), self.palette().mid().color()] | |||||
else: | else: | ||||
# Dark background | # Dark background | ||||
self.m_color1 = QColor(0, 0, 0, 255) | self.m_color1 = QColor(0, 0, 0, 255) | ||||
@@ -99,6 +99,7 @@ class PixmapKeyboard(QWidget): | |||||
self.m_font = QFont("Monospace", 8, QFont.Normal) | self.m_font = QFont("Monospace", 8, QFont.Normal) | ||||
self.m_pixmap = QPixmap("") | self.m_pixmap = QPixmap("") | ||||
self.setCursor(Qt.PointingHandCursor) | |||||
self.setMode(self.HORIZONTAL) | self.setMode(self.HORIZONTAL) | ||||
def sendNoteOn(self, note, sendSignal=True): | def sendNoteOn(self, note, sendSignal=True): | ||||
@@ -17,17 +17,41 @@ | |||||
# For a full copy of the GNU General Public License see the COPYING file | # For a full copy of the GNU General Public License see the COPYING file | ||||
# Imports (Global) | # Imports (Global) | ||||
from os import getenv | |||||
import os, sys | |||||
from PyQt4.QtCore import SIGNAL | from PyQt4.QtCore import SIGNAL | ||||
from PyQt4.QtGui import QAction, QIcon, QMenu, QSystemTrayIcon | from PyQt4.QtGui import QAction, QIcon, QMenu, QSystemTrayIcon | ||||
try: | try: | ||||
if getenv("DESKTOP_SESSION") in ("ubuntu", "ubuntu-2d") and not os.path.exists("/var/kxstudio/no_appindicators"): | |||||
from gi.repository import AppIndicator3, Gtk | |||||
if os.getenv("DESKTOP_SESSION") in ("ubuntu", "ubuntu-2d") and not os.path.exists("/var/cadence/no_appindicators"): | |||||
# Check current Qt theme. If Gtk+, use Gtk2 AppIndicator | |||||
style = None | |||||
if len(sys.argv) > 2 and "-style" in sys.argv: | |||||
i = sys.argv.index("-style") | |||||
if i < len(sys.argv): | |||||
style = sys.argv[i+1] | |||||
check_cmd = "python3 -c 'import sys; from PyQt4.QtGui import QApplication; app = QApplication(sys.argv); print(app.style().objectName())'" | |||||
if style: | |||||
check_cmd += " -style " | |||||
check_cmd += style | |||||
from subprocess import getoutput | |||||
needsGtk2 = bool(getoutput(check_cmd).strip().lower() in ("gtk", "gtk+")) | |||||
if needsGtk2: | |||||
from gi import pygtkcompat | |||||
pygtkcompat.enable() | |||||
pygtkcompat.enable_gtk(version="2.0") | |||||
from gi.repository import Gtk, AppIndicator | |||||
else: | |||||
from gi.repository import Gtk, AppIndicator3 as AppIndicator | |||||
TrayEngine = "AppIndicator" | TrayEngine = "AppIndicator" | ||||
elif getenv("KDE_FULL_SESSION"): | elif getenv("KDE_FULL_SESSION"): | ||||
from PyKDE4.kdeui import KAction, KIcon, KMenu, KStatusNotifierItem | from PyKDE4.kdeui import KAction, KIcon, KMenu, KStatusNotifierItem | ||||
TrayEngine = "KDE" | TrayEngine = "KDE" | ||||
else: | else: | ||||
TrayEngine = "Qt" | TrayEngine = "Qt" | ||||
except: | except: | ||||
@@ -80,7 +104,7 @@ class GlobalSysTray(object): | |||||
elif TrayEngine == "AppIndicator": | elif TrayEngine == "AppIndicator": | ||||
self.menu = Gtk.Menu() | self.menu = Gtk.Menu() | ||||
self.tray = AppIndicator3.Indicator.new(name, icon, AppIndicator3.IndicatorCategory.APPLICATION_STATUS) | |||||
self.tray = AppIndicator.Indicator.new(name, icon, AppIndicator.IndicatorCategory.APPLICATION_STATUS) | |||||
self.tray.set_menu(self.menu) | self.tray.set_menu(self.menu) | ||||
# Double-click is not possible with App-Indicators | # Double-click is not possible with App-Indicators | ||||
@@ -484,7 +508,7 @@ class GlobalSysTray(object): | |||||
if TrayEngine == "KDE": | if TrayEngine == "KDE": | ||||
self.tray.setStatus(KStatusNotifierItem.Active) | self.tray.setStatus(KStatusNotifierItem.Active) | ||||
elif TrayEngine == "AppIndicator": | elif TrayEngine == "AppIndicator": | ||||
self.tray.set_status(AppIndicator3.IndicatorStatus.ACTIVE) | |||||
self.tray.set_status(AppIndicator.IndicatorStatus.ACTIVE) | |||||
elif TrayEngine == "Qt": | elif TrayEngine == "Qt": | ||||
self.tray.show() | self.tray.show() | ||||
@@ -492,7 +516,7 @@ class GlobalSysTray(object): | |||||
if TrayEngine == "KDE": | if TrayEngine == "KDE": | ||||
self.tray.setStatus(KStatusNotifierItem.Passive) | self.tray.setStatus(KStatusNotifierItem.Passive) | ||||
elif TrayEngine == "AppIndicator": | elif TrayEngine == "AppIndicator": | ||||
self.tray.set_status(AppIndicator3.IndicatorStatus.PASSIVE) | |||||
self.tray.set_status(AppIndicator.IndicatorStatus.PASSIVE) | |||||
elif TrayEngine == "Qt": | elif TrayEngine == "Qt": | ||||
self.tray.hide() | self.tray.hide() | ||||
@@ -217,6 +217,7 @@ | |||||
<height>64</height> | <height>64</height> | ||||
</size> | </size> | ||||
</property> | </property> | ||||
<layout class="QHBoxLayout" name="horizontalLayout_4"/> | |||||
</widget> | </widget> | ||||
</item> | </item> | ||||
</layout> | </layout> | ||||
@@ -231,7 +232,7 @@ | |||||
<x>0</x> | <x>0</x> | ||||
<y>0</y> | <y>0</y> | ||||
<width>588</width> | <width>588</width> | ||||
<height>21</height> | |||||
<height>20</height> | |||||
</rect> | </rect> | ||||
</property> | </property> | ||||
<widget class="QMenu" name="menu_File"> | <widget class="QMenu" name="menu_File"> | ||||
@@ -206,6 +206,7 @@ class XYGraphicsScene(QGraphicsScene): | |||||
def mousePressEvent(self, event): | def mousePressEvent(self, event): | ||||
self.m_mouseLock = True | self.m_mouseLock = True | ||||
self.handleMousePos(event.scenePos()) | self.handleMousePos(event.scenePos()) | ||||
self.parent().setCursor(Qt.CrossCursor) | |||||
QGraphicsScene.mousePressEvent(self, event) | QGraphicsScene.mousePressEvent(self, event) | ||||
def mouseMoveEvent(self, event): | def mouseMoveEvent(self, event): | ||||
@@ -214,6 +215,7 @@ class XYGraphicsScene(QGraphicsScene): | |||||
def mouseReleaseEvent(self, event): | def mouseReleaseEvent(self, event): | ||||
self.m_mouseLock = False | self.m_mouseLock = False | ||||
self.parent().setCursor(Qt.ArrowCursor) | |||||
QGraphicsScene.mouseReleaseEvent(self, event) | QGraphicsScene.mouseReleaseEvent(self, event) | ||||
# XY Controller Window | # XY Controller Window | ||||
@@ -605,7 +607,7 @@ if __name__ == '__main__': | |||||
# Start jack | # Start jack | ||||
jack_status = jacklib.jack_status_t(0) | jack_status = jacklib.jack_status_t(0) | ||||
jack_client = jacklib.client_open("XY-Controller", jacklib.JackSessionID, jacklib.pointer(jack_status)) | |||||
jack_client = jacklib.client_open("XY-Controller", jacklib.JackNoStartServer|jacklib.JackSessionID, jacklib.pointer(jack_status)) | |||||
if not jack_client: | if not jack_client: | ||||
errorString = get_jack_status_error_string(jack_status) | errorString = get_jack_status_error_string(jack_status) | ||||