| @@ -626,6 +626,11 @@ public: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Static values and calls | // Static values and calls | ||||
| /*! | |||||
| * TODO. | |||||
| */ | |||||
| static const unsigned short MAX_PEAKS = 2; | |||||
| /*! | /*! | ||||
| * Get the number of available engine drivers. | * Get the number of available engine drivers. | ||||
| */ | */ | ||||
| @@ -920,8 +925,6 @@ public: | |||||
| // ------------------------------------- | // ------------------------------------- | ||||
| protected: | protected: | ||||
| static const unsigned short MAX_PEAKS = 2; | |||||
| uint32_t fBufferSize; | uint32_t fBufferSize; | ||||
| double fSampleRate; | double fSampleRate; | ||||
| @@ -1442,7 +1442,7 @@ void CarlaEngine::processPatchbay(float** inBuf, float** outBuf, const uint32_t | |||||
| #ifdef BUILD_BRIDGE | #ifdef BUILD_BRIDGE | ||||
| void CarlaEngine::osc_send_peaks(CarlaPlugin* const /*plugin*/) | void CarlaEngine::osc_send_peaks(CarlaPlugin* const /*plugin*/) | ||||
| #else | #else | ||||
| void CarlaEngine::osc_send_peaks(CarlaPlugin* const plugin, const unsigned short& id) | |||||
| void CarlaEngine::osc_send_peaks(CarlaPlugin* const plugin, const unsigned short id) | |||||
| #endif | #endif | ||||
| { | { | ||||
| // Peak values | // Peak values | ||||
| @@ -122,8 +122,8 @@ enum EnginePostAction { | |||||
| struct EnginePluginData { | struct EnginePluginData { | ||||
| CarlaPlugin* plugin; | CarlaPlugin* plugin; | ||||
| float insPeak[MAX_PEAKS]; | |||||
| float outsPeak[MAX_PEAKS]; | |||||
| float insPeak[CarlaEngine::MAX_PEAKS]; | |||||
| float outsPeak[CarlaEngine::MAX_PEAKS]; | |||||
| EnginePluginData() | EnginePluginData() | ||||
| : plugin(nullptr), | : plugin(nullptr), | ||||
| @@ -23,12 +23,21 @@ | |||||
| #include "jackbridge/jackbridge.h" | #include "jackbridge/jackbridge.h" | ||||
| #include <cmath> | |||||
| CARLA_BACKEND_START_NAMESPACE | CARLA_BACKEND_START_NAMESPACE | ||||
| #if 0 | #if 0 | ||||
| } // Fix editor indentation | } // Fix editor indentation | ||||
| #endif | #endif | ||||
| // ------------------------------------------------------------------- | |||||
| // Helpers, defined in carla_plugin.cpp | |||||
| extern CarlaEngine* CarlaPluginGetEngine(CarlaPlugin* const plugin); | |||||
| extern CarlaEngineAudioPort* CarlaPluginGetAudioInPort(CarlaPlugin* const plugin, uint32_t index); | |||||
| extern CarlaEngineAudioPort* CarlaPluginGetAudioOutPort(CarlaPlugin* const plugin, uint32_t index); | |||||
| // ------------------------------------------------------------------------------------------------------------------- | // ------------------------------------------------------------------------------------------------------------------- | ||||
| // Carla Engine JACK-Audio port | // Carla Engine JACK-Audio port | ||||
| @@ -80,6 +89,8 @@ private: | |||||
| jack_client_t* const kClient; | jack_client_t* const kClient; | ||||
| jack_port_t* const kPort; | jack_port_t* const kPort; | ||||
| friend class CarlaEngineJack; | |||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaEngineJackAudioPort) | CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaEngineJackAudioPort) | ||||
| }; | }; | ||||
| @@ -467,6 +478,21 @@ private: | |||||
| // ------------------------------------------------------------------------------------------------------------------- | // ------------------------------------------------------------------------------------------------------------------- | ||||
| // Jack Engine | // Jack Engine | ||||
| #if 0 | |||||
| struct EnginePluginData { | |||||
| CarlaEngine* const engine; | |||||
| CarlaPlugin* const plugin; | |||||
| EnginePluginData(CarlaEngine* const engine_, CarlaPlugin* const plugin_) | |||||
| : engine(engine_), | |||||
| plugin(plugin_) {} | |||||
| EnginePluginData() = delete; | |||||
| EnginePluginData(EnginePlugin&) = delete; | |||||
| EnginePluginData(const EnginePlugin&) = delete; | |||||
| }; | |||||
| #endif | |||||
| class CarlaEngineJack : public CarlaEngine | class CarlaEngineJack : public CarlaEngine | ||||
| { | { | ||||
| public: | public: | ||||
| @@ -1007,10 +1033,10 @@ private: | |||||
| // ------------------------------------- | // ------------------------------------- | ||||
| static void processPlugin(CarlaPlugin* const p, const uint32_t nframes) | |||||
| void processPlugin(CarlaPlugin* const plugin, const uint32_t nframes) | |||||
| { | { | ||||
| const uint32_t inCount = p->audioInCount(); | |||||
| const uint32_t outCount = p->audioOutCount(); | |||||
| const uint32_t inCount = plugin->audioInCount(); | |||||
| const uint32_t outCount = plugin->audioOutCount(); | |||||
| float* inBuffer[inCount]; | float* inBuffer[inCount]; | ||||
| float* outBuffer[outCount]; | float* outBuffer[outCount]; | ||||
| @@ -1022,78 +1048,82 @@ private: | |||||
| carla_zeroFloat(outPeaks, outCount); | carla_zeroFloat(outPeaks, outCount); | ||||
| for (uint32_t i=0; i < inCount; i++) | for (uint32_t i=0; i < inCount; i++) | ||||
| inBuffer[i] = p->getAudioInPortBuffer(i); | |||||
| { | |||||
| CarlaEngineAudioPort* const port = CarlaPluginGetAudioInPort(plugin, i); | |||||
| inBuffer[i] = port->getBuffer(); | |||||
| } | |||||
| for (uint32_t i=0; i < outCount; i++) | for (uint32_t i=0; i < outCount; i++) | ||||
| outBuffer[i] = p->getAudioOutPortBuffer(i); | |||||
| { | |||||
| CarlaEngineAudioPort* const port = CarlaPluginGetAudioOutPort(plugin, i); | |||||
| outBuffer[i] = port->getBuffer(); | |||||
| } | |||||
| for (uint32_t i=0; i < inCount; i++) | for (uint32_t i=0; i < inCount; i++) | ||||
| { | { | ||||
| for (uint32_t j=0; j < nframes; j++) | for (uint32_t j=0; j < nframes; j++) | ||||
| { | { | ||||
| const float absV = std::abs(inBuffer[i][j]); | |||||
| const float absV = std::fabs(inBuffer[i][j]); | |||||
| if (absV > inPeaks[i]) | if (absV > inPeaks[i]) | ||||
| inPeaks[i] = absV; | inPeaks[i] = absV; | ||||
| } | } | ||||
| } | } | ||||
| p->process(inBuffer, outBuffer, nframes); | |||||
| plugin->process(inBuffer, outBuffer, nframes); | |||||
| for (uint32_t i=0; i < outCount; i++) | for (uint32_t i=0; i < outCount; i++) | ||||
| { | { | ||||
| for (uint32_t j=0; j < nframes; j++) | for (uint32_t j=0; j < nframes; j++) | ||||
| { | { | ||||
| const float absV = std::abs(outBuffer[i][j]); | |||||
| const float absV = std::fabs(outBuffer[i][j]); | |||||
| if (absV > outPeaks[i]) | if (absV > outPeaks[i]) | ||||
| outPeaks[i] = absV; | outPeaks[i] = absV; | ||||
| } | } | ||||
| } | } | ||||
| //if (CarlaEngineJack* const engine = (CarlaEngineJack*)p->getEngine()) | |||||
| // engine->setPeaks(p->id(), inPeaks, outPeaks); | |||||
| setPeaks(plugin->id(), inPeaks, outPeaks); | |||||
| } | } | ||||
| static void latencyPlugin(CarlaPlugin* const p, jack_latency_callback_mode_t mode) | |||||
| void latencyPlugin(CarlaPlugin* const plugin, jack_latency_callback_mode_t mode) | |||||
| { | { | ||||
| const uint32_t inCount = plugin->audioInCount(); | |||||
| const uint32_t outCount = plugin->audioOutCount(); | |||||
| jack_latency_range_t range; | jack_latency_range_t range; | ||||
| uint32_t pluginLatency = 0; //p->getLatency(); | |||||
| uint32_t pluginLatency = plugin->latency(); | |||||
| if (pluginLatency == 0) | if (pluginLatency == 0) | ||||
| return; | return; | ||||
| if (mode == JackCaptureLatency) | if (mode == JackCaptureLatency) | ||||
| { | { | ||||
| #if 0 | |||||
| for (uint32_t i=0; i < p->aIn.count; i++) | |||||
| for (uint32_t i=0; i < inCount; i++) | |||||
| { | { | ||||
| uint aOutI = (i >= p->aOut.count) ? p->aOut.count : i; | |||||
| jack_port_t* const portIn = ((CarlaEngineJackAudioPort*)p->aIn.ports[i])->m_port; | |||||
| jack_port_t* const portOut = ((CarlaEngineJackAudioPort*)p->aOut.ports[aOutI])->m_port; | |||||
| uint aOutI = (i >= outCount) ? outCount : i; | |||||
| jack_port_t* const portIn = ((CarlaEngineJackAudioPort*)CarlaPluginGetAudioInPort(plugin, i))->kPort; | |||||
| jack_port_t* const portOut = ((CarlaEngineJackAudioPort*)CarlaPluginGetAudioOutPort(plugin, aOutI))->kPort; | |||||
| jackbridge_port_get_latency_range(portIn, mode, &range); | jackbridge_port_get_latency_range(portIn, mode, &range); | ||||
| range.min += pluginLatency; | range.min += pluginLatency; | ||||
| range.max += pluginLatency; | range.max += pluginLatency; | ||||
| jackbridge_port_set_latency_range(portOut, mode, &range); | jackbridge_port_set_latency_range(portOut, mode, &range); | ||||
| } | } | ||||
| #endif | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| #if 0 | |||||
| for (uint32_t i=0; i < p->aOut.count; i++) | |||||
| for (uint32_t i=0; i < outCount; i++) | |||||
| { | { | ||||
| uint aInI = (i >= p->aIn.count) ? p->aIn.count : i; | |||||
| jack_port_t* const portIn = ((CarlaEngineJackAudioPort*)p->aIn.ports[aInI])->m_port; | |||||
| jack_port_t* const portOut = ((CarlaEngineJackAudioPort*)p->aOut.ports[i])->m_port; | |||||
| uint aInI = (i >= inCount) ? inCount : i; | |||||
| jack_port_t* const portIn = ((CarlaEngineJackAudioPort*)CarlaPluginGetAudioInPort(plugin, aInI))->kPort; | |||||
| jack_port_t* const portOut = ((CarlaEngineJackAudioPort*)CarlaPluginGetAudioOutPort(plugin, i))->kPort; | |||||
| jackbridge_port_get_latency_range(portOut, mode, &range); | jackbridge_port_get_latency_range(portOut, mode, &range); | ||||
| range.min += pluginLatency; | range.min += pluginLatency; | ||||
| range.max += pluginLatency; | range.max += pluginLatency; | ||||
| jackbridge_port_set_latency_range(portIn, mode, &range); | jackbridge_port_set_latency_range(portIn, mode, &range); | ||||
| } | } | ||||
| #endif | |||||
| } | } | ||||
| } | } | ||||
| @@ -1145,10 +1175,12 @@ private: | |||||
| { | { | ||||
| CarlaPlugin* const plugin = (CarlaPlugin*)arg; | CarlaPlugin* const plugin = (CarlaPlugin*)arg; | ||||
| if (plugin && plugin->enabled()) | |||||
| if (plugin != nullptr && plugin->enabled()) | |||||
| { | { | ||||
| CarlaEngineJack* const engine = (CarlaEngineJack*)CarlaPluginGetEngine(plugin); | |||||
| plugin->initBuffers(); | plugin->initBuffers(); | ||||
| processPlugin(plugin, nframes); | |||||
| engine->processPlugin(plugin, nframes); | |||||
| } | } | ||||
| return 0; | return 0; | ||||
| @@ -1158,8 +1190,12 @@ private: | |||||
| { | { | ||||
| CarlaPlugin* const plugin = (CarlaPlugin*)arg; | CarlaPlugin* const plugin = (CarlaPlugin*)arg; | ||||
| if (plugin && plugin->enabled()) | |||||
| latencyPlugin(plugin, mode); | |||||
| if (plugin != nullptr && plugin->enabled()) | |||||
| { | |||||
| CarlaEngineJack* const engine = (CarlaEngineJack*)CarlaPluginGetEngine(plugin); | |||||
| engine->latencyPlugin(plugin, mode); | |||||
| } | |||||
| } | } | ||||
| #endif | #endif | ||||
| @@ -15,7 +15,7 @@ | |||||
| * For a full copy of the GNU General Public License see the GPL.txt file | * For a full copy of the GNU General Public License see the GPL.txt file | ||||
| */ | */ | ||||
| #ifdef CARLA_ENGINE_PLUGIN | |||||
| #if 0 //def CARLA_ENGINE_PLUGIN | |||||
| #include "carla_engine_internal.hpp" | #include "carla_engine_internal.hpp" | ||||
| #include "carla_backend_utils.hpp" | #include "carla_backend_utils.hpp" | ||||
| @@ -37,6 +37,11 @@ static const CustomData kCustomDataNull; | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Helpers | // Helpers | ||||
| CarlaEngine* CarlaPluginGetEngine(CarlaPlugin* const plugin) | |||||
| { | |||||
| return CarlaPluginProtectedData::getEngine(plugin); | |||||
| } | |||||
| CarlaEngineAudioPort* CarlaPluginGetAudioInPort(CarlaPlugin* const plugin, uint32_t index) | CarlaEngineAudioPort* CarlaPluginGetAudioInPort(CarlaPlugin* const plugin, uint32_t index) | ||||
| { | { | ||||
| return CarlaPluginProtectedData::getAudioInPort(plugin, index); | return CarlaPluginProtectedData::getAudioInPort(plugin, index); | ||||
| @@ -1396,6 +1401,9 @@ bool CarlaPlugin::libOpen(const char* const filename) | |||||
| bool CarlaPlugin::libClose() | bool CarlaPlugin::libClose() | ||||
| { | { | ||||
| if (kData->lib == nullptr) | |||||
| return false; | |||||
| const bool ret = lib_close(kData->lib); | const bool ret = lib_close(kData->lib); | ||||
| kData->lib = nullptr; | kData->lib = nullptr; | ||||
| return ret; | return ret; | ||||
| @@ -530,6 +530,11 @@ struct CarlaPluginProtectedData { | |||||
| CarlaPluginProtectedData(CarlaPluginProtectedData&) = delete; | CarlaPluginProtectedData(CarlaPluginProtectedData&) = delete; | ||||
| CarlaPluginProtectedData(const CarlaPluginProtectedData&) = delete; | CarlaPluginProtectedData(const CarlaPluginProtectedData&) = delete; | ||||
| static CarlaEngine* getEngine(CarlaPlugin* const plugin) | |||||
| { | |||||
| return plugin->kData->engine; | |||||
| } | |||||
| static CarlaEngineAudioPort* getAudioInPort(CarlaPlugin* const plugin, uint32_t index) | static CarlaEngineAudioPort* getAudioInPort(CarlaPlugin* const plugin, uint32_t index) | ||||
| { | { | ||||
| return plugin->kData->audioIn.ports[index].port; | return plugin->kData->audioIn.ports[index].port; | ||||
| @@ -211,20 +211,19 @@ public: | |||||
| CarlaPlugin::getRealName(strBuf); | CarlaPlugin::getRealName(strBuf); | ||||
| } | } | ||||
| #if 0 | |||||
| void getParameterName(const uint32_t parameterId, char* const strBuf) | void getParameterName(const uint32_t parameterId, char* const strBuf) | ||||
| { | { | ||||
| CARLA_ASSERT(descriptor); | |||||
| CARLA_ASSERT(handle); | |||||
| CARLA_ASSERT(parameterId < param.count); | |||||
| CARLA_ASSERT(fDescriptor != nullptr); | |||||
| CARLA_ASSERT(fHandle != nullptr); | |||||
| CARLA_ASSERT(parameterId < kData->param.count); | |||||
| if (descriptor && handle && parameterId < param.count && descriptor->get_parameter_info) | |||||
| if (fDescriptor != nullptr && fHandle != nullptr && parameterId < kData->param.count && fDescriptor->get_parameter_info != nullptr) | |||||
| { | { | ||||
| const ::Parameter* const param = descriptor->get_parameter_info(handle, parameterId); | |||||
| const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId); | |||||
| if (param && param->name) | |||||
| if (param != nullptr && param->name != nullptr) | |||||
| { | { | ||||
| strncpy(strBuf, param->name, STR_MAX); | |||||
| std::strncpy(strBuf, param->name, STR_MAX); | |||||
| return; | return; | ||||
| } | } | ||||
| } | } | ||||
| @@ -234,17 +233,15 @@ public: | |||||
| void getParameterText(const uint32_t parameterId, char* const strBuf) | void getParameterText(const uint32_t parameterId, char* const strBuf) | ||||
| { | { | ||||
| CARLA_ASSERT(descriptor); | |||||
| CARLA_ASSERT(handle); | |||||
| CARLA_ASSERT(parameterId < param.count); | |||||
| CARLA_ASSERT(fDescriptor != nullptr); | |||||
| CARLA_ASSERT(fHandle != nullptr); | |||||
| CARLA_ASSERT(parameterId < kData->param.count); | |||||
| if (descriptor && handle && parameterId < param.count && descriptor->get_parameter_text) | |||||
| if (fDescriptor != nullptr && fHandle != nullptr && parameterId < kData->param.count && fDescriptor->get_parameter_text != nullptr) | |||||
| { | { | ||||
| const char* const text = descriptor->get_parameter_text(handle, parameterId); | |||||
| if (text) | |||||
| if (const char* const text = fDescriptor->get_parameter_text(fHandle, parameterId)) | |||||
| { | { | ||||
| strncpy(strBuf, text, STR_MAX); | |||||
| std::strncpy(strBuf, text, STR_MAX); | |||||
| return; | return; | ||||
| } | } | ||||
| } | } | ||||
| @@ -254,17 +251,17 @@ public: | |||||
| void getParameterUnit(const uint32_t parameterId, char* const strBuf) | void getParameterUnit(const uint32_t parameterId, char* const strBuf) | ||||
| { | { | ||||
| CARLA_ASSERT(descriptor); | |||||
| CARLA_ASSERT(handle); | |||||
| CARLA_ASSERT(parameterId < param.count); | |||||
| CARLA_ASSERT(fDescriptor != nullptr); | |||||
| CARLA_ASSERT(fHandle != nullptr); | |||||
| CARLA_ASSERT(parameterId < kData->param.count); | |||||
| if (descriptor && handle && parameterId < param.count && descriptor->get_parameter_info) | |||||
| if (fDescriptor != nullptr && fHandle != nullptr && parameterId < kData->param.count && fDescriptor->get_parameter_info != nullptr) | |||||
| { | { | ||||
| const ::Parameter* const param = descriptor->get_parameter_info(handle, parameterId); | |||||
| const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId); | |||||
| if (param && param->unit) | |||||
| if (param != nullptr && param->unit != nullptr) | |||||
| { | { | ||||
| strncpy(strBuf, param->unit, STR_MAX); | |||||
| std::strncpy(strBuf, param->unit, STR_MAX); | |||||
| return; | return; | ||||
| } | } | ||||
| } | } | ||||
| @@ -274,22 +271,20 @@ public: | |||||
| void getParameterScalePointLabel(const uint32_t parameterId, const uint32_t scalePointId, char* const strBuf) | void getParameterScalePointLabel(const uint32_t parameterId, const uint32_t scalePointId, char* const strBuf) | ||||
| { | { | ||||
| CARLA_ASSERT(descriptor); | |||||
| CARLA_ASSERT(handle); | |||||
| CARLA_ASSERT(parameterId < param.count); | |||||
| CARLA_ASSERT(fDescriptor != nullptr); | |||||
| CARLA_ASSERT(fHandle != nullptr); | |||||
| CARLA_ASSERT(parameterId < kData->param.count); | |||||
| CARLA_ASSERT(scalePointId < parameterScalePointCount(parameterId)); | CARLA_ASSERT(scalePointId < parameterScalePointCount(parameterId)); | ||||
| if (descriptor && handle && parameterId < param.count && descriptor->get_parameter_info) | |||||
| if (fDescriptor != nullptr && fHandle != nullptr && parameterId < kData->param.count && fDescriptor->get_parameter_info != nullptr) | |||||
| { | { | ||||
| const ::Parameter* const param = descriptor->get_parameter_info(handle, parameterId); | |||||
| if (param && scalePointId < param->scalePointCount && param->scalePoints) | |||||
| if (const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)) | |||||
| { | { | ||||
| const ::ParameterScalePoint* const scalePoint = ¶m->scalePoints[scalePointId]; | |||||
| const ParameterScalePoint& scalePoint = param->scalePoints[scalePointId]; | |||||
| if (scalePoint && scalePoint->label) | |||||
| if (scalePoint.label != nullptr) | |||||
| { | { | ||||
| strncpy(strBuf, scalePoint->label, STR_MAX); | |||||
| std::strncpy(strBuf, scalePoint.label, STR_MAX); | |||||
| return; | return; | ||||
| } | } | ||||
| } | } | ||||
| @@ -298,32 +293,29 @@ public: | |||||
| CarlaPlugin::getParameterScalePointLabel(parameterId, scalePointId, strBuf); | CarlaPlugin::getParameterScalePointLabel(parameterId, scalePointId, strBuf); | ||||
| } | } | ||||
| void getGuiInfo(GuiType* const type, bool* const resizable) | |||||
| { | |||||
| *type = GUI_EXTERNAL_LV2; // FIXME, should be as _PLUGIN | |||||
| *resizable = false; | |||||
| } | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Set data (plugin-specific stuff) | // Set data (plugin-specific stuff) | ||||
| void setParameterValue(const uint32_t parameterId, double value, const bool sendGui, const bool sendOsc, const bool sendCallback) | |||||
| void setParameterValue(const uint32_t parameterId, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback) | |||||
| { | { | ||||
| CARLA_ASSERT(descriptor); | |||||
| CARLA_ASSERT(handle); | |||||
| CARLA_ASSERT(parameterId < param.count); | |||||
| CARLA_ASSERT(fDescriptor != nullptr); | |||||
| CARLA_ASSERT(fHandle != nullptr); | |||||
| CARLA_ASSERT(parameterId < kData->param.count); | |||||
| const float fixedValue = kData->param.fixValue(parameterId, value); | |||||
| if (descriptor && handle && parameterId < param.count) | |||||
| if (fDescriptor != nullptr && fHandle != nullptr && parameterId < kData->param.count && fDescriptor->set_parameter_value != nullptr) | |||||
| { | { | ||||
| fixParameterValue(value, param.ranges[parameterId]); | |||||
| fDescriptor->set_parameter_value(fHandle, parameterId, fixedValue); | |||||
| descriptor->set_parameter_value(handle, param.data[parameterId].rindex, value); | |||||
| if (h2) descriptor->set_parameter_value(h2, param.data[parameterId].rindex, value); | |||||
| if (fHandle2 != nullptr) | |||||
| fDescriptor->set_parameter_value(fHandle2, parameterId, fixedValue); | |||||
| } | } | ||||
| CarlaPlugin::setParameterValue(parameterId, value, sendGui, sendOsc, sendCallback); | |||||
| CarlaPlugin::setParameterValue(parameterId, fixedValue, sendGui, sendOsc, sendCallback); | |||||
| } | } | ||||
| #if 0 | |||||
| void setCustomData(const char* const type, const char* const key, const char* const value, const bool sendGui) | void setCustomData(const char* const type, const char* const key, const char* const value, const bool sendGui) | ||||
| { | { | ||||
| CARLA_ASSERT(descriptor); | CARLA_ASSERT(descriptor); | ||||
| @@ -359,8 +351,8 @@ public: | |||||
| void setMidiProgram(int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback, const bool block) | void setMidiProgram(int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback, const bool block) | ||||
| { | { | ||||
| CARLA_ASSERT(descriptor); | |||||
| CARLA_ASSERT(handle); | |||||
| CARLA_ASSERT(fDescriptor != nullptr); | |||||
| CARLA_ASSERT(fHandle != nullptr); | |||||
| CARLA_ASSERT(index >= -1 && index < (int32_t)midiprog.count); | CARLA_ASSERT(index >= -1 && index < (int32_t)midiprog.count); | ||||
| if (index < -1) | if (index < -1) | ||||
| @@ -386,27 +378,27 @@ public: | |||||
| CarlaPlugin::setMidiProgram(index, sendGui, sendOsc, sendCallback, block); | CarlaPlugin::setMidiProgram(index, sendGui, sendOsc, sendCallback, block); | ||||
| } | } | ||||
| #endif | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Set gui stuff | // Set gui stuff | ||||
| void showGui(const bool yesNo) | void showGui(const bool yesNo) | ||||
| { | { | ||||
| CARLA_ASSERT(descriptor); | |||||
| CARLA_ASSERT(handle); | |||||
| CARLA_ASSERT(fDescriptor != nullptr); | |||||
| CARLA_ASSERT(fHandle != nullptr); | |||||
| if (descriptor && handle && descriptor->ui_show) | |||||
| descriptor->ui_show(handle, yesNo); | |||||
| if (fDescriptor != nullptr && fHandle != nullptr && fDescriptor->ui_show != nullptr) | |||||
| fDescriptor->ui_show(fHandle, yesNo); | |||||
| } | } | ||||
| void idleGui() | void idleGui() | ||||
| { | { | ||||
| // FIXME - this should not be called if there's no GUI! | |||||
| CARLA_ASSERT(descriptor); | |||||
| CARLA_ASSERT(handle); | |||||
| CARLA_ASSERT(fDescriptor != nullptr); | |||||
| CARLA_ASSERT(fHandle != nullptr); | |||||
| if (descriptor && handle && descriptor->ui_idle) | |||||
| descriptor->ui_idle(handle); | |||||
| if (fDescriptor != nullptr && fHandle != nullptr && fDescriptor->ui_idle != nullptr) | |||||
| fDescriptor->ui_idle(fHandle); | |||||
| } | } | ||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| @@ -415,8 +407,9 @@ public: | |||||
| void reload() | void reload() | ||||
| { | { | ||||
| qDebug("NativePlugin::reload() - start"); | qDebug("NativePlugin::reload() - start"); | ||||
| CARLA_ASSERT(descriptor); | |||||
| CARLA_ASSERT(fDescriptor != nullptr); | |||||
| #if 0 | |||||
| const ProcessMode processMode(x_engine->getOptions().processMode); | const ProcessMode processMode(x_engine->getOptions().processMode); | ||||
| // Safely disable plugin for reload | // Safely disable plugin for reload | ||||
| @@ -702,35 +695,39 @@ public: | |||||
| param.count = params; | param.count = params; | ||||
| // plugin checks | // plugin checks | ||||
| m_hints &= ~(PLUGIN_IS_SYNTH | PLUGIN_USES_CHUNKS | PLUGIN_CAN_DRYWET | PLUGIN_CAN_VOLUME | PLUGIN_CAN_BALANCE | PLUGIN_CAN_FORCE_STEREO); | |||||
| fHints &= ~(PLUGIN_IS_SYNTH | PLUGIN_USES_CHUNKS | PLUGIN_CAN_DRYWET | PLUGIN_CAN_VOLUME | PLUGIN_CAN_BALANCE | PLUGIN_CAN_FORCE_STEREO); | |||||
| if (aOuts > 0 && (aIns == aOuts || aIns == 1)) | if (aOuts > 0 && (aIns == aOuts || aIns == 1)) | ||||
| m_hints |= PLUGIN_CAN_DRYWET; | |||||
| fHints |= PLUGIN_CAN_DRYWET; | |||||
| if (aOuts > 0) | if (aOuts > 0) | ||||
| m_hints |= PLUGIN_CAN_VOLUME; | |||||
| fHints |= PLUGIN_CAN_VOLUME; | |||||
| if (aOuts >= 2 && aOuts%2 == 0) | if (aOuts >= 2 && aOuts%2 == 0) | ||||
| m_hints |= PLUGIN_CAN_BALANCE; | |||||
| fHints |= PLUGIN_CAN_BALANCE; | |||||
| if (aIns <= 2 && aOuts <= 2 && (aIns == aOuts || aIns == 0 || aOuts == 0) && mIns <= 1 && mOuts <= 1) | if (aIns <= 2 && aOuts <= 2 && (aIns == aOuts || aIns == 0 || aOuts == 0) && mIns <= 1 && mOuts <= 1) | ||||
| m_hints |= PLUGIN_CAN_FORCE_STEREO; | |||||
| fHints |= PLUGIN_CAN_FORCE_STEREO; | |||||
| #endif | |||||
| // native plugin hints | // native plugin hints | ||||
| if (descriptor->hints & ::PLUGIN_IS_SYNTH) | |||||
| m_hints |= PLUGIN_IS_SYNTH; | |||||
| if (descriptor->hints & ::PLUGIN_HAS_GUI) | |||||
| m_hints |= PLUGIN_HAS_GUI; | |||||
| if (descriptor->hints & ::PLUGIN_USES_SINGLE_THREAD) | |||||
| m_hints |= PLUGIN_USES_SINGLE_THREAD; | |||||
| if (fDescriptor->hints & ::PLUGIN_IS_RTSAFE) | |||||
| fHints |= PLUGIN_IS_RTSAFE; | |||||
| if (fDescriptor->hints & ::PLUGIN_IS_SYNTH) | |||||
| fHints |= PLUGIN_IS_SYNTH; | |||||
| if (fDescriptor->hints & ::PLUGIN_HAS_GUI) | |||||
| fHints |= PLUGIN_HAS_GUI; | |||||
| if (fDescriptor->hints & ::PLUGIN_USES_SINGLE_THREAD) | |||||
| fHints |= PLUGIN_USES_SINGLE_THREAD; | |||||
| reloadPrograms(true); | reloadPrograms(true); | ||||
| x_client->activate(); | |||||
| kData->client->activate(); | |||||
| qDebug("NativePlugin::reload() - end"); | qDebug("NativePlugin::reload() - end"); | ||||
| } | } | ||||
| #if 0 | |||||
| void reloadPrograms(const bool init) | void reloadPrograms(const bool init) | ||||
| { | { | ||||
| qDebug("NativePlugin::reloadPrograms(%s)", bool2str(init)); | qDebug("NativePlugin::reloadPrograms(%s)", bool2str(init)); | ||||
| @@ -2257,7 +2257,7 @@ class PluginWidget(QFrame): | |||||
| @pyqtSlot(bool) | @pyqtSlot(bool) | ||||
| def slot_guiClicked(self, show): | def slot_guiClicked(self, show): | ||||
| Carla.host.show_gui(show) | |||||
| Carla.host.show_gui(self.fPluginId, show) | |||||
| @pyqtSlot(bool) | @pyqtSlot(bool) | ||||
| def slot_editClicked(self, show): | def slot_editClicked(self, show): | ||||