| @@ -23,6 +23,8 @@ moc_*.cpp | |||||
| ui_*.h | ui_*.h | ||||
| carla-bridge-qtcreator | carla-bridge-qtcreator | ||||
| carla-bridge-posix32 | |||||
| carla-bridge-posix64 | |||||
| carla-bridge-lv2-gtk2 | carla-bridge-lv2-gtk2 | ||||
| carla-bridge-lv2-gtk3 | carla-bridge-lv2-gtk3 | ||||
| carla-bridge-lv2-qt4 | carla-bridge-lv2-qt4 | ||||
| @@ -511,8 +511,8 @@ struct ParameterRanges { | |||||
| ParameterRanges() | ParameterRanges() | ||||
| : def(0.0), | : def(0.0), | ||||
| //min(0.0), | |||||
| //max(1.0), | |||||
| min(0.0), | |||||
| max(1.0), | |||||
| step(0.01), | step(0.01), | ||||
| stepSmall(0.0001), | stepSmall(0.0001), | ||||
| stepLarge(0.1) {} | stepLarge(0.1) {} | ||||
| @@ -846,7 +846,7 @@ double get_current_parameter_value(unsigned short plugin_id, uint32_t parameter_ | |||||
| double get_input_peak_value(unsigned short plugin_id, unsigned short port_id) | double get_input_peak_value(unsigned short plugin_id, unsigned short port_id) | ||||
| { | { | ||||
| if (plugin_id < CarlaBackend::MAX_PLUGINS && (port_id == 1 || port_id == 2)) | |||||
| if (plugin_id < CarlaBackend::CarlaEngine::maxPluginNumber() && (port_id == 1 || port_id == 2)) | |||||
| return carlaEngine->getInputPeak(plugin_id, port_id-1); | return carlaEngine->getInputPeak(plugin_id, port_id-1); | ||||
| qCritical("CarlaBackendStandalone::get_input_peak_value(%i, %i) - invalid plugin or port value", plugin_id, port_id); | qCritical("CarlaBackendStandalone::get_input_peak_value(%i, %i) - invalid plugin or port value", plugin_id, port_id); | ||||
| @@ -855,7 +855,7 @@ double get_input_peak_value(unsigned short plugin_id, unsigned short port_id) | |||||
| double get_output_peak_value(unsigned short plugin_id, unsigned short port_id) | double get_output_peak_value(unsigned short plugin_id, unsigned short port_id) | ||||
| { | { | ||||
| if (plugin_id < CarlaBackend::MAX_PLUGINS && (port_id == 1 || port_id == 2)) | |||||
| if (plugin_id < CarlaBackend::CarlaEngine::maxPluginNumber() && (port_id == 1 || port_id == 2)) | |||||
| return carlaEngine->getOutputPeak(plugin_id, port_id-1); | return carlaEngine->getOutputPeak(plugin_id, port_id-1); | ||||
| qCritical("CarlaBackendStandalone::get_output_peak_value(%i, %i) - invalid plugin or port value", plugin_id, port_id); | qCritical("CarlaBackendStandalone::get_output_peak_value(%i, %i) - invalid plugin or port value", plugin_id, port_id); | ||||
| @@ -20,35 +20,59 @@ | |||||
| #include <QtCore/QFile> | #include <QtCore/QFile> | ||||
| #include <QtCore/QTextStream> | #include <QtCore/QTextStream> | ||||
| CARLA_BACKEND_START_NAMESPACE | |||||
| #define CARLA_BRIDGE_CHECK_OSC_TYPES(/* argc, types, */ argcToCompare, typesToCompare) \ | |||||
| /* check argument count */ \ | |||||
| if (argc != argcToCompare) \ | |||||
| { \ | |||||
| qCritical("BridgePlugin::%s() - argument count mismatch: %i != %i", __FUNCTION__, argc, argcToCompare); \ | |||||
| return 1; \ | |||||
| } \ | |||||
| if (argc > 0) \ | |||||
| { \ | |||||
| /* check for nullness */ \ | |||||
| if (! (types && typesToCompare)) \ | |||||
| { \ | |||||
| qCritical("BridgePlugin::%s() - argument types are null", __FUNCTION__); \ | |||||
| return 1; \ | |||||
| } \ | |||||
| /* check argument types */ \ | |||||
| if (strcmp(types, typesToCompare) != 0) \ | |||||
| { \ | |||||
| qCritical("BridgePlugin::%s() - argument types mismatch: '%s' != '%s'", __FUNCTION__, types, typesToCompare); \ | |||||
| return 1; \ | |||||
| } \ | |||||
| } | |||||
| #if 0 | |||||
| } /* adjust editor indent */ | |||||
| #endif | |||||
| CARLA_BACKEND_START_NAMESPACE | |||||
| struct BridgeParamInfo { | struct BridgeParamInfo { | ||||
| double value; | double value; | ||||
| QString name; | QString name; | ||||
| QString unit; | QString unit; | ||||
| BridgeParamInfo() | |||||
| : value(0.0) {} | |||||
| }; | }; | ||||
| class BridgePlugin : public CarlaPlugin | class BridgePlugin : public CarlaPlugin | ||||
| { | { | ||||
| public: | public: | ||||
| BridgePlugin(CarlaEngine* const engine, unsigned short id, BinaryType btype, PluginType ptype) : CarlaPlugin(engine, id), | |||||
| m_binary(btype) | |||||
| BridgePlugin(CarlaEngine* const engine, const unsigned short id, const BinaryType btype, const PluginType ptype) | |||||
| : CarlaPlugin(engine, id), | |||||
| m_binary(btype) | |||||
| { | { | ||||
| qDebug("BridgePlugin::BridgePlugin()"); | qDebug("BridgePlugin::BridgePlugin()"); | ||||
| m_type = ptype; | m_type = ptype; | ||||
| m_hints = PLUGIN_IS_BRIDGE; | m_hints = PLUGIN_IS_BRIDGE; | ||||
| m_initiated = false; | m_initiated = false; | ||||
| m_saved = false; | m_saved = false; | ||||
| info.ains = 0; | |||||
| info.aouts = 0; | |||||
| info.mins = 0; | |||||
| info.mouts = 0; | |||||
| info.aIns = 0; | |||||
| info.aOuts = 0; | |||||
| info.mIns = 0; | |||||
| info.mOuts = 0; | |||||
| info.category = PLUGIN_CATEGORY_NONE; | info.category = PLUGIN_CATEGORY_NONE; | ||||
| info.uniqueId = 0; | info.uniqueId = 0; | ||||
| @@ -119,22 +143,22 @@ public: | |||||
| uint32_t audioInCount() | uint32_t audioInCount() | ||||
| { | { | ||||
| return info.ains; | |||||
| return info.aIns; | |||||
| } | } | ||||
| uint32_t audioOutCount() | uint32_t audioOutCount() | ||||
| { | { | ||||
| return info.aouts; | |||||
| return info.aOuts; | |||||
| } | } | ||||
| uint32_t midiInCount() | uint32_t midiInCount() | ||||
| { | { | ||||
| return info.mins; | |||||
| return info.mIns; | |||||
| } | } | ||||
| uint32_t midiOutCount() | uint32_t midiOutCount() | ||||
| { | { | ||||
| return info.mouts; | |||||
| return info.mOuts; | |||||
| } | } | ||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| @@ -195,21 +219,21 @@ public: | |||||
| CarlaPlugin::getRealName(strBuf); | CarlaPlugin::getRealName(strBuf); | ||||
| } | } | ||||
| void getParameterName(uint32_t parameterId, char* const strBuf) | |||||
| void getParameterName(const uint32_t parameterId, char* const strBuf) | |||||
| { | { | ||||
| Q_ASSERT(parameterId < param.count); | Q_ASSERT(parameterId < param.count); | ||||
| strncpy(strBuf, params[parameterId].name.toUtf8().constData(), STR_MAX); | strncpy(strBuf, params[parameterId].name.toUtf8().constData(), STR_MAX); | ||||
| } | } | ||||
| void getParameterUnit(uint32_t parameterId, char* const strBuf) | |||||
| void getParameterUnit(const uint32_t parameterId, char* const strBuf) | |||||
| { | { | ||||
| Q_ASSERT(parameterId < param.count); | Q_ASSERT(parameterId < param.count); | ||||
| strncpy(strBuf, params[parameterId].unit.toUtf8().constData(), STR_MAX); | strncpy(strBuf, params[parameterId].unit.toUtf8().constData(), STR_MAX); | ||||
| } | } | ||||
| void getGuiInfo(GuiType* type, bool* resizable) | |||||
| void getGuiInfo(GuiType* const type, bool* const resizable) | |||||
| { | { | ||||
| if (m_hints & PLUGIN_HAS_GUI) | if (m_hints & PLUGIN_HAS_GUI) | ||||
| *type = GUI_EXTERNAL_OSC; | *type = GUI_EXTERNAL_OSC; | ||||
| @@ -221,166 +245,159 @@ public: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Set data (internal stuff) | // Set data (internal stuff) | ||||
| int setOscBridgeInfo(const PluginBridgeInfoType type, const lo_arg* const* const argv) | |||||
| int setOscBridgeInfo(const PluginBridgeInfoType type, const int argc, const lo_arg* const* const argv, const char* const types) | |||||
| { | { | ||||
| qDebug("setOscBridgeInfo(%i, %p)", type, argv); | |||||
| qDebug("setOscBridgeInfo(%i, %i, %p, \"%s\")", type, argc, argv, types); | |||||
| switch (type) | switch (type) | ||||
| { | { | ||||
| // case PluginBridgeAudioCount: | |||||
| // { | |||||
| // int aIns = argv[0]->i; | |||||
| // int aOuts = argv[1]->i; | |||||
| // int aTotal = argv[2]->i; | |||||
| // info.ains = aIns; | |||||
| // info.aouts = aOuts; | |||||
| // break; | |||||
| // Q_UNUSED(aTotal); | |||||
| // } | |||||
| // case PluginBridgeMidiCount: | |||||
| // { | |||||
| // int mIns = argv[0]->i; | |||||
| // int mOuts = argv[1]->i; | |||||
| // int mTotal = argv[2]->i; | |||||
| // info.mins = mIns; | |||||
| // info.mouts = mOuts; | |||||
| // break; | |||||
| // Q_UNUSED(mTotal); | |||||
| // } | |||||
| // case PluginBridgeParameterCount: | |||||
| // { | |||||
| // int pIns = argv[0]->i; | |||||
| // int pOuts = argv[1]->i; | |||||
| // int pTotal = argv[2]->i; | |||||
| // // delete old data | |||||
| // if (param.count > 0) | |||||
| // { | |||||
| // delete[] param.data; | |||||
| // delete[] param.ranges; | |||||
| // delete[] params; | |||||
| // } | |||||
| case PluginBridgeAudioCount: | |||||
| { | |||||
| CARLA_BRIDGE_CHECK_OSC_TYPES(3, "iii"); | |||||
| // // create new if needed | |||||
| // param.count = (pTotal < (int)carlaOptions.maxParameters) ? pTotal : 0; | |||||
| const int32_t aIns = argv[0]->i; | |||||
| const int32_t aOuts = argv[1]->i; | |||||
| const int32_t aTotal = argv[2]->i; | |||||
| // if (param.count > 0) | |||||
| // { | |||||
| // param.data = new ParameterData[param.count]; | |||||
| // param.ranges = new ParameterRanges[param.count]; | |||||
| // params = new BridgeParamInfo[param.count]; | |||||
| // } | |||||
| // else | |||||
| // { | |||||
| // param.data = nullptr; | |||||
| // param.ranges = nullptr; | |||||
| // params = nullptr; | |||||
| // } | |||||
| info.aIns = aIns; | |||||
| info.aOuts = aOuts; | |||||
| // // initialize | |||||
| // for (uint32_t i=0; i < param.count; i++) | |||||
| // { | |||||
| // param.data[i].type = PARAMETER_UNKNOWN; | |||||
| // param.data[i].index = -1; | |||||
| // param.data[i].rindex = -1; | |||||
| // param.data[i].hints = 0; | |||||
| // param.data[i].midiChannel = 0; | |||||
| // param.data[i].midiCC = -1; | |||||
| // param.ranges[i].def = 0.0; | |||||
| // param.ranges[i].min = 0.0; | |||||
| // param.ranges[i].max = 1.0; | |||||
| // param.ranges[i].step = 0.01; | |||||
| // param.ranges[i].stepSmall = 0.0001; | |||||
| // param.ranges[i].stepLarge = 0.1; | |||||
| // params[i].value = 0.0; | |||||
| // params[i].name = QString(); | |||||
| // params[i].unit = QString(); | |||||
| // } | |||||
| break; | |||||
| Q_UNUSED(aTotal); | |||||
| } | |||||
| // break; | |||||
| // Q_UNUSED(pIns); | |||||
| // Q_UNUSED(pOuts); | |||||
| // } | |||||
| case PluginBridgeMidiCount: | |||||
| { | |||||
| CARLA_BRIDGE_CHECK_OSC_TYPES(3, "iii"); | |||||
| // case PluginBridgeProgramCount: | |||||
| // { | |||||
| // int count = argv[0]->i; | |||||
| const int32_t mIns = argv[0]->i; | |||||
| const int32_t mOuts = argv[1]->i; | |||||
| const int32_t mTotal = argv[2]->i; | |||||
| // // Delete old programs | |||||
| // if (prog.count > 0) | |||||
| // { | |||||
| // for (uint32_t i=0; i < prog.count; i++) | |||||
| // free((void*)prog.names[i]); | |||||
| info.mIns = mIns; | |||||
| info.mOuts = mOuts; | |||||
| // delete[] prog.names; | |||||
| // } | |||||
| break; | |||||
| Q_UNUSED(mTotal); | |||||
| } | |||||
| // prog.count = 0; | |||||
| // prog.names = nullptr; | |||||
| case PluginBridgeParameterCount: | |||||
| { | |||||
| CARLA_BRIDGE_CHECK_OSC_TYPES(3, "iii"); | |||||
| // // Query new programs | |||||
| // prog.count = count; | |||||
| const int32_t pIns = argv[0]->i; | |||||
| const int32_t pOuts = argv[1]->i; | |||||
| const int32_t pTotal = argv[2]->i; | |||||
| // if (prog.count > 0) | |||||
| // prog.names = new const char* [prog.count]; | |||||
| // delete old data | |||||
| if (param.count > 0) | |||||
| { | |||||
| delete[] param.data; | |||||
| delete[] param.ranges; | |||||
| delete[] params; | |||||
| } | |||||
| // // Update names (NULL) | |||||
| // for (uint32_t i=0; i < prog.count; i++) | |||||
| // prog.names[i] = nullptr; | |||||
| // create new if needed | |||||
| param.count = (pTotal < (int32_t)carlaOptions.maxParameters) ? pTotal : 0; | |||||
| // break; | |||||
| // } | |||||
| if (param.count > 0) | |||||
| { | |||||
| param.data = new ParameterData[param.count]; | |||||
| param.ranges = new ParameterRanges[param.count]; | |||||
| params = new BridgeParamInfo[param.count]; | |||||
| } | |||||
| else | |||||
| { | |||||
| param.data = nullptr; | |||||
| param.ranges = nullptr; | |||||
| params = nullptr; | |||||
| } | |||||
| // case PluginBridgeMidiProgramCount: | |||||
| // { | |||||
| // int count = argv[0]->i; | |||||
| break; | |||||
| Q_UNUSED(pIns); | |||||
| Q_UNUSED(pOuts); | |||||
| } | |||||
| // // Delete old programs | |||||
| // if (midiprog.count > 0) | |||||
| // { | |||||
| // for (uint32_t i=0; i < midiprog.count; i++) | |||||
| // free((void*)midiprog.data[i].name); | |||||
| case PluginBridgeProgramCount: | |||||
| { | |||||
| CARLA_BRIDGE_CHECK_OSC_TYPES(1, "i"); | |||||
| // delete[] midiprog.data; | |||||
| // } | |||||
| const int32_t count = argv[0]->i; | |||||
| // midiprog.count = 0; | |||||
| // midiprog.data = nullptr; | |||||
| // Delete old programs | |||||
| if (prog.count > 0) | |||||
| { | |||||
| for (uint32_t i=0; i < prog.count; i++) | |||||
| { | |||||
| if (prog.names[i]) | |||||
| free((void*)prog.names[i]); | |||||
| } | |||||
| // // Query new programs | |||||
| // midiprog.count = count; | |||||
| delete[] prog.names; | |||||
| } | |||||
| // if (midiprog.count > 0) | |||||
| // midiprog.data = new midi_program_t [midiprog.count]; | |||||
| prog.count = 0; | |||||
| prog.names = nullptr; | |||||
| // // Update data (NULL) | |||||
| // for (uint32_t i=0; i < midiprog.count; i++) | |||||
| // { | |||||
| // midiprog.data[i].bank = 0; | |||||
| // midiprog.data[i].program = 0; | |||||
| // midiprog.data[i].name = nullptr; | |||||
| // } | |||||
| // Query new programs | |||||
| prog.count = count; | |||||
| if (prog.count > 0) | |||||
| prog.names = new const char* [prog.count]; | |||||
| // Update names (NULL) | |||||
| for (uint32_t i=0; i < prog.count; i++) | |||||
| prog.names[i] = nullptr; | |||||
| break; | |||||
| } | |||||
| case PluginBridgeMidiProgramCount: | |||||
| { | |||||
| CARLA_BRIDGE_CHECK_OSC_TYPES(1, "i"); | |||||
| const int32_t count = argv[0]->i; | |||||
| // break; | |||||
| // } | |||||
| // Delete old programs | |||||
| if (midiprog.count > 0) | |||||
| { | |||||
| for (uint32_t i=0; i < midiprog.count; i++) | |||||
| { | |||||
| if (midiprog.data[i].name) | |||||
| free((void*)midiprog.data[i].name); | |||||
| } | |||||
| delete[] midiprog.data; | |||||
| } | |||||
| midiprog.count = 0; | |||||
| midiprog.data = nullptr; | |||||
| // Query new programs | |||||
| midiprog.count = count; | |||||
| if (midiprog.count > 0) | |||||
| midiprog.data = new midi_program_t [midiprog.count]; | |||||
| break; | |||||
| } | |||||
| case PluginBridgePluginInfo: | case PluginBridgePluginInfo: | ||||
| { | { | ||||
| int category = argv[0]->i; | |||||
| int hints = argv[1]->i; | |||||
| const char* name = (const char*)&argv[2]->s; | |||||
| const char* label = (const char*)&argv[3]->s; | |||||
| const char* maker = (const char*)&argv[4]->s; | |||||
| const char* copyright = (const char*)&argv[5]->s; | |||||
| long uniqueId = argv[6]->i; | |||||
| CARLA_BRIDGE_CHECK_OSC_TYPES(7, "iissssh"); | |||||
| const int32_t category = argv[0]->i; | |||||
| const int32_t hints = argv[1]->i; | |||||
| const char* const name = (const char*)&argv[2]->s; | |||||
| const char* const label = (const char*)&argv[3]->s; | |||||
| const char* const maker = (const char*)&argv[4]->s; | |||||
| const char* const copyright = (const char*)&argv[5]->s; | |||||
| const int64_t uniqueId = argv[6]->i; | |||||
| Q_ASSERT(name); | |||||
| Q_ASSERT(label); | |||||
| Q_ASSERT(maker); | |||||
| Q_ASSERT(copyright); | |||||
| m_hints = hints | PLUGIN_IS_BRIDGE; | m_hints = hints | PLUGIN_IS_BRIDGE; | ||||
| info.category = (PluginCategory)category; | info.category = (PluginCategory)category; | ||||
| @@ -397,108 +414,188 @@ public: | |||||
| break; | break; | ||||
| } | } | ||||
| // case PluginBridgeParameterInfo: | |||||
| // { | |||||
| // int index = argv[0]->i; | |||||
| // const char* name = (const char*)&argv[1]->s; | |||||
| // const char* unit = (const char*)&argv[2]->s; | |||||
| case PluginBridgeParameterInfo: | |||||
| { | |||||
| CARLA_BRIDGE_CHECK_OSC_TYPES(3, "iss"); | |||||
| // if (index >= 0 && index < (int32_t)param.count) | |||||
| // { | |||||
| // params[index].name = QString(name); | |||||
| // params[index].unit = QString(unit); | |||||
| // } | |||||
| const int32_t index = argv[0]->i; | |||||
| const char* const name = (const char*)&argv[1]->s; | |||||
| const char* const unit = (const char*)&argv[2]->s; | |||||
| // break; | |||||
| // } | |||||
| Q_ASSERT(index >= 0 && index < (int32_t)param.count); | |||||
| Q_ASSERT(name); | |||||
| Q_ASSERT(unit); | |||||
| // case PluginBridgeParameterDataInfo: | |||||
| // { | |||||
| // int index = argv[0]->i; | |||||
| // int type = argv[1]->i; | |||||
| // int rindex = argv[2]->i; | |||||
| // int hints = argv[3]->i; | |||||
| // int channel = argv[4]->i; | |||||
| // int cc = argv[5]->i; | |||||
| if (index >= 0 && index < (int32_t)param.count) | |||||
| { | |||||
| params[index].name = QString(name); | |||||
| params[index].unit = QString(unit); | |||||
| } | |||||
| break; | |||||
| } | |||||
| // if (index >= 0 && index < (int32_t)param.count) | |||||
| // { | |||||
| // param.data[index].type = (ParameterType)type; | |||||
| // param.data[index].index = index; | |||||
| // param.data[index].rindex = rindex; | |||||
| // param.data[index].hints = hints; | |||||
| // param.data[index].midiChannel = channel; | |||||
| // param.data[index].midiCC = cc; | |||||
| // } | |||||
| case PluginBridgeParameterData: | |||||
| { | |||||
| CARLA_BRIDGE_CHECK_OSC_TYPES(6, "iiiiii"); | |||||
| // break; | |||||
| // } | |||||
| const int32_t index = argv[0]->i; | |||||
| const int32_t type = argv[1]->i; | |||||
| const int32_t rindex = argv[2]->i; | |||||
| const int32_t hints = argv[3]->i; | |||||
| const int32_t channel = argv[4]->i; | |||||
| const int32_t cc = argv[5]->i; | |||||
| // case PluginBridgeParameterRangesInfo: | |||||
| // { | |||||
| // int index = argv[0]->i; | |||||
| // float def = argv[1]->f; | |||||
| // float min = argv[2]->f; | |||||
| // float max = argv[3]->f; | |||||
| // float step = argv[4]->f; | |||||
| // float stepSmall = argv[5]->f; | |||||
| // float stepLarge = argv[6]->f; | |||||
| Q_ASSERT(index >= 0 && index < (int32_t)param.count); | |||||
| // if (index >= 0 && index < (int32_t)param.count) | |||||
| // { | |||||
| // param.ranges[index].def = def; | |||||
| // param.ranges[index].min = min; | |||||
| // param.ranges[index].max = max; | |||||
| // param.ranges[index].step = step; | |||||
| // param.ranges[index].stepSmall = stepSmall; | |||||
| // param.ranges[index].stepLarge = stepLarge; | |||||
| // } | |||||
| if (index >= 0 && index < (int32_t)param.count) | |||||
| { | |||||
| param.data[index].type = (ParameterType)type; | |||||
| param.data[index].index = index; | |||||
| param.data[index].rindex = rindex; | |||||
| param.data[index].hints = hints; | |||||
| param.data[index].midiChannel = channel; | |||||
| param.data[index].midiCC = cc; | |||||
| } | |||||
| // break; | |||||
| // } | |||||
| break; | |||||
| } | |||||
| // case PluginBridgeProgramInfo: | |||||
| // { | |||||
| // int index = argv[0]->i; | |||||
| // const char* name = (const char*)&argv[1]->s; | |||||
| case PluginBridgeParameterRanges: | |||||
| { | |||||
| CARLA_BRIDGE_CHECK_OSC_TYPES(7, "idddddd"); | |||||
| // if (index >= 0 && index < (int32_t)prog.count) | |||||
| // prog.names[index] = strdup(name); | |||||
| const int32_t index = argv[0]->i; | |||||
| const double def = argv[1]->d; | |||||
| const double min = argv[2]->d; | |||||
| const double max = argv[3]->d; | |||||
| const double step = argv[4]->d; | |||||
| const double stepSmall = argv[5]->d; | |||||
| const double stepLarge = argv[6]->d; | |||||
| // break; | |||||
| // } | |||||
| Q_ASSERT(index >= 0 && index < (int32_t)param.count); | |||||
| // case PluginBridgeMidiProgramInfo: | |||||
| // { | |||||
| // int index = argv[0]->i; | |||||
| // int bank = argv[1]->i; | |||||
| // int program = argv[2]->i; | |||||
| // const char* name = (const char*)&argv[3]->s; | |||||
| if (index >= 0 && index < (int32_t)param.count) | |||||
| { | |||||
| param.ranges[index].def = def; | |||||
| param.ranges[index].min = min; | |||||
| param.ranges[index].max = max; | |||||
| param.ranges[index].step = step; | |||||
| param.ranges[index].stepSmall = stepSmall; | |||||
| param.ranges[index].stepLarge = stepLarge; | |||||
| params[index].value = def; | |||||
| } | |||||
| // if (index >= 0 && index < (int32_t)midiprog.count) | |||||
| // { | |||||
| // midiprog.data[index].bank = bank; | |||||
| // midiprog.data[index].program = program; | |||||
| // midiprog.data[index].name = strdup(name); | |||||
| // } | |||||
| break; | |||||
| } | |||||
| case PluginBridgeProgramInfo: | |||||
| { | |||||
| CARLA_BRIDGE_CHECK_OSC_TYPES(2, "is"); | |||||
| const int32_t index = argv[0]->i; | |||||
| const char* const name = (const char*)&argv[1]->s; | |||||
| Q_ASSERT(name); | |||||
| if (index >= 0 && index < (int32_t)prog.count) | |||||
| { | |||||
| if (prog.names[index]) | |||||
| free((void*)prog.names[index]); | |||||
| prog.names[index] = strdup(name); | |||||
| } | |||||
| break; | |||||
| } | |||||
| // break; | |||||
| // } | |||||
| case PluginBridgeMidiProgramInfo: | |||||
| { | |||||
| CARLA_BRIDGE_CHECK_OSC_TYPES(4, "iiis"); | |||||
| const int32_t index = argv[0]->i; | |||||
| const int32_t bank = argv[1]->i; | |||||
| const int32_t program = argv[2]->i; | |||||
| const char* const name = (const char*)&argv[3]->s; | |||||
| Q_ASSERT(name); | |||||
| if (index >= 0 && index < (int32_t)midiprog.count) | |||||
| { | |||||
| if (midiprog.data[index].name) | |||||
| free((void*)midiprog.data[index].name); | |||||
| midiprog.data[index].bank = bank; | |||||
| midiprog.data[index].program = program; | |||||
| midiprog.data[index].name = strdup(name); | |||||
| } | |||||
| break; | |||||
| } | |||||
| case PluginBridgeSetParameterValue: | |||||
| { | |||||
| CARLA_BRIDGE_CHECK_OSC_TYPES(2, "id"); | |||||
| const int32_t index = argv[0]->i; | |||||
| const double value = argv[1]->d; | |||||
| setParameterValueByRIndex(index, value, false, true, true); | |||||
| // case PluginBridgeCustomData: | |||||
| // { | |||||
| break; | |||||
| } | |||||
| case PluginBridgeSetDefaultValue: | |||||
| { | |||||
| CARLA_BRIDGE_CHECK_OSC_TYPES(2, "id"); | |||||
| const int32_t index = argv[0]->i; | |||||
| const double value = argv[1]->d; | |||||
| Q_ASSERT(index >= 0 && index < (int32_t)param.count); | |||||
| if (index >= 0 && index < (int32_t)param.count) | |||||
| param.ranges[index].def = value; | |||||
| break; | |||||
| } | |||||
| case PluginBridgeSetProgram: | |||||
| { | |||||
| CARLA_BRIDGE_CHECK_OSC_TYPES(1, "i"); | |||||
| const int32_t index = argv[0]->i; | |||||
| setProgram(index, false, true, true, true); | |||||
| break; | |||||
| } | |||||
| case PluginBridgeSetMidiProgram: | |||||
| { | |||||
| CARLA_BRIDGE_CHECK_OSC_TYPES(1, "i"); | |||||
| const int32_t index = argv[0]->i; | |||||
| setMidiProgram(index, false, true, true, true); | |||||
| break; | |||||
| } | |||||
| case PluginBridgeSetCustomData: | |||||
| { | |||||
| // const char* stype = (const char*)&argv[0]->s; | // const char* stype = (const char*)&argv[0]->s; | ||||
| // const char* key = (const char*)&argv[1]->s; | // const char* key = (const char*)&argv[1]->s; | ||||
| // const char* value = (const char*)&argv[2]->s; | // const char* value = (const char*)&argv[2]->s; | ||||
| // setCustomData(getCustomDataStringType(stype), key, value, false); | // setCustomData(getCustomDataStringType(stype), key, value, false); | ||||
| // break; | |||||
| // } | |||||
| break; | |||||
| } | |||||
| // case PluginBridgeChunkData: | |||||
| // { | |||||
| case PluginBridgeSetChunkData: | |||||
| { | |||||
| // const char* const filePath = (const char*)&argv[0]->s; | // const char* const filePath = (const char*)&argv[0]->s; | ||||
| // QFile file(filePath); | // QFile file(filePath); | ||||
| @@ -508,8 +605,8 @@ public: | |||||
| // file.remove(); | // file.remove(); | ||||
| // } | // } | ||||
| // break; | |||||
| // } | |||||
| break; | |||||
| } | |||||
| case PluginBridgeUpdateNow: | case PluginBridgeUpdateNow: | ||||
| m_initiated = true; | m_initiated = true; | ||||
| @@ -526,7 +623,7 @@ public: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Set data (plugin-specific stuff) | // Set data (plugin-specific stuff) | ||||
| void setParameterValue(uint32_t parameterId, double value, bool sendGui, bool sendOsc, bool sendCallback) | |||||
| void setParameterValue(const uint32_t parameterId, double value, const bool sendGui, const bool sendOsc, const bool sendCallback) | |||||
| { | { | ||||
| Q_ASSERT(parameterId < param.count); | Q_ASSERT(parameterId < param.count); | ||||
| @@ -535,7 +632,7 @@ public: | |||||
| CarlaPlugin::setParameterValue(parameterId, value, sendGui, sendOsc, sendCallback); | CarlaPlugin::setParameterValue(parameterId, value, sendGui, sendOsc, sendCallback); | ||||
| } | } | ||||
| void setCustomData(CustomDataType type, const char* const key, const char* const value, bool sendGui) | |||||
| void setCustomData(const CustomDataType type, const char* const key, const char* const value, const bool sendGui) | |||||
| { | { | ||||
| Q_ASSERT(key); | Q_ASSERT(key); | ||||
| Q_ASSERT(value); | Q_ASSERT(value); | ||||
| @@ -560,7 +657,7 @@ public: | |||||
| Q_ASSERT(stringData); | Q_ASSERT(stringData); | ||||
| QString filePath; | QString filePath; | ||||
| filePath += "/tmp/.CarlaChunk_"; | |||||
| filePath += "/tmp/.CarlaChunk_"; // FIXME - cross-platform | |||||
| filePath += m_name; | filePath += m_name; | ||||
| QFile file(filePath); | QFile file(filePath); | ||||
| @@ -593,11 +690,11 @@ public: | |||||
| m_saved = false; | m_saved = false; | ||||
| osc_send_configure(&osc.data, CARLA_BRIDGE_MSG_SAVE_NOW, ""); | osc_send_configure(&osc.data, CARLA_BRIDGE_MSG_SAVE_NOW, ""); | ||||
| for (int i=0; i < 100; i++) | |||||
| for (int i=0; i < 200; i++) | |||||
| { | { | ||||
| if (m_saved) | if (m_saved) | ||||
| break; | break; | ||||
| carla_msleep(100); | |||||
| carla_msleep(50); | |||||
| } | } | ||||
| if (! m_saved) | if (! m_saved) | ||||
| @@ -613,6 +710,11 @@ public: | |||||
| { | { | ||||
| Q_ASSERT(index < param.count); | Q_ASSERT(index < param.count); | ||||
| if (index >= param.count) | |||||
| return; | |||||
| if (! osc.data.target) | |||||
| return; | |||||
| osc_send_control(&osc.data, param.data[index].rindex, value); | osc_send_control(&osc.data, param.data[index].rindex, value); | ||||
| } | } | ||||
| @@ -620,6 +722,11 @@ public: | |||||
| { | { | ||||
| Q_ASSERT(index < prog.count); | Q_ASSERT(index < prog.count); | ||||
| if (index >= prog.count) | |||||
| return; | |||||
| if (! osc.data.target) | |||||
| return; | |||||
| osc_send_program(&osc.data, index); | osc_send_program(&osc.data, index); | ||||
| } | } | ||||
| @@ -627,6 +734,11 @@ public: | |||||
| { | { | ||||
| Q_ASSERT(index < midiprog.count); | Q_ASSERT(index < midiprog.count); | ||||
| if (index >= midiprog.count) | |||||
| return; | |||||
| if (! osc.data.target) | |||||
| return; | |||||
| osc_send_midi_program(&osc.data, index); | osc_send_midi_program(&osc.data, index); | ||||
| } | } | ||||
| @@ -636,10 +748,14 @@ public: | |||||
| Q_ASSERT(note < 128); | Q_ASSERT(note < 128); | ||||
| Q_ASSERT(velo > 0 && velo < 128); | Q_ASSERT(velo > 0 && velo < 128); | ||||
| // TODO | |||||
| Q_UNUSED(channel); | |||||
| Q_UNUSED(note); | |||||
| Q_UNUSED(velo); | |||||
| if (! osc.data.target) | |||||
| return; | |||||
| uint8_t midiData[4] = { 0 }; | |||||
| midiData[1] = MIDI_STATUS_NOTE_ON + channel; | |||||
| midiData[2] = note; | |||||
| midiData[3] = velo; | |||||
| osc_send_midi(&osc.data, midiData); | |||||
| } | } | ||||
| void uiNoteOff(const uint8_t channel, const uint8_t note) | void uiNoteOff(const uint8_t channel, const uint8_t note) | ||||
| @@ -647,9 +763,13 @@ public: | |||||
| Q_ASSERT(channel < 16); | Q_ASSERT(channel < 16); | ||||
| Q_ASSERT(note < 128); | Q_ASSERT(note < 128); | ||||
| // TODO | |||||
| Q_UNUSED(channel); | |||||
| Q_UNUSED(note); | |||||
| if (! osc.data.target) | |||||
| return; | |||||
| uint8_t midiData[4] = { 0 }; | |||||
| midiData[1] = MIDI_STATUS_NOTE_OFF + channel; | |||||
| midiData[2] = note; | |||||
| osc_send_midi(&osc.data, midiData); | |||||
| } | } | ||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| @@ -717,8 +837,8 @@ private: | |||||
| bool m_saved; | bool m_saved; | ||||
| struct { | struct { | ||||
| uint32_t ains, aouts; | |||||
| uint32_t mins, mouts; | |||||
| uint32_t aIns, aOuts; | |||||
| uint32_t mIns, mOuts; | |||||
| PluginCategory category; | PluginCategory category; | ||||
| long uniqueId; | long uniqueId; | ||||
| const char* name; | const char* name; | ||||
| @@ -737,7 +857,7 @@ CarlaPlugin* CarlaPlugin::newBridge(const initializer& init, BinaryType btype, P | |||||
| short id = init.engine->getNewPluginId(); | short id = init.engine->getNewPluginId(); | ||||
| if (id < 0 || id > MAX_PLUGINS) | |||||
| if (id < 0 || id > CarlaEngine::maxPluginNumber()) | |||||
| { | { | ||||
| setLastError("Maximum number of plugins reached"); | setLastError("Maximum number of plugins reached"); | ||||
| return nullptr; | return nullptr; | ||||
| @@ -22,6 +22,8 @@ CARLA_BACKEND_START_NAMESPACE | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| unsigned short CarlaEngine::m_maxPluginNumber = 0; | |||||
| CarlaEngine::CarlaEngine() | CarlaEngine::CarlaEngine() | ||||
| : m_checkThread(this), | : m_checkThread(this), | ||||
| #ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
| @@ -45,7 +47,7 @@ CarlaEngine::CarlaEngine() | |||||
| name = nullptr; | name = nullptr; | ||||
| bufferSize = 0; | bufferSize = 0; | ||||
| sampleRate = 0.0; | sampleRate = 0.0; | ||||
| maxPluginNumber = 0; | |||||
| m_maxPluginNumber = 0; | |||||
| #ifndef Q_COMPILER_INITIALIZER_LISTS | #ifndef Q_COMPILER_INITIALIZER_LISTS | ||||
| for (unsigned short i=0; i < MAX_PLUGINS; i++) | for (unsigned short i=0; i < MAX_PLUGINS; i++) | ||||
| @@ -95,6 +97,11 @@ int CarlaEngine::maxPortNameSize() | |||||
| return STR_MAX; | return STR_MAX; | ||||
| } | } | ||||
| unsigned short CarlaEngine::maxPluginNumber() | |||||
| { | |||||
| return m_maxPluginNumber; | |||||
| } | |||||
| bool CarlaEngine::init(const char* const clientName) | bool CarlaEngine::init(const char* const clientName) | ||||
| { | { | ||||
| qDebug("CarlaEngine::init(\"%s\")", clientName); | qDebug("CarlaEngine::init(\"%s\")", clientName); | ||||
| @@ -118,7 +125,7 @@ bool CarlaEngine::close() | |||||
| m_osc.close(); | m_osc.close(); | ||||
| #endif | #endif | ||||
| maxPluginNumber = 0; | |||||
| m_maxPluginNumber = 0; | |||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -130,7 +137,7 @@ short CarlaEngine::getNewPluginId() const | |||||
| { | { | ||||
| qDebug("CarlaEngine::getNewPluginId()"); | qDebug("CarlaEngine::getNewPluginId()"); | ||||
| for (unsigned short i=0; i < maxPluginNumber; i++) | |||||
| for (unsigned short i=0; i < m_maxPluginNumber; i++) | |||||
| { | { | ||||
| if (! m_carlaPlugins[i]) | if (! m_carlaPlugins[i]) | ||||
| return i; | return i; | ||||
| @@ -141,11 +148,11 @@ short CarlaEngine::getNewPluginId() const | |||||
| CarlaPlugin* CarlaEngine::getPlugin(const unsigned short id) const | CarlaPlugin* CarlaEngine::getPlugin(const unsigned short id) const | ||||
| { | { | ||||
| qDebug("CarlaEngine::getPlugin(%i/%i)", id, maxPluginNumber); | |||||
| Q_ASSERT(maxPluginNumber != 0); | |||||
| Q_ASSERT(id < maxPluginNumber); | |||||
| qDebug("CarlaEngine::getPlugin(%i/%i)", id, m_maxPluginNumber); | |||||
| Q_ASSERT(m_maxPluginNumber != 0); | |||||
| Q_ASSERT(id < m_maxPluginNumber); | |||||
| if (id < maxPluginNumber) | |||||
| if (id < m_maxPluginNumber) | |||||
| return m_carlaPlugins[id]; | return m_carlaPlugins[id]; | ||||
| return nullptr; | return nullptr; | ||||
| @@ -153,8 +160,8 @@ CarlaPlugin* CarlaEngine::getPlugin(const unsigned short id) const | |||||
| CarlaPlugin* CarlaEngine::getPluginUnchecked(const unsigned short id) const | CarlaPlugin* CarlaEngine::getPluginUnchecked(const unsigned short id) const | ||||
| { | { | ||||
| Q_ASSERT(maxPluginNumber != 0); | |||||
| Q_ASSERT(id < maxPluginNumber); | |||||
| Q_ASSERT(m_maxPluginNumber != 0); | |||||
| Q_ASSERT(id < m_maxPluginNumber); | |||||
| return m_carlaPlugins[id]; | return m_carlaPlugins[id]; | ||||
| } | } | ||||
| @@ -171,7 +178,7 @@ const char* CarlaEngine::getUniqueName(const char* const name) | |||||
| qname.truncate(maxClientNameSize()-5-1); // 5 = strlen(" (10)") | qname.truncate(maxClientNameSize()-5-1); // 5 = strlen(" (10)") | ||||
| qname.replace(":", "."); // ":" is used in JACK1 to split client/port names | qname.replace(":", "."); // ":" is used in JACK1 to split client/port names | ||||
| for (unsigned short i=0; i < maxPluginNumber; i++) | |||||
| for (unsigned short i=0; i < m_maxPluginNumber; i++) | |||||
| { | { | ||||
| // Check if unique name already exists | // Check if unique name already exists | ||||
| if (m_uniqueNames[i] && qname == m_uniqueNames[i]) | if (m_uniqueNames[i] && qname == m_uniqueNames[i]) | ||||
| @@ -234,11 +241,11 @@ short CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype, con | |||||
| Q_ASSERT(filename); | Q_ASSERT(filename); | ||||
| Q_ASSERT(label); | Q_ASSERT(label); | ||||
| if (maxPluginNumber == 0) | |||||
| if (m_maxPluginNumber == 0) | |||||
| #ifdef BUILD_BRIDGE | #ifdef BUILD_BRIDGE | ||||
| maxPluginNumber = MAX_PLUGINS; | |||||
| m_maxPluginNumber = MAX_PLUGINS; | |||||
| #else | #else | ||||
| maxPluginNumber = (carlaOptions.processMode == PROCESS_MODE_CONTINUOUS_RACK) ? 16 : MAX_PLUGINS; | |||||
| m_maxPluginNumber = (carlaOptions.processMode == PROCESS_MODE_CONTINUOUS_RACK) ? 16 : MAX_PLUGINS; | |||||
| #endif | #endif | ||||
| CarlaPlugin::initializer init = { | CarlaPlugin::initializer init = { | ||||
| @@ -251,7 +258,7 @@ short CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype, con | |||||
| CarlaPlugin* plugin = nullptr; | CarlaPlugin* plugin = nullptr; | ||||
| #ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
| if (btype != BINARY_NATIVE) | |||||
| if (btype != BINARY_NATIVE /*|| true*/) | |||||
| { | { | ||||
| # ifdef CARLA_ENGINE_JACK | # ifdef CARLA_ENGINE_JACK | ||||
| if (carlaOptions.processMode != CarlaBackend::PROCESS_MODE_MULTIPLE_CLIENTS) | if (carlaOptions.processMode != CarlaBackend::PROCESS_MODE_MULTIPLE_CLIENTS) | ||||
| @@ -316,7 +323,7 @@ short CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype, con | |||||
| m_uniqueNames[id] = plugin->name(); | m_uniqueNames[id] = plugin->name(); | ||||
| if (! m_checkThread.isRunning()) | if (! m_checkThread.isRunning()) | ||||
| m_checkThread.startNow(maxPluginNumber); | |||||
| m_checkThread.startNow(); | |||||
| return id; | return id; | ||||
| } | } | ||||
| @@ -324,8 +331,8 @@ short CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype, con | |||||
| bool CarlaEngine::removePlugin(const unsigned short id) | bool CarlaEngine::removePlugin(const unsigned short id) | ||||
| { | { | ||||
| qDebug("CarlaEngine::removePlugin(%i)", id); | qDebug("CarlaEngine::removePlugin(%i)", id); | ||||
| Q_ASSERT(maxPluginNumber != 0); | |||||
| Q_ASSERT(id < maxPluginNumber); | |||||
| Q_ASSERT(m_maxPluginNumber != 0); | |||||
| Q_ASSERT(id < m_maxPluginNumber); | |||||
| CarlaPlugin* const plugin = m_carlaPlugins[id]; | CarlaPlugin* const plugin = m_carlaPlugins[id]; | ||||
| @@ -346,7 +353,7 @@ bool CarlaEngine::removePlugin(const unsigned short id) | |||||
| #ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
| if (carlaOptions.processMode == PROCESS_MODE_CONTINUOUS_RACK) | if (carlaOptions.processMode == PROCESS_MODE_CONTINUOUS_RACK) | ||||
| { | { | ||||
| for (unsigned short i=id; i < maxPluginNumber-1; i++) | |||||
| for (unsigned short i=id; i < m_maxPluginNumber-1; i++) | |||||
| { | { | ||||
| m_carlaPlugins[i] = m_carlaPlugins[i+1]; | m_carlaPlugins[i] = m_carlaPlugins[i+1]; | ||||
| m_uniqueNames[i] = m_uniqueNames[i+1]; | m_uniqueNames[i] = m_uniqueNames[i+1]; | ||||
| @@ -358,7 +365,7 @@ bool CarlaEngine::removePlugin(const unsigned short id) | |||||
| #endif | #endif | ||||
| if (isRunning()) | if (isRunning()) | ||||
| m_checkThread.startNow(maxPluginNumber); | |||||
| m_checkThread.startNow(); | |||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -374,7 +381,7 @@ void CarlaEngine::removeAllPlugins() | |||||
| m_checkThread.stopNow(); | m_checkThread.stopNow(); | ||||
| for (unsigned short i=0; i < maxPluginNumber; i++) | |||||
| for (unsigned short i=0; i < m_maxPluginNumber; i++) | |||||
| { | { | ||||
| CarlaPlugin* const plugin = m_carlaPlugins[i]; | CarlaPlugin* const plugin = m_carlaPlugins[i]; | ||||
| @@ -390,14 +397,14 @@ void CarlaEngine::removeAllPlugins() | |||||
| } | } | ||||
| } | } | ||||
| maxPluginNumber = 0; | |||||
| m_maxPluginNumber = 0; | |||||
| } | } | ||||
| void CarlaEngine::idlePluginGuis() | void CarlaEngine::idlePluginGuis() | ||||
| { | { | ||||
| Q_ASSERT(maxPluginNumber != 0); | |||||
| Q_ASSERT(m_maxPluginNumber != 0); | |||||
| for (unsigned short i=0; i < maxPluginNumber; i++) | |||||
| for (unsigned short i=0; i < m_maxPluginNumber; i++) | |||||
| { | { | ||||
| CarlaPlugin* const plugin = m_carlaPlugins[i]; | CarlaPlugin* const plugin = m_carlaPlugins[i]; | ||||
| @@ -440,7 +447,7 @@ const CarlaTimeInfo* CarlaEngine::getTimeInfo() const | |||||
| double CarlaEngine::getInputPeak(const unsigned short pluginId, const unsigned short id) const | double CarlaEngine::getInputPeak(const unsigned short pluginId, const unsigned short id) const | ||||
| { | { | ||||
| Q_ASSERT(pluginId < maxPluginNumber); | |||||
| Q_ASSERT(pluginId < m_maxPluginNumber); | |||||
| Q_ASSERT(id < MAX_PEAKS); | Q_ASSERT(id < MAX_PEAKS); | ||||
| return m_insPeak[pluginId*MAX_PEAKS + id]; | return m_insPeak[pluginId*MAX_PEAKS + id]; | ||||
| @@ -448,7 +455,7 @@ double CarlaEngine::getInputPeak(const unsigned short pluginId, const unsigned s | |||||
| double CarlaEngine::getOutputPeak(const unsigned short pluginId, const unsigned short id) const | double CarlaEngine::getOutputPeak(const unsigned short pluginId, const unsigned short id) const | ||||
| { | { | ||||
| Q_ASSERT(pluginId < maxPluginNumber); | |||||
| Q_ASSERT(pluginId < m_maxPluginNumber); | |||||
| Q_ASSERT(id < MAX_PEAKS); | Q_ASSERT(id < MAX_PEAKS); | ||||
| return m_outsPeak[pluginId*MAX_PEAKS + id]; | return m_outsPeak[pluginId*MAX_PEAKS + id]; | ||||
| @@ -456,7 +463,7 @@ double CarlaEngine::getOutputPeak(const unsigned short pluginId, const unsigned | |||||
| void CarlaEngine::setInputPeak(const unsigned short pluginId, const unsigned short id, double value) | void CarlaEngine::setInputPeak(const unsigned short pluginId, const unsigned short id, double value) | ||||
| { | { | ||||
| Q_ASSERT(pluginId < maxPluginNumber); | |||||
| Q_ASSERT(pluginId < m_maxPluginNumber); | |||||
| Q_ASSERT(id < MAX_PEAKS); | Q_ASSERT(id < MAX_PEAKS); | ||||
| m_insPeak[pluginId*MAX_PEAKS + id] = value; | m_insPeak[pluginId*MAX_PEAKS + id] = value; | ||||
| @@ -464,7 +471,7 @@ void CarlaEngine::setInputPeak(const unsigned short pluginId, const unsigned sho | |||||
| void CarlaEngine::setOutputPeak(const unsigned short pluginId, const unsigned short id, double value) | void CarlaEngine::setOutputPeak(const unsigned short pluginId, const unsigned short id, double value) | ||||
| { | { | ||||
| Q_ASSERT(pluginId < maxPluginNumber); | |||||
| Q_ASSERT(pluginId < m_maxPluginNumber); | |||||
| Q_ASSERT(id < MAX_PEAKS); | Q_ASSERT(id < MAX_PEAKS); | ||||
| m_outsPeak[pluginId*MAX_PEAKS + id] = value; | m_outsPeak[pluginId*MAX_PEAKS + id] = value; | ||||
| @@ -541,7 +548,7 @@ void CarlaEngine::bufferSizeChanged(uint32_t newBufferSize) | |||||
| bufferSize = newBufferSize; | bufferSize = newBufferSize; | ||||
| for (unsigned short i=0; i < maxPluginNumber; i++) | |||||
| for (unsigned short i=0; i < m_maxPluginNumber; i++) | |||||
| { | { | ||||
| if (m_carlaPlugins[i] && m_carlaPlugins[i]->enabled()) | if (m_carlaPlugins[i] && m_carlaPlugins[i]->enabled()) | ||||
| m_carlaPlugins[i]->bufferSizeChanged(newBufferSize); | m_carlaPlugins[i]->bufferSizeChanged(newBufferSize); | ||||
| @@ -1105,9 +1112,9 @@ void CarlaEngineMidiPort::writeEvent(uint32_t time, const uint8_t* data, uint8_t | |||||
| #ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
| void CarlaEngine::osc_send_control_add_plugin(const int32_t pluginId, const char* const pluginName) | void CarlaEngine::osc_send_control_add_plugin(const int32_t pluginId, const char* const pluginName) | ||||
| { | { | ||||
| qDebug("CarlaEngine::osc_send_add_plugin(%i, \"%s\")", pluginId, pluginName); | |||||
| qDebug("CarlaEngine::osc_send_control_add_plugin(%i, \"%s\")", pluginId, pluginName); | |||||
| Q_ASSERT(m_oscData); | Q_ASSERT(m_oscData); | ||||
| Q_ASSERT(pluginId >= 0 && pluginId < maxPluginNumber); | |||||
| Q_ASSERT(pluginId >= 0 && pluginId < m_maxPluginNumber); | |||||
| Q_ASSERT(pluginName); | Q_ASSERT(pluginName); | ||||
| if (m_oscData && m_oscData->target) | if (m_oscData && m_oscData->target) | ||||
| @@ -1121,7 +1128,7 @@ void CarlaEngine::osc_send_control_add_plugin(const int32_t pluginId, const char | |||||
| void CarlaEngine::osc_send_control_remove_plugin(const int32_t pluginId) | void CarlaEngine::osc_send_control_remove_plugin(const int32_t pluginId) | ||||
| { | { | ||||
| qDebug("CarlaEngine::osc_send_remove_plugin(%i)", pluginId); | |||||
| qDebug("CarlaEngine::osc_send_control_remove_plugin(%i)", pluginId); | |||||
| Q_ASSERT(m_oscData); | Q_ASSERT(m_oscData); | ||||
| if (m_oscData && m_oscData->target) | if (m_oscData && m_oscData->target) | ||||
| @@ -1135,9 +1142,9 @@ void CarlaEngine::osc_send_control_remove_plugin(const int32_t pluginId) | |||||
| void CarlaEngine::osc_send_control_set_plugin_data(const int32_t pluginId, const int32_t type, const int32_t category, const int32_t hints, const char* const realName, const char* const label, const char* const maker, const char* const copyright, const int64_t uniqueId) | void CarlaEngine::osc_send_control_set_plugin_data(const int32_t pluginId, const int32_t type, const int32_t category, const int32_t hints, const char* const realName, const char* const label, const char* const maker, const char* const copyright, const int64_t uniqueId) | ||||
| { | { | ||||
| qDebug("CarlaEngine::osc_send_set_plugin_data(%i, %i, %i, %i, \"%s\", \"%s\", \"%s\", \"%s\", %li)", pluginId, type, category, hints, realName, label, maker, copyright, uniqueId); | |||||
| qDebug("CarlaEngine::osc_send_control_set_plugin_data(%i, %i, %i, %i, \"%s\", \"%s\", \"%s\", \"%s\", %li)", pluginId, type, category, hints, realName, label, maker, copyright, uniqueId); | |||||
| Q_ASSERT(m_oscData); | Q_ASSERT(m_oscData); | ||||
| Q_ASSERT(pluginId >= 0 && pluginId < maxPluginNumber); | |||||
| Q_ASSERT(pluginId >= 0 && pluginId < m_maxPluginNumber); | |||||
| Q_ASSERT(type != PLUGIN_NONE); | Q_ASSERT(type != PLUGIN_NONE); | ||||
| if (m_oscData && m_oscData->target) | if (m_oscData && m_oscData->target) | ||||
| @@ -1151,9 +1158,9 @@ void CarlaEngine::osc_send_control_set_plugin_data(const int32_t pluginId, const | |||||
| void CarlaEngine::osc_send_control_set_plugin_ports(const int32_t pluginId, const int32_t audioIns, const int32_t audioOuts, const int32_t midiIns, const int32_t midiOuts, const int32_t cIns, const int32_t cOuts, const int32_t cTotals) | void CarlaEngine::osc_send_control_set_plugin_ports(const int32_t pluginId, const int32_t audioIns, const int32_t audioOuts, const int32_t midiIns, const int32_t midiOuts, const int32_t cIns, const int32_t cOuts, const int32_t cTotals) | ||||
| { | { | ||||
| qDebug("CarlaEngine::osc_send_set_plugin_ports(%i, %i, %i, %i, %i, %i, %i, %i)", pluginId, audioIns, audioOuts, midiIns, midiOuts, cIns, cOuts, cTotals); | |||||
| qDebug("CarlaEngine::osc_send_control_set_plugin_ports(%i, %i, %i, %i, %i, %i, %i, %i)", pluginId, audioIns, audioOuts, midiIns, midiOuts, cIns, cOuts, cTotals); | |||||
| Q_ASSERT(m_oscData); | Q_ASSERT(m_oscData); | ||||
| Q_ASSERT(pluginId >= 0 && pluginId < maxPluginNumber); | |||||
| Q_ASSERT(pluginId >= 0 && pluginId < m_maxPluginNumber); | |||||
| if (m_oscData && m_oscData->target) | if (m_oscData && m_oscData->target) | ||||
| { | { | ||||
| @@ -1166,9 +1173,9 @@ void CarlaEngine::osc_send_control_set_plugin_ports(const int32_t pluginId, cons | |||||
| void CarlaEngine::osc_send_control_set_parameter_data(const int32_t pluginId, const int32_t index, const int32_t type, const int32_t hints, const char* const name, const char* const label, const double current) | void CarlaEngine::osc_send_control_set_parameter_data(const int32_t pluginId, const int32_t index, const int32_t type, const int32_t hints, const char* const name, const char* const label, const double current) | ||||
| { | { | ||||
| qDebug("CarlaEngine::osc_send_set_parameter_data(%i, %i, %i, %i, \"%s\", \"%s\", %g)", pluginId, index, type, hints, name, label, current); | |||||
| qDebug("CarlaEngine::osc_send_control_set_parameter_data(%i, %i, %i, %i, \"%s\", \"%s\", %g)", pluginId, index, type, hints, name, label, current); | |||||
| Q_ASSERT(m_oscData); | Q_ASSERT(m_oscData); | ||||
| Q_ASSERT(pluginId >= 0 && pluginId < maxPluginNumber); | |||||
| Q_ASSERT(pluginId >= 0 && pluginId < m_maxPluginNumber); | |||||
| Q_ASSERT(index >= 0); | Q_ASSERT(index >= 0); | ||||
| Q_ASSERT(type != PARAMETER_UNKNOWN); | Q_ASSERT(type != PARAMETER_UNKNOWN); | ||||
| @@ -1183,9 +1190,9 @@ void CarlaEngine::osc_send_control_set_parameter_data(const int32_t pluginId, co | |||||
| void CarlaEngine::osc_send_control_set_parameter_ranges(const int32_t pluginId, const int32_t index, const double min, const double max, const double def, const double step, const double stepSmall, const double stepLarge) | void CarlaEngine::osc_send_control_set_parameter_ranges(const int32_t pluginId, const int32_t index, const double min, const double max, const double def, const double step, const double stepSmall, const double stepLarge) | ||||
| { | { | ||||
| qDebug("CarlaEngine::osc_send_set_parameter_ranges(%i, %i, %g, %g, %g, %g, %g, %g)", pluginId, index, min, max, def, step, stepSmall, stepLarge); | |||||
| qDebug("CarlaEngine::osc_send_control_set_parameter_ranges(%i, %i, %g, %g, %g, %g, %g, %g)", pluginId, index, min, max, def, step, stepSmall, stepLarge); | |||||
| Q_ASSERT(m_oscData); | Q_ASSERT(m_oscData); | ||||
| Q_ASSERT(pluginId >= 0 && pluginId < maxPluginNumber); | |||||
| Q_ASSERT(pluginId >= 0 && pluginId < m_maxPluginNumber); | |||||
| Q_ASSERT(index >= 0); | Q_ASSERT(index >= 0); | ||||
| Q_ASSERT(min < max); | Q_ASSERT(min < max); | ||||
| @@ -1200,9 +1207,9 @@ void CarlaEngine::osc_send_control_set_parameter_ranges(const int32_t pluginId, | |||||
| void CarlaEngine::osc_send_control_set_parameter_midi_cc(const int32_t pluginId, const int32_t index, const int32_t cc) | void CarlaEngine::osc_send_control_set_parameter_midi_cc(const int32_t pluginId, const int32_t index, const int32_t cc) | ||||
| { | { | ||||
| qDebug("CarlaEngine::osc_send_set_parameter_midi_cc(%i, %i, %i)", pluginId, index, cc); | |||||
| qDebug("CarlaEngine::osc_send_control_set_parameter_midi_cc(%i, %i, %i)", pluginId, index, cc); | |||||
| Q_ASSERT(m_oscData); | Q_ASSERT(m_oscData); | ||||
| Q_ASSERT(pluginId >= 0 && pluginId < maxPluginNumber); | |||||
| Q_ASSERT(pluginId >= 0 && pluginId < m_maxPluginNumber); | |||||
| Q_ASSERT(index >= 0); | Q_ASSERT(index >= 0); | ||||
| if (m_oscData && m_oscData->target) | if (m_oscData && m_oscData->target) | ||||
| @@ -1216,9 +1223,9 @@ void CarlaEngine::osc_send_control_set_parameter_midi_cc(const int32_t pluginId, | |||||
| void CarlaEngine::osc_send_control_set_parameter_midi_channel(const int32_t pluginId, const int32_t index, const int32_t channel) | void CarlaEngine::osc_send_control_set_parameter_midi_channel(const int32_t pluginId, const int32_t index, const int32_t channel) | ||||
| { | { | ||||
| qDebug("CarlaEngine::osc_send_set_parameter_midi_channel(%i, %i, %i)", pluginId, index, channel); | |||||
| qDebug("CarlaEngine::osc_send_control_set_parameter_midi_channel(%i, %i, %i)", pluginId, index, channel); | |||||
| Q_ASSERT(m_oscData); | Q_ASSERT(m_oscData); | ||||
| Q_ASSERT(pluginId >= 0 && pluginId < maxPluginNumber); | |||||
| Q_ASSERT(pluginId >= 0 && pluginId < m_maxPluginNumber); | |||||
| Q_ASSERT(index >= 0); | Q_ASSERT(index >= 0); | ||||
| Q_ASSERT(channel >= 0 && channel < 16); | Q_ASSERT(channel >= 0 && channel < 16); | ||||
| @@ -1234,13 +1241,13 @@ void CarlaEngine::osc_send_control_set_parameter_midi_channel(const int32_t plug | |||||
| void CarlaEngine::osc_send_control_set_parameter_value(const int32_t pluginId, const int32_t index, const double value) | void CarlaEngine::osc_send_control_set_parameter_value(const int32_t pluginId, const int32_t index, const double value) | ||||
| { | { | ||||
| #if DEBUG | #if DEBUG | ||||
| if (index < 0) | |||||
| qDebug("CarlaEngine::osc_send_set_parameter_value(%i, %s, %g)", pluginId, InternalParametersIndex2str((InternalParametersIndex)index), value); | |||||
| if (index < -1) | |||||
| qDebug("CarlaEngine::osc_send_control_set_parameter_value(%i, %s, %g)", pluginId, InternalParametersIndex2str((InternalParametersIndex)index), value); | |||||
| else | else | ||||
| qDebug("CarlaEngine::osc_send_set_parameter_value(%i, %i, %g)", pluginId, index, value); | |||||
| qDebug("CarlaEngine::osc_send_control_set_parameter_value(%i, %i, %g)", pluginId, index, value); | |||||
| #endif | #endif | ||||
| Q_ASSERT(m_oscData); | Q_ASSERT(m_oscData); | ||||
| Q_ASSERT(pluginId >= 0 && pluginId < maxPluginNumber); | |||||
| Q_ASSERT(pluginId >= 0 && pluginId < m_maxPluginNumber); | |||||
| if (m_oscData && m_oscData->target) | if (m_oscData && m_oscData->target) | ||||
| { | { | ||||
| @@ -1253,9 +1260,9 @@ void CarlaEngine::osc_send_control_set_parameter_value(const int32_t pluginId, c | |||||
| void CarlaEngine::osc_send_control_set_default_value(const int32_t pluginId, const int32_t index, const double value) | void CarlaEngine::osc_send_control_set_default_value(const int32_t pluginId, const int32_t index, const double value) | ||||
| { | { | ||||
| qDebug("CarlaEngine::osc_send_set_default_value(%i, %i, %g)", pluginId, index, value); | |||||
| qDebug("CarlaEngine::osc_send_control_set_default_value(%i, %i, %g)", pluginId, index, value); | |||||
| Q_ASSERT(m_oscData); | Q_ASSERT(m_oscData); | ||||
| Q_ASSERT(pluginId >= 0 && pluginId < maxPluginNumber); | |||||
| Q_ASSERT(pluginId >= 0 && pluginId < m_maxPluginNumber); | |||||
| Q_ASSERT(index >= 0); | Q_ASSERT(index >= 0); | ||||
| if (m_oscData && m_oscData->target) | if (m_oscData && m_oscData->target) | ||||
| @@ -1269,9 +1276,9 @@ void CarlaEngine::osc_send_control_set_default_value(const int32_t pluginId, con | |||||
| void CarlaEngine::osc_send_control_set_program(const int32_t pluginId, const int32_t index) | void CarlaEngine::osc_send_control_set_program(const int32_t pluginId, const int32_t index) | ||||
| { | { | ||||
| qDebug("CarlaEngine::osc_send_set_program(%i, %i)", pluginId, index); | |||||
| qDebug("CarlaEngine::osc_send_control_set_program(%i, %i)", pluginId, index); | |||||
| Q_ASSERT(m_oscData); | Q_ASSERT(m_oscData); | ||||
| Q_ASSERT(pluginId >= 0 && pluginId < maxPluginNumber); | |||||
| Q_ASSERT(pluginId >= 0 && pluginId < m_maxPluginNumber); | |||||
| if (m_oscData && m_oscData->target) | if (m_oscData && m_oscData->target) | ||||
| { | { | ||||
| @@ -1284,9 +1291,9 @@ void CarlaEngine::osc_send_control_set_program(const int32_t pluginId, const int | |||||
| void CarlaEngine::osc_send_control_set_program_count(const int32_t pluginId, const int32_t count) | void CarlaEngine::osc_send_control_set_program_count(const int32_t pluginId, const int32_t count) | ||||
| { | { | ||||
| qDebug("CarlaEngine::osc_send_set_program_count(%i, %i)", pluginId, count); | |||||
| qDebug("CarlaEngine::osc_send_control_set_program_count(%i, %i)", pluginId, count); | |||||
| Q_ASSERT(m_oscData); | Q_ASSERT(m_oscData); | ||||
| Q_ASSERT(pluginId >= 0 && pluginId < maxPluginNumber); | |||||
| Q_ASSERT(pluginId >= 0 && pluginId < m_maxPluginNumber); | |||||
| Q_ASSERT(count >= 0); | Q_ASSERT(count >= 0); | ||||
| if (m_oscData && m_oscData->target) | if (m_oscData && m_oscData->target) | ||||
| @@ -1300,9 +1307,9 @@ void CarlaEngine::osc_send_control_set_program_count(const int32_t pluginId, con | |||||
| void CarlaEngine::osc_send_control_set_program_name(const int32_t pluginId, const int32_t index, const char* const name) | void CarlaEngine::osc_send_control_set_program_name(const int32_t pluginId, const int32_t index, const char* const name) | ||||
| { | { | ||||
| qDebug("CarlaEngine::osc_send_set_program_name(%i, %i, %s)", pluginId, index, name); | |||||
| qDebug("CarlaEngine::osc_send_control_set_program_name(%i, %i, %s)", pluginId, index, name); | |||||
| Q_ASSERT(m_oscData); | Q_ASSERT(m_oscData); | ||||
| Q_ASSERT(pluginId >= 0 && pluginId < maxPluginNumber); | |||||
| Q_ASSERT(pluginId >= 0 && pluginId < m_maxPluginNumber); | |||||
| Q_ASSERT(index >= 0); | Q_ASSERT(index >= 0); | ||||
| Q_ASSERT(name); | Q_ASSERT(name); | ||||
| @@ -1317,9 +1324,9 @@ void CarlaEngine::osc_send_control_set_program_name(const int32_t pluginId, cons | |||||
| void CarlaEngine::osc_send_control_set_midi_program(const int32_t pluginId, const int32_t index) | void CarlaEngine::osc_send_control_set_midi_program(const int32_t pluginId, const int32_t index) | ||||
| { | { | ||||
| qDebug("CarlaEngine::osc_send_set_midi_program(%i, %i)", pluginId, index); | |||||
| qDebug("CarlaEngine::osc_send_control_set_midi_program(%i, %i)", pluginId, index); | |||||
| Q_ASSERT(m_oscData); | Q_ASSERT(m_oscData); | ||||
| Q_ASSERT(pluginId >= 0 && pluginId < maxPluginNumber); | |||||
| Q_ASSERT(pluginId >= 0 && pluginId < m_maxPluginNumber); | |||||
| if (m_oscData && m_oscData->target) | if (m_oscData && m_oscData->target) | ||||
| { | { | ||||
| @@ -1332,9 +1339,9 @@ void CarlaEngine::osc_send_control_set_midi_program(const int32_t pluginId, cons | |||||
| void CarlaEngine::osc_send_control_set_midi_program_count(const int32_t pluginId, const int32_t count) | void CarlaEngine::osc_send_control_set_midi_program_count(const int32_t pluginId, const int32_t count) | ||||
| { | { | ||||
| qDebug("CarlaEngine::osc_send_set_midi_program_count(%i, %i)", pluginId, count); | |||||
| qDebug("CarlaEngine::osc_send_control_set_midi_program_count(%i, %i)", pluginId, count); | |||||
| Q_ASSERT(m_oscData); | Q_ASSERT(m_oscData); | ||||
| Q_ASSERT(pluginId >= 0 && pluginId < maxPluginNumber); | |||||
| Q_ASSERT(pluginId >= 0 && pluginId < m_maxPluginNumber); | |||||
| Q_ASSERT(count >= 0); | Q_ASSERT(count >= 0); | ||||
| if (m_oscData && m_oscData->target) | if (m_oscData && m_oscData->target) | ||||
| @@ -1348,9 +1355,9 @@ void CarlaEngine::osc_send_control_set_midi_program_count(const int32_t pluginId | |||||
| void CarlaEngine::osc_send_control_set_midi_program_data(const int32_t pluginId, const int32_t index, const int32_t bank, const int32_t program, const char* const name) | void CarlaEngine::osc_send_control_set_midi_program_data(const int32_t pluginId, const int32_t index, const int32_t bank, const int32_t program, const char* const name) | ||||
| { | { | ||||
| qDebug("CarlaEngine::osc_send_set_midi_program_data(%i, %i, %i, %i, %s)", pluginId, index, bank, program, name); | |||||
| qDebug("CarlaEngine::osc_send_control_set_midi_program_data(%i, %i, %i, %i, %s)", pluginId, index, bank, program, name); | |||||
| Q_ASSERT(m_oscData); | Q_ASSERT(m_oscData); | ||||
| Q_ASSERT(pluginId >= 0 && pluginId < maxPluginNumber); | |||||
| Q_ASSERT(pluginId >= 0 && pluginId < m_maxPluginNumber); | |||||
| Q_ASSERT(index >= 0); | Q_ASSERT(index >= 0); | ||||
| Q_ASSERT(bank >= 0); | Q_ASSERT(bank >= 0); | ||||
| Q_ASSERT(program >= 0); | Q_ASSERT(program >= 0); | ||||
| @@ -1367,9 +1374,9 @@ void CarlaEngine::osc_send_control_set_midi_program_data(const int32_t pluginId, | |||||
| void CarlaEngine::osc_send_control_note_on(const int32_t pluginId, const int32_t channel, const int32_t note, const int32_t velo) | void CarlaEngine::osc_send_control_note_on(const int32_t pluginId, const int32_t channel, const int32_t note, const int32_t velo) | ||||
| { | { | ||||
| qDebug("CarlaEngine::osc_send_note_on(%i, %i, %i, %i)", pluginId, channel, note, velo); | |||||
| qDebug("CarlaEngine::osc_send_control_note_on(%i, %i, %i, %i)", pluginId, channel, note, velo); | |||||
| Q_ASSERT(m_oscData); | Q_ASSERT(m_oscData); | ||||
| Q_ASSERT(pluginId >= 0 && pluginId < maxPluginNumber); | |||||
| Q_ASSERT(pluginId >= 0 && pluginId < m_maxPluginNumber); | |||||
| Q_ASSERT(channel >= 0 && channel < 16); | Q_ASSERT(channel >= 0 && channel < 16); | ||||
| Q_ASSERT(note >= 0 && note < 128); | Q_ASSERT(note >= 0 && note < 128); | ||||
| Q_ASSERT(velo > 0 && velo < 128); | Q_ASSERT(velo > 0 && velo < 128); | ||||
| @@ -1385,9 +1392,9 @@ void CarlaEngine::osc_send_control_note_on(const int32_t pluginId, const int32_t | |||||
| void CarlaEngine::osc_send_control_note_off(const int32_t pluginId, const int32_t channel, const int32_t note) | void CarlaEngine::osc_send_control_note_off(const int32_t pluginId, const int32_t channel, const int32_t note) | ||||
| { | { | ||||
| qDebug("CarlaEngine::osc_send_note_off(%i, %i, %i)", pluginId, channel, note); | |||||
| qDebug("CarlaEngine::osc_send_control_note_off(%i, %i, %i)", pluginId, channel, note); | |||||
| Q_ASSERT(m_oscData); | Q_ASSERT(m_oscData); | ||||
| Q_ASSERT(pluginId >= 0 && pluginId < maxPluginNumber); | |||||
| Q_ASSERT(pluginId >= 0 && pluginId < m_maxPluginNumber); | |||||
| Q_ASSERT(channel >= 0 && channel < 16); | Q_ASSERT(channel >= 0 && channel < 16); | ||||
| Q_ASSERT(note >= 0 && note < 128); | Q_ASSERT(note >= 0 && note < 128); | ||||
| @@ -1402,9 +1409,9 @@ void CarlaEngine::osc_send_control_note_off(const int32_t pluginId, const int32_ | |||||
| void CarlaEngine::osc_send_control_set_input_peak_value(const int32_t pluginId, const int32_t portId, const double value) | void CarlaEngine::osc_send_control_set_input_peak_value(const int32_t pluginId, const int32_t portId, const double value) | ||||
| { | { | ||||
| qDebug("CarlaEngine::osc_send_set_input_peak_value(%i, %i, %g)", pluginId, portId, value); | |||||
| qDebug("CarlaEngine::osc_send_control_set_input_peak_value(%i, %i, %g)", pluginId, portId, value); | |||||
| Q_ASSERT(m_oscData); | Q_ASSERT(m_oscData); | ||||
| Q_ASSERT(pluginId >= 0 && pluginId < maxPluginNumber); | |||||
| Q_ASSERT(pluginId >= 0 && pluginId < m_maxPluginNumber); | |||||
| Q_ASSERT(portId == 1 || portId == 2); | Q_ASSERT(portId == 1 || portId == 2); | ||||
| if (m_oscData && m_oscData->target) | if (m_oscData && m_oscData->target) | ||||
| @@ -1418,9 +1425,9 @@ void CarlaEngine::osc_send_control_set_input_peak_value(const int32_t pluginId, | |||||
| void CarlaEngine::osc_send_control_set_output_peak_value(const int32_t pluginId, const int32_t portId, const double value) | void CarlaEngine::osc_send_control_set_output_peak_value(const int32_t pluginId, const int32_t portId, const double value) | ||||
| { | { | ||||
| qDebug("CarlaEngine::osc_send_set_output_peak_value(%i, %i, %g)", pluginId, portId, value); | |||||
| qDebug("CarlaEngine::osc_send_control_set_output_peak_value(%i, %i, %g)", pluginId, portId, value); | |||||
| Q_ASSERT(m_oscData); | Q_ASSERT(m_oscData); | ||||
| Q_ASSERT(pluginId >= 0 && pluginId < maxPluginNumber); | |||||
| Q_ASSERT(pluginId >= 0 && pluginId < m_maxPluginNumber); | |||||
| Q_ASSERT(portId == 1 || portId == 2); | Q_ASSERT(portId == 1 || portId == 2); | ||||
| if (m_oscData && m_oscData->target) | if (m_oscData && m_oscData->target) | ||||
| @@ -1434,7 +1441,7 @@ void CarlaEngine::osc_send_control_set_output_peak_value(const int32_t pluginId, | |||||
| void CarlaEngine::osc_send_control_exit() | void CarlaEngine::osc_send_control_exit() | ||||
| { | { | ||||
| qDebug("CarlaEngine::osc_send_exit()"); | |||||
| qDebug("CarlaEngine::osc_send_control_exit()"); | |||||
| Q_ASSERT(m_oscData); | Q_ASSERT(m_oscData); | ||||
| if (m_oscData && m_oscData->target) | if (m_oscData && m_oscData->target) | ||||
| @@ -1532,53 +1539,53 @@ void CarlaEngine::osc_send_bridge_plugin_info(const int32_t category, const int3 | |||||
| if (m_oscData && m_oscData->target) | if (m_oscData && m_oscData->target) | ||||
| { | { | ||||
| char target_path[strlen(m_oscData->path)+27]; | |||||
| char target_path[strlen(m_oscData->path)+20]; | |||||
| strcpy(target_path, m_oscData->path); | strcpy(target_path, m_oscData->path); | ||||
| strcat(target_path, "/bridge_plugin_info"); | strcat(target_path, "/bridge_plugin_info"); | ||||
| lo_send(m_oscData->target, target_path, "iissssh", category, hints, name, label, maker, copyright, uniqueId); | lo_send(m_oscData->target, target_path, "iissssh", category, hints, name, label, maker, copyright, uniqueId); | ||||
| } | } | ||||
| } | } | ||||
| void CarlaEngine::osc_send_bridge_param_info(const int32_t index, const char* const name, const char* const unit) | |||||
| void CarlaEngine::osc_send_bridge_parameter_info(const int32_t index, const char* const name, const char* const unit) | |||||
| { | { | ||||
| qDebug("CarlaEngine::osc_send_bridge_param_info(%i, \"%s\", \"%s\")", index, name, unit); | |||||
| qDebug("CarlaEngine::osc_send_bridge_parameter_info(%i, \"%s\", \"%s\")", index, name, unit); | |||||
| Q_ASSERT(m_oscData); | Q_ASSERT(m_oscData); | ||||
| Q_ASSERT(name); | Q_ASSERT(name); | ||||
| Q_ASSERT(unit); | Q_ASSERT(unit); | ||||
| if (m_oscData && m_oscData->target) | if (m_oscData && m_oscData->target) | ||||
| { | { | ||||
| char target_path[strlen(m_oscData->path)+27]; | |||||
| char target_path[strlen(m_oscData->path)+23]; | |||||
| strcpy(target_path, m_oscData->path); | strcpy(target_path, m_oscData->path); | ||||
| strcat(target_path, "/bridge_param_info"); | |||||
| strcat(target_path, "/bridge_parameter_info"); | |||||
| lo_send(m_oscData->target, target_path, "iss", index, name, unit); | lo_send(m_oscData->target, target_path, "iss", index, name, unit); | ||||
| } | } | ||||
| } | } | ||||
| void CarlaEngine::osc_send_bridge_param_data(const int32_t index, const int32_t type, const int32_t rindex, const int32_t hints, const int32_t midiChannel, const int32_t midiCC) | |||||
| void CarlaEngine::osc_send_bridge_parameter_data(const int32_t index, const int32_t type, const int32_t rindex, const int32_t hints, const int32_t midiChannel, const int32_t midiCC) | |||||
| { | { | ||||
| qDebug("CarlaEngine::osc_send_bridge_param_data(%i, %i, %i, %i, %i, %i)", index, type, rindex, hints, midiChannel, midiCC); | |||||
| qDebug("CarlaEngine::osc_send_bridge_parameter_data(%i, %i, %i, %i, %i, %i)", index, type, rindex, hints, midiChannel, midiCC); | |||||
| Q_ASSERT(m_oscData); | Q_ASSERT(m_oscData); | ||||
| if (m_oscData && m_oscData->target) | if (m_oscData && m_oscData->target) | ||||
| { | { | ||||
| char target_path[strlen(m_oscData->path)+27]; | |||||
| char target_path[strlen(m_oscData->path)+23]; | |||||
| strcpy(target_path, m_oscData->path); | strcpy(target_path, m_oscData->path); | ||||
| strcat(target_path, "/bridge_param_data"); | |||||
| strcat(target_path, "/bridge_parameter_data"); | |||||
| lo_send(m_oscData->target, target_path, "iiiiii", index, type, rindex, hints, midiChannel, midiCC); | lo_send(m_oscData->target, target_path, "iiiiii", index, type, rindex, hints, midiChannel, midiCC); | ||||
| } | } | ||||
| } | } | ||||
| void CarlaEngine::osc_send_bridge_param_ranges(const int32_t index, const double def, const double min, const double max, const double step, const double stepSmall, const double stepLarge) | |||||
| void CarlaEngine::osc_send_bridge_parameter_ranges(const int32_t index, const double def, const double min, const double max, const double step, const double stepSmall, const double stepLarge) | |||||
| { | { | ||||
| qDebug("CarlaEngine::osc_send_bridge_param_ranges(%i, %g, %g, %g, %g, %g, %g)", index, def, min, max, step, stepSmall, stepLarge); | |||||
| qDebug("CarlaEngine::osc_send_bridge_parameter_ranges(%i, %g, %g, %g, %g, %g, %g)", index, def, min, max, step, stepSmall, stepLarge); | |||||
| Q_ASSERT(m_oscData); | Q_ASSERT(m_oscData); | ||||
| if (m_oscData && m_oscData->target) | if (m_oscData && m_oscData->target) | ||||
| { | { | ||||
| char target_path[strlen(m_oscData->path)+27]; | |||||
| char target_path[strlen(m_oscData->path)+25]; | |||||
| strcpy(target_path, m_oscData->path); | strcpy(target_path, m_oscData->path); | ||||
| strcat(target_path, "/bridge_param_ranges"); | |||||
| strcat(target_path, "/bridge_parameter_ranges"); | |||||
| lo_send(m_oscData->target, target_path, "idddddd", index, def, min, max, step, stepSmall, stepLarge); | lo_send(m_oscData->target, target_path, "idddddd", index, def, min, max, step, stepSmall, stepLarge); | ||||
| } | } | ||||
| } | } | ||||
| @@ -1590,9 +1597,9 @@ void CarlaEngine::osc_send_bridge_program_info(const int32_t index, const char* | |||||
| if (m_oscData && m_oscData->target) | if (m_oscData && m_oscData->target) | ||||
| { | { | ||||
| char target_path[strlen(m_oscData->path)+27]; | |||||
| char target_path[strlen(m_oscData->path)+21]; | |||||
| strcpy(target_path, m_oscData->path); | strcpy(target_path, m_oscData->path); | ||||
| strcat(target_path, "/bridge_midi_program_info"); | |||||
| strcat(target_path, "/bridge_program_info"); | |||||
| lo_send(m_oscData->target, target_path, "is", index, name); | lo_send(m_oscData->target, target_path, "is", index, name); | ||||
| } | } | ||||
| } | } | ||||
| @@ -1604,7 +1611,7 @@ void CarlaEngine::osc_send_bridge_midi_program_info(const int32_t index, const i | |||||
| if (m_oscData && m_oscData->target) | if (m_oscData && m_oscData->target) | ||||
| { | { | ||||
| char target_path[strlen(m_oscData->path)+27]; | |||||
| char target_path[strlen(m_oscData->path)+26]; | |||||
| strcpy(target_path, m_oscData->path); | strcpy(target_path, m_oscData->path); | ||||
| strcat(target_path, "/bridge_midi_program_info"); | strcat(target_path, "/bridge_midi_program_info"); | ||||
| lo_send(m_oscData->target, target_path, "iiis", index, bank, program, label); | lo_send(m_oscData->target, target_path, "iiis", index, bank, program, label); | ||||
| @@ -1618,7 +1625,7 @@ void CarlaEngine::osc_send_bridge_set_parameter_value(const int32_t index, const | |||||
| if (m_oscData && m_oscData->target) | if (m_oscData && m_oscData->target) | ||||
| { | { | ||||
| char target_path[strlen(m_oscData->path)+27]; | |||||
| char target_path[strlen(m_oscData->path)+28]; | |||||
| strcpy(target_path, m_oscData->path); | strcpy(target_path, m_oscData->path); | ||||
| strcat(target_path, "/bridge_set_parameter_value"); | strcat(target_path, "/bridge_set_parameter_value"); | ||||
| lo_send(m_oscData->target, target_path, "id", index, value); | lo_send(m_oscData->target, target_path, "id", index, value); | ||||
| @@ -1632,7 +1639,7 @@ void CarlaEngine::osc_send_bridge_set_default_value(const int32_t index, const d | |||||
| if (m_oscData && m_oscData->target) | if (m_oscData && m_oscData->target) | ||||
| { | { | ||||
| char target_path[strlen(m_oscData->path)+27]; | |||||
| char target_path[strlen(m_oscData->path)+26]; | |||||
| strcpy(target_path, m_oscData->path); | strcpy(target_path, m_oscData->path); | ||||
| strcat(target_path, "/bridge_set_default_value"); | strcat(target_path, "/bridge_set_default_value"); | ||||
| lo_send(m_oscData->target, target_path, "id", index, value); | lo_send(m_oscData->target, target_path, "id", index, value); | ||||
| @@ -1646,7 +1653,7 @@ void CarlaEngine::osc_send_bridge_set_program(const int32_t index) | |||||
| if (m_oscData && m_oscData->target) | if (m_oscData && m_oscData->target) | ||||
| { | { | ||||
| char target_path[strlen(m_oscData->path)+27]; | |||||
| char target_path[strlen(m_oscData->path)+20]; | |||||
| strcpy(target_path, m_oscData->path); | strcpy(target_path, m_oscData->path); | ||||
| strcat(target_path, "/bridge_set_program"); | strcat(target_path, "/bridge_set_program"); | ||||
| lo_send(m_oscData->target, target_path, "i", index); | lo_send(m_oscData->target, target_path, "i", index); | ||||
| @@ -1660,12 +1667,40 @@ void CarlaEngine::osc_send_bridge_set_midi_program(const int32_t index) | |||||
| if (m_oscData && m_oscData->target) | if (m_oscData && m_oscData->target) | ||||
| { | { | ||||
| char target_path[strlen(m_oscData->path)+27]; | |||||
| char target_path[strlen(m_oscData->path)+25]; | |||||
| strcpy(target_path, m_oscData->path); | strcpy(target_path, m_oscData->path); | ||||
| strcat(target_path, "/bridge_set_midi_program"); | strcat(target_path, "/bridge_set_midi_program"); | ||||
| lo_send(m_oscData->target, target_path, "i", index); | lo_send(m_oscData->target, target_path, "i", index); | ||||
| } | } | ||||
| } | } | ||||
| void CarlaEngine::osc_send_bridge_set_input_peak_value(const int32_t portId, const double value) | |||||
| { | |||||
| Q_ASSERT(m_oscData); | |||||
| Q_ASSERT(portId == 1 || portId == 2); | |||||
| if (m_oscData && m_oscData->target) | |||||
| { | |||||
| char target_path[strlen(m_oscData->path)+28]; | |||||
| strcpy(target_path, m_oscData->path); | |||||
| strcat(target_path, "/bridge_set_input_peak_value"); | |||||
| lo_send(m_oscData->target, target_path, "id", portId, value); | |||||
| } | |||||
| } | |||||
| void CarlaEngine::osc_send_bridge_set_output_peak_value(const int32_t portId, const double value) | |||||
| { | |||||
| Q_ASSERT(m_oscData); | |||||
| Q_ASSERT(portId == 1 || portId == 2); | |||||
| if (m_oscData && m_oscData->target) | |||||
| { | |||||
| char target_path[strlen(m_oscData->path)+29]; | |||||
| strcpy(target_path, m_oscData->path); | |||||
| strcat(target_path, "/bridge_set_output_peak_value"); | |||||
| lo_send(m_oscData->target, target_path, "id", portId, value); | |||||
| } | |||||
| } | |||||
| #endif | #endif | ||||
| CARLA_BACKEND_END_NAMESPACE | CARLA_BACKEND_END_NAMESPACE | ||||
| @@ -192,6 +192,7 @@ public: | |||||
| static int maxClientNameSize(); | static int maxClientNameSize(); | ||||
| static int maxPortNameSize(); | static int maxPortNameSize(); | ||||
| static unsigned short maxPluginNumber(); | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Virtual, per-engine type calls | // Virtual, per-engine type calls | ||||
| @@ -270,20 +271,19 @@ public: | |||||
| void osc_send_bridge_program_count(const int32_t count); | void osc_send_bridge_program_count(const int32_t count); | ||||
| void osc_send_bridge_midi_program_count(const int32_t count); | void osc_send_bridge_midi_program_count(const int32_t count); | ||||
| void osc_send_bridge_plugin_info(const int32_t category, const int32_t hints, const char* const name, const char* const label, const char* const maker, const char* const copyright, const int64_t uniqueId); | void osc_send_bridge_plugin_info(const int32_t category, const int32_t hints, const char* const name, const char* const label, const char* const maker, const char* const copyright, const int64_t uniqueId); | ||||
| void osc_send_bridge_param_info(const int32_t index, const char* const name, const char* const unit); | |||||
| void osc_send_bridge_param_data(const int32_t index, const int32_t type, const int32_t rindex, const int32_t hints, const int32_t midiChannel, const int32_t midiCC); | |||||
| void osc_send_bridge_param_ranges(const int32_t index, const double def, const double min, const double max, const double step, const double stepSmall, const double stepLarge); | |||||
| void osc_send_bridge_parameter_info(const int32_t index, const char* const name, const char* const unit); | |||||
| void osc_send_bridge_parameter_data(const int32_t index, const int32_t type, const int32_t rindex, const int32_t hints, const int32_t midiChannel, const int32_t midiCC); | |||||
| void osc_send_bridge_parameter_ranges(const int32_t index, const double def, const double min, const double max, const double step, const double stepSmall, const double stepLarge); | |||||
| void osc_send_bridge_program_info(const int32_t index, const char* const name); | void osc_send_bridge_program_info(const int32_t index, const char* const name); | ||||
| void osc_send_bridge_midi_program_info(const int32_t index, const int32_t bank, const int32_t program, const char* const label); | void osc_send_bridge_midi_program_info(const int32_t index, const int32_t bank, const int32_t program, const char* const label); | ||||
| void osc_send_bridge_set_parameter_value(const int32_t index, const double value); | void osc_send_bridge_set_parameter_value(const int32_t index, const double value); | ||||
| void osc_send_bridge_set_default_value(const int32_t index, const double value); | void osc_send_bridge_set_default_value(const int32_t index, const double value); | ||||
| void osc_send_bridge_set_program(const int32_t index); | void osc_send_bridge_set_program(const int32_t index); | ||||
| void osc_send_bridge_set_midi_program(const int32_t index); | void osc_send_bridge_set_midi_program(const int32_t index); | ||||
| //void osc_send_bridge_program(const int32_t index); | |||||
| //void osc_send_bridge_midi_program(const int32_t index); | |||||
| void osc_send_bridge_set_input_peak_value(const int32_t portId, const double value); | |||||
| void osc_send_bridge_set_output_peak_value(const int32_t portId, const double value); | |||||
| //void osc_send_bridge_custom_data(const char* const stype, const char* const key, const char* const value); | //void osc_send_bridge_custom_data(const char* const stype, const char* const key, const char* const value); | ||||
| //void osc_send_bridge_chunk_data(const char* const stringData); | //void osc_send_bridge_chunk_data(const char* const stringData); | ||||
| //void osc_send_bridge_update(); | |||||
| #else | #else | ||||
| void osc_send_control_add_plugin(const int32_t pluginId, const char* const pluginName); | void osc_send_control_add_plugin(const int32_t pluginId, const char* const pluginName); | ||||
| void osc_send_control_remove_plugin(const int32_t pluginId); | void osc_send_control_remove_plugin(const int32_t pluginId); | ||||
| @@ -366,7 +366,6 @@ protected: | |||||
| uint32_t bufferSize; | uint32_t bufferSize; | ||||
| double sampleRate; | double sampleRate; | ||||
| CarlaTimeInfo timeInfo; | CarlaTimeInfo timeInfo; | ||||
| unsigned short maxPluginNumber; | |||||
| void bufferSizeChanged(uint32_t newBufferSize); | void bufferSizeChanged(uint32_t newBufferSize); | ||||
| @@ -389,6 +388,8 @@ private: | |||||
| double m_insPeak[MAX_PLUGINS * MAX_PEAKS]; | double m_insPeak[MAX_PLUGINS * MAX_PEAKS]; | ||||
| double m_outsPeak[MAX_PLUGINS * MAX_PEAKS]; | double m_outsPeak[MAX_PLUGINS * MAX_PEAKS]; | ||||
| static unsigned short m_maxPluginNumber; | |||||
| }; | }; | ||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| @@ -266,7 +266,7 @@ void CarlaEngineJack::handleFreewheelCallback(bool isFreewheel) | |||||
| void CarlaEngineJack::handleProcessCallback(uint32_t nframes) | void CarlaEngineJack::handleProcessCallback(uint32_t nframes) | ||||
| { | { | ||||
| if (maxPluginNumber == 0) | |||||
| if (maxPluginNumber() == 0) | |||||
| return; | return; | ||||
| state = jackbridge_transport_query(client, &pos); | state = jackbridge_transport_query(client, &pos); | ||||
| @@ -302,7 +302,7 @@ void CarlaEngineJack::handleProcessCallback(uint32_t nframes) | |||||
| #ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
| if (carlaOptions.processMode == PROCESS_MODE_SINGLE_CLIENT) | if (carlaOptions.processMode == PROCESS_MODE_SINGLE_CLIENT) | ||||
| { | { | ||||
| for (unsigned short i=0; i < maxPluginNumber; i++) | |||||
| for (unsigned short i=0, max=maxPluginNumber(); i < max; i++) | |||||
| { | { | ||||
| CarlaPlugin* const plugin = getPluginUnchecked(i); | CarlaPlugin* const plugin = getPluginUnchecked(i); | ||||
| @@ -436,7 +436,7 @@ void CarlaEngineJack::handleProcessCallback(uint32_t nframes) | |||||
| bool processed = false; | bool processed = false; | ||||
| // process plugins | // process plugins | ||||
| for (unsigned short i=0; i < maxPluginNumber; i++) | |||||
| for (unsigned short i=0, max=maxPluginNumber(); i < max; i++) | |||||
| { | { | ||||
| CarlaPlugin* const plugin = getPluginUnchecked(i); | CarlaPlugin* const plugin = getPluginUnchecked(i); | ||||
| @@ -581,7 +581,7 @@ void CarlaEngineJack::handleProcessCallback(uint32_t nframes) | |||||
| void CarlaEngineJack::handleShutdownCallback() | void CarlaEngineJack::handleShutdownCallback() | ||||
| { | { | ||||
| //for (unsigned short i=0; i < maxPluginNumber; i++) | |||||
| //for (unsigned short i=0, max=maxPluginNumber(); i < max; i++) | |||||
| //{ | //{ | ||||
| //CarlaPlugin* const plugin = getPluginUnchecked(i); | //CarlaPlugin* const plugin = getPluginUnchecked(i); | ||||
| //plugin->x_client | //plugin->x_client | ||||
| @@ -42,8 +42,6 @@ CarlaEngineRtAudio::CarlaEngineRtAudio(RtAudio::Api api) | |||||
| qDebug("CarlaEngineRtAudio::CarlaEngineRtAudio()"); | qDebug("CarlaEngineRtAudio::CarlaEngineRtAudio()"); | ||||
| type = CarlaEngineTypeRtAudio; | type = CarlaEngineTypeRtAudio; | ||||
| procThread = nullptr; | |||||
| } | } | ||||
| CarlaEngineRtAudio::~CarlaEngineRtAudio() | CarlaEngineRtAudio::~CarlaEngineRtAudio() | ||||
| @@ -55,8 +53,6 @@ bool CarlaEngineRtAudio::init(const char* const clientName) | |||||
| { | { | ||||
| qDebug("CarlaEngineRtAudio::init(\"%s\")", clientName); | qDebug("CarlaEngineRtAudio::init(\"%s\")", clientName); | ||||
| procThread = nullptr; | |||||
| if (adac.getDeviceCount() < 1) | if (adac.getDeviceCount() < 1) | ||||
| { | { | ||||
| setLastError("No audio devices available"); | setLastError("No audio devices available"); | ||||
| @@ -134,11 +130,6 @@ bool CarlaEngineRtAudio::close() | |||||
| return true; | return true; | ||||
| } | } | ||||
| bool CarlaEngineRtAudio::isOnAudioThread() | |||||
| { | |||||
| return (QThread::currentThread() == procThread); | |||||
| } | |||||
| bool CarlaEngineRtAudio::isOffline() | bool CarlaEngineRtAudio::isOffline() | ||||
| { | { | ||||
| return false; | return false; | ||||
| @@ -180,10 +171,7 @@ CarlaEngineClient* CarlaEngineRtAudio::addClient(CarlaPlugin* const plugin) | |||||
| void CarlaEngineRtAudio::handleProcessCallback(void* outputBuffer, void* inputBuffer, unsigned int nframes, double streamTime, RtAudioStreamStatus status) | void CarlaEngineRtAudio::handleProcessCallback(void* outputBuffer, void* inputBuffer, unsigned int nframes, double streamTime, RtAudioStreamStatus status) | ||||
| { | { | ||||
| if (procThread == nullptr) | |||||
| procThread = QThread::currentThread(); | |||||
| if (maxPluginNumber == 0) | |||||
| if (maxPluginNumber() == 0) | |||||
| return; | return; | ||||
| // get buffers from RtAudio | // get buffers from RtAudio | ||||
| @@ -233,7 +221,7 @@ void CarlaEngineRtAudio::handleProcessCallback(void* outputBuffer, void* inputBu | |||||
| bool processed = false; | bool processed = false; | ||||
| // process plugins | // process plugins | ||||
| for (unsigned short i=0; i < maxPluginNumber; i++) | |||||
| for (unsigned short i=0, max=maxPluginNumber(); i < max; i++) | |||||
| { | { | ||||
| CarlaPlugin* const plugin = getPluginUnchecked(i); | CarlaPlugin* const plugin = getPluginUnchecked(i); | ||||
| @@ -91,7 +91,11 @@ void CarlaOsc::close() | |||||
| int CarlaOsc::handleMessage(const char* const path, const int argc, const lo_arg* const* const argv, const char* const types, const lo_message msg) | int CarlaOsc::handleMessage(const char* const path, const int argc, const lo_arg* const* const argv, const char* const types, const lo_message msg) | ||||
| { | { | ||||
| qDebug("CarlaOsc::handleMessage(%s, %i, %p, %s, %p)", path, argc, argv, types, msg); | |||||
| #if DEBUG | |||||
| if (! QString(path).contains("put_peak_value")) | |||||
| qDebug("CarlaOsc::handleMessage(%s, %i, %p, %s, %p)", path, argc, argv, types, msg); | |||||
| #endif | |||||
| Q_ASSERT(m_serverThread); | Q_ASSERT(m_serverThread); | ||||
| Q_ASSERT(path); | Q_ASSERT(path); | ||||
| @@ -122,14 +126,14 @@ int CarlaOsc::handleMessage(const char* const path, const int argc, const lo_arg | |||||
| if (std::isdigit(path[m_name_len+3])) | if (std::isdigit(path[m_name_len+3])) | ||||
| pluginId += (path[m_name_len+3]-'0')*10; | pluginId += (path[m_name_len+3]-'0')*10; | ||||
| if (pluginId < 0 || pluginId > CarlaBackend::MAX_PLUGINS) | |||||
| if (pluginId < 0 || pluginId > CarlaEngine::maxPluginNumber()) | |||||
| { | { | ||||
| qCritical("CarlaOsc::handleMessage() - failed to get plugin, wrong id -> %i", pluginId); | qCritical("CarlaOsc::handleMessage() - failed to get plugin, wrong id -> %i", pluginId); | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| // Get plugin | // Get plugin | ||||
| CarlaBackend::CarlaPlugin* const plugin = engine->getPlugin(pluginId); | |||||
| CarlaPlugin* const plugin = engine->getPluginUnchecked(pluginId); | |||||
| if (plugin == nullptr || plugin->id() != pluginId) | if (plugin == nullptr || plugin->id() != pluginId) | ||||
| { | { | ||||
| @@ -142,8 +146,6 @@ int CarlaOsc::handleMessage(const char* const path, const int argc, const lo_arg | |||||
| char method[32] = { 0 }; | char method[32] = { 0 }; | ||||
| memcpy(method, path + (m_name_len + offset), 32); | memcpy(method, path + (m_name_len + offset), 32); | ||||
| qWarning("CarlaOsc::handleMessage() method: %s", method); | |||||
| // Common OSC methods | // Common OSC methods | ||||
| if (strcmp(method, "/update") == 0) | if (strcmp(method, "/update") == 0) | ||||
| { | { | ||||
| @@ -194,42 +196,48 @@ int CarlaOsc::handleMessage(const char* const path, const int argc, const lo_arg | |||||
| return handle_lv2_event_transfer(plugin, argc, argv, types); | return handle_lv2_event_transfer(plugin, argc, argv, types); | ||||
| // Plugin Bridges | // Plugin Bridges | ||||
| if (plugin->hints() & CarlaBackend::PLUGIN_IS_BRIDGE) | |||||
| if (plugin->hints() & PLUGIN_IS_BRIDGE) | |||||
| { | { | ||||
| qWarning("CarlaOsc::handleMessage() TO PLUGIN"); | |||||
| if (strcmp(method, "/bridge_ains_peak") == 0) | |||||
| return handle_bridge_ains_peak(plugin, argc, argv, types); | |||||
| if (strcmp(method, "/bridge_aouts_peak") == 0) | |||||
| return handle_bridge_aouts_peak(plugin, argc, argv, types); | |||||
| if (strcmp(method, "/bridge_set_input_peak_value") == 0) | |||||
| return handle_bridge_set_input_peak_value(plugin, argc, argv, types); | |||||
| if (strcmp(method, "/bridge_set_output_peak_value") == 0) | |||||
| return handle_bridge_set_output_peak_value(plugin, argc, argv, types); | |||||
| if (strcmp(method, "/bridge_audio_count") == 0) | if (strcmp(method, "/bridge_audio_count") == 0) | ||||
| return plugin->setOscBridgeInfo(CarlaBackend::PluginBridgeAudioCount, argv); | |||||
| return plugin->setOscBridgeInfo(PluginBridgeAudioCount, argc, argv, types); | |||||
| if (strcmp(method, "/bridge_midi_count") == 0) | if (strcmp(method, "/bridge_midi_count") == 0) | ||||
| return plugin->setOscBridgeInfo(CarlaBackend::PluginBridgeMidiCount, argv); | |||||
| if (strcmp(method, "/bridge_param_count") == 0) | |||||
| return plugin->setOscBridgeInfo(CarlaBackend::PluginBridgeParameterCount, argv); | |||||
| return plugin->setOscBridgeInfo(PluginBridgeMidiCount, argc, argv, types); | |||||
| if (strcmp(method, "/bridge_parameter_count") == 0) | |||||
| return plugin->setOscBridgeInfo(PluginBridgeParameterCount, argc, argv, types); | |||||
| if (strcmp(method, "/bridge_program_count") == 0) | if (strcmp(method, "/bridge_program_count") == 0) | ||||
| return plugin->setOscBridgeInfo(CarlaBackend::PluginBridgeProgramCount, argv); | |||||
| return plugin->setOscBridgeInfo(PluginBridgeProgramCount, argc, argv, types); | |||||
| if (strcmp(method, "/bridge_midi_program_count") == 0) | if (strcmp(method, "/bridge_midi_program_count") == 0) | ||||
| return plugin->setOscBridgeInfo(CarlaBackend::PluginBridgeMidiProgramCount, argv); | |||||
| return plugin->setOscBridgeInfo(PluginBridgeMidiProgramCount, argc, argv, types); | |||||
| if (strcmp(method, "/bridge_plugin_info") == 0) | if (strcmp(method, "/bridge_plugin_info") == 0) | ||||
| return plugin->setOscBridgeInfo(CarlaBackend::PluginBridgePluginInfo, argv); | |||||
| if (strcmp(method, "/bridge_param_info") == 0) | |||||
| return plugin->setOscBridgeInfo(CarlaBackend::PluginBridgeParameterInfo, argv); | |||||
| if (strcmp(method, "/bridge_param_data") == 0) | |||||
| return plugin->setOscBridgeInfo(CarlaBackend::PluginBridgeParameterDataInfo, argv); | |||||
| if (strcmp(method, "/bridge_param_ranges") == 0) | |||||
| return plugin->setOscBridgeInfo(CarlaBackend::PluginBridgeParameterRangesInfo, argv); | |||||
| return plugin->setOscBridgeInfo(PluginBridgePluginInfo, argc, argv, types); | |||||
| if (strcmp(method, "/bridge_parameter_info") == 0) | |||||
| return plugin->setOscBridgeInfo(PluginBridgeParameterInfo, argc, argv, types); | |||||
| if (strcmp(method, "/bridge_parameter_data") == 0) | |||||
| return plugin->setOscBridgeInfo(PluginBridgeParameterData, argc, argv, types); | |||||
| if (strcmp(method, "/bridge_parameter_ranges") == 0) | |||||
| return plugin->setOscBridgeInfo(PluginBridgeParameterRanges, argc, argv, types); | |||||
| if (strcmp(method, "/bridge_program_info") == 0) | if (strcmp(method, "/bridge_program_info") == 0) | ||||
| return plugin->setOscBridgeInfo(CarlaBackend::PluginBridgeProgramInfo, argv); | |||||
| return plugin->setOscBridgeInfo(PluginBridgeProgramInfo, argc, argv, types); | |||||
| if (strcmp(method, "/bridge_midi_program_info") == 0) | if (strcmp(method, "/bridge_midi_program_info") == 0) | ||||
| return plugin->setOscBridgeInfo(CarlaBackend::PluginBridgeMidiProgramInfo, argv); | |||||
| if (strcmp(method, "/bridge_custom_data") == 0) | |||||
| return plugin->setOscBridgeInfo(CarlaBackend::PluginBridgeCustomData, argv); | |||||
| if (strcmp(method, "/bridge_chunk_data") == 0) | |||||
| return plugin->setOscBridgeInfo(CarlaBackend::PluginBridgeChunkData, argv); | |||||
| return plugin->setOscBridgeInfo(PluginBridgeMidiProgramInfo, argc, argv, types); | |||||
| if (strcmp(method, "/bridge_set_parameter_value") == 0) | |||||
| return plugin->setOscBridgeInfo(PluginBridgeSetParameterValue, argc, argv, types); | |||||
| if (strcmp(method, "/bridge_set_default_value") == 0) | |||||
| return plugin->setOscBridgeInfo(PluginBridgeSetDefaultValue, argc, argv, types); | |||||
| if (strcmp(method, "/bridge_set_program") == 0) | |||||
| return plugin->setOscBridgeInfo(PluginBridgeSetProgram, argc, argv, types); | |||||
| if (strcmp(method, "/bridge_set_midi_program") == 0) | |||||
| return plugin->setOscBridgeInfo(PluginBridgeSetMidiProgram, argc, argv, types); | |||||
| if (strcmp(method, "/bridge_set_custom_data") == 0) | |||||
| return plugin->setOscBridgeInfo(PluginBridgeSetCustomData, argc, argv, types); | |||||
| if (strcmp(method, "/bridge_set_chunk_data") == 0) | |||||
| return plugin->setOscBridgeInfo(PluginBridgeSetChunkData, argc, argv, types); | |||||
| if (strcmp(method, "/bridge_update") == 0) | if (strcmp(method, "/bridge_update") == 0) | ||||
| return plugin->setOscBridgeInfo(CarlaBackend::PluginBridgeUpdateNow, argv); | |||||
| return plugin->setOscBridgeInfo(PluginBridgeUpdateNow, argc, argv, types); | |||||
| } | } | ||||
| qWarning("CarlaOsc::handleMessage() - unsupported OSC method '%s'", method); | qWarning("CarlaOsc::handleMessage() - unsupported OSC method '%s'", method); | ||||
| @@ -268,9 +276,9 @@ int CarlaOsc::handle_register(const int argc, const lo_arg* const* const argv, c | |||||
| free((void*)port); | free((void*)port); | ||||
| // FIXME - max plugins | // FIXME - max plugins | ||||
| for (unsigned short i=0; i < CarlaBackend::MAX_PLUGINS; i++) | |||||
| for (unsigned short i=0; i < CarlaEngine::maxPluginNumber(); i++) | |||||
| { | { | ||||
| CarlaBackend::CarlaPlugin* const plugin = engine->getPluginUnchecked(i); | |||||
| CarlaPlugin* const plugin = engine->getPluginUnchecked(i); | |||||
| if (plugin && plugin->enabled()) | if (plugin && plugin->enabled()) | ||||
| plugin->registerToOsc(); | plugin->registerToOsc(); | ||||
| @@ -314,21 +322,21 @@ int CarlaOsc::handle_configure(CARLA_OSC_HANDLE_ARGS2) | |||||
| const char* const key = (const char*)&argv[0]->s; | const char* const key = (const char*)&argv[0]->s; | ||||
| const char* const value = (const char*)&argv[1]->s; | const char* const value = (const char*)&argv[1]->s; | ||||
| if (plugin->hints() & CarlaBackend::PLUGIN_IS_BRIDGE) | |||||
| { | |||||
| if (strcmp(key, CarlaBackend::CARLA_BRIDGE_MSG_HIDE_GUI) == 0) | |||||
| { | |||||
| engine->callback(CarlaBackend::CALLBACK_SHOW_GUI, plugin->id(), 0, 0, 0.0); | |||||
| return 0; | |||||
| } | |||||
| // if (plugin->hints() & PLUGIN_IS_BRIDGE) | |||||
| // { | |||||
| // if (strcmp(key, CARLA_BRIDGE_MSG_HIDE_GUI) == 0) | |||||
| // { | |||||
| // engine->callback(CALLBACK_SHOW_GUI, plugin->id(), 0, 0, 0.0); | |||||
| // return 0; | |||||
| // } | |||||
| if (strcmp(key, CarlaBackend::CARLA_BRIDGE_MSG_SAVED) == 0) | |||||
| { | |||||
| return plugin->setOscBridgeInfo(CarlaBackend::PluginBridgeSaved, nullptr); | |||||
| } | |||||
| } | |||||
| // if (strcmp(key, CARLA_BRIDGE_MSG_SAVED) == 0) | |||||
| // { | |||||
| // return plugin->setOscBridgeInfo(PluginBridgeSaved, nullptr); | |||||
| // } | |||||
| // } | |||||
| plugin->setCustomData(CarlaBackend::CUSTOM_DATA_STRING, key, value, false); | |||||
| plugin->setCustomData(CUSTOM_DATA_STRING, key, value, false); | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -416,7 +424,7 @@ int CarlaOsc::handle_exiting(CARLA_OSC_HANDLE_ARGS1) | |||||
| qDebug("CarlaOsc::handle_exiting()"); | qDebug("CarlaOsc::handle_exiting()"); | ||||
| // TODO - check for non-UIs (dssi-vst) and set to -1 instead | // TODO - check for non-UIs (dssi-vst) and set to -1 instead | ||||
| engine->callback(CarlaBackend::CALLBACK_SHOW_GUI, plugin->id(), 0, 0, 0.0); | |||||
| engine->callback(CALLBACK_SHOW_GUI, plugin->id(), 0, 0, 0.0); | |||||
| plugin->clearOscData(); | plugin->clearOscData(); | ||||
| return 0; | return 0; | ||||
| @@ -429,7 +437,7 @@ int CarlaOsc::handle_set_active(CARLA_OSC_HANDLE_ARGS2) | |||||
| qDebug("CarlaOsc::handle_set_active()"); | qDebug("CarlaOsc::handle_set_active()"); | ||||
| CARLA_OSC_CHECK_OSC_TYPES(1, "i"); | CARLA_OSC_CHECK_OSC_TYPES(1, "i"); | ||||
| bool active = (bool)argv[0]->i; | |||||
| const bool active = (bool)argv[0]->i; | |||||
| plugin->setActive(active, false, true); | plugin->setActive(active, false, true); | ||||
| return 0; | return 0; | ||||
| @@ -440,7 +448,7 @@ int CarlaOsc::handle_set_drywet(CARLA_OSC_HANDLE_ARGS2) | |||||
| qDebug("CarlaOsc::handle_set_drywet()"); | qDebug("CarlaOsc::handle_set_drywet()"); | ||||
| CARLA_OSC_CHECK_OSC_TYPES(1, "d"); | CARLA_OSC_CHECK_OSC_TYPES(1, "d"); | ||||
| double value = argv[0]->d; | |||||
| const double value = argv[0]->d; | |||||
| plugin->setDryWet(value, false, true); | plugin->setDryWet(value, false, true); | ||||
| return 0; | return 0; | ||||
| @@ -451,7 +459,7 @@ int CarlaOsc::handle_set_volume(CARLA_OSC_HANDLE_ARGS2) | |||||
| qDebug("CarlaOsc::handle_set_volume()"); | qDebug("CarlaOsc::handle_set_volume()"); | ||||
| CARLA_OSC_CHECK_OSC_TYPES(1, "d"); | CARLA_OSC_CHECK_OSC_TYPES(1, "d"); | ||||
| double value = argv[0]->d; | |||||
| const double value = argv[0]->d; | |||||
| plugin->setVolume(value, false, true); | plugin->setVolume(value, false, true); | ||||
| return 0; | return 0; | ||||
| @@ -462,7 +470,7 @@ int CarlaOsc::handle_set_balance_left(CARLA_OSC_HANDLE_ARGS2) | |||||
| qDebug("CarlaOsc::handle_set_balance_left()"); | qDebug("CarlaOsc::handle_set_balance_left()"); | ||||
| CARLA_OSC_CHECK_OSC_TYPES(1, "d"); | CARLA_OSC_CHECK_OSC_TYPES(1, "d"); | ||||
| double value = argv[0]->d; | |||||
| const double value = argv[0]->d; | |||||
| plugin->setBalanceLeft(value, false, true); | plugin->setBalanceLeft(value, false, true); | ||||
| return 0; | return 0; | ||||
| @@ -473,7 +481,7 @@ int CarlaOsc::handle_set_balance_right(CARLA_OSC_HANDLE_ARGS2) | |||||
| qDebug("CarlaOsc::handle_set_balance_right()"); | qDebug("CarlaOsc::handle_set_balance_right()"); | ||||
| CARLA_OSC_CHECK_OSC_TYPES(1, "d"); | CARLA_OSC_CHECK_OSC_TYPES(1, "d"); | ||||
| double value = argv[0]->d; | |||||
| const double value = argv[0]->d; | |||||
| plugin->setBalanceRight(value, false, true); | plugin->setBalanceRight(value, false, true); | ||||
| return 0; | return 0; | ||||
| @@ -484,8 +492,8 @@ int CarlaOsc::handle_set_parameter_value(CARLA_OSC_HANDLE_ARGS2) | |||||
| qDebug("CarlaOsc::handle_set_parameter_value()"); | qDebug("CarlaOsc::handle_set_parameter_value()"); | ||||
| CARLA_OSC_CHECK_OSC_TYPES(2, "id"); | CARLA_OSC_CHECK_OSC_TYPES(2, "id"); | ||||
| const uint32_t index = argv[0]->i; | |||||
| const double value = argv[1]->d; | |||||
| const int32_t index = argv[0]->i; | |||||
| const double value = argv[1]->d; | |||||
| plugin->setParameterValue(index, value, true, false, true); | plugin->setParameterValue(index, value, true, false, true); | ||||
| return 0; | return 0; | ||||
| @@ -496,8 +504,8 @@ int CarlaOsc::handle_set_parameter_midi_cc(CARLA_OSC_HANDLE_ARGS2) | |||||
| qDebug("CarlaOsc::handle_set_parameter_midi_cc()"); | qDebug("CarlaOsc::handle_set_parameter_midi_cc()"); | ||||
| CARLA_OSC_CHECK_OSC_TYPES(2, "ii"); | CARLA_OSC_CHECK_OSC_TYPES(2, "ii"); | ||||
| const uint32_t index = argv[0]->i; | |||||
| const int32_t cc = argv[1]->i; | |||||
| const int32_t index = argv[0]->i; | |||||
| const int32_t cc = argv[1]->i; | |||||
| plugin->setParameterMidiCC(index, cc, false, true); | plugin->setParameterMidiCC(index, cc, false, true); | ||||
| return 0; | return 0; | ||||
| @@ -508,8 +516,8 @@ int CarlaOsc::handle_set_parameter_midi_channel(CARLA_OSC_HANDLE_ARGS2) | |||||
| qDebug("CarlaOsc::handle_set_parameter_midi_channel()"); | qDebug("CarlaOsc::handle_set_parameter_midi_channel()"); | ||||
| CARLA_OSC_CHECK_OSC_TYPES(2, "ii"); | CARLA_OSC_CHECK_OSC_TYPES(2, "ii"); | ||||
| const uint32_t index = argv[0]->i; | |||||
| const uint32_t channel = argv[1]->i; | |||||
| const int32_t index = argv[0]->i; | |||||
| const int32_t channel = argv[1]->i; | |||||
| plugin->setParameterMidiChannel(index, channel, false, true); | plugin->setParameterMidiChannel(index, channel, false, true); | ||||
| return 0; | return 0; | ||||
| @@ -520,7 +528,7 @@ int CarlaOsc::handle_set_program(CARLA_OSC_HANDLE_ARGS2) | |||||
| qDebug("CarlaOsc::handle_set_program()"); | qDebug("CarlaOsc::handle_set_program()"); | ||||
| CARLA_OSC_CHECK_OSC_TYPES(1, "i"); | CARLA_OSC_CHECK_OSC_TYPES(1, "i"); | ||||
| const uint32_t index = argv[0]->i; | |||||
| const int32_t index = argv[0]->i; | |||||
| plugin->setProgram(index, true, false, true, true); | plugin->setProgram(index, true, false, true, true); | ||||
| return 0; | return 0; | ||||
| @@ -531,7 +539,7 @@ int CarlaOsc::handle_set_midi_program(CARLA_OSC_HANDLE_ARGS2) | |||||
| qDebug("CarlaOsc::handle_set_midi_program()"); | qDebug("CarlaOsc::handle_set_midi_program()"); | ||||
| CARLA_OSC_CHECK_OSC_TYPES(1, "i"); | CARLA_OSC_CHECK_OSC_TYPES(1, "i"); | ||||
| const uint32_t index = argv[0]->i; | |||||
| const int32_t index = argv[0]->i; | |||||
| plugin->setMidiProgram(index, true, false, true, true); | plugin->setMidiProgram(index, true, false, true, true); | ||||
| return 0; | return 0; | ||||
| @@ -542,9 +550,9 @@ int CarlaOsc::handle_note_on(CARLA_OSC_HANDLE_ARGS2) | |||||
| qDebug("CarlaOsc::handle_note_on()"); | qDebug("CarlaOsc::handle_note_on()"); | ||||
| CARLA_OSC_CHECK_OSC_TYPES(3, "iii"); | CARLA_OSC_CHECK_OSC_TYPES(3, "iii"); | ||||
| const int channel = argv[0]->i; | |||||
| const int note = argv[1]->i; | |||||
| const int velo = argv[2]->i; | |||||
| const int32_t channel = argv[0]->i; | |||||
| const int32_t note = argv[1]->i; | |||||
| const int32_t velo = argv[2]->i; | |||||
| plugin->sendMidiSingleNote(channel, note, velo, true, false, true); | plugin->sendMidiSingleNote(channel, note, velo, true, false, true); | ||||
| return 0; | return 0; | ||||
| @@ -555,30 +563,30 @@ int CarlaOsc::handle_note_off(CARLA_OSC_HANDLE_ARGS2) | |||||
| qDebug("CarlaOsc::handle_note_off()"); | qDebug("CarlaOsc::handle_note_off()"); | ||||
| CARLA_OSC_CHECK_OSC_TYPES(2, "ii"); | CARLA_OSC_CHECK_OSC_TYPES(2, "ii"); | ||||
| const int channel = argv[0]->i; | |||||
| const int note = argv[1]->i; | |||||
| const int32_t channel = argv[0]->i; | |||||
| const int32_t note = argv[1]->i; | |||||
| plugin->sendMidiSingleNote(channel, note, 0, true, false, true); | plugin->sendMidiSingleNote(channel, note, 0, true, false, true); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| int CarlaOsc::handle_bridge_ains_peak(CARLA_OSC_HANDLE_ARGS2) | |||||
| int CarlaOsc::handle_bridge_set_input_peak_value(CARLA_OSC_HANDLE_ARGS2) | |||||
| { | { | ||||
| CARLA_OSC_CHECK_OSC_TYPES(2, "id"); | CARLA_OSC_CHECK_OSC_TYPES(2, "id"); | ||||
| const int index = argv[0]->i; | |||||
| const double value = argv[1]->d; | |||||
| const int32_t index = argv[0]->i; | |||||
| const double value = argv[1]->d; | |||||
| engine->setInputPeak(plugin->id(), index-1, value); | engine->setInputPeak(plugin->id(), index-1, value); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| int CarlaOsc::handle_bridge_aouts_peak(CARLA_OSC_HANDLE_ARGS2) | |||||
| int CarlaOsc::handle_bridge_set_output_peak_value(CARLA_OSC_HANDLE_ARGS2) | |||||
| { | { | ||||
| CARLA_OSC_CHECK_OSC_TYPES(2, "id"); | CARLA_OSC_CHECK_OSC_TYPES(2, "id"); | ||||
| const int index = argv[0]->i; | |||||
| const double value = argv[1]->d; | |||||
| const int32_t index = argv[0]->i; | |||||
| const double value = argv[1]->d; | |||||
| engine->setOutputPeak(plugin->id(), index-1, value); | engine->setOutputPeak(plugin->id(), index-1, value); | ||||
| return 0; | return 0; | ||||
| @@ -121,8 +121,8 @@ private: | |||||
| int handle_lv2_atom_transfer(CARLA_OSC_HANDLE_ARGS2); | int handle_lv2_atom_transfer(CARLA_OSC_HANDLE_ARGS2); | ||||
| int handle_lv2_event_transfer(CARLA_OSC_HANDLE_ARGS2); | int handle_lv2_event_transfer(CARLA_OSC_HANDLE_ARGS2); | ||||
| int handle_bridge_ains_peak(CARLA_OSC_HANDLE_ARGS2); | |||||
| int handle_bridge_aouts_peak(CARLA_OSC_HANDLE_ARGS2); | |||||
| int handle_bridge_set_input_peak_value(CARLA_OSC_HANDLE_ARGS2); | |||||
| int handle_bridge_set_output_peak_value(CARLA_OSC_HANDLE_ARGS2); | |||||
| }; | }; | ||||
| CARLA_BACKEND_END_NAMESPACE | CARLA_BACKEND_END_NAMESPACE | ||||
| @@ -73,12 +73,16 @@ enum PluginBridgeInfoType { | |||||
| PluginBridgeMidiProgramCount, | PluginBridgeMidiProgramCount, | ||||
| PluginBridgePluginInfo, | PluginBridgePluginInfo, | ||||
| PluginBridgeParameterInfo, | PluginBridgeParameterInfo, | ||||
| PluginBridgeParameterDataInfo, | |||||
| PluginBridgeParameterRangesInfo, | |||||
| PluginBridgeParameterData, | |||||
| PluginBridgeParameterRanges, | |||||
| PluginBridgeProgramInfo, | PluginBridgeProgramInfo, | ||||
| PluginBridgeMidiProgramInfo, | PluginBridgeMidiProgramInfo, | ||||
| PluginBridgeCustomData, | |||||
| PluginBridgeChunkData, | |||||
| PluginBridgeSetParameterValue, | |||||
| PluginBridgeSetDefaultValue, | |||||
| PluginBridgeSetProgram, | |||||
| PluginBridgeSetMidiProgram, | |||||
| PluginBridgeSetCustomData, | |||||
| PluginBridgeSetChunkData, | |||||
| PluginBridgeUpdateNow, | PluginBridgeUpdateNow, | ||||
| PluginBridgeSaved | PluginBridgeSaved | ||||
| }; | }; | ||||
| @@ -198,7 +202,7 @@ public: | |||||
| * This is the constructor of the base plugin class. | * This is the constructor of the base plugin class. | ||||
| * | * | ||||
| * \param engine The engine which this plugin belongs to, must not be null | * \param engine The engine which this plugin belongs to, must not be null | ||||
| * \param id The 'id' of this plugin, must between 0 and MAX_PLUGINS | |||||
| * \param id The 'id' of this plugin, must between 0 and CarlaEngine::maxPluginNumber() | |||||
| */ | */ | ||||
| CarlaPlugin(CarlaEngine* const engine, const unsigned short id) | CarlaPlugin(CarlaEngine* const engine, const unsigned short id) | ||||
| : m_id(id), | : m_id(id), | ||||
| @@ -210,7 +214,7 @@ public: | |||||
| x_balanceRight(1.0) | x_balanceRight(1.0) | ||||
| { | { | ||||
| Q_ASSERT(engine); | Q_ASSERT(engine); | ||||
| Q_ASSERT(id < MAX_PLUGINS); | |||||
| Q_ASSERT(id < CarlaEngine::maxPluginNumber()); | |||||
| qDebug("CarlaPlugin::CarlaPlugin(%p, %i)", engine, id); | qDebug("CarlaPlugin::CarlaPlugin(%p, %i)", engine, id); | ||||
| m_type = PLUGIN_NONE; | m_type = PLUGIN_NONE; | ||||
| @@ -690,7 +694,7 @@ public: | |||||
| { | { | ||||
| Q_ASSERT(index < prog.count); | Q_ASSERT(index < prog.count); | ||||
| if (index < prog.count) | |||||
| if (index < prog.count && prog.names[index]) | |||||
| strncpy(strBuf, prog.names[index], STR_MAX); | strncpy(strBuf, prog.names[index], STR_MAX); | ||||
| else | else | ||||
| *strBuf = 0; | *strBuf = 0; | ||||
| @@ -705,7 +709,7 @@ public: | |||||
| { | { | ||||
| Q_ASSERT(index < midiprog.count); | Q_ASSERT(index < midiprog.count); | ||||
| if (index < midiprog.count) | |||||
| if (index < midiprog.count && midiprog.data[index].name) | |||||
| strncpy(strBuf, midiprog.data[index].name, STR_MAX); | strncpy(strBuf, midiprog.data[index].name, STR_MAX); | ||||
| else | else | ||||
| *strBuf = 0; | *strBuf = 0; | ||||
| @@ -787,18 +791,17 @@ public: | |||||
| #ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
| if (sendOsc) | if (sendOsc) | ||||
| { | |||||
| x_engine->osc_send_control_set_parameter_value(m_id, PARAMETER_ACTIVE, value); | x_engine->osc_send_control_set_parameter_value(m_id, PARAMETER_ACTIVE, value); | ||||
| if (m_hints & PLUGIN_IS_BRIDGE) | |||||
| osc_send_control(&osc.data, PARAMETER_ACTIVE, value); | |||||
| } | |||||
| #else | #else | ||||
| Q_UNUSED(sendOsc); | Q_UNUSED(sendOsc); | ||||
| #endif | #endif | ||||
| if (sendCallback) | if (sendCallback) | ||||
| x_engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, m_id, PARAMETER_ACTIVE, 0, value); | x_engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, m_id, PARAMETER_ACTIVE, 0, value); | ||||
| #ifndef BUILD_BRIDGE | |||||
| else if (m_hints & PLUGIN_IS_BRIDGE) | |||||
| osc_send_control(&osc.data, PARAMETER_ACTIVE, value); | |||||
| #endif | |||||
| } | } | ||||
| /*! | /*! | ||||
| @@ -821,18 +824,17 @@ public: | |||||
| #ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
| if (sendOsc) | if (sendOsc) | ||||
| { | |||||
| x_engine->osc_send_control_set_parameter_value(m_id, PARAMETER_DRYWET, value); | x_engine->osc_send_control_set_parameter_value(m_id, PARAMETER_DRYWET, value); | ||||
| if (m_hints & PLUGIN_IS_BRIDGE) | |||||
| osc_send_control(&osc.data, PARAMETER_DRYWET, value); | |||||
| } | |||||
| #else | #else | ||||
| Q_UNUSED(sendOsc); | Q_UNUSED(sendOsc); | ||||
| #endif | #endif | ||||
| if (sendCallback) | if (sendCallback) | ||||
| x_engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, m_id, PARAMETER_DRYWET, 0, value); | x_engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, m_id, PARAMETER_DRYWET, 0, value); | ||||
| #ifndef BUILD_BRIDGE | |||||
| else if (m_hints & PLUGIN_IS_BRIDGE) | |||||
| osc_send_control(&osc.data, PARAMETER_DRYWET, value); | |||||
| #endif | |||||
| } | } | ||||
| /*! | /*! | ||||
| @@ -855,18 +857,17 @@ public: | |||||
| #ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
| if (sendOsc) | if (sendOsc) | ||||
| { | |||||
| x_engine->osc_send_control_set_parameter_value(m_id, PARAMETER_VOLUME, value); | x_engine->osc_send_control_set_parameter_value(m_id, PARAMETER_VOLUME, value); | ||||
| if (m_hints & PLUGIN_IS_BRIDGE) | |||||
| osc_send_control(&osc.data, PARAMETER_VOLUME, value); | |||||
| } | |||||
| #else | #else | ||||
| Q_UNUSED(sendOsc); | Q_UNUSED(sendOsc); | ||||
| #endif | #endif | ||||
| if (sendCallback) | if (sendCallback) | ||||
| x_engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, m_id, PARAMETER_VOLUME, 0, value); | x_engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, m_id, PARAMETER_VOLUME, 0, value); | ||||
| #ifndef BUILD_BRIDGE | |||||
| else if (m_hints & PLUGIN_IS_BRIDGE) | |||||
| osc_send_control(&osc.data, PARAMETER_VOLUME, value); | |||||
| #endif | |||||
| } | } | ||||
| /*! | /*! | ||||
| @@ -889,18 +890,17 @@ public: | |||||
| #ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
| if (sendOsc) | if (sendOsc) | ||||
| { | |||||
| x_engine->osc_send_control_set_parameter_value(m_id, PARAMETER_BALANCE_LEFT, value); | x_engine->osc_send_control_set_parameter_value(m_id, PARAMETER_BALANCE_LEFT, value); | ||||
| if (m_hints & PLUGIN_IS_BRIDGE) | |||||
| osc_send_control(&osc.data, PARAMETER_BALANCE_LEFT, value); | |||||
| } | |||||
| #else | #else | ||||
| Q_UNUSED(sendOsc); | Q_UNUSED(sendOsc); | ||||
| #endif | #endif | ||||
| if (sendCallback) | if (sendCallback) | ||||
| x_engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, m_id, PARAMETER_BALANCE_LEFT, 0, value); | x_engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, m_id, PARAMETER_BALANCE_LEFT, 0, value); | ||||
| #ifndef BUILD_BRIDGE | |||||
| else if (m_hints & PLUGIN_IS_BRIDGE) | |||||
| osc_send_control(&osc.data, PARAMETER_BALANCE_LEFT, value); | |||||
| #endif | |||||
| } | } | ||||
| /*! | /*! | ||||
| @@ -923,29 +923,30 @@ public: | |||||
| #ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
| if (sendOsc) | if (sendOsc) | ||||
| { | |||||
| x_engine->osc_send_control_set_parameter_value(m_id, PARAMETER_BALANCE_RIGHT, value); | x_engine->osc_send_control_set_parameter_value(m_id, PARAMETER_BALANCE_RIGHT, value); | ||||
| if (m_hints & PLUGIN_IS_BRIDGE) | |||||
| osc_send_control(&osc.data, PARAMETER_BALANCE_RIGHT, value); | |||||
| } | |||||
| #else | #else | ||||
| Q_UNUSED(sendOsc); | Q_UNUSED(sendOsc); | ||||
| #endif | #endif | ||||
| if (sendCallback) | if (sendCallback) | ||||
| x_engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, m_id, PARAMETER_BALANCE_RIGHT, 0, value); | x_engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, m_id, PARAMETER_BALANCE_RIGHT, 0, value); | ||||
| #ifndef BUILD_BRIDGE | |||||
| else if (m_hints & PLUGIN_IS_BRIDGE) | |||||
| osc_send_control(&osc.data, PARAMETER_BALANCE_RIGHT, value); | |||||
| #endif | |||||
| } | } | ||||
| #ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
| /*! | /*! | ||||
| * BridgePlugin call used to set internal data. | * BridgePlugin call used to set internal data. | ||||
| */ | */ | ||||
| virtual int setOscBridgeInfo(const PluginBridgeInfoType type, const lo_arg* const* const argv) | |||||
| virtual int setOscBridgeInfo(const PluginBridgeInfoType type, const int argc, const lo_arg* const* const argv, const char* const types) | |||||
| { | { | ||||
| return 1; | return 1; | ||||
| Q_UNUSED(type); | Q_UNUSED(type); | ||||
| Q_UNUSED(argc); | |||||
| Q_UNUSED(argv); | Q_UNUSED(argv); | ||||
| Q_UNUSED(types); | |||||
| } | } | ||||
| #endif | #endif | ||||
| @@ -972,12 +973,7 @@ public: | |||||
| #ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
| if (sendOsc) | if (sendOsc) | ||||
| { | |||||
| x_engine->osc_send_control_set_parameter_value(m_id, parameterId, value); | x_engine->osc_send_control_set_parameter_value(m_id, parameterId, value); | ||||
| if (m_hints & PLUGIN_IS_BRIDGE) | |||||
| osc_send_control(&osc.data, parameterId, value); | |||||
| } | |||||
| #else | #else | ||||
| Q_UNUSED(sendOsc); | Q_UNUSED(sendOsc); | ||||
| #endif | #endif | ||||
| @@ -1174,12 +1170,7 @@ public: | |||||
| #ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
| if (sendOsc) | if (sendOsc) | ||||
| { | |||||
| x_engine->osc_send_control_set_program(m_id, index); | x_engine->osc_send_control_set_program(m_id, index); | ||||
| if (m_hints & PLUGIN_IS_BRIDGE) | |||||
| osc_send_program(&osc.data, index); | |||||
| } | |||||
| #else | #else | ||||
| Q_UNUSED(sendOsc); | Q_UNUSED(sendOsc); | ||||
| #endif | #endif | ||||
| @@ -1232,12 +1223,7 @@ public: | |||||
| #ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
| if (sendOsc) | if (sendOsc) | ||||
| { | |||||
| x_engine->osc_send_control_set_midi_program(m_id, index); | x_engine->osc_send_control_set_midi_program(m_id, index); | ||||
| if (m_hints & PLUGIN_IS_BRIDGE) | |||||
| osc_send_midi_program(&osc.data, index); | |||||
| } | |||||
| #else | #else | ||||
| Q_UNUSED(sendOsc); | Q_UNUSED(sendOsc); | ||||
| #endif | #endif | ||||
| @@ -1485,9 +1471,9 @@ public: | |||||
| getParameterUnit(i, bufUnit); | getParameterUnit(i, bufUnit); | ||||
| #ifdef BUILD_BRIDGE | #ifdef BUILD_BRIDGE | ||||
| x_engine->osc_send_bridge_param_info(i, bufName, bufUnit); | |||||
| x_engine->osc_send_bridge_param_data(i, param.data[i].type, param.data[i].rindex, param.data[i].hints, param.data[i].midiChannel, param.data[i].midiCC); | |||||
| x_engine->osc_send_bridge_param_ranges(i, param.ranges[i].def, param.ranges[i].min, param.ranges[i].max, param.ranges[i].step, param.ranges[i].stepSmall, param.ranges[i].stepLarge); | |||||
| x_engine->osc_send_bridge_parameter_info(i, bufName, bufUnit); | |||||
| x_engine->osc_send_bridge_parameter_data(i, param.data[i].type, param.data[i].rindex, param.data[i].hints, param.data[i].midiChannel, param.data[i].midiCC); | |||||
| x_engine->osc_send_bridge_parameter_ranges(i, param.ranges[i].def, param.ranges[i].min, param.ranges[i].max, param.ranges[i].step, param.ranges[i].stepSmall, param.ranges[i].stepLarge); | |||||
| x_engine->osc_send_bridge_set_parameter_value(i, getParameterValue(i)); | x_engine->osc_send_bridge_set_parameter_value(i, getParameterValue(i)); | ||||
| #else | #else | ||||
| x_engine->osc_send_control_set_parameter_data(m_id, i, param.data[i].type, param.data[i].hints, bufName, bufUnit, getParameterValue(i)); | x_engine->osc_send_control_set_parameter_data(m_id, i, param.data[i].type, param.data[i].hints, bufName, bufUnit, getParameterValue(i)); | ||||
| @@ -1655,7 +1641,7 @@ public: | |||||
| if (sendGui) | if (sendGui) | ||||
| { | { | ||||
| if (note > 0) | |||||
| if (velo > 0) | |||||
| uiNoteOn(channel, note, velo); | uiNoteOn(channel, note, velo); | ||||
| else | else | ||||
| uiNoteOff(channel, note); | uiNoteOff(channel, note); | ||||
| @@ -1664,19 +1650,10 @@ public: | |||||
| #ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
| if (sendOsc) | if (sendOsc) | ||||
| { | { | ||||
| if (velo) | |||||
| if (velo > 0) | |||||
| x_engine->osc_send_control_note_on(m_id, channel, note, velo); | x_engine->osc_send_control_note_on(m_id, channel, note, velo); | ||||
| else | else | ||||
| x_engine->osc_send_control_note_off(m_id, channel, note); | x_engine->osc_send_control_note_off(m_id, channel, note); | ||||
| if (m_hints & PLUGIN_IS_BRIDGE) | |||||
| { | |||||
| uint8_t midiData[4] = { 0 }; | |||||
| midiData[1] = (velo ? MIDI_STATUS_NOTE_ON : MIDI_STATUS_NOTE_OFF) + channel; | |||||
| midiData[2] = note; | |||||
| midiData[3] = velo; | |||||
| osc_send_midi(&osc.data, midiData); | |||||
| } | |||||
| } | } | ||||
| #else | #else | ||||
| Q_UNUSED(sendOsc); | Q_UNUSED(sendOsc); | ||||
| @@ -24,12 +24,12 @@ | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| // CarlaCheckThread | // CarlaCheckThread | ||||
| CarlaCheckThread::CarlaCheckThread(CarlaBackend::CarlaEngine* const engine_, QObject* const parent) : | |||||
| QThread(parent), | |||||
| engine(engine_) | |||||
| CarlaCheckThread::CarlaCheckThread(CarlaBackend::CarlaEngine* const engine_, QObject* const parent) | |||||
| : QThread(parent), | |||||
| engine(engine_) | |||||
| { | { | ||||
| maxPluginNumber = 0; | |||||
| qDebug("CarlaCheckThread::CarlaCheckThread(%p)", parent); | |||||
| qDebug("CarlaCheckThread::CarlaCheckThread(%p, %p)", engine, parent); | |||||
| Q_ASSERT(engine); | |||||
| } | } | ||||
| CarlaCheckThread::~CarlaCheckThread() | CarlaCheckThread::~CarlaCheckThread() | ||||
| @@ -37,9 +37,8 @@ CarlaCheckThread::~CarlaCheckThread() | |||||
| qDebug("CarlaCheckThread::~CarlaCheckThread()"); | qDebug("CarlaCheckThread::~CarlaCheckThread()"); | ||||
| } | } | ||||
| void CarlaCheckThread::startNow(const unsigned short maxPluginNumber_) | |||||
| void CarlaCheckThread::startNow() | |||||
| { | { | ||||
| maxPluginNumber = maxPluginNumber_; | |||||
| start(QThread::HighPriority); | start(QThread::HighPriority); | ||||
| } | } | ||||
| @@ -63,7 +62,10 @@ void CarlaCheckThread::run() | |||||
| { | { | ||||
| qDebug("CarlaCheckThread::run()"); | qDebug("CarlaCheckThread::run()"); | ||||
| using namespace CarlaBackend; | |||||
| bool oscControllerRegisted, usesSingleThread; | bool oscControllerRegisted, usesSingleThread; | ||||
| unsigned short id, maxPluginNumber = CarlaEngine::maxPluginNumber(); | |||||
| double value; | double value; | ||||
| m_stopNow = false; | m_stopNow = false; | ||||
| @@ -80,14 +82,12 @@ void CarlaCheckThread::run() | |||||
| for (unsigned short i=0; i < maxPluginNumber; i++) | for (unsigned short i=0; i < maxPluginNumber; i++) | ||||
| { | { | ||||
| CarlaBackend::CarlaPlugin* const plugin = engine->getPluginUnchecked(i); | |||||
| CarlaPlugin* const plugin = engine->getPluginUnchecked(i); | |||||
| if (plugin && plugin->enabled()) | if (plugin && plugin->enabled()) | ||||
| { | { | ||||
| #ifndef BUILD_BRIDGE | |||||
| unsigned short id = plugin->id(); | |||||
| #endif | |||||
| usesSingleThread = (plugin->hints() & CarlaBackend::PLUGIN_USES_SINGLE_THREAD); | |||||
| id = plugin->id(); | |||||
| usesSingleThread = (plugin->hints() & PLUGIN_USES_SINGLE_THREAD); | |||||
| // ------------------------------------------------------- | // ------------------------------------------------------- | ||||
| // Process postponed events | // Process postponed events | ||||
| @@ -121,7 +121,6 @@ void CarlaCheckThread::run() | |||||
| } | } | ||||
| } | } | ||||
| #ifndef BUILD_BRIDGE | |||||
| // ------------------------------------------------------- | // ------------------------------------------------------- | ||||
| // Update OSC control client | // Update OSC control client | ||||
| @@ -130,16 +129,25 @@ void CarlaCheckThread::run() | |||||
| // Peak values | // Peak values | ||||
| if (plugin->audioInCount() > 0) | if (plugin->audioInCount() > 0) | ||||
| { | { | ||||
| #ifdef BUILD_BRIDGE | |||||
| engine->osc_send_bridge_set_input_peak_value(1, engine->getInputPeak(id, 0)); | |||||
| engine->osc_send_bridge_set_input_peak_value(2, engine->getInputPeak(id, 1)); | |||||
| #else | |||||
| engine->osc_send_control_set_input_peak_value(id, 1, engine->getInputPeak(id, 0)); | engine->osc_send_control_set_input_peak_value(id, 1, engine->getInputPeak(id, 0)); | ||||
| engine->osc_send_control_set_input_peak_value(id, 2, engine->getInputPeak(id, 1)); | engine->osc_send_control_set_input_peak_value(id, 2, engine->getInputPeak(id, 1)); | ||||
| #endif | |||||
| } | } | ||||
| if (plugin->audioOutCount() > 0) | if (plugin->audioOutCount() > 0) | ||||
| { | { | ||||
| #ifdef BUILD_BRIDGE | |||||
| engine->osc_send_bridge_set_output_peak_value(1, engine->getOutputPeak(id, 0)); | |||||
| engine->osc_send_bridge_set_output_peak_value(2, engine->getOutputPeak(id, 1)); | |||||
| #else | |||||
| engine->osc_send_control_set_output_peak_value(id, 1, engine->getOutputPeak(id, 0)); | engine->osc_send_control_set_output_peak_value(id, 1, engine->getOutputPeak(id, 0)); | ||||
| engine->osc_send_control_set_output_peak_value(id, 2, engine->getOutputPeak(id, 1)); | engine->osc_send_control_set_output_peak_value(id, 2, engine->getOutputPeak(id, 1)); | ||||
| #endif | |||||
| } | } | ||||
| } | } | ||||
| #endif | |||||
| } | } | ||||
| } | } | ||||
| @@ -32,7 +32,7 @@ public: | |||||
| CarlaCheckThread(CarlaBackend::CarlaEngine* const engine, QObject* const parent = nullptr); | CarlaCheckThread(CarlaBackend::CarlaEngine* const engine, QObject* const parent = nullptr); | ||||
| ~CarlaCheckThread(); | ~CarlaCheckThread(); | ||||
| void startNow(const unsigned short maxPluginNumber); | |||||
| void startNow(); | |||||
| void stopNow(); | void stopNow(); | ||||
| protected: | protected: | ||||
| @@ -42,7 +42,6 @@ private: | |||||
| CarlaBackend::CarlaEngine* const engine; | CarlaBackend::CarlaEngine* const engine; | ||||
| QMutex mutex; | QMutex mutex; | ||||
| bool m_stopNow; | bool m_stopNow; | ||||
| unsigned short maxPluginNumber; | |||||
| // ---------------------------------------------- | // ---------------------------------------------- | ||||
| @@ -742,10 +742,13 @@ public: | |||||
| #ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
| // Update OSC Names | // Update OSC Names | ||||
| x_engine->osc_send_control_set_midi_program_count(m_id, midiprog.count); | |||||
| if (x_engine->isOscControllerRegisted()) | |||||
| { | |||||
| x_engine->osc_send_control_set_midi_program_count(m_id, midiprog.count); | |||||
| for (i=0; i < midiprog.count; i++) | |||||
| x_engine->osc_send_control_set_midi_program_data(m_id, i, midiprog.data[i].bank, midiprog.data[i].program, midiprog.data[i].name); | |||||
| for (i=0; i < midiprog.count; i++) | |||||
| x_engine->osc_send_control_set_midi_program_data(m_id, i, midiprog.data[i].bank, midiprog.data[i].program, midiprog.data[i].name); | |||||
| } | |||||
| #endif | #endif | ||||
| if (init) | if (init) | ||||
| @@ -1014,7 +1017,6 @@ public: | |||||
| // ---------------------------------------------------------------------------------------------------- | // ---------------------------------------------------------------------------------------------------- | ||||
| // MIDI Input (External) | // MIDI Input (External) | ||||
| if (m_ctrlInChannel >= 0 && m_ctrlInChannel < 16) | |||||
| { | { | ||||
| engineMidiLock(); | engineMidiLock(); | ||||
| @@ -1515,7 +1517,7 @@ CarlaPlugin* CarlaPlugin::newDSSI(const initializer& init, const void* const ext | |||||
| short id = init.engine->getNewPluginId(); | short id = init.engine->getNewPluginId(); | ||||
| if (id < 0 || id > MAX_PLUGINS) | |||||
| if (id < 0 || id > CarlaEngine::maxPluginNumber()) | |||||
| { | { | ||||
| setLastError("Maximum number of plugins reached"); | setLastError("Maximum number of plugins reached"); | ||||
| return nullptr; | return nullptr; | ||||
| @@ -768,13 +768,17 @@ public: | |||||
| #ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
| // Update OSC Names | // Update OSC Names | ||||
| //osc_global_send_set_midi_program_count(m_id, midiprog.count); | |||||
| if (x_engine->isOscControllerRegisted()) | |||||
| { | |||||
| x_engine->osc_send_control_set_midi_program_count(m_id, midiprog.count); | |||||
| //for (i=0; i < midiprog.count; i++) | |||||
| // osc_global_send_set_midi_program_data(m_id, i, midiprog.data[i].bank, midiprog.data[i].program, midiprog.data[i].name); | |||||
| for (i=0; i < midiprog.count; i++) | |||||
| x_engine->osc_send_control_set_midi_program_data(m_id, i, midiprog.data[i].bank, midiprog.data[i].program, midiprog.data[i].name); | |||||
| } | |||||
| #endif | |||||
| // FIXME | |||||
| x_engine->callback(CALLBACK_RELOAD_PROGRAMS, m_id, 0, 0, 0.0); | x_engine->callback(CALLBACK_RELOAD_PROGRAMS, m_id, 0, 0, 0.0); | ||||
| #endif | |||||
| if (init) | if (init) | ||||
| { | { | ||||
| @@ -1285,7 +1289,7 @@ CarlaPlugin* CarlaPlugin::newSF2(const initializer& init) | |||||
| #ifdef WANT_FLUIDSYNTH | #ifdef WANT_FLUIDSYNTH | ||||
| short id = init.engine->getNewPluginId(); | short id = init.engine->getNewPluginId(); | ||||
| if (id < 0 || id > MAX_PLUGINS) | |||||
| if (id < 0 || id > CarlaEngine::maxPluginNumber()) | |||||
| { | { | ||||
| setLastError("Maximum number of plugins reached"); | setLastError("Maximum number of plugins reached"); | ||||
| return nullptr; | return nullptr; | ||||
| @@ -1125,7 +1125,7 @@ CarlaPlugin* CarlaPlugin::newLADSPA(const initializer& init, const void* const e | |||||
| short id = init.engine->getNewPluginId(); | short id = init.engine->getNewPluginId(); | ||||
| if (id < 0 || id > MAX_PLUGINS) | |||||
| if (id < 0 || id > CarlaEngine::maxPluginNumber()) | |||||
| { | { | ||||
| setLastError("Maximum number of plugins reached"); | setLastError("Maximum number of plugins reached"); | ||||
| return nullptr; | return nullptr; | ||||
| @@ -254,14 +254,17 @@ public: | |||||
| #ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
| // Update OSC Names | // Update OSC Names | ||||
| //osc_global_send_set_midi_program_count(m_id, midiprog.count); | |||||
| //for (i=0; i < midiprog.count; i++) | |||||
| // osc_global_send_set_midi_program_data(m_id, i, midiprog.data[i].bank, midiprog.data[i].program, midiprog.data[i].name); | |||||
| if (x_engine->isOscControllerRegisted()) | |||||
| { | |||||
| x_engine->osc_send_control_set_midi_program_count(m_id, midiprog.count); | |||||
| x_engine->callback(CALLBACK_RELOAD_PROGRAMS, m_id, 0, 0, 0.0); | |||||
| for (i=0; i < midiprog.count; i++) | |||||
| x_engine->osc_send_control_set_midi_program_data(m_id, i, midiprog.data[i].bank, midiprog.data[i].program, midiprog.data[i].name); | |||||
| } | |||||
| #endif | #endif | ||||
| // TODO | |||||
| if (init) | if (init) | ||||
| { | { | ||||
| if (midiprog.count > 0) | if (midiprog.count > 0) | ||||
| @@ -578,7 +581,7 @@ CarlaPlugin* LinuxSamplerPlugin::newLinuxSampler(const initializer& init, bool i | |||||
| short id = init.engine->getNewPluginId(); | short id = init.engine->getNewPluginId(); | ||||
| if (id < 0 || id > MAX_PLUGINS) | |||||
| if (id < 0 || id > CarlaEngine::maxPluginNumber()) | |||||
| { | { | ||||
| setLastError("Maximum number of plugins reached"); | setLastError("Maximum number of plugins reached"); | ||||
| return nullptr; | return nullptr; | ||||
| @@ -1706,10 +1706,13 @@ public: | |||||
| #ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
| // Update OSC Names | // Update OSC Names | ||||
| x_engine->osc_send_control_set_midi_program_count(m_id, midiprog.count); | |||||
| if (x_engine->isOscControllerRegisted()) | |||||
| { | |||||
| x_engine->osc_send_control_set_midi_program_count(m_id, midiprog.count); | |||||
| for (i=0; i < midiprog.count; i++) | |||||
| x_engine->osc_send_control_set_midi_program_data(m_id, i, midiprog.data[i].bank, midiprog.data[i].program, midiprog.data[i].name); | |||||
| for (i=0; i < midiprog.count; i++) | |||||
| x_engine->osc_send_control_set_midi_program_data(m_id, i, midiprog.data[i].bank, midiprog.data[i].program, midiprog.data[i].name); | |||||
| } | |||||
| #endif | #endif | ||||
| if (init) | if (init) | ||||
| @@ -2036,7 +2039,6 @@ public: | |||||
| // ---------------------------------------------------------------------------------------------------- | // ---------------------------------------------------------------------------------------------------- | ||||
| // MIDI Input (External) | // MIDI Input (External) | ||||
| if (evIn.count > 0 && m_ctrlInChannel >= 0 && m_ctrlInChannel < 16) | |||||
| { | { | ||||
| engineMidiLock(); | engineMidiLock(); | ||||
| @@ -4257,7 +4259,7 @@ CarlaPlugin* CarlaPlugin::newLV2(const initializer& init) | |||||
| short id = init.engine->getNewPluginId(); | short id = init.engine->getNewPluginId(); | ||||
| if (id < 0 || id > MAX_PLUGINS) | |||||
| if (id < 0 || id > CarlaEngine::maxPluginNumber()) | |||||
| { | { | ||||
| setLastError("Maximum number of plugins reached"); | setLastError("Maximum number of plugins reached"); | ||||
| return nullptr; | return nullptr; | ||||
| @@ -28,8 +28,8 @@ SOURCES = \ | |||||
| ../lv2.cpp \ | ../lv2.cpp \ | ||||
| ../vst.cpp \ | ../vst.cpp \ | ||||
| ../fluidsynth.cpp \ | ../fluidsynth.cpp \ | ||||
| ../linuxsampler.cpp | |||||
| # ../../carla-jackbridge/carla_jackbridge.cpp | |||||
| ../linuxsampler.cpp \ | |||||
| ../../carla-jackbridge/carla_jackbridge.cpp | |||||
| HEADERS = \ | HEADERS = \ | ||||
| ../carla_backend.h \ | ../carla_backend.h \ | ||||
| @@ -65,7 +65,7 @@ DEFINES += CARLA_ENGINE_LV2 | |||||
| DEFINES += HAVE_SUIL | DEFINES += HAVE_SUIL | ||||
| DEFINES += WANT_FLUIDSYNTH WANT_LINUXSAMPLER | DEFINES += WANT_FLUIDSYNTH WANT_LINUXSAMPLER | ||||
| LIBS = ../../carla-lilv/carla_lilv.a -ldl | LIBS = ../../carla-lilv/carla_lilv.a -ldl | ||||
| LIBS += -L../../carla-jackbridge -lcarla-jackbridge-native | |||||
| #LIBS += -L../../carla-jackbridge -lcarla-jackbridge-native | |||||
| INCLUDEPATH += ../rtaudio-4.0.11 | INCLUDEPATH += ../rtaudio-4.0.11 | ||||
| INCLUDEPATH += ../rtmidi-2.0.0 | INCLUDEPATH += ../rtmidi-2.0.0 | ||||
| @@ -64,6 +64,7 @@ public: | |||||
| gui.height = 0; | gui.height = 0; | ||||
| isProcessing = false; | isProcessing = false; | ||||
| needIdle = false; | |||||
| memset(midiEvents, 0, sizeof(VstMidiEvent)*MAX_MIDI_EVENTS*2); | memset(midiEvents, 0, sizeof(VstMidiEvent)*MAX_MIDI_EVENTS*2); | ||||
| @@ -422,11 +423,12 @@ public: | |||||
| void idleGui() | void idleGui() | ||||
| { | { | ||||
| //effect->dispatcher(effect, effIdle, 0, 0, nullptr, 0.0f); | |||||
| if (gui.type != GUI_EXTERNAL_OSC && gui.visible) | |||||
| if (gui.type != GUI_EXTERNAL_OSC) | |||||
| effect->dispatcher(effect, effEditIdle, 0, 0, nullptr, 0.0f); | effect->dispatcher(effect, effEditIdle, 0, 0, nullptr, 0.0f); | ||||
| if (needIdle) | |||||
| effect->dispatcher(effect, effIdle, 0, 0, nullptr, 0.0f); | |||||
| CarlaPlugin::idleGui(); | CarlaPlugin::idleGui(); | ||||
| } | } | ||||
| @@ -743,10 +745,13 @@ public: | |||||
| #ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
| // Update OSC Names | // Update OSC Names | ||||
| x_engine->osc_send_control_set_program_count(m_id, prog.count); | |||||
| if (x_engine->isOscControllerRegisted()) | |||||
| { | |||||
| x_engine->osc_send_control_set_program_count(m_id, prog.count); | |||||
| for (i=0; i < prog.count; i++) | |||||
| x_engine->osc_send_control_set_program_name(m_id, i, prog.names[i]); | |||||
| for (i=0; i < prog.count; i++) | |||||
| x_engine->osc_send_control_set_program_name(m_id, i, prog.names[i]); | |||||
| } | |||||
| #endif | #endif | ||||
| if (init) | if (init) | ||||
| @@ -1011,7 +1016,6 @@ public: | |||||
| // ---------------------------------------------------------------------------------------------------- | // ---------------------------------------------------------------------------------------------------- | ||||
| // MIDI Input (External) | // MIDI Input (External) | ||||
| if (m_ctrlInChannel >= 0 && m_ctrlInChannel < 16) | |||||
| { | { | ||||
| engineMidiLock(); | engineMidiLock(); | ||||
| @@ -1165,7 +1169,7 @@ public: | |||||
| // FIXME - make this a global option | // FIXME - make this a global option | ||||
| // don't process if not needed | // don't process if not needed | ||||
| //if ((effect->flags & effFlagsNoSoundInStop) > 0 && aInsPeak[0] == 0.0 && aInsPeak[1] == 0.0 && midiEventCount == 0 && ! midi.port_mout) | |||||
| //if ((effect->flags & effFlagsNoSoundInStop) > 0 && aInsPeak[0] == 0.0 && aInsPeak[1] == 0.0 && midiEventCount == 0 && ! midi.portMout) | |||||
| //{ | //{ | ||||
| if (m_hints & PLUGIN_CAN_PROCESS_REPLACING) | if (m_hints & PLUGIN_CAN_PROCESS_REPLACING) | ||||
| { | { | ||||
| @@ -1438,7 +1442,7 @@ public: | |||||
| if (timeInfo->playing) | if (timeInfo->playing) | ||||
| vstTimeInfo.flags |= kVstTransportPlaying; | vstTimeInfo.flags |= kVstTransportPlaying; | ||||
| vstTimeInfo.samplePos = timeInfo->frame; | |||||
| //vstTimeInfo.samplePos = timeInfo->frame; // FIXME - currentSamplePosition ? | |||||
| vstTimeInfo.sampleRate = x_engine->getSampleRate(); | vstTimeInfo.sampleRate = x_engine->getSampleRate(); | ||||
| vstTimeInfo.nanoSeconds = timeInfo->time; | vstTimeInfo.nanoSeconds = timeInfo->time; | ||||
| @@ -1533,6 +1537,11 @@ public: | |||||
| return 1; | return 1; | ||||
| } | } | ||||
| void handleAudioMasterNeedIdle() | |||||
| { | |||||
| needIdle = true; | |||||
| } | |||||
| intptr_t handleAudioMasterProcessEvents(const VstEvents* const vstEvents) | intptr_t handleAudioMasterProcessEvents(const VstEvents* const vstEvents) | ||||
| { | { | ||||
| Q_ASSERT(m_enabled); | Q_ASSERT(m_enabled); | ||||
| @@ -1726,6 +1735,8 @@ public: | |||||
| case audioMasterAutomate: | case audioMasterAutomate: | ||||
| if (self) | if (self) | ||||
| self->handleAudioMasterAutomate(index, opt); | self->handleAudioMasterAutomate(index, opt); | ||||
| else | |||||
| qWarning("VstPlugin::hostCallback::audioMasterAutomate called without valid object"); | |||||
| break; | break; | ||||
| case audioMasterVersion: | case audioMasterVersion: | ||||
| @@ -1737,8 +1748,10 @@ public: | |||||
| break; | break; | ||||
| case audioMasterIdle: | case audioMasterIdle: | ||||
| //if (effect) | |||||
| // effect->dispatcher(effect, effEditIdle, 0, 0, nullptr, 0.0f); | |||||
| if (effect) | |||||
| effect->dispatcher(effect, effEditIdle, 0, 0, nullptr, 0.0f); | |||||
| else | |||||
| qWarning("VstPlugin::hostCallback::audioMasterIdle called without valid object"); | |||||
| break; | break; | ||||
| #if ! VST_FORCE_DEPRECATED | #if ! VST_FORCE_DEPRECATED | ||||
| @@ -1751,6 +1764,8 @@ public: | |||||
| // Deprecated in VST SDK 2.4 | // Deprecated in VST SDK 2.4 | ||||
| if (self) | if (self) | ||||
| self->handleAudioMasterWantMidi(); | self->handleAudioMasterWantMidi(); | ||||
| else | |||||
| qWarning("VstPlugin::hostCallback::audioMasterWantMidi called without valid object"); | |||||
| break; | break; | ||||
| #endif | #endif | ||||
| @@ -1761,6 +1776,8 @@ public: | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| qWarning("VstPlugin::hostCallback::audioMasterGetTime called without valid object"); | |||||
| static VstTimeInfo_R timeInfo; | static VstTimeInfo_R timeInfo; | ||||
| memset(&timeInfo, 0, sizeof(VstTimeInfo_R)); | memset(&timeInfo, 0, sizeof(VstTimeInfo_R)); | ||||
| timeInfo.sampleRate = 44100.0; | timeInfo.sampleRate = 44100.0; | ||||
| @@ -1779,8 +1796,15 @@ public: | |||||
| break; | break; | ||||
| case audioMasterProcessEvents: | case audioMasterProcessEvents: | ||||
| if (self && ptr) | |||||
| ret = self->handleAudioMasterProcessEvents((const VstEvents*)ptr); | |||||
| if (self) | |||||
| { | |||||
| if (ptr) | |||||
| ret = self->handleAudioMasterProcessEvents((const VstEvents*)ptr); | |||||
| else | |||||
| qWarning("VstPlugin::hostCallback::audioMasterProcessEvents called with invalid pointer"); | |||||
| } | |||||
| else | |||||
| qWarning("VstPlugin::hostCallback::audioMasterProcessEvents called without valid object"); | |||||
| break; | break; | ||||
| #if ! VST_FORCE_DEPRECATED | #if ! VST_FORCE_DEPRECATED | ||||
| @@ -1792,6 +1816,8 @@ public: | |||||
| // Deprecated in VST SDK 2.4 | // Deprecated in VST SDK 2.4 | ||||
| if (self) | if (self) | ||||
| ret = self->handleAudioMasterTempoAt(); | ret = self->handleAudioMasterTempoAt(); | ||||
| else | |||||
| qWarning("stPlugin::hostCallback::audioMasterTempoAt called without valid object"); | |||||
| if (ret == 0) | if (ret == 0) | ||||
| ret = 120 * 10000; | ret = 120 * 10000; | ||||
| break; | break; | ||||
| @@ -1814,30 +1840,48 @@ public: | |||||
| case audioMasterIOChanged: | case audioMasterIOChanged: | ||||
| if (self) | if (self) | ||||
| ret = self->handleAudioMasterIOChanged(); | ret = self->handleAudioMasterIOChanged(); | ||||
| else | |||||
| qWarning("VstPlugin::hostCallback::audioMasterIOChanged called without valid object"); | |||||
| break; | break; | ||||
| case audioMasterNeedIdle: | case audioMasterNeedIdle: | ||||
| // Deprecated in VST SDK 2.4 | // Deprecated in VST SDK 2.4 | ||||
| // TODO | |||||
| if (self) | |||||
| self->handleAudioMasterNeedIdle(); | |||||
| else | |||||
| qWarning("VstPlugin::hostCallback::audioMasterNeedIdle called without valid object"); | |||||
| break; | break; | ||||
| case audioMasterSizeWindow: | case audioMasterSizeWindow: | ||||
| if (self && index > 0 && value > 0) | |||||
| ret = self->handleAdioMasterSizeWindow(index, value); | |||||
| if (self) | |||||
| { | |||||
| if (index > 0 && value > 0) | |||||
| ret = self->handleAdioMasterSizeWindow(index, value); | |||||
| else | |||||
| qWarning("VstPlugin::hostCallback::audioMasterSizeWindow called with invalid size"); | |||||
| } | |||||
| else | |||||
| qWarning("VstPlugin::hostCallback::audioMasterSizeWindow called without valid object"); | |||||
| break; | break; | ||||
| case audioMasterGetSampleRate: | case audioMasterGetSampleRate: | ||||
| if (self) | if (self) | ||||
| ret = self->handleAudioMasterGetSampleRate(); | ret = self->handleAudioMasterGetSampleRate(); | ||||
| else | else | ||||
| { | |||||
| qWarning("stPlugin::hostCallback::audioMasterGetSampleRate called without valid object"); | |||||
| ret = 44100; | ret = 44100; | ||||
| } | |||||
| break; | break; | ||||
| case audioMasterGetBlockSize: | case audioMasterGetBlockSize: | ||||
| if (self) | if (self) | ||||
| ret = self->handleAudioMasterGetBlockSize(); | ret = self->handleAudioMasterGetBlockSize(); | ||||
| else | else | ||||
| { | |||||
| qWarning("stPlugin::hostCallback::audioMasterGetBlockSize called without valid object"); | |||||
| ret = 512; | ret = 512; | ||||
| } | |||||
| break; | break; | ||||
| case audioMasterGetInputLatency: | case audioMasterGetInputLatency: | ||||
| @@ -1868,7 +1912,10 @@ public: | |||||
| if (self) | if (self) | ||||
| ret = self->handleAudioMasterGetCurrentProcessLevel(); | ret = self->handleAudioMasterGetCurrentProcessLevel(); | ||||
| else | else | ||||
| { | |||||
| qWarning("VstPlugin::hostCallback::audioMasterGetCurrentProcessLevel called without valid object"); | |||||
| ret = kVstProcessLevelUnknown; | ret = kVstProcessLevelUnknown; | ||||
| } | |||||
| break; | break; | ||||
| case audioMasterGetAutomationState: | case audioMasterGetAutomationState: | ||||
| @@ -1901,11 +1948,15 @@ public: | |||||
| case audioMasterGetVendorString: | case audioMasterGetVendorString: | ||||
| if (ptr) | if (ptr) | ||||
| strcpy((char*)ptr, "Cadence"); | strcpy((char*)ptr, "Cadence"); | ||||
| else | |||||
| qWarning("VstPlugin::hostCallback::audioMasterGetVendorString called with invalid pointer"); | |||||
| break; | break; | ||||
| case audioMasterGetProductString: | case audioMasterGetProductString: | ||||
| if (ptr) | if (ptr) | ||||
| strcpy((char*)ptr, "Carla"); | strcpy((char*)ptr, "Carla"); | ||||
| else | |||||
| qWarning("VstPlugin::hostCallback::audioMasterGetProductString called with invalid pointer"); | |||||
| break; | break; | ||||
| case audioMasterGetVendorVersion: | case audioMasterGetVendorVersion: | ||||
| @@ -1925,6 +1976,8 @@ public: | |||||
| case audioMasterCanDo: | case audioMasterCanDo: | ||||
| if (ptr) | if (ptr) | ||||
| ret = hostCanDo((const char*)ptr); | ret = hostCanDo((const char*)ptr); | ||||
| else | |||||
| qWarning("VstPlugin::hostCallback::audioMasterCanDo called with invalid pointer"); | |||||
| break; | break; | ||||
| case audioMasterGetLanguage: | case audioMasterGetLanguage: | ||||
| @@ -1946,6 +1999,10 @@ public: | |||||
| case audioMasterUpdateDisplay: | case audioMasterUpdateDisplay: | ||||
| if (self) | if (self) | ||||
| self->handleAudioMasterUpdateDisplay(); | self->handleAudioMasterUpdateDisplay(); | ||||
| else | |||||
| qWarning("VstPlugin::hostCallback::audioMasterUpdateDisplay called without valid object"); | |||||
| if (effect) | |||||
| effect->dispatcher(effect, effEditIdle, 0, 0, nullptr, 0.0f); | |||||
| break; | break; | ||||
| case audioMasterBeginEdit: | case audioMasterBeginEdit: | ||||
| @@ -2048,6 +2105,12 @@ public: | |||||
| // --------------------------------------------------------------- | // --------------------------------------------------------------- | ||||
| // initialize VST stuff | // initialize VST stuff | ||||
| #ifdef VESTIGE_HEADER | |||||
| effect->ptr1 = this; | |||||
| #else | |||||
| effect->resvd1 = (intptr_t)this; | |||||
| #endif | |||||
| effect->dispatcher(effect, effOpen, 0, 0, nullptr, 0.0f); | effect->dispatcher(effect, effOpen, 0, 0, nullptr, 0.0f); | ||||
| #if ! VST_FORCE_DEPRECATED | #if ! VST_FORCE_DEPRECATED | ||||
| effect->dispatcher(effect, effSetBlockSizeAndSampleRate, 0, x_engine->getBufferSize(), nullptr, x_engine->getSampleRate()); | effect->dispatcher(effect, effSetBlockSizeAndSampleRate, 0, x_engine->getBufferSize(), nullptr, x_engine->getSampleRate()); | ||||
| @@ -2056,12 +2119,6 @@ public: | |||||
| effect->dispatcher(effect, effSetBlockSize, 0, x_engine->getBufferSize(), nullptr, 0.0f); | effect->dispatcher(effect, effSetBlockSize, 0, x_engine->getBufferSize(), nullptr, 0.0f); | ||||
| effect->dispatcher(effect, effSetProcessPrecision, 0, kVstProcessPrecision32, nullptr, 0.0f); | effect->dispatcher(effect, effSetProcessPrecision, 0, kVstProcessPrecision32, nullptr, 0.0f); | ||||
| #ifdef VESTIGE_HEADER | |||||
| effect->ptr1 = this; | |||||
| #else | |||||
| effect->resvd1 = (intptr_t)this; | |||||
| #endif | |||||
| #if ! VST_FORCE_DEPRECATED | #if ! VST_FORCE_DEPRECATED | ||||
| // dummy pre-start to catch possible wantEvents() call on old plugins | // dummy pre-start to catch possible wantEvents() call on old plugins | ||||
| effect->dispatcher(effect, effStartProcess, 0, 0, nullptr, 0.0f); | effect->dispatcher(effect, effStartProcess, 0, 0, nullptr, 0.0f); | ||||
| @@ -2145,6 +2202,7 @@ private: | |||||
| } gui; | } gui; | ||||
| bool isProcessing; | bool isProcessing; | ||||
| bool needIdle; | |||||
| int unique2; | int unique2; | ||||
| }; | }; | ||||
| @@ -2155,7 +2213,7 @@ CarlaPlugin* CarlaPlugin::newVST(const initializer& init) | |||||
| short id = init.engine->getNewPluginId(); | short id = init.engine->getNewPluginId(); | ||||
| if (id < 0 || id > MAX_PLUGINS) | |||||
| if (id < 0 || id > CarlaEngine::maxPluginNumber()) | |||||
| { | { | ||||
| setLastError("Maximum number of plugins reached"); | setLastError("Maximum number of plugins reached"); | ||||
| return nullptr; | return nullptr; | ||||
| @@ -7,12 +7,13 @@ | |||||
| CXX ?= g++ | CXX ?= g++ | ||||
| STRIP ?= strip | STRIP ?= strip | ||||
| BASE_FLAGS = -O2 -ffast-math -fomit-frame-pointer -mtune=generic -msse -mfpmath=sse -Wall | |||||
| # BASE_FLAGS = -O2 -ffast-math -fomit-frame-pointer -mtune=generic -msse -mfpmath=sse -Wall | |||||
| BASE_FLAGS = -O0 -g | BASE_FLAGS = -O0 -g | ||||
| BUILD_FLAGS = $(BASE_FLAGS) -std=c++0x $(CXXFLAGS) | BUILD_FLAGS = $(BASE_FLAGS) -std=c++0x $(CXXFLAGS) | ||||
| BUILD_FLAGS += -I. -I../carla-includes $(shell pkg-config --cflags liblo QtCore) | BUILD_FLAGS += -I. -I../carla-includes $(shell pkg-config --cflags liblo QtCore) | ||||
| BUILD_FLAGS += -DBUILD_BRIDGE -DDEBUG # -DQT_NO_DEBUG -DQT_NO_DEBUG_STREAM -DQT_NO_DEBUG_OUTPUT # -DNDEBUG | |||||
| # BUILD_FLAGS += -DBUILD_BRIDGE -DQT_NO_DEBUG -DQT_NO_DEBUG_STREAM -DQT_NO_DEBUG_OUTPUT -DNDEBUG | |||||
| BUILD_FLAGS += -DBUILD_BRIDGE -DDEBUG | |||||
| BUILD_FLAGS += -DVESTIGE_HEADER # Comment this line to not use vestige header | BUILD_FLAGS += -DVESTIGE_HEADER # Comment this line to not use vestige header | ||||
| 32BIT_FLAGS = -m32 | 32BIT_FLAGS = -m32 | ||||
| @@ -250,14 +250,23 @@ int CarlaOsc::handleMsgProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
| int CarlaOsc::handleMsgMidiProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS) | int CarlaOsc::handleMsgMidiProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS) | ||||
| { | { | ||||
| qDebug("CarlaOsc::handleMsgMidiProgram()"); | qDebug("CarlaOsc::handleMsgMidiProgram()"); | ||||
| #ifdef BUILD_BRIDGE_PLUGIN | |||||
| CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(1, "i"); | |||||
| #else | |||||
| CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "ii"); | CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "ii"); | ||||
| #endif | |||||
| if (! client) | if (! client) | ||||
| return 1; | return 1; | ||||
| #ifdef BUILD_BRIDGE_PLUGIN | |||||
| const int32_t index = argv[0]->i; | |||||
| client->quequeMessage(MESSAGE_MIDI_PROGRAM, index, -1, 0.0); | |||||
| #else | |||||
| const int32_t bank = argv[0]->i; | const int32_t bank = argv[0]->i; | ||||
| const int32_t program = argv[1]->i; | const int32_t program = argv[1]->i; | ||||
| client->quequeMessage(MESSAGE_MIDI_PROGRAM, bank, program, 0.0); | client->quequeMessage(MESSAGE_MIDI_PROGRAM, bank, program, 0.0); | ||||
| #endif | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -93,6 +93,9 @@ public: | |||||
| void setStuff(CarlaBackend::CarlaEngine* const engine_, CarlaBackend::CarlaPlugin* const plugin_) | void setStuff(CarlaBackend::CarlaEngine* const engine_, CarlaBackend::CarlaPlugin* const plugin_) | ||||
| { | { | ||||
| Q_ASSERT(engine_); | |||||
| Q_ASSERT(plugin_); | |||||
| engine = engine_; | engine = engine_; | ||||
| plugin = plugin_; | plugin = plugin_; | ||||
| } | } | ||||
| @@ -114,25 +117,47 @@ public: | |||||
| void setProgram(const uint32_t index) | void setProgram(const uint32_t index) | ||||
| { | { | ||||
| qDebug("CarlaPluginClient::setProgram(%i)", index); | qDebug("CarlaPluginClient::setProgram(%i)", index); | ||||
| Q_ASSERT(plugin && index < plugin->programCount()); | |||||
| Q_ASSERT(engine); | |||||
| Q_ASSERT(plugin); | |||||
| Q_ASSERT(index < plugin->programCount()); | |||||
| if (! plugin) | |||||
| if (! (plugin && engine)) | |||||
| return; | return; | ||||
| if (index >= plugin->programCount()) | if (index >= plugin->programCount()) | ||||
| return; | return; | ||||
| plugin->setProgram(index, true, true, false, true); | plugin->setProgram(index, true, true, false, true); | ||||
| double value; | |||||
| for (uint32_t i=0; i < plugin->parameterCount(); i++) | |||||
| { | |||||
| value = plugin->getParameterValue(i); | |||||
| engine->osc_send_bridge_set_parameter_value(i, value); | |||||
| engine->osc_send_bridge_set_default_value(i, value); | |||||
| } | |||||
| } | } | ||||
| void setMidiProgram(const uint32_t bank, const uint32_t program) | |||||
| void setMidiProgram(const uint32_t index, const uint32_t test) | |||||
| { | { | ||||
| qDebug("CarlaPluginClient::setMidiProgram(%i, %i)", bank, program); | |||||
| qDebug("CarlaPluginClient::setMidiProgram(%i, %i)", index, test); | |||||
| Q_ASSERT(engine); | |||||
| Q_ASSERT(plugin); | Q_ASSERT(plugin); | ||||
| Q_ASSERT(test == -1); | |||||
| if (! plugin) | |||||
| if (! (plugin && engine)) | |||||
| return; | return; | ||||
| if (test != -1) | |||||
| return; | |||||
| plugin->setMidiProgramById(bank, program, true, true, false, true); | |||||
| plugin->setMidiProgram(index, true, true, false, true); | |||||
| double value; | |||||
| for (uint32_t i=0; i < plugin->parameterCount(); i++) | |||||
| { | |||||
| value = plugin->getParameterValue(i); | |||||
| engine->osc_send_bridge_set_parameter_value(i, value); | |||||
| engine->osc_send_bridge_set_default_value(i, value); | |||||
| } | |||||
| } | } | ||||
| void noteOn(const uint8_t channel, const uint8_t note, const uint8_t velo) | void noteOn(const uint8_t channel, const uint8_t note, const uint8_t velo) | ||||
| @@ -149,7 +174,7 @@ public: | |||||
| void noteOff(const uint8_t channel, const uint8_t note) | void noteOff(const uint8_t channel, const uint8_t note) | ||||
| { | { | ||||
| qDebug("CarlaPluginClient::noteOn(%i, %i)", channel, note); | |||||
| qDebug("CarlaPluginClient::noteOff(%i, %i)", channel, note); | |||||
| Q_ASSERT(plugin); | Q_ASSERT(plugin); | ||||
| if (! plugin) | if (! plugin) | ||||
| @@ -163,6 +188,7 @@ public: | |||||
| void saveNow() | void saveNow() | ||||
| { | { | ||||
| qDebug("CarlaPluginClient::saveNow()"); | |||||
| Q_ASSERT(plugin); | Q_ASSERT(plugin); | ||||
| if (! plugin) | if (! plugin) | ||||
| @@ -206,6 +232,7 @@ public: | |||||
| void setCustomData(const char* const type, const char* const key, const char* const value) | void setCustomData(const char* const type, const char* const key, const char* const value) | ||||
| { | { | ||||
| qDebug("CarlaPluginClient::setCustomData(\"%s\", \"%s\", \"%s\")", type, key, value); | |||||
| Q_ASSERT(plugin); | Q_ASSERT(plugin); | ||||
| if (! plugin) | if (! plugin) | ||||
| @@ -216,6 +243,7 @@ public: | |||||
| void setChunkData(const char* const filePath) | void setChunkData(const char* const filePath) | ||||
| { | { | ||||
| qDebug("CarlaPluginClient::setChunkData(\"%s\")", filePath); | |||||
| Q_ASSERT(plugin); | Q_ASSERT(plugin); | ||||
| if (! plugin) | if (! plugin) | ||||
| @@ -391,6 +419,7 @@ public: | |||||
| qDebug("CarlaToolkitPlugin::CarlaToolkitPlugin()"); | qDebug("CarlaToolkitPlugin::CarlaToolkitPlugin()"); | ||||
| app = nullptr; | app = nullptr; | ||||
| dialog = nullptr; | dialog = nullptr; | ||||
| m_resizable = false; | |||||
| } | } | ||||
| ~CarlaToolkitPlugin() | ~CarlaToolkitPlugin() | ||||
| @@ -478,16 +507,26 @@ public: | |||||
| qDebug("CarlaToolkitPlugin::resize(%i, %i)", width, height); | qDebug("CarlaToolkitPlugin::resize(%i, %i)", width, height); | ||||
| Q_ASSERT(dialog); | Q_ASSERT(dialog); | ||||
| if (dialog) | |||||
| if (! dialog) | |||||
| return; | |||||
| if (m_resizable) | |||||
| dialog->resize(width, height); | |||||
| else | |||||
| dialog->setFixedSize(width, height); | dialog->setFixedSize(width, height); | ||||
| } | } | ||||
| // --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
| void createWindow(const char* const pluginName, const bool createLayout) | |||||
| void createWindow(const char* const pluginName, const bool createLayout, const bool resizable) | |||||
| { | { | ||||
| qDebug("CarlaToolkitPlugin::createWindow(%s, %s, %s)", pluginName, bool2str(createLayout), bool2str(resizable)); | |||||
| Q_ASSERT(pluginName); | |||||
| m_resizable = resizable; | |||||
| dialog = new QDialog(nullptr); | dialog = new QDialog(nullptr); | ||||
| dialog->resize(10, 10); | |||||
| resize(10, 10); | |||||
| if (createLayout) | if (createLayout) | ||||
| { | { | ||||
| @@ -497,6 +536,11 @@ public: | |||||
| } | } | ||||
| dialog->setWindowTitle(QString("%1 (GUI)").arg(pluginName)); | dialog->setWindowTitle(QString("%1 (GUI)").arg(pluginName)); | ||||
| #ifdef Q_OS_WIN | |||||
| if (! resizable) | |||||
| dialog->setWindowFlags(dialog->windowFlags() | Qt::MSWindowsFixedSizeDialogHint); | |||||
| #endif | |||||
| } | } | ||||
| CarlaBackend::GuiDataHandle getWindowHandle() const | CarlaBackend::GuiDataHandle getWindowHandle() const | ||||
| @@ -509,6 +553,7 @@ public: | |||||
| private: | private: | ||||
| BridgeApplication* app; | BridgeApplication* app; | ||||
| QDialog* dialog; | QDialog* dialog; | ||||
| bool m_resizable; | |||||
| }; | }; | ||||
| CarlaToolkit* CarlaToolkit::createNew(const char* const) | CarlaToolkit* CarlaToolkit::createNew(const char* const) | ||||
| @@ -608,7 +653,7 @@ int main(int argc, char* argv[]) | |||||
| if (guiType == CarlaBackend::GUI_INTERNAL_QT4 || guiType == CarlaBackend::GUI_INTERNAL_COCOA || guiType == CarlaBackend::GUI_INTERNAL_HWND || guiType == CarlaBackend::GUI_INTERNAL_X11) | if (guiType == CarlaBackend::GUI_INTERNAL_QT4 || guiType == CarlaBackend::GUI_INTERNAL_COCOA || guiType == CarlaBackend::GUI_INTERNAL_HWND || guiType == CarlaBackend::GUI_INTERNAL_X11) | ||||
| { | { | ||||
| toolkit.createWindow(plugin->name(), (guiType == CarlaBackend::GUI_INTERNAL_QT4)); | |||||
| toolkit.createWindow(plugin->name(), (guiType == CarlaBackend::GUI_INTERNAL_QT4), guiResizable); | |||||
| plugin->setGuiData(toolkit.getWindowHandle()); | plugin->setGuiData(toolkit.getWindowHandle()); | ||||
| } | } | ||||
| @@ -94,6 +94,12 @@ public: | |||||
| // ----------------------------------------------------------------- | // ----------------------------------------------------------------- | ||||
| // initialize VST stuff | // initialize VST stuff | ||||
| #ifdef VESTIGE_HEADER | |||||
| effect->ptr1 = this; | |||||
| #else | |||||
| effect->resvd1 = (intptr_t)this; | |||||
| #endif | |||||
| int32_t value = 0; | int32_t value = 0; | ||||
| #ifdef Q_WS_X11 | #ifdef Q_WS_X11 | ||||
| value = (int64_t)QX11Info::display(); | value = (int64_t)QX11Info::display(); | ||||
| @@ -110,12 +116,6 @@ public: | |||||
| if (effect->dispatcher(effect, effEditOpen, 0, value, (void*)widget->winId(), 0.0f) != 1) | if (effect->dispatcher(effect, effEditOpen, 0, value, (void*)widget->winId(), 0.0f) != 1) | ||||
| return false; | return false; | ||||
| #ifdef VESTIGE_HEADER | |||||
| effect->ptr1 = this; | |||||
| #else | |||||
| effect->resvd1 = (intptr_t)this; | |||||
| #endif | |||||
| // ----------------------------------------------------------------- | // ----------------------------------------------------------------- | ||||
| // initialize gui stuff | // initialize gui stuff | ||||
| @@ -1988,6 +1988,9 @@ class PluginGUI(QDialog): | |||||
| self.setNewSize(50, 50) | self.setNewSize(50, 50) | ||||
| self.setWindowTitle("%s (GUI)" % pluginName) | self.setWindowTitle("%s (GUI)" % pluginName) | ||||
| if (WINDOWS and not resizable): | |||||
| self.setWindowFlags(self.windowFlags() | Qt.MSWindowsFixedSizeDialogHint) | |||||
| self.connect(self, SIGNAL("finished(int)"), SLOT("slot_finished()")) | self.connect(self, SIGNAL("finished(int)"), SLOT("slot_finished()")) | ||||
| def setNewSize(self, width, height): | def setNewSize(self, width, height): | ||||