| @@ -184,55 +184,7 @@ short add_plugin(CarlaBackend::BinaryType btype, CarlaBackend::PluginType ptype, | |||||
| { | { | ||||
| qDebug("add_plugin(%s, %s, %s, %s, %s, %p)", CarlaBackend::BinaryType2str(btype), CarlaBackend::PluginType2str(ptype), filename, name, label, extra_stuff); | qDebug("add_plugin(%s, %s, %s, %s, %s, %p)", CarlaBackend::BinaryType2str(btype), CarlaBackend::PluginType2str(ptype), filename, name, label, extra_stuff); | ||||
| return -1; | |||||
| #if 0 | |||||
| CarlaBackend::CarlaPlugin::initializer init = { | |||||
| &carla_engine, | |||||
| filename, | |||||
| name, | |||||
| label | |||||
| }; | |||||
| #ifndef BUILD_BRIDGE | |||||
| if (btype != BINARY_NATIVE) | |||||
| { | |||||
| #ifdef CARLA_ENGINE_JACK | |||||
| if (CarlaBackend::carla_options.process_mode != CarlaBackend::PROCESS_MODE_MULTIPLE_CLIENTS) | |||||
| { | |||||
| CarlaBackend::set_last_error("Can only use bridged plugins in JACK Multi-Client mode"); | |||||
| return -1; | |||||
| } | |||||
| #else | |||||
| CarlaBackend::set_last_error("Can only use bridged plugins with JACK backend"); | |||||
| return -1; | |||||
| #endif | |||||
| return CarlaBackend::CarlaPlugin::newBridge(init, btype, ptype); | |||||
| } | |||||
| #endif | |||||
| switch (ptype) | |||||
| { | |||||
| case CarlaBackend::PLUGIN_LADSPA: | |||||
| return CarlaBackend::CarlaPlugin::newLADSPA(init, extra_stuff); | |||||
| case CarlaBackend::PLUGIN_DSSI: | |||||
| return CarlaBackend::CarlaPlugin::newDSSI(init, extra_stuff); | |||||
| case CarlaBackend::PLUGIN_LV2: | |||||
| return CarlaBackend::CarlaPlugin::newLV2(init); | |||||
| case CarlaBackend::PLUGIN_VST: | |||||
| return CarlaBackend::CarlaPlugin::newVST(init); | |||||
| case CarlaBackend::PLUGIN_GIG: | |||||
| return CarlaBackend::CarlaPlugin::newGIG(init); | |||||
| case CarlaBackend::PLUGIN_SF2: | |||||
| return CarlaBackend::CarlaPlugin::newSF2(init); | |||||
| case CarlaBackend::PLUGIN_SFZ: | |||||
| return CarlaBackend::CarlaPlugin::newSFZ(init); | |||||
| default: | |||||
| CarlaBackend::set_last_error("Unknown plugin type"); | |||||
| return -1; | |||||
| } | |||||
| #endif | |||||
| return carla_engine->addPlugin(btype, ptype, filename, name, label, extra_stuff); | |||||
| } | } | ||||
| bool remove_plugin(unsigned short plugin_id) | bool remove_plugin(unsigned short plugin_id) | ||||
| @@ -1212,48 +1164,25 @@ void main_callback(CarlaBackend::CallbackType action, unsigned short plugin_id, | |||||
| } | } | ||||
| } | } | ||||
| int main(int /*argc*/, char* /*argv*/[]) | |||||
| int main(int argc, char* argv[]) | |||||
| { | { | ||||
| //QApplication app(argc, argv); | |||||
| // Lv2World.init(); | |||||
| QApplication app(argc, argv); | |||||
| // const LV2_RDF_Descriptor* const descX = lv2_rdf_new("urn:juce:TalFilter2"); | |||||
| // qDebug("desc: %p", descX); | |||||
| //set_option(CarlaBackend::OPTION_PROCESS_MODE, CarlaBackend::PROCESS_MODE_CONTINUOUS_RACK, nullptr); | |||||
| // if (! descX) | |||||
| // return 1; | |||||
| // const LV2_RDF_Descriptor* const desc = lv2_rdf_dup(descX); | |||||
| // lv2_rdf_free(descX); | |||||
| // qDebug("desc->Name: %s", desc->Name); | |||||
| // qDebug("desc->PortCount: %u", desc->PortCount); | |||||
| // qDebug("desc->UniqueID: %lu", desc->UniqueID); | |||||
| // for (uint32_t i=0; i < desc->PresetCount; i++) | |||||
| // { | |||||
| // const LV2_RDF_Preset* const Preset = &desc->Presets[i]; | |||||
| // qDebug(" Preset #%02i: %s", i, Preset->Label); | |||||
| // } | |||||
| // lv2_rdf_free(desc); | |||||
| #if 0 | |||||
| gui = new QDialog(nullptr); | gui = new QDialog(nullptr); | ||||
| if (engine_init("PulseAudio", "carla_demo")) | |||||
| if (engine_init("JACK", "carla_demo")) | |||||
| { | { | ||||
| set_callback_function(main_callback); | set_callback_function(main_callback); | ||||
| ::set_option(CarlaBackend::OPTION_PROCESS_MODE, CarlaBackend::PROCESS_MODE_CONTINUOUS_RACK, nullptr); | |||||
| short id = add_plugin(BINARY_NATIVE, CarlaBackend::PLUGIN_LV2, "xxx", "name!!!", "http://linuxdsp.co.uk/lv2/peq-2a.lv2", nullptr); | |||||
| short id = add_plugin(BINARY_NATIVE, CarlaBackend::PLUGIN_LADSPA, "/usr/lib/ladspa/delay.so", "HAHA name!!!", "delay_5s", nullptr); | |||||
| if (id >= 0) | if (id >= 0) | ||||
| { | { | ||||
| qDebug("Main Initiated, id = %u", id); | qDebug("Main Initiated, id = %u", id); | ||||
| const GuiInfo* guiInfo = get_gui_info(id); | |||||
| const GuiInfo* const guiInfo = get_gui_info(id); | |||||
| if (guiInfo->type == CarlaBackend::GUI_INTERNAL_QT4 || guiInfo->type == CarlaBackend::GUI_INTERNAL_X11) | if (guiInfo->type == CarlaBackend::GUI_INTERNAL_QT4 || guiInfo->type == CarlaBackend::GUI_INTERNAL_X11) | ||||
| { | { | ||||
| @@ -1276,7 +1205,6 @@ int main(int /*argc*/, char* /*argv*/[]) | |||||
| 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 gui; | delete gui; | ||||
| #endif | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -104,7 +104,7 @@ short CarlaEngine::getNewPluginIndex() | |||||
| return -1; | return -1; | ||||
| } | } | ||||
| CarlaPlugin* CarlaEngine::getPluginById(unsigned short id) | |||||
| CarlaPlugin* CarlaEngine::getPluginById(const unsigned short id) | |||||
| { | { | ||||
| for (unsigned short i=0; i < MAX_PLUGINS; i++) | for (unsigned short i=0; i < MAX_PLUGINS; i++) | ||||
| { | { | ||||
| @@ -117,20 +117,20 @@ CarlaPlugin* CarlaEngine::getPluginById(unsigned short id) | |||||
| return nullptr; | return nullptr; | ||||
| } | } | ||||
| CarlaPlugin* CarlaEngine::getPluginByIndex(unsigned short index) | |||||
| CarlaPlugin* CarlaEngine::getPluginByIndex(const unsigned short index) | |||||
| { | { | ||||
| assert(index < MAX_PLUGINS); | assert(index < MAX_PLUGINS); | ||||
| return m_carlaPlugins[index]; | return m_carlaPlugins[index]; | ||||
| } | } | ||||
| const char* CarlaEngine::getUniqueName(const char* name) | |||||
| const char* CarlaEngine::getUniqueName(const char* const name) | |||||
| { | { | ||||
| QString qname(name); | QString qname(name); | ||||
| if (qname.isEmpty()) | if (qname.isEmpty()) | ||||
| qname = "(No name)"; | qname = "(No name)"; | ||||
| qname.truncate(maxClientNameSize()-1); | |||||
| qname.truncate(maxClientNameSize()-5-1); // 5 = strlen(" (10)") | |||||
| qname.replace(":", "."); // ":" is used in JACK to split client/port names | qname.replace(":", "."); // ":" is used in JACK to split client/port names | ||||
| for (unsigned short i=0; i < MAX_PLUGINS; i++) | for (unsigned short i=0; i < MAX_PLUGINS; i++) | ||||
| @@ -183,15 +183,78 @@ const char* CarlaEngine::getUniqueName(const char* name) | |||||
| return strdup(qname.toUtf8().constData()); | return strdup(qname.toUtf8().constData()); | ||||
| } | } | ||||
| void CarlaEngine::addPlugin(unsigned short id, CarlaPlugin* plugin) | |||||
| short CarlaEngine::addPlugin(const PluginType ptype, const char* const filename, const char* const name, const char* const label, void* const extra) | |||||
| { | { | ||||
| assert(id < MAX_PLUGINS); | |||||
| return addPlugin(BINARY_NATIVE, ptype, filename, name, label, extra); | |||||
| } | |||||
| short CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype, const char* const filename, const char* const name, const char* const label, void* const extra) | |||||
| { | |||||
| CarlaPlugin::initializer init = { | |||||
| this, | |||||
| filename, | |||||
| name, | |||||
| label | |||||
| }; | |||||
| CarlaPlugin* plugin = nullptr; | |||||
| #ifndef BUILD_BRIDGE | |||||
| if (btype != BINARY_NATIVE) | |||||
| { | |||||
| # ifdef CARLA_ENGINE_JACK | |||||
| if (carlaOptions.process_mode != CarlaBackend::PROCESS_MODE_MULTIPLE_CLIENTS) | |||||
| { | |||||
| setLastError("Can only use bridged plugins in JACK Multi-Client mode"); | |||||
| return -1; | |||||
| } | |||||
| # else | |||||
| setLastError("Can only use bridged plugins with JACK backend"); | |||||
| return -1; | |||||
| # endif | |||||
| //plugin = CarlaPlugin::newBridge(init, btype, ptype); | |||||
| } | |||||
| #endif | |||||
| switch (ptype) | |||||
| { | |||||
| case PLUGIN_NONE: | |||||
| break; | |||||
| case PLUGIN_LADSPA: | |||||
| plugin = CarlaPlugin::newLADSPA(init, extra); | |||||
| break; | |||||
| case PLUGIN_DSSI: | |||||
| //id = CarlaPlugin::newDSSI(init, extra); | |||||
| break; | |||||
| case PLUGIN_LV2: | |||||
| //id = CarlaPlugin::newLV2(init); | |||||
| break; | |||||
| case PLUGIN_VST: | |||||
| //id = CarlaPlugin::newVST(init); | |||||
| break; | |||||
| case PLUGIN_GIG: | |||||
| //id = CarlaPlugin::newGIG(init); | |||||
| break; | |||||
| case PLUGIN_SF2: | |||||
| //id = CarlaPlugin::newSF2(init); | |||||
| break; | |||||
| case PLUGIN_SFZ: | |||||
| //id = CarlaPlugin::newSFZ(init); | |||||
| break; | |||||
| } | |||||
| if (plugin == nullptr) | |||||
| return -1; | |||||
| const short id = plugin->id(); | |||||
| m_carlaPlugins[id] = plugin; | m_carlaPlugins[id] = plugin; | ||||
| m_uniqueNames[id] = plugin->name(); | m_uniqueNames[id] = plugin->name(); | ||||
| // TODO - make this bool, or different somehow | |||||
| return id; | |||||
| } | } | ||||
| bool CarlaEngine::removePlugin(unsigned short id) | |||||
| bool CarlaEngine::removePlugin(const unsigned short id) | |||||
| { | { | ||||
| for (unsigned short i=0; i < MAX_PLUGINS; i++) | for (unsigned short i=0; i < MAX_PLUGINS; i++) | ||||
| { | { | ||||
| @@ -218,8 +281,12 @@ bool CarlaEngine::removePlugin(unsigned short id) | |||||
| } | } | ||||
| } | } | ||||
| qCritical("remove_plugin(%i) - could not find plugin", id); | |||||
| setLastError("Could not find plugin to remove"); | |||||
| if (isRunning()) | |||||
| { | |||||
| qCritical("remove_plugin(%i) - could not find plugin", id); | |||||
| setLastError("Could not find plugin to remove"); | |||||
| } | |||||
| return false; | return false; | ||||
| } | } | ||||
| @@ -235,6 +302,7 @@ CarlaEngineClient::CarlaEngineClient(const CarlaEngineClientNativeHandle& handle | |||||
| CarlaEngineClient::~CarlaEngineClient() | CarlaEngineClient::~CarlaEngineClient() | ||||
| { | { | ||||
| assert(! m_active); | assert(! m_active); | ||||
| #ifdef CARLA_ENGINE_JACK | #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) | ||||
| @@ -47,7 +47,14 @@ CARLA_BACKEND_START_NAMESPACE | |||||
| * @{ | * @{ | ||||
| */ | */ | ||||
| /*! | |||||
| * @defgroup TimeInfoValidHints TimeInfo Valid Hints | |||||
| * | |||||
| * Various hints used for CarlaTimeInfo::valid. | |||||
| * @{ | |||||
| */ | |||||
| const uint32_t CarlaEngineTimeBBT = 0x1; | const uint32_t CarlaEngineTimeBBT = 0x1; | ||||
| /**@}*/ | |||||
| enum CarlaEnginePortType { | enum CarlaEnginePortType { | ||||
| CarlaEnginePortTypeAudio, | CarlaEnginePortTypeAudio, | ||||
| @@ -156,7 +163,7 @@ public: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // virtual, per-engine type calls | // virtual, per-engine type calls | ||||
| virtual bool init(const char* const name) = 0; | |||||
| virtual bool init(const char* const clientName) = 0; | |||||
| virtual bool close() = 0; | virtual bool close() = 0; | ||||
| virtual bool isOnAudioThread() = 0; | virtual bool isOnAudioThread() = 0; | ||||
| @@ -166,18 +173,19 @@ public: | |||||
| virtual CarlaEngineClient* addClient(CarlaPlugin* const plugin) = 0; | virtual CarlaEngineClient* addClient(CarlaPlugin* const plugin) = 0; | ||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // plugin management | |||||
| // Plugin management | |||||
| short getNewPluginIndex(); | short getNewPluginIndex(); | ||||
| CarlaPlugin* getPluginById(unsigned short id); | |||||
| CarlaPlugin* getPluginByIndex(unsigned short id); | |||||
| const char* getUniqueName(const char* name); | |||||
| CarlaPlugin* getPluginById(const unsigned short id); | |||||
| CarlaPlugin* getPluginByIndex(const unsigned short id); | |||||
| const char* getUniqueName(const char* const name); | |||||
| void addPlugin(unsigned short id, CarlaPlugin* plugin); | |||||
| bool removePlugin(unsigned short id); | |||||
| short addPlugin(const BinaryType btype, const PluginType ptype, const char* const filename, const char* const name, const char* const label, void* const extra = nullptr); | |||||
| short addPlugin(const PluginType ptype, const char* const filename, const char* const name, const char* const label, void* const extra = nullptr); | |||||
| bool removePlugin(const unsigned short id); | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // information (base) | |||||
| // Information (base) | |||||
| const char* getName() const | const char* getName() const | ||||
| { | { | ||||
| @@ -200,30 +208,30 @@ public: | |||||
| } | } | ||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // information (audio peaks) | |||||
| // Information (audio peaks) | |||||
| double getInputPeak(unsigned short pluginId, unsigned short id) | |||||
| double getInputPeak(const unsigned short pluginId, const unsigned short id) const | |||||
| { | { | ||||
| assert(pluginId < MAX_PLUGINS); | assert(pluginId < MAX_PLUGINS); | ||||
| assert(id < MAX_PEAKS); | assert(id < MAX_PEAKS); | ||||
| return m_insPeak[pluginId*MAX_PEAKS + id]; | return m_insPeak[pluginId*MAX_PEAKS + id]; | ||||
| } | } | ||||
| double getOutputPeak(unsigned short pluginId, unsigned short id) | |||||
| double getOutputPeak(const unsigned short pluginId, const unsigned short id) const | |||||
| { | { | ||||
| assert(pluginId < MAX_PLUGINS); | assert(pluginId < MAX_PLUGINS); | ||||
| assert(id < MAX_PEAKS); | assert(id < MAX_PEAKS); | ||||
| return m_outsPeak[pluginId*MAX_PEAKS + id]; | return m_outsPeak[pluginId*MAX_PEAKS + id]; | ||||
| } | } | ||||
| void setInputPeak(unsigned short pluginId, unsigned short id, double value) | |||||
| void setInputPeak(const unsigned short pluginId, const unsigned short id, double value) | |||||
| { | { | ||||
| assert(pluginId < MAX_PLUGINS); | assert(pluginId < MAX_PLUGINS); | ||||
| assert(id < MAX_PEAKS); | assert(id < MAX_PEAKS); | ||||
| m_insPeak[pluginId*MAX_PEAKS + id] = value; | m_insPeak[pluginId*MAX_PEAKS + id] = value; | ||||
| } | } | ||||
| void setOutputPeak(unsigned short pluginId, unsigned short id, double value) | |||||
| void setOutputPeak(const unsigned short pluginId, const unsigned short id, double value) | |||||
| { | { | ||||
| assert(pluginId < MAX_PLUGINS); | assert(pluginId < MAX_PLUGINS); | ||||
| assert(id < MAX_PEAKS); | assert(id < MAX_PEAKS); | ||||
| @@ -231,15 +239,15 @@ public: | |||||
| } | } | ||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // callback | |||||
| // Callback | |||||
| void callback(CallbackType action, unsigned short pluginId, int value1, int value2, double value3) | |||||
| void callback(const CallbackType action, const unsigned short pluginId, const int value1, const int value2, const double value3) | |||||
| { | { | ||||
| if (m_callback) | if (m_callback) | ||||
| m_callback(action, pluginId, value1, value2, value3); | m_callback(action, pluginId, value1, value2, value3); | ||||
| } | } | ||||
| void setCallback(CallbackFunc func) | |||||
| void setCallback(const CallbackFunc func) | |||||
| { | { | ||||
| m_callback = func; | m_callback = func; | ||||
| } | } | ||||
| @@ -268,16 +276,16 @@ public: | |||||
| } | } | ||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // osc stuff | |||||
| // OSC Stuff | |||||
| const char* getOscServerPath() const | |||||
| bool isOscControllerRegisted() const | |||||
| { | { | ||||
| return m_osc.getServerPath(); | |||||
| return m_osc.isControllerRegistered(); | |||||
| } | } | ||||
| bool isOscControllerRegisted() const | |||||
| const char* getOscServerPath() const | |||||
| { | { | ||||
| return m_osc.isControllerRegistered(); | |||||
| return m_osc.getServerPath(); | |||||
| } | } | ||||
| void osc_send_add_plugin(int plugin_id, const char* plugin_name); | void osc_send_add_plugin(int plugin_id, const char* plugin_name); | ||||
| @@ -304,7 +312,7 @@ public: | |||||
| #ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // rack mode | |||||
| // Rack mode | |||||
| static const unsigned short MAX_ENGINE_CONTROL_EVENTS = 512; | static const unsigned short MAX_ENGINE_CONTROL_EVENTS = 512; | ||||
| static const unsigned short MAX_ENGINE_MIDI_EVENTS = 512; | static const unsigned short MAX_ENGINE_MIDI_EVENTS = 512; | ||||
| @@ -470,7 +478,7 @@ public: | |||||
| // ------------------------------------- | // ------------------------------------- | ||||
| bool init(const char* const name); | |||||
| bool init(const char* const clientName); | |||||
| bool close(); | bool close(); | ||||
| bool isOnAudioThread(); | bool isOnAudioThread(); | ||||
| @@ -522,7 +530,7 @@ public: | |||||
| // ------------------------------------- | // ------------------------------------- | ||||
| bool init(const char* const name); | |||||
| bool init(const char* const clientName); | |||||
| bool close(); | bool close(); | ||||
| bool isOnAudioThread(); | bool isOnAudioThread(); | ||||
| @@ -85,6 +85,8 @@ CarlaEngineJack::CarlaEngineJack() : | |||||
| CarlaEngine(), | CarlaEngine(), | ||||
| rackJackPorts{nullptr} | rackJackPorts{nullptr} | ||||
| { | { | ||||
| qDebug("CarlaEngineJack::CarlaEngineJack()"); | |||||
| client = nullptr; | client = nullptr; | ||||
| state = JackTransportStopped; | state = JackTransportStopped; | ||||
| freewheel = false; | freewheel = false; | ||||
| @@ -95,13 +97,16 @@ CarlaEngineJack::CarlaEngineJack() : | |||||
| CarlaEngineJack::~CarlaEngineJack() | CarlaEngineJack::~CarlaEngineJack() | ||||
| { | { | ||||
| qDebug("CarlaEngineJack::~CarlaEngineJack()"); | |||||
| } | } | ||||
| // ------------------------------------------------------------------------------------------------------------------- | // ------------------------------------------------------------------------------------------------------------------- | ||||
| bool CarlaEngineJack::init(const char* name_) | |||||
| bool CarlaEngineJack::init(const char* const clientName) | |||||
| { | { | ||||
| client = jack_client_open(name_, JackNullOption, nullptr); | |||||
| qDebug("CarlaEngineJack::init(%s)", clientName); | |||||
| client = jack_client_open(clientName, JackNullOption, nullptr); | |||||
| state = JackTransportStopped; | state = JackTransportStopped; | ||||
| freewheel = false; | freewheel = false; | ||||
| procThread = nullptr; | procThread = nullptr; | ||||
| @@ -163,6 +168,8 @@ bool CarlaEngineJack::init(const char* name_) | |||||
| bool CarlaEngineJack::close() | bool CarlaEngineJack::close() | ||||
| { | { | ||||
| qDebug("CarlaEngineJack::close()"); | |||||
| if (name) | if (name) | ||||
| { | { | ||||
| free((void*)name); | free((void*)name); | ||||
| @@ -329,11 +336,21 @@ void CarlaEngineJack::handleProcessCallback(uint32_t nframes) | |||||
| float* audioIn2 = (float*)jack_port_get_buffer(rackJackPorts[rackPortAudioIn2], nframes); | float* audioIn2 = (float*)jack_port_get_buffer(rackJackPorts[rackPortAudioIn2], nframes); | ||||
| float* audioOut1 = (float*)jack_port_get_buffer(rackJackPorts[rackPortAudioOut1], nframes); | float* audioOut1 = (float*)jack_port_get_buffer(rackJackPorts[rackPortAudioOut1], nframes); | ||||
| float* audioOut2 = (float*)jack_port_get_buffer(rackJackPorts[rackPortAudioOut2], nframes); | float* audioOut2 = (float*)jack_port_get_buffer(rackJackPorts[rackPortAudioOut2], nframes); | ||||
| //void* controlIn = jack_port_get_buffer(rackJackPorts[rackPortControlIn], nframes); | |||||
| //void* controlOut = jack_port_get_buffer(rackJackPorts[rackPortControlOut], nframes); | |||||
| void* controlIn = jack_port_get_buffer(rackJackPorts[rackPortControlIn], nframes); | |||||
| void* controlOut = jack_port_get_buffer(rackJackPorts[rackPortControlOut], nframes); | |||||
| void* midiIn = jack_port_get_buffer(rackJackPorts[rackPortMidiIn], nframes); | void* midiIn = jack_port_get_buffer(rackJackPorts[rackPortMidiIn], nframes); | ||||
| void* midiOut = jack_port_get_buffer(rackJackPorts[rackPortMidiOut], nframes); | void* midiOut = jack_port_get_buffer(rackJackPorts[rackPortMidiOut], nframes); | ||||
| // assert buffers | |||||
| assert(audioIn1); | |||||
| assert(audioIn2); | |||||
| assert(audioOut1); | |||||
| assert(audioOut2); | |||||
| assert(controlIn); | |||||
| assert(controlOut); | |||||
| assert(midiIn); | |||||
| assert(midiOut); | |||||
| // create temporary audio buffers | // create temporary audio buffers | ||||
| float ains_tmp_buf1[nframes]; | float ains_tmp_buf1[nframes]; | ||||
| float ains_tmp_buf2[nframes]; | float ains_tmp_buf2[nframes]; | ||||
| @@ -167,6 +167,7 @@ public: | |||||
| x_client(nullptr) | x_client(nullptr) | ||||
| { | { | ||||
| qDebug("CarlaPlugin::CarlaPlugin()"); | qDebug("CarlaPlugin::CarlaPlugin()"); | ||||
| assert(engine); | |||||
| m_type = PLUGIN_NONE; | m_type = PLUGIN_NONE; | ||||
| m_hints = 0; | m_hints = 0; | ||||
| @@ -1962,15 +1963,15 @@ public: | |||||
| const char* const label; | const char* const label; | ||||
| }; | }; | ||||
| static short newLADSPA(const initializer& init, const void* const extra); | |||||
| static short newDSSI(const initializer& init, const void* const extra); | |||||
| static short newLV2(const initializer& init); | |||||
| static short newVST(const initializer& init); | |||||
| static short newGIG(const initializer& init); | |||||
| static short newSF2(const initializer& init); | |||||
| static short newSFZ(const initializer& init); | |||||
| static CarlaPlugin* newLADSPA(const initializer& init, const void* const extra); | |||||
| ///static short newDSSI(const initializer& init, const void* const extra); | |||||
| //static short newLV2(const initializer& init); | |||||
| //static short newVST(const initializer& init); | |||||
| //static short newGIG(const initializer& init); | |||||
| //static short newSF2(const initializer& init); | |||||
| //static short newSFZ(const initializer& init); | |||||
| #ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
| static short newBridge(const initializer& init, BinaryType btype, PluginType ptype); | |||||
| //static short newBridge(const initializer& init, BinaryType btype, PluginType ptype); | |||||
| #endif | #endif | ||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| @@ -456,7 +456,7 @@ PluginCategory getPluginCategoryFromName(const char* const name) | |||||
| const char* getLastError() | const char* getLastError() | ||||
| { | { | ||||
| qDebug("CarlaBackend::gettLastError()"); | |||||
| qDebug("CarlaBackend::getLastError()"); | |||||
| return carlaLastError; | return carlaLastError; | ||||
| } | } | ||||
| @@ -31,6 +31,11 @@ CarlaCheckThread::CarlaCheckThread(CarlaBackend::CarlaEngine* const engine_, QOb | |||||
| qDebug("CarlaCheckThread::CarlaCheckThread(%p)", parent); | qDebug("CarlaCheckThread::CarlaCheckThread(%p)", parent); | ||||
| } | } | ||||
| CarlaCheckThread::~CarlaCheckThread() | |||||
| { | |||||
| qDebug("CarlaCheckThread::~CarlaCheckThread()"); | |||||
| } | |||||
| void CarlaCheckThread::stopNow() | void CarlaCheckThread::stopNow() | ||||
| { | { | ||||
| m_stopNow = true; | m_stopNow = true; | ||||
| @@ -31,6 +31,8 @@ class CarlaCheckThread : public QThread | |||||
| { | { | ||||
| public: | public: | ||||
| CarlaCheckThread(CarlaBackend::CarlaEngine* const engine, QObject* parent = nullptr); | CarlaCheckThread(CarlaBackend::CarlaEngine* const engine, QObject* parent = nullptr); | ||||
| ~CarlaCheckThread(); | |||||
| void stopNow(); | void stopNow(); | ||||
| protected: | protected: | ||||
| @@ -1091,7 +1091,7 @@ private: | |||||
| float* param_buffers; | float* param_buffers; | ||||
| }; | }; | ||||
| short CarlaPlugin::newLADSPA(const initializer& init, const void* const extra) | |||||
| CarlaPlugin* CarlaPlugin::newLADSPA(const initializer& init, const void* const extra) | |||||
| { | { | ||||
| qDebug("CarlaPlugin::newLADSPA(%p, %s, %s, %s, %p)", init.engine, init.filename, init.name, init.label, extra); | qDebug("CarlaPlugin::newLADSPA(%p, %s, %s, %s, %p)", init.engine, init.filename, init.name, init.label, extra); | ||||
| @@ -1100,7 +1100,7 @@ short CarlaPlugin::newLADSPA(const initializer& init, const void* const extra) | |||||
| if (id < 0) | if (id < 0) | ||||
| { | { | ||||
| setLastError("Maximum number of plugins reached"); | setLastError("Maximum number of plugins reached"); | ||||
| return -1; | |||||
| return nullptr; | |||||
| } | } | ||||
| LadspaPlugin* const plugin = new LadspaPlugin(init.engine, id); | LadspaPlugin* const plugin = new LadspaPlugin(init.engine, id); | ||||
| @@ -1108,7 +1108,7 @@ short CarlaPlugin::newLADSPA(const initializer& init, const void* const extra) | |||||
| if (! plugin->init(init.filename, init.name, init.label, (const LADSPA_RDF_Descriptor*)extra)) | if (! plugin->init(init.filename, init.name, init.label, (const LADSPA_RDF_Descriptor*)extra)) | ||||
| { | { | ||||
| delete plugin; | delete plugin; | ||||
| return -1; | |||||
| return nullptr; | |||||
| } | } | ||||
| plugin->reload(); | plugin->reload(); | ||||
| @@ -1124,15 +1124,14 @@ short CarlaPlugin::newLADSPA(const initializer& init, const void* const extra) | |||||
| setLastError("Carla's Rack Mode can only work with Mono or Stereo plugins, sorry!"); | setLastError("Carla's Rack Mode can only work with Mono or Stereo plugins, sorry!"); | ||||
| qWarning("data: %i %i | %i %i %i", ins > 2, outs > 2, ins != outs, ins != 0, outs != 0); | qWarning("data: %i %i | %i %i %i", ins > 2, outs > 2, ins != outs, ins != 0, outs != 0); | ||||
| delete plugin; | delete plugin; | ||||
| return -1; | |||||
| return nullptr; | |||||
| } | } | ||||
| } | } | ||||
| #endif | #endif | ||||
| plugin->registerToOsc(); | plugin->registerToOsc(); | ||||
| init.engine->addPlugin(id, plugin); | |||||
| return id; | |||||
| return plugin; | |||||
| } | } | ||||
| /**@}*/ | /**@}*/ | ||||
| @@ -55,7 +55,7 @@ DEFINES += CARLA_ENGINE_JACK | |||||
| DEFINES += QTCREATOR_TEST | DEFINES += QTCREATOR_TEST | ||||
| LIBS = ../../carla-lilv/carla_lilv.a -ldl | LIBS = ../../carla-lilv/carla_lilv.a -ldl | ||||
| QMAKE_CXXFLAGS *= -fPIC -std=c++0x | |||||
| QMAKE_CXXFLAGS *= -fPIC -std=c++11 | |||||
| #INCLUDEPATH += ../rtaudio/rtaudio-4.0.11 | #INCLUDEPATH += ../rtaudio/rtaudio-4.0.11 | ||||
| #SOURCES += ../rtaudio/rtaudio-4.0.11/RtAudio.cpp | #SOURCES += ../rtaudio/rtaudio-4.0.11/RtAudio.cpp | ||||