Browse Source

General fixing; Start tests with bridges

tags/1.9.4
falkTX 11 years ago
parent
commit
c52d3d559e
20 changed files with 601 additions and 505 deletions
  1. +51
    -51
      source/backend/CarlaEngine.hpp
  2. +163
    -119
      source/backend/engine/CarlaEngine.cpp
  3. +35
    -30
      source/backend/engine/CarlaEngineBridge.cpp
  4. +25
    -22
      source/backend/engine/CarlaEngineJack.cpp
  5. +1
    -1
      source/backend/engine/CarlaEngineThread.cpp
  6. +18
    -14
      source/backend/plugin/CarlaPlugin.cpp
  7. +4
    -12
      source/backend/plugin/CarlaPluginInternal.hpp
  8. +1
    -1
      source/backend/plugin/CarlaPluginThread.cpp
  9. +9
    -11
      source/backend/plugin/LadspaPlugin.cpp
  10. +9
    -3
      source/backend/standalone/CarlaStandalone.cpp
  11. +1
    -1
      source/bridges/CarlaBridge.hpp
  12. +33
    -25
      source/bridges/CarlaBridgePlugin.cpp
  13. +93
    -93
      source/bridges/Makefile
  14. +6
    -6
      source/carla_database.py
  15. +57
    -43
      source/carla_host.py
  16. +3
    -0
      source/carla_patchbay.py
  17. +20
    -24
      source/carla_rack.py
  18. +66
    -43
      source/carla_widgets.py
  19. +1
    -1
      source/modules/theme/Makefile
  20. +5
    -5
      source/utils/CarlaMutex.hpp

+ 51
- 51
source/backend/CarlaEngine.hpp View File

@@ -845,7 +845,7 @@ public:
/*!
* 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.
@@ -854,7 +854,7 @@ public:

/*!
* 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;

@@ -992,7 +992,7 @@ public:
/*!
* Set last error.
*/
void setLastError(const char* const error);
void setLastError(const char* const error) const;

// -------------------------------------------------------------------
// Misc
@@ -1045,7 +1045,7 @@ public:
/*!
* Set OSC bridge data.
*/
void setOscBridgeData(const CarlaOscData* const oscData) noexcept;
void setOscBridgeData(const CarlaOscData* const oscData) const noexcept;
#endif

// -------------------------------------------------------------------
@@ -1165,54 +1165,54 @@ private:
// Bridge/Controller OSC stuff
public:
#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
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

CARLA_DECLARE_NON_COPY_CLASS(CarlaEngine)


+ 163
- 119
source/backend/engine/CarlaEngine.cpp View File

@@ -616,6 +616,7 @@ CarlaEngine* CarlaEngine::newDriverByName(const char* const driverName)
if (std::strcmp(driverName, "JACK") == 0)
return newJack();

#ifndef BUILD_BRIDGE
// common
if (std::strncmp(driverName, "JACK ", 5) == 0)
return newRtAudio(AUDIO_API_JACK);
@@ -637,6 +638,7 @@ CarlaEngine* CarlaEngine::newDriverByName(const char* const driverName)
return newRtAudio(AUDIO_API_ASIO);
if (std::strcmp(driverName, "DirectSound") == 0)
return newRtAudio(AUDIO_API_DS);
#endif

carla_stderr("CarlaEngine::newDriverByName(\"%s\") - invalid driver name", driverName);
return nullptr;
@@ -718,6 +720,9 @@ bool CarlaEngine::init(const char* const clientName)

pData->plugins = new EnginePluginData[pData->maxPluginNumber];

for (uint i=0; i < pData->maxPluginNumber; ++i)
pData->plugins[i].clear();

pData->osc.init(clientName);
#ifndef BUILD_BRIDGE
pData->oscData = pData->osc.getControlData();
@@ -1164,7 +1169,7 @@ bool CarlaEngine::switchPlugins(const unsigned int idA, const unsigned int idB)
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->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_debug("CarlaEngine::getUniquePluginName(\"%s\")", name);

static CarlaMutex m;
const CarlaMutex::ScopedLocker sl(m);

static CarlaString sname;
CarlaString sname;
sname = name;

if (sname.isEmpty())
{
sname = "(No name)";
return (const char*)sname;
return sname.dup();
}

sname.truncate(getMaxClientNameSize()-5-1); // 5 = strlen(" (10)")
@@ -1261,7 +1263,7 @@ const char* CarlaEngine::getUniquePluginName(const char* const name) const
sname += " (2)";
}

return (const char*)sname;
return sname.dup();
}

// -----------------------------------------------------------------------
@@ -1655,7 +1657,7 @@ const char* CarlaEngine::getLastError() const noexcept
return (const char*)pData->lastError;
}

