@@ -925,13 +925,17 @@ void set_parameter_value(unsigned short plugin_id, quint32 parameter_id, double | |||
qCritical("CarlaBackendStandalone::set_parameter_value(%i, %i, %g) - could not find plugin", plugin_id, parameter_id, value); | |||
} | |||
void set_parameter_midi_channel(unsigned short plugin_id, quint32 parameter_id, quint8 channel) | |||
void set_parameter_midi_cc(unsigned short plugin_id, quint32 parameter_id, int16_t midi_cc) | |||
{ | |||
qDebug("CarlaBackendStandalone::set_parameter_midi_channel(%i, %i, %i)", plugin_id, parameter_id, channel); | |||
qDebug("CarlaBackendStandalone::set_parameter_midi_cc(%i, %i, %i)", plugin_id, parameter_id, midi_cc); | |||
if (channel > 15) | |||
if (midi_cc < -1) | |||
{ | |||
qCritical("CarlaBackendStandalone::set_parameter_midi_channel(%i, %i, %i) - invalid channel number", plugin_id, parameter_id, channel); | |||
midi_cc = -1; | |||
} | |||
else if (midi_cc > 0x5F) // 95 | |||
{ | |||
qCritical("CarlaBackendStandalone::set_parameter_midi_cc(%i, %i, %i) - invalid midi_cc number", plugin_id, parameter_id, midi_cc); | |||
return; | |||
} | |||
@@ -940,26 +944,22 @@ void set_parameter_midi_channel(unsigned short plugin_id, quint32 parameter_id, | |||
if (plugin) | |||
{ | |||
if (parameter_id < plugin->parameterCount()) | |||
return plugin->setParameterMidiChannel(parameter_id, channel); | |||
return plugin->setParameterMidiCC(parameter_id, midi_cc, true, false); | |||
qCritical("CarlaBackendStandalone::set_parameter_midi_channel(%i, %i, %i) - parameter_id out of bounds", plugin_id, parameter_id, channel); | |||
qCritical("CarlaBackendStandalone::set_parameter_midi_cc(%i, %i, %i) - parameter_id out of bounds", plugin_id, parameter_id, midi_cc); | |||
return; | |||
} | |||
qCritical("CarlaBackendStandalone::set_parameter_midi_channel(%i, %i, %i) - could not find plugin", plugin_id, parameter_id, channel); | |||
qCritical("CarlaBackendStandalone::set_parameter_midi_cc(%i, %i, %i) - could not find plugin", plugin_id, parameter_id, midi_cc); | |||
} | |||
void set_parameter_midi_cc(unsigned short plugin_id, quint32 parameter_id, int16_t midi_cc) | |||
void set_parameter_midi_channel(unsigned short plugin_id, quint32 parameter_id, quint8 channel) | |||
{ | |||
qDebug("CarlaBackendStandalone::set_parameter_midi_cc(%i, %i, %i)", plugin_id, parameter_id, midi_cc); | |||
qDebug("CarlaBackendStandalone::set_parameter_midi_channel(%i, %i, %i)", plugin_id, parameter_id, channel); | |||
if (midi_cc < -1) | |||
{ | |||
midi_cc = -1; | |||
} | |||
else if (midi_cc > 0x5F) // 95 | |||
if (channel > 15) | |||
{ | |||
qCritical("CarlaBackendStandalone::set_parameter_midi_cc(%i, %i, %i) - invalid midi_cc number", plugin_id, parameter_id, midi_cc); | |||
qCritical("CarlaBackendStandalone::set_parameter_midi_channel(%i, %i, %i) - invalid channel number", plugin_id, parameter_id, channel); | |||
return; | |||
} | |||
@@ -968,13 +968,13 @@ void set_parameter_midi_cc(unsigned short plugin_id, quint32 parameter_id, int16 | |||
if (plugin) | |||
{ | |||
if (parameter_id < plugin->parameterCount()) | |||
return plugin->setParameterMidiCC(parameter_id, midi_cc); | |||
return plugin->setParameterMidiChannel(parameter_id, channel, true, false); | |||
qCritical("CarlaBackendStandalone::set_parameter_midi_cc(%i, %i, %i) - parameter_id out of bounds", plugin_id, parameter_id, midi_cc); | |||
qCritical("CarlaBackendStandalone::set_parameter_midi_channel(%i, %i, %i) - parameter_id out of bounds", plugin_id, parameter_id, channel); | |||
return; | |||
} | |||
qCritical("CarlaBackendStandalone::set_parameter_midi_cc(%i, %i, %i) - could not find plugin", plugin_id, parameter_id, midi_cc); | |||
qCritical("CarlaBackendStandalone::set_parameter_midi_channel(%i, %i, %i) - could not find plugin", plugin_id, parameter_id, channel); | |||
} | |||
void set_program(unsigned short plugin_id, quint32 program_id) | |||
@@ -135,8 +135,8 @@ CARLA_EXPORT void set_balance_left(unsigned short plugin_id, double value); | |||
CARLA_EXPORT void set_balance_right(unsigned short plugin_id, double value); | |||
CARLA_EXPORT void set_parameter_value(unsigned short plugin_id, quint32 parameter_id, double value); | |||
CARLA_EXPORT void set_parameter_midi_channel(unsigned short plugin_id, quint32 parameter_id, quint8 channel); | |||
CARLA_EXPORT void set_parameter_midi_cc(unsigned short plugin_id, quint32 parameter_id, qint16 midi_cc); | |||
CARLA_EXPORT void set_parameter_midi_channel(unsigned short plugin_id, quint32 parameter_id, quint8 channel); | |||
CARLA_EXPORT void set_program(unsigned short plugin_id, quint32 program_id); | |||
CARLA_EXPORT void set_midi_program(unsigned short plugin_id, quint32 midi_program_id); | |||
@@ -843,6 +843,7 @@ void CarlaEngine::osc_send_add_plugin(const int32_t pluginId, const char* const | |||
const CarlaOscData* const oscData = m_osc.getControllerData(); | |||
Q_ASSERT(oscData); | |||
Q_ASSERT(pluginId >= 0 && pluginId < MAX_PLUGINS); | |||
Q_ASSERT(pluginName); | |||
if (oscData->target) | |||
{ | |||
@@ -868,13 +869,13 @@ void CarlaEngine::osc_send_remove_plugin(const int32_t pluginId) | |||
} | |||
} | |||
void CarlaEngine::osc_send_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_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); | |||
const CarlaOscData* const oscData = m_osc.getControllerData(); | |||
Q_ASSERT(oscData); | |||
Q_ASSERT(pluginId >= 0 && pluginId < MAX_PLUGINS); | |||
Q_ASSERT(type != PLUGIN_NONE); | |||
if (oscData->target) | |||
{ | |||
@@ -885,8 +886,7 @@ void CarlaEngine::osc_send_set_plugin_data(const int32_t pluginId, const int32_t | |||
} | |||
} | |||
void CarlaEngine::osc_send_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_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); | |||
const CarlaOscData* const oscData = m_osc.getControllerData(); | |||
@@ -902,13 +902,14 @@ void CarlaEngine::osc_send_set_plugin_ports(const int32_t pluginId, const int32_ | |||
} | |||
} | |||
void CarlaEngine::osc_send_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_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); | |||
const CarlaOscData* const oscData = m_osc.getControllerData(); | |||
Q_ASSERT(oscData); | |||
Q_ASSERT(pluginId >= 0 && pluginId < MAX_PLUGINS); | |||
Q_ASSERT(index >= 0); | |||
Q_ASSERT(type != PARAMETER_UNKNOWN); | |||
if (oscData->target) | |||
{ | |||
@@ -919,13 +920,14 @@ void CarlaEngine::osc_send_set_parameter_data(const int32_t pluginId, const int3 | |||
} | |||
} | |||
void CarlaEngine::osc_send_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_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); | |||
const CarlaOscData* const oscData = m_osc.getControllerData(); | |||
Q_ASSERT(oscData); | |||
Q_ASSERT(pluginId >= 0 && pluginId < MAX_PLUGINS); | |||
Q_ASSERT(index >= 0); | |||
Q_ASSERT(min < max); | |||
if (oscData->target) | |||
{ | |||
@@ -942,6 +944,7 @@ void CarlaEngine::osc_send_set_parameter_midi_cc(const int32_t pluginId, const i | |||
const CarlaOscData* const oscData = m_osc.getControllerData(); | |||
Q_ASSERT(oscData); | |||
Q_ASSERT(pluginId >= 0 && pluginId < MAX_PLUGINS); | |||
Q_ASSERT(index >= 0); | |||
if (oscData->target) | |||
{ | |||
@@ -958,6 +961,8 @@ void CarlaEngine::osc_send_set_parameter_midi_channel(const int32_t pluginId, co | |||
const CarlaOscData* const oscData = m_osc.getControllerData(); | |||
Q_ASSERT(oscData); | |||
Q_ASSERT(pluginId >= 0 && pluginId < MAX_PLUGINS); | |||
Q_ASSERT(index >= 0); | |||
Q_ASSERT(channel >= 0 && channel < 16); | |||
if (oscData->target) | |||
{ | |||
@@ -995,6 +1000,7 @@ void CarlaEngine::osc_send_set_default_value(const int32_t pluginId, const int32 | |||
const CarlaOscData* const oscData = m_osc.getControllerData(); | |||
Q_ASSERT(oscData); | |||
Q_ASSERT(pluginId >= 0 && pluginId < MAX_PLUGINS); | |||
Q_ASSERT(index >= 0); | |||
if (oscData->target) | |||
{ | |||
@@ -1027,6 +1033,7 @@ void CarlaEngine::osc_send_set_program_count(const int32_t pluginId, const int32 | |||
const CarlaOscData* const oscData = m_osc.getControllerData(); | |||
Q_ASSERT(oscData); | |||
Q_ASSERT(pluginId >= 0 && pluginId < MAX_PLUGINS); | |||
Q_ASSERT(count >= 0); | |||
if (oscData->target) | |||
{ | |||
@@ -1043,6 +1050,8 @@ void CarlaEngine::osc_send_set_program_name(const int32_t pluginId, const int32_ | |||
const CarlaOscData* const oscData = m_osc.getControllerData(); | |||
Q_ASSERT(oscData); | |||
Q_ASSERT(pluginId >= 0 && pluginId < MAX_PLUGINS); | |||
Q_ASSERT(index >= 0); | |||
Q_ASSERT(name); | |||
if (oscData->target) | |||
{ | |||
@@ -1075,6 +1084,7 @@ void CarlaEngine::osc_send_set_midi_program_count(const int32_t pluginId, const | |||
const CarlaOscData* const oscData = m_osc.getControllerData(); | |||
Q_ASSERT(oscData); | |||
Q_ASSERT(pluginId >= 0 && pluginId < MAX_PLUGINS); | |||
Q_ASSERT(count >= 0); | |||
if (oscData->target) | |||
{ | |||
@@ -1091,6 +1101,10 @@ void CarlaEngine::osc_send_set_midi_program_data(const int32_t pluginId, const i | |||
const CarlaOscData* const oscData = m_osc.getControllerData(); | |||
Q_ASSERT(oscData); | |||
Q_ASSERT(pluginId >= 0 && pluginId < MAX_PLUGINS); | |||
Q_ASSERT(index >= 0); | |||
Q_ASSERT(bank >= 0); | |||
Q_ASSERT(program >= 0); | |||
Q_ASSERT(name); | |||
if (oscData->target) | |||
{ | |||
@@ -1101,67 +1115,74 @@ void CarlaEngine::osc_send_set_midi_program_data(const int32_t pluginId, const i | |||
} | |||
} | |||
void CarlaEngine::osc_send_set_input_peak_value(const int32_t plugin_id, const int32_t port_id, const double value) | |||
void CarlaEngine::osc_send_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, %f)", plugin_id, port_id, value); | |||
qDebug("CarlaEngine::osc_send_set_input_peak_value(%i, %i, %g)", pluginId, portId, value); | |||
const CarlaOscData* const oscData = m_osc.getControllerData(); | |||
Q_ASSERT(oscData); | |||
//Q_ASSERT(pluginId >= 0 && pluginId < MAX_PLUGINS); | |||
Q_ASSERT(pluginId >= 0 && pluginId < MAX_PLUGINS); | |||
Q_ASSERT(portId == 1 || portId == 2); | |||
if (oscData->target) | |||
{ | |||
char target_path[strlen(oscData->path)+22]; | |||
strcpy(target_path, oscData->path); | |||
strcat(target_path, "/set_input_peak_value"); | |||
lo_send(oscData->target, target_path, "iid", plugin_id, port_id, value); | |||
lo_send(oscData->target, target_path, "iid", pluginId, portId, value); | |||
} | |||
} | |||
void CarlaEngine::osc_send_set_output_peak_value(const int32_t plugin_id, const int32_t port_id, const double value) | |||
void CarlaEngine::osc_send_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, %f)", plugin_id, port_id, value); | |||
qDebug("CarlaEngine::osc_send_set_output_peak_value(%i, %i, %g)", pluginId, portId, value); | |||
const CarlaOscData* const oscData = m_osc.getControllerData(); | |||
Q_ASSERT(oscData); | |||
//Q_ASSERT(pluginId >= 0 && pluginId < MAX_PLUGINS); | |||
Q_ASSERT(pluginId >= 0 && pluginId < MAX_PLUGINS); | |||
Q_ASSERT(portId == 1 || portId == 2); | |||
if (oscData->target) | |||
{ | |||
char target_path[strlen(oscData->path)+23]; | |||
strcpy(target_path, oscData->path); | |||
strcat(target_path, "/set_output_peak_value"); | |||
lo_send(oscData->target, target_path, "iid", plugin_id, port_id, value); | |||
lo_send(oscData->target, target_path, "iid", pluginId, portId, value); | |||
} | |||
} | |||
void CarlaEngine::osc_send_note_on(const int32_t plugin_id, const int32_t channel, const int32_t note, const int32_t velo) | |||
void CarlaEngine::osc_send_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)", plugin_id, channel, note, velo); | |||
qDebug("CarlaEngine::osc_send_note_on(%i, %i, %i, %i)", pluginId, channel, note, velo); | |||
const CarlaOscData* const oscData = m_osc.getControllerData(); | |||
Q_ASSERT(oscData); | |||
//Q_ASSERT(pluginId >= 0 && pluginId < MAX_PLUGINS); | |||
Q_ASSERT(pluginId >= 0 && pluginId < MAX_PLUGINS); | |||
Q_ASSERT(channel >= 0 && channel < 16); | |||
Q_ASSERT(note >= 0 && note < 128); | |||
Q_ASSERT(velo >= 0 && velo < 128); | |||
if (oscData->target) | |||
{ | |||
char target_path[strlen(oscData->path)+9]; | |||
strcpy(target_path, oscData->path); | |||
strcat(target_path, "/note_on"); | |||
lo_send(oscData->target, target_path, "iiii", plugin_id, channel, note, velo); | |||
lo_send(oscData->target, target_path, "iiii", pluginId, channel, note, velo); | |||
} | |||
} | |||
void CarlaEngine::osc_send_note_off(const int32_t plugin_id, const int32_t channel, const int32_t note) | |||
void CarlaEngine::osc_send_note_off(const int32_t pluginId, const int32_t channel, const int32_t note) | |||
{ | |||
qDebug("CarlaEngine::osc_send_note_off(%i, %i, %i)", plugin_id, channel, note); | |||
qDebug("CarlaEngine::osc_send_note_off(%i, %i, %i)", pluginId, channel, note); | |||
const CarlaOscData* const oscData = m_osc.getControllerData(); | |||
Q_ASSERT(oscData); | |||
//Q_ASSERT(pluginId >= 0 && pluginId < MAX_PLUGINS); | |||
Q_ASSERT(pluginId >= 0 && pluginId < MAX_PLUGINS); | |||
Q_ASSERT(channel >= 0 && channel < 16); | |||
Q_ASSERT(note >= 0 && note < 128); | |||
if (oscData->target) | |||
{ | |||
char target_path[strlen(oscData->path)+10]; | |||
strcpy(target_path, oscData->path); | |||
strcat(target_path, "/note_off"); | |||
lo_send(oscData->target, target_path, "iii", plugin_id, channel, note); | |||
lo_send(oscData->target, target_path, "iii", pluginId, channel, note); | |||
} | |||
} | |||
@@ -315,28 +315,24 @@ public: | |||
void osc_send_add_plugin(const int32_t pluginId, const char* const pluginName); | |||
void osc_send_remove_plugin(const int32_t pluginId); | |||
void osc_send_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 osc_send_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 osc_send_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 osc_send_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 osc_send_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 osc_send_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 osc_send_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 osc_send_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 osc_send_set_parameter_midi_cc(const int32_t pluginId, const int32_t index, const int32_t cc); | |||
void osc_send_set_parameter_midi_channel(const int32_t pluginId, const int32_t index, const int32_t channel); | |||
void osc_send_set_parameter_value(const int32_t pluginId, const int32_t index, const double value); | |||
void osc_send_set_default_value(const int32_t pluginId, const int32_t index, const double value); | |||
void osc_send_set_program(const int32_t pluginId, const int32_t index); | |||
void osc_send_set_program_count(int32_t pluginId, int program_count); | |||
void osc_send_set_program_count(const int32_t pluginId, const int32_t count); | |||
void osc_send_set_program_name(const int32_t pluginId, const int32_t index, const char* const name); | |||
void osc_send_set_midi_program(const int32_t pluginId, const int32_t index); | |||
void osc_send_set_midi_program_count(const int32_t pluginId, const int32_t count); | |||
void osc_send_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 osc_send_set_input_peak_value(int32_t pluginId, int port_id, double value); | |||
void osc_send_set_output_peak_value(int32_t pluginId, int port_id, double value); | |||
void osc_send_note_on(int32_t pluginId, int channel, int note, int velo); | |||
void osc_send_note_off(int32_t pluginId, int channel, int note); | |||
void osc_send_set_input_peak_value(const int32_t pluginId, const int32_t portId, const double value); | |||
void osc_send_set_output_peak_value(const int32_t pluginId, const int32_t portId, const double value); | |||
void osc_send_note_on(const int32_t pluginId, const int32_t channel, const int32_t note, const int32_t velo); | |||
void osc_send_note_off(const int32_t pluginId, const int32_t channel, const int32_t note); | |||
void osc_send_exit(); | |||
#ifndef BUILD_BRIDGE | |||
@@ -163,8 +163,12 @@ int CarlaOsc::handleMessage(const char* const path, const int argc, const lo_arg | |||
return handle_set_balance_left(plugin, argc, argv, types); | |||
if (strcmp(method, "/set_balance_right") == 0) | |||
return handle_set_balance_right(plugin, argc, argv, types); | |||
if (strcmp(method, "/set_parameter") == 0) | |||
return handle_set_parameter(plugin, argc, argv, types); | |||
if (strcmp(method, "/set_parameter_value") == 0) | |||
return handle_set_parameter_value(plugin, argc, argv, types); | |||
if (strcmp(method, "/set_parameter_midi_cc") == 0) | |||
return handle_set_parameter_midi_cc(plugin, argc, argv, types); | |||
if (strcmp(method, "/set_parameter_midi_channel") == 0) | |||
return handle_set_parameter_midi_channel(plugin, argc, argv, types); | |||
if (strcmp(method, "/set_program") == 0) | |||
return handle_set_program(plugin, argc, argv, types); | |||
if (strcmp(method, "/set_midi_program") == 0) | |||
@@ -413,8 +417,8 @@ int CarlaOsc::handle_set_active(CARLA_OSC_HANDLE_ARGS2) | |||
qDebug("CarlaOsc::handle_set_active()"); | |||
CARLA_OSC_CHECK_OSC_TYPES(1, "i"); | |||
bool value = (bool)argv[0]->i; | |||
plugin->setActive(value, false, true); | |||
bool active = (bool)argv[0]->i; | |||
plugin->setActive(active, false, true); | |||
return 0; | |||
} | |||
@@ -463,14 +467,38 @@ int CarlaOsc::handle_set_balance_right(CARLA_OSC_HANDLE_ARGS2) | |||
return 0; | |||
} | |||
int CarlaOsc::handle_set_parameter(CARLA_OSC_HANDLE_ARGS2) | |||
int CarlaOsc::handle_set_parameter_value(CARLA_OSC_HANDLE_ARGS2) | |||
{ | |||
qDebug("CarlaOsc::handle_set_parameter()"); | |||
CARLA_OSC_CHECK_OSC_TYPES(1, "d"); | |||
qDebug("CarlaOsc::handle_set_parameter_value()"); | |||
CARLA_OSC_CHECK_OSC_TYPES(2, "id"); | |||
const uint32_t index = argv[0]->i; | |||
const double value = argv[1]->d; | |||
plugin->setParameterValue(index, value, true, false, true); | |||
return 0; | |||
} | |||
int CarlaOsc::handle_set_parameter_midi_cc(CARLA_OSC_HANDLE_ARGS2) | |||
{ | |||
qDebug("CarlaOsc::handle_set_parameter_midi_cc()"); | |||
CARLA_OSC_CHECK_OSC_TYPES(2, "ii"); | |||
const uint32_t index = argv[0]->i; | |||
const int32_t cc = argv[1]->i; | |||
plugin->setParameterMidiCC(index, cc, false, true); | |||
return 0; | |||
} | |||
int CarlaOsc::handle_set_parameter_midi_channel(CARLA_OSC_HANDLE_ARGS2) | |||
{ | |||
qDebug("CarlaOsc::handle_set_parameter_midi_channel()"); | |||
CARLA_OSC_CHECK_OSC_TYPES(2, "ii"); | |||
const uint32_t parameter_id = argv[0]->i; | |||
const double value = argv[1]->d; | |||
plugin->setParameterValue(parameter_id, value, true, false, true); | |||
const uint32_t index = argv[0]->i; | |||
const uint32_t channel = argv[1]->i; | |||
plugin->setParameterMidiChannel(index, channel, false, true); | |||
return 0; | |||
} | |||
@@ -113,7 +113,9 @@ private: | |||
int handle_set_volume(CARLA_OSC_HANDLE_ARGS2); | |||
int handle_set_balance_left(CARLA_OSC_HANDLE_ARGS2); | |||
int handle_set_balance_right(CARLA_OSC_HANDLE_ARGS2); | |||
int handle_set_parameter(CARLA_OSC_HANDLE_ARGS2); | |||
int handle_set_parameter_value(CARLA_OSC_HANDLE_ARGS2); | |||
int handle_set_parameter_midi_cc(CARLA_OSC_HANDLE_ARGS2); | |||
int handle_set_parameter_midi_channel(CARLA_OSC_HANDLE_ARGS2); | |||
int handle_set_program(CARLA_OSC_HANDLE_ARGS2); | |||
int handle_set_midi_program(CARLA_OSC_HANDLE_ARGS2); | |||
int handle_note_on(CARLA_OSC_HANDLE_ARGS2); | |||
@@ -973,39 +973,43 @@ public: | |||
} | |||
/*! | |||
* Set parameter's \a parameterId MIDI channel to \a channel.\n | |||
* \a channel must be between 0 and 15. | |||
* Set parameter's \a parameterId MIDI CC to \a cc.\n | |||
* \a cc must be between 0 and 15. | |||
*/ | |||
void setParameterMidiChannel(uint32_t parameterId, uint8_t channel) | |||
void setParameterMidiCC(uint32_t parameterId, int16_t cc, bool sendOsc, bool sendCallback) | |||
{ | |||
assert(parameterId < param.count && channel < 16); | |||
param.data[parameterId].midiChannel = channel; | |||
assert(parameterId < param.count); | |||
param.data[parameterId].midiCC = cc; | |||
#ifndef BUILD_BRIDGE | |||
x_engine->osc_send_set_parameter_midi_channel(m_id, parameterId, channel); | |||
// FIXME: send to engine | |||
//if (m_hints & PLUGIN_IS_BRIDGE) | |||
// osc_send_set_parameter_midi_channel(&osc.data, m_id, parameterId, channel); | |||
if (sendOsc) | |||
x_engine->osc_send_set_parameter_midi_cc(m_id, parameterId, cc); | |||
#else | |||
Q_UNUSED(sendOsc); | |||
#endif | |||
//if (sendCallback) | |||
//x_engine->callback(CALLBACK_PARAMETER_MIDI_CC_CHANGED, m_id, parameterId, cc, 0.0); | |||
} | |||
/*! | |||
* Set parameter's \a parameterId MIDI CC to \a cc.\n | |||
* \a cc must be between 0 and 15. | |||
* Set parameter's \a parameterId MIDI channel to \a channel.\n | |||
* \a channel must be between 0 and 15. | |||
*/ | |||
void setParameterMidiCC(uint32_t parameterId, int16_t cc) | |||
void setParameterMidiChannel(uint32_t parameterId, uint8_t channel, bool sendOsc, bool sendCallback) | |||
{ | |||
assert(parameterId < param.count); | |||
param.data[parameterId].midiCC = cc; | |||
assert(parameterId < param.count && channel < 16); | |||
param.data[parameterId].midiChannel = channel; | |||
#ifndef BUILD_BRIDGE | |||
x_engine->osc_send_set_parameter_midi_cc(m_id, parameterId, cc); | |||
// FIXME: send to engine | |||
//if (m_hints & PLUGIN_IS_BRIDGE) | |||
// osc_send_set_parameter_midi_cc(&osc.data, m_id, parameterId, midi_cc); | |||
if (sendOsc) | |||
x_engine->osc_send_set_parameter_midi_channel(m_id, parameterId, channel); | |||
#else | |||
Q_UNUSED(sendOsc); | |||
#endif | |||
//if (sendCallback) | |||
//x_engine->callback(CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED, m_id, parameterId, channel, 0.0); | |||
} | |||
/*! | |||
@@ -23,9 +23,9 @@ | |||
#include <stdint.h> | |||
#include "lv2/lv2plug.in/ns/ext/urid/urid.h" | |||
#include "lv2/lv2plug.in/ns/ext/atom/atom.h" | |||
#include "lv2/lv2plug.in/ns/ext/atom/forge.h" | |||
#include "lv2/urid.h" | |||
#include "lv2/atom.h" | |||
#include "lv2/atom-forge.h" | |||
#include "serd/serd.h" | |||
#include "sord/sord.h" | |||
@@ -773,12 +773,12 @@ class Host(object): | |||
self.lib.set_parameter_value.argtypes = [c_ushort, c_uint32, c_double] | |||
self.lib.set_parameter_value.restype = None | |||
self.lib.set_parameter_midi_channel.argtypes = [c_ushort, c_uint32, c_uint8] | |||
self.lib.set_parameter_midi_channel.restype = None | |||
self.lib.set_parameter_midi_cc.argtypes = [c_ushort, c_uint32, c_int16] | |||
self.lib.set_parameter_midi_cc.restype = None | |||
self.lib.set_parameter_midi_channel.argtypes = [c_ushort, c_uint32, c_uint8] | |||
self.lib.set_parameter_midi_channel.restype = None | |||
self.lib.set_program.argtypes = [c_ushort, c_uint32] | |||
self.lib.set_program.restype = None | |||
@@ -941,12 +941,12 @@ class Host(object): | |||
def set_parameter_value(self, plugin_id, parameter_id, value): | |||
self.lib.set_parameter_value(plugin_id, parameter_id, value) | |||
def set_parameter_midi_channel(self, plugin_id, parameter_id, channel): | |||
self.lib.set_parameter_midi_channel(plugin_id, parameter_id, channel) | |||
def set_parameter_midi_cc(self, plugin_id, parameter_id, midi_cc): | |||
self.lib.set_parameter_midi_cc(plugin_id, parameter_id, midi_cc) | |||
def set_parameter_midi_channel(self, plugin_id, parameter_id, channel): | |||
self.lib.set_parameter_midi_channel(plugin_id, parameter_id, channel) | |||
def set_program(self, plugin_id, program_id): | |||
self.lib.set_program(plugin_id, program_id) | |||
@@ -27,7 +27,7 @@ from shared_carla import * | |||
global carla_name, lo_target | |||
carla_name = "" | |||
lo_target = None | |||
lo_target = None | |||
Carla.isControl = True | |||
@@ -53,27 +53,23 @@ class ControlServer(ServerThread): | |||
@make_method('/carla-control/set_plugin_data', 'iiiissssh') | |||
def set_plugin_data_callback(self, path, args): | |||
pluginId, ptype, category, hints, realName, label, maker, copyright, uniqueId = args | |||
self.parent.emit(SIGNAL("SetPluginData(int, int, int, int, QString, QString, QString, QString, long)"), | |||
pluginId, ptype, category, hints, realName, label, maker, copyright, uniqueId) | |||
pluginId, ptype, category, hints, realName, label, maker, copyright_, uniqueId = args | |||
self.parent.emit(SIGNAL("SetPluginData(int, int, int, int, QString, QString, QString, QString, long)"), pluginId, ptype, category, hints, realName, label, maker, copyright_, uniqueId) | |||
@make_method('/carla-control/set_plugin_ports', 'iiiiiiii') | |||
def set_plugin_ports_callback(self, path, args): | |||
pluginId, audioIns, audioOuts, midiIns, midiOuts, cIns, cOuts, cTotals = args | |||
self.parent.emit(SIGNAL("SetPluginPorts(int, int, int, int, int, int, int, int)"), | |||
pluginId, audioIns, audioOuts, midiIns, midiOuts, cIns, cOuts, cTotals) | |||
self.parent.emit(SIGNAL("SetPluginPorts(int, int, int, int, int, int, int, int)"), pluginId, audioIns, audioOuts, midiIns, midiOuts, cIns, cOuts, cTotals) | |||
@make_method('/carla-control/set_parameter_data', 'iiiissd') | |||
def set_parameter_data_callback(self, path, args): | |||
pluginId, index, type, hints, name, label, current = args | |||
self.parent.emit(SIGNAL("SetParameterData(int, int, int, int, QString, QString, double)"), | |||
pluginId, index, type, hints, name, label, current) | |||
pluginId, index, type_, hints, name, label, current = args | |||
self.parent.emit(SIGNAL("SetParameterData(int, int, int, int, QString, QString, double)"), pluginId, index, type_, hints, name, label, current) | |||
@make_method('/carla-control/set_parameter_ranges', 'iidddddd') | |||
def set_parameter_ranges_callback(self, path, args): | |||
pluginId, index, min, max, def, step, stepSmall, stepLarge = args | |||
self.parent.emit(SIGNAL("SetParameterRanges(int, int, double, double, double, double, double, double, double)"), | |||
pluginId, index, min, max, def, step, stepSmall, stepLarge) | |||
pluginId, index, min_, max_, def_, step, stepSmall, stepLarge = args | |||
self.parent.emit(SIGNAL("SetParameterRanges(int, int, double, double, double, double, double, double, double)"), pluginId, index, min_, max_, def_, step, stepSmall, stepLarge) | |||
@make_method('/carla-control/set_parameter_midi_cc', 'iii') | |||
def set_parameter_midi_cc_callback(self, path, args): | |||
@@ -105,11 +101,6 @@ class ControlServer(ServerThread): | |||
pluginId, count = args | |||
self.parent.emit(SIGNAL("SetProgramCount(int, int)"), pluginId, count) | |||
#void osc_send_set_program_name(int plugin_id, int program_id, const char* program_name); | |||
#void osc_send_set_midi_program(int plugin_id, int midi_program_id); | |||
#void osc_send_set_midi_program_count(int plugin_id, int midi_program_count); | |||
#void osc_send_set_midi_program_data(int plugin_id, int midi_program_id, int bank_id, int program_id, const char* midi_program_name); | |||
@make_method('/carla-control/set_program_name', 'iis') | |||
def set_program_name_callback(self, path, args): | |||
pluginId, index, name = args | |||
@@ -126,99 +117,101 @@ class ControlServer(ServerThread): | |||
self.parent.emit(SIGNAL("SetMidiProgram(int, int)"), pluginId, count) | |||
@make_method('/carla-control/set_midi_program_data', 'iiiiis') | |||
def set_program_name_callback(self, path, args): | |||
def set_midi_program_data_callback(self, path, args): | |||
pluginId, index, bank, program, name = args | |||
self.parent.emit(SIGNAL("SetMidiProgramName(int, int, int, int, int, QString)"), pluginId, index, bank, program, name) | |||
@make_method('/carla-control/set_input_peak_value', 'iif') | |||
@make_method('/carla-control/set_input_peak_value', 'iid') | |||
def set_input_peak_value_callback(self, path, args): | |||
plugin_id, port_id, value = args | |||
self.parent.emit(SIGNAL("SetInputPeakValue(int, int, double)"), plugin_id, port_id, value) | |||
pluginId, portId, value = args | |||
self.parent.emit(SIGNAL("SetInputPeakValue(int, int, double)"), pluginId, portId, value) | |||
@make_method('/carla-control/set_output_peak_value', 'iif') | |||
@make_method('/carla-control/set_output_peak_value', 'iid') | |||
def set_output_peak_value_callback(self, path, args): | |||
plugin_id, port_id, value = args | |||
self.parent.emit(SIGNAL("SetOutputPeakValue(int, int, double)"), plugin_id, port_id, value) | |||
pluginId, portId, value = args | |||
self.parent.emit(SIGNAL("SetOutputPeakValue(int, int, double)"), pluginId, portId, value) | |||
@make_method('/carla-control/note_on', 'iii') | |||
@make_method('/carla-control/note_on', 'iiii') | |||
def note_on_callback(self, path, args): | |||
plugin_id, note, velo = args | |||
self.parent.emit(SIGNAL("NoteOn(int, int, int)"), plugin_id, note, velo) | |||
pluginId, channel, note, velo = args | |||
self.parent.emit(SIGNAL("NoteOn(int, int, int, int)"), pluginId, channel, note, velo) | |||
@make_method('/carla-control/note_off', 'iii') | |||
def note_off_callback(self, path, args): | |||
plugin_id, note, velo = args | |||
self.parent.emit(SIGNAL("NoteOff(int, int, int)"), plugin_id, note, velo) | |||
pluginId, channel, note = args | |||
self.parent.emit(SIGNAL("NoteOff(int, int, int)"), pluginId, channel, note) | |||
@make_method('/carla-control/exit', '') | |||
def exit_callback(self, path, args): | |||
self.parent.emit(SIGNAL("Exit()")) | |||
#void osc_send_set_input_peak_value(int plugin_id, int port_id, double value); | |||
#void osc_send_set_output_peak_value(int plugin_id, int port_id, double value); | |||
#void osc_send_note_on(int plugin_id, int channel, int note, int velo); | |||
#void osc_send_note_off(int plugin_id, int channel, int note); | |||
#void osc_send_exit(); | |||
@make_method(None, None) | |||
def fallback(self, path, args): | |||
pass | |||
#print "received unknown message '%s'" % path, ":", len(args), ":", args | |||
print("ControlServer::fallback(\"%s\") - unknown message, args =" % path, args) | |||
# Python Object class compatible to 'Host' on the Carla Backend code | |||
class Host(object): | |||
def __init__(self): | |||
super(Host, self).__init__() | |||
def set_active(self, plugin_id, active): | |||
def set_active(self, plugin_id, onoff): | |||
global carla_name, to_target | |||
osc_control = "/%s/%i/set_active" % (carla_name, plugin_id) | |||
lo_send(lo_target, osc_control, 1 if (active) else 0) | |||
lo_path = "/%s/%i/set_active" % (carla_name, plugin_id) | |||
lo_send(lo_target, lo_path, 1 if onoff else 0) | |||
def set_drywet(self, plugin_id, value): | |||
global carla_name, to_target | |||
osc_control = "/%s/%i/set_drywet" % (carla_name, plugin_id) | |||
lo_send(lo_target, osc_control, value) | |||
lo_path = "/%s/%i/set_drywet" % (carla_name, plugin_id) | |||
lo_send(lo_target, lo_path, value) | |||
def set_vol(self, plugin_id, value): | |||
def set_volume(self, plugin_id, value): | |||
global carla_name, to_target | |||
osc_control = "/%s/%i/set_vol" % (carla_name, plugin_id) | |||
lo_send(lo_target, osc_control, value) | |||
lo_path = "/%s/%i/set_volume" % (carla_name, plugin_id) | |||
lo_send(lo_target, lo_path, value) | |||
def set_balance_left(self, plugin_id, value): | |||
global carla_name, to_target | |||
osc_control = "/%s/%i/set_balance_left" % (carla_name, plugin_id) | |||
lo_send(lo_target, osc_control, value) | |||
lo_path = "/%s/%i/set_balance_left" % (carla_name, plugin_id) | |||
lo_send(lo_target, lo_path, value) | |||
def set_balance_right(self, plugin_id, value): | |||
global carla_name, to_target | |||
osc_control = "/%s/%i/set_balance_right" % (carla_name, plugin_id) | |||
lo_send(lo_target, osc_control, value) | |||
lo_path = "/%s/%i/set_balance_right" % (carla_name, plugin_id) | |||
lo_send(lo_target, lo_path, value) | |||
def set_parameter_value(self, plugin_id, param_id, value): | |||
def set_parameter_value(self, plugin_id, parameter_id, value): | |||
global carla_name, to_target | |||
osc_control = "/%s/%i/set_parameter" % (carla_name, plugin_id) | |||
lo_send(lo_target, osc_control, param_id, value) | |||
lo_path = "/%s/%i/set_parameter_value" % (carla_name, plugin_id) | |||
lo_send(lo_target, lo_path, parameter_id, value) | |||
def set_program(self, plugin_id, program_id): | |||
def set_parameter_midi_cc(self, plugin_id, parameter_id, midi_cc): | |||
global carla_name, to_target | |||
osc_control = "/%s/%i/set_program" % (carla_name, plugin_id) | |||
lo_send(lo_target, osc_control, program_id) | |||
lo_path = "/%s/%i/set_parameter_midi_cc" % (carla_name, plugin_id) | |||
lo_send(lo_target, lo_path, parameter_id, midi_cc) | |||
def set_midi_program(self, plugin_id, midi_program_id): | |||
def set_parameter_midi_channel(self, plugin_id, parameter_id, channel): | |||
global carla_name, to_target | |||
osc_control = "/%s/%i/set_midi_program" % (carla_name, plugin_id) | |||
lo_send(lo_target, osc_control, midi_program_id) | |||
lo_path = "/%s/%i/set_parameter_midi_channel" % (carla_name, plugin_id) | |||
lo_send(lo_target, lo_path, parameter_id, channel) | |||
def note_on(self, plugin_id, note, velo): | |||
def set_program(self, plugin_id, program_id): | |||
global carla_name, to_target | |||
osc_control = "/%s/%i/note_on" % (carla_name, plugin_id) | |||
lo_send(lo_target, osc_control, note, velo) | |||
lo_path = "/%s/%i/set_program" % (carla_name, plugin_id) | |||
lo_send(lo_target, lo_path, program_id) | |||
def note_off(self, plugin_id, param_id, value): | |||
def set_midi_program(self, plugin_id, midi_program_id): | |||
global carla_name, to_target | |||
osc_control = "/%s/%i/note_off" % (carla_name, plugin_id) | |||
lo_send(lo_target, osc_control, note, velo) | |||
lo_path = "/%s/%i/set_midi_program" % (carla_name, plugin_id) | |||
lo_send(lo_target, lo_path, midi_program_id) | |||
def send_midi_note(self, plugin_id, channel, note, velocity): | |||
global carla_name, to_target | |||
if velocity: | |||
lo_path = "/%s/%i/note_on" % (carla_name, plugin_id) | |||
lo_send(lo_target, lo_path, channel, note, velocity) | |||
else: | |||
lo_path = "/%s/%i/note_off" % (carla_name, plugin_id) | |||
lo_send(lo_target, lo_path, channel, note) | |||
# About Carla Dialog | |||
class AboutW(QDialog, ui_carla_about.Ui_CarlaAboutW): | |||
@@ -242,30 +235,30 @@ class CarlaControlW(QMainWindow, ui_carla_control.Ui_CarlaControlW): | |||
super(CarlaControlW, self).__init__(parent) | |||
self.setupUi(self) | |||
#self.settings = QSettings("Cadence", "Carla-Control") | |||
#self.loadSettings() | |||
self.settings = QSettings("Cadence", "Carla-Control") | |||
self.loadSettings() | |||
#self.lo_address = "" | |||
#self.lo_server = None | |||
#self.setStyleSheet(""" | |||
#QWidget#centralwidget { | |||
#background-color: qlineargradient(spread:pad, | |||
#x1:0.0, y1:0.0, | |||
#x2:0.2, y2:1.0, | |||
#stop:0 rgb( 7, 7, 7), | |||
#stop:1 rgb(28, 28, 28) | |||
#); | |||
#} | |||
#""") | |||
#self.plugin_list = [] | |||
#for x in range(MAX_PLUGINS): | |||
#self.plugin_list.append(None) | |||
self.lo_address = "" | |||
self.lo_server = None | |||
#self.act_file_refresh.setEnabled(False) | |||
self.setStyleSheet(""" | |||
QWidget#centralwidget { | |||
background-color: qlineargradient(spread:pad, | |||
x1:0.0, y1:0.0, | |||
x2:0.2, y2:1.0, | |||
stop:0 rgb( 7, 7, 7), | |||
stop:1 rgb(28, 28, 28) | |||
); | |||
} | |||
""") | |||
self.plugin_list = [] | |||
for x in range(MAX_PLUGINS): | |||
self.plugin_list.append(None) | |||
self.act_file_refresh.setEnabled(False) | |||
#self.resize(self.width(), 0) | |||
self.resize(self.width(), 0) | |||
#self.connect(self.act_file_connect, SIGNAL("triggered()"), self.do_connect) | |||
#self.connect(self.act_file_refresh, SIGNAL("triggered()"), self.do_refresh) | |||
@@ -457,17 +450,17 @@ class CarlaControlW(QMainWindow, ui_carla_control.Ui_CarlaControlW): | |||
#AboutW(self).exec_() | |||
def saveSettings(self): | |||
self.settings.setValue("Geometry", QVariant(self.saveGeometry())) | |||
self.settings.setValue("Geometry", self.saveGeometry()) | |||
def loadSettings(self): | |||
self.restoreGeometry(self.settings.value("Geometry").toByteArray()) | |||
self.restoreGeometry(self.settings.value("Geometry", "")) | |||
def closeEvent(self, event): | |||
self.saveSettings() | |||
#global lo_target | |||
#if (lo_target and self.lo_server): | |||
#lo_send(lo_target, "unregister") | |||
global lo_target | |||
if lo_target and self.lo_server: | |||
lo_send(lo_target, "unregister") | |||
QMainWindow.closeEvent(self, event) | |||