|
|
@@ -1453,11 +1453,18 @@ void CarlaPlugin::setProgram(int32_t index, const bool sendGui, const bool sendO |
|
|
|
if (index > static_cast<int32_t>(kData->prog.count)) |
|
|
|
return; |
|
|
|
|
|
|
|
const int32_t fixedIndex = carla_fixValue<int32_t>(-1, kData->prog.count, index); |
|
|
|
const int32_t fixedIndex(carla_fixValue<int32_t>(-1, kData->prog.count, index)); |
|
|
|
|
|
|
|
kData->prog.current = fixedIndex; |
|
|
|
|
|
|
|
// Change default parameter values |
|
|
|
#ifndef BUILD_BRIDGE |
|
|
|
if (sendOsc) |
|
|
|
kData->engine->osc_send_control_set_program(fId, fixedIndex); |
|
|
|
#endif |
|
|
|
|
|
|
|
if (sendCallback) |
|
|
|
kData->engine->callback(CALLBACK_PROGRAM_CHANGED, fId, fixedIndex, 0, 0.0f, nullptr); |
|
|
|
|
|
|
|
if (fixedIndex >= 0) |
|
|
|
{ |
|
|
|
#ifndef BUILD_BRIDGE |
|
|
@@ -1465,30 +1472,30 @@ void CarlaPlugin::setProgram(int32_t index, const bool sendGui, const bool sendO |
|
|
|
uiProgramChange(fixedIndex); |
|
|
|
#endif |
|
|
|
|
|
|
|
if (type() == PLUGIN_GIG || type() == PLUGIN_SF2 || type() == PLUGIN_SFZ) |
|
|
|
return; |
|
|
|
|
|
|
|
for (uint32_t i=0; i < kData->param.count; ++i) |
|
|
|
{ |
|
|
|
// FIXME? |
|
|
|
kData->param.ranges[i].def = getParameterValue(i); |
|
|
|
kData->param.ranges[i].fixDefault(); |
|
|
|
const float value(kData->param.ranges[i].fixValue(getParameterValue(i))); |
|
|
|
|
|
|
|
kData->param.ranges[i].def = value;; |
|
|
|
|
|
|
|
#ifndef BUILD_BRIDGE |
|
|
|
if (sendOsc) |
|
|
|
{ |
|
|
|
kData->engine->osc_send_control_set_default_value(fId, i, kData->param.ranges[i].def); |
|
|
|
kData->engine->osc_send_control_set_parameter_value(fId, i, kData->param.ranges[i].def); |
|
|
|
kData->engine->osc_send_control_set_default_value(fId, i, value); |
|
|
|
kData->engine->osc_send_control_set_parameter_value(fId, i, value); |
|
|
|
} |
|
|
|
#endif |
|
|
|
if (sendCallback) |
|
|
|
{ |
|
|
|
kData->engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, fId, i, 0, value, nullptr); |
|
|
|
kData->engine->callback(CALLBACK_PARAMETER_DEFAULT_CHANGED, fId, i, 0, value, nullptr); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#ifndef BUILD_BRIDGE |
|
|
|
if (sendOsc) |
|
|
|
kData->engine->osc_send_control_set_program(fId, fixedIndex); |
|
|
|
#endif |
|
|
|
|
|
|
|
if (sendCallback) |
|
|
|
kData->engine->callback(CALLBACK_PROGRAM_CHANGED, fId, fixedIndex, 0, 0.0f, nullptr); |
|
|
|
|
|
|
|
#ifdef BUILD_BRIDGE |
|
|
|
return; |
|
|
|
|
|
|
@@ -1508,10 +1515,18 @@ void CarlaPlugin::setMidiProgram(int32_t index, const bool sendGui, const bool s |
|
|
|
if (index > static_cast<int32_t>(kData->midiprog.count)) |
|
|
|
return; |
|
|
|
|
|
|
|
const int32_t fixedIndex = carla_fixValue<int32_t>(-1, kData->midiprog.count, index); |
|
|
|
const int32_t fixedIndex(carla_fixValue<int32_t>(-1, kData->midiprog.count, index)); |
|
|
|
|
|
|
|
kData->midiprog.current = fixedIndex; |
|
|
|
|
|
|
|
#ifndef BUILD_BRIDGE |
|
|
|
if (sendOsc) |
|
|
|
kData->engine->osc_send_control_set_midi_program(fId, fixedIndex); |
|
|
|
#endif |
|
|
|
|
|
|
|
if (sendCallback) |
|
|
|
kData->engine->callback(CALLBACK_MIDI_PROGRAM_CHANGED, fId, fixedIndex, 0, 0.0f, nullptr); |
|
|
|
|
|
|
|
if (fixedIndex >= 0) |
|
|
|
{ |
|
|
|
#ifndef BUILD_BRIDGE |
|
|
@@ -1519,34 +1534,30 @@ void CarlaPlugin::setMidiProgram(int32_t index, const bool sendGui, const bool s |
|
|
|
uiMidiProgramChange(fixedIndex); |
|
|
|
#endif |
|
|
|
|
|
|
|
// Change default parameter values (sound banks never change defaults) |
|
|
|
if (type() != PLUGIN_GIG && type() != PLUGIN_SF2 && type() != PLUGIN_SFZ) |
|
|
|
if (type() == PLUGIN_GIG || type() == PLUGIN_SF2 || type() == PLUGIN_SFZ) |
|
|
|
return; |
|
|
|
|
|
|
|
for (uint32_t i=0; i < kData->param.count; ++i) |
|
|
|
{ |
|
|
|
for (uint32_t i=0; i < kData->param.count; ++i) |
|
|
|
{ |
|
|
|
// FIXME? |
|
|
|
kData->param.ranges[i].def = getParameterValue(i); |
|
|
|
kData->param.ranges[i].fixDefault(); |
|
|
|
const float value(kData->param.ranges[i].fixValue(getParameterValue(i))); |
|
|
|
|
|
|
|
kData->param.ranges[i].def = value;; |
|
|
|
|
|
|
|
#ifndef BUILD_BRIDGE |
|
|
|
if (sendOsc) |
|
|
|
{ |
|
|
|
kData->engine->osc_send_control_set_default_value(fId, i, kData->param.ranges[i].def); |
|
|
|
kData->engine->osc_send_control_set_parameter_value(fId, i, kData->param.ranges[i].def); |
|
|
|
} |
|
|
|
if (sendOsc) |
|
|
|
{ |
|
|
|
kData->engine->osc_send_control_set_default_value(fId, i, value); |
|
|
|
kData->engine->osc_send_control_set_parameter_value(fId, i, value); |
|
|
|
} |
|
|
|
#endif |
|
|
|
if (sendCallback) |
|
|
|
{ |
|
|
|
kData->engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, fId, i, 0, value, nullptr); |
|
|
|
kData->engine->callback(CALLBACK_PARAMETER_DEFAULT_CHANGED, fId, i, 0, value, nullptr); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#ifndef BUILD_BRIDGE |
|
|
|
if (sendOsc) |
|
|
|
kData->engine->osc_send_control_set_midi_program(fId, fixedIndex); |
|
|
|
#endif |
|
|
|
|
|
|
|
if (sendCallback) |
|
|
|
kData->engine->callback(CALLBACK_MIDI_PROGRAM_CHANGED, fId, fixedIndex, 0, 0.0f, nullptr); |
|
|
|
|
|
|
|
#ifdef BUILD_BRIDGE |
|
|
|
return; |
|
|
|
|
|
|
|