void CarlaEngine::setLastError(const char* const error)
void CarlaEngine::setLastError(const char* const error) const
{
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);

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)
{
@@ -1683,12 +1685,12 @@ void CarlaEngine::setOption(const EngineOption option, const int value, const ch
break;

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);
break;

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);
break;

@@ -1797,7 +1799,7 @@ const char* CarlaEngine::getOscServerPathUDP() const noexcept
}

#ifdef BUILD_BRIDGE
void CarlaEngine::setOscBridgeData(const CarlaOscData* const oscData) noexcept
void CarlaEngine::setOscBridgeData(const CarlaOscData* const oscData) const noexcept
{
pData->oscData = oscData;
}
@@ -2068,55 +2070,83 @@ void CarlaEngine::processPatchbay(float** inBuf, float** outBuf, const uint32_t
// Bridge/Controller OSC stuff

#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(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)
{
char targetPath[std::strlen(pData->oscData->path)+20];
std::strcpy(targetPath, pData->oscData->path);
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(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)
{
char targetPath[std::strlen(pData->oscData->path)+19];
std::strcpy(targetPath, pData->oscData->path);
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(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)
{
char targetPath[std::strlen(pData->oscData->path)+24];
std::strcpy(targetPath, pData->oscData->path);
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(count >= 0,);
carla_debug("CarlaEngine::oscSend_bridge_program_count(%i)", count);

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];
std::strcpy(targetPath, pData->oscData->path);
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(count >= 0,);
carla_debug("CarlaEngine::oscSend_bridge_midi_program_count(%i)", count);

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];
std::strcpy(targetPath, pData->oscData->path);
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(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)
{
char targetPath[std::strlen(pData->oscData->path)+20];
char targetPath[std::strlen(pData->oscData->path)+23];
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(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)
{
char targetPath[std::strlen(pData->oscData->path)+23];
char targetPath[std::strlen(pData->oscData->path)+26];
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_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)
{
char targetPath[std::strlen(pData->oscData->path)+23];
char targetPath[std::strlen(pData->oscData->path)+26];
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_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)
{
char targetPath[std::strlen(pData->oscData->path)+25];
char targetPath[std::strlen(pData->oscData->path)+26];
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_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)
{
char targetPath[std::strlen(pData->oscData->path)+21];
char targetPath[std::strlen(pData->oscData->path)+31];
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_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)
{
char targetPath[std::strlen(pData->oscData->path)+26];
char targetPath[std::strlen(pData->oscData->path)+24];
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(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)
{
char targetPath[std::strlen(pData->oscData->path)+18];
char targetPath[std::strlen(pData->oscData->path)+22];
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_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)
{
char targetPath[std::strlen(pData->oscData->path)+28];
char targetPath[std::strlen(pData->oscData->path)+20];
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_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)
{
char targetPath[std::strlen(pData->oscData->path)+26];
char targetPath[std::strlen(pData->oscData->path)+25];
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_debug("CarlaEngine::oscSend_bridge_set_program(%i)", index);
carla_debug("CarlaEngine::oscSend_bridge_program_name(%i, \"%s\")", index, name);

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::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_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)
{
char targetPath[std::strlen(pData->oscData->path)+25];
char targetPath[std::strlen(pData->oscData->path)+26];
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_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_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);
}
}

// TODO?
//void oscSend_bridge_set_peaks() const;

#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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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_debug("CarlaEngine::oscSend_control_exit()");


+ 35
- 30
source/backend/engine/CarlaEngineBridge.cpp View File

@@ -145,12 +145,12 @@ struct BridgeControl : public RingBufferControl {
// -------------------------------------------------------------------

class CarlaEngineBridge : public CarlaEngine,
public juce::Thread
public CarlaThread
{
public:
CarlaEngineBridge(const char* const audioBaseName, const char* const controlBaseName)
: CarlaEngine(),
juce::Thread("CarlaEngineBridge"),
CarlaThread("CarlaEngineBridge"),
fIsRunning(false)
{
carla_debug("CarlaEngineBridge::CarlaEngineBridge()");
@@ -208,17 +208,15 @@ public:

opcode = fShmControl.readOpcode();
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();
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);
return true;
}
@@ -228,7 +226,7 @@ public:
carla_debug("CarlaEnginePlugin::close()");
CarlaEngine::close();

stopThread(6000);
CarlaThread::stop(6000);

fShmControl.clear();
fShmAudioPool.clear();
@@ -251,27 +249,34 @@ public:
return kEngineTypeBridge;
}

const char* getCurrentDriverName() const noexcept
{
return "Bridge";
}

// -------------------------------------
// CarlaThread virtual calls

void run() override
{
fIsRunning = true;

// TODO - set RT permissions
carla_debug("CarlaEngineBridge::run()");

while (! threadShouldExit())
while (! shouldExit())
{
if (! jackbridge_sem_timedwait(&fShmControl.data->runServer, 5))
{
if (errno == ETIMEDOUT)
{
fIsRunning = false;
signalThreadShouldExit();
signalShouldExit();
return;
}
}

while (fShmControl.dataAvailable())
while (fShmControl.isDataAvailable())
{
const PluginBridgeOpcode opcode(fShmControl.readOpcode());

@@ -306,8 +311,8 @@ public:

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));

@@ -322,7 +327,7 @@ public:

case kPluginBridgeOpcodeSetProgram:
{
const int index(fShmControl.readInt());
//const int index(fShmControl.readInt());

CarlaPlugin* const plugin(getPluginUnchecked(0));

@@ -337,7 +342,7 @@ public:

case kPluginBridgeOpcodeSetMidiProgram:
{
const int index(fShmControl.readInt());
//const int index(fShmControl.readInt());

CarlaPlugin* const plugin(getPluginUnchecked(0));

@@ -352,18 +357,18 @@ public:

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
}
@@ -376,7 +381,7 @@ public:
CARLA_ASSERT(fShmAudioPool.data != nullptr);
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 outCount(plugin->getAudioOutCount());
@@ -385,19 +390,19 @@ public:
float* outBuffer[outCount];

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)
outBuffer[i] = fShmAudioPool.data + (i+inCount)*fBufferSize;
outBuffer[i] = fShmAudioPool.data + (i+inCount)*pData->bufferSize;

plugin->initBuffers();
plugin->process(inBuffer, outBuffer, fBufferSize);
plugin->process(inBuffer, outBuffer, pData->bufferSize);
plugin->unlock();
}
break;
}

case kPluginBridgeOpcodeQuit:
signalThreadShouldExit();
signalShouldExit();
break;
}
}


+ 25
- 22
source/backend/engine/CarlaEngineJack.cpp View File

@@ -444,7 +444,7 @@ public:
fTransportState(JackTransportStopped),
fFreewheel(false),
#ifdef BUILD_BRIDGE
fHasQuit(false)
fIsRunning(false)
#else
fLastGroupId(0),
fLastPortId(0),
@@ -527,7 +527,23 @@ public:

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;
fLastPortId = 0;
fLastConnectionId = 0;
@@ -589,20 +605,6 @@ public:
setLastError("Failed to create new JACK client");

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
}

@@ -612,8 +614,8 @@ public:
CarlaEngine::close();

#ifdef BUILD_BRIDGE
fClient = nullptr;
fHasQuit = true;
fClient = nullptr;
fIsRunning = false;
return true;
#else
if (jackbridge_deactivate(fClient))
@@ -646,8 +648,9 @@ public:
fUsedPortNames.clear();
fUsedConnections.clear();
fGroupIconsChanged.clear();
#endif
return false;
#endif
}

#ifndef BUILD_BRIDGE
@@ -700,7 +703,7 @@ public:
bool isRunning() const noexcept override
{
#ifdef BUILD_BRIDGE
return (fClient != nullptr || ! fHasQuit);
return (fClient != nullptr || fIsRunning);
#else
return (fClient != nullptr);
#endif
@@ -931,7 +934,6 @@ public:

return true;
}
#endif

// -------------------------------------------------------------------
// Transport
@@ -959,6 +961,7 @@ public:
else if (fClient != nullptr)
jackbridge_transport_locate(fClient, static_cast<jack_nframes_t>(frame));
}
#endif

// -------------------------------------------------------------------

@@ -1435,7 +1438,7 @@ private:
// -------------------------------------------------------------------

#ifdef BUILD_BRIDGE
bool fHasQuit;
bool fIsRunning;
#else
enum RackPorts {
kRackPortAudioIn1 = 0,


+ 1
- 1
source/backend/engine/CarlaEngineThread.cpp View File

@@ -92,7 +92,7 @@ void CarlaEngineThread::run()
if (oscRegisted)
{
#ifdef BUILD_BRIDGE
fEngine->oscSend_bridge_set_parameter_value(j, value);
fEngine->oscSend_bridge_parameter_value(j, value);
#else
fEngine->oscSend_control_set_parameter_value(i, j, value);
#endif


+ 18
- 14
source/backend/plugin/CarlaPlugin.cpp View File

@@ -248,17 +248,17 @@ bool CarlaPlugin::isEnabled() const noexcept

const char* CarlaPlugin::getName() const noexcept
{
return (const char*)pData->name;
return pData->name;
}

const char* CarlaPlugin::getFilename() const noexcept
{
return (const char*)pData->filename;
return pData->filename;
}

const char* CarlaPlugin::getIconName() const noexcept
{
return (const char*)pData->iconName;
return pData->iconName;
}

uint32_t CarlaPlugin::getLatencyInFrames() const noexcept
@@ -1524,6 +1524,7 @@ void CarlaPlugin::registerToOscClient()

// Base data
{
// TODO - clear buf
char bufName[STR_MAX+1] = { '\0' };
char bufLabel[STR_MAX+1] = { '\0' };
char bufMaker[STR_MAX+1] = { '\0' };
@@ -1534,7 +1535,8 @@ void CarlaPlugin::registerToOscClient()
getCopyright(bufCopyright);

#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
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);
@@ -1547,8 +1549,8 @@ void CarlaPlugin::registerToOscClient()
getParameterCountInfo(paramIns, paramOuts);

#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);
#else
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]);

#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
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);
@@ -1596,9 +1600,9 @@ void CarlaPlugin::registerToOscClient()
pData->engine->oscSend_bridge_program_count(pData->prog.count);

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
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]);

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
pData->engine->oscSend_control_set_midi_program_count(pData->id, pData->midiprog.count);



+ 4
- 12
source/backend/plugin/CarlaPluginInternal.hpp View File

@@ -693,8 +693,8 @@ struct CarlaPluginProtectedData {
// mutex MUST have been locked before
const bool lockMaster(masterMutex.tryLock());
const bool lockSingle(singleMutex.tryLock());
CARLA_ASSERT(! lockMaster);
CARLA_ASSERT(! lockSingle);
CARLA_SAFE_ASSERT(! lockMaster);
CARLA_SAFE_ASSERT(! lockSingle);
}

if (client != nullptr)
@@ -812,11 +812,7 @@ struct CarlaPluginProtectedData {
for (uint32_t i=0; i < audioIn.count; ++i)
{
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,);

PluginPostRtEvent event;
event.type = type;
event.value1 = value1;
event.value2 = value2;
event.value3 = value3;
PluginPostRtEvent event = { type, value1, value2, value3 };

postRtEvents.appendRT(event);
}


+ 1
- 1
source/backend/plugin/CarlaPluginThread.cpp View File

@@ -54,7 +54,7 @@ CarlaPluginThread::CarlaPluginThread(CarlaBackend::CarlaEngine* const engine, Ca
fPlugin(plugin),
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);
}


+ 9
- 11
source/backend/plugin/LadspaPlugin.cpp View File

@@ -1411,10 +1411,7 @@ public:
else
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
@@ -1457,13 +1454,14 @@ public:
if (pData->engine->getOptions().forceStereo)
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());

// ignore settings, we need this anyway


+ 9
- 3
source/backend/standalone/CarlaStandalone.cpp View File

@@ -124,9 +124,9 @@ struct CarlaBackendStandalone {
#ifdef BUILD_BRIDGE
engineOptions.processMode = CB::ENGINE_PROCESS_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
}

@@ -442,8 +442,14 @@ bool carla_engine_init(const char* driverName, const char* clientName)

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_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_PREFER_PLUGIN_BRIDGES, gStandalone.engineOptions.preferPluginBridges ? 1 : 0, nullptr);
gStandalone.engine->setOption(CB::ENGINE_OPTION_PREFER_UI_BRIDGES, gStandalone.engineOptions.preferUiBridges ? 1 : 0, nullptr);


+ 1
- 1
source/bridges/CarlaBridge.hpp View File

@@ -18,7 +18,7 @@
#ifndef 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_END_NAMESPACE }


+ 33
- 25
source/bridges/CarlaBridgePlugin.cpp View File

@@ -19,18 +19,18 @@

#include "CarlaEngine.hpp"
#include "CarlaPlugin.hpp"
#include "CarlaHost.hpp"
#include "CarlaHost.h"

#include "CarlaBackendUtils.hpp"
#include "CarlaBridgeUtils.hpp"

#include "juce_core.h"
//#include "juce_core.h"

#ifdef CARLA_OS_UNIX
# include <signal.h>
#endif

using juce::File;
//using juce::File;

// -------------------------------------------------------------------------

@@ -103,14 +103,15 @@ class CarlaPluginClient : public CarlaBridgeClient
public:
CarlaPluginClient(const bool useBridge, const char* const driverName, const char* audioBaseName, const char* controlBaseName)
: CarlaBridgeClient(nullptr),
fEngine(nullptr),
fPlugin(nullptr)
fPlugin(nullptr),
fEngine(nullptr)
{
CARLA_ASSERT(driverName != nullptr && driverName[0] != '\0');
carla_debug("CarlaPluginClient::CarlaPluginClient(%s, \"%s\", %s, %s)", bool2str(useBridge), driverName, audioBaseName, controlBaseName);

carla_set_engine_callback(callback, this);

#if 0
File curDir(File::getSpecialLocation(File::currentApplicationFile).getParentDirectory());

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());
else
carla_set_engine_option(CarlaBackend::OPTION_PATH_RESOURCES, 0, curDir.getChildFile("../modules/carla_native/resources").getFullPathName().toRawUTF8());
#endif

if (useBridge)
carla_engine_init_bridge(audioBaseName, controlBaseName, driverName);
else
carla_engine_init("JACK", driverName);

fEngine = carla_get_standalone_engine();
fEngine = carla_get_engine();
}

~CarlaPluginClient() override
@@ -156,8 +158,8 @@ public:
fProjFileName = fPlugin->getName();
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))
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);
}

if (fPlugin->getOptions() & CarlaBackend::PLUGIN_OPTION_USE_CHUNKS)
if (fPlugin->getOptionsEnabled() & CarlaBackend::PLUGIN_OPTION_USE_CHUNKS)
{
void* data = nullptr;
int32_t dataSize = fPlugin->getChunkData(&data);
@@ -249,7 +251,7 @@ public:
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_debug("CarlaPluginClient::setParameterMidiChannel(%i, %i)", index, channel);
@@ -257,7 +259,7 @@ public:
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_debug("CarlaPluginClient::setParameterMidiCC(%i, %i)", index, cc);
@@ -306,7 +308,7 @@ public:
// ---------------------------------------------------------------------

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;

@@ -314,12 +316,12 @@ protected:

switch (action)
{
case CALLBACK_PARAMETER_VALUE_CHANGED:
case ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED:
if (isOscControlRegistered())
sendOscControl(value1, value3);
break;

case CALLBACK_SHOW_GUI:
case ENGINE_CALLBACK_UI_STATE_CHANGED:
if (! isOscControlRegistered())
{
if (value1 != 1)
@@ -342,14 +344,14 @@ protected:
}

private:
CarlaBackend::CarlaEngine* fEngine;
CarlaBackend::CarlaPlugin* fPlugin;
const CarlaBackend::CarlaEngine* fEngine;

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(pluginId == 0,);

@@ -363,7 +365,7 @@ int CarlaBridgeOsc::handleMsgShow()
{
carla_debug("CarlaBridgeOsc::handleMsgShow()");

carla_show_gui(0, true);
carla_show_custom_ui(0, true);
return 0;
}

@@ -371,7 +373,7 @@ int CarlaBridgeOsc::handleMsgHide()
{
carla_debug("CarlaBridgeOsc::handleMsgHide()");

carla_show_gui(0, false);
carla_show_custom_ui(0, false);
return 0;
}

@@ -405,8 +407,11 @@ int CarlaBridgeOsc::handleMsgPluginSetParameterMidiChannel(CARLA_BRIDGE_OSC_HAND
const int32_t index = argv[0]->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);
plugClient->setParameterMidiChannel(index, channel);
plugClient->setParameterMidiChannel(static_cast<uint32_t>(index), static_cast<uint8_t>(channel));

return 0;
}
@@ -420,8 +425,11 @@ int CarlaBridgeOsc::handleMsgPluginSetParameterMidiCC(CARLA_BRIDGE_OSC_HANDLE_AR
const int32_t index = argv[0]->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);
plugClient->setParameterMidiCC(index, cc);
plugClient->setParameterMidiCC(static_cast<uint32_t>(index), static_cast<int16_t>(cc));

return 0;
}
@@ -529,8 +537,8 @@ int main(int argc, char* argv[])

CarlaString clientName((name != nullptr) ? name : label);

if (clientName.isEmpty())
clientName = File(filename).getFileNameWithoutExtension().toRawUTF8();
//if (clientName.isEmpty())
// clientName = File(filename).getFileNameWithoutExtension().toRawUTF8();

// ---------------------------------------------------------------------
// Set extraStuff
@@ -586,8 +594,8 @@ int main(int argc, char* argv[])

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);
}
}



+ 93
- 93
source/bridges/Makefile View File

@@ -9,36 +9,37 @@ include ../Makefile.mk
# --------------------------------------------------------------

# 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 += -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

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
LINK_PLUGIN_FLAGS = $(LINK_FLAGS) -lpthread
LINK_PLUGIN_FLAGS = $(LINK_FLAGS) $(QTXML_LIBS) -lpthread

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

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)
@@ -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_LINK_FLAGS = $(LINK_PLUGIN_FLAGS) -ldl

ifneq ($(MACOS),true)
POSIX_LINK_FLAGS += -lrt
endif

# --------------------------------------------------------------
# Plugin bridges (Windows)

@@ -63,47 +60,48 @@ WIN_LINK_FLAGS = $(LINK_PLUGIN_FLAGS) -L../modules
# --------------------------------------------------------------
# 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)

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
@@ -153,23 +151,23 @@ LINK_UI_VST_X11_FLAGS = $(LINK_UI_FLAGS) $(QT5_UI_LIBS)

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)
TARGETS = carla-bridge-win32.exe
@@ -394,24 +392,26 @@ OBJS_NATIVE += \

# libs
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

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)
$(CXX) $(OBJS_NATIVE) $(NATIVE_LINK_FLAGS) -o $@


+ 6
- 6
source/carla_database.py View File

@@ -117,14 +117,14 @@ def findFilenames(filePath, stype):
# ------------------------------------------------------------------------------------------------------------
# Plugin Query

PLUGIN_QUERY_API_VERSION = 2
PLUGIN_QUERY_API_VERSION = 3

PyPluginInfo = {
'API': PLUGIN_QUERY_API_VERSION,
'build': BINARY_NONE,
'type': PLUGIN_NONE,
'hints': 0x0,
'binary': "",
'filename': "",
'name': "",
'label': "",
'maker': "",
@@ -177,8 +177,8 @@ def runCarlaDiscovery(itype, stype, filename, tool, isWine=False):

if line == "carla-discovery::init::-----------":
pinfo = deepcopy(PyPluginInfo)
pinfo['type'] = itype
pinfo['binary'] = filename
pinfo['type'] = itype
pinfo['filename'] = filename

elif line == "carla-discovery::end::------------":
if pinfo is not None:
@@ -1250,7 +1250,7 @@ class PluginDatabaseW(QDialog):
self._reAddPlugins()

if self.fRealParent:
self.fRealParent.loadRDFsNeeded()
self.fRealParent.setLoadRDFsNeeded()

def _checkFilters(self):
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, 11, QTableWidgetItem(bridgeText))
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.fLastTableIndex += 1


+ 57
- 43
source/carla_host.py View File

@@ -67,6 +67,9 @@ class CarlaDummyW(object):
def renamePlugin(self, pluginId, newName):
pass

def disablePlugin(self, pluginId, errorMsg):
pass

def removeAllPlugins(self):
pass

@@ -255,21 +258,30 @@ class HostWindow(QMainWindow):
self.ui.fileTreeView.doubleClicked.connect(self.slot_fileTreeDoubleClicked)

self.DebugCallback.connect(self.slot_handleDebugCallback)

self.PluginAddedCallback.connect(self.slot_handlePluginAddedCallback)
self.PluginRemovedCallback.connect(self.slot_handlePluginRemovedCallback)
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.EngineStoppedCallback.connect(self.slot_handleEngineStoppedCallback)

self.ProcessModeChangedCallback.connect(self.slot_handleProcessModeChangedCallback)
self.TransportModeChangedCallback.connect(self.slot_handleTransportModeChangedCallback)

self.BufferSizeChangedCallback.connect(self.slot_handleBufferSizeChangedCallback)
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.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))
return

#self.fBufferSize = Carla.host.get_buffer_size()
#self.fSampleRate = Carla.host.get_sample_rate()

#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):
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"
@@ -422,17 +426,6 @@ class HostWindow(QMainWindow):
if Carla.host.is_engine_running() and not Carla.host.engine_close():
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)

@@ -488,9 +481,7 @@ class HostWindow(QMainWindow):
# Internal stuff (transport)

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

timeInfo = Carla.host.get_transport_info()
@@ -512,7 +503,7 @@ class HostWindow(QMainWindow):
self.fLastTransportState = playing

if frame != self.fLastTransportFrame or forced:
time = frame / self.fSampleRate
time = frame / Carla.sampleRate
secs = time % 60
mins = (time / 60) % 60
hrs = (time / 3600) % 60
@@ -616,7 +607,7 @@ class HostWindow(QMainWindow):

if self.fIdleTimerFast != 0:
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:
self.killTimer(self.fIdleTimerSlow)
@@ -742,6 +733,11 @@ class HostWindow(QMainWindow):
def slot_engineStop(self, doStop = True):
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()
self.ui.menu_PluginMacros.setEnabled(check)
self.ui.menu_Canvas.setEnabled(check)
@@ -776,7 +772,7 @@ class HostWindow(QMainWindow):

btype = dialog.fRetPlugin['build']
ptype = dialog.fRetPlugin['type']
filename = dialog.fRetPlugin['binary']
filename = dialog.fRetPlugin['filename']
label = dialog.fRetPlugin['label']
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)

if self.fContainer.getPluginCount() == 1:
@@ -919,25 +915,28 @@ class HostWindow(QMainWindow):
def slot_handlePluginRenamedCallback(self, pluginId, newName):
self.fContainer.renamePlugin(pluginId, newName)

@pyqtSlot(int, str)
def slot_handlePluginUnavailableCallback(self, pluginId, errorMsg):
self.fContainer.disablePlugin(pluginId, errorMsg)

# -----------------------------------------------------------------

@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:
self.fIdleTimerFast = self.startTimer(30) #self.fSavedSettings["Main/RefreshInterval"])
self.fIdleTimerFast = self.startTimer(self.fSavedSettings["Main/RefreshInterval"])
if self.fIdleTimerSlow == 0:
self.fIdleTimerSlow = self.startTimer(self.fSavedSettings["Main/RefreshInterval"]*2)

self.slot_engineStart(False)

@pyqtSlot()
def slot_handleEngineStoppedCallback(self):
#self.fBufferSize = 0
#self.fSampleRate = 0.0

if self.fIdleTimerFast != 0:
self.killTimer(self.fIdleTimerFast)
self.fIdleTimerFast = 0
@@ -946,12 +945,11 @@ class HostWindow(QMainWindow):
self.killTimer(self.fIdleTimerSlow)
self.fIdleTimerSlow = 0

if self.fContainer.getPluginCount() > 0:
self.ui.act_plugin_remove_all.setEnabled(False)
self.fContainer.removeAllPlugins() # FIXME?

self.slot_engineStop(False)

Carla.bufferSize = 0
Carla.sampleRate = 0.0

# -----------------------------------------------------------------

@pyqtSlot(int)
@@ -962,6 +960,8 @@ class HostWindow(QMainWindow):
def slot_handleTransportModeChangedCallback(self, newTransportMode):
self.fEngineChanged = True

# -----------------------------------------------------------------

@pyqtSlot(int)
def slot_handleBufferSizeChangedCallback(self, newBufferSize):
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()
def slot_handleSIGUSR1(self):
print("Got SIGUSR1 -> Saving project now")


+ 3
- 0
source/carla_patchbay.py View File

@@ -200,6 +200,9 @@ class CarlaPatchbayW(QGraphicsView):

pitem.setName(newName)

def disablePlugin(self, pluginId, errorMsg):
pass

def removeAllPlugins(self):
for i in range(self.fPluginCount):
pitem = self.fPluginList[i]


+ 20
- 24
source/carla_rack.py View File

@@ -72,22 +72,22 @@ class CarlaRackW(QListWidget):
#self.setMnimumWidth(800)
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
@@ -169,6 +169,9 @@ class CarlaRackW(QListWidget):
pitem.fWidget.ui.label_name.setText(newName)
pitem.fWidget.ui.edit_dialog.setName(newName)

def disablePlugin(self, pluginId, errorMsg):
pass

def removeAllPlugins(self):
while (self.takeItem(0)):
pass
@@ -504,11 +507,4 @@ class CarlaRackW(QListWidget):

pitem.ui.edit_dialog.reloadAll()

# ------------------------------------------------------------------------------------------------------------
# TESTING

#from PyQt5.QtWidgets import QApplication
#app = QApplication(sys.argv)
#gui = CarlaRackW(None)
#gui.show()
#app.exec_()
# -----------------------------------------------------------------

+ 66
- 43
source/carla_widgets.py View File

@@ -60,6 +60,7 @@ gFakePluginInfo = {
}

gFakeParamInfo = {
"type": PARAMETER_INPUT,
"hints": PARAMETER_IS_ENABLED|PARAMETER_IS_AUTOMABLE,
"name": "Parameter Name",
"unit": "",
@@ -71,7 +72,7 @@ gFakeParamInfo = {
"maximum": 1.0,
"step": 0.01,
"stepSmall": 0.01,
"stepLarge": 0.01,
"stepLarge": 0.01, # FIXME
"midiCC": -1,
"midiChannel": 1,

@@ -205,34 +206,52 @@ class PluginParameter(QWidget):
# -------------------------------------------------------------
# Set-up GUI

pType = pInfo['type']
pHints = pInfo['hints']

self.ui.label.setText(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.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:
self.ui.widget.setTextCallback(self._textCallBack)
@@ -371,7 +390,7 @@ class PluginEdit(QDialog):
self.fScrollAreaSetup = False

self.fParameterCount = 0
self.fParameterList = [] # (isInput, id, widget)
self.fParameterList = [] # (type, id, widget)
self.fParametersToUpdate = [] # (id, value)

self.fPlayingNotes = [] # (channel, note)
@@ -460,7 +479,7 @@ class PluginEdit(QDialog):
def reloadAll(self):
if Carla.host is not None:
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['label'] = charPtrToString(self.fPluginInfo['label'])
self.fPluginInfo['maker'] = charPtrToString(self.fPluginInfo['maker'])
@@ -638,7 +657,7 @@ class PluginEdit(QDialog):
paramFakeList.append(gFakeParamInfo)
paramFakeListFull.append((paramFakeList, paramFakeWidth))

self._createParameterWidgets(True, paramFakeListFull, self.tr("Parameters"))
self._createParameterWidgets(PARAMETER_INPUT, paramFakeListFull, self.tr("Parameters"))
return

parameterCount = Carla.host.get_parameter_count(self.fPluginId)
@@ -661,6 +680,9 @@ class PluginEdit(QDialog):
paramRanges = Carla.host.get_parameter_ranges(self.fPluginId, i)
paramValue = Carla.host.get_current_parameter_value(self.fPluginId, i)

if paramData['type'] not in (PARAMETER_INPUT, PARAMETER_OUTPUT):
continue

parameter = {
'type': paramData['type'],
'hints': paramData['hints'],
@@ -694,7 +716,7 @@ class PluginEdit(QDialog):
# -----------------------------------------------------------------
# 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'])

if paramInputWidthTMP > paramInputWidth:
@@ -732,8 +754,8 @@ class PluginEdit(QDialog):
# -----------------------------------------------------------------
# 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
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)

parameter = {
'hints': PARAMETER_IS_INPUT|PARAMETER_IS_ENABLED|PARAMETER_IS_READ_ONLY,
'type': PARAMETER_UNKNOWN,
'hints': 0x0,
'name': fakeName,
'unit': "",
'scalePoints': [],
@@ -764,7 +787,7 @@ class PluginEdit(QDialog):
paramFakeList.append(parameter)
paramFakeListFull.append((paramFakeList, paramFakeWidth))

self._createParameterWidgets(True, paramFakeListFull, self.tr("Information"))
self._createParameterWidgets(PARAMETER_UNKNOWN, paramFakeListFull, self.tr("Information"))

def reloadPrograms(self):
# Programs
@@ -845,7 +868,7 @@ class PluginEdit(QDialog):
self.ui.cb_midi_programs.setItemText(mpIndex, "%03i:%03i - %s" % (mpBank+1, mpProg+1, mpName))

# 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.update()

@@ -868,19 +891,19 @@ class PluginEdit(QDialog):
self.fParametersToUpdate.append([parameterId, value])

def setParameterDefault(self, parameterId, value):
for isInput, paramId, paramWidget in self.fParameterList:
for paramType, paramId, paramWidget in self.fParameterList:
if paramId == parameterId:
paramWidget.setDefault(value)
break

def setParameterMidiControl(self, parameterId, control):
for isInput, paramId, paramWidget in self.fParameterList:
for paramType, paramId, paramWidget in self.fParameterList:
if paramId == parameterId:
paramWidget.setMidiControl(control)
break

def setParameterMidiChannel(self, parameterId, channel):
for isInput, paramId, paramWidget in self.fParameterList:
for paramType, paramId, paramWidget in self.fParameterList:
if paramId == parameterId:
paramWidget.setMidiChannel(channel+1)
break
@@ -973,14 +996,14 @@ class PluginEdit(QDialog):
self._updateCtrlMidiProgram()

elif index >= 0:
for isInput, paramId, paramWidget in self.fParameterList:
for paramType, paramId, paramWidget in self.fParameterList:
if paramId != index:
continue

paramWidget.setValue(value, False)

if isInput:
tabIndex = paramWidget.tabIndex()
if paramType == PARAMETER_INPUT:
tabIndex = paramWidget.getTabIndex()

if self.fTabIconTimers[tabIndex-1] == ICON_STATE_NULL:
self.ui.tabWidget.setTabIcon(tabIndex, self.fTabIconOn)
@@ -993,8 +1016,8 @@ class PluginEdit(QDialog):
self.fParametersToUpdate = []

# 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)
paramWidget.setValue(value, False)

@@ -1263,7 +1286,7 @@ class PluginEdit(QDialog):
selChannel = int(actSel.text())
self.ui.sb_ctrl_channel.setValue(selChannel)

def _createParameterWidgets(self, isInput, paramListFull, tabPageName):
def _createParameterWidgets(self, paramType, paramListFull, tabPageName):
i = 1
for paramList, width in paramListFull:
if len(paramList) == 0:
@@ -1279,9 +1302,9 @@ class PluginEdit(QDialog):
paramWidget.setLabelWidth(width)
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.midiControlChanged.connect(self.slot_parameterMidiControlChanged)
@@ -1292,7 +1315,7 @@ class PluginEdit(QDialog):
self.ui.tabWidget.addTab(tabPageContainer, "%s (%i)" % (tabPageName, i))
i += 1

if isInput:
if paramType == PARAMETER_INPUT:
self.ui.tabWidget.setTabIcon(tabIndex, self.fTabIconOff)

self.fTabIconTimers.append(ICON_STATE_NULL)
@@ -1342,7 +1365,7 @@ class PluginWidget(QFrame):
self.fPluginId = pluginId
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['label'] = charPtrToString(self.fPluginInfo['label'])
self.fPluginInfo['maker'] = charPtrToString(self.fPluginInfo['maker'])


+ 1
- 1
source/modules/theme/Makefile View File

@@ -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)
QT4_CXX_FLAGS = $(BUILD_CXX_FLAGS)


+ 5
- 5
source/utils/CarlaMutex.hpp View File

@@ -34,12 +34,12 @@ public:
CarlaMutex() noexcept
: 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);
}

/*


Loading…
Cancel
Save