| @@ -1268,7 +1268,7 @@ void run_tests_standalone(short idMax) | |||||
| set_midi_program(id, 0); | set_midi_program(id, 0); | ||||
| qDebug("------------------- TEST @%i: set extra data --------------------", id); | qDebug("------------------- TEST @%i: set extra data --------------------", id); | ||||
| set_custom_data(id, CarlaBackend::CUSTOM_DATA_INVALID, nullptr, nullptr); | |||||
| //set_custom_data(id, CarlaBackend::CUSTOM_DATA_INVALID, nullptr, nullptr); | |||||
| set_custom_data(id, CarlaBackend::CUSTOM_DATA_INVALID, "", ""); | set_custom_data(id, CarlaBackend::CUSTOM_DATA_INVALID, "", ""); | ||||
| set_chunk_data(id, nullptr); | set_chunk_data(id, nullptr); | ||||
| set_gui_data(id, 0, 0); | set_gui_data(id, 0, 0); | ||||
| @@ -1308,7 +1308,7 @@ int main(int argc, char* argv[]) | |||||
| //set_option(OPTION_PROCESS_MODE, PROCESS_MODE_CONTINUOUS_RACK, nullptr); | //set_option(OPTION_PROCESS_MODE, PROCESS_MODE_CONTINUOUS_RACK, nullptr); | ||||
| // start engine | // start engine | ||||
| if (! engine_init("JACK", "carla_demo")) | |||||
| if (! engine_init("PulseAudio", "carla_demo")) | |||||
| { | { | ||||
| qCritical("failed to start backend engine, reason:\n%s", get_last_error()); | qCritical("failed to start backend engine, reason:\n%s", get_last_error()); | ||||
| delete vstGui; | delete vstGui; | ||||
| @@ -1350,7 +1350,7 @@ int main(int argc, char* argv[]) | |||||
| run_tests_standalone(id_dssi+1); | run_tests_standalone(id_dssi+1); | ||||
| // lock | // lock | ||||
| app.exec(); | |||||
| //app.exec(); | |||||
| remove_plugin(id_ladspa); | remove_plugin(id_ladspa); | ||||
| remove_plugin(id_dssi); | remove_plugin(id_dssi); | ||||
| @@ -368,8 +368,9 @@ void CarlaEngine::bufferSizeChanged(uint32_t newBufferSize) | |||||
| // ------------------------------------------------------------------------------------------------------------------- | // ------------------------------------------------------------------------------------------------------------------- | ||||
| // Carla Engine Client | // Carla Engine Client | ||||
| CarlaEngineClient::CarlaEngineClient(const CarlaEngineClientNativeHandle& handle_) | |||||
| : handle(handle_) | |||||
| CarlaEngineClient::CarlaEngineClient(const CarlaEngineType& type_, const CarlaEngineClientNativeHandle& handle_) | |||||
| : type(type_), | |||||
| handle(handle_) | |||||
| { | { | ||||
| qDebug("CarlaEngineClient::CarlaEngineClient()"); | qDebug("CarlaEngineClient::CarlaEngineClient()"); | ||||
| @@ -381,15 +382,19 @@ CarlaEngineClient::~CarlaEngineClient() | |||||
| qDebug("CarlaEngineClient::~CarlaEngineClient()"); | qDebug("CarlaEngineClient::~CarlaEngineClient()"); | ||||
| Q_ASSERT(! m_active); | Q_ASSERT(! m_active); | ||||
| #ifdef CARLA_ENGINE_JACK | |||||
| # ifndef BUILD_BRIDGE | |||||
| #ifndef BUILD_BRIDGE | |||||
| if (carlaOptions.process_mode == PROCESS_MODE_MULTIPLE_CLIENTS) | if (carlaOptions.process_mode == PROCESS_MODE_MULTIPLE_CLIENTS) | ||||
| # endif | |||||
| #endif | |||||
| { | { | ||||
| if (handle.client) | |||||
| jack_client_close(handle.client); | |||||
| } | |||||
| #ifdef CARLA_ENGINE_JACK | |||||
| if (handle.jackClient) | |||||
| jack_client_close(handle.jackClient); | |||||
| #endif | |||||
| #ifdef CARLA_ENGINE_RTAUDIO | |||||
| if (handle.rtAudioPtr) | |||||
| delete handle.rtAudioPtr; | |||||
| #endif | #endif | ||||
| } | |||||
| } | } | ||||
| void CarlaEngineClient::activate() | void CarlaEngineClient::activate() | ||||
| @@ -397,15 +402,22 @@ void CarlaEngineClient::activate() | |||||
| qDebug("CarlaEngineClient::activate()"); | qDebug("CarlaEngineClient::activate()"); | ||||
| Q_ASSERT(! m_active); | Q_ASSERT(! m_active); | ||||
| #ifdef CARLA_ENGINE_JACK | |||||
| # ifndef BUILD_BRIDGE | |||||
| #ifndef BUILD_BRIDGE | |||||
| if (carlaOptions.process_mode == PROCESS_MODE_MULTIPLE_CLIENTS) | if (carlaOptions.process_mode == PROCESS_MODE_MULTIPLE_CLIENTS) | ||||
| # endif | |||||
| #endif | |||||
| { | { | ||||
| if (handle.client && ! m_active) | |||||
| jack_activate(handle.client); | |||||
| } | |||||
| if (! m_active) | |||||
| { | |||||
| #ifdef CARLA_ENGINE_JACK | |||||
| if (handle.jackClient) | |||||
| jack_activate(handle.jackClient); | |||||
| #endif | |||||
| #ifdef CARLA_ENGINE_RTAUDIO | |||||
| if (handle.rtAudioPtr) | |||||
| handle.rtAudioPtr->startStream(); | |||||
| #endif | #endif | ||||
| } | |||||
| } | |||||
| m_active = true; | m_active = true; | ||||
| } | } | ||||
| @@ -415,15 +427,22 @@ void CarlaEngineClient::deactivate() | |||||
| qDebug("CarlaEngineClient::deactivate()"); | qDebug("CarlaEngineClient::deactivate()"); | ||||
| Q_ASSERT(m_active); | Q_ASSERT(m_active); | ||||
| #ifdef CARLA_ENGINE_JACK | |||||
| # ifndef BUILD_BRIDGE | |||||
| #ifndef BUILD_BRIDGE | |||||
| if (carlaOptions.process_mode == PROCESS_MODE_MULTIPLE_CLIENTS) | if (carlaOptions.process_mode == PROCESS_MODE_MULTIPLE_CLIENTS) | ||||
| # endif | |||||
| #endif | |||||
| { | { | ||||
| if (handle.client && m_active) | |||||
| jack_deactivate(handle.client); | |||||
| } | |||||
| if (m_active) | |||||
| { | |||||
| #ifdef CARLA_ENGINE_JACK | |||||
| if (handle.jackClient) | |||||
| jack_deactivate(handle.jackClient); | |||||
| #endif | #endif | ||||
| #ifdef CARLA_ENGINE_RTAUDIO | |||||
| if (handle.rtAudioPtr) | |||||
| handle.rtAudioPtr->stopStream(); | |||||
| #endif | |||||
| } | |||||
| } | |||||
| m_active = false; | m_active = false; | ||||
| } | } | ||||
| @@ -439,12 +458,16 @@ bool CarlaEngineClient::isOk() const | |||||
| { | { | ||||
| qDebug("CarlaEngineClient::isOk()"); | qDebug("CarlaEngineClient::isOk()"); | ||||
| #ifdef CARLA_ENGINE_JACK | |||||
| # ifndef BUILD_BRIDGE | |||||
| #ifndef BUILD_BRIDGE | |||||
| if (carlaOptions.process_mode != PROCESS_MODE_CONTINUOUS_RACK) | if (carlaOptions.process_mode != PROCESS_MODE_CONTINUOUS_RACK) | ||||
| # endif | |||||
| return bool(handle.client); | |||||
| #endif | #endif | ||||
| { | |||||
| #ifdef CARLA_ENGINE_JACK | |||||
| return bool(handle.jackClient); | |||||
| // FIXME | |||||
| #endif | |||||
| } | |||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -454,7 +477,7 @@ const CarlaEngineBasePort* CarlaEngineClient::addPort(const CarlaEnginePortType | |||||
| CarlaEnginePortNativeHandle portHandle; | CarlaEnginePortNativeHandle portHandle; | ||||
| #ifdef CARLA_ENGINE_JACK | #ifdef CARLA_ENGINE_JACK | ||||
| portHandle.client = handle.client; | |||||
| portHandle.jackClient = handle.jackClient; | |||||
| #endif | #endif | ||||
| #ifdef CARLA_ENGINE_JACK | #ifdef CARLA_ENGINE_JACK | ||||
| @@ -465,11 +488,11 @@ const CarlaEngineBasePort* CarlaEngineClient::addPort(const CarlaEnginePortType | |||||
| switch (type) | switch (type) | ||||
| { | { | ||||
| case CarlaEnginePortTypeAudio: | case CarlaEnginePortTypeAudio: | ||||
| portHandle.port = jack_port_register(handle.client, name, JACK_DEFAULT_AUDIO_TYPE, isInput ? JackPortIsInput : JackPortIsOutput, 0); | |||||
| portHandle.jackPort = jack_port_register(handle.jackClient, name, JACK_DEFAULT_AUDIO_TYPE, isInput ? JackPortIsInput : JackPortIsOutput, 0); | |||||
| break; | break; | ||||
| case CarlaEnginePortTypeControl: | case CarlaEnginePortTypeControl: | ||||
| case CarlaEnginePortTypeMIDI: | case CarlaEnginePortTypeMIDI: | ||||
| portHandle.port = jack_port_register(handle.client, name, JACK_DEFAULT_MIDI_TYPE, isInput ? JackPortIsInput : JackPortIsOutput, 0); | |||||
| portHandle.jackPort = jack_port_register(handle.jackClient, name, JACK_DEFAULT_MIDI_TYPE, isInput ? JackPortIsInput : JackPortIsOutput, 0); | |||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| @@ -511,8 +534,8 @@ CarlaEngineBasePort::~CarlaEngineBasePort() | |||||
| if (carlaOptions.process_mode != PROCESS_MODE_CONTINUOUS_RACK) | if (carlaOptions.process_mode != PROCESS_MODE_CONTINUOUS_RACK) | ||||
| # endif | # endif | ||||
| { | { | ||||
| if (handle.client && handle.port) | |||||
| jack_port_unregister(handle.client, handle.port); | |||||
| if (handle.jackClient && handle.jackPort) | |||||
| jack_port_unregister(handle.jackClient, handle.jackPort); | |||||
| } | } | ||||
| #endif | #endif | ||||
| } | } | ||||
| @@ -537,8 +560,8 @@ float* CarlaEngineAudioPort::getJackAudioBuffer(uint32_t nframes) | |||||
| if (carlaOptions.process_mode == PROCESS_MODE_CONTINUOUS_RACK) | if (carlaOptions.process_mode == PROCESS_MODE_CONTINUOUS_RACK) | ||||
| return nullptr; | return nullptr; | ||||
| # endif | # endif | ||||
| Q_ASSERT(handle.port); | |||||
| return (float*)jack_port_get_buffer(handle.port, nframes); | |||||
| Q_ASSERT(handle.jackPort); | |||||
| return (float*)jack_port_get_buffer(handle.jackPort, nframes); | |||||
| } | } | ||||
| #endif | #endif | ||||
| @@ -564,9 +587,9 @@ void CarlaEngineControlPort::initBuffer(CarlaEngine* const engine) | |||||
| #endif | #endif | ||||
| #ifdef CARLA_ENGINE_JACK | #ifdef CARLA_ENGINE_JACK | ||||
| if (handle.port) | |||||
| if (handle.jackPort) | |||||
| { | { | ||||
| buffer = jack_port_get_buffer(handle.port, engine->getBufferSize()); | |||||
| buffer = jack_port_get_buffer(handle.jackPort, engine->getBufferSize()); | |||||
| if (! isInput) | if (! isInput) | ||||
| jack_midi_clear_buffer(buffer); | jack_midi_clear_buffer(buffer); | ||||
| @@ -774,9 +797,9 @@ void CarlaEngineMidiPort::initBuffer(CarlaEngine* const engine) | |||||
| #endif | #endif | ||||
| #ifdef CARLA_ENGINE_JACK | #ifdef CARLA_ENGINE_JACK | ||||
| if (handle.port) | |||||
| if (handle.jackPort) | |||||
| { | { | ||||
| buffer = jack_port_get_buffer(handle.port, engine->getBufferSize()); | |||||
| buffer = jack_port_get_buffer(handle.jackPort, engine->getBufferSize()); | |||||
| if (! isInput) | if (! isInput) | ||||
| jack_midi_clear_buffer(buffer); | jack_midi_clear_buffer(buffer); | ||||
| @@ -22,8 +22,6 @@ | |||||
| #include "carla_shared.h" | #include "carla_shared.h" | ||||
| #include "carla_threads.h" | #include "carla_threads.h" | ||||
| #include <QtCore/QMutex> | |||||
| #ifdef CARLA_ENGINE_JACK | #ifdef CARLA_ENGINE_JACK | ||||
| #include <jack/jack.h> | #include <jack/jack.h> | ||||
| #include <jack/midiport.h> | #include <jack/midiport.h> | ||||
| @@ -138,22 +136,36 @@ struct CarlaTimeInfo { | |||||
| struct CarlaEngineClientNativeHandle { | struct CarlaEngineClientNativeHandle { | ||||
| #ifdef CARLA_ENGINE_JACK | #ifdef CARLA_ENGINE_JACK | ||||
| jack_client_t* client; | |||||
| jack_client_t* jackClient; | |||||
| #endif | |||||
| #ifdef CARLA_ENGINE_JACK | |||||
| RtAudio* rtAudioPtr; | |||||
| #endif | |||||
| CarlaEngineClientNativeHandle() | CarlaEngineClientNativeHandle() | ||||
| : client(nullptr) {} | |||||
| { | |||||
| #ifdef CARLA_ENGINE_JACK | |||||
| jackClient = nullptr; | |||||
| #endif | #endif | ||||
| #ifdef CARLA_ENGINE_JACK | |||||
| rtAudioPtr = nullptr; | |||||
| #endif | |||||
| } | |||||
| }; | }; | ||||
| struct CarlaEnginePortNativeHandle { | struct CarlaEnginePortNativeHandle { | ||||
| #ifdef CARLA_ENGINE_JACK | #ifdef CARLA_ENGINE_JACK | ||||
| jack_client_t* client; | |||||
| jack_port_t* port; | |||||
| jack_client_t* jackClient; | |||||
| jack_port_t* jackPort; | |||||
| #endif | |||||
| CarlaEnginePortNativeHandle() | CarlaEnginePortNativeHandle() | ||||
| : client(nullptr), | |||||
| port(nullptr) {} | |||||
| { | |||||
| #ifdef CARLA_ENGINE_JACK | |||||
| jackClient = nullptr; | |||||
| jackPort = nullptr; | |||||
| #endif | #endif | ||||
| } | |||||
| }; | }; | ||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| @@ -449,7 +461,7 @@ private: | |||||
| class CarlaEngineClient | class CarlaEngineClient | ||||
| { | { | ||||
| public: | public: | ||||
| CarlaEngineClient(const CarlaEngineClientNativeHandle& handle); | |||||
| CarlaEngineClient(const CarlaEngineType& type, const CarlaEngineClientNativeHandle& handle); | |||||
| ~CarlaEngineClient(); | ~CarlaEngineClient(); | ||||
| void activate(); | void activate(); | ||||
| @@ -462,6 +474,7 @@ public: | |||||
| private: | private: | ||||
| bool m_active; | bool m_active; | ||||
| const CarlaEngineType type; | |||||
| const CarlaEngineClientNativeHandle handle; | const CarlaEngineClientNativeHandle handle; | ||||
| }; | }; | ||||
| @@ -240,19 +240,19 @@ CarlaEngineClient* CarlaEngineJack::addClient(CarlaPlugin* const plugin) | |||||
| #ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
| if (carlaOptions.process_mode == PROCESS_MODE_SINGLE_CLIENT) | if (carlaOptions.process_mode == PROCESS_MODE_SINGLE_CLIENT) | ||||
| { | { | ||||
| handle.client = client; | |||||
| handle.jackClient = client; | |||||
| } | } | ||||
| else if (carlaOptions.process_mode == PROCESS_MODE_MULTIPLE_CLIENTS) | else if (carlaOptions.process_mode == PROCESS_MODE_MULTIPLE_CLIENTS) | ||||
| #endif | #endif | ||||
| { | { | ||||
| handle.client = jack_client_open(plugin->name(), JackNullOption, nullptr); | |||||
| jack_set_process_callback(handle.client, carla_jack_process_callback_plugin, plugin); | |||||
| handle.jackClient = jack_client_open(plugin->name(), JackNullOption, nullptr); | |||||
| jack_set_process_callback(handle.jackClient, carla_jack_process_callback_plugin, plugin); | |||||
| } | } | ||||
| //else if (carla_options.process_mode == PROCESS_MODE_CONTINUOUS_RACK) | //else if (carla_options.process_mode == PROCESS_MODE_CONTINUOUS_RACK) | ||||
| //{ | //{ | ||||
| //} | //} | ||||
| return new CarlaEngineClient(handle); | |||||
| return new CarlaEngineClient(CarlaEngineTypeJack, handle); | |||||
| } | } | ||||
| // ------------------------------------------------------------------------------------------------------------------- | // ------------------------------------------------------------------------------------------------------------------- | ||||
| @@ -147,7 +147,7 @@ CarlaEngineClient* CarlaEngineRtAudio::addClient(CarlaPlugin* const plugin) | |||||
| { | { | ||||
| CarlaEngineClientNativeHandle handle; | CarlaEngineClientNativeHandle handle; | ||||
| return new CarlaEngineClient(handle); | |||||
| return new CarlaEngineClient(CarlaEngineTypeRtAudio, handle); | |||||
| Q_UNUSED(plugin); | Q_UNUSED(plugin); | ||||
| } | } | ||||
| @@ -1608,23 +1608,28 @@ class CarlaMainW(QMainWindow, ui_carla.Ui_CarlaMainW): | |||||
| @pyqtSlot() | @pyqtSlot() | ||||
| def slot_remove_all(self): | def slot_remove_all(self): | ||||
| h = 0 | |||||
| for i in range(MAX_PLUGINS): | for i in range(MAX_PLUGINS): | ||||
| pwidget = self.m_plugin_list[i] | pwidget = self.m_plugin_list[i] | ||||
| if not pwidget: | if not pwidget: | ||||
| continue | continue | ||||
| pwidget.setId(i-h) | |||||
| pwidget.edit_dialog.close() | pwidget.edit_dialog.close() | ||||
| if pwidget.gui_dialog: | if pwidget.gui_dialog: | ||||
| pwidget.gui_dialog.close() | pwidget.gui_dialog.close() | ||||
| if Carla.Host.remove_plugin(i): | |||||
| if Carla.Host.remove_plugin(i-h): | |||||
| pwidget.close() | pwidget.close() | ||||
| pwidget.deleteLater() | pwidget.deleteLater() | ||||
| self.w_plugins.layout().removeWidget(pwidget) | self.w_plugins.layout().removeWidget(pwidget) | ||||
| self.m_plugin_list[i] = None | self.m_plugin_list[i] = None | ||||
| if Carla.processMode == PROCESS_MODE_CONTINUOUS_RACK: | |||||
| h += 1 | |||||
| self.act_plugin_remove_all.setEnabled(False) | self.act_plugin_remove_all.setEnabled(False) | ||||
| @pyqtSlot() | @pyqtSlot() | ||||
| @@ -983,7 +983,7 @@ | |||||
| </sizepolicy> | </sizepolicy> | ||||
| </property> | </property> | ||||
| <property name="currentIndex"> | <property name="currentIndex"> | ||||
| <number>1</number> | |||||
| <number>0</number> | |||||
| </property> | </property> | ||||
| <widget class="QWidget" name="page"> | <widget class="QWidget" name="page"> | ||||
| <layout class="QGridLayout" name="gridLayout_6"> | <layout class="QGridLayout" name="gridLayout_6"> | ||||
| @@ -1043,8 +1043,8 @@ | |||||
| <rect> | <rect> | ||||
| <x>0</x> | <x>0</x> | ||||
| <y>0</y> | <y>0</y> | ||||
| <width>94</width> | |||||
| <height>76</height> | |||||
| <width>395</width> | |||||
| <height>256</height> | |||||
| </rect> | </rect> | ||||
| </property> | </property> | ||||
| <attribute name="label"> | <attribute name="label"> | ||||
| @@ -1061,8 +1061,8 @@ | |||||
| <rect> | <rect> | ||||
| <x>0</x> | <x>0</x> | ||||
| <y>0</y> | <y>0</y> | ||||
| <width>94</width> | |||||
| <height>76</height> | |||||
| <width>98</width> | |||||
| <height>96</height> | |||||
| </rect> | </rect> | ||||
| </property> | </property> | ||||
| <attribute name="label"> | <attribute name="label"> | ||||
| @@ -1079,8 +1079,8 @@ | |||||
| <rect> | <rect> | ||||
| <x>0</x> | <x>0</x> | ||||
| <y>0</y> | <y>0</y> | ||||
| <width>94</width> | |||||
| <height>76</height> | |||||
| <width>98</width> | |||||
| <height>96</height> | |||||
| </rect> | </rect> | ||||
| </property> | </property> | ||||
| <attribute name="label"> | <attribute name="label"> | ||||
| @@ -1097,8 +1097,8 @@ | |||||
| <rect> | <rect> | ||||
| <x>0</x> | <x>0</x> | ||||
| <y>0</y> | <y>0</y> | ||||
| <width>94</width> | |||||
| <height>76</height> | |||||
| <width>98</width> | |||||
| <height>96</height> | |||||
| </rect> | </rect> | ||||
| </property> | </property> | ||||
| <attribute name="label"> | <attribute name="label"> | ||||
| @@ -1377,7 +1377,7 @@ | |||||
| <x>0</x> | <x>0</x> | ||||
| <y>0</y> | <y>0</y> | ||||
| <width>732</width> | <width>732</width> | ||||
| <height>19</height> | |||||
| <height>20</height> | |||||
| </rect> | </rect> | ||||
| </property> | </property> | ||||
| <widget class="QMenu" name="menu_File"> | <widget class="QMenu" name="menu_File"> | ||||