@@ -611,7 +611,7 @@ public: | |||
* @param sendOsc Send message change over OSC | |||
* @param sendCallback Send message change to registered callback | |||
*/ | |||
virtual void setProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept; | |||
virtual void setProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback, const bool doingInit = false) noexcept; | |||
/*! | |||
* Change the current MIDI plugin program to @a index. | |||
@@ -624,7 +624,7 @@ public: | |||
* @param sendOsc Send message change over OSC | |||
* @param sendCallback Send message change to registered callback | |||
*/ | |||
virtual void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept; | |||
virtual void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback, const bool doingInit = false) noexcept; | |||
/*! | |||
* This is an overloaded call to setMidiProgram(). | |||
@@ -985,8 +985,6 @@ bool carla_export_plugin_lv2(uint pluginId, const char* lv2path) | |||
const CarlaPluginInfo* carla_get_plugin_info(uint pluginId) | |||
{ | |||
carla_debug("carla_get_plugin_info(%i)", pluginId); | |||
static CarlaPluginInfo retInfo; | |||
// reset | |||
@@ -1024,6 +1022,8 @@ const CarlaPluginInfo* carla_get_plugin_info(uint pluginId) | |||
CarlaPlugin* const plugin(gStandalone.engine->getPlugin(pluginId)); | |||
CARLA_SAFE_ASSERT_RETURN(plugin != nullptr, &retInfo); | |||
carla_debug("carla_get_plugin_info(%i)", pluginId); | |||
char strBuf[STR_MAX+1]; | |||
retInfo.type = plugin->getType(); | |||
@@ -1061,8 +1061,6 @@ const CarlaPluginInfo* carla_get_plugin_info(uint pluginId) | |||
const CarlaPortCountInfo* carla_get_audio_port_count_info(uint pluginId) | |||
{ | |||
carla_debug("carla_get_audio_port_count_info(%i)", pluginId); | |||
static CarlaPortCountInfo retInfo; | |||
carla_zeroStruct(retInfo); | |||
@@ -1071,21 +1069,15 @@ const CarlaPortCountInfo* carla_get_audio_port_count_info(uint pluginId) | |||
CarlaPlugin* const plugin(gStandalone.engine->getPlugin(pluginId)); | |||
CARLA_SAFE_ASSERT_RETURN(plugin != nullptr, &retInfo); | |||
if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId)) | |||
{ | |||
retInfo.ins = plugin->getAudioInCount(); | |||
retInfo.outs = plugin->getAudioOutCount(); | |||
return &retInfo; | |||
} | |||
carla_debug("carla_get_audio_port_count_info(%i)", pluginId); | |||
carla_stderr2("carla_get_audio_port_count_info(%i) - could not find plugin", pluginId); | |||
retInfo.ins = plugin->getAudioInCount(); | |||
retInfo.outs = plugin->getAudioOutCount(); | |||
return &retInfo; | |||
} | |||
const CarlaPortCountInfo* carla_get_midi_port_count_info(uint pluginId) | |||
{ | |||
carla_debug("carla_get_midi_port_count_info(%i)", pluginId); | |||
static CarlaPortCountInfo retInfo; | |||
carla_zeroStruct(retInfo); | |||
@@ -1094,21 +1086,15 @@ const CarlaPortCountInfo* carla_get_midi_port_count_info(uint pluginId) | |||
CarlaPlugin* const plugin(gStandalone.engine->getPlugin(pluginId)); | |||
CARLA_SAFE_ASSERT_RETURN(plugin != nullptr, &retInfo); | |||
if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId)) | |||
{ | |||
retInfo.ins = plugin->getMidiInCount(); | |||
retInfo.outs = plugin->getMidiOutCount(); | |||
return &retInfo; | |||
} | |||
carla_debug("carla_get_midi_port_count_info(%i)", pluginId); | |||
carla_stderr2("carla_get_midi_port_count_info(%i) - could not find plugin", pluginId); | |||
retInfo.ins = plugin->getMidiInCount(); | |||
retInfo.outs = plugin->getMidiOutCount(); | |||
return &retInfo; | |||
} | |||
const CarlaPortCountInfo* carla_get_parameter_count_info(uint pluginId) | |||
{ | |||
carla_debug("carla_get_parameter_count_info(%i)", pluginId); | |||
static CarlaPortCountInfo retInfo; | |||
carla_zeroStruct(retInfo); | |||
@@ -1117,20 +1103,14 @@ const CarlaPortCountInfo* carla_get_parameter_count_info(uint pluginId) | |||
CarlaPlugin* const plugin(gStandalone.engine->getPlugin(pluginId)); | |||
CARLA_SAFE_ASSERT_RETURN(plugin != nullptr, &retInfo); | |||
if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId)) | |||
{ | |||
plugin->getParameterCountInfo(retInfo.ins, retInfo.outs); | |||
return &retInfo; | |||
} | |||
carla_debug("carla_get_parameter_count_info(%i)", pluginId); | |||
carla_stderr2("carla_get_parameter_count_info(%i) - could not find plugin", pluginId); | |||
plugin->getParameterCountInfo(retInfo.ins, retInfo.outs); | |||
return &retInfo; | |||
} | |||
const CarlaParameterInfo* carla_get_parameter_info(uint pluginId, uint32_t parameterId) | |||
{ | |||
carla_debug("carla_get_parameter_info(%i, %i)", pluginId, parameterId); | |||
static CarlaParameterInfo retInfo; | |||
// reset | |||
@@ -1160,46 +1140,39 @@ const CarlaParameterInfo* carla_get_parameter_info(uint pluginId, uint32_t param | |||
CarlaPlugin* const plugin(gStandalone.engine->getPlugin(pluginId)); | |||
CARLA_SAFE_ASSERT_RETURN(plugin != nullptr, &retInfo); | |||
if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId)) | |||
{ | |||
if (parameterId < plugin->getParameterCount()) | |||
{ | |||
char strBufName[STR_MAX+1]; | |||
char strBufSymbol[STR_MAX+1]; | |||
char strBufUnit[STR_MAX+1]; | |||
carla_debug("carla_get_parameter_info(%i, %i)", pluginId, parameterId); | |||
CARLA_SAFE_ASSERT_RETURN(parameterId < plugin->getParameterCount(), &retInfo); | |||
carla_zeroChars(strBufName, STR_MAX+1); | |||
carla_zeroChars(strBufSymbol, STR_MAX+1); | |||
carla_zeroChars(strBufUnit, STR_MAX+1); | |||
// TODO | |||
retInfo.scalePointCount = plugin->getParameterScalePointCount(parameterId); | |||
char strBufName[STR_MAX+1]; | |||
char strBufSymbol[STR_MAX+1]; | |||
char strBufUnit[STR_MAX+1]; | |||
plugin->getParameterName(parameterId, strBufName); | |||
retInfo.name = carla_strdup_safe(strBufName); | |||
carla_zeroChars(strBufName, STR_MAX+1); | |||
carla_zeroChars(strBufSymbol, STR_MAX+1); | |||
carla_zeroChars(strBufUnit, STR_MAX+1); | |||
plugin->getParameterSymbol(parameterId, strBufSymbol); | |||
retInfo.symbol = carla_strdup_safe(strBufSymbol); | |||
retInfo.scalePointCount = plugin->getParameterScalePointCount(parameterId); | |||
plugin->getParameterUnit(parameterId, strBufUnit); | |||
retInfo.unit = carla_strdup_safe(strBufUnit); | |||
plugin->getParameterName(parameterId, strBufName); | |||
retInfo.name = carla_strdup_safe(strBufName); | |||
checkStringPtr(retInfo.name); | |||
checkStringPtr(retInfo.symbol); | |||
checkStringPtr(retInfo.unit); | |||
} | |||
else | |||
carla_stderr2("carla_get_parameter_info(%i, %i) - parameterId out of bounds", pluginId, parameterId); | |||
plugin->getParameterSymbol(parameterId, strBufSymbol); | |||
retInfo.symbol = carla_strdup_safe(strBufSymbol); | |||
return &retInfo; | |||
} | |||
plugin->getParameterUnit(parameterId, strBufUnit); | |||
retInfo.unit = carla_strdup_safe(strBufUnit); | |||
checkStringPtr(retInfo.name); | |||
checkStringPtr(retInfo.symbol); | |||
checkStringPtr(retInfo.unit); | |||
carla_stderr2("carla_get_parameter_info(%i, %i) - could not find plugin", pluginId, parameterId); | |||
return &retInfo; | |||
} | |||
const CarlaScalePointInfo* carla_get_parameter_scalepoint_info(uint pluginId, uint32_t parameterId, uint32_t scalePointId) | |||
{ | |||
carla_debug("carla_get_parameter_scalepoint_info(%i, %i, %i)", pluginId, parameterId, scalePointId); | |||
CARLA_ASSERT(gStandalone.engine != nullptr); | |||
static CarlaScalePointInfo retInfo; | |||
@@ -1219,31 +1192,21 @@ const CarlaScalePointInfo* carla_get_parameter_scalepoint_info(uint pluginId, ui | |||
CarlaPlugin* const plugin(gStandalone.engine->getPlugin(pluginId)); | |||
CARLA_SAFE_ASSERT_RETURN(plugin != nullptr, &retInfo); | |||
if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId)) | |||
{ | |||
if (parameterId < plugin->getParameterCount()) | |||
{ | |||
if (scalePointId < plugin->getParameterScalePointCount(parameterId)) | |||
{ | |||
char strBufLabel[STR_MAX+1]; | |||
carla_zeroChars(strBufLabel, STR_MAX+1); | |||
retInfo.value = plugin->getParameterScalePointValue(parameterId, scalePointId); | |||
plugin->getParameterScalePointLabel(parameterId, scalePointId, strBufLabel); | |||
retInfo.label = carla_strdup_safe(strBufLabel); | |||
checkStringPtr(retInfo.label); | |||
} | |||
else | |||
carla_stderr2("carla_get_parameter_scalepoint_info(%i, %i, %i) - scalePointId out of bounds", pluginId, parameterId, scalePointId); | |||
} | |||
else | |||
carla_stderr2("carla_get_parameter_scalepoint_info(%i, %i, %i) - parameterId out of bounds", pluginId, parameterId, scalePointId); | |||
carla_debug("carla_get_parameter_scalepoint_info(%i, %i, %i)", pluginId, parameterId, scalePointId); | |||
CARLA_SAFE_ASSERT_RETURN(parameterId < plugin->getParameterCount(), &retInfo); | |||
CARLA_SAFE_ASSERT_RETURN(scalePointId < plugin->getParameterScalePointCount(parameterId), &retInfo); | |||
return &retInfo; | |||
} | |||
// TODO | |||
char strBufLabel[STR_MAX+1]; | |||
carla_zeroChars(strBufLabel, STR_MAX+1); | |||
retInfo.value = plugin->getParameterScalePointValue(parameterId, scalePointId); | |||
plugin->getParameterScalePointLabel(parameterId, scalePointId, strBufLabel); | |||
retInfo.label = carla_strdup_safe(strBufLabel); | |||
checkStringPtr(retInfo.label); | |||
carla_stderr2("carla_get_parameter_scalepoint_info(%i, %i, %i) - could not find plugin", pluginId, parameterId, scalePointId); | |||
return &retInfo; | |||
} | |||
@@ -1317,7 +1280,7 @@ const MidiProgramData* carla_get_midi_program_data(uint pluginId, uint32_t midiP | |||
retMidiProgData.bank = 0; | |||
retMidiProgData.program = 0; | |||
if (retMidiProgData.name != nullptr) | |||
if (retMidiProgData.name != gNullCharPtr) | |||
{ | |||
delete[] retMidiProgData.name; | |||
retMidiProgData.name = gNullCharPtr; | |||
@@ -1334,8 +1297,17 @@ const MidiProgramData* carla_get_midi_program_data(uint pluginId, uint32_t midiP | |||
const MidiProgramData& pluginMidiProgData(plugin->getMidiProgramData(midiProgramId)); | |||
retMidiProgData.bank = pluginMidiProgData.bank; | |||
retMidiProgData.program = pluginMidiProgData.program; | |||
retMidiProgData.name = carla_strdup_safe(pluginMidiProgData.name); | |||
checkStringPtr(retMidiProgData.name); | |||
if (pluginMidiProgData.name != nullptr) | |||
{ | |||
retMidiProgData.name = carla_strdup_safe(pluginMidiProgData.name); | |||
checkStringPtr(retMidiProgData.name); | |||
} | |||
else | |||
{ | |||
retMidiProgData.name = gNullCharPtr; | |||
} | |||
return &retMidiProgData; | |||
} | |||
@@ -1666,7 +1666,7 @@ void CarlaPlugin::setChunkData(const void* const data, const std::size_t dataSiz | |||
CARLA_SAFE_ASSERT(false); // this should never happen | |||
} | |||
void CarlaPlugin::setProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept | |||
void CarlaPlugin::setProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback, const bool) noexcept | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->prog.count),); | |||
@@ -1707,7 +1707,7 @@ void CarlaPlugin::setProgram(const int32_t index, const bool sendGui, const bool | |||
return; (void)sendOsc; | |||
} | |||
void CarlaPlugin::setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept | |||
void CarlaPlugin::setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback, const bool) noexcept | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->midiprog.count),); | |||
@@ -734,10 +734,10 @@ public: | |||
CarlaPlugin::setParameterMidiCC(parameterId, cc, sendOsc, sendCallback); | |||
} | |||
void setProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept override | |||
void setProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback, const bool doingInit) noexcept override | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->prog.count),); | |||
CARLA_SAFE_ASSERT_RETURN(sendGui || sendOsc || sendCallback,); | |||
CARLA_SAFE_ASSERT_RETURN(sendGui || sendOsc || sendCallback || doingInit,); | |||
{ | |||
const CarlaMutexLocker _cml(fShmNonRtClientControl.mutex); | |||
@@ -747,13 +747,13 @@ public: | |||
fShmNonRtClientControl.commitWrite(); | |||
} | |||
CarlaPlugin::setProgram(index, sendGui, sendOsc, sendCallback); | |||
CarlaPlugin::setProgram(index, sendGui, sendOsc, sendCallback, doingInit); | |||
} | |||
void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept override | |||
void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback, const bool doingInit) noexcept override | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->midiprog.count),); | |||
CARLA_SAFE_ASSERT_RETURN(sendGui || sendOsc || sendCallback,); | |||
CARLA_SAFE_ASSERT_RETURN(sendGui || sendOsc || sendCallback || doingInit,); | |||
{ | |||
const CarlaMutexLocker _cml(fShmNonRtClientControl.mutex); | |||
@@ -763,7 +763,7 @@ public: | |||
fShmNonRtClientControl.commitWrite(); | |||
} | |||
CarlaPlugin::setMidiProgram(index, sendGui, sendOsc, sendCallback); | |||
CarlaPlugin::setMidiProgram(index, sendGui, sendOsc, sendCallback, doingInit); | |||
} | |||
void setMidiProgramRT(const uint32_t uindex) noexcept override | |||
@@ -640,12 +640,12 @@ public: | |||
pData->updateParameterValues(this, sendOsc, true, false); | |||
} | |||
void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept override | |||
void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback, const bool doingInit) noexcept override | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(fDssiDescriptor != nullptr,); | |||
CARLA_SAFE_ASSERT_RETURN(fDssiDescriptor->select_program != nullptr,); | |||
CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->midiprog.count),); | |||
CARLA_SAFE_ASSERT_RETURN(sendGui || sendOsc || sendCallback,); | |||
CARLA_SAFE_ASSERT_RETURN(sendGui || sendOsc || sendCallback || doingInit,); | |||
if (index >= 0 && fHandles.count() > 0) | |||
{ | |||
@@ -654,7 +654,7 @@ public: | |||
setMidiProgramInDSSI(static_cast<uint32_t>(index)); | |||
} | |||
CarlaPlugin::setMidiProgram(index, sendGui, sendOsc, sendCallback); | |||
CarlaPlugin::setMidiProgram(index, sendGui, sendOsc, sendCallback, doingInit); | |||
} | |||
void setMidiProgramRT(const uint32_t uindex) noexcept override | |||
@@ -1233,7 +1233,7 @@ public: | |||
if (doInit) | |||
{ | |||
if (newCount > 0) | |||
setMidiProgram(0, false, false, false); | |||
setMidiProgram(0, false, false, false, true); | |||
} | |||
else | |||
{ | |||
@@ -1271,7 +1271,7 @@ public: | |||
} | |||
if (programChanged) | |||
setMidiProgram(pData->midiprog.current, true, true, true); | |||
setMidiProgram(pData->midiprog.current, true, true, true, false); | |||
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PROGRAMS, pData->id, 0, 0, 0.0f, nullptr); | |||
} | |||
@@ -527,11 +527,11 @@ public: | |||
CarlaPlugin::setCustomData(type, key, value, sendGui); | |||
} | |||
void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept override | |||
void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback, const bool doingInit) noexcept override | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(fSynth != nullptr,); | |||
CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->midiprog.count),); | |||
CARLA_SAFE_ASSERT_RETURN(sendGui || sendOsc || sendCallback,); | |||
CARLA_SAFE_ASSERT_RETURN(sendGui || sendOsc || sendCallback || doingInit,); | |||
if (index >= 0 && pData->ctrlChannel >= 0 && pData->ctrlChannel < MAX_MIDI_CHANNELS) | |||
{ | |||
@@ -547,7 +547,7 @@ public: | |||
fCurMidiProgs[pData->ctrlChannel] = index; | |||
} | |||
CarlaPlugin::setMidiProgram(index, sendGui, sendOsc, sendCallback); | |||
CarlaPlugin::setMidiProgram(index, sendGui, sendOsc, sendCallback, doingInit); | |||
} | |||
void setMidiProgramRT(const uint32_t uindex) noexcept override | |||
@@ -1223,7 +1223,7 @@ public: | |||
CarlaPlugin::setCustomData(type, key, value, sendGui); | |||
} | |||
void setProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept override | |||
void setProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback, const bool doingInit) noexcept override | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); | |||
CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->prog.count),); | |||
@@ -1238,7 +1238,7 @@ public: | |||
CARLA_SAFE_ASSERT_RETURN(state != nullptr,); | |||
// invalidate midi-program selection | |||
CarlaPlugin::setMidiProgram(-1, false, false, sendCallback); | |||
CarlaPlugin::setMidiProgram(-1, false, false, sendCallback, false); | |||
if (fExt.state != nullptr) | |||
{ | |||
@@ -1257,14 +1257,14 @@ public: | |||
lilv_state_free(state); | |||
} | |||
CarlaPlugin::setProgram(index, sendGui, sendOsc, sendCallback); | |||
CarlaPlugin::setProgram(index, sendGui, sendOsc, sendCallback, doingInit); | |||
} | |||
void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept override | |||
void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback, const bool doingInit) noexcept override | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); | |||
CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->midiprog.count),); | |||
CARLA_SAFE_ASSERT_RETURN(sendGui || sendOsc || sendCallback,); | |||
CARLA_SAFE_ASSERT_RETURN(sendGui || sendOsc || sendCallback || doingInit,); | |||
if (index >= 0 && fExt.programs != nullptr && fExt.programs->select_program != nullptr) | |||
{ | |||
@@ -1285,7 +1285,7 @@ public: | |||
} | |||
} | |||
CarlaPlugin::setMidiProgram(index, sendGui, sendOsc, sendCallback); | |||
CarlaPlugin::setMidiProgram(index, sendGui, sendOsc, sendCallback, doingInit); | |||
} | |||
void setMidiProgramRT(const uint32_t uindex) noexcept override | |||
@@ -2610,7 +2610,7 @@ public: | |||
{ | |||
if (newCount > 0) | |||
{ | |||
setMidiProgram(0, false, false, false); | |||
setMidiProgram(0, false, false, false, true); | |||
} | |||
else | |||
{ | |||
@@ -2662,7 +2662,7 @@ public: | |||
} | |||
if (programChanged) | |||
setMidiProgram(pData->midiprog.current, true, true, true); | |||
setMidiProgram(pData->midiprog.current, true, true, true, false); | |||
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PROGRAMS, pData->id, 0, 0, 0.0f, nullptr); | |||
} | |||
@@ -6358,7 +6358,7 @@ bool CarlaPipeServerLV2::msgReceived(const char* const msg) noexcept | |||
CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(index), true); | |||
try { | |||
kPlugin->setMidiProgram(static_cast<int32_t>(index), false, true, true); | |||
kPlugin->setMidiProgram(static_cast<int32_t>(index), false, true, true, false); | |||
} CARLA_SAFE_EXCEPTION("msgReceived program"); | |||
return true; | |||
@@ -503,10 +503,10 @@ public: | |||
CarlaPlugin::setCustomData(type, key, value, sendGui); | |||
} | |||
void setProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept override | |||
void setProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback, const bool doingInit) noexcept override | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->prog.count),); | |||
CARLA_SAFE_ASSERT_RETURN(sendGui || sendOsc || sendCallback,); | |||
CARLA_SAFE_ASSERT_RETURN(sendGui || sendOsc || sendCallback || doingInit,); | |||
const int8_t channel(kIsGIG ? pData->ctrlChannel : int8_t(0)); | |||
@@ -525,7 +525,7 @@ public: | |||
pData->engine->callback(ENGINE_CALLBACK_PROGRAM_CHANGED, pData->id, index, 0, 0.0f, nullptr); | |||
} | |||
CarlaPlugin::setProgram(index, sendGui, sendOsc, sendCallback); | |||
CarlaPlugin::setProgram(index, sendGui, sendOsc, sendCallback, doingInit); | |||
} | |||
void setProgramRT(const uint32_t uindex) noexcept override | |||
@@ -713,16 +713,16 @@ public: | |||
CarlaPlugin::setCustomData(type, key, value, sendGui); | |||
} | |||
void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept override | |||
void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback, const bool doingInit) noexcept override | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); | |||
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); | |||
CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->midiprog.count),); | |||
CARLA_SAFE_ASSERT_RETURN(sendGui || sendOsc || sendCallback,); | |||
CARLA_SAFE_ASSERT_RETURN(sendGui || sendOsc || sendCallback || doingInit,); | |||
// TODO, put into check below | |||
if ((pData->hints & PLUGIN_IS_SYNTH) != 0 && (pData->ctrlChannel < 0 || pData->ctrlChannel >= MAX_MIDI_CHANNELS)) | |||
return CarlaPlugin::setMidiProgram(index, sendGui, sendOsc, sendCallback); | |||
return CarlaPlugin::setMidiProgram(index, sendGui, sendOsc, sendCallback, doingInit); | |||
if (index >= 0) | |||
{ | |||
@@ -746,7 +746,7 @@ public: | |||
fCurMidiProgs[channel] = index; | |||
} | |||
CarlaPlugin::setMidiProgram(index, sendGui, sendOsc, sendCallback); | |||
CarlaPlugin::setMidiProgram(index, sendGui, sendOsc, sendCallback, doingInit); | |||
} | |||
void setMidiProgramRT(const uint32_t index) noexcept override | |||
@@ -1284,7 +1284,7 @@ public: | |||
if (doInit) | |||
{ | |||
if (count > 0) | |||
setMidiProgram(0, false, false, false); | |||
setMidiProgram(0, false, false, false, true); | |||
} | |||
else | |||
{ | |||
@@ -1322,7 +1322,7 @@ public: | |||
} | |||
if (programChanged) | |||
setMidiProgram(pData->midiprog.current, true, true, true); | |||
setMidiProgram(pData->midiprog.current, true, true, true, false); | |||
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PROGRAMS, pData->id, 0, 0, 0.0f, nullptr); | |||
} | |||
@@ -405,11 +405,11 @@ public: | |||
pData->updateParameterValues(this, sendOsc, true, false); | |||
} | |||
void setProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept override | |||
void setProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback, const bool doingInit) noexcept override | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(fEffect != nullptr,); | |||
CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->prog.count),); | |||
CARLA_SAFE_ASSERT_RETURN(sendGui || sendOsc || sendCallback,); | |||
CARLA_SAFE_ASSERT_RETURN(sendGui || sendOsc || sendCallback || doingInit,); | |||
if (index >= 0) | |||
{ | |||
@@ -430,7 +430,7 @@ public: | |||
} CARLA_SAFE_EXCEPTION("effEndSetProgram"); | |||
} | |||
CarlaPlugin::setProgram(index, sendGui, sendOsc, sendCallback); | |||
CarlaPlugin::setProgram(index, sendGui, sendOsc, sendCallback, doingInit); | |||
} | |||
void setProgramRT(const uint32_t uindex) noexcept override | |||
@@ -963,7 +963,7 @@ public: | |||
if (doInit) | |||
{ | |||
if (newCount > 0) | |||
setProgram(0, false, false, false); | |||
setProgram(0, false, false, false, true); | |||
else | |||
dispatcher(effSetProgram, 0, 0, nullptr, 0.0f); | |||
} | |||
@@ -1004,7 +1004,7 @@ public: | |||
if (programChanged) | |||
{ | |||
setProgram(pData->prog.current, true, true, true); | |||
setProgram(pData->prog.current, true, true, true, false); | |||
} | |||
else | |||
{ | |||