@@ -845,7 +845,7 @@ public: | |||||
/*! | /*! | ||||
* Get plugin with id \a id. | * Get plugin with id \a id. | ||||
*/ | */ | ||||
CarlaPlugin* getPlugin(const unsigned int id); | |||||
CarlaPlugin* getPlugin(const unsigned int id) const; | |||||
/*! | /*! | ||||
* Get plugin with id \a id, faster unchecked version. | * Get plugin with id \a id, faster unchecked version. | ||||
@@ -854,7 +854,7 @@ public: | |||||
/*! | /*! | ||||
* Get a unique plugin name within the engine.\n | * Get a unique plugin name within the engine.\n | ||||
* Returned variable must NOT be free'd. | |||||
* Returned variable must be deleted if non-NULL. | |||||
*/ | */ | ||||
const char* getUniquePluginName(const char* const name) const; | const char* getUniquePluginName(const char* const name) const; | ||||
@@ -992,7 +992,7 @@ public: | |||||
/*! | /*! | ||||
* Set last error. | * Set last error. | ||||
*/ | */ | ||||
void setLastError(const char* const error); | |||||
void setLastError(const char* const error) const; | |||||
// ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
// Misc | // Misc | ||||
@@ -1045,7 +1045,7 @@ public: | |||||
/*! | /*! | ||||
* Set OSC bridge data. | * Set OSC bridge data. | ||||
*/ | */ | ||||
void setOscBridgeData(const CarlaOscData* const oscData) noexcept; | |||||
void setOscBridgeData(const CarlaOscData* const oscData) const noexcept; | |||||
#endif | #endif | ||||
// ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
@@ -1165,54 +1165,54 @@ private: | |||||
// Bridge/Controller OSC stuff | // Bridge/Controller OSC stuff | ||||
public: | public: | ||||
#ifdef BUILD_BRIDGE | #ifdef BUILD_BRIDGE | ||||
void oscSend_bridge_plugin_info1(const PluginType type, const PluginCategory category, const uint hints, const long uniqueId); | |||||
void oscSend_bridge_plugin_info2(const char* const realName, const char* const label, const char* const maker, const char* const copyright); | |||||
void oscSend_bridge_audio_count(const uint32_t ins, const uint32_t outs); | |||||
void oscSend_bridge_midi_count(const uint32_t ins, const uint32_t outs); | |||||
void oscSend_bridge_parameter_count(const uint32_t ins, const uint32_t outs); | |||||
void oscSend_bridge_program_count(const uint32_t count); | |||||
void oscSend_bridge_midi_program_count(const uint32_t count); | |||||
void oscSend_bridge_parameter_data(const uint32_t index, const int32_t rindex, const ParameterType type, const uint hints, const char* const name, const char* const unit); | |||||
void oscSend_bridge_parameter_ranges1(const uint32_t index, const float def, const float min, const float max); | |||||
void oscSend_bridge_parameter_ranges2(const uint32_t index, const float step, const float stepSmall, const float stepLarge); | |||||
void oscSend_bridge_set_parameter_midi_cc(const uint32_t index, const int16_t cc); | |||||
void oscSend_bridge_set_parameter_midi_channel(const uint32_t index, const uint8_t channel); | |||||
void oscSend_bridge_set_parameter_value(const int32_t index, const float value); // may be used for internal params (< 0) | |||||
void oscSend_bridge_set_default_value(const uint32_t index, const float value); | |||||
void oscSend_bridge_set_current_program(const int32_t index); | |||||
void oscSend_bridge_set_current_midi_program(const int32_t index); | |||||
void oscSend_bridge_program_name(const uint32_t index, const char* const name); | |||||
void oscSend_bridge_midi_program_data(const uint32_t index, const uint32_t bank, const uint32_t program, const char* const name); | |||||
void oscSend_bridge_configure(const char* const key, const char* const value); | |||||
void oscSend_bridge_set_custom_data(const char* const type, const char* const key, const char* const value); | |||||
void oscSend_bridge_set_chunk_data(const char* const chunkFile); | |||||
void oscSend_bridge_set_peaks(); | |||||
void oscSend_bridge_plugin_info1(const PluginCategory category, const uint hints, const long uniqueId) const; | |||||
void oscSend_bridge_plugin_info2(const char* const realName, const char* const label, const char* const maker, const char* const copyright) const; | |||||
void oscSend_bridge_audio_count(const uint32_t ins, const uint32_t outs) const; | |||||
void oscSend_bridge_midi_count(const uint32_t ins, const uint32_t outs) const; | |||||
void oscSend_bridge_parameter_count(const uint32_t ins, const uint32_t outs) const; | |||||
void oscSend_bridge_program_count(const uint32_t count) const; | |||||
void oscSend_bridge_midi_program_count(const uint32_t count) const; | |||||
void oscSend_bridge_parameter_data(const uint32_t index, const int32_t rindex, const ParameterType type, const uint hints, const char* const name, const char* const unit) const; | |||||
void oscSend_bridge_parameter_ranges1(const uint32_t index, const float def, const float min, const float max) const; | |||||
void oscSend_bridge_parameter_ranges2(const uint32_t index, const float step, const float stepSmall, const float stepLarge) const; | |||||
void oscSend_bridge_parameter_midi_cc(const uint32_t index, const int16_t cc) const; | |||||
void oscSend_bridge_parameter_midi_channel(const uint32_t index, const uint8_t channel) const; | |||||
void oscSend_bridge_parameter_value(const int32_t index, const float value) const; // may be used for internal params (< 0) | |||||
void oscSend_bridge_default_value(const uint32_t index, const float value) const; | |||||
void oscSend_bridge_current_program(const int32_t index) const; | |||||
void oscSend_bridge_current_midi_program(const int32_t index) const; | |||||
void oscSend_bridge_program_name(const uint32_t index, const char* const name) const; | |||||
void oscSend_bridge_midi_program_data(const uint32_t index, const uint32_t bank, const uint32_t program, const char* const name) const; | |||||
void oscSend_bridge_configure(const char* const key, const char* const value) const; | |||||
void oscSend_bridge_set_custom_data(const char* const type, const char* const key, const char* const value) const; | |||||
void oscSend_bridge_set_chunk_data(const char* const chunkFile) const; | |||||
void oscSend_bridge_set_peaks() const; | |||||
#else | #else | ||||
void oscSend_control_add_plugin_start(const uint pluginId, const char* const pluginName); | |||||
void oscSend_control_add_plugin_end(const uint pluginId); | |||||
void oscSend_control_remove_plugin(const uint pluginId); | |||||
void oscSend_control_set_plugin_info1(const uint pluginId, const PluginType type, const PluginCategory category, const uint hints, const long uniqueId); | |||||
void oscSend_control_set_plugin_info2(const uint pluginId, const char* const realName, const char* const label, const char* const maker, const char* const copyright); | |||||
void oscSend_control_set_audio_count(const uint pluginId, const uint32_t ins, const uint32_t outs); | |||||
void oscSend_control_set_midi_count(const uint pluginId, const uint32_t ins, const uint32_t outs); | |||||
void oscSend_control_set_parameter_count(const uint pluginId, const uint32_t ins, const uint32_t outs); | |||||
void oscSend_control_set_program_count(const uint pluginId, const uint32_t count); | |||||
void oscSend_control_set_midi_program_count(const uint pluginId, const uint32_t count); | |||||
void oscSend_control_set_parameter_data(const uint pluginId, const uint32_t index, const ParameterType type, const uint hints, const char* const name, const char* const unit); | |||||
void oscSend_control_set_parameter_ranges1(const uint pluginId, const uint32_t index, const float def, const float min, const float max); | |||||
void oscSend_control_set_parameter_ranges2(const uint pluginId, const uint32_t index, const float step, const float stepSmall, const float stepLarge); | |||||
void oscSend_control_set_parameter_midi_cc(const uint pluginId, const uint32_t index, const int16_t cc); | |||||
void oscSend_control_set_parameter_midi_channel(const uint pluginId, const uint32_t index, const uint8_t channel); | |||||
void oscSend_control_set_parameter_value(const uint pluginId, const int32_t index, const float value); // may be used for internal params (< 0) | |||||
void oscSend_control_set_default_value(const uint pluginId, const uint32_t index, const float value); | |||||
void oscSend_control_set_current_program(const uint pluginId, const int32_t index); | |||||
void oscSend_control_set_current_midi_program(const uint pluginId, const int32_t index); | |||||
void oscSend_control_set_program_name(const uint pluginId, const uint32_t index, const char* const name); | |||||
void oscSend_control_set_midi_program_data(const uint pluginId, const uint32_t index, const uint32_t bank, const uint32_t program, const char* const name); | |||||
void oscSend_control_note_on(const uint pluginId, const uint8_t channel, const uint8_t note, const uint8_t velo); | |||||
void oscSend_control_note_off(const uint pluginId, const uint8_t channel, const uint8_t note); | |||||
void oscSend_control_set_peaks(const uint pluginId); | |||||
void oscSend_control_exit(); | |||||
void oscSend_control_add_plugin_start(const uint pluginId, const char* const pluginName) const; | |||||
void oscSend_control_add_plugin_end(const uint pluginId) const; | |||||
void oscSend_control_remove_plugin(const uint pluginId) const; | |||||
void oscSend_control_set_plugin_info1(const uint pluginId, const PluginType type, const PluginCategory category, const uint hints, const long uniqueId) const; | |||||
void oscSend_control_set_plugin_info2(const uint pluginId, const char* const realName, const char* const label, const char* const maker, const char* const copyright) const; | |||||
void oscSend_control_set_audio_count(const uint pluginId, const uint32_t ins, const uint32_t outs) const; | |||||
void oscSend_control_set_midi_count(const uint pluginId, const uint32_t ins, const uint32_t outs) const; | |||||
void oscSend_control_set_parameter_count(const uint pluginId, const uint32_t ins, const uint32_t outs) const; | |||||
void oscSend_control_set_program_count(const uint pluginId, const uint32_t count) const; | |||||
void oscSend_control_set_midi_program_count(const uint pluginId, const uint32_t count) const; | |||||
void oscSend_control_set_parameter_data(const uint pluginId, const uint32_t index, const ParameterType type, const uint hints, const char* const name, const char* const unit) const; | |||||
void oscSend_control_set_parameter_ranges1(const uint pluginId, const uint32_t index, const float def, const float min, const float max) const; | |||||
void oscSend_control_set_parameter_ranges2(const uint pluginId, const uint32_t index, const float step, const float stepSmall, const float stepLarge) const; | |||||
void oscSend_control_set_parameter_midi_cc(const uint pluginId, const uint32_t index, const int16_t cc) const; | |||||
void oscSend_control_set_parameter_midi_channel(const uint pluginId, const uint32_t index, const uint8_t channel) const; | |||||
void oscSend_control_set_parameter_value(const uint pluginId, const int32_t index, const float value) const; // may be used for internal params (< 0) | |||||
void oscSend_control_set_default_value(const uint pluginId, const uint32_t index, const float value) const; | |||||
void oscSend_control_set_current_program(const uint pluginId, const int32_t index) const; | |||||
void oscSend_control_set_current_midi_program(const uint pluginId, const int32_t index) const; | |||||
void oscSend_control_set_program_name(const uint pluginId, const uint32_t index, const char* const name) const; | |||||
void oscSend_control_set_midi_program_data(const uint pluginId, const uint32_t index, const uint32_t bank, const uint32_t program, const char* const name) const; | |||||
void oscSend_control_note_on(const uint pluginId, const uint8_t channel, const uint8_t note, const uint8_t velo) const; | |||||
void oscSend_control_note_off(const uint pluginId, const uint8_t channel, const uint8_t note) const; | |||||
void oscSend_control_set_peaks(const uint pluginId) const; | |||||
void oscSend_control_exit() const; | |||||
#endif | #endif | ||||
CARLA_DECLARE_NON_COPY_CLASS(CarlaEngine) | CARLA_DECLARE_NON_COPY_CLASS(CarlaEngine) | ||||
@@ -616,6 +616,7 @@ CarlaEngine* CarlaEngine::newDriverByName(const char* const driverName) | |||||
if (std::strcmp(driverName, "JACK") == 0) | if (std::strcmp(driverName, "JACK") == 0) | ||||
return newJack(); | return newJack(); | ||||
#ifndef BUILD_BRIDGE | |||||
// common | // common | ||||
if (std::strncmp(driverName, "JACK ", 5) == 0) | if (std::strncmp(driverName, "JACK ", 5) == 0) | ||||
return newRtAudio(AUDIO_API_JACK); | return newRtAudio(AUDIO_API_JACK); | ||||
@@ -637,6 +638,7 @@ CarlaEngine* CarlaEngine::newDriverByName(const char* const driverName) | |||||
return newRtAudio(AUDIO_API_ASIO); | return newRtAudio(AUDIO_API_ASIO); | ||||
if (std::strcmp(driverName, "DirectSound") == 0) | if (std::strcmp(driverName, "DirectSound") == 0) | ||||
return newRtAudio(AUDIO_API_DS); | return newRtAudio(AUDIO_API_DS); | ||||
#endif | |||||
carla_stderr("CarlaEngine::newDriverByName(\"%s\") - invalid driver name", driverName); | carla_stderr("CarlaEngine::newDriverByName(\"%s\") - invalid driver name", driverName); | ||||
return nullptr; | return nullptr; | ||||
@@ -718,6 +720,9 @@ bool CarlaEngine::init(const char* const clientName) | |||||
pData->plugins = new EnginePluginData[pData->maxPluginNumber]; | pData->plugins = new EnginePluginData[pData->maxPluginNumber]; | ||||
for (uint i=0; i < pData->maxPluginNumber; ++i) | |||||
pData->plugins[i].clear(); | |||||
pData->osc.init(clientName); | pData->osc.init(clientName); | ||||
#ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
pData->oscData = pData->osc.getControlData(); | pData->oscData = pData->osc.getControlData(); | ||||
@@ -1164,7 +1169,7 @@ bool CarlaEngine::switchPlugins(const unsigned int idA, const unsigned int idB) | |||||
return true; | return true; | ||||
} | } | ||||
CarlaPlugin* CarlaEngine::getPlugin(const unsigned int id) | |||||
CarlaPlugin* CarlaEngine::getPlugin(const unsigned int id) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN_ERRN(pData->plugins != nullptr, "Invalid engine internal data (err #38)"); | CARLA_SAFE_ASSERT_RETURN_ERRN(pData->plugins != nullptr, "Invalid engine internal data (err #38)"); | ||||
CARLA_SAFE_ASSERT_RETURN_ERRN(pData->curPluginCount != 0, "Invalid engine internal data (err #39)"); | CARLA_SAFE_ASSERT_RETURN_ERRN(pData->curPluginCount != 0, "Invalid engine internal data (err #39)"); | ||||
@@ -1188,16 +1193,13 @@ const char* CarlaEngine::getUniquePluginName(const char* const name) const | |||||
CARLA_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0', nullptr); | CARLA_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0', nullptr); | ||||
carla_debug("CarlaEngine::getUniquePluginName(\"%s\")", name); | carla_debug("CarlaEngine::getUniquePluginName(\"%s\")", name); | ||||
static CarlaMutex m; | |||||
const CarlaMutex::ScopedLocker sl(m); | |||||
static CarlaString sname; | |||||
CarlaString sname; | |||||
sname = name; | sname = name; | ||||
if (sname.isEmpty()) | if (sname.isEmpty()) | ||||
{ | { | ||||
sname = "(No name)"; | sname = "(No name)"; | ||||
return (const char*)sname; | |||||
return sname.dup(); | |||||
} | } | ||||
sname.truncate(getMaxClientNameSize()-5-1); // 5 = strlen(" (10)") | sname.truncate(getMaxClientNameSize()-5-1); // 5 = strlen(" (10)") | ||||
@@ -1261,7 +1263,7 @@ const char* CarlaEngine::getUniquePluginName(const char* const name) const | |||||
sname += " (2)"; | sname += " (2)"; | ||||
} | } | ||||
return (const char*)sname; | |||||
return sname.dup(); | |||||
} | } | ||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
@@ -1655,7 +1657,7 @@ const char* CarlaEngine::getLastError() const noexcept | |||||
return (const char*)pData->lastError; | return (const char*)pData->lastError; | ||||
} | } | ||||
void CarlaEngine::setLastError(const char* const error) | |||||
void CarlaEngine::setLastError(const char* const error) const | |||||
{ | { | ||||
pData->lastError = error; | pData->lastError = error; | ||||
} | } | ||||
@@ -1675,7 +1677,7 @@ void CarlaEngine::setOption(const EngineOption option, const int value, const ch | |||||
carla_debug("CarlaEngine::setOption(%i:%s, %i, \"%s\")", option, EngineOption2Str(option), value, valueStr); | carla_debug("CarlaEngine::setOption(%i:%s, %i, \"%s\")", option, EngineOption2Str(option), value, valueStr); | ||||
if (isRunning() && (option == ENGINE_OPTION_PROCESS_MODE || option == ENGINE_OPTION_AUDIO_NUM_PERIODS || option == ENGINE_OPTION_AUDIO_DEVICE)) | if (isRunning() && (option == ENGINE_OPTION_PROCESS_MODE || option == ENGINE_OPTION_AUDIO_NUM_PERIODS || option == ENGINE_OPTION_AUDIO_DEVICE)) | ||||
return carla_stderr("CarlaEngine::setOption(%s, %i, \"%s\") - Cannot set this option while engine is running!", EngineOption2Str(option), value, valueStr); | |||||
return carla_stderr("CarlaEngine::setOption(%i:%s, %i, \"%s\") - Cannot set this option while engine is running!", option, EngineOption2Str(option), value, valueStr); | |||||
switch (option) | switch (option) | ||||
{ | { | ||||
@@ -1683,12 +1685,12 @@ void CarlaEngine::setOption(const EngineOption option, const int value, const ch | |||||
break; | break; | ||||
case ENGINE_OPTION_PROCESS_MODE: | case ENGINE_OPTION_PROCESS_MODE: | ||||
CARLA_SAFE_ASSERT_RETURN(value >= ENGINE_PROCESS_MODE_SINGLE_CLIENT && value < ENGINE_PROCESS_MODE_BRIDGE,); | |||||
CARLA_SAFE_ASSERT_RETURN(value >= ENGINE_PROCESS_MODE_SINGLE_CLIENT && value <= ENGINE_PROCESS_MODE_BRIDGE,); | |||||
pData->options.processMode = static_cast<EngineProcessMode>(value); | pData->options.processMode = static_cast<EngineProcessMode>(value); | ||||
break; | break; | ||||
case ENGINE_OPTION_TRANSPORT_MODE: | case ENGINE_OPTION_TRANSPORT_MODE: | ||||
CARLA_SAFE_ASSERT_RETURN(value >= ENGINE_TRANSPORT_MODE_INTERNAL && value < ENGINE_TRANSPORT_MODE_BRIDGE,); | |||||
CARLA_SAFE_ASSERT_RETURN(value >= ENGINE_TRANSPORT_MODE_INTERNAL && value <= ENGINE_TRANSPORT_MODE_BRIDGE,); | |||||
pData->options.transportMode = static_cast<EngineTransportMode>(value); | pData->options.transportMode = static_cast<EngineTransportMode>(value); | ||||
break; | break; | ||||
@@ -1797,7 +1799,7 @@ const char* CarlaEngine::getOscServerPathUDP() const noexcept | |||||
} | } | ||||
#ifdef BUILD_BRIDGE | #ifdef BUILD_BRIDGE | ||||
void CarlaEngine::setOscBridgeData(const CarlaOscData* const oscData) noexcept | |||||
void CarlaEngine::setOscBridgeData(const CarlaOscData* const oscData) const noexcept | |||||
{ | { | ||||
pData->oscData = oscData; | pData->oscData = oscData; | ||||
} | } | ||||
@@ -2068,55 +2070,83 @@ void CarlaEngine::processPatchbay(float** inBuf, float** outBuf, const uint32_t | |||||
// Bridge/Controller OSC stuff | // Bridge/Controller OSC stuff | ||||
#ifdef BUILD_BRIDGE | #ifdef BUILD_BRIDGE | ||||
void CarlaEngine::oscSend_bridge_audio_count(const int32_t ins, const int32_t outs, const int32_t total) | |||||
void CarlaEngine::oscSend_bridge_plugin_info1(const PluginCategory category, const uint hints, const long uniqueId) const | |||||
{ | |||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | |||||
carla_debug("CarlaEngine::oscSend_bridge_plugin_info1(%i:%s, %X, %l)", category, PluginCategory2Str(category), hints, uniqueId); | |||||
if (pData->oscData->target != nullptr) | |||||
{ | |||||
char targetPath[std::strlen(pData->oscData->path)+21]; | |||||
std::strcpy(targetPath, pData->oscData->path); | |||||
std::strcat(targetPath, "/bridge_plugin_info1"); | |||||
lo_send(pData->oscData->target, targetPath, "iih", static_cast<int32_t>(category), static_cast<int32_t>(hints), static_cast<int64_t>(uniqueId)); | |||||
} | |||||
} | |||||
void CarlaEngine::oscSend_bridge_plugin_info2(const char* const realName, const char* const label, const char* const maker, const char* const copyright) const | |||||
{ | |||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | |||||
CARLA_SAFE_ASSERT_RETURN(realName != nullptr && realName[0] != '\0',); | |||||
CARLA_SAFE_ASSERT_RETURN(label != nullptr && label[0] != '\0',); | |||||
CARLA_SAFE_ASSERT_RETURN(maker != nullptr,); | |||||
CARLA_SAFE_ASSERT_RETURN(copyright != nullptr,); | |||||
carla_debug("CarlaEngine::oscSend_bridge_plugin_info2(\"%s\", \"%s\", \"%s\", \"%s\")", realName, label, maker, copyright); | |||||
if (pData->oscData->target != nullptr) | |||||
{ | |||||
char targetPath[std::strlen(pData->oscData->path)+21]; | |||||
std::strcpy(targetPath, pData->oscData->path); | |||||
std::strcat(targetPath, "/bridge_plugin_info2"); | |||||
lo_send(pData->oscData->target, targetPath, "ssss", realName, label, maker, copyright); | |||||
} | |||||
} | |||||
void CarlaEngine::oscSend_bridge_audio_count(const uint32_t ins, const uint32_t outs) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(total >= 0 && total >= ins + outs,); | |||||
carla_debug("CarlaEngine::oscSend_bridge_audio_count(%i, %i, %i)", ins, outs, total); | |||||
carla_debug("CarlaEngine::oscSend_bridge_audio_count(%i, %i)", ins, outs); | |||||
if (pData->oscData->target != nullptr) | if (pData->oscData->target != nullptr) | ||||
{ | { | ||||
char targetPath[std::strlen(pData->oscData->path)+20]; | char targetPath[std::strlen(pData->oscData->path)+20]; | ||||
std::strcpy(targetPath, pData->oscData->path); | std::strcpy(targetPath, pData->oscData->path); | ||||
std::strcat(targetPath, "/bridge_audio_count"); | std::strcat(targetPath, "/bridge_audio_count"); | ||||
lo_send(pData->oscData->target, targetPath, "iii", ins, outs, total); | |||||
lo_send(pData->oscData->target, targetPath, "iii", static_cast<int32_t>(ins), static_cast<int32_t>(outs)); | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_bridge_midi_count(const int32_t ins, const int32_t outs, const int32_t total) | |||||
void CarlaEngine::oscSend_bridge_midi_count(const uint32_t ins, const uint32_t outs) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(total >= 0 && total >= ins + outs,); | |||||
carla_debug("CarlaEngine::oscSend_bridge_midi_count(%i, %i, %i)", ins, outs, total); | |||||
carla_debug("CarlaEngine::oscSend_bridge_midi_count(%i, %i)", ins, outs); | |||||
if (pData->oscData->target != nullptr) | if (pData->oscData->target != nullptr) | ||||
{ | { | ||||
char targetPath[std::strlen(pData->oscData->path)+19]; | char targetPath[std::strlen(pData->oscData->path)+19]; | ||||
std::strcpy(targetPath, pData->oscData->path); | std::strcpy(targetPath, pData->oscData->path); | ||||
std::strcat(targetPath, "/bridge_midi_count"); | std::strcat(targetPath, "/bridge_midi_count"); | ||||
lo_send(pData->oscData->target, targetPath, "iii", ins, outs, total); | |||||
lo_send(pData->oscData->target, targetPath, "ii", static_cast<int32_t>(ins), static_cast<int32_t>(outs)); | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_bridge_parameter_count(const int32_t ins, const int32_t outs, const int32_t total) | |||||
void CarlaEngine::oscSend_bridge_parameter_count(const uint32_t ins, const uint32_t outs) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(total >= 0 && total >= ins + outs,); | |||||
carla_debug("CarlaEngine::oscSend_bridge_parameter_count(%i, %i, %i)", ins, outs, total); | |||||
carla_debug("CarlaEngine::oscSend_bridge_parameter_count(%i, %i)", ins, outs); | |||||
if (pData->oscData->target != nullptr) | if (pData->oscData->target != nullptr) | ||||
{ | { | ||||
char targetPath[std::strlen(pData->oscData->path)+24]; | char targetPath[std::strlen(pData->oscData->path)+24]; | ||||
std::strcpy(targetPath, pData->oscData->path); | std::strcpy(targetPath, pData->oscData->path); | ||||
std::strcat(targetPath, "/bridge_parameter_count"); | std::strcat(targetPath, "/bridge_parameter_count"); | ||||
lo_send(pData->oscData->target, targetPath, "iii", ins, outs, total); | |||||
lo_send(pData->oscData->target, targetPath, "ii", static_cast<int32_t>(ins), static_cast<int32_t>(outs)); | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_bridge_program_count(const int32_t count) | |||||
void CarlaEngine::oscSend_bridge_program_count(const uint32_t count) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(count >= 0,); | |||||
carla_debug("CarlaEngine::oscSend_bridge_program_count(%i)", count); | carla_debug("CarlaEngine::oscSend_bridge_program_count(%i)", count); | ||||
if (pData->oscData->target != nullptr) | if (pData->oscData->target != nullptr) | ||||
@@ -2124,14 +2154,13 @@ void CarlaEngine::oscSend_bridge_program_count(const int32_t count) | |||||
char targetPath[std::strlen(pData->oscData->path)+22]; | char targetPath[std::strlen(pData->oscData->path)+22]; | ||||
std::strcpy(targetPath, pData->oscData->path); | std::strcpy(targetPath, pData->oscData->path); | ||||
std::strcat(targetPath, "/bridge_program_count"); | std::strcat(targetPath, "/bridge_program_count"); | ||||
lo_send(pData->oscData->target, targetPath, "i", count); | |||||
lo_send(pData->oscData->target, targetPath, "i", static_cast<int32_t>(count)); | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_bridge_midi_program_count(const int32_t count) | |||||
void CarlaEngine::oscSend_bridge_midi_program_count(const uint32_t count) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(count >= 0,); | |||||
carla_debug("CarlaEngine::oscSend_bridge_midi_program_count(%i)", count); | carla_debug("CarlaEngine::oscSend_bridge_midi_program_count(%i)", count); | ||||
if (pData->oscData->target != nullptr) | if (pData->oscData->target != nullptr) | ||||
@@ -2139,173 +2168,184 @@ void CarlaEngine::oscSend_bridge_midi_program_count(const int32_t count) | |||||
char targetPath[std::strlen(pData->oscData->path)+27]; | char targetPath[std::strlen(pData->oscData->path)+27]; | ||||
std::strcpy(targetPath, pData->oscData->path); | std::strcpy(targetPath, pData->oscData->path); | ||||
std::strcat(targetPath, "/bridge_midi_program_count"); | std::strcat(targetPath, "/bridge_midi_program_count"); | ||||
lo_send(pData->oscData->target, targetPath, "i", count); | |||||
lo_send(pData->oscData->target, targetPath, "i", static_cast<int32_t>(count)); | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_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 CarlaEngine::oscSend_bridge_parameter_data(const uint32_t index, const int32_t rindex, const ParameterType type, const uint hints, const char* const name, const char* const unit) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0',); | CARLA_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0',); | ||||
CARLA_SAFE_ASSERT_RETURN(label != nullptr && label[0] != '\0',); | |||||
CARLA_SAFE_ASSERT_RETURN(maker != nullptr,); | |||||
CARLA_SAFE_ASSERT_RETURN(copyright != nullptr,); | |||||
carla_debug("CarlaEngine::oscSend_bridge_plugin_info(%i, %i, \"%s\", \"%s\", \"%s\", \"%s\", " P_INT64 ")", category, hints, name, label, maker, copyright, uniqueId); | |||||
CARLA_SAFE_ASSERT_RETURN(unit != nullptr,); | |||||
carla_debug("CarlaEngine::oscSend_bridge_parameter_data(%i, %i, %i:%s, %X, \"%s\", \"%s\")", index, rindex, type, ParameterType2Str(type), hints, name, unit); | |||||
if (pData->oscData->target != nullptr) | if (pData->oscData->target != nullptr) | ||||
{ | { | ||||
char targetPath[std::strlen(pData->oscData->path)+20]; | |||||
char targetPath[std::strlen(pData->oscData->path)+23]; | |||||
std::strcpy(targetPath, pData->oscData->path); | std::strcpy(targetPath, pData->oscData->path); | ||||
std::strcat(targetPath, "/bridge_plugin_info"); | |||||
lo_send(pData->oscData->target, targetPath, "iissssh", category, hints, name, label, maker, copyright, uniqueId); | |||||
std::strcat(targetPath, "/bridge_parameter_data"); | |||||
lo_send(pData->oscData->target, targetPath, "iiiiss", static_cast<int32_t>(index), static_cast<int32_t>(rindex), static_cast<int32_t>(type), static_cast<int32_t>(hints), name, unit); | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_bridge_parameter_info(const int32_t index, const char* const name, const char* const unit) | |||||
void CarlaEngine::oscSend_bridge_parameter_ranges1(const uint32_t index, const float def, const float min, const float max) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0',); | |||||
CARLA_SAFE_ASSERT_RETURN(unit != nullptr,); | |||||
carla_debug("CarlaEngine::oscSend_bridge_parameter_info(%i, \"%s\", \"%s\")", index, name, unit); | |||||
carla_debug("CarlaEngine::oscSend_bridge_parameter_ranges(%i, %f, %f, %f)", index, def, min, max); | |||||
if (pData->oscData->target != nullptr) | if (pData->oscData->target != nullptr) | ||||
{ | { | ||||
char targetPath[std::strlen(pData->oscData->path)+23]; | |||||
char targetPath[std::strlen(pData->oscData->path)+26]; | |||||
std::strcpy(targetPath, pData->oscData->path); | std::strcpy(targetPath, pData->oscData->path); | ||||
std::strcat(targetPath, "/bridge_parameter_info"); | |||||
lo_send(pData->oscData->target, targetPath, "iss", index, name, unit); | |||||
std::strcat(targetPath, "/bridge_parameter_ranges1"); | |||||
lo_send(pData->oscData->target, targetPath, "ifff", static_cast<int32_t>(index), def, min, max); | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_bridge_parameter_data(const int32_t index, const int32_t rindex, const int32_t hints, const int32_t midiChannel, const int32_t midiCC) | |||||
void CarlaEngine::oscSend_bridge_parameter_ranges2(const uint32_t index, const float step, const float stepSmall, const float stepLarge) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
carla_debug("CarlaEngine::oscSend_bridge_parameter_data(%i, %i, %i, %i, %i)", index, rindex, hints, midiChannel, midiCC); | |||||
carla_debug("CarlaEngine::oscSend_bridge_parameter_ranges(%i, %f, %f, %f)", index, step, stepSmall, stepLarge); | |||||
if (pData->oscData->target != nullptr) | if (pData->oscData->target != nullptr) | ||||
{ | { | ||||
char targetPath[std::strlen(pData->oscData->path)+23]; | |||||
char targetPath[std::strlen(pData->oscData->path)+26]; | |||||
std::strcpy(targetPath, pData->oscData->path); | std::strcpy(targetPath, pData->oscData->path); | ||||
std::strcat(targetPath, "/bridge_parameter_data"); | |||||
lo_send(pData->oscData->target, targetPath, "iiiii", index, rindex, hints, midiChannel, midiCC); | |||||
std::strcat(targetPath, "/bridge_parameter_ranges2"); | |||||
lo_send(pData->oscData->target, targetPath, "ifff", static_cast<int32_t>(index), step, stepSmall, stepLarge); | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_bridge_parameter_ranges(const int32_t index, const float def, const float min, const float max, const float step, const float stepSmall, const float stepLarge) | |||||
void CarlaEngine::oscSend_bridge_parameter_midi_cc(const uint32_t index, const int16_t cc) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
carla_debug("CarlaEngine::oscSend_bridge_parameter_ranges(%i, %f, %f, %f, %f, %f, %f)", index, def, min, max, step, stepSmall, stepLarge); | |||||
carla_debug("CarlaEngine::oscSend_bridge_parameter_midi_cc(%i, %i)", index, cc); | |||||
if (pData->oscData->target != nullptr) | if (pData->oscData->target != nullptr) | ||||
{ | { | ||||
char targetPath[std::strlen(pData->oscData->path)+25]; | |||||
char targetPath[std::strlen(pData->oscData->path)+26]; | |||||
std::strcpy(targetPath, pData->oscData->path); | std::strcpy(targetPath, pData->oscData->path); | ||||
std::strcat(targetPath, "/bridge_parameter_ranges"); | |||||
lo_send(pData->oscData->target, targetPath, "iffffff", index, def, min, max, step, stepSmall, stepLarge); | |||||
std::strcat(targetPath, "/bridge_parameter_midi_cc"); | |||||
lo_send(pData->oscData->target, targetPath, "ii", static_cast<int32_t>(index), static_cast<int32_t>(cc)); | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_bridge_program_info(const int32_t index, const char* const name) | |||||
void CarlaEngine::oscSend_bridge_parameter_midi_channel(const uint32_t index, const uint8_t channel) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
carla_debug("CarlaEngine::oscSend_bridge_program_info(%i, \"%s\")", index, name); | |||||
carla_debug("CarlaEngine::oscSend_bridge_parameter_midi_channel(%i, %i)", index, channel); | |||||
if (pData->oscData->target != nullptr) | if (pData->oscData->target != nullptr) | ||||
{ | { | ||||
char targetPath[std::strlen(pData->oscData->path)+21]; | |||||
char targetPath[std::strlen(pData->oscData->path)+31]; | |||||
std::strcpy(targetPath, pData->oscData->path); | std::strcpy(targetPath, pData->oscData->path); | ||||
std::strcat(targetPath, "/bridge_program_info"); | |||||
lo_send(pData->oscData->target, targetPath, "is", index, name); | |||||
std::strcat(targetPath, "/bridge_parameter_midi_channel"); | |||||
lo_send(pData->oscData->target, targetPath, "ii", static_cast<int32_t>(index), static_cast<int32_t>(channel)); | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_bridge_midi_program_info(const int32_t index, const int32_t bank, const int32_t program, const char* const label) | |||||
void CarlaEngine::oscSend_bridge_parameter_value(const int32_t index, const float value) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
carla_debug("CarlaEngine::oscSend_bridge_midi_program_info(%i, %i, %i, \"%s\")", index, bank, program, label); | |||||
carla_debug("CarlaEngine::oscSend_bridge_parameter_value(%i, %f)", index, value); | |||||
if (pData->oscData->target != nullptr) | if (pData->oscData->target != nullptr) | ||||
{ | { | ||||
char targetPath[std::strlen(pData->oscData->path)+26]; | |||||
char targetPath[std::strlen(pData->oscData->path)+24]; | |||||
std::strcpy(targetPath, pData->oscData->path); | std::strcpy(targetPath, pData->oscData->path); | ||||
std::strcat(targetPath, "/bridge_midi_program_info"); | |||||
lo_send(pData->oscData->target, targetPath, "iiis", index, bank, program, label); | |||||
std::strcat(targetPath, "/bridge_parameter_value"); | |||||
lo_send(pData->oscData->target, targetPath, "if", index, value); | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_bridge_configure(const char* const key, const char* const value) | |||||
void CarlaEngine::oscSend_bridge_default_value(const uint32_t index, const float value) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(key != nullptr && key[0] != '\0',); | |||||
CARLA_SAFE_ASSERT_RETURN(value != nullptr,); | |||||
carla_debug("CarlaEngine::oscSend_bridge_configure(\"%s\", \"%s\")", key, value); | |||||
carla_debug("CarlaEngine::oscSend_bridge_default_value(%i, %f)", index, value); | |||||
if (pData->oscData->target != nullptr) | if (pData->oscData->target != nullptr) | ||||
{ | { | ||||
char targetPath[std::strlen(pData->oscData->path)+18]; | |||||
char targetPath[std::strlen(pData->oscData->path)+22]; | |||||
std::strcpy(targetPath, pData->oscData->path); | std::strcpy(targetPath, pData->oscData->path); | ||||
std::strcat(targetPath, "/bridge_configure"); | |||||
lo_send(pData->oscData->target, targetPath, "ss", key, value); | |||||
std::strcat(targetPath, "/bridge_default_value"); | |||||
lo_send(pData->oscData->target, targetPath, "if", static_cast<int32_t>(index), value); | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_bridge_set_parameter_value(const int32_t index, const float value) | |||||
void CarlaEngine::oscSend_bridge_current_program(const int32_t index) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
carla_debug("CarlaEngine::oscSend_bridge_set_parameter_value(%i, %f)", index, value); | |||||
carla_debug("CarlaEngine::oscSend_bridge_current_program(%i)", index); | |||||
if (pData->oscData->target != nullptr) | if (pData->oscData->target != nullptr) | ||||
{ | { | ||||
char targetPath[std::strlen(pData->oscData->path)+28]; | |||||
char targetPath[std::strlen(pData->oscData->path)+20]; | |||||
std::strcpy(targetPath, pData->oscData->path); | std::strcpy(targetPath, pData->oscData->path); | ||||
std::strcat(targetPath, "/bridge_set_parameter_value"); | |||||
lo_send(pData->oscData->target, targetPath, "if", index, value); | |||||
std::strcat(targetPath, "/bridge_current_program"); | |||||
lo_send(pData->oscData->target, targetPath, "i", index); | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_bridge_set_default_value(const int32_t index, const float value) | |||||
void CarlaEngine::oscSend_bridge_current_midi_program(const int32_t index) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
carla_debug("CarlaEngine::oscSend_bridge_set_default_value(%i, %f)", index, value); | |||||
carla_debug("CarlaEngine::oscSend_bridge_current_midi_program(%i)", index); | |||||
if (pData->oscData->target != nullptr) | if (pData->oscData->target != nullptr) | ||||
{ | { | ||||
char targetPath[std::strlen(pData->oscData->path)+26]; | |||||
char targetPath[std::strlen(pData->oscData->path)+25]; | |||||
std::strcpy(targetPath, pData->oscData->path); | std::strcpy(targetPath, pData->oscData->path); | ||||
std::strcat(targetPath, "/bridge_set_default_value"); | |||||
lo_send(pData->oscData->target, targetPath, "if", index, value); | |||||
std::strcat(targetPath, "/bridge_current_midi_program"); | |||||
lo_send(pData->oscData->target, targetPath, "i", index); | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_bridge_set_program(const int32_t index) | |||||
void CarlaEngine::oscSend_bridge_program_name(const uint32_t index, const char* const name) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
carla_debug("CarlaEngine::oscSend_bridge_set_program(%i)", index); | |||||
carla_debug("CarlaEngine::oscSend_bridge_program_name(%i, \"%s\")", index, name); | |||||
if (pData->oscData->target != nullptr) | if (pData->oscData->target != nullptr) | ||||
{ | { | ||||
char targetPath[std::strlen(pData->oscData->path)+20]; | |||||
char targetPath[std::strlen(pData->oscData->path)+21]; | |||||
std::strcpy(targetPath, pData->oscData->path); | std::strcpy(targetPath, pData->oscData->path); | ||||
std::strcat(targetPath, "/bridge_set_program"); | |||||
lo_send(pData->oscData->target, targetPath, "i", index); | |||||
std::strcat(targetPath, "/bridge_program_name"); | |||||
lo_send(pData->oscData->target, targetPath, "is", static_cast<int32_t>(index), name); | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_bridge_set_midi_program(const int32_t index) | |||||
void CarlaEngine::oscSend_bridge_midi_program_data(const uint32_t index, const uint32_t bank, const uint32_t program, const char* const name) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
carla_debug("CarlaEngine::oscSend_bridge_set_midi_program(%i)", index); | |||||
CARLA_SAFE_ASSERT_RETURN(name != nullptr,); | |||||
carla_debug("CarlaEngine::oscSend_bridge_midi_program_data(%i, %i, %i, \"%s\")", index, bank, program, name); | |||||
if (pData->oscData->target != nullptr) | if (pData->oscData->target != nullptr) | ||||
{ | { | ||||
char targetPath[std::strlen(pData->oscData->path)+25]; | |||||
char targetPath[std::strlen(pData->oscData->path)+26]; | |||||
std::strcpy(targetPath, pData->oscData->path); | std::strcpy(targetPath, pData->oscData->path); | ||||
std::strcat(targetPath, "/bridge_set_midi_program"); | |||||
lo_send(pData->oscData->target, targetPath, "i", index); | |||||
std::strcat(targetPath, "/bridge_midi_program_data"); | |||||
lo_send(pData->oscData->target, targetPath, "iiis", static_cast<int32_t>(index), static_cast<int32_t>(bank), static_cast<int32_t>(program), name); | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_bridge_set_custom_data(const char* const type, const char* const key, const char* const value) | |||||
void CarlaEngine::oscSend_bridge_configure(const char* const key, const char* const value) const | |||||
{ | |||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | |||||
CARLA_SAFE_ASSERT_RETURN(key != nullptr && key[0] != '\0',); | |||||
CARLA_SAFE_ASSERT_RETURN(value != nullptr,); | |||||
carla_debug("CarlaEngine::oscSend_bridge_configure(\"%s\", \"%s\")", key, value); | |||||
if (pData->oscData->target != nullptr) | |||||
{ | |||||
char targetPath[std::strlen(pData->oscData->path)+18]; | |||||
std::strcpy(targetPath, pData->oscData->path); | |||||
std::strcat(targetPath, "/bridge_configure"); | |||||
lo_send(pData->oscData->target, targetPath, "ss", key, value); | |||||
} | |||||
} | |||||
void CarlaEngine::oscSend_bridge_set_custom_data(const char* const type, const char* const key, const char* const value) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
carla_debug("CarlaEngine::oscSend_bridge_set_custom_data(\"%s\", \"%s\", \"%s\")", type, key, value); | carla_debug("CarlaEngine::oscSend_bridge_set_custom_data(\"%s\", \"%s\", \"%s\")", type, key, value); | ||||
@@ -2319,7 +2359,7 @@ void CarlaEngine::oscSend_bridge_set_custom_data(const char* const type, const c | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_bridge_set_chunk_data(const char* const chunkFile) | |||||
void CarlaEngine::oscSend_bridge_set_chunk_data(const char* const chunkFile) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
carla_debug("CarlaEngine::oscSend_bridge_set_chunk_data(\"%s\")", chunkFile); | carla_debug("CarlaEngine::oscSend_bridge_set_chunk_data(\"%s\")", chunkFile); | ||||
@@ -2332,8 +2372,12 @@ void CarlaEngine::oscSend_bridge_set_chunk_data(const char* const chunkFile) | |||||
lo_send(pData->oscData->target, targetPath, "s", chunkFile); | lo_send(pData->oscData->target, targetPath, "s", chunkFile); | ||||
} | } | ||||
} | } | ||||
// TODO? | |||||
//void oscSend_bridge_set_peaks() const; | |||||
#else | #else | ||||
void CarlaEngine::oscSend_control_add_plugin_start(const uint pluginId, const char* const pluginName) | |||||
void CarlaEngine::oscSend_control_add_plugin_start(const uint pluginId, const char* const pluginName) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | ||||
@@ -2349,7 +2393,7 @@ void CarlaEngine::oscSend_control_add_plugin_start(const uint pluginId, const ch | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_control_add_plugin_end(const uint pluginId) | |||||
void CarlaEngine::oscSend_control_add_plugin_end(const uint pluginId) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | ||||
@@ -2364,7 +2408,7 @@ void CarlaEngine::oscSend_control_add_plugin_end(const uint pluginId) | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_control_remove_plugin(const uint pluginId) | |||||
void CarlaEngine::oscSend_control_remove_plugin(const uint pluginId) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | ||||
@@ -2379,7 +2423,7 @@ void CarlaEngine::oscSend_control_remove_plugin(const uint pluginId) | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_control_set_plugin_info1(const uint pluginId, const PluginType type, const PluginCategory category, const uint hints, const long uniqueId) | |||||
void CarlaEngine::oscSend_control_set_plugin_info1(const uint pluginId, const PluginType type, const PluginCategory category, const uint hints, const long uniqueId) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | ||||
@@ -2395,7 +2439,7 @@ void CarlaEngine::oscSend_control_set_plugin_info1(const uint pluginId, const Pl | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_control_set_plugin_info2(const uint pluginId, const char* const realName, const char* const label, const char* const maker, const char* const copyright) | |||||
void CarlaEngine::oscSend_control_set_plugin_info2(const uint pluginId, const char* const realName, const char* const label, const char* const maker, const char* const copyright) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | ||||
@@ -2414,7 +2458,7 @@ void CarlaEngine::oscSend_control_set_plugin_info2(const uint pluginId, const ch | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_control_set_audio_count(const uint pluginId, const uint32_t ins, const uint32_t outs) | |||||
void CarlaEngine::oscSend_control_set_audio_count(const uint pluginId, const uint32_t ins, const uint32_t outs) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | ||||
@@ -2429,7 +2473,7 @@ void CarlaEngine::oscSend_control_set_audio_count(const uint pluginId, const uin | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_control_set_midi_count(const uint pluginId, const uint32_t ins, const uint32_t outs) | |||||
void CarlaEngine::oscSend_control_set_midi_count(const uint pluginId, const uint32_t ins, const uint32_t outs) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | ||||
@@ -2444,7 +2488,7 @@ void CarlaEngine::oscSend_control_set_midi_count(const uint pluginId, const uint | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_control_set_parameter_count(const uint pluginId, const uint32_t ins, const uint32_t outs) | |||||
void CarlaEngine::oscSend_control_set_parameter_count(const uint pluginId, const uint32_t ins, const uint32_t outs) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | ||||
@@ -2459,7 +2503,7 @@ void CarlaEngine::oscSend_control_set_parameter_count(const uint pluginId, const | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_control_set_program_count(const uint pluginId, const uint32_t count) | |||||
void CarlaEngine::oscSend_control_set_program_count(const uint pluginId, const uint32_t count) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | ||||
@@ -2474,7 +2518,7 @@ void CarlaEngine::oscSend_control_set_program_count(const uint pluginId, const u | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_control_set_midi_program_count(const uint pluginId, const uint32_t count) | |||||
void CarlaEngine::oscSend_control_set_midi_program_count(const uint pluginId, const uint32_t count) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | ||||
@@ -2489,7 +2533,7 @@ void CarlaEngine::oscSend_control_set_midi_program_count(const uint pluginId, co | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_control_set_parameter_data(const uint pluginId, const uint32_t index, const ParameterType type, const uint hints, const char* const name, const char* const unit) | |||||
void CarlaEngine::oscSend_control_set_parameter_data(const uint pluginId, const uint32_t index, const ParameterType type, const uint hints, const char* const name, const char* const unit) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | ||||
@@ -2506,7 +2550,7 @@ void CarlaEngine::oscSend_control_set_parameter_data(const uint pluginId, const | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_control_set_parameter_ranges1(const uint pluginId, const uint32_t index, const float def, const float min, const float max) | |||||
void CarlaEngine::oscSend_control_set_parameter_ranges1(const uint pluginId, const uint32_t index, const float def, const float min, const float max) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | ||||
@@ -2523,7 +2567,7 @@ void CarlaEngine::oscSend_control_set_parameter_ranges1(const uint pluginId, con | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_control_set_parameter_ranges2(const uint pluginId, const uint32_t index, const float step, const float stepSmall, const float stepLarge) | |||||
void CarlaEngine::oscSend_control_set_parameter_ranges2(const uint pluginId, const uint32_t index, const float step, const float stepSmall, const float stepLarge) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | ||||
@@ -2540,7 +2584,7 @@ void CarlaEngine::oscSend_control_set_parameter_ranges2(const uint pluginId, con | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_control_set_parameter_midi_cc(const uint pluginId, const uint32_t index, const int16_t cc) | |||||
void CarlaEngine::oscSend_control_set_parameter_midi_cc(const uint pluginId, const uint32_t index, const int16_t cc) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | ||||
@@ -2556,7 +2600,7 @@ void CarlaEngine::oscSend_control_set_parameter_midi_cc(const uint pluginId, con | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_control_set_parameter_midi_channel(const uint pluginId, const uint32_t index, const uint8_t channel) | |||||
void CarlaEngine::oscSend_control_set_parameter_midi_channel(const uint pluginId, const uint32_t index, const uint8_t channel) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | ||||
@@ -2572,7 +2616,7 @@ void CarlaEngine::oscSend_control_set_parameter_midi_channel(const uint pluginId | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_control_set_parameter_value(const uint pluginId, const int32_t index, const float value) | |||||
void CarlaEngine::oscSend_control_set_parameter_value(const uint pluginId, const int32_t index, const float value) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | ||||
@@ -2587,7 +2631,7 @@ void CarlaEngine::oscSend_control_set_parameter_value(const uint pluginId, const | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_control_set_default_value(const uint pluginId, const uint32_t index, const float value) | |||||
void CarlaEngine::oscSend_control_set_default_value(const uint pluginId, const uint32_t index, const float value) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | ||||
@@ -2602,7 +2646,7 @@ void CarlaEngine::oscSend_control_set_default_value(const uint pluginId, const u | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_control_set_current_program(const uint pluginId, const int32_t index) | |||||
void CarlaEngine::oscSend_control_set_current_program(const uint pluginId, const int32_t index) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | ||||
@@ -2617,7 +2661,7 @@ void CarlaEngine::oscSend_control_set_current_program(const uint pluginId, const | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_control_set_current_midi_program(const uint pluginId, const int32_t index) | |||||
void CarlaEngine::oscSend_control_set_current_midi_program(const uint pluginId, const int32_t index) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | ||||
@@ -2632,7 +2676,7 @@ void CarlaEngine::oscSend_control_set_current_midi_program(const uint pluginId, | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_control_set_program_name(const uint pluginId, const uint32_t index, const char* const name) | |||||
void CarlaEngine::oscSend_control_set_program_name(const uint pluginId, const uint32_t index, const char* const name) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | ||||
@@ -2648,7 +2692,7 @@ void CarlaEngine::oscSend_control_set_program_name(const uint pluginId, const ui | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_control_set_midi_program_data(const uint pluginId, const uint32_t index, const uint32_t bank, const uint32_t program, const char* const name) | |||||
void CarlaEngine::oscSend_control_set_midi_program_data(const uint pluginId, const uint32_t index, const uint32_t bank, const uint32_t program, const char* const name) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | ||||
@@ -2664,7 +2708,7 @@ void CarlaEngine::oscSend_control_set_midi_program_data(const uint pluginId, con | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_control_note_on(const uint pluginId, const uint8_t channel, const uint8_t note, const uint8_t velo) | |||||
void CarlaEngine::oscSend_control_note_on(const uint pluginId, const uint8_t channel, const uint8_t note, const uint8_t velo) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | ||||
@@ -2682,7 +2726,7 @@ void CarlaEngine::oscSend_control_note_on(const uint pluginId, const uint8_t cha | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_control_note_off(const uint pluginId, const uint8_t channel, const uint8_t note) | |||||
void CarlaEngine::oscSend_control_note_off(const uint pluginId, const uint8_t channel, const uint8_t note) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | ||||
@@ -2699,7 +2743,7 @@ void CarlaEngine::oscSend_control_note_off(const uint pluginId, const uint8_t ch | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_control_set_peaks(const uint pluginId) | |||||
void CarlaEngine::oscSend_control_set_peaks(const uint pluginId) const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,); | ||||
@@ -2716,7 +2760,7 @@ void CarlaEngine::oscSend_control_set_peaks(const uint pluginId) | |||||
} | } | ||||
} | } | ||||
void CarlaEngine::oscSend_control_exit() | |||||
void CarlaEngine::oscSend_control_exit() const | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | ||||
carla_debug("CarlaEngine::oscSend_control_exit()"); | carla_debug("CarlaEngine::oscSend_control_exit()"); | ||||
@@ -145,12 +145,12 @@ struct BridgeControl : public RingBufferControl { | |||||
// ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
class CarlaEngineBridge : public CarlaEngine, | class CarlaEngineBridge : public CarlaEngine, | ||||
public juce::Thread | |||||
public CarlaThread | |||||
{ | { | ||||
public: | public: | ||||
CarlaEngineBridge(const char* const audioBaseName, const char* const controlBaseName) | CarlaEngineBridge(const char* const audioBaseName, const char* const controlBaseName) | ||||
: CarlaEngine(), | : CarlaEngine(), | ||||
juce::Thread("CarlaEngineBridge"), | |||||
CarlaThread("CarlaEngineBridge"), | |||||
fIsRunning(false) | fIsRunning(false) | ||||
{ | { | ||||
carla_debug("CarlaEngineBridge::CarlaEngineBridge()"); | carla_debug("CarlaEngineBridge::CarlaEngineBridge()"); | ||||
@@ -208,17 +208,15 @@ public: | |||||
opcode = fShmControl.readOpcode(); | opcode = fShmControl.readOpcode(); | ||||
CARLA_ASSERT_INT(opcode == kPluginBridgeOpcodeSetBufferSize, opcode); | CARLA_ASSERT_INT(opcode == kPluginBridgeOpcodeSetBufferSize, opcode); | ||||
fBufferSize = fShmControl.readInt(); | |||||
carla_stderr("BufferSize: %i", fBufferSize); | |||||
pData->bufferSize = fShmControl.readInt(); | |||||
carla_stderr("BufferSize: %i", pData->bufferSize); | |||||
opcode = fShmControl.readOpcode(); | opcode = fShmControl.readOpcode(); | ||||
CARLA_ASSERT_INT(opcode == kPluginBridgeOpcodeSetSampleRate, opcode); | CARLA_ASSERT_INT(opcode == kPluginBridgeOpcodeSetSampleRate, opcode); | ||||
fSampleRate = fShmControl.readFloat(); | |||||
carla_stderr("SampleRate: %f", fSampleRate); | |||||
pData->sampleRate = fShmControl.readFloat(); | |||||
carla_stderr("SampleRate: %f", pData->sampleRate); | |||||
fIsRunning = true; | |||||
startThread(10); | |||||
CarlaThread::start(); | |||||
CarlaEngine::init(clientName); | CarlaEngine::init(clientName); | ||||
return true; | return true; | ||||
} | } | ||||
@@ -228,7 +226,7 @@ public: | |||||
carla_debug("CarlaEnginePlugin::close()"); | carla_debug("CarlaEnginePlugin::close()"); | ||||
CarlaEngine::close(); | CarlaEngine::close(); | ||||
stopThread(6000); | |||||
CarlaThread::stop(6000); | |||||
fShmControl.clear(); | fShmControl.clear(); | ||||
fShmAudioPool.clear(); | fShmAudioPool.clear(); | ||||
@@ -251,27 +249,34 @@ public: | |||||
return kEngineTypeBridge; | return kEngineTypeBridge; | ||||
} | } | ||||
const char* getCurrentDriverName() const noexcept | |||||
{ | |||||
return "Bridge"; | |||||
} | |||||
// ------------------------------------- | // ------------------------------------- | ||||
// CarlaThread virtual calls | // CarlaThread virtual calls | ||||
void run() override | void run() override | ||||
{ | { | ||||
fIsRunning = true; | |||||
// TODO - set RT permissions | // TODO - set RT permissions | ||||
carla_debug("CarlaEngineBridge::run()"); | carla_debug("CarlaEngineBridge::run()"); | ||||
while (! threadShouldExit()) | |||||
while (! shouldExit()) | |||||
{ | { | ||||
if (! jackbridge_sem_timedwait(&fShmControl.data->runServer, 5)) | if (! jackbridge_sem_timedwait(&fShmControl.data->runServer, 5)) | ||||
{ | { | ||||
if (errno == ETIMEDOUT) | if (errno == ETIMEDOUT) | ||||
{ | { | ||||
fIsRunning = false; | fIsRunning = false; | ||||
signalThreadShouldExit(); | |||||
signalShouldExit(); | |||||
return; | return; | ||||
} | } | ||||
} | } | ||||
while (fShmControl.dataAvailable()) | |||||
while (fShmControl.isDataAvailable()) | |||||
{ | { | ||||
const PluginBridgeOpcode opcode(fShmControl.readOpcode()); | const PluginBridgeOpcode opcode(fShmControl.readOpcode()); | ||||
@@ -306,8 +311,8 @@ public: | |||||
case kPluginBridgeOpcodeSetParameter: | case kPluginBridgeOpcodeSetParameter: | ||||
{ | { | ||||
const int index(fShmControl.readInt()); | |||||
const float value(fShmControl.readFloat()); | |||||
//const int index(fShmControl.readInt()); | |||||
//const float value(fShmControl.readFloat()); | |||||
CarlaPlugin* const plugin(getPluginUnchecked(0)); | CarlaPlugin* const plugin(getPluginUnchecked(0)); | ||||
@@ -322,7 +327,7 @@ public: | |||||
case kPluginBridgeOpcodeSetProgram: | case kPluginBridgeOpcodeSetProgram: | ||||
{ | { | ||||
const int index(fShmControl.readInt()); | |||||
//const int index(fShmControl.readInt()); | |||||
CarlaPlugin* const plugin(getPluginUnchecked(0)); | CarlaPlugin* const plugin(getPluginUnchecked(0)); | ||||
@@ -337,7 +342,7 @@ public: | |||||
case kPluginBridgeOpcodeSetMidiProgram: | case kPluginBridgeOpcodeSetMidiProgram: | ||||
{ | { | ||||
const int index(fShmControl.readInt()); | |||||
//const int index(fShmControl.readInt()); | |||||
CarlaPlugin* const plugin(getPluginUnchecked(0)); | CarlaPlugin* const plugin(getPluginUnchecked(0)); | ||||
@@ -352,18 +357,18 @@ public: | |||||
case kPluginBridgeOpcodeMidiEvent: | case kPluginBridgeOpcodeMidiEvent: | ||||
{ | { | ||||
uint8_t data[4] = { 0 }; | |||||
const long time(fShmControl.readLong()); | |||||
const int dataSize(fShmControl.readInt()); | |||||
//uint8_t data[4] = { 0 }; | |||||
//const long time(fShmControl.readLong()); | |||||
//const int dataSize(fShmControl.readInt()); | |||||
CARLA_ASSERT_INT(dataSize >= 1 && dataSize <= 4, dataSize); | |||||
//CARLA_ASSERT_INT(dataSize >= 1 && dataSize <= 4, dataSize); | |||||
for (int i=0; i < dataSize && i < 4; ++i) | |||||
data[i] = fShmControl.readChar(); | |||||
//for (int i=0; i < dataSize && i < 4; ++i) | |||||
// data[i] = fShmControl.readChar(); | |||||
CARLA_ASSERT(pData->bufEvents.in != nullptr); | |||||
//CARLA_ASSERT(pData->bufEvents.in != nullptr); | |||||
if (pData->bufEvents.in != nullptr) | |||||
//if (pData->bufEvents.in != nullptr) | |||||
{ | { | ||||
// TODO | // TODO | ||||
} | } | ||||
@@ -376,7 +381,7 @@ public: | |||||
CARLA_ASSERT(fShmAudioPool.data != nullptr); | CARLA_ASSERT(fShmAudioPool.data != nullptr); | ||||
CarlaPlugin* const plugin(getPluginUnchecked(0)); | CarlaPlugin* const plugin(getPluginUnchecked(0)); | ||||
if (plugin != nullptr && plugin->isEnabled() && plugin->tryLock()) | |||||
if (plugin != nullptr && plugin->isEnabled() && plugin->tryLock(true)) // FIXME - always lock? | |||||
{ | { | ||||
const uint32_t inCount(plugin->getAudioInCount()); | const uint32_t inCount(plugin->getAudioInCount()); | ||||
const uint32_t outCount(plugin->getAudioOutCount()); | const uint32_t outCount(plugin->getAudioOutCount()); | ||||
@@ -385,19 +390,19 @@ public: | |||||
float* outBuffer[outCount]; | float* outBuffer[outCount]; | ||||
for (uint32_t i=0; i < inCount; ++i) | for (uint32_t i=0; i < inCount; ++i) | ||||
inBuffer[i] = fShmAudioPool.data + i*fBufferSize; | |||||
inBuffer[i] = fShmAudioPool.data + i*pData->bufferSize; | |||||
for (uint32_t i=0; i < outCount; ++i) | for (uint32_t i=0; i < outCount; ++i) | ||||
outBuffer[i] = fShmAudioPool.data + (i+inCount)*fBufferSize; | |||||
outBuffer[i] = fShmAudioPool.data + (i+inCount)*pData->bufferSize; | |||||
plugin->initBuffers(); | plugin->initBuffers(); | ||||
plugin->process(inBuffer, outBuffer, fBufferSize); | |||||
plugin->process(inBuffer, outBuffer, pData->bufferSize); | |||||
plugin->unlock(); | plugin->unlock(); | ||||
} | } | ||||
break; | break; | ||||
} | } | ||||
case kPluginBridgeOpcodeQuit: | case kPluginBridgeOpcodeQuit: | ||||
signalThreadShouldExit(); | |||||
signalShouldExit(); | |||||
break; | break; | ||||
} | } | ||||
} | } | ||||
@@ -444,7 +444,7 @@ public: | |||||
fTransportState(JackTransportStopped), | fTransportState(JackTransportStopped), | ||||
fFreewheel(false), | fFreewheel(false), | ||||
#ifdef BUILD_BRIDGE | #ifdef BUILD_BRIDGE | ||||
fHasQuit(false) | |||||
fIsRunning(false) | |||||
#else | #else | ||||
fLastGroupId(0), | fLastGroupId(0), | ||||
fLastPortId(0), | fLastPortId(0), | ||||
@@ -527,7 +527,23 @@ public: | |||||
carla_zeroStruct<jack_position_t>(fTransportPos); | carla_zeroStruct<jack_position_t>(fTransportPos); | ||||
#ifndef BUILD_BRIDGE | |||||
#ifdef BUILD_BRIDGE | |||||
if (pData->bufferSize == 0 || pData->sampleRate == 0.0) | |||||
{ | |||||
// open temp client to get initial buffer-size and sample-rate values | |||||
if (jack_client_t* tmpClient = jackbridge_client_open(clientName, JackNullOption, nullptr)) | |||||
{ | |||||
pData->bufferSize = jackbridge_get_buffer_size(tmpClient); | |||||
pData->sampleRate = jackbridge_get_sample_rate(tmpClient); | |||||
jackbridge_client_close(tmpClient); | |||||
} | |||||
} | |||||
fIsRunning = true; | |||||
return CarlaEngine::init(clientName); | |||||
#else | |||||
fLastGroupId = 0; | fLastGroupId = 0; | ||||
fLastPortId = 0; | fLastPortId = 0; | ||||
fLastConnectionId = 0; | fLastConnectionId = 0; | ||||
@@ -589,20 +605,6 @@ public: | |||||
setLastError("Failed to create new JACK client"); | setLastError("Failed to create new JACK client"); | ||||
return false; | return false; | ||||
#else | |||||
if (pData->bufferSize == 0 || pData->sampleRate == 0.0) | |||||
{ | |||||
// open temp client to get initial buffer-size and sample-rate values | |||||
if (jack_client_t* tmpClient = jackbridge_client_open(clientName, JackNullOption, nullptr)) | |||||
{ | |||||
pData->bufferSize = jackbridge_get_buffer_size(tmpClient); | |||||
pData->sampleRate = jackbridge_get_sample_rate(tmpClient); | |||||
jackbridge_client_close(tmpClient); | |||||
} | |||||
} | |||||
return CarlaEngine::init(clientName); | |||||
#endif | #endif | ||||
} | } | ||||
@@ -612,8 +614,8 @@ public: | |||||
CarlaEngine::close(); | CarlaEngine::close(); | ||||
#ifdef BUILD_BRIDGE | #ifdef BUILD_BRIDGE | ||||
fClient = nullptr; | |||||
fHasQuit = true; | |||||
fClient = nullptr; | |||||
fIsRunning = false; | |||||
return true; | return true; | ||||
#else | #else | ||||
if (jackbridge_deactivate(fClient)) | if (jackbridge_deactivate(fClient)) | ||||
@@ -646,8 +648,9 @@ public: | |||||
fUsedPortNames.clear(); | fUsedPortNames.clear(); | ||||
fUsedConnections.clear(); | fUsedConnections.clear(); | ||||
fGroupIconsChanged.clear(); | fGroupIconsChanged.clear(); | ||||
#endif | |||||
return false; | return false; | ||||
#endif | |||||
} | } | ||||
#ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
@@ -700,7 +703,7 @@ public: | |||||
bool isRunning() const noexcept override | bool isRunning() const noexcept override | ||||
{ | { | ||||
#ifdef BUILD_BRIDGE | #ifdef BUILD_BRIDGE | ||||
return (fClient != nullptr || ! fHasQuit); | |||||
return (fClient != nullptr || fIsRunning); | |||||
#else | #else | ||||
return (fClient != nullptr); | return (fClient != nullptr); | ||||
#endif | #endif | ||||
@@ -931,7 +934,6 @@ public: | |||||
return true; | return true; | ||||
} | } | ||||
#endif | |||||
// ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
// Transport | // Transport | ||||
@@ -959,6 +961,7 @@ public: | |||||
else if (fClient != nullptr) | else if (fClient != nullptr) | ||||
jackbridge_transport_locate(fClient, static_cast<jack_nframes_t>(frame)); | jackbridge_transport_locate(fClient, static_cast<jack_nframes_t>(frame)); | ||||
} | } | ||||
#endif | |||||
// ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
@@ -1435,7 +1438,7 @@ private: | |||||
// ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
#ifdef BUILD_BRIDGE | #ifdef BUILD_BRIDGE | ||||
bool fHasQuit; | |||||
bool fIsRunning; | |||||
#else | #else | ||||
enum RackPorts { | enum RackPorts { | ||||
kRackPortAudioIn1 = 0, | kRackPortAudioIn1 = 0, | ||||
@@ -92,7 +92,7 @@ void CarlaEngineThread::run() | |||||
if (oscRegisted) | if (oscRegisted) | ||||
{ | { | ||||
#ifdef BUILD_BRIDGE | #ifdef BUILD_BRIDGE | ||||
fEngine->oscSend_bridge_set_parameter_value(j, value); | |||||
fEngine->oscSend_bridge_parameter_value(j, value); | |||||
#else | #else | ||||
fEngine->oscSend_control_set_parameter_value(i, j, value); | fEngine->oscSend_control_set_parameter_value(i, j, value); | ||||
#endif | #endif | ||||
@@ -248,17 +248,17 @@ bool CarlaPlugin::isEnabled() const noexcept | |||||
const char* CarlaPlugin::getName() const noexcept | const char* CarlaPlugin::getName() const noexcept | ||||
{ | { | ||||
return (const char*)pData->name; | |||||
return pData->name; | |||||
} | } | ||||
const char* CarlaPlugin::getFilename() const noexcept | const char* CarlaPlugin::getFilename() const noexcept | ||||
{ | { | ||||
return (const char*)pData->filename; | |||||
return pData->filename; | |||||
} | } | ||||
const char* CarlaPlugin::getIconName() const noexcept | const char* CarlaPlugin::getIconName() const noexcept | ||||
{ | { | ||||
return (const char*)pData->iconName; | |||||
return pData->iconName; | |||||
} | } | ||||
uint32_t CarlaPlugin::getLatencyInFrames() const noexcept | uint32_t CarlaPlugin::getLatencyInFrames() const noexcept | ||||
@@ -1524,6 +1524,7 @@ void CarlaPlugin::registerToOscClient() | |||||
// Base data | // Base data | ||||
{ | { | ||||
// TODO - clear buf | |||||
char bufName[STR_MAX+1] = { '\0' }; | char bufName[STR_MAX+1] = { '\0' }; | ||||
char bufLabel[STR_MAX+1] = { '\0' }; | char bufLabel[STR_MAX+1] = { '\0' }; | ||||
char bufMaker[STR_MAX+1] = { '\0' }; | char bufMaker[STR_MAX+1] = { '\0' }; | ||||
@@ -1534,7 +1535,8 @@ void CarlaPlugin::registerToOscClient() | |||||
getCopyright(bufCopyright); | getCopyright(bufCopyright); | ||||
#ifdef BUILD_BRIDGE | #ifdef BUILD_BRIDGE | ||||
pData->engine->oscSend_bridge_plugin_info(getCategory(), pData->hints, bufName, bufLabel, bufMaker, bufCopyright, getUniqueId()); | |||||
pData->engine->oscSend_bridge_plugin_info1(getCategory(), pData->hints, getUniqueId()); | |||||
pData->engine->oscSend_bridge_plugin_info2(bufName, bufLabel, bufMaker, bufCopyright); | |||||
#else | #else | ||||
pData->engine->oscSend_control_set_plugin_info1(pData->id, getType(), getCategory(), pData->hints, getUniqueId()); | pData->engine->oscSend_control_set_plugin_info1(pData->id, getType(), getCategory(), pData->hints, getUniqueId()); | ||||
pData->engine->oscSend_control_set_plugin_info2(pData->id, bufName, bufLabel, bufMaker, bufCopyright); | pData->engine->oscSend_control_set_plugin_info2(pData->id, bufName, bufLabel, bufMaker, bufCopyright); | ||||
@@ -1547,8 +1549,8 @@ void CarlaPlugin::registerToOscClient() | |||||
getParameterCountInfo(paramIns, paramOuts); | getParameterCountInfo(paramIns, paramOuts); | ||||
#ifdef BUILD_BRIDGE | #ifdef BUILD_BRIDGE | ||||
pData->engine->oscSend_bridge_audio_count(getAudioInCount(), getAudioOutCount(), getAudioInCount() + getAudioOutCount()); | |||||
pData->engine->oscSend_bridge_midi_count(getMidiInCount(), getMidiOutCount(), getMidiInCount() + getMidiOutCount()); | |||||
pData->engine->oscSend_bridge_audio_count(getAudioInCount(), getAudioOutCount()); | |||||
pData->engine->oscSend_bridge_midi_count(getMidiInCount(), getMidiOutCount()); | |||||
pData->engine->oscSend_bridge_parameter_count(paramIns, paramOuts); | pData->engine->oscSend_bridge_parameter_count(paramIns, paramOuts); | ||||
#else | #else | ||||
pData->engine->oscSend_control_set_audio_count(pData->id, getAudioInCount(), getAudioOutCount()); | pData->engine->oscSend_control_set_audio_count(pData->id, getAudioInCount(), getAudioOutCount()); | ||||
@@ -1574,10 +1576,12 @@ void CarlaPlugin::registerToOscClient() | |||||
const ParameterRanges& paramRanges(pData->param.ranges[i]); | const ParameterRanges& paramRanges(pData->param.ranges[i]); | ||||
#ifdef BUILD_BRIDGE | #ifdef BUILD_BRIDGE | ||||
pData->engine->oscSend_bridge_parameter_info(i, bufName, bufUnit); | |||||
pData->engine->oscSend_bridge_parameter_data(i, paramData.type, paramData.hints, paramData.rindex, paramData.midiChannel, paramData.midiCC); | |||||
pData->engine->oscSend_bridge_parameter_ranges(i, paramRanges.def, paramRanges.min, paramRanges.max, paramRanges.step, paramRanges.stepSmall, paramRanges.stepLarge); | |||||
pData->engine->oscSend_bridge_set_parameter_value(i, getParameterValue(i)); | |||||
pData->engine->oscSend_bridge_parameter_data(i, paramData.rindex, paramData.type, paramData.hints, bufName, bufUnit); | |||||
pData->engine->oscSend_bridge_parameter_ranges1(i, paramRanges.def, paramRanges.min, paramRanges.max); | |||||
pData->engine->oscSend_bridge_parameter_ranges2(i, paramRanges.step, paramRanges.stepSmall, paramRanges.stepLarge); | |||||
pData->engine->oscSend_bridge_parameter_value(i, getParameterValue(i)); | |||||
pData->engine->oscSend_bridge_parameter_midi_cc(i, paramData.midiCC); | |||||
pData->engine->oscSend_bridge_parameter_midi_channel(i, paramData.midiChannel); | |||||
#else | #else | ||||
pData->engine->oscSend_control_set_parameter_data(pData->id, i, paramData.type, paramData.hints, bufName, bufUnit); | pData->engine->oscSend_control_set_parameter_data(pData->id, i, paramData.type, paramData.hints, bufName, bufUnit); | ||||
pData->engine->oscSend_control_set_parameter_ranges1(pData->id, i, paramRanges.def, paramRanges.min, paramRanges.max); | pData->engine->oscSend_control_set_parameter_ranges1(pData->id, i, paramRanges.def, paramRanges.min, paramRanges.max); | ||||
@@ -1596,9 +1600,9 @@ void CarlaPlugin::registerToOscClient() | |||||
pData->engine->oscSend_bridge_program_count(pData->prog.count); | pData->engine->oscSend_bridge_program_count(pData->prog.count); | ||||
for (uint32_t i=0; i < pData->prog.count; ++i) | for (uint32_t i=0; i < pData->prog.count; ++i) | ||||
pData->engine->oscSend_bridge_program_info(i, pData->prog.names[i]); | |||||
pData->engine->oscSend_bridge_program_name(i, pData->prog.names[i]); | |||||
pData->engine->oscSend_bridge_set_current_program(pData->prog.current); | |||||
pData->engine->oscSend_bridge_current_program(pData->prog.current); | |||||
#else | #else | ||||
pData->engine->oscSend_control_set_program_count(pData->id, pData->prog.count); | pData->engine->oscSend_control_set_program_count(pData->id, pData->prog.count); | ||||
@@ -1619,10 +1623,10 @@ void CarlaPlugin::registerToOscClient() | |||||
{ | { | ||||
const MidiProgramData& mpData(pData->midiprog.data[i]); | const MidiProgramData& mpData(pData->midiprog.data[i]); | ||||
pData->engine->oscSend_bridge_midi_program_info(i, mpData.bank, mpData.program, mpData.name); | |||||
pData->engine->oscSend_bridge_midi_program_data(i, mpData.bank, mpData.program, mpData.name); | |||||
} | } | ||||
pData->engine->oscSend_bridge_set_current_midi_program(pData->midiprog.current); | |||||
pData->engine->oscSend_bridge_current_midi_program(pData->midiprog.current); | |||||
#else | #else | ||||
pData->engine->oscSend_control_set_midi_program_count(pData->id, pData->midiprog.count); | pData->engine->oscSend_control_set_midi_program_count(pData->id, pData->midiprog.count); | ||||
@@ -693,8 +693,8 @@ struct CarlaPluginProtectedData { | |||||
// mutex MUST have been locked before | // mutex MUST have been locked before | ||||
const bool lockMaster(masterMutex.tryLock()); | const bool lockMaster(masterMutex.tryLock()); | ||||
const bool lockSingle(singleMutex.tryLock()); | const bool lockSingle(singleMutex.tryLock()); | ||||
CARLA_ASSERT(! lockMaster); | |||||
CARLA_ASSERT(! lockSingle); | |||||
CARLA_SAFE_ASSERT(! lockMaster); | |||||
CARLA_SAFE_ASSERT(! lockSingle); | |||||
} | } | ||||
if (client != nullptr) | if (client != nullptr) | ||||
@@ -812,11 +812,7 @@ struct CarlaPluginProtectedData { | |||||
for (uint32_t i=0; i < audioIn.count; ++i) | for (uint32_t i=0; i < audioIn.count; ++i) | ||||
{ | { | ||||
latencyBuffers[i] = new float[latency]; | latencyBuffers[i] = new float[latency]; | ||||
#ifdef USE_JUCE | |||||
FloatVectorOperations::clear(latencyBuffers[i], latency); | |||||
#else | |||||
carla_zeroFloat(latencyBuffers[i], latency); | |||||
#endif | |||||
FLOAT_CLEAR(latencyBuffers[i], latency); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -828,11 +824,7 @@ struct CarlaPluginProtectedData { | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(type != kPluginPostRtEventNull,); | CARLA_SAFE_ASSERT_RETURN(type != kPluginPostRtEventNull,); | ||||
PluginPostRtEvent event; | |||||
event.type = type; | |||||
event.value1 = value1; | |||||
event.value2 = value2; | |||||
event.value3 = value3; | |||||
PluginPostRtEvent event = { type, value1, value2, value3 }; | |||||
postRtEvents.appendRT(event); | postRtEvents.appendRT(event); | ||||
} | } | ||||
@@ -54,7 +54,7 @@ CarlaPluginThread::CarlaPluginThread(CarlaBackend::CarlaEngine* const engine, Ca | |||||
fPlugin(plugin), | fPlugin(plugin), | ||||
fMode(mode) | fMode(mode) | ||||
{ | { | ||||
carla_debug("CarlaPluginThread::CarlaPluginThread(plugin:\"%s\", engine:\"%s\", %s)", plugin->getName(), engine->getName(), PluginThreadMode2str(mode)); | |||||
carla_debug("CarlaPluginThread::CarlaPluginThread(%p, %p, %s)", engine, plugin, PluginThreadMode2str(mode)); | |||||
//setPriority(5); | //setPriority(5); | ||||
} | } | ||||
@@ -1411,10 +1411,7 @@ public: | |||||
else | else | ||||
pData->name = pData->engine->getUniquePluginName(fDescriptor->Label); | pData->name = pData->engine->getUniquePluginName(fDescriptor->Label); | ||||
pData->filename = filename; | |||||
CARLA_ASSERT(pData->name != nullptr); | |||||
CARLA_ASSERT(pData->filename != nullptr); | |||||
pData->filename = carla_strdup(filename); | |||||
// --------------------------------------------------------------- | // --------------------------------------------------------------- | ||||
// register client | // register client | ||||
@@ -1457,13 +1454,14 @@ public: | |||||
if (pData->engine->getOptions().forceStereo) | if (pData->engine->getOptions().forceStereo) | ||||
pData->options |= PLUGIN_OPTION_FORCE_STEREO; | pData->options |= PLUGIN_OPTION_FORCE_STEREO; | ||||
// load settings TODO | |||||
pData->identifier = "LADSPA/"; | |||||
//pData->idStr += std::strrchr(filename, OS_SEP)+1; | |||||
//pData->idStr += "/"; | |||||
//pData->idStr += CarlaString(getUniqueId()); | |||||
//pData->idStr += "/"; | |||||
//pData->idStr += label; | |||||
// set identifier string | |||||
CarlaString identifier("LADSPA/"); | |||||
identifier += CarlaString(getUniqueId()); | |||||
identifier += ","; | |||||
identifier += label; | |||||
pData->identifier = identifier.dup(); | |||||
// load settings | |||||
pData->options = pData->loadSettings(pData->options, getOptionsAvailable()); | pData->options = pData->loadSettings(pData->options, getOptionsAvailable()); | ||||
// ignore settings, we need this anyway | // ignore settings, we need this anyway | ||||
@@ -124,9 +124,9 @@ struct CarlaBackendStandalone { | |||||
#ifdef BUILD_BRIDGE | #ifdef BUILD_BRIDGE | ||||
engineOptions.processMode = CB::ENGINE_PROCESS_MODE_BRIDGE; | engineOptions.processMode = CB::ENGINE_PROCESS_MODE_BRIDGE; | ||||
engineOptions.transportMode = CB::ENGINE_TRANSPORT_MODE_BRIDGE; | engineOptions.transportMode = CB::ENGINE_TRANSPORT_MODE_BRIDGE; | ||||
engineOptions.forceStereo = CB::ENGINE_OPTION_FORCE_STEREO = false; | |||||
engineOptions.preferPluginBridges = CB::ENGINE_OPTION_PREFER_PLUGIN_BRIDGES = false; | |||||
engineOptions.preferUiBridges = CB::ENGINE_OPTION_PREFER_UI_BRIDGES = false; | |||||
engineOptions.forceStereo = false; | |||||
engineOptions.preferPluginBridges = false; | |||||
engineOptions.preferUiBridges = false; | |||||
#endif | #endif | ||||
} | } | ||||
@@ -442,8 +442,14 @@ bool carla_engine_init(const char* driverName, const char* clientName) | |||||
gStandalone.engine->setCallback(gStandalone.engineCallback, gStandalone.engineCallbackPtr); | gStandalone.engine->setCallback(gStandalone.engineCallback, gStandalone.engineCallbackPtr); | ||||
#ifdef BUILD_BRIDGE | |||||
gStandalone.engine->setOption(CB::ENGINE_OPTION_PROCESS_MODE, CB::ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS, nullptr); | |||||
gStandalone.engine->setOption(CB::ENGINE_OPTION_TRANSPORT_MODE, CB::ENGINE_TRANSPORT_MODE_JACK, nullptr); | |||||
#else | |||||
gStandalone.engine->setOption(CB::ENGINE_OPTION_PROCESS_MODE, static_cast<int>(gStandalone.engineOptions.processMode), nullptr); | gStandalone.engine->setOption(CB::ENGINE_OPTION_PROCESS_MODE, static_cast<int>(gStandalone.engineOptions.processMode), nullptr); | ||||
gStandalone.engine->setOption(CB::ENGINE_OPTION_TRANSPORT_MODE, static_cast<int>(gStandalone.engineOptions.transportMode), nullptr); | gStandalone.engine->setOption(CB::ENGINE_OPTION_TRANSPORT_MODE, static_cast<int>(gStandalone.engineOptions.transportMode), nullptr); | ||||
#endif | |||||
gStandalone.engine->setOption(CB::ENGINE_OPTION_FORCE_STEREO, gStandalone.engineOptions.forceStereo ? 1 : 0, nullptr); | gStandalone.engine->setOption(CB::ENGINE_OPTION_FORCE_STEREO, gStandalone.engineOptions.forceStereo ? 1 : 0, nullptr); | ||||
gStandalone.engine->setOption(CB::ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, gStandalone.engineOptions.preferPluginBridges ? 1 : 0, nullptr); | gStandalone.engine->setOption(CB::ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, gStandalone.engineOptions.preferPluginBridges ? 1 : 0, nullptr); | ||||
gStandalone.engine->setOption(CB::ENGINE_OPTION_PREFER_UI_BRIDGES, gStandalone.engineOptions.preferUiBridges ? 1 : 0, nullptr); | gStandalone.engine->setOption(CB::ENGINE_OPTION_PREFER_UI_BRIDGES, gStandalone.engineOptions.preferUiBridges ? 1 : 0, nullptr); | ||||
@@ -18,7 +18,7 @@ | |||||
#ifndef CARLA_BRIDGE_HPP_INCLUDED | #ifndef CARLA_BRIDGE_HPP_INCLUDED | ||||
#define CARLA_BRIDGE_HPP_INCLUDED | #define CARLA_BRIDGE_HPP_INCLUDED | ||||
#include "CarlaDefines.hpp" | |||||
#include "CarlaDefines.h" | |||||
#define CARLA_BRIDGE_START_NAMESPACE namespace CarlaBridge { | #define CARLA_BRIDGE_START_NAMESPACE namespace CarlaBridge { | ||||
#define CARLA_BRIDGE_END_NAMESPACE } | #define CARLA_BRIDGE_END_NAMESPACE } | ||||
@@ -19,18 +19,18 @@ | |||||
#include "CarlaEngine.hpp" | #include "CarlaEngine.hpp" | ||||
#include "CarlaPlugin.hpp" | #include "CarlaPlugin.hpp" | ||||
#include "CarlaHost.hpp" | |||||
#include "CarlaHost.h" | |||||
#include "CarlaBackendUtils.hpp" | #include "CarlaBackendUtils.hpp" | ||||
#include "CarlaBridgeUtils.hpp" | #include "CarlaBridgeUtils.hpp" | ||||
#include "juce_core.h" | |||||
//#include "juce_core.h" | |||||
#ifdef CARLA_OS_UNIX | #ifdef CARLA_OS_UNIX | ||||
# include <signal.h> | # include <signal.h> | ||||
#endif | #endif | ||||
using juce::File; | |||||
//using juce::File; | |||||
// ------------------------------------------------------------------------- | // ------------------------------------------------------------------------- | ||||
@@ -103,14 +103,15 @@ class CarlaPluginClient : public CarlaBridgeClient | |||||
public: | public: | ||||
CarlaPluginClient(const bool useBridge, const char* const driverName, const char* audioBaseName, const char* controlBaseName) | CarlaPluginClient(const bool useBridge, const char* const driverName, const char* audioBaseName, const char* controlBaseName) | ||||
: CarlaBridgeClient(nullptr), | : CarlaBridgeClient(nullptr), | ||||
fEngine(nullptr), | |||||
fPlugin(nullptr) | |||||
fPlugin(nullptr), | |||||
fEngine(nullptr) | |||||
{ | { | ||||
CARLA_ASSERT(driverName != nullptr && driverName[0] != '\0'); | CARLA_ASSERT(driverName != nullptr && driverName[0] != '\0'); | ||||
carla_debug("CarlaPluginClient::CarlaPluginClient(%s, \"%s\", %s, %s)", bool2str(useBridge), driverName, audioBaseName, controlBaseName); | carla_debug("CarlaPluginClient::CarlaPluginClient(%s, \"%s\", %s, %s)", bool2str(useBridge), driverName, audioBaseName, controlBaseName); | ||||
carla_set_engine_callback(callback, this); | carla_set_engine_callback(callback, this); | ||||
#if 0 | |||||
File curDir(File::getSpecialLocation(File::currentApplicationFile).getParentDirectory()); | File curDir(File::getSpecialLocation(File::currentApplicationFile).getParentDirectory()); | ||||
if (curDir.getChildFile("resources").exists()) | if (curDir.getChildFile("resources").exists()) | ||||
@@ -119,13 +120,14 @@ public: | |||||
carla_set_engine_option(CarlaBackend::OPTION_PATH_RESOURCES, 0, curDir.getChildFile("../../modules/carla_native/resources").getFullPathName().toRawUTF8()); | carla_set_engine_option(CarlaBackend::OPTION_PATH_RESOURCES, 0, curDir.getChildFile("../../modules/carla_native/resources").getFullPathName().toRawUTF8()); | ||||
else | else | ||||
carla_set_engine_option(CarlaBackend::OPTION_PATH_RESOURCES, 0, curDir.getChildFile("../modules/carla_native/resources").getFullPathName().toRawUTF8()); | carla_set_engine_option(CarlaBackend::OPTION_PATH_RESOURCES, 0, curDir.getChildFile("../modules/carla_native/resources").getFullPathName().toRawUTF8()); | ||||
#endif | |||||
if (useBridge) | if (useBridge) | ||||
carla_engine_init_bridge(audioBaseName, controlBaseName, driverName); | carla_engine_init_bridge(audioBaseName, controlBaseName, driverName); | ||||
else | else | ||||
carla_engine_init("JACK", driverName); | carla_engine_init("JACK", driverName); | ||||
fEngine = carla_get_standalone_engine(); | |||||
fEngine = carla_get_engine(); | |||||
} | } | ||||
~CarlaPluginClient() override | ~CarlaPluginClient() override | ||||
@@ -156,8 +158,8 @@ public: | |||||
fProjFileName = fPlugin->getName(); | fProjFileName = fPlugin->getName(); | ||||
fProjFileName += ".carxs"; | fProjFileName += ".carxs"; | ||||
if (! File::isAbsolutePath((const char*)fProjFileName)) | |||||
fProjFileName = File::getCurrentWorkingDirectory().getChildFile((const char*)fProjFileName).getFullPathName().toRawUTF8(); | |||||
//if (! File::isAbsolutePath((const char*)fProjFileName)) | |||||
// fProjFileName = File::getCurrentWorkingDirectory().getChildFile((const char*)fProjFileName).getFullPathName().toRawUTF8(); | |||||
if (! fPlugin->loadStateFromFile(fProjFileName)) | if (! fPlugin->loadStateFromFile(fProjFileName)) | ||||
carla_stderr("Plugin preset load failed, error was:\n%s", fEngine->getLastError()); | carla_stderr("Plugin preset load failed, error was:\n%s", fEngine->getLastError()); | ||||
@@ -216,7 +218,7 @@ public: | |||||
fEngine->oscSend_bridge_set_custom_data(cdata.type, cdata.key, cdata.value); | fEngine->oscSend_bridge_set_custom_data(cdata.type, cdata.key, cdata.value); | ||||
} | } | ||||
if (fPlugin->getOptions() & CarlaBackend::PLUGIN_OPTION_USE_CHUNKS) | |||||
if (fPlugin->getOptionsEnabled() & CarlaBackend::PLUGIN_OPTION_USE_CHUNKS) | |||||
{ | { | ||||
void* data = nullptr; | void* data = nullptr; | ||||
int32_t dataSize = fPlugin->getChunkData(&data); | int32_t dataSize = fPlugin->getChunkData(&data); | ||||
@@ -249,7 +251,7 @@ public: | |||||
fEngine->oscSend_bridge_configure(CARLA_BRIDGE_MSG_SAVED, ""); | fEngine->oscSend_bridge_configure(CARLA_BRIDGE_MSG_SAVED, ""); | ||||
} | } | ||||
void setParameterMidiChannel(const int32_t index, const int32_t channel) | |||||
void setParameterMidiChannel(const int32_t index, const uint8_t channel) | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(fPlugin != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fPlugin != nullptr,); | ||||
carla_debug("CarlaPluginClient::setParameterMidiChannel(%i, %i)", index, channel); | carla_debug("CarlaPluginClient::setParameterMidiChannel(%i, %i)", index, channel); | ||||
@@ -257,7 +259,7 @@ public: | |||||
fPlugin->setParameterMidiChannel(index, channel, false, false); | fPlugin->setParameterMidiChannel(index, channel, false, false); | ||||
} | } | ||||
void setParameterMidiCC(const int32_t index, const int32_t cc) | |||||
void setParameterMidiCC(const int32_t index, const int16_t cc) | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(fPlugin != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fPlugin != nullptr,); | ||||
carla_debug("CarlaPluginClient::setParameterMidiCC(%i, %i)", index, cc); | carla_debug("CarlaPluginClient::setParameterMidiCC(%i, %i)", index, cc); | ||||
@@ -306,7 +308,7 @@ public: | |||||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
protected: | protected: | ||||
void handleCallback(const CarlaBackend::CallbackType action, const int value1, const int value2, const float value3, const char* const valueStr) | |||||
void handleCallback(const CarlaBackend::EngineCallbackOpcode action, const int value1, const int value2, const float value3, const char* const valueStr) | |||||
{ | { | ||||
CARLA_BACKEND_USE_NAMESPACE; | CARLA_BACKEND_USE_NAMESPACE; | ||||
@@ -314,12 +316,12 @@ protected: | |||||
switch (action) | switch (action) | ||||
{ | { | ||||
case CALLBACK_PARAMETER_VALUE_CHANGED: | |||||
case ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED: | |||||
if (isOscControlRegistered()) | if (isOscControlRegistered()) | ||||
sendOscControl(value1, value3); | sendOscControl(value1, value3); | ||||
break; | break; | ||||
case CALLBACK_SHOW_GUI: | |||||
case ENGINE_CALLBACK_UI_STATE_CHANGED: | |||||
if (! isOscControlRegistered()) | if (! isOscControlRegistered()) | ||||
{ | { | ||||
if (value1 != 1) | if (value1 != 1) | ||||
@@ -342,14 +344,14 @@ protected: | |||||
} | } | ||||
private: | private: | ||||
CarlaBackend::CarlaEngine* fEngine; | |||||
CarlaBackend::CarlaPlugin* fPlugin; | CarlaBackend::CarlaPlugin* fPlugin; | ||||
const CarlaBackend::CarlaEngine* fEngine; | |||||
CarlaString fProjFileName; | CarlaString fProjFileName; | ||||
static void callback(void* ptr, CarlaBackend::CallbackType action, unsigned int pluginId, int value1, int value2, float value3, const char* valueStr) | |||||
static void callback(void* ptr, CarlaBackend::EngineCallbackOpcode action, unsigned int pluginId, int value1, int value2, float value3, const char* valueStr) | |||||
{ | { | ||||
carla_debug("CarlaPluginClient::callback(%p, %i:%s, %i, %i, %i, %f, \"%s\")", ptr, action, CarlaBackend::CallbackType2Str(action), pluginId, value1, value2, value3, valueStr); | |||||
carla_debug("CarlaPluginClient::callback(%p, %i:%s, %i, %i, %i, %f, \"%s\")", ptr, action, CarlaBackend::EngineCallbackOpcode2Str(action), pluginId, value1, value2, value3, valueStr); | |||||
CARLA_SAFE_ASSERT_RETURN(ptr != nullptr,); | CARLA_SAFE_ASSERT_RETURN(ptr != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(pluginId == 0,); | CARLA_SAFE_ASSERT_RETURN(pluginId == 0,); | ||||
@@ -363,7 +365,7 @@ int CarlaBridgeOsc::handleMsgShow() | |||||
{ | { | ||||
carla_debug("CarlaBridgeOsc::handleMsgShow()"); | carla_debug("CarlaBridgeOsc::handleMsgShow()"); | ||||
carla_show_gui(0, true); | |||||
carla_show_custom_ui(0, true); | |||||
return 0; | return 0; | ||||
} | } | ||||
@@ -371,7 +373,7 @@ int CarlaBridgeOsc::handleMsgHide() | |||||
{ | { | ||||
carla_debug("CarlaBridgeOsc::handleMsgHide()"); | carla_debug("CarlaBridgeOsc::handleMsgHide()"); | ||||
carla_show_gui(0, false); | |||||
carla_show_custom_ui(0, false); | |||||
return 0; | return 0; | ||||
} | } | ||||
@@ -405,8 +407,11 @@ int CarlaBridgeOsc::handleMsgPluginSetParameterMidiChannel(CARLA_BRIDGE_OSC_HAND | |||||
const int32_t index = argv[0]->i; | const int32_t index = argv[0]->i; | ||||
const int32_t channel = argv[1]->i; | const int32_t channel = argv[1]->i; | ||||
CARLA_SAFE_ASSERT_RETURN(index >= 0, 0); | |||||
CARLA_SAFE_ASSERT_RETURN(channel >= 0 && channel < MAX_MIDI_CHANNELS, 0); | |||||
CarlaPluginClient* const plugClient((CarlaPluginClient*)fClient); | CarlaPluginClient* const plugClient((CarlaPluginClient*)fClient); | ||||
plugClient->setParameterMidiChannel(index, channel); | |||||
plugClient->setParameterMidiChannel(static_cast<uint32_t>(index), static_cast<uint8_t>(channel)); | |||||
return 0; | return 0; | ||||
} | } | ||||
@@ -420,8 +425,11 @@ int CarlaBridgeOsc::handleMsgPluginSetParameterMidiCC(CARLA_BRIDGE_OSC_HANDLE_AR | |||||
const int32_t index = argv[0]->i; | const int32_t index = argv[0]->i; | ||||
const int32_t cc = argv[1]->i; | const int32_t cc = argv[1]->i; | ||||
CARLA_SAFE_ASSERT_RETURN(index >= 0, 0); | |||||
CARLA_SAFE_ASSERT_RETURN(cc >= 1 && cc < 0x5F, 0); | |||||
CarlaPluginClient* const plugClient((CarlaPluginClient*)fClient); | CarlaPluginClient* const plugClient((CarlaPluginClient*)fClient); | ||||
plugClient->setParameterMidiCC(index, cc); | |||||
plugClient->setParameterMidiCC(static_cast<uint32_t>(index), static_cast<int16_t>(cc)); | |||||
return 0; | return 0; | ||||
} | } | ||||
@@ -529,8 +537,8 @@ int main(int argc, char* argv[]) | |||||
CarlaString clientName((name != nullptr) ? name : label); | CarlaString clientName((name != nullptr) ? name : label); | ||||
if (clientName.isEmpty()) | |||||
clientName = File(filename).getFileNameWithoutExtension().toRawUTF8(); | |||||
//if (clientName.isEmpty()) | |||||
// clientName = File(filename).getFileNameWithoutExtension().toRawUTF8(); | |||||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
// Set extraStuff | // Set extraStuff | ||||
@@ -586,8 +594,8 @@ int main(int argc, char* argv[]) | |||||
if (const CarlaPluginInfo* const pluginInfo = carla_get_plugin_info(0)) | if (const CarlaPluginInfo* const pluginInfo = carla_get_plugin_info(0)) | ||||
{ | { | ||||
if (pluginInfo->hints & CarlaBackend::PLUGIN_HAS_GUI) | |||||
carla_show_gui(0, true); | |||||
if (pluginInfo->hints & CarlaBackend::PLUGIN_HAS_CUSTOM_UI) | |||||
carla_show_custom_ui(0, true); | |||||
} | } | ||||
} | } | ||||
@@ -9,36 +9,37 @@ include ../Makefile.mk | |||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
# TODO: remove in favour of juce gui stuff | # TODO: remove in favour of juce gui stuff | ||||
QT5_UI_FLAGS = $(shell pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets) | |||||
QT5_UI_LIBS = $(shell pkg-config --libs Qt5Core Qt5Gui Qt5Widgets) | |||||
# QT5_UI_FLAGS = $(shell pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets) | |||||
# QT5_UI_LIBS = $(shell pkg-config --libs Qt5Core Qt5Gui Qt5Widgets) | |||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
BUILD_CXX_FLAGS += -DBUILD_BRIDGE | BUILD_CXX_FLAGS += -DBUILD_BRIDGE | ||||
BUILD_CXX_FLAGS += -I. -I../backend -I../includes -I../modules -I../modules/theme -I../utils | |||||
BUILD_CXX_FLAGS += $(shell pkg-config --cflags liblo) | |||||
LINK_FLAGS += $(shell pkg-config --libs liblo) | |||||
BUILD_CXX_FLAGS += -I. -I../backend -I../includes -I../utils -isystem ../modules -isystem ../modules/theme | |||||
BUILD_CXX_FLAGS += $(shell pkg-config --cflags liblo) $(QTCORE_FLAGS) | |||||
LINK_FLAGS += $(shell pkg-config --libs liblo) $(QTCORE_LIBS) | |||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
# Plugin bridges | # Plugin bridges | ||||
BUILD_PLUGIN_FLAGS = $(BUILD_CXX_FLAGS) -DBUILD_BRIDGE_PLUGIN | |||||
BUILD_PLUGIN_FLAGS = $(BUILD_CXX_FLAGS) $(QTXML_FLAGS) -DBUILD_BRIDGE_PLUGIN | |||||
BUILD_PLUGIN_FLAGS += -I../backend/engine -I../backend/plugin | BUILD_PLUGIN_FLAGS += -I../backend/engine -I../backend/plugin | ||||
LINK_PLUGIN_FLAGS = $(LINK_FLAGS) -lpthread | |||||
LINK_PLUGIN_FLAGS = $(LINK_FLAGS) $(QTXML_LIBS) -lpthread | |||||
ifeq ($(CARLA_PLUGIN_SUPPORT),true) | ifeq ($(CARLA_PLUGIN_SUPPORT),true) | ||||
BUILD_PLUGIN_FLAGS += -DWANT_LADSPA -DWANT_DSSI -DWANT_LV2 -DWANT_VST | |||||
ifeq ($(CARLA_VESTIGE_HEADER),true) | |||||
BUILD_PLUGIN_FLAGS += -DVESTIGE_HEADER | |||||
endif | |||||
BUILD_PLUGIN_FLAGS += -DWANT_LADSPA | |||||
# -DWANT_DSSI -DWANT_LV2 -DWANT_VST | |||||
# ifeq ($(CARLA_VESTIGE_HEADER),true) | |||||
# BUILD_PLUGIN_FLAGS += -DVESTIGE_HEADER | |||||
# endif | |||||
endif | endif | ||||
LINK_PLUGIN_FLAGS += $(JUCE_AUDIO_BASICS_LIBS) | |||||
LINK_PLUGIN_FLAGS += $(JUCE_CORE_LIBS) | |||||
LINK_PLUGIN_FLAGS += $(JUCE_DATA_STRUCTURES_LIBS) | |||||
LINK_PLUGIN_FLAGS += $(JUCE_EVENTS_LIBS) | |||||
LINK_PLUGIN_FLAGS += $(JUCE_GRAPHICS_LIBS) | |||||
LINK_PLUGIN_FLAGS += $(JUCE_GUI_BASICS_LIBS) | |||||
# LINK_PLUGIN_FLAGS += $(JUCE_AUDIO_BASICS_LIBS) | |||||
# LINK_PLUGIN_FLAGS += $(JUCE_CORE_LIBS) | |||||
# LINK_PLUGIN_FLAGS += $(JUCE_DATA_STRUCTURES_LIBS) | |||||
# LINK_PLUGIN_FLAGS += $(JUCE_EVENTS_LIBS) | |||||
# LINK_PLUGIN_FLAGS += $(JUCE_GRAPHICS_LIBS) | |||||
# LINK_PLUGIN_FLAGS += $(JUCE_GUI_BASICS_LIBS) | |||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
# Plugin bridges (POSIX) | # Plugin bridges (POSIX) | ||||
@@ -48,10 +49,6 @@ POSIX_32BIT_FLAGS = $(32BIT_FLAGS) -L/usr/lib32 -L/usr/lib/i386-linux-gnu | |||||
POSIX_64BIT_FLAGS = $(64BIT_FLAGS) -L/usr/lib64 -L/usr/lib/x86_64-linux-gnu | POSIX_64BIT_FLAGS = $(64BIT_FLAGS) -L/usr/lib64 -L/usr/lib/x86_64-linux-gnu | ||||
POSIX_LINK_FLAGS = $(LINK_PLUGIN_FLAGS) -ldl | POSIX_LINK_FLAGS = $(LINK_PLUGIN_FLAGS) -ldl | ||||
ifneq ($(MACOS),true) | |||||
POSIX_LINK_FLAGS += -lrt | |||||
endif | |||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
# Plugin bridges (Windows) | # Plugin bridges (Windows) | ||||
@@ -63,47 +60,48 @@ WIN_LINK_FLAGS = $(LINK_PLUGIN_FLAGS) -L../modules | |||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
# Plugin bridges (Native) | # Plugin bridges (Native) | ||||
NATIVE_BUILD_FLAGS = $(POSIX_BUILD_FLAGS) -DWANT_NATIVE | |||||
NATIVE_BUILD_FLAGS = $(POSIX_BUILD_FLAGS) | |||||
# -DWANT_NATIVE | |||||
NATIVE_LINK_FLAGS = $(POSIX_LINK_FLAGS) | NATIVE_LINK_FLAGS = $(POSIX_LINK_FLAGS) | ||||
ifeq ($(HAVE_FLUIDSYNTH),true) | |||||
NATIVE_BUILD_FLAGS += -DWANT_FLUIDSYNTH | |||||
NATIVE_BUILD_FLAGS += $(shell pkg-config --cflags fluidsynth) | |||||
NATIVE_LINK_FLAGS += $(shell pkg-config --libs fluidsynth) | |||||
endif | |||||
ifeq ($(HAVE_LINUXSAMPLER),true) | |||||
NATIVE_BUILD_FLAGS += -DWANT_LINUXSAMPLER | |||||
NATIVE_BUILD_FLAGS += $(shell pkg-config --cflags linuxsampler) | |||||
NATIVE_LINK_FLAGS += $(shell pkg-config --libs linuxsampler) | |||||
endif | |||||
ifeq ($(HAVE_AF_DEPS),true) | |||||
NATIVE_BUILD_FLAGS += -DWANT_AUDIOFILE | |||||
NATIVE_LINK_FLAGS += $(shell pkg-config --libs sndfile) | |||||
ifeq ($(HAVE_FFMPEG),true) | |||||
NATIVE_BUILD_FLAGS += -DHAVE_FFMPEG | |||||
NATIVE_LINK_FLAGS += $(shell pkg-config --libs libavcodec libavformat libavutil) | |||||
endif | |||||
endif | |||||
ifeq ($(HAVE_MF_DEPS),true) | |||||
NATIVE_BUILD_FLAGS += -DWANT_MIDIFILE | |||||
NATIVE_LINK_FLAGS += $(shell pkg-config --libs smf) | |||||
endif | |||||
ifeq ($(HAVE_OPENGL),true) | |||||
NATIVE_BUILD_FLAGS += -DWANT_OPENGL | |||||
NATIVE_LINK_FLAGS += $(DGL_LIBS) | |||||
endif | |||||
ifeq ($(HAVE_ZYN_DEPS),true) | |||||
NATIVE_BUILD_FLAGS += -DWANT_ZYNADDSUBFX | |||||
NATIVE_LINK_FLAGS += $(shell pkg-config --libs fftw3 mxml zlib) | |||||
ifeq ($(HAVE_ZYN_UI_DEPS),true) | |||||
NATIVE_LINK_FLAGS += $(shell pkg-config --libs ntk_images ntk) | |||||
endif | |||||
endif | |||||
# ifeq ($(HAVE_FLUIDSYNTH),true) | |||||
# NATIVE_BUILD_FLAGS += -DWANT_FLUIDSYNTH | |||||
# NATIVE_BUILD_FLAGS += $(shell pkg-config --cflags fluidsynth) | |||||
# NATIVE_LINK_FLAGS += $(shell pkg-config --libs fluidsynth) | |||||
# endif | |||||
# | |||||
# ifeq ($(HAVE_LINUXSAMPLER),true) | |||||
# NATIVE_BUILD_FLAGS += -DWANT_LINUXSAMPLER | |||||
# NATIVE_BUILD_FLAGS += $(shell pkg-config --cflags linuxsampler) | |||||
# NATIVE_LINK_FLAGS += $(shell pkg-config --libs linuxsampler) | |||||
# endif | |||||
# ifeq ($(HAVE_AF_DEPS),true) | |||||
# NATIVE_BUILD_FLAGS += -DWANT_AUDIOFILE | |||||
# NATIVE_LINK_FLAGS += $(shell pkg-config --libs sndfile) | |||||
# ifeq ($(HAVE_FFMPEG),true) | |||||
# NATIVE_BUILD_FLAGS += -DHAVE_FFMPEG | |||||
# NATIVE_LINK_FLAGS += $(shell pkg-config --libs libavcodec libavformat libavutil) | |||||
# endif | |||||
# endif | |||||
# | |||||
# ifeq ($(HAVE_MF_DEPS),true) | |||||
# NATIVE_BUILD_FLAGS += -DWANT_MIDIFILE | |||||
# NATIVE_LINK_FLAGS += $(shell pkg-config --libs smf) | |||||
# endif | |||||
# | |||||
# ifeq ($(HAVE_OPENGL),true) | |||||
# NATIVE_BUILD_FLAGS += -DWANT_OPENGL | |||||
# NATIVE_LINK_FLAGS += $(DGL_LIBS) | |||||
# endif | |||||
# ifeq ($(HAVE_ZYN_DEPS),true) | |||||
# NATIVE_BUILD_FLAGS += -DWANT_ZYNADDSUBFX | |||||
# NATIVE_LINK_FLAGS += $(shell pkg-config --libs fftw3 mxml zlib) | |||||
# ifeq ($(HAVE_ZYN_UI_DEPS),true) | |||||
# NATIVE_LINK_FLAGS += $(shell pkg-config --libs ntk_images ntk) | |||||
# endif | |||||
# endif | |||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
# UI bridges | # UI bridges | ||||
@@ -153,23 +151,23 @@ LINK_UI_VST_X11_FLAGS = $(LINK_UI_FLAGS) $(QT5_UI_LIBS) | |||||
TARGETS = native | TARGETS = native | ||||
ifeq ($(CARLA_PLUGIN_SUPPORT),true) | |||||
ifeq ($(HAVE_GTK2),true) | |||||
TARGETS += ui_lv2-gtk2 | |||||
endif | |||||
ifeq ($(HAVE_GTK3),true) | |||||
TARGETS += ui_lv2-gtk3 | |||||
endif | |||||
ifeq ($(HAVE_QT4),true) | |||||
TARGETS += ui_lv2-qt4 | |||||
else | |||||
ifeq ($(HAVE_QT5),true) | |||||
TARGETS += ui_lv2-qt5 | |||||
endif | |||||
endif | |||||
TARGETS += ui_lv2-x11 | |||||
TARGETS += ui_vst-x11 | |||||
endif | |||||
# ifeq ($(CARLA_PLUGIN_SUPPORT),true) | |||||
# ifeq ($(HAVE_GTK2),true) | |||||
# TARGETS += ui_lv2-gtk2 | |||||
# endif | |||||
# ifeq ($(HAVE_GTK3),true) | |||||
# TARGETS += ui_lv2-gtk3 | |||||
# endif | |||||
# ifeq ($(HAVE_QT4),true) | |||||
# TARGETS += ui_lv2-qt4 | |||||
# else | |||||
# ifeq ($(HAVE_QT5),true) | |||||
# TARGETS += ui_lv2-qt5 | |||||
# endif | |||||
# endif | |||||
# TARGETS += ui_lv2-x11 | |||||
# TARGETS += ui_vst-x11 | |||||
# endif | |||||
ifeq ($(WIN32),true) | ifeq ($(WIN32),true) | ||||
TARGETS = carla-bridge-win32.exe | TARGETS = carla-bridge-win32.exe | ||||
@@ -394,24 +392,26 @@ OBJS_NATIVE += \ | |||||
# libs | # libs | ||||
OBJS_NATIVE += \ | OBJS_NATIVE += \ | ||||
../modules/carla_native.a \ | |||||
../modules/juce_audio_basics.a \ | |||||
../modules/juce_core.a \ | |||||
../modules/juce_data_structures.a \ | |||||
../modules/juce_events.a \ | |||||
../modules/juce_graphics.a \ | |||||
../modules/juce_gui_basics.a \ | |||||
../modules/jackbridge.a \ | |||||
../modules/rtmempool.a | ../modules/rtmempool.a | ||||
ifeq ($(HAVE_OPENGL),true) | |||||
OBJS_NATIVE += \ | |||||
../modules/dgl.a | |||||
endif | |||||
ifeq ($(CARLA_PLUGIN_SUPPORT),true) | |||||
OBJS_NATIVE += \ | |||||
../modules/lilv.a | |||||
endif | |||||
# ../modules/carla_native.a \ | |||||
# ../modules/juce_audio_basics.a \ | |||||
# ../modules/juce_core.a \ | |||||
# ../modules/juce_data_structures.a \ | |||||
# ../modules/juce_events.a \ | |||||
# ../modules/juce_graphics.a \ | |||||
# ../modules/juce_gui_basics.a \ | |||||
# ifeq ($(HAVE_OPENGL),true) | |||||
# OBJS_NATIVE += \ | |||||
# ../modules/dgl.a | |||||
# endif | |||||
# ifeq ($(CARLA_PLUGIN_SUPPORT),true) | |||||
# OBJS_NATIVE += \ | |||||
# ../modules/lilv.a | |||||
# endif | |||||
carla-bridge-native: $(FILES) $(OBJS_NATIVE) | carla-bridge-native: $(FILES) $(OBJS_NATIVE) | ||||
$(CXX) $(OBJS_NATIVE) $(NATIVE_LINK_FLAGS) -o $@ | $(CXX) $(OBJS_NATIVE) $(NATIVE_LINK_FLAGS) -o $@ | ||||
@@ -117,14 +117,14 @@ def findFilenames(filePath, stype): | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Plugin Query | # Plugin Query | ||||
PLUGIN_QUERY_API_VERSION = 2 | |||||
PLUGIN_QUERY_API_VERSION = 3 | |||||
PyPluginInfo = { | PyPluginInfo = { | ||||
'API': PLUGIN_QUERY_API_VERSION, | 'API': PLUGIN_QUERY_API_VERSION, | ||||
'build': BINARY_NONE, | 'build': BINARY_NONE, | ||||
'type': PLUGIN_NONE, | 'type': PLUGIN_NONE, | ||||
'hints': 0x0, | 'hints': 0x0, | ||||
'binary': "", | |||||
'filename': "", | |||||
'name': "", | 'name': "", | ||||
'label': "", | 'label': "", | ||||
'maker': "", | 'maker': "", | ||||
@@ -177,8 +177,8 @@ def runCarlaDiscovery(itype, stype, filename, tool, isWine=False): | |||||
if line == "carla-discovery::init::-----------": | if line == "carla-discovery::init::-----------": | ||||
pinfo = deepcopy(PyPluginInfo) | pinfo = deepcopy(PyPluginInfo) | ||||
pinfo['type'] = itype | |||||
pinfo['binary'] = filename | |||||
pinfo['type'] = itype | |||||
pinfo['filename'] = filename | |||||
elif line == "carla-discovery::end::------------": | elif line == "carla-discovery::end::------------": | ||||
if pinfo is not None: | if pinfo is not None: | ||||
@@ -1250,7 +1250,7 @@ class PluginDatabaseW(QDialog): | |||||
self._reAddPlugins() | self._reAddPlugins() | ||||
if self.fRealParent: | if self.fRealParent: | ||||
self.fRealParent.loadRDFsNeeded() | |||||
self.fRealParent.setLoadRDFsNeeded() | |||||
def _checkFilters(self): | def _checkFilters(self): | ||||
text = self.ui.lineEdit.text().lower() | text = self.ui.lineEdit.text().lower() | ||||
@@ -1404,7 +1404,7 @@ class PluginDatabaseW(QDialog): | |||||
self.ui.tableWidget.setItem(index, 10, QTableWidgetItem(self.tr("Yes") if (plugin['hints'] & PLUGIN_IS_SYNTH) else self.tr("No"))) | self.ui.tableWidget.setItem(index, 10, QTableWidgetItem(self.tr("Yes") if (plugin['hints'] & PLUGIN_IS_SYNTH) else self.tr("No"))) | ||||
self.ui.tableWidget.setItem(index, 11, QTableWidgetItem(bridgeText)) | self.ui.tableWidget.setItem(index, 11, QTableWidgetItem(bridgeText)) | ||||
self.ui.tableWidget.setItem(index, 12, QTableWidgetItem(ptype)) | self.ui.tableWidget.setItem(index, 12, QTableWidgetItem(ptype)) | ||||
self.ui.tableWidget.setItem(index, 13, QTableWidgetItem(str(plugin['binary']))) | |||||
self.ui.tableWidget.setItem(index, 13, QTableWidgetItem(str(plugin['filename']))) | |||||
self.ui.tableWidget.item(index, 0).setData(Qt.UserRole, plugin) | self.ui.tableWidget.item(index, 0).setData(Qt.UserRole, plugin) | ||||
self.fLastTableIndex += 1 | self.fLastTableIndex += 1 | ||||
@@ -67,6 +67,9 @@ class CarlaDummyW(object): | |||||
def renamePlugin(self, pluginId, newName): | def renamePlugin(self, pluginId, newName): | ||||
pass | pass | ||||
def disablePlugin(self, pluginId, errorMsg): | |||||
pass | |||||
def removeAllPlugins(self): | def removeAllPlugins(self): | ||||
pass | pass | ||||
@@ -255,21 +258,30 @@ class HostWindow(QMainWindow): | |||||
self.ui.fileTreeView.doubleClicked.connect(self.slot_fileTreeDoubleClicked) | self.ui.fileTreeView.doubleClicked.connect(self.slot_fileTreeDoubleClicked) | ||||
self.DebugCallback.connect(self.slot_handleDebugCallback) | self.DebugCallback.connect(self.slot_handleDebugCallback) | ||||
self.PluginAddedCallback.connect(self.slot_handlePluginAddedCallback) | self.PluginAddedCallback.connect(self.slot_handlePluginAddedCallback) | ||||
self.PluginRemovedCallback.connect(self.slot_handlePluginRemovedCallback) | self.PluginRemovedCallback.connect(self.slot_handlePluginRemovedCallback) | ||||
self.PluginRenamedCallback.connect(self.slot_handlePluginRenamedCallback) | self.PluginRenamedCallback.connect(self.slot_handlePluginRenamedCallback) | ||||
self.PluginUnavailableCallback.connect(self.slot_handlePluginUnavailableCallback) | |||||
# parameter (rack) | |||||
# program, midi-program, ui-state (rack) | |||||
# note on, off (rack) | |||||
# update, reload (rack) | |||||
# patchbay | |||||
self.EngineStartedCallback.connect(self.slot_handleEngineStartedCallback) | self.EngineStartedCallback.connect(self.slot_handleEngineStartedCallback) | ||||
self.EngineStoppedCallback.connect(self.slot_handleEngineStoppedCallback) | self.EngineStoppedCallback.connect(self.slot_handleEngineStoppedCallback) | ||||
self.ProcessModeChangedCallback.connect(self.slot_handleProcessModeChangedCallback) | self.ProcessModeChangedCallback.connect(self.slot_handleProcessModeChangedCallback) | ||||
self.TransportModeChangedCallback.connect(self.slot_handleTransportModeChangedCallback) | self.TransportModeChangedCallback.connect(self.slot_handleTransportModeChangedCallback) | ||||
self.BufferSizeChangedCallback.connect(self.slot_handleBufferSizeChangedCallback) | self.BufferSizeChangedCallback.connect(self.slot_handleBufferSizeChangedCallback) | ||||
self.SampleRateChangedCallback.connect(self.slot_handleSampleRateChangedCallback) | self.SampleRateChangedCallback.connect(self.slot_handleSampleRateChangedCallback) | ||||
#self.InfoCallback.connect(self.slot_handleInfoCallback) | |||||
#self.ErrorCallback.connect(self.slot_handleErrorCallback) | |||||
#self.QuitCallback.connect(self.slot_handleQuitCallback) | |||||
self.InfoCallback.connect(self.slot_handleInfoCallback) | |||||
self.ErrorCallback.connect(self.slot_handleErrorCallback) | |||||
self.QuitCallback.connect(self.slot_handleQuitCallback) | |||||
self.SIGUSR1.connect(self.slot_handleSIGUSR1) | self.SIGUSR1.connect(self.slot_handleSIGUSR1) | ||||
self.SIGTERM.connect(self.slot_handleSIGTERM) | self.SIGTERM.connect(self.slot_handleSIGTERM) | ||||
@@ -398,16 +410,8 @@ class HostWindow(QMainWindow): | |||||
QMessageBox.critical(self, self.tr("Error"), self.tr("Could not connect to Audio backend '%s'" % audioDriver)) | QMessageBox.critical(self, self.tr("Error"), self.tr("Could not connect to Audio backend '%s'" % audioDriver)) | ||||
return | return | ||||
#self.fBufferSize = Carla.host.get_buffer_size() | |||||
#self.fSampleRate = Carla.host.get_sample_rate() | |||||
#self.fFirstEngineInit = False | #self.fFirstEngineInit = False | ||||
# Peaks and TimeInfo | |||||
self.fIdleTimerFast = self.startTimer(30) #self.fSavedSettings["Main/RefreshInterval"]) | |||||
# LEDs and edit dialog parameters | |||||
self.fIdleTimerSlow = self.startTimer(self.fSavedSettings["Main/RefreshInterval"]*2) | |||||
def stopEngine(self): | def stopEngine(self): | ||||
if self.fContainer.getPluginCount() > 0: | if self.fContainer.getPluginCount() > 0: | ||||
ask = QMessageBox.question(self, self.tr("Warning"), self.tr("There are still some plugins loaded, you need to remove them to stop the engine.\n" | ask = QMessageBox.question(self, self.tr("Warning"), self.tr("There are still some plugins loaded, you need to remove them to stop the engine.\n" | ||||
@@ -422,17 +426,6 @@ class HostWindow(QMainWindow): | |||||
if Carla.host.is_engine_running() and not Carla.host.engine_close(): | if Carla.host.is_engine_running() and not Carla.host.engine_close(): | ||||
print(Carla.host.get_last_error()) | print(Carla.host.get_last_error()) | ||||
#self.fBufferSize = 0 | |||||
#self.fSampleRate = 0.0 | |||||
if self.fIdleTimerFast != 0: | |||||
self.killTimer(self.fIdleTimerFast) | |||||
self.fIdleTimerFast = 0 | |||||
if self.fIdleTimerSlow != 0: | |||||
self.killTimer(self.fIdleTimerSlow) | |||||
self.fIdleTimerSlow = 0 | |||||
# ----------------------------------------------------------------- | # ----------------------------------------------------------------- | ||||
# Internal stuff (plugins) | # Internal stuff (plugins) | ||||
@@ -488,9 +481,7 @@ class HostWindow(QMainWindow): | |||||
# Internal stuff (transport) | # Internal stuff (transport) | ||||
def refreshTransport(self, forced = False): | def refreshTransport(self, forced = False): | ||||
if not Carla.host.is_engine_running(): | |||||
return | |||||
if self.fSampleRate == 0.0: | |||||
if Carla.sampleRate == 0.0 or not Carla.host.is_engine_running(): | |||||
return | return | ||||
timeInfo = Carla.host.get_transport_info() | timeInfo = Carla.host.get_transport_info() | ||||
@@ -512,7 +503,7 @@ class HostWindow(QMainWindow): | |||||
self.fLastTransportState = playing | self.fLastTransportState = playing | ||||
if frame != self.fLastTransportFrame or forced: | if frame != self.fLastTransportFrame or forced: | ||||
time = frame / self.fSampleRate | |||||
time = frame / Carla.sampleRate | |||||
secs = time % 60 | secs = time % 60 | ||||
mins = (time / 60) % 60 | mins = (time / 60) % 60 | ||||
hrs = (time / 3600) % 60 | hrs = (time / 3600) % 60 | ||||
@@ -616,7 +607,7 @@ class HostWindow(QMainWindow): | |||||
if self.fIdleTimerFast != 0: | if self.fIdleTimerFast != 0: | ||||
self.killTimer(self.fIdleTimerFast) | self.killTimer(self.fIdleTimerFast) | ||||
self.fIdleTimerFast = self.startTimer(30) #self.fSavedSettings["Main/RefreshInterval"]) | |||||
self.fIdleTimerFast = self.startTimer(self.fSavedSettings["Main/RefreshInterval"]) | |||||
if self.fIdleTimerSlow != 0: | if self.fIdleTimerSlow != 0: | ||||
self.killTimer(self.fIdleTimerSlow) | self.killTimer(self.fIdleTimerSlow) | ||||
@@ -742,6 +733,11 @@ class HostWindow(QMainWindow): | |||||
def slot_engineStop(self, doStop = True): | def slot_engineStop(self, doStop = True): | ||||
if doStop: self.stopEngine() | if doStop: self.stopEngine() | ||||
# FIXME? | |||||
if self.fContainer.getPluginCount() > 0: | |||||
self.ui.act_plugin_remove_all.setEnabled(False) | |||||
self.fContainer.removeAllPlugins() | |||||
check = Carla.host.is_engine_running() | check = Carla.host.is_engine_running() | ||||
self.ui.menu_PluginMacros.setEnabled(check) | self.ui.menu_PluginMacros.setEnabled(check) | ||||
self.ui.menu_Canvas.setEnabled(check) | self.ui.menu_Canvas.setEnabled(check) | ||||
@@ -776,7 +772,7 @@ class HostWindow(QMainWindow): | |||||
btype = dialog.fRetPlugin['build'] | btype = dialog.fRetPlugin['build'] | ||||
ptype = dialog.fRetPlugin['type'] | ptype = dialog.fRetPlugin['type'] | ||||
filename = dialog.fRetPlugin['binary'] | |||||
filename = dialog.fRetPlugin['filename'] | |||||
label = dialog.fRetPlugin['label'] | label = dialog.fRetPlugin['label'] | ||||
extraPtr = self.getExtraPtr(dialog.fRetPlugin) | extraPtr = self.getExtraPtr(dialog.fRetPlugin) | ||||
@@ -901,8 +897,8 @@ class HostWindow(QMainWindow): | |||||
# ----------------------------------------------------------------- | # ----------------------------------------------------------------- | ||||
@pyqtSlot(int) | |||||
def slot_handlePluginAddedCallback(self, pluginId): | |||||
@pyqtSlot(int, str) | |||||
def slot_handlePluginAddedCallback(self, pluginId, pluginName): | |||||
self.fContainer.addPlugin(pluginId, self.fIsProjectLoading) | self.fContainer.addPlugin(pluginId, self.fIsProjectLoading) | ||||
if self.fContainer.getPluginCount() == 1: | if self.fContainer.getPluginCount() == 1: | ||||
@@ -919,25 +915,28 @@ class HostWindow(QMainWindow): | |||||
def slot_handlePluginRenamedCallback(self, pluginId, newName): | def slot_handlePluginRenamedCallback(self, pluginId, newName): | ||||
self.fContainer.renamePlugin(pluginId, newName) | self.fContainer.renamePlugin(pluginId, newName) | ||||
@pyqtSlot(int, str) | |||||
def slot_handlePluginUnavailableCallback(self, pluginId, errorMsg): | |||||
self.fContainer.disablePlugin(pluginId, errorMsg) | |||||
# ----------------------------------------------------------------- | # ----------------------------------------------------------------- | ||||
@pyqtSlot(str) | @pyqtSlot(str) | ||||
def slot_handleEngineStartedCallback(self, driverName): | |||||
#self.fBufferSize = Carla.host.get_buffer_size() | |||||
#self.fSampleRate = Carla.host.get_sample_rate() | |||||
def slot_handleEngineStartedCallback(self, processMode, transportMode, driverName): | |||||
Carla.processMode = processMode | |||||
Carla.transportMode = transportMode | |||||
Carla.bufferSize = Carla.host.get_buffer_size() | |||||
Carla.sampleRate = Carla.host.get_sample_rate() | |||||
self.slot_engineStart(False) | |||||
if self.fIdleTimerFast == 0: | if self.fIdleTimerFast == 0: | ||||
self.fIdleTimerFast = self.startTimer(30) #self.fSavedSettings["Main/RefreshInterval"]) | |||||
self.fIdleTimerFast = self.startTimer(self.fSavedSettings["Main/RefreshInterval"]) | |||||
if self.fIdleTimerSlow == 0: | if self.fIdleTimerSlow == 0: | ||||
self.fIdleTimerSlow = self.startTimer(self.fSavedSettings["Main/RefreshInterval"]*2) | self.fIdleTimerSlow = self.startTimer(self.fSavedSettings["Main/RefreshInterval"]*2) | ||||
self.slot_engineStart(False) | |||||
@pyqtSlot() | @pyqtSlot() | ||||
def slot_handleEngineStoppedCallback(self): | def slot_handleEngineStoppedCallback(self): | ||||
#self.fBufferSize = 0 | |||||
#self.fSampleRate = 0.0 | |||||
if self.fIdleTimerFast != 0: | if self.fIdleTimerFast != 0: | ||||
self.killTimer(self.fIdleTimerFast) | self.killTimer(self.fIdleTimerFast) | ||||
self.fIdleTimerFast = 0 | self.fIdleTimerFast = 0 | ||||
@@ -946,12 +945,11 @@ class HostWindow(QMainWindow): | |||||
self.killTimer(self.fIdleTimerSlow) | self.killTimer(self.fIdleTimerSlow) | ||||
self.fIdleTimerSlow = 0 | self.fIdleTimerSlow = 0 | ||||
if self.fContainer.getPluginCount() > 0: | |||||
self.ui.act_plugin_remove_all.setEnabled(False) | |||||
self.fContainer.removeAllPlugins() # FIXME? | |||||
self.slot_engineStop(False) | self.slot_engineStop(False) | ||||
Carla.bufferSize = 0 | |||||
Carla.sampleRate = 0.0 | |||||
# ----------------------------------------------------------------- | # ----------------------------------------------------------------- | ||||
@pyqtSlot(int) | @pyqtSlot(int) | ||||
@@ -962,6 +960,8 @@ class HostWindow(QMainWindow): | |||||
def slot_handleTransportModeChangedCallback(self, newTransportMode): | def slot_handleTransportModeChangedCallback(self, newTransportMode): | ||||
self.fEngineChanged = True | self.fEngineChanged = True | ||||
# ----------------------------------------------------------------- | |||||
@pyqtSlot(int) | @pyqtSlot(int) | ||||
def slot_handleBufferSizeChangedCallback(self, newBufferSize): | def slot_handleBufferSizeChangedCallback(self, newBufferSize): | ||||
self.fEngineChanged = True | self.fEngineChanged = True | ||||
@@ -972,6 +972,20 @@ class HostWindow(QMainWindow): | |||||
# ----------------------------------------------------------------- | # ----------------------------------------------------------------- | ||||
@pyqtSlot(str) | |||||
def slot_handleInfoCallback(self, info): | |||||
pass | |||||
@pyqtSlot(str) | |||||
def slot_handleErrorCallback(self, error): | |||||
pass | |||||
@pyqtSlot() | |||||
def slot_handleQuitCallback(self): | |||||
pass | |||||
# ----------------------------------------------------------------- | |||||
@pyqtSlot() | @pyqtSlot() | ||||
def slot_handleSIGUSR1(self): | def slot_handleSIGUSR1(self): | ||||
print("Got SIGUSR1 -> Saving project now") | print("Got SIGUSR1 -> Saving project now") | ||||
@@ -200,6 +200,9 @@ class CarlaPatchbayW(QGraphicsView): | |||||
pitem.setName(newName) | pitem.setName(newName) | ||||
def disablePlugin(self, pluginId, errorMsg): | |||||
pass | |||||
def removeAllPlugins(self): | def removeAllPlugins(self): | ||||
for i in range(self.fPluginCount): | for i in range(self.fPluginCount): | ||||
pitem = self.fPluginList[i] | pitem = self.fPluginList[i] | ||||
@@ -72,22 +72,22 @@ class CarlaRackW(QListWidget): | |||||
#self.setMnimumWidth(800) | #self.setMnimumWidth(800) | ||||
self.setSortingEnabled(False) | self.setSortingEnabled(False) | ||||
#app = QApplication.instance() | |||||
#pal1 = app.palette().base().color() | |||||
#pal2 = app.palette().button().color() | |||||
#col1 = "stop:0 rgb(%i, %i, %i)" % (pal1.red(), pal1.green(), pal1.blue()) | |||||
#col2 = "stop:1 rgb(%i, %i, %i)" % (pal2.red(), pal2.green(), pal2.blue()) | |||||
#self.setStyleSheet(""" | |||||
#QListWidget { | |||||
#background-color: qlineargradient(spread:pad, | |||||
#x1:0.0, y1:0.0, | |||||
#x2:0.2, y2:1.0, | |||||
#%s, | |||||
#%s | |||||
#); | |||||
#} | |||||
#""" % (col1, col2)) | |||||
app = QApplication.instance() | |||||
pal1 = app.palette().base().color() | |||||
pal2 = app.palette().button().color() | |||||
col1 = "stop:0 rgb(%i, %i, %i)" % (pal1.red(), pal1.green(), pal1.blue()) | |||||
col2 = "stop:1 rgb(%i, %i, %i)" % (pal2.red(), pal2.green(), pal2.blue()) | |||||
self.setStyleSheet(""" | |||||
QListWidget { | |||||
background-color: qlineargradient(spread:pad, | |||||
x1:0.0, y1:0.0, | |||||
x2:0.2, y2:1.0, | |||||
%s, | |||||
%s | |||||
); | |||||
} | |||||
""" % (col1, col2)) | |||||
# ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
# Connect actions to functions | # Connect actions to functions | ||||
@@ -169,6 +169,9 @@ class CarlaRackW(QListWidget): | |||||
pitem.fWidget.ui.label_name.setText(newName) | pitem.fWidget.ui.label_name.setText(newName) | ||||
pitem.fWidget.ui.edit_dialog.setName(newName) | pitem.fWidget.ui.edit_dialog.setName(newName) | ||||
def disablePlugin(self, pluginId, errorMsg): | |||||
pass | |||||
def removeAllPlugins(self): | def removeAllPlugins(self): | ||||
while (self.takeItem(0)): | while (self.takeItem(0)): | ||||
pass | pass | ||||
@@ -504,11 +507,4 @@ class CarlaRackW(QListWidget): | |||||
pitem.ui.edit_dialog.reloadAll() | pitem.ui.edit_dialog.reloadAll() | ||||
# ------------------------------------------------------------------------------------------------------------ | |||||
# TESTING | |||||
#from PyQt5.QtWidgets import QApplication | |||||
#app = QApplication(sys.argv) | |||||
#gui = CarlaRackW(None) | |||||
#gui.show() | |||||
#app.exec_() | |||||
# ----------------------------------------------------------------- |
@@ -60,6 +60,7 @@ gFakePluginInfo = { | |||||
} | } | ||||
gFakeParamInfo = { | gFakeParamInfo = { | ||||
"type": PARAMETER_INPUT, | |||||
"hints": PARAMETER_IS_ENABLED|PARAMETER_IS_AUTOMABLE, | "hints": PARAMETER_IS_ENABLED|PARAMETER_IS_AUTOMABLE, | ||||
"name": "Parameter Name", | "name": "Parameter Name", | ||||
"unit": "", | "unit": "", | ||||
@@ -71,7 +72,7 @@ gFakeParamInfo = { | |||||
"maximum": 1.0, | "maximum": 1.0, | ||||
"step": 0.01, | "step": 0.01, | ||||
"stepSmall": 0.01, | "stepSmall": 0.01, | ||||
"stepLarge": 0.01, | |||||
"stepLarge": 0.01, # FIXME | |||||
"midiCC": -1, | "midiCC": -1, | ||||
"midiChannel": 1, | "midiChannel": 1, | ||||
@@ -205,34 +206,52 @@ class PluginParameter(QWidget): | |||||
# ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
# Set-up GUI | # Set-up GUI | ||||
pType = pInfo['type'] | |||||
pHints = pInfo['hints'] | pHints = pInfo['hints'] | ||||
self.ui.label.setText(pInfo['name']) | self.ui.label.setText(pInfo['name']) | ||||
self.ui.widget.setName(pInfo['name']) | self.ui.widget.setName(pInfo['name']) | ||||
self.ui.widget.setMinimum(pInfo['minimum']) | |||||
self.ui.widget.setMaximum(pInfo['maximum']) | |||||
self.ui.widget.setDefault(pInfo['default']) | |||||
self.ui.widget.setValue(pInfo['current'], False) | |||||
self.ui.widget.setLabel(pInfo['unit']) | |||||
self.ui.widget.setStep(pInfo['step']) | |||||
self.ui.widget.setStepSmall(pInfo['stepSmall']) | |||||
self.ui.widget.setStepLarge(pInfo['stepLarge']) | |||||
self.ui.widget.setScalePoints(pInfo['scalePoints'], bool(pHints & PARAMETER_USES_SCALEPOINTS)) | |||||
if not pHints & PARAMETER_IS_ENABLED: | |||||
self.ui.label.setEnabled(False) | |||||
self.ui.widget.setEnabled(False) | |||||
if pType == PARAMETER_INPUT: | |||||
self.ui.widget.setMinimum(pInfo['minimum']) | |||||
self.ui.widget.setMaximum(pInfo['maximum']) | |||||
self.ui.widget.setDefault(pInfo['default']) | |||||
self.ui.widget.setValue(pInfo['current'], False) | |||||
self.ui.widget.setLabel(pInfo['unit']) | |||||
self.ui.widget.setStep(pInfo['step']) | |||||
self.ui.widget.setStepSmall(pInfo['stepSmall']) | |||||
self.ui.widget.setStepLarge(pInfo['stepLarge']) | |||||
self.ui.widget.setScalePoints(pInfo['scalePoints'], bool(pHints & PARAMETER_USES_SCALEPOINTS)) | |||||
if not pHints & PARAMETER_IS_ENABLED: | |||||
self.ui.label.setEnabled(False) | |||||
self.ui.widget.setEnabled(False) | |||||
self.ui.widget.setReadOnly(True) | |||||
self.ui.sb_control.setEnabled(False) | |||||
self.ui.sb_channel.setEnabled(False) | |||||
elif not pHints & PARAMETER_IS_AUTOMABLE: | |||||
self.ui.sb_control.setEnabled(False) | |||||
self.ui.sb_channel.setEnabled(False) | |||||
if pHints & PARAMETER_IS_READ_ONLY: | |||||
self.ui.widget.setReadOnly(True) | |||||
elif pType == PARAMETER_OUTPUT: | |||||
self.ui.widget.setMinimum(pInfo['minimum']) | |||||
self.ui.widget.setMaximum(pInfo['maximum']) | |||||
self.ui.widget.setValue(pInfo['current'], False) | |||||
self.ui.widget.setLabel(pInfo['unit']) | |||||
self.ui.widget.setReadOnly(True) | self.ui.widget.setReadOnly(True) | ||||
self.ui.sb_control.setEnabled(False) | |||||
self.ui.sb_channel.setEnabled(False) | |||||
elif not pHints & PARAMETER_IS_AUTOMABLE: | |||||
self.ui.sb_control.setEnabled(False) | |||||
self.ui.sb_channel.setEnabled(False) | |||||
if not pHints & PARAMETER_IS_AUTOMABLE: | |||||
self.ui.sb_control.setEnabled(False) | |||||
self.ui.sb_channel.setEnabled(False) | |||||
if pHints & PARAMETER_IS_READ_ONLY: | |||||
self.ui.widget.setReadOnly(True) | |||||
else: | |||||
self.ui.widget.setVisible(False) | |||||
self.ui.sb_control.setVisible(False) | |||||
self.ui.sb_channel.setVisible(False) | |||||
if pHints & PARAMETER_USES_CUSTOM_TEXT: | if pHints & PARAMETER_USES_CUSTOM_TEXT: | ||||
self.ui.widget.setTextCallback(self._textCallBack) | self.ui.widget.setTextCallback(self._textCallBack) | ||||
@@ -371,7 +390,7 @@ class PluginEdit(QDialog): | |||||
self.fScrollAreaSetup = False | self.fScrollAreaSetup = False | ||||
self.fParameterCount = 0 | self.fParameterCount = 0 | ||||
self.fParameterList = [] # (isInput, id, widget) | |||||
self.fParameterList = [] # (type, id, widget) | |||||
self.fParametersToUpdate = [] # (id, value) | self.fParametersToUpdate = [] # (id, value) | ||||
self.fPlayingNotes = [] # (channel, note) | self.fPlayingNotes = [] # (channel, note) | ||||
@@ -460,7 +479,7 @@ class PluginEdit(QDialog): | |||||
def reloadAll(self): | def reloadAll(self): | ||||
if Carla.host is not None: | if Carla.host is not None: | ||||
self.fPluginInfo = Carla.host.get_plugin_info(self.fPluginId) | self.fPluginInfo = Carla.host.get_plugin_info(self.fPluginId) | ||||
self.fPluginInfo['binary'] = charPtrToString(self.fPluginInfo['binary']) | |||||
self.fPluginInfo['filename'] = charPtrToString(self.fPluginInfo['filename']) | |||||
self.fPluginInfo['name'] = charPtrToString(self.fPluginInfo['name']) | self.fPluginInfo['name'] = charPtrToString(self.fPluginInfo['name']) | ||||
self.fPluginInfo['label'] = charPtrToString(self.fPluginInfo['label']) | self.fPluginInfo['label'] = charPtrToString(self.fPluginInfo['label']) | ||||
self.fPluginInfo['maker'] = charPtrToString(self.fPluginInfo['maker']) | self.fPluginInfo['maker'] = charPtrToString(self.fPluginInfo['maker']) | ||||
@@ -638,7 +657,7 @@ class PluginEdit(QDialog): | |||||
paramFakeList.append(gFakeParamInfo) | paramFakeList.append(gFakeParamInfo) | ||||
paramFakeListFull.append((paramFakeList, paramFakeWidth)) | paramFakeListFull.append((paramFakeList, paramFakeWidth)) | ||||
self._createParameterWidgets(True, paramFakeListFull, self.tr("Parameters")) | |||||
self._createParameterWidgets(PARAMETER_INPUT, paramFakeListFull, self.tr("Parameters")) | |||||
return | return | ||||
parameterCount = Carla.host.get_parameter_count(self.fPluginId) | parameterCount = Carla.host.get_parameter_count(self.fPluginId) | ||||
@@ -661,6 +680,9 @@ class PluginEdit(QDialog): | |||||
paramRanges = Carla.host.get_parameter_ranges(self.fPluginId, i) | paramRanges = Carla.host.get_parameter_ranges(self.fPluginId, i) | ||||
paramValue = Carla.host.get_current_parameter_value(self.fPluginId, i) | paramValue = Carla.host.get_current_parameter_value(self.fPluginId, i) | ||||
if paramData['type'] not in (PARAMETER_INPUT, PARAMETER_OUTPUT): | |||||
continue | |||||
parameter = { | parameter = { | ||||
'type': paramData['type'], | 'type': paramData['type'], | ||||
'hints': paramData['hints'], | 'hints': paramData['hints'], | ||||
@@ -694,7 +716,7 @@ class PluginEdit(QDialog): | |||||
# ----------------------------------------------------------------- | # ----------------------------------------------------------------- | ||||
# Get width values, in packs of 10 | # Get width values, in packs of 10 | ||||
if parameter['hints'] == PARAMETER_IS_INPUT: | |||||
if parameter['type'] == PARAMETER_INPUT: | |||||
paramInputWidthTMP = QFontMetrics(self.font()).width(parameter['name']) | paramInputWidthTMP = QFontMetrics(self.font()).width(parameter['name']) | ||||
if paramInputWidthTMP > paramInputWidth: | if paramInputWidthTMP > paramInputWidth: | ||||
@@ -732,8 +754,8 @@ class PluginEdit(QDialog): | |||||
# ----------------------------------------------------------------- | # ----------------------------------------------------------------- | ||||
# Create parameter tabs + widgets | # Create parameter tabs + widgets | ||||
self._createParameterWidgets(True, paramInputListFull, self.tr("Parameters")) | |||||
self._createParameterWidgets(False, paramOutputListFull, self.tr("Outputs")) | |||||
self._createParameterWidgets(PARAMETER_INPUT, paramInputListFull, self.tr("Parameters")) | |||||
self._createParameterWidgets(PARAMETER_OUTPUT, paramOutputListFull, self.tr("Outputs")) | |||||
else: # > Carla.maxParameters | else: # > Carla.maxParameters | ||||
fakeName = self.tr("This plugin has too many parameters to display here!") | fakeName = self.tr("This plugin has too many parameters to display here!") | ||||
@@ -743,7 +765,8 @@ class PluginEdit(QDialog): | |||||
paramFakeWidth = QFontMetrics(self.font()).width(fakeName) | paramFakeWidth = QFontMetrics(self.font()).width(fakeName) | ||||
parameter = { | parameter = { | ||||
'hints': PARAMETER_IS_INPUT|PARAMETER_IS_ENABLED|PARAMETER_IS_READ_ONLY, | |||||
'type': PARAMETER_UNKNOWN, | |||||
'hints': 0x0, | |||||
'name': fakeName, | 'name': fakeName, | ||||
'unit': "", | 'unit': "", | ||||
'scalePoints': [], | 'scalePoints': [], | ||||
@@ -764,7 +787,7 @@ class PluginEdit(QDialog): | |||||
paramFakeList.append(parameter) | paramFakeList.append(parameter) | ||||
paramFakeListFull.append((paramFakeList, paramFakeWidth)) | paramFakeListFull.append((paramFakeList, paramFakeWidth)) | ||||
self._createParameterWidgets(True, paramFakeListFull, self.tr("Information")) | |||||
self._createParameterWidgets(PARAMETER_UNKNOWN, paramFakeListFull, self.tr("Information")) | |||||
def reloadPrograms(self): | def reloadPrograms(self): | ||||
# Programs | # Programs | ||||
@@ -845,7 +868,7 @@ class PluginEdit(QDialog): | |||||
self.ui.cb_midi_programs.setItemText(mpIndex, "%03i:%03i - %s" % (mpBank+1, mpProg+1, mpName)) | self.ui.cb_midi_programs.setItemText(mpIndex, "%03i:%03i - %s" % (mpBank+1, mpProg+1, mpName)) | ||||
# Update all parameter values | # Update all parameter values | ||||
for isInput, paramId, paramWidget in self.fParameterList: | |||||
for paramType, paramId, paramWidget in self.fParameterList: | |||||
paramWidget.setValue(Carla.host.get_current_parameter_value(self.fPluginId, paramId), False) | paramWidget.setValue(Carla.host.get_current_parameter_value(self.fPluginId, paramId), False) | ||||
paramWidget.update() | paramWidget.update() | ||||
@@ -868,19 +891,19 @@ class PluginEdit(QDialog): | |||||
self.fParametersToUpdate.append([parameterId, value]) | self.fParametersToUpdate.append([parameterId, value]) | ||||
def setParameterDefault(self, parameterId, value): | def setParameterDefault(self, parameterId, value): | ||||
for isInput, paramId, paramWidget in self.fParameterList: | |||||
for paramType, paramId, paramWidget in self.fParameterList: | |||||
if paramId == parameterId: | if paramId == parameterId: | ||||
paramWidget.setDefault(value) | paramWidget.setDefault(value) | ||||
break | break | ||||
def setParameterMidiControl(self, parameterId, control): | def setParameterMidiControl(self, parameterId, control): | ||||
for isInput, paramId, paramWidget in self.fParameterList: | |||||
for paramType, paramId, paramWidget in self.fParameterList: | |||||
if paramId == parameterId: | if paramId == parameterId: | ||||
paramWidget.setMidiControl(control) | paramWidget.setMidiControl(control) | ||||
break | break | ||||
def setParameterMidiChannel(self, parameterId, channel): | def setParameterMidiChannel(self, parameterId, channel): | ||||
for isInput, paramId, paramWidget in self.fParameterList: | |||||
for paramType, paramId, paramWidget in self.fParameterList: | |||||
if paramId == parameterId: | if paramId == parameterId: | ||||
paramWidget.setMidiChannel(channel+1) | paramWidget.setMidiChannel(channel+1) | ||||
break | break | ||||
@@ -973,14 +996,14 @@ class PluginEdit(QDialog): | |||||
self._updateCtrlMidiProgram() | self._updateCtrlMidiProgram() | ||||
elif index >= 0: | elif index >= 0: | ||||
for isInput, paramId, paramWidget in self.fParameterList: | |||||
for paramType, paramId, paramWidget in self.fParameterList: | |||||
if paramId != index: | if paramId != index: | ||||
continue | continue | ||||
paramWidget.setValue(value, False) | paramWidget.setValue(value, False) | ||||
if isInput: | |||||
tabIndex = paramWidget.tabIndex() | |||||
if paramType == PARAMETER_INPUT: | |||||
tabIndex = paramWidget.getTabIndex() | |||||
if self.fTabIconTimers[tabIndex-1] == ICON_STATE_NULL: | if self.fTabIconTimers[tabIndex-1] == ICON_STATE_NULL: | ||||
self.ui.tabWidget.setTabIcon(tabIndex, self.fTabIconOn) | self.ui.tabWidget.setTabIcon(tabIndex, self.fTabIconOn) | ||||
@@ -993,8 +1016,8 @@ class PluginEdit(QDialog): | |||||
self.fParametersToUpdate = [] | self.fParametersToUpdate = [] | ||||
# Update parameter outputs | # Update parameter outputs | ||||
for isInput, paramId, paramWidget in self.fParameterList: | |||||
if not isInput: | |||||
for paramType, paramId, paramWidget in self.fParameterList: | |||||
if paramType == PARAMETER_OUTPUT: | |||||
value = Carla.host.get_current_parameter_value(self.fPluginId, paramId) | value = Carla.host.get_current_parameter_value(self.fPluginId, paramId) | ||||
paramWidget.setValue(value, False) | paramWidget.setValue(value, False) | ||||
@@ -1263,7 +1286,7 @@ class PluginEdit(QDialog): | |||||
selChannel = int(actSel.text()) | selChannel = int(actSel.text()) | ||||
self.ui.sb_ctrl_channel.setValue(selChannel) | self.ui.sb_ctrl_channel.setValue(selChannel) | ||||
def _createParameterWidgets(self, isInput, paramListFull, tabPageName): | |||||
def _createParameterWidgets(self, paramType, paramListFull, tabPageName): | |||||
i = 1 | i = 1 | ||||
for paramList, width in paramListFull: | for paramList, width in paramListFull: | ||||
if len(paramList) == 0: | if len(paramList) == 0: | ||||
@@ -1279,9 +1302,9 @@ class PluginEdit(QDialog): | |||||
paramWidget.setLabelWidth(width) | paramWidget.setLabelWidth(width) | ||||
tabPageLayout.addWidget(paramWidget) | tabPageLayout.addWidget(paramWidget) | ||||
self.fParameterList.append((isInput, paramInfo['index'], paramWidget)) | |||||
self.fParameterList.append((paramType, paramInfo['index'], paramWidget)) | |||||
if isInput: | |||||
if paramType == PARAMETER_INPUT: | |||||
paramWidget.valueChanged.connect(self.slot_parameterValueChanged) | paramWidget.valueChanged.connect(self.slot_parameterValueChanged) | ||||
paramWidget.midiControlChanged.connect(self.slot_parameterMidiControlChanged) | paramWidget.midiControlChanged.connect(self.slot_parameterMidiControlChanged) | ||||
@@ -1292,7 +1315,7 @@ class PluginEdit(QDialog): | |||||
self.ui.tabWidget.addTab(tabPageContainer, "%s (%i)" % (tabPageName, i)) | self.ui.tabWidget.addTab(tabPageContainer, "%s (%i)" % (tabPageName, i)) | ||||
i += 1 | i += 1 | ||||
if isInput: | |||||
if paramType == PARAMETER_INPUT: | |||||
self.ui.tabWidget.setTabIcon(tabIndex, self.fTabIconOff) | self.ui.tabWidget.setTabIcon(tabIndex, self.fTabIconOff) | ||||
self.fTabIconTimers.append(ICON_STATE_NULL) | self.fTabIconTimers.append(ICON_STATE_NULL) | ||||
@@ -1342,7 +1365,7 @@ class PluginWidget(QFrame): | |||||
self.fPluginId = pluginId | self.fPluginId = pluginId | ||||
self.fPluginInfo = Carla.host.get_plugin_info(self.fPluginId) if Carla.host is not None else gFakePluginInfo | self.fPluginInfo = Carla.host.get_plugin_info(self.fPluginId) if Carla.host is not None else gFakePluginInfo | ||||
self.fPluginInfo['binary'] = charPtrToString(self.fPluginInfo['binary']) | |||||
self.fPluginInfo['filename'] = charPtrToString(self.fPluginInfo['filename']) | |||||
self.fPluginInfo['name'] = charPtrToString(self.fPluginInfo['name']) | self.fPluginInfo['name'] = charPtrToString(self.fPluginInfo['name']) | ||||
self.fPluginInfo['label'] = charPtrToString(self.fPluginInfo['label']) | self.fPluginInfo['label'] = charPtrToString(self.fPluginInfo['label']) | ||||
self.fPluginInfo['maker'] = charPtrToString(self.fPluginInfo['maker']) | self.fPluginInfo['maker'] = charPtrToString(self.fPluginInfo['maker']) | ||||
@@ -8,7 +8,7 @@ include ../../Makefile.mk | |||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
BUILD_CXX_FLAGS += -I. -I../../includes -I../../utils | |||||
BUILD_CXX_FLAGS += -I. -I../../includes -I../../utils -w | |||||
ifeq ($(HAVE_QT4),true) | ifeq ($(HAVE_QT4),true) | ||||
QT4_CXX_FLAGS = $(BUILD_CXX_FLAGS) | QT4_CXX_FLAGS = $(BUILD_CXX_FLAGS) | ||||
@@ -34,12 +34,12 @@ public: | |||||
CarlaMutex() noexcept | CarlaMutex() noexcept | ||||
: fTryLockWasCalled(false) | : fTryLockWasCalled(false) | ||||
{ | { | ||||
pthread_mutexattr_t atts; | |||||
pthread_mutexattr_init(&atts); | |||||
pthread_mutexattr_settype(&atts, PTHREAD_MUTEX_RECURSIVE); | |||||
//pthread_mutexattr_t atts; | |||||
//pthread_mutexattr_init(&atts); | |||||
//pthread_mutexattr_settype(&atts, PTHREAD_MUTEX_RECURSIVE); | |||||
pthread_mutex_init(&fMutex, &atts); | |||||
pthread_mutexattr_destroy(&atts); | |||||
pthread_mutex_init(&fMutex, nullptr /*&atts*/); | |||||
//pthread_mutexattr_destroy(&atts); | |||||
} | } | ||||
/* | /* | ||||