Browse Source

A lot more bridge work

tags/1.9.4
falkTX 10 years ago
parent
commit
8ae122bc42
35 changed files with 360 additions and 433 deletions
  1. +20
    -12
      source/backend/CarlaBackend.h
  2. +3
    -4
      source/backend/CarlaEngine.hpp
  3. +4
    -2
      source/backend/CarlaHost.h
  4. +3
    -1
      source/backend/CarlaPlugin.hpp
  5. +5
    -3
      source/backend/CarlaStandalone.cpp
  6. +0
    -8
      source/backend/Makefile
  7. +22
    -22
      source/backend/engine/CarlaEngine.cpp
  8. +5
    -25
      source/backend/engine/CarlaEngineBridge.cpp
  9. +7
    -6
      source/backend/engine/CarlaEngineInternal.cpp
  10. +1
    -1
      source/backend/engine/CarlaEngineInternal.hpp
  11. +4
    -6
      source/backend/engine/CarlaEngineOsc.cpp
  12. +22
    -34
      source/backend/engine/CarlaEngineOscSend.cpp
  13. +52
    -63
      source/backend/plugin/BridgePlugin.cpp
  14. +32
    -68
      source/backend/plugin/CarlaPlugin.cpp
  15. +6
    -2
      source/backend/plugin/DssiPlugin.cpp
  16. +7
    -29
      source/backend/plugin/FluidSynthPlugin.cpp
  17. +7
    -4
      source/backend/plugin/JucePlugin.cpp
  18. +2
    -3
      source/backend/plugin/LadspaPlugin.cpp
  19. +5
    -1
      source/backend/plugin/LinuxSamplerPlugin.cpp
  20. +8
    -2
      source/backend/plugin/Lv2Plugin.cpp
  21. +10
    -9
      source/backend/plugin/NativePlugin.cpp
  22. +5
    -1
      source/backend/plugin/VstPlugin.cpp
  23. +0
    -5
      source/bridges-plugin/CarlaBridgePlugin.cpp
  24. +1
    -1
      source/bridges-ui/CarlaBridgeClient.cpp
  25. +1
    -1
      source/bridges-ui/CarlaBridgeClient.hpp
  26. +9
    -9
      source/carla_backend.py
  27. +8
    -9
      source/modules/jackbridge/JackBridge.hpp
  28. +1
    -1
      source/modules/jackbridge/JackBridge1.cpp
  29. +31
    -42
      source/modules/jackbridge/JackBridge2.cpp
  30. +8
    -2
      source/utils/CarlaBackendUtils.hpp
  31. +25
    -35
      source/utils/CarlaBridgeUtils.hpp
  32. +2
    -0
      source/utils/CarlaEngineUtils.hpp
  33. +15
    -16
      source/utils/CarlaShmUtils.hpp
  34. +19
    -0
      source/utils/CarlaStateUtils.cpp
  35. +10
    -6
      source/utils/CarlaStateUtils.hpp

+ 20
- 12
source/backend/CarlaBackend.h View File

@@ -465,6 +465,7 @@ typedef enum {

/*!
* VST3 plugin.
* @note Windows and MacOS only
*/
PLUGIN_VST3 = 6,

@@ -587,6 +588,7 @@ typedef enum {
*/
PARAMETER_NULL = -1,

#ifndef BUILD_BRIDGE
/*!
* Active parameter, boolean type.\n
* Default is 'false'.
@@ -628,6 +630,7 @@ typedef enum {
* Range -1...15 (-1 = off).
*/
PARAMETER_CTRL_CHANNEL = -8,
#endif

/*!
* Max value, defined only for convenience.
@@ -694,6 +697,7 @@ typedef enum {
*/
ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED = 6,

#ifndef BUILD_BRIDGE
/*!
* A parameter's MIDI CC has changed.
* @param pluginId Plugin Id
@@ -711,27 +715,28 @@ typedef enum {
ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED = 8,

/*!
* The current program of a plugin has changed.
* A plugin option has changed.
* @param pluginId Plugin Id
* @param value1 New program index
* @param value1 Option
* @param value2 New on/off state (1 for on, 0 for off)
* @see PluginOptions
*/
ENGINE_CALLBACK_PROGRAM_CHANGED = 9,
ENGINE_CALLBACK_OPTION_CHANGED = 9,
#endif

/*!
* The current MIDI program of a plugin has changed.
* The current program of a plugin has changed.
* @param pluginId Plugin Id
* @param value1 New MIDI program index
* @param value1 New program index
*/
ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED = 10,
ENGINE_CALLBACK_PROGRAM_CHANGED = 10,

/*!
* A plugin option has changed.
* The current MIDI program of a plugin has changed.
* @param pluginId Plugin Id
* @param value1 Option
* @param value2 New on/off state (1 for on, 0 for off)
* @see PluginOptions
* @param value1 New MIDI program index
*/
ENGINE_CALLBACK_OPTION_CHANGED = 11,
ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED = 11,

/*!
* A plugin's custom UI state has changed.
@@ -790,6 +795,7 @@ typedef enum {
*/
ENGINE_CALLBACK_RELOAD_ALL = 19,

#ifndef BUILD_BRIDGE
/*!
* A patchbay client has been added.
* @param pluginId Client Id
@@ -859,6 +865,7 @@ typedef enum {
* @param pluginId Connection Id
*/
ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED = 28,
#endif

/*!
* Engine started.
@@ -1346,7 +1353,8 @@ typedef struct {
{
return value * (max - min) + min;
}
#endif
#endif // __cplusplus

} ParameterRanges;

/*!


+ 3
- 4
source/backend/CarlaEngine.hpp View File

@@ -1145,18 +1145,17 @@ public:
// Bridge/Controller OSC stuff

#ifdef BUILD_BRIDGE
void oscSend_bridge_plugin_info1(const PluginCategory category, const uint hints, const int64_t uniqueId) const noexcept;
void oscSend_bridge_plugin_info1(const PluginCategory category, const uint hints, const uint optionsAvailable, const uint optionsEnabled, const int64_t uniqueId) const noexcept;
void oscSend_bridge_plugin_info2(const char* const realName, const char* const label, const char* const maker, const char* const copyright) const noexcept;
void oscSend_bridge_audio_count(const uint32_t ins, const uint32_t outs) const noexcept;
void oscSend_bridge_midi_count(const uint32_t ins, const uint32_t outs) const noexcept;
void oscSend_bridge_parameter_count(const uint32_t ins, const uint32_t outs) const noexcept;
void oscSend_bridge_program_count(const uint32_t count) const noexcept;
void oscSend_bridge_midi_program_count(const uint32_t count) const noexcept;
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 noexcept;
void oscSend_bridge_parameter_data1(const uint32_t index, const int32_t rindex, const ParameterType type, const uint hints, const int16_t cc) const noexcept;
void oscSend_bridge_parameter_data2(const uint32_t index, const char* const name, const char* const unit) const noexcept;
void oscSend_bridge_parameter_ranges1(const uint32_t index, const float def, const float min, const float max) const noexcept;
void oscSend_bridge_parameter_ranges2(const uint32_t index, const float step, const float stepSmall, const float stepLarge) const noexcept;
void oscSend_bridge_parameter_midi_cc(const uint32_t index, const int16_t cc) const noexcept;
void oscSend_bridge_parameter_midi_channel(const uint32_t index, const uint8_t channel) const noexcept;
void oscSend_bridge_parameter_value(const uint32_t index, const float value) const noexcept;
void oscSend_bridge_default_value(const uint32_t index, const float value) const noexcept;
void oscSend_bridge_current_program(const int32_t index) const noexcept;


+ 4
- 2
source/backend/CarlaHost.h View File

@@ -514,7 +514,6 @@ CARLA_EXPORT bool carla_patchbay_disconnect(uint connectionId);
* Force the engine to resend all patchbay clients, ports and connections again.
*/
CARLA_EXPORT bool carla_patchbay_refresh();
#endif

/*!
* Start playback of the engine transport.
@@ -541,6 +540,7 @@ CARLA_EXPORT uint64_t carla_get_current_transport_frame();
* Get the engine transport information.
*/
CARLA_EXPORT const CarlaTransportInfo* carla_get_transport_info();
#endif

/*!
* Add a new plugin.\n
@@ -799,6 +799,7 @@ CARLA_EXPORT float carla_get_input_peak_value(uint pluginId, bool isLeft);
*/
CARLA_EXPORT float carla_get_output_peak_value(uint pluginId, bool isLeft);

#ifndef BUILD_BRIDGE
/*!
* Enable a plugin's option.
* @param pluginId Plugin
@@ -814,7 +815,6 @@ CARLA_EXPORT void carla_set_option(uint pluginId, uint option, bool yesNo);
*/
CARLA_EXPORT void carla_set_active(uint pluginId, bool onOff);

#ifndef BUILD_BRIDGE
/*!
* Change a plugin's internal dry/wet.
* @param pluginId Plugin
@@ -866,6 +866,7 @@ CARLA_EXPORT void carla_set_ctrl_channel(uint pluginId, int8_t channel);
*/
CARLA_EXPORT void carla_set_parameter_value(uint pluginId, uint32_t parameterId, float value);

#ifndef BUILD_BRIDGE
/*!
* Change a plugin's parameter MIDI channel.
* @param pluginId Plugin
@@ -881,6 +882,7 @@ CARLA_EXPORT void carla_set_parameter_midi_channel(uint pluginId, uint32_t param
* @param cc New MIDI cc
*/
CARLA_EXPORT void carla_set_parameter_midi_cc(uint pluginId, uint32_t parameterId, int16_t cc);
#endif

/*!
* Change a plugin's current program.


+ 3
- 1
source/backend/CarlaPlugin.hpp View File

@@ -538,6 +538,7 @@ public:
*/
void setParameterValueByRealIndex(const int32_t rindex, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept;

#ifndef BUILD_BRIDGE
/*!
* Set parameter's \a parameterId MIDI channel to \a channel.\n
* \a channel must be between 0 and 15.
@@ -549,6 +550,7 @@ public:
* \a cc must be between 0 and 95 (0x5F), or -1 for invalid.
*/
void setParameterMidiCC(const uint32_t parameterId, int16_t cc, const bool sendOsc, const bool sendCallback) noexcept;
#endif

/*!
* Add a custom data set.\n
@@ -743,7 +745,6 @@ public:
* \note Non-RT call
*/
void sendMidiSingleNote(const uint8_t channel, const uint8_t note, const uint8_t velo, const bool sendGui, const bool sendOsc, const bool sendCallback);
#endif

/*!
* Send all midi notes off to the host callback.\n
@@ -751,6 +752,7 @@ public:
* \note RT call
*/
void sendMidiAllNotesOffToCallback();
#endif

// -------------------------------------------------------------------
// Post-poned events


+ 5
- 3
source/backend/CarlaStandalone.cpp View File

@@ -1088,7 +1088,6 @@ bool carla_patchbay_refresh()
gStandalone.lastError = "Engine is not running";
return false;
}
#endif

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

@@ -1153,6 +1152,7 @@ const CarlaTransportInfo* carla_get_transport_info()

return &retInfo;
}
#endif

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

@@ -1677,7 +1677,7 @@ const char* carla_get_chunk_data(uint pluginId)
if (plugin->getOptionsEnabled() & CB::PLUGIN_OPTION_USE_CHUNKS)
{
void* data = nullptr;
const int32_t dataSize(plugin->getChunkData(&data));
const std::size_t dataSize(plugin->getChunkData(&data));

if (data != nullptr && dataSize > 0)
{
@@ -1932,6 +1932,7 @@ float carla_get_output_peak_value(uint pluginId, bool isLeft)

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

#ifndef BUILD_BRIDGE
void carla_set_option(uint pluginId, uint option, bool yesNo)
{
CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,);
@@ -1954,7 +1955,6 @@ void carla_set_active(uint pluginId, bool onOff)
carla_stderr2("carla_set_active(%i, %s) - could not find plugin", pluginId, bool2str(onOff));
}

#ifndef BUILD_BRIDGE
void carla_set_drywet(uint pluginId, float value)
{
CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,);
@@ -2042,6 +2042,7 @@ void carla_set_parameter_value(uint pluginId, uint32_t parameterId, float value)
carla_stderr2("carla_set_parameter_value(%i, %i, %f) - could not find plugin", pluginId, parameterId, value);
}

#ifndef BUILD_BRIDGE
void carla_set_parameter_midi_channel(uint pluginId, uint32_t parameterId, uint8_t channel)
{
CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,);
@@ -2077,6 +2078,7 @@ void carla_set_parameter_midi_cc(uint pluginId, uint32_t parameterId, int16_t cc

carla_stderr2("carla_set_parameter_midi_cc(%i, %i, %i) - could not find plugin", pluginId, parameterId, cc);
}
#endif

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



+ 0
- 8
source/backend/Makefile View File

@@ -110,11 +110,3 @@ CarlaStandalone.cpp.o: CarlaStandalone.cpp $(CARLA_STANDALONE_CPP_DEPS)
$(CXX) $< $(LIBS_START) $(STANDALONE_LIBS) $(LIBS_END) $(LINK_FLAGS) $(STANDALONE_FLAGS) $(SHARED) -o $@

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

carla_%.a:
$(MAKE) -C $* ../carla_$*.a

../modules/%.a:
$(MAKE) -C ../modules/$* ../$*.a

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

+ 22
- 22
source/backend/engine/CarlaEngine.cpp View File

@@ -321,7 +321,7 @@ CarlaEngineClient* CarlaEngine::addClient(CarlaPlugin* const)

bool CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype, const char* const filename, const char* const name, const char* const label, const int64_t uniqueId, const void* const extra)
{
CARLA_SAFE_ASSERT_RETURN_ERR(! pData->isIdling, "An operation is still being processed, please wait for it to finish");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->isIdling == 0, "An operation is still being processed, please wait for it to finish");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->plugins != nullptr, "Invalid engine internal data");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->nextPluginId <= pData->maxPluginNumber, "Invalid engine internal data");
CARLA_SAFE_ASSERT_RETURN_ERR(btype != BINARY_NONE, "Invalid plugin binary mode");
@@ -541,7 +541,9 @@ bool CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype, cons
pluginData.outsPeak[0] = 0.0f;
pluginData.outsPeak[1] = 0.0f;

#ifndef BUILD_BRIDGE
#ifdef BUILD_BRIDGE
plugin->setActive(true, true, true);
#else
if (oldPlugin != nullptr)
{
// the engine thread might be reading from the old plugin
@@ -582,7 +584,7 @@ bool CarlaEngine::addPlugin(const PluginType ptype, const char* const filename,

bool CarlaEngine::removePlugin(const uint id)
{
CARLA_SAFE_ASSERT_RETURN_ERR(! pData->isIdling, "An operation is still being processed, please wait for it to finish");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->isIdling == 0, "An operation is still being processed, please wait for it to finish");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->plugins != nullptr, "Invalid engine internal data");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->curPluginCount != 0, "Invalid engine internal data");
CARLA_SAFE_ASSERT_RETURN_ERR(id < pData->curPluginCount, "Invalid plugin Id");
@@ -616,7 +618,7 @@ bool CarlaEngine::removePlugin(const uint id)

bool CarlaEngine::removeAllPlugins()
{
CARLA_SAFE_ASSERT_RETURN_ERR(! pData->isIdling, "An operation is still being processed, please wait for it to finish");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->isIdling == 0, "An operation is still being processed, please wait for it to finish");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->plugins != nullptr, "Invalid engine internal data");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->nextPluginId == pData->maxPluginNumber, "Invalid engine internal data");
carla_debug("CarlaEngine::removeAllPlugins()");
@@ -657,7 +659,7 @@ bool CarlaEngine::removeAllPlugins()
#ifndef BUILD_BRIDGE
const char* CarlaEngine::renamePlugin(const uint id, const char* const newName)
{
CARLA_SAFE_ASSERT_RETURN_ERRN(! pData->isIdling, "An operation is still being processed, please wait for it to finish");
CARLA_SAFE_ASSERT_RETURN_ERRN(pData->isIdling == 0, "An operation is still being processed, please wait for it to finish");
CARLA_SAFE_ASSERT_RETURN_ERRN(pData->plugins != nullptr, "Invalid engine internal data");
CARLA_SAFE_ASSERT_RETURN_ERRN(pData->curPluginCount != 0, "Invalid engine internal data");
CARLA_SAFE_ASSERT_RETURN_ERRN(id < pData->curPluginCount, "Invalid plugin Id");
@@ -681,7 +683,7 @@ const char* CarlaEngine::renamePlugin(const uint id, const char* const newName)

bool CarlaEngine::clonePlugin(const uint id)
{
CARLA_SAFE_ASSERT_RETURN_ERR(! pData->isIdling, "An operation is still being processed, please wait for it to finish");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->isIdling == 0, "An operation is still being processed, please wait for it to finish");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->plugins != nullptr, "Invalid engine internal data");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->curPluginCount != 0, "Invalid engine internal data");
CARLA_SAFE_ASSERT_RETURN_ERR(id < pData->curPluginCount, "Invalid plugin Id");
@@ -711,7 +713,7 @@ bool CarlaEngine::clonePlugin(const uint id)

bool CarlaEngine::replacePlugin(const uint id) noexcept
{
CARLA_SAFE_ASSERT_RETURN_ERR(! pData->isIdling, "An operation is still being processed, please wait for it to finish");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->isIdling == 0, "An operation is still being processed, please wait for it to finish");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->plugins != nullptr, "Invalid engine internal data");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->curPluginCount != 0, "Invalid engine internal data");
carla_debug("CarlaEngine::replacePlugin(%i)", id);
@@ -737,7 +739,7 @@ bool CarlaEngine::replacePlugin(const uint id) noexcept

bool CarlaEngine::switchPlugins(const uint idA, const uint idB) noexcept
{
CARLA_SAFE_ASSERT_RETURN_ERR(! pData->isIdling, "An operation is still being processed, please wait for it to finish");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->isIdling == 0, "An operation is still being processed, please wait for it to finish");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->plugins != nullptr, "Invalid engine internal data");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->curPluginCount >= 2, "Invalid engine internal data");
CARLA_SAFE_ASSERT_RETURN_ERR(idA != idB, "Invalid operation, cannot switch plugin with itself");
@@ -870,7 +872,7 @@ const char* CarlaEngine::getUniquePluginName(const char* const name) const

bool CarlaEngine::loadFile(const char* const filename)
{
CARLA_SAFE_ASSERT_RETURN_ERR(! pData->isIdling, "An operation is still being processed, please wait for it to finish");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->isIdling == 0, "An operation is still being processed, please wait for it to finish");
CARLA_SAFE_ASSERT_RETURN_ERR(filename != nullptr && filename[0] != '\0', "Invalid filename");
carla_debug("CarlaEngine::loadFile(\"%s\")", filename);

@@ -949,7 +951,7 @@ bool CarlaEngine::loadFile(const char* const filename)

bool CarlaEngine::loadProject(const char* const filename)
{
CARLA_SAFE_ASSERT_RETURN_ERR(! pData->isIdling, "An operation is still being processed, please wait for it to finish");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->isIdling == 0, "An operation is still being processed, please wait for it to finish");
CARLA_SAFE_ASSERT_RETURN_ERR(filename != nullptr && filename[0] != '\0', "Invalid filename");
carla_debug("CarlaEngine::loadProject(\"%s\")", filename);

@@ -1213,11 +1215,19 @@ void CarlaEngine::callback(const EngineCallbackOpcode action, const uint pluginI
{
carla_debug("CarlaEngine::callback(%i:%s, %i, %i, %i, %f, \"%s\")", action, EngineCallbackOpcode2Str(action), pluginId, value1, value2, value3, valueStr);

#ifdef BUILD_BRIDGE
if (pData->isIdling)
#else
if (pData->isIdling && action != ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED)
#endif
{
carla_stdout("callback while idling (%i:%s, %i, %i, %i, %f, \"%s\")", action, EngineCallbackOpcode2Str(action), pluginId, value1, value2, value3, valueStr);
}

if (action == ENGINE_CALLBACK_IDLE)
pData->isIdling = true;
{
++pData->isIdling;
}
#ifdef BUILD_BRIDGE
else if (pData->oscData != nullptr)
{
@@ -1231,16 +1241,6 @@ void CarlaEngine::callback(const EngineCallbackOpcode action, const uint pluginI
CARLA_SAFE_ASSERT_BREAK(value1 >= 0);
oscSend_bridge_default_value(static_cast<uint>(value1), value3);
break;
case ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED:
CARLA_SAFE_ASSERT_BREAK(value1 >= 0);
CARLA_SAFE_ASSERT_BREAK(value2 >= -1 && value2 <= 0x5F);
oscSend_bridge_parameter_midi_cc(static_cast<uint>(value1), static_cast<int16_t>(value2));
break;
case ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED:
CARLA_SAFE_ASSERT_BREAK(value1 >= 0);
CARLA_SAFE_ASSERT_BREAK(value2 >= 0 && value2 < MAX_MIDI_CHANNELS);
oscSend_bridge_parameter_midi_channel(static_cast<uint>(value1), static_cast<uint8_t>(value2));
break;
case ENGINE_CALLBACK_PROGRAM_CHANGED:
CARLA_SAFE_ASSERT_BREAK(value1 >= -1);
oscSend_bridge_current_program(value1);
@@ -1267,7 +1267,7 @@ void CarlaEngine::callback(const EngineCallbackOpcode action, const uint pluginI
}

if (action == ENGINE_CALLBACK_IDLE)
pData->isIdling = false;
--pData->isIdling;
}

void CarlaEngine::setCallback(const EngineCallbackFunc func, void* const ptr) noexcept


+ 5
- 25
source/backend/engine/CarlaEngineBridge.cpp View File

@@ -34,9 +34,9 @@
using juce::File;
using juce::String;

#ifdef JACKBRIDGE_EXPORT
// -------------------------------------------------------------------

#ifdef JACKBRIDGE_EXPORT
bool jackbridge_is_ok() noexcept
{
return true;
@@ -324,10 +324,7 @@ public:
CarlaEngine::close();

stopThread(5000);

fShmAudioPool.clear();
fShmRtControl.clear();
fShmNonRtControl.clear();
clear();

return true;
}
@@ -375,7 +372,8 @@ public:
const PluginBridgeNonRtOpcode opcode(fShmNonRtControl.readOpcode());
CarlaPlugin* const plugin(pData->plugins[0].plugin);

carla_stdout("CarlaEngineBridgeNonRtThread::run() - got opcode: %s", PluginBridgeNonRtOpcode2str(opcode));
if (opcode != kPluginBridgeNonRtPing)
carla_stdout("CarlaEngineBridge::handleNonRtData() - got opcode: %s", PluginBridgeNonRtOpcode2str(opcode));

switch (opcode)
{
@@ -421,7 +419,7 @@ public:
break;

case kPluginBridgeNonRtSetParameterValue: {
const uint32_t index(fShmNonRtControl.readInt());
const uint32_t index(fShmNonRtControl.readUInt());
const float value(fShmNonRtControl.readFloat());

if (plugin != nullptr && plugin->isEnabled())
@@ -429,24 +427,6 @@ public:
break;
}

case kPluginBridgeNonRtSetParameterMidiChannel: {
const uint32_t index(fShmNonRtControl.readInt());
const uint8_t channel(fShmNonRtControl.readByte());

if (plugin != nullptr && plugin->isEnabled())
plugin->setParameterMidiChannel(index, channel, false, false);
break;
}

case kPluginBridgeNonRtSetParameterMidiCC: {
const uint32_t index(fShmNonRtControl.readInt());
const int16_t cc(fShmNonRtControl.readShort());

if (plugin != nullptr && plugin->isEnabled())
plugin->setParameterMidiCC(index, cc, false, false);
break;
}

case kPluginBridgeNonRtSetProgram: {
const int32_t index(fShmNonRtControl.readInt());



+ 7
- 6
source/backend/engine/CarlaEngineInternal.cpp View File

@@ -94,24 +94,25 @@ CarlaEngine::ProtectedData::ProtectedData(CarlaEngine* const engine) noexcept
bufferSize(0),
sampleRate(0.0),
aboutToClose(false),
isIdling(false),
isIdling(0),
curPluginCount(0),
maxPluginNumber(0),
nextPluginId(0)
#ifndef BUILD_BRIDGE
, plugins(nullptr)
#endif
nextPluginId(0),
plugins(nullptr) {}
#else
nextPluginId(0)
{
#ifdef BUILD_BRIDGE
carla_zeroStruct(plugins, 1);
#endif
}
#endif

CarlaEngine::ProtectedData::~ProtectedData() noexcept
{
CARLA_SAFE_ASSERT(curPluginCount == 0);
CARLA_SAFE_ASSERT(maxPluginNumber == 0);
CARLA_SAFE_ASSERT(nextPluginId == 0);
CARLA_SAFE_ASSERT(isIdling == 0);
#ifndef BUILD_BRIDGE
CARLA_SAFE_ASSERT(plugins == nullptr);
#endif


+ 1
- 1
source/backend/engine/CarlaEngineInternal.hpp View File

@@ -157,7 +157,7 @@ struct CarlaEngine::ProtectedData {
double sampleRate;

bool aboutToClose; // don't re-activate thread if true
bool isIdling; // don't allow any operations while idling
int isIdling; // don't allow any operations while idling
uint curPluginCount; // number of plugins loaded (0...max)
uint maxPluginNumber; // number of plugins allowed (0, 16, 99 or 255)
uint nextPluginId; // invalid if == maxPluginNumber


+ 4
- 6
source/backend/engine/CarlaEngineOsc.cpp View File

@@ -348,16 +348,14 @@ int CarlaEngineOsc::handleMessage(const bool isTCP, const char* const path, cons
return CarlaPluginSetOscBridgeInfo(plugin, kPluginBridgeOscProgramCount, argc, argv, types);
if (std::strcmp(bmethod, "midi_program_count") == 0)
return CarlaPluginSetOscBridgeInfo(plugin, kPluginBridgeOscMidiProgramCount, argc, argv, types);
if (std::strcmp(bmethod, "parameter_data") == 0)
return CarlaPluginSetOscBridgeInfo(plugin, kPluginBridgeOscParameterData, argc, argv, types);
if (std::strcmp(bmethod, "parameter_data1") == 0)
return CarlaPluginSetOscBridgeInfo(plugin, kPluginBridgeOscParameterData1, argc, argv, types);
if (std::strcmp(bmethod, "parameter_data2") == 0)
return CarlaPluginSetOscBridgeInfo(plugin, kPluginBridgeOscParameterData2, argc, argv, types);
if (std::strcmp(bmethod, "parameter_ranges1") == 0)
return CarlaPluginSetOscBridgeInfo(plugin, kPluginBridgeOscParameterRanges1, argc, argv, types);
if (std::strcmp(bmethod, "parameter_ranges2") == 0)
return CarlaPluginSetOscBridgeInfo(plugin, kPluginBridgeOscParameterRanges2, argc, argv, types);
if (std::strcmp(bmethod, "parameter_midi_cc") == 0)
return CarlaPluginSetOscBridgeInfo(plugin, kPluginBridgeOscParameterMidiCC, argc, argv, types);
if (std::strcmp(bmethod, "parameter_midi_channel") == 0)
return CarlaPluginSetOscBridgeInfo(plugin, kPluginBridgeOscParameterMidiChannel, argc, argv, types);
if (std::strcmp(bmethod, "parameter_value") == 0)
return CarlaPluginSetOscBridgeInfo(plugin, kPluginBridgeOscParameterValue, argc, argv, types);
if (std::strcmp(bmethod, "default_value") == 0)


+ 22
- 34
source/backend/engine/CarlaEngineOscSend.cpp View File

@@ -24,17 +24,17 @@ CARLA_BACKEND_START_NAMESPACE
// -----------------------------------------------------------------------

#ifdef BUILD_BRIDGE
void CarlaEngine::oscSend_bridge_plugin_info1(const PluginCategory category, const uint hints, const int64_t uniqueId) const noexcept
void CarlaEngine::oscSend_bridge_plugin_info1(const PluginCategory category, const uint hints, const uint optionsAvailable, const uint optionsEnabled, const int64_t uniqueId) const noexcept
{
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
carla_debug("CarlaEngine::oscSend_bridge_plugin_info1(%i:%s, %X, " P_INT64 ")", category, PluginCategory2Str(category), hints, uniqueId);
carla_debug("CarlaEngine::oscSend_bridge_plugin_info1(%i:%s, %X, %X, %X, " P_INT64 ")", category, PluginCategory2Str(category), hints, optionsAvailable, optionsEnabled, uniqueId);

char targetPath[std::strlen(pData->oscData->path)+21];
std::strcpy(targetPath, pData->oscData->path);
std::strcat(targetPath, "/bridge_plugin_info1");
try_lo_send(pData->oscData->target, targetPath, "iih", static_cast<int32_t>(category), static_cast<int32_t>(hints), uniqueId);
try_lo_send(pData->oscData->target, targetPath, "iiiih", static_cast<int32_t>(category), static_cast<int32_t>(hints), static_cast<int32_t>(optionsAvailable), static_cast<int32_t>(optionsEnabled), uniqueId);
}

void CarlaEngine::oscSend_bridge_plugin_info2(const char* const realName, const char* const label, const char* const maker, const char* const copyright) const noexcept
@@ -119,19 +119,33 @@ void CarlaEngine::oscSend_bridge_midi_program_count(const uint32_t count) const
try_lo_send(pData->oscData->target, targetPath, "i", static_cast<int32_t>(count));
}

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 noexcept
void CarlaEngine::oscSend_bridge_parameter_data1(const uint32_t index, const int32_t rindex, const ParameterType type, const uint hints, const int16_t cc) const noexcept
{
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
CARLA_SAFE_ASSERT_RETURN(cc >= -1 && cc < 0x9F,); // FIXME
carla_debug("CarlaEngine::oscSend_bridge_parameter_data1(%i, %i, %i:%s, %X, %i)", index, rindex, type, ParameterType2Str(type), hints, cc);

char targetPath[std::strlen(pData->oscData->path)+25];
std::strcpy(targetPath, pData->oscData->path);
std::strcat(targetPath, "/bridge_parameter_data1");
try_lo_send(pData->oscData->target, targetPath, "iiiii", static_cast<int32_t>(index), static_cast<int32_t>(rindex), static_cast<int32_t>(type), static_cast<int32_t>(hints), static_cast<int32_t>(cc));
}

void CarlaEngine::oscSend_bridge_parameter_data2(const uint32_t index, const char* const name, const char* const unit) const noexcept
{
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
CARLA_SAFE_ASSERT_RETURN(name != nullptr,);
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);
carla_debug("CarlaEngine::oscSend_bridge_parameter_data2(%i, \"%s\", \"%s\")", index, name, unit);

char targetPath[std::strlen(pData->oscData->path)+24];
char targetPath[std::strlen(pData->oscData->path)+25];
std::strcpy(targetPath, pData->oscData->path);
std::strcat(targetPath, "/bridge_parameter_data");
try_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);
std::strcat(targetPath, "/bridge_parameter_data2");
try_lo_send(pData->oscData->target, targetPath, "iss", static_cast<int32_t>(index), name, unit);
}

void CarlaEngine::oscSend_bridge_parameter_ranges1(const uint32_t index, const float def, const float min, const float max) const noexcept
@@ -160,32 +174,6 @@ void CarlaEngine::oscSend_bridge_parameter_ranges2(const uint32_t index, const f
try_lo_send(pData->oscData->target, targetPath, "ifff", static_cast<int32_t>(index), step, stepSmall, stepLarge);
}

void CarlaEngine::oscSend_bridge_parameter_midi_cc(const uint32_t index, const int16_t cc) const noexcept
{
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
carla_debug("CarlaEngine::oscSend_bridge_parameter_midi_cc(%i, %i)", index, cc);

char targetPath[std::strlen(pData->oscData->path)+26];
std::strcpy(targetPath, pData->oscData->path);
std::strcat(targetPath, "/bridge_parameter_midi_cc");
try_lo_send(pData->oscData->target, targetPath, "ii", static_cast<int32_t>(index), static_cast<int32_t>(cc));
}

void CarlaEngine::oscSend_bridge_parameter_midi_channel(const uint32_t index, const uint8_t channel) const noexcept
{
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
carla_debug("CarlaEngine::oscSend_bridge_parameter_midi_channel(%i, %i)", index, channel);

char targetPath[std::strlen(pData->oscData->path)+31];
std::strcpy(targetPath, pData->oscData->path);
std::strcat(targetPath, "/bridge_parameter_midi_channel");
try_lo_send(pData->oscData->target, targetPath, "ii", static_cast<int32_t>(index), static_cast<int32_t>(channel));
}

void CarlaEngine::oscSend_bridge_parameter_value(const uint32_t index, const float value) const noexcept
{
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);


+ 52
- 63
source/backend/plugin/BridgePlugin.cpp View File

@@ -438,17 +438,7 @@ public:

uint getOptionsAvailable() const noexcept override
{
uint options = 0x0;

options |= PLUGIN_OPTION_MAP_PROGRAM_CHANGES;
options |= PLUGIN_OPTION_USE_CHUNKS;
options |= PLUGIN_OPTION_SEND_CONTROL_CHANGES;
options |= PLUGIN_OPTION_SEND_CHANNEL_PRESSURE;
options |= PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH;
options |= PLUGIN_OPTION_SEND_PITCHBEND;
options |= PLUGIN_OPTION_SEND_ALL_SOUND_OFF;

return options;
return fInfo.optionsAvailable;
}

float getParameterValue(const uint32_t parameterId) const noexcept override
@@ -620,7 +610,7 @@ public:

fShmNonRtControl.writeOpcode(kPluginBridgeNonRtSetChunkDataFile);
fShmNonRtControl.writeInt(filePath.length());
fShmNonRtControl.writeCustomData(filePath.toRawUTF8(), filePath.length());
fShmNonRtControl.writeCustomData(filePath.toRawUTF8(), static_cast<uint32_t>(filePath.length()));
fShmNonRtControl.commitWrite();
}
}
@@ -649,7 +639,14 @@ public:

void idle() override
{
if (! pData->osc.thread.isThreadRunning())
if (pData->osc.thread.isThreadRunning())
{
const CarlaMutexLocker _cml(fShmNonRtControl.mutex);

fShmNonRtControl.writeOpcode(kPluginBridgeNonRtPing);
fShmNonRtControl.commitWrite();
}
else
carla_stderr2("TESTING: Bridge has closed!");

CarlaPlugin::idle();
@@ -1000,7 +997,7 @@ public:

setParameterValue(k, value, false, false, false);
pData->postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(k), 0, value);
break;
break;
}

// check if event is already handled
@@ -1010,7 +1007,7 @@ public:
if ((pData->options & PLUGIN_OPTION_SEND_CONTROL_CHANGES) != 0 && ctrlEvent.param <= 0x5F)
{
fShmRtControl.writeOpcode(kPluginBridgeRtMidiEvent);
fShmRtControl.writeInt(event.time);
fShmRtControl.writeInt(static_cast<int32_t>(event.time));
fShmRtControl.writeInt(3);
fShmRtControl.writeByte(static_cast<uint8_t>(MIDI_STATUS_CONTROL_CHANGE + event.channel));
fShmRtControl.writeByte(static_cast<uint8_t>(ctrlEvent.param));
@@ -1097,7 +1094,7 @@ public:

{
fShmRtControl.writeOpcode(kPluginBridgeRtMidiEvent);
fShmRtControl.writeInt(event.time);
fShmRtControl.writeInt(static_cast<int32_t>(event.time));
fShmRtControl.writeInt(midiEvent.size);

fShmRtControl.writeByte(static_cast<uint8_t>(status + channel));
@@ -1332,20 +1329,27 @@ public:
break;

case kPluginBridgeOscPluginInfo1: {
CARLA_BRIDGE_CHECK_OSC_TYPES(3, "iih");
CARLA_BRIDGE_CHECK_OSC_TYPES(5, "iiiih");

const int32_t category = argv[0]->i;
const int32_t hints = argv[1]->i;
const int64_t uniqueId = argv[2]->h;
const int32_t optionAv = argv[2]->i;
const int32_t optionEn = argv[3]->i;
const int64_t uniqueId = argv[4]->h;

CARLA_SAFE_ASSERT_BREAK(category >= 0);
CARLA_SAFE_ASSERT_BREAK(hints >= 0);
CARLA_SAFE_ASSERT_BREAK(optionAv >= 0);
CARLA_SAFE_ASSERT_BREAK(optionEn >= 0);

pData->hints = static_cast<uint>(hints);
pData->hints |= PLUGIN_IS_BRIDGE;

pData->options = static_cast<uint>(optionEn);

fInfo.category = static_cast<PluginCategory>(category);
fInfo.uniqueId = static_cast<long>(uniqueId);
fInfo.uniqueId = uniqueId;
fInfo.optionsAvailable = static_cast<uint>(optionAv);
break;
}

@@ -1465,23 +1469,20 @@ public:
break;
}

case kPluginBridgeOscParameterData:
{
CARLA_BRIDGE_CHECK_OSC_TYPES(6, "iiiiss");
case kPluginBridgeOscParameterData1: {
CARLA_BRIDGE_CHECK_OSC_TYPES(5, "iiiii");

const int32_t index = argv[0]->i;
const int32_t rindex = argv[1]->i;
const int32_t type = argv[2]->i;
const int32_t hints = argv[3]->i;
const char* const name = (const char*)&argv[4]->s;
const char* const unit = (const char*)&argv[5]->s;
const int32_t midiCC = argv[4]->i;

CARLA_SAFE_ASSERT_BREAK(index >= 0);
CARLA_SAFE_ASSERT_BREAK(rindex >= 0);
CARLA_SAFE_ASSERT_BREAK(type >= 0);
CARLA_SAFE_ASSERT_BREAK(hints >= 0);
CARLA_SAFE_ASSERT_BREAK(name != nullptr);
CARLA_SAFE_ASSERT_BREAK(unit != nullptr);
CARLA_SAFE_ASSERT_BREAK(midiCC >= -1 && midiCC < 0x5F);
CARLA_SAFE_ASSERT_INT2(index < static_cast<int32_t>(pData->param.count), index, pData->param.count);

if (index < static_cast<int32_t>(pData->param.count))
@@ -1490,14 +1491,32 @@ public:
pData->param.data[index].index = index;
pData->param.data[index].rindex = rindex;
pData->param.data[index].hints = static_cast<uint>(hints);
pData->param.data[index].midiCC = static_cast<int16_t>(midiCC);
}
break;
}

case kPluginBridgeOscParameterData2: {
CARLA_BRIDGE_CHECK_OSC_TYPES(3, "iss");

const int32_t index = argv[0]->i;
const char* const name = (const char*)&argv[1]->s;
const char* const unit = (const char*)&argv[2]->s;

CARLA_SAFE_ASSERT_BREAK(index >= 0);
CARLA_SAFE_ASSERT_BREAK(name != nullptr);
CARLA_SAFE_ASSERT_BREAK(unit != nullptr);
CARLA_SAFE_ASSERT_INT2(index < static_cast<int32_t>(pData->param.count), index, pData->param.count);

if (index < static_cast<int32_t>(pData->param.count))
{
fParams[index].name = name;
fParams[index].unit = unit;
}
break;
}

case kPluginBridgeOscParameterRanges1:
{
case kPluginBridgeOscParameterRanges1: {
CARLA_BRIDGE_CHECK_OSC_TYPES(4, "ifff");

const int32_t index = argv[0]->i;
@@ -1520,8 +1539,7 @@ public:
break;
}

case kPluginBridgeOscParameterRanges2:
{
case kPluginBridgeOscParameterRanges2: {
CARLA_BRIDGE_CHECK_OSC_TYPES(4, "ifff");

const int32_t index = argv[0]->i;
@@ -1541,38 +1559,7 @@ public:
break;
}

case kPluginBridgeOscParameterMidiCC: {
CARLA_BRIDGE_CHECK_OSC_TYPES(2, "ii");

const int32_t index = argv[0]->i;
const int32_t cc = argv[1]->i;

CARLA_SAFE_ASSERT_BREAK(index >= 0);
CARLA_SAFE_ASSERT_BREAK(cc >= -1 && cc < 0x5F);
CARLA_SAFE_ASSERT_INT2(index < static_cast<int32_t>(pData->param.count), index, pData->param.count);

if (index < static_cast<int32_t>(pData->param.count))
pData->param.data[index].midiCC = static_cast<int16_t>(cc);
break;
}

case kPluginBridgeOscParameterMidiChannel: {
CARLA_BRIDGE_CHECK_OSC_TYPES(2, "ii");

const int32_t index = argv[0]->i;
const int32_t channel = argv[1]->i;

CARLA_SAFE_ASSERT_BREAK(index >= 0);
CARLA_SAFE_ASSERT_BREAK(channel >= 0 && channel < MAX_MIDI_CHANNELS);
CARLA_SAFE_ASSERT_INT2(index < static_cast<int32_t>(pData->param.count), index, pData->param.count);

if (index < static_cast<int32_t>(pData->param.count))
pData->param.data[index].midiChannel = static_cast<uint8_t>(channel);
break;
}

case kPluginBridgeOscParameterValue:
{
case kPluginBridgeOscParameterValue: {
CARLA_BRIDGE_CHECK_OSC_TYPES(2, "if");

const int32_t index = argv[0]->i;
@@ -2025,7 +2012,8 @@ private:
uint32_t aIns, aOuts;
uint32_t mIns, mOuts;
PluginCategory category;
long uniqueId;
uint optionsAvailable;
int64_t uniqueId;
CarlaString name;
CarlaString label;
CarlaString maker;
@@ -2038,6 +2026,7 @@ private:
mIns(0),
mOuts(0),
category(PLUGIN_CATEGORY_NONE),
optionsAvailable(0),
uniqueId(0) {}
} fInfo;



+ 32
- 68
source/backend/plugin/CarlaPlugin.cpp View File

@@ -52,11 +52,11 @@ struct ParamSymbol {
int32_t index;
const char* symbol;

ParamSymbol(uint32_t i, const char* s)
ParamSymbol(const uint32_t i, const char* const s)
: index(static_cast<int32_t>(i)),
symbol(carla_strdup(s)) {}

~ParamSymbol()
~ParamSymbol() noexcept
{
CARLA_SAFE_ASSERT_RETURN(symbol != nullptr,)

@@ -70,8 +70,6 @@ struct ParamSymbol {
#endif
};

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

// -------------------------------------------------------------------
// Constructor and destructor

@@ -150,13 +148,7 @@ const char* CarlaPlugin::getIconName() const noexcept

PluginCategory CarlaPlugin::getCategory() const noexcept
{
PluginCategory category = PLUGIN_CATEGORY_NONE;

try {
category = getPluginCategoryFromName(pData->name);
} catch(...) {}

return category;
return getPluginCategoryFromName(pData->name);
}

int64_t CarlaPlugin::getUniqueId() const noexcept
@@ -348,6 +340,7 @@ void CarlaPlugin::getParameterScalePointLabel(const uint32_t parameterId, const

float CarlaPlugin::getInternalParameterValue(const int32_t parameterId) const noexcept
{
#ifndef BUILD_BRIDGE
CARLA_SAFE_ASSERT_RETURN(parameterId != PARAMETER_NULL && parameterId > PARAMETER_MAX, 0.0f);

switch (parameterId)
@@ -356,7 +349,6 @@ float CarlaPlugin::getInternalParameterValue(const int32_t parameterId) const no
return pData->active;
case PARAMETER_CTRL_CHANNEL:
return pData->ctrlChannel;
#ifndef BUILD_BRIDGE
case PARAMETER_DRYWET:
return pData->postProc.dryWet;
case PARAMETER_VOLUME:
@@ -367,9 +359,8 @@ float CarlaPlugin::getInternalParameterValue(const int32_t parameterId) const no
return pData->postProc.balanceRight;
case PARAMETER_PANNING:
return pData->postProc.panning;
#endif
};
#endif
CARLA_SAFE_ASSERT_RETURN(parameterId >= 0, 0.0f);

return getParameterValue(static_cast<uint32_t>(parameterId));
@@ -489,17 +480,18 @@ const StateSave& CarlaPlugin::getStateSave()
pData->stateSave.name = carla_strdup(pData->name);
pData->stateSave.label = carla_strdup(strBuf);
pData->stateSave.uniqueId = getUniqueId();
#ifndef BUILD_BRIDGE
pData->stateSave.options = pData->options;
#endif

if (pData->filename != nullptr)
pData->stateSave.binary = carla_strdup(pData->filename);

#ifndef BUILD_BRIDGE
// ---------------------------------------------------------------
// Internals

pData->stateSave.active = pData->active;

#ifndef BUILD_BRIDGE
pData->stateSave.active = pData->active;
pData->stateSave.dryWet = pData->postProc.dryWet;
pData->stateSave.volume = pData->postProc.volume;
pData->stateSave.balanceLeft = pData->postProc.balanceLeft;
@@ -514,7 +506,7 @@ const StateSave& CarlaPlugin::getStateSave()
if (pData->options & PLUGIN_OPTION_USE_CHUNKS)
{
void* data = nullptr;
const int32_t dataSize(getChunkData(&data));
const std::size_t dataSize(getChunkData(&data));

if (data != nullptr && dataSize > 0)
{
@@ -561,8 +553,10 @@ const StateSave& CarlaPlugin::getStateSave()

stateParameter->isInput = (paramData.type == PARAMETER_INPUT);
stateParameter->index = paramData.index;
stateParameter->midiCC = paramData.midiCC;
#ifndef BUILD_BRIDGE
stateParameter->midiCC = paramData.midiCC;
stateParameter->midiChannel = paramData.midiChannel;
#endif

getParameterName(i, strBuf);
stateParameter->name = carla_strdup(strBuf);
@@ -803,6 +797,7 @@ void CarlaPlugin::loadStateSave(const StateSave& stateSave)
if (stateSave.chunk != nullptr && (pData->options & PLUGIN_OPTION_USE_CHUNKS) != 0)
setChunkData(stateSave.chunk);

#ifndef BUILD_BRIDGE
// ---------------------------------------------------------------
// Part 6 - set internal stuff

@@ -817,16 +812,14 @@ void CarlaPlugin::loadStateSave(const StateSave& stateSave)

}

#ifndef BUILD_BRIDGE
setDryWet(stateSave.dryWet, true, true);
setVolume(stateSave.volume, true, true);
setBalanceLeft(stateSave.balanceLeft, true, true);
setBalanceRight(stateSave.balanceRight, true, true);
setPanning(stateSave.panning, true, true);
setCtrlChannel(stateSave.ctrlChannel, true, true);
#endif

setActive(stateSave.active, true, true);
#endif
}

bool CarlaPlugin::saveStateToFile(const char* const filename)
@@ -900,8 +893,13 @@ void CarlaPlugin::setOption(const uint option, const bool yesNo, const bool send
else
pData->options &= ~option;

#ifndef BUILD_BRIDGE
if (sendCallback)
pData->engine->callback(ENGINE_CALLBACK_OPTION_CHANGED, pData->id, static_cast<int>(option), yesNo ? 1 : 0, 0.0f, nullptr);
#else
// unused
return; (void)sendCallback;
#endif
}

void CarlaPlugin::setEnabled(const bool yesNo) noexcept
@@ -915,14 +913,9 @@ void CarlaPlugin::setEnabled(const bool yesNo) noexcept
pData->masterMutex.unlock();
}

// -------------------------------------------------------------------
// Set data (internal stuff)

void CarlaPlugin::setActive(const bool active, const bool sendOsc, const bool sendCallback) noexcept
{
#ifndef BUILD_BRIDGE
CARLA_SAFE_ASSERT_RETURN(sendOsc || sendCallback,); // never call this from RT
#endif

if (pData->active == active)
return;
@@ -947,11 +940,8 @@ void CarlaPlugin::setActive(const bool active, const bool sendOsc, const bool se
if (sendCallback)
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, PARAMETER_ACTIVE, 0, value, nullptr);
#else
return;

// unused
(void)sendOsc;
(void)sendCallback;
return; (void)sendOsc; (void)sendCallback;
#endif
}

@@ -1110,6 +1100,7 @@ void CarlaPlugin::setParameterValue(const uint32_t parameterId, const float valu

void CarlaPlugin::setParameterValueByRealIndex(const int32_t rindex, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept
{
#ifndef BUILD_BRIDGE
CARLA_SAFE_ASSERT_RETURN(rindex > PARAMETER_MAX && rindex != PARAMETER_NULL,);

switch (rindex)
@@ -1118,7 +1109,6 @@ void CarlaPlugin::setParameterValueByRealIndex(const int32_t rindex, const float
return setActive((value > 0.0f), sendOsc, sendCallback);
case PARAMETER_CTRL_CHANNEL:
return setCtrlChannel(int8_t(value), sendOsc, sendCallback);
#ifndef BUILD_BRIDGE
case PARAMETER_DRYWET:
return setDryWet(value, sendOsc, sendCallback);
case PARAMETER_VOLUME:
@@ -1129,8 +1119,9 @@ void CarlaPlugin::setParameterValueByRealIndex(const int32_t rindex, const float
return setBalanceRight(value, sendOsc, sendCallback);
case PARAMETER_PANNING:
return setPanning(value, sendOsc, sendCallback);
#endif
}
#endif
CARLA_SAFE_ASSERT_RETURN(rindex >= 0,);

for (uint32_t i=0; i < pData->param.count; ++i)
{
@@ -1143,6 +1134,7 @@ void CarlaPlugin::setParameterValueByRealIndex(const int32_t rindex, const float
}
}

#ifndef BUILD_BRIDGE
void CarlaPlugin::setParameterMidiChannel(const uint32_t parameterId, uint8_t channel, const bool sendOsc, const bool sendCallback) noexcept
{
CARLA_SAFE_ASSERT_RETURN(sendOsc || sendCallback,); // never call this from RT
@@ -1151,22 +1143,11 @@ void CarlaPlugin::setParameterMidiChannel(const uint32_t parameterId, uint8_t ch

pData->param.data[parameterId].midiChannel = channel;

#ifndef BUILD_BRIDGE
if (sendOsc && pData->engine->isOscControlRegistered())
pData->engine->oscSend_control_set_parameter_midi_channel(pData->id, parameterId, channel);

if (sendCallback)
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED, pData->id, static_cast<int>(parameterId), channel, 0.0f, nullptr);

if (pData->hints & PLUGIN_IS_BRIDGE)
{} // TODO
#else
return;

// unused
(void)sendOsc;
(void)sendCallback;
#endif
}

void CarlaPlugin::setParameterMidiCC(const uint32_t parameterId, int16_t cc, const bool sendOsc, const bool sendCallback) noexcept
@@ -1177,23 +1158,13 @@ void CarlaPlugin::setParameterMidiCC(const uint32_t parameterId, int16_t cc, con

pData->param.data[parameterId].midiCC = cc;

#ifndef BUILD_BRIDGE
if (sendOsc && pData->engine->isOscControlRegistered())
pData->engine->oscSend_control_set_parameter_midi_cc(pData->id, parameterId, cc);

if (sendCallback)
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED, pData->id, static_cast<int>(parameterId), cc, 0.0f, nullptr);

if (pData->hints & PLUGIN_IS_BRIDGE)
{} // TODO
#else
return;

// unused
(void)sendOsc;
(void)sendCallback;
#endif
}
#endif // ! BUILD_BRIDGE

void CarlaPlugin::setCustomData(const char* const type, const char* const key, const char* const value, const bool sendGui)
{
@@ -1292,11 +1263,8 @@ void CarlaPlugin::setProgram(const int32_t index, const bool sendGui, const bool
}

#ifdef BUILD_BRIDGE
return;

// unused
(void)sendGui;
(void)sendOsc;
return; (void)sendGui; (void)sendOsc;
#endif
}

@@ -1335,11 +1303,8 @@ void CarlaPlugin::setMidiProgram(const int32_t index, const bool sendGui, const
}

#ifdef BUILD_BRIDGE
return;

// unused
(void)sendGui;
(void)sendOsc;
return; (void)sendGui; (void)sendOsc;
#endif
}

@@ -1491,7 +1456,7 @@ void CarlaPlugin::registerToOscClient() noexcept
getCopyright(bufCopyright);

#ifdef BUILD_BRIDGE
pData->engine->oscSend_bridge_plugin_info1(getCategory(), pData->hints, getUniqueId());
pData->engine->oscSend_bridge_plugin_info1(getCategory(), pData->hints, getOptionsAvailable(), pData->options, 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());
@@ -1532,12 +1497,11 @@ void CarlaPlugin::registerToOscClient() noexcept
const ParameterRanges& paramRanges(pData->param.ranges[i]);

#ifdef BUILD_BRIDGE
pData->engine->oscSend_bridge_parameter_data(i, paramData.rindex, paramData.type, paramData.hints, bufName, bufUnit);
pData->engine->oscSend_bridge_parameter_data1(i, paramData.rindex, paramData.type, paramData.hints, paramData.midiCC);
pData->engine->oscSend_bridge_parameter_data2(i, 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);
@@ -1763,7 +1727,6 @@ void CarlaPlugin::sendMidiSingleNote(const uint8_t channel, const uint8_t note,
if (sendCallback)
pData->engine->callback((velo > 0) ? ENGINE_CALLBACK_NOTE_ON : ENGINE_CALLBACK_NOTE_OFF, pData->id, channel, note, velo, nullptr);
}
#endif

void CarlaPlugin::sendMidiAllNotesOffToCallback()
{
@@ -1782,6 +1745,7 @@ void CarlaPlugin::sendMidiAllNotesOffToCallback()
pData->postRtEvents.appendRT(postEvent);
}
}
#endif

// -------------------------------------------------------------------
// Post-poned events


+ 6
- 2
source/backend/plugin/DssiPlugin.cpp View File

@@ -1171,7 +1171,9 @@ public:
// ----------------------------------------------------------------------------------------------------
// Event Input (System)

#ifndef BUILD_BRIDGE
bool allNotesOffSent = false;
#endif
const bool isSampleAccurate = (pData->options & PLUGIN_OPTION_FIXED_BUFFERS) == 0;

uint32_t numEvents = pData->event.portIn->getEventCount();
@@ -1274,7 +1276,6 @@ public:
break;
}
}
#endif

// Control plugin parameters
uint32_t k;
@@ -1311,6 +1312,7 @@ public:
// check if event is already handled
if (k != pData->param.count)
break;
#endif

if ((pData->options & PLUGIN_OPTION_SEND_CONTROL_CHANGES) != 0 && ctrlEvent.param <= 0x5F)
{
@@ -1373,11 +1375,13 @@ public:
case kEngineControlEventTypeAllNotesOff:
if (pData->options & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
{
#ifndef BUILD_BRIDGE
if (event.channel == pData->ctrlChannel && ! allNotesOffSent)
{
allNotesOffSent = true;
sendMidiAllNotesOffToCallback();
}
#endif

if (midiEventCount >= kPluginMaxMidiEvents)
continue;
@@ -1547,7 +1551,6 @@ public:
}
}
}
#endif

// --------------------------------------------------------------------------------------------------------
// Control Output
@@ -1574,6 +1577,7 @@ public:
}
}
} // End of Control Output
#endif
}

bool processSingle(float** const inBuffer, float** const outBuffer, const uint32_t frames, const uint32_t timeOffset, const ulong midiEventCount)


+ 7
- 29
source/backend/plugin/FluidSynthPlugin.cpp View File

@@ -674,8 +674,6 @@ public:
pData->param.data[j].hints = PARAMETER_IS_ENABLED /*| PARAMETER_IS_AUTOMABLE*/ | PARAMETER_IS_BOOLEAN;
pData->param.data[j].index = j;
pData->param.data[j].rindex = j;
pData->param.data[j].midiCC = -1;
pData->param.data[j].midiChannel = 0;
pData->param.ranges[j].min = 0.0f;
pData->param.ranges[j].max = 1.0f;
pData->param.ranges[j].def = 1.0f;
@@ -689,8 +687,6 @@ public:
pData->param.data[j].hints = PARAMETER_IS_ENABLED /*| PARAMETER_IS_AUTOMABLE*/;
pData->param.data[j].index = j;
pData->param.data[j].rindex = j;
pData->param.data[j].midiCC = -1;
pData->param.data[j].midiChannel = 0;
pData->param.ranges[j].min = 0.0f;
pData->param.ranges[j].max = 1.2f;
pData->param.ranges[j].def = FLUID_REVERB_DEFAULT_ROOMSIZE;
@@ -704,8 +700,6 @@ public:
pData->param.data[j].hints = PARAMETER_IS_ENABLED /*| PARAMETER_IS_AUTOMABLE*/;
pData->param.data[j].index = j;
pData->param.data[j].rindex = j;
pData->param.data[j].midiCC = -1;
pData->param.data[j].midiChannel = 0;
pData->param.ranges[j].min = 0.0f;
pData->param.ranges[j].max = 1.0f;
pData->param.ranges[j].def = FLUID_REVERB_DEFAULT_DAMP;
@@ -720,7 +714,6 @@ public:
pData->param.data[j].index = j;
pData->param.data[j].rindex = j;
pData->param.data[j].midiCC = MIDI_CONTROL_REVERB_SEND_LEVEL;
pData->param.data[j].midiChannel = 0;
pData->param.ranges[j].min = 0.0f;
pData->param.ranges[j].max = 1.0f;
pData->param.ranges[j].def = FLUID_REVERB_DEFAULT_LEVEL;
@@ -734,8 +727,6 @@ public:
pData->param.data[j].hints = PARAMETER_IS_ENABLED /*| PARAMETER_IS_AUTOMABLE*/;
pData->param.data[j].index = j;
pData->param.data[j].rindex = j;
pData->param.data[j].midiCC = -1;
pData->param.data[j].midiChannel = 0;
pData->param.ranges[j].min = 0.0f;
pData->param.ranges[j].max = 10.0f; // should be 100, but that sounds too much
pData->param.ranges[j].def = FLUID_REVERB_DEFAULT_WIDTH;
@@ -749,8 +740,6 @@ public:
pData->param.data[j].hints = PARAMETER_IS_ENABLED | PARAMETER_IS_BOOLEAN;
pData->param.data[j].index = j;
pData->param.data[j].rindex = j;
pData->param.data[j].midiCC = -1;
pData->param.data[j].midiChannel = 0;
pData->param.ranges[j].min = 0.0f;
pData->param.ranges[j].max = 1.0f;
pData->param.ranges[j].def = 1.0f;
@@ -764,8 +753,6 @@ public:
pData->param.data[j].hints = PARAMETER_IS_ENABLED | PARAMETER_IS_INTEGER;
pData->param.data[j].index = j;
pData->param.data[j].rindex = j;
pData->param.data[j].midiCC = -1;
pData->param.data[j].midiChannel = 0;
pData->param.ranges[j].min = 0.0f;
pData->param.ranges[j].max = 99.0f;
pData->param.ranges[j].def = FLUID_CHORUS_DEFAULT_N;
@@ -779,8 +766,6 @@ public:
pData->param.data[j].hints = PARAMETER_IS_ENABLED;
pData->param.data[j].index = j;
pData->param.data[j].rindex = j;
pData->param.data[j].midiCC = 0; //MIDI_CONTROL_CHORUS_SEND_LEVEL;
pData->param.data[j].midiChannel = 0;
pData->param.ranges[j].min = 0.0f;
pData->param.ranges[j].max = 10.0f;
pData->param.ranges[j].def = FLUID_CHORUS_DEFAULT_LEVEL;
@@ -794,8 +779,6 @@ public:
pData->param.data[j].hints = PARAMETER_IS_ENABLED;
pData->param.data[j].index = j;
pData->param.data[j].rindex = j;
pData->param.data[j].midiCC = -1;
pData->param.data[j].midiChannel = 0;
pData->param.ranges[j].min = 0.29f;
pData->param.ranges[j].max = 5.0f;
pData->param.ranges[j].def = FLUID_CHORUS_DEFAULT_SPEED;
@@ -809,8 +792,6 @@ public:
pData->param.data[j].hints = PARAMETER_IS_ENABLED;
pData->param.data[j].index = j;
pData->param.data[j].rindex = j;
pData->param.data[j].midiCC = -1;
pData->param.data[j].midiChannel = 0;
pData->param.ranges[j].min = 0.0f;
pData->param.ranges[j].max = float(2048.0 * 1000.0 / pData->engine->getSampleRate()); // FIXME?
pData->param.ranges[j].def = FLUID_CHORUS_DEFAULT_DEPTH;
@@ -824,8 +805,6 @@ public:
pData->param.data[j].hints = PARAMETER_IS_ENABLED | PARAMETER_IS_INTEGER | PARAMETER_USES_SCALEPOINTS;
pData->param.data[j].index = j;
pData->param.data[j].rindex = j;
pData->param.data[j].midiCC = -1;
pData->param.data[j].midiChannel = 0;
pData->param.ranges[j].min = FLUID_CHORUS_MOD_SINE;
pData->param.ranges[j].max = FLUID_CHORUS_MOD_TRIANGLE;
pData->param.ranges[j].def = FLUID_CHORUS_DEFAULT_TYPE;
@@ -839,8 +818,6 @@ public:
pData->param.data[j].hints = PARAMETER_IS_ENABLED | PARAMETER_IS_INTEGER;
pData->param.data[j].index = j;
pData->param.data[j].rindex = j;
pData->param.data[j].midiCC = -1;
pData->param.data[j].midiChannel = 0;
pData->param.ranges[j].min = 1.0f;
pData->param.ranges[j].max = 512.0f; // max theoric is 65535
pData->param.ranges[j].def = (float)fluid_synth_get_polyphony(fSynth);
@@ -854,8 +831,6 @@ public:
pData->param.data[j].hints = PARAMETER_IS_ENABLED | PARAMETER_IS_INTEGER | PARAMETER_USES_SCALEPOINTS;
pData->param.data[j].index = j;
pData->param.data[j].rindex = j;
pData->param.data[j].midiCC = -1;
pData->param.data[j].midiChannel = 0;
pData->param.ranges[j].min = FLUID_INTERP_NONE;
pData->param.ranges[j].max = FLUID_INTERP_HIGHEST;
pData->param.ranges[j].def = FLUID_INTERP_DEFAULT;
@@ -869,8 +844,6 @@ public:
pData->param.data[j].hints = PARAMETER_IS_ENABLED | PARAMETER_IS_AUTOMABLE | PARAMETER_IS_INTEGER;
pData->param.data[j].index = j;
pData->param.data[j].rindex = j;
pData->param.data[j].midiCC = -1;
pData->param.data[j].midiChannel = 0;
pData->param.ranges[j].min = 0.0f;
pData->param.ranges[j].max = 65535.0f;
pData->param.ranges[j].def = 0.0f;
@@ -1097,8 +1070,9 @@ public:
// ----------------------------------------------------------------------------------------------------
// Event Input (System)

#ifndef BUILD_BRIDGE
bool allNotesOffSent = false;
#endif
uint32_t time, nEvents = pData->event.portIn->getEventCount();
uint32_t timeOffset = 0;

@@ -1191,7 +1165,6 @@ public:
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_RIGHT, 0, right);
}
}
#endif

// Control plugin parameters
for (uint32_t k=0; k < pData->param.count; ++k)
@@ -1222,6 +1195,7 @@ public:
setParameterValue(k, value, false, false, false);
pData->postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(k), 0, value);
}
#endif

if ((pData->options & PLUGIN_OPTION_SEND_CONTROL_CHANGES) != 0 && ctrlEvent.param <= 0x5F)
{
@@ -1272,11 +1246,13 @@ public:
case kEngineControlEventTypeAllNotesOff:
if (pData->options & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
{
#ifndef BUILD_BRIDGE
if (event.channel == pData->ctrlChannel && ! allNotesOffSent)
{
allNotesOffSent = true;
sendMidiAllNotesOffToCallback();
}
#endif

#ifdef FLUIDSYNTH_VERSION_NEW_API
fluid_synth_all_notes_off(fSynth, event.channel);
@@ -1359,6 +1335,7 @@ public:

} // End of Event Input and Processing

#ifndef BUILD_BRIDGE
// --------------------------------------------------------------------------------------------------------
// Control Output

@@ -1374,6 +1351,7 @@ public:
}

} // End of Control Output
#endif
}

bool processSingle(float** const outBuffer, const uint32_t frames, const uint32_t timeOffset)


+ 7
- 4
source/backend/plugin/JucePlugin.cpp View File

@@ -630,9 +630,10 @@ public:
// ----------------------------------------------------------------------------------------------------
// Event Input (System)

bool allNotesOffSent = false;

uint32_t numEvents = pData->event.portIn->getEventCount();
#ifndef BUILD_BRIDGE
bool allNotesOffSent = false;
#endif
uint32_t numEvents = pData->event.portIn->getEventCount();
uint32_t nextBankId;

if (pData->midiprog.current >= 0 && pData->midiprog.count > 0)
@@ -711,7 +712,6 @@ public:
break;
}
}
#endif

// Control plugin parameters
uint32_t k;
@@ -748,6 +748,7 @@ public:
// check if event is already handled
if (k != pData->param.count)
break;
#endif

if ((pData->options & PLUGIN_OPTION_SEND_CONTROL_CHANGES) != 0 && ctrlEvent.param <= 0x5F)
{
@@ -799,11 +800,13 @@ public:
case kEngineControlEventTypeAllNotesOff:
if (pData->options & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
{
#ifndef BUILD_BRIDGE
if (event.channel == pData->ctrlChannel && ! allNotesOffSent)
{
allNotesOffSent = true;
sendMidiAllNotesOffToCallback();
}
#endif

uint8_t midiData[3];
midiData[0] = static_cast<uint8_t>(MIDI_STATUS_CONTROL_CHANGE + i);


+ 2
- 3
source/backend/plugin/LadspaPlugin.cpp View File

@@ -1064,7 +1064,6 @@ public:
break;
}
}
#endif

// Control plugin parameters
for (uint32_t k=0; k < pData->param.count; ++k)
@@ -1096,7 +1095,7 @@ public:
pData->postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(k), 0, value);
break;
}
#endif
break;
} // case kEngineControlEventTypeParameter

@@ -1159,7 +1158,6 @@ public:
}
}
}
#endif

// --------------------------------------------------------------------------------------------------------
// Control Output
@@ -1186,6 +1184,7 @@ public:
}
}
} // End of Control Output
#endif
}

bool processSingle(float** const inBuffer, float** const outBuffer, const uint32_t frames, const uint32_t timeOffset)


+ 5
- 1
source/backend/plugin/LinuxSamplerPlugin.cpp View File

@@ -795,7 +795,9 @@ public:
// ----------------------------------------------------------------------------------------------------
// Event Input (System)

#ifndef BUILD_BRIDGE
bool allNotesOffSent = false;
#endif
bool sampleAccurate = (pData->options & PLUGIN_OPTION_FIXED_BUFFERS) == 0;

uint32_t nEvents = pData->event.portIn->getEventCount();
@@ -892,7 +894,6 @@ public:
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_RIGHT, 0, right);
}
}
#endif

// Control plugin parameters
for (uint32_t k=0; k < pData->param.count; ++k)
@@ -923,6 +924,7 @@ public:
setParameterValue(k, value, false, false, false);
pData->postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(k), 0, value);
}
#endif

if ((pData->options & PLUGIN_OPTION_SEND_CONTROL_CHANGES) != 0 && ctrlEvent.param <= 0x5F)
{
@@ -982,11 +984,13 @@ public:
case kEngineControlEventTypeAllNotesOff:
if (pData->options & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
{
#ifndef BUILD_BRIDGE
if (event.channel == pData->ctrlChannel && ! allNotesOffSent)
{
allNotesOffSent = true;
sendMidiAllNotesOffToCallback();
}
#endif

fMidiInputPort->DispatchControlChange(MIDI_CONTROL_ALL_NOTES_OFF, 0, event.channel, static_cast<int32_t>(sampleAccurate ? startTime : event.time));
}


+ 8
- 2
source/backend/plugin/Lv2Plugin.cpp View File

@@ -2002,7 +2002,7 @@ public:
if (LV2_IS_PORT_MIDI_MAP_CC(portMidiMap.Type))
{
if (portMidiMap.Number < 0x5F && ! MIDI_IS_CONTROL_BANK_SELECT(portMidiMap.Number))
pData->param.data[j].midiCC = int16_t(portMidiMap.Number);
pData->param.data[j].midiCC = static_cast<int16_t>(portMidiMap.Number);
}
}
else if (LV2_IS_PORT_OUTPUT(portTypes))
@@ -2811,7 +2811,9 @@ public:
// ----------------------------------------------------------------------------------------------------
// Event Input (System)

#ifndef BUILD_BRIDGE
bool allNotesOffSent = false;
#endif
bool isSampleAccurate = (pData->options & PLUGIN_OPTION_FIXED_BUFFERS) == 0;

uint32_t numEvents = (fEventsIn.ctrl->port != nullptr) ? fEventsIn.ctrl->port->getEventCount() : 0;
@@ -2933,7 +2935,6 @@ public:
break;
}
}
#endif

// Control plugin parameters
uint32_t k;
@@ -2970,6 +2971,7 @@ public:
// check if event is already handled
if (k != pData->param.count)
break;
#endif

if ((pData->options & PLUGIN_OPTION_SEND_CONTROL_CHANGES) != 0 && ctrlEvent.param <= 0x5F)
{
@@ -3039,11 +3041,13 @@ public:
case kEngineControlEventTypeAllNotesOff:
if (pData->options & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
{
#ifndef BUILD_BRIDGE
if (event.channel == pData->ctrlChannel && ! allNotesOffSent)
{
allNotesOffSent = true;
sendMidiAllNotesOffToCallback();
}
#endif

const uint32_t mtime(isSampleAccurate ? startTime : event.time);

@@ -3246,6 +3250,7 @@ public:
}
}

#ifndef BUILD_BRIDGE
// --------------------------------------------------------------------------------------------------------
// Control Output

@@ -3271,6 +3276,7 @@ public:
}
}
} // End of Control Output
#endif

// --------------------------------------------------------------------------------------------------------
// Final work


+ 10
- 9
source/backend/plugin/NativePlugin.cpp View File

@@ -1388,7 +1388,9 @@ public:
// ----------------------------------------------------------------------------------------------------
// Event Input (System)

#ifndef BUILD_BRIDGE
bool allNotesOffSent = false;
#endif
bool sampleAccurate = (pData->options & PLUGIN_OPTION_FIXED_BUFFERS) == 0;

uint32_t time, nEvents = pData->event.portIn->getEventCount();
@@ -1438,8 +1440,7 @@ public:
case kEngineEventTypeNull:
break;

case kEngineEventTypeControl:
{
case kEngineEventTypeControl: {
const EngineControlEvent& ctrlEvent = event.ctrl;

switch (ctrlEvent.type)
@@ -1447,8 +1448,7 @@ public:
case kEngineControlEventTypeNull:
break;

case kEngineControlEventTypeParameter:
{
case kEngineControlEventTypeParameter: {
#ifndef BUILD_BRIDGE
// Control backend stuff
if (event.channel == pData->ctrlChannel)
@@ -1496,7 +1496,6 @@ public:
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_RIGHT, 0, right);
}
}
#endif

// Control plugin parameters
for (uint32_t k=0; k < pData->param.count; ++k)
@@ -1527,6 +1526,7 @@ public:
setParameterValue(k, value, false, false, false);
pData->postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(k), 0, value);
}
#endif

if ((pData->options & PLUGIN_OPTION_SEND_CONTROL_CHANGES) != 0 && ctrlEvent.param <= 0x5F)
{
@@ -1542,7 +1542,6 @@ public:

fMidiEventCount += 1;
}

break;
}

@@ -1596,11 +1595,13 @@ public:
case kEngineControlEventTypeAllNotesOff:
if (pData->options & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
{
#ifndef BUILD_BRIDGE
if (event.channel == pData->ctrlChannel && ! allNotesOffSent)
{
allNotesOffSent = true;
sendMidiAllNotesOffToCallback();
}
#endif

if (fMidiEventCount >= kPluginMaxMidiEvents*2)
continue;
@@ -1616,12 +1617,10 @@ public:
}
break;
}

break;
}

case kEngineEventTypeMidi:
{
case kEngineEventTypeMidi: {
if (fMidiEventCount >= kPluginMaxMidiEvents*2)
continue;

@@ -1685,6 +1684,7 @@ public:

if (fMidiOut.count > 0 || pData->event.portOut != nullptr)
{
#ifndef BUILD_BRIDGE
float value, curValue;

for (uint32_t k=0; k < pData->param.count; ++k)
@@ -1701,6 +1701,7 @@ public:
pData->event.portOut->writeControlEvent(0, pData->param.data[k].midiChannel, kEngineControlEventTypeParameter, static_cast<uint16_t>(pData->param.data[k].midiCC), value);
}
}
#endif

// reverse lookup MIDI events
for (uint32_t k = (kPluginMaxMidiEvents*2)-1; k >= fMidiEventCount; --k)


+ 5
- 1
source/backend/plugin/VstPlugin.cpp View File

@@ -1205,7 +1205,9 @@ public:
// ----------------------------------------------------------------------------------------------------
// Event Input (System)

#ifndef BUILD_BRIDGE
bool allNotesOffSent = false;
#endif
bool isSampleAccurate = (pData->options & PLUGIN_OPTION_FIXED_BUFFERS) == 0;

uint32_t numEvents = pData->event.portIn->getEventCount();
@@ -1302,7 +1304,6 @@ public:
break;
}
}
#endif

// Control plugin parameters
uint32_t k;
@@ -1339,6 +1340,7 @@ public:
// check if event is already handled
if (k != pData->param.count)
break;
#endif

if ((pData->options & PLUGIN_OPTION_SEND_CONTROL_CHANGES) != 0 && ctrlEvent.param <= 0x5F)
{
@@ -1396,11 +1398,13 @@ public:
case kEngineControlEventTypeAllNotesOff:
if (pData->options & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
{
#ifndef BUILD_BRIDGE
if (event.channel == pData->ctrlChannel && ! allNotesOffSent)
{
allNotesOffSent = true;
sendMidiAllNotesOffToCallback();
}
#endif

if (fMidiEventCount >= kPluginMaxMidiEvents*2)
continue;


+ 0
- 5
source/bridges-plugin/CarlaBridgePlugin.cpp View File

@@ -491,14 +491,9 @@ int main(int argc, char* argv[])
{
bridge.sendOscUpdate();
bridge.sendOscBridgeUpdate();

// FIXME
carla_set_active(0, true);
}
else
{
carla_set_active(0, true);

if (const CarlaPluginInfo* const pluginInfo = carla_get_plugin_info(0))
{
if (pluginInfo->hints & CarlaBackend::PLUGIN_HAS_CUSTOM_UI)


+ 1
- 1
source/bridges-ui/CarlaBridgeClient.cpp View File

@@ -188,7 +188,7 @@ void CarlaBridgeClient::sendOscExiting() const
}

#ifdef BRIDGE_LV2
void CarlaBridgeClient::sendOscLv2AtomTransfer(const int32_t portIndex, const char* const atomBuf) const
void CarlaBridgeClient::sendOscLv2AtomTransfer(const uint32_t portIndex, const char* const atomBuf) const
{
carla_debug("CarlaBridgeClient::sendOscLv2TransferAtom(%i, \"%s\")", portIndex, atomBuf);



+ 1
- 1
source/bridges-ui/CarlaBridgeClient.hpp View File

@@ -83,7 +83,7 @@ protected:
void sendOscExiting() const;

#ifdef BRIDGE_LV2
void sendOscLv2AtomTransfer(const int32_t portIndex, const char* const atomBuf) const;
void sendOscLv2AtomTransfer(const uint32_t portIndex, const char* const atomBuf) const;
void sendOscLv2UridMap(const uint32_t urid, const char* const uri) const;
#endif



+ 9
- 9
source/carla_backend.py View File

@@ -527,22 +527,22 @@ ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED = 7
# @param value2 New MIDI channel
ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED = 8

# A plugin option has changed.
# @param pluginId Plugin Id
# @param value1 Option
# @param value2 New on/off state (1 for on, 0 for off)
# @see PluginOptions
ENGINE_CALLBACK_OPTION_CHANGED = 9

# The current program of a plugin has changed.
# @param pluginId Plugin Id
# @param value1 New program index
ENGINE_CALLBACK_PROGRAM_CHANGED = 9
ENGINE_CALLBACK_PROGRAM_CHANGED = 10

# The current MIDI program of a plugin has changed.
# @param pluginId Plugin Id
# @param value1 New MIDI program index
ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED = 10

# A plugin option has changed.
# @param pluginId Plugin Id
# @param value1 Option
# @param value2 New on/off state (1 for on, 0 for off)
# @see PluginOptions
ENGINE_CALLBACK_OPTION_CHANGED = 11
ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED = 11

# A plugin's custom UI state has changed.
# @param pluginId Plugin Id


+ 8
- 9
source/modules/jackbridge/JackBridge.hpp View File

@@ -1,6 +1,6 @@
/*
* JackBridge
* Copyright (C) 2013 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2013-2014 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
@@ -378,13 +378,12 @@ CARLA_EXPORT bool jackbridge_set_property_change_callback(jack_client_t* client,
CARLA_EXPORT bool jackbridge_sem_init(void* sem) noexcept;
CARLA_EXPORT bool jackbridge_sem_destroy(void* sem) noexcept;
CARLA_EXPORT bool jackbridge_sem_post(void* sem) noexcept;
CARLA_EXPORT bool jackbridge_sem_timedwait(void* sem, int secs);
CARLA_EXPORT bool jackbridge_sem_wait(void* sem);

CARLA_EXPORT bool jackbridge_shm_is_valid(const void* shm);
CARLA_EXPORT void jackbridge_shm_init(void* shm);
CARLA_EXPORT void jackbridge_shm_attach(void* shm, const char* name);
CARLA_EXPORT void jackbridge_shm_close(void* shm);
CARLA_EXPORT void* jackbridge_shm_map(void* shm, size_t size);
CARLA_EXPORT bool jackbridge_sem_timedwait(void* sem, int secs) noexcept;

CARLA_EXPORT bool jackbridge_shm_is_valid(const void* shm) noexcept;
CARLA_EXPORT void jackbridge_shm_init(void* shm) noexcept;
CARLA_EXPORT void jackbridge_shm_attach(void* shm, const char* name) noexcept;
CARLA_EXPORT void jackbridge_shm_close(void* shm) noexcept;
CARLA_EXPORT void* jackbridge_shm_map(void* shm, size_t size) noexcept;

#endif // JACKBRIDGE_HPP_INCLUDED

+ 1
- 1
source/modules/jackbridge/JackBridge1.cpp View File

@@ -1,6 +1,6 @@
/*
* JackBridge (Part 1, JACK functions)
* Copyright (C) 2013 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2013-2014 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this


+ 31
- 42
source/modules/jackbridge/JackBridge2.cpp View File

@@ -1,6 +1,6 @@
/*
* JackBridge (Part 2, Semaphore functions)
* Copyright (C) 2013 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2013-2014 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
@@ -24,13 +24,13 @@
CARLA_EXPORT bool jackbridge_sem_init(void* sem) noexcept;
CARLA_EXPORT bool jackbridge_sem_destroy(void* sem) noexcept;
CARLA_EXPORT bool jackbridge_sem_post(void* sem) noexcept;
CARLA_EXPORT bool jackbridge_sem_timedwait(void* sem, int secs);
CARLA_EXPORT bool jackbridge_sem_timedwait(void* sem, int secs) noexcept;

CARLA_EXPORT bool jackbridge_shm_is_valid(void* shm);
CARLA_EXPORT void jackbridge_shm_init(void* shm);
CARLA_EXPORT void jackbridge_shm_attach(void* shm, const char* name);
CARLA_EXPORT void jackbridge_shm_close(void* shm);
CARLA_EXPORT void* jackbridge_shm_map(void* shm, size_t size);
CARLA_EXPORT bool jackbridge_shm_is_valid(const void* shm) noexcept;
CARLA_EXPORT void jackbridge_shm_init(void* shm) noexcept;
CARLA_EXPORT void jackbridge_shm_attach(void* shm, const char* name) noexcept;
CARLA_EXPORT void jackbridge_shm_close(void* shm) noexcept;
CARLA_EXPORT void* jackbridge_shm_map(void* shm, size_t size) noexcept;
#endif

// -----------------------------------------------------------------------------
@@ -51,34 +51,29 @@ bool jackbridge_sem_post(void*) noexcept
return false;
}

bool jackbridge_sem_timedwait(void*, int)
bool jackbridge_sem_timedwait(void*, int) noexcept
{
return false;
}

bool jackbridge_sem_wait(void*)
bool jackbridge_shm_is_valid(const void*) noexcept
{
return false;
}

bool jackbridge_shm_is_valid(const void*)
void jackbridge_shm_init(void*) noexcept
{
return false;
}

void jackbridge_shm_init(void*)
void jackbridge_shm_attach(void*, const char*) noexcept
{
}

void jackbridge_shm_attach(void*, const char*)
void jackbridge_shm_close(void*) noexcept
{
}

void jackbridge_shm_close(void*)
{
}

void* jackbridge_shm_map(void*, size_t)
void* jackbridge_shm_map(void*, size_t) noexcept
{
return nullptr;
}
@@ -104,11 +99,13 @@ bool jackbridge_sem_post(void* sem) noexcept
return (sem_post((sem_t*)sem) == 0);
}

bool jackbridge_sem_timedwait(void* sem, int secs)
bool jackbridge_sem_timedwait(void* sem, int secs) noexcept
{
#ifdef CARLA_OS_MAC
alarm(secs);
return (sem_wait((sem_t*)sem) == 0);
try {
return (sem_wait((sem_t*)sem) == 0);
} CARLA_SAFE_EXCEPTION_RETURN("sem_wait", false);
#else
timespec timeout;

@@ -120,45 +117,37 @@ bool jackbridge_sem_timedwait(void* sem, int secs)
# else
clock_gettime(CLOCK_REALTIME, &timeout);
# endif

timeout.tv_sec += secs;
return (sem_timedwait((sem_t*)sem, &timeout) == 0);
#endif
}

bool jackbridge_sem_wait(void* sem)
{
return (sem_wait((sem_t*)sem) == 0);
try {
return (sem_timedwait((sem_t*)sem, &timeout) == 0);
} CARLA_SAFE_EXCEPTION_RETURN("sem_timedwait", false);
#endif
}

bool jackbridge_shm_is_valid(const void* shm)
bool jackbridge_shm_is_valid(const void* shm) noexcept
{
const shm_t* t = (const shm_t*)shm;
return carla_is_shm_valid(*t);
return carla_is_shm_valid(*(const shm_t*)shm);
}

void jackbridge_shm_init(void* shm)
void jackbridge_shm_init(void* shm) noexcept
{
shm_t* t = (shm_t*)shm;
carla_shm_init(*t);
carla_shm_init(*(shm_t*)shm);
}

void jackbridge_shm_attach(void* shm, const char* name)
void jackbridge_shm_attach(void* shm, const char* name) noexcept
{
shm_t* t = (shm_t*)shm;
*t = carla_shm_attach(name);
*(shm_t*)shm = carla_shm_attach(name);
}

void jackbridge_shm_close(void* shm)
void jackbridge_shm_close(void* shm) noexcept
{
shm_t* t = (shm_t*)shm;
carla_shm_close(*t);
carla_shm_close(*(shm_t*)shm);
}

void* jackbridge_shm_map(void* shm, size_t size)
void* jackbridge_shm_map(void* shm, size_t size) noexcept
{
shm_t* t = (shm_t*)shm;
return carla_shm_map(*t, size);
return carla_shm_map(*(shm_t*)shm, size);
}

#endif // ! JACKBRIDGE_DUMMY


+ 8
- 2
source/utils/CarlaBackendUtils.hpp View File

@@ -168,6 +168,7 @@ const char* InternalParameterIndex2Str(const InternalParameterIndex index) noexc
{
case PARAMETER_NULL:
return "PARAMETER_NULL";
#ifndef BUILD_BRIDGE
case PARAMETER_ACTIVE:
return "PARAMETER_ACTIVE";
case PARAMETER_DRYWET:
@@ -182,6 +183,7 @@ const char* InternalParameterIndex2Str(const InternalParameterIndex index) noexc
return "PARAMETER_PANNING";
case PARAMETER_CTRL_CHANNEL:
return "PARAMETER_CTRL_CHANNEL";
#endif
case PARAMETER_MAX:
return "PARAMETER_MAX";
}
@@ -209,16 +211,18 @@ const char* EngineCallbackOpcode2Str(const EngineCallbackOpcode opcode) noexcept
return "ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED";
case ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED:
return "ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED";
#ifndef BUILD_BRIDGE
case ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED:
return "ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED";
case ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED:
return "ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED";
case ENGINE_CALLBACK_OPTION_CHANGED:
return "ENGINE_CALLBACK_OPTION_CHANGED";
#endif
case ENGINE_CALLBACK_PROGRAM_CHANGED:
return "ENGINE_CALLBACK_PROGRAM_CHANGED";
case ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED:
return "ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED";
case ENGINE_CALLBACK_OPTION_CHANGED:
return "ENGINE_CALLBACK_OPTION_CHANGED";
case ENGINE_CALLBACK_UI_STATE_CHANGED:
return "ENGINE_CALLBACK_UI_STATE_CHANGED";
case ENGINE_CALLBACK_NOTE_ON:
@@ -235,6 +239,7 @@ const char* EngineCallbackOpcode2Str(const EngineCallbackOpcode opcode) noexcept
return "ENGINE_CALLBACK_RELOAD_PROGRAMS";
case ENGINE_CALLBACK_RELOAD_ALL:
return "ENGINE_CALLBACK_RELOAD_ALL";
#ifndef BUILD_BRIDGE
case ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED:
return "ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED";
case ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED:
@@ -253,6 +258,7 @@ const char* EngineCallbackOpcode2Str(const EngineCallbackOpcode opcode) noexcept
return "ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED";
case ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED:
return "ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED";
#endif
case ENGINE_CALLBACK_ENGINE_STARTED:
return "ENGINE_CALLBACK_ENGINE_STARTED";
case ENGINE_CALLBACK_ENGINE_STOPPED:


+ 25
- 35
source/utils/CarlaBridgeUtils.hpp View File

@@ -26,28 +26,27 @@
enum PluginBridgeOscInfoType {
kPluginBridgeOscNull = 0,
kPluginBridgeOscPong,
kPluginBridgeOscPluginInfo1, // uuh => category, hints, uniqueId
kPluginBridgeOscPluginInfo2, // ssss => realName, label, maker, copyright
kPluginBridgeOscAudioCount, // uu => ins, outs
kPluginBridgeOscMidiCount, // uu => ins, outs
kPluginBridgeOscParameterCount, // uu => ins, outs
kPluginBridgeOscProgramCount, // u => count
kPluginBridgeOscMidiProgramCount, // u => count
kPluginBridgeOscParameterData, // uiuuss => index, rindex, type, hints, name, unit
kPluginBridgeOscParameterRanges1, // ufff => index, def, min, max
kPluginBridgeOscParameterRanges2, // ufff => index, step, stepSmall, stepLarge
kPluginBridgeOscParameterMidiCC, // ui => index, cc
kPluginBridgeOscParameterMidiChannel, // uu => index, channel
kPluginBridgeOscParameterValue, // uf => index, value
kPluginBridgeOscDefaultValue, // uf => index, value
kPluginBridgeOscCurrentProgram, // i => index
kPluginBridgeOscCurrentMidiProgram, // i => index
kPluginBridgeOscProgramName, // us => index, name
kPluginBridgeOscMidiProgramData, // uuus => index, bank, program, name
kPluginBridgeOscConfigure, // ss => key, value
kPluginBridgeOscSetCustomData, // sss => type, key, value
kPluginBridgeOscSetChunkDataFile, // s => chunkFile
kPluginBridgeOscLatency, // u => value
kPluginBridgeOscPluginInfo1, // uuuuh => category, hints, optionsAvailable, optionsEnabled, uniqueId
kPluginBridgeOscPluginInfo2, // ssss => realName, label, maker, copyright
kPluginBridgeOscAudioCount, // uu => ins, outs
kPluginBridgeOscMidiCount, // uu => ins, outs
kPluginBridgeOscParameterCount, // uu => ins, outs
kPluginBridgeOscProgramCount, // u => count
kPluginBridgeOscMidiProgramCount, // u => count
kPluginBridgeOscParameterData1, // uiuui => index, rindex, type, hints, cc
kPluginBridgeOscParameterData2, // uss => index, name, unit
kPluginBridgeOscParameterRanges1, // ufff => index, def, min, max
kPluginBridgeOscParameterRanges2, // ufff => index, step, stepSmall, stepLarge
kPluginBridgeOscParameterValue, // uf => index, value
kPluginBridgeOscDefaultValue, // uf => index, value
kPluginBridgeOscCurrentProgram, // i => index
kPluginBridgeOscCurrentMidiProgram, // i => index
kPluginBridgeOscProgramName, // us => index, name
kPluginBridgeOscMidiProgramData, // uuus => index, bank, program, name
kPluginBridgeOscConfigure, // ss => key, value
kPluginBridgeOscSetCustomData, // sss => type, key, value
kPluginBridgeOscSetChunkDataFile, // s => chunkFile
kPluginBridgeOscLatency, // u => value
kPluginBridgeOscReady,
kPluginBridgeOscError
};
@@ -74,8 +73,6 @@ enum PluginBridgeNonRtOpcode {
kPluginBridgeNonRtSetOffline,
kPluginBridgeNonRtSetOnline,
kPluginBridgeNonRtSetParameterValue, // uint, float
kPluginBridgeNonRtSetParameterMidiChannel, // uint, byte
kPluginBridgeNonRtSetParameterMidiCC, // uint, short
kPluginBridgeNonRtSetProgram, // int
kPluginBridgeNonRtSetMidiProgram, // int
kPluginBridgeNonRtSetCustomData, // uint/size, str, uint/size, str, uint/size, str
@@ -127,7 +124,6 @@ struct BridgeRtData {
};

struct BridgeNonRtData {
//BridgeSemaphore sem;
BigStackBuffer ringBuffer;
};

@@ -156,16 +152,14 @@ const char* PluginBridgeOscInfoType2str(const PluginBridgeOscInfoType type) noex
return "kPluginBridgeOscProgramCount";
case kPluginBridgeOscMidiProgramCount:
return "kPluginBridgeOscMidiProgramCount";
case kPluginBridgeOscParameterData:
return "kPluginBridgeOscParameterData";
case kPluginBridgeOscParameterData1:
return "kPluginBridgeOscParameterData1";
case kPluginBridgeOscParameterData2:
return "kPluginBridgeOscParameterData2";
case kPluginBridgeOscParameterRanges1:
return "kPluginBridgeOscParameterRanges1";
case kPluginBridgeOscParameterRanges2:
return "kPluginBridgeOscParameterRanges2";
case kPluginBridgeOscParameterMidiCC:
return "kPluginBridgeOscParameterMidiCC";
case kPluginBridgeOscParameterMidiChannel:
return "kPluginBridgeOscParameterMidiChannel";
case kPluginBridgeOscParameterValue:
return "kPluginBridgeOscParameterValue";
case kPluginBridgeOscDefaultValue:
@@ -244,10 +238,6 @@ const char* PluginBridgeNonRtOpcode2str(const PluginBridgeNonRtOpcode opcode) no
return "kPluginBridgeNonRtSetOnline";
case kPluginBridgeNonRtSetParameterValue:
return "kPluginBridgeNonRtSetParameterValue";
case kPluginBridgeNonRtSetParameterMidiChannel:
return "kPluginBridgeNonRtSetParameterMidiChannel";
case kPluginBridgeNonRtSetParameterMidiCC:
return "kPluginBridgeNonRtSetParameterMidiCC";
case kPluginBridgeNonRtSetProgram:
return "kPluginBridgeNonRtSetProgram";
case kPluginBridgeNonRtSetMidiProgram:


+ 2
- 0
source/utils/CarlaEngineUtils.hpp View File

@@ -165,6 +165,7 @@ void fillJuceMidiBufferFromEngineEvents(juce::MidiBuffer& midiBuffer, const Engi
if (engineEvent.type == kEngineEventTypeNull)
break;

#ifndef BUILD_BRIDGE
else if (engineEvent.type == kEngineEventTypeControl)
{
const EngineControlEvent& ctrlEvent(engineEvent.ctrl);
@@ -172,6 +173,7 @@ void fillJuceMidiBufferFromEngineEvents(juce::MidiBuffer& midiBuffer, const Engi
ctrlEvent.convertToMidiData(engineEvent.channel, size, mdata);
mdataPtr = mdata;
}
#endif
else if (engineEvent.type == kEngineEventTypeMidi)
{
const EngineMidiEvent& midiEvent(engineEvent.midi);


+ 15
- 16
source/utils/CarlaShmUtils.hpp View File

@@ -41,30 +41,30 @@ static const shm_t gNullCarlaShm = { -1, nullptr };
#endif

/*
* Initialize a shared memory object to an invalid state.
* Check if a shared memory object is valid.
*/
static inline
void carla_shm_init(shm_t& shm) noexcept
bool carla_is_shm_valid(const shm_t& shm) noexcept
{
#ifdef CARLA_OS_WIN
shm.shm = nullptr;
shm.map = nullptr;
return (shm.shm != nullptr && shm.shm != INVALID_HANDLE_VALUE);
#else
shm.fd = -1;
shm.filename = nullptr;
return (shm.fd >= 0);
#endif
}

/*
* Check if a shared memory object is valid.
* Initialize a shared memory object to an invalid state.
*/
static inline
bool carla_is_shm_valid(const shm_t& shm) noexcept
void carla_shm_init(shm_t& shm) noexcept
{
#ifdef CARLA_OS_WIN
return (shm.shm != nullptr && shm.shm != INVALID_HANDLE_VALUE);
shm.shm = nullptr;
shm.map = nullptr;
#else
return (shm.fd >= 0);
shm.fd = -1;
shm.filename = nullptr;
#endif
}

@@ -85,7 +85,7 @@ shm_t carla_shm_create(const char* const filename) noexcept
ret.map = nullptr;
#else
ret.fd = ::shm_open(filename, O_CREAT|O_EXCL|O_RDWR, 0600);
ret.filename = (ret.fd >= 0) ? carla_strdup(filename) : nullptr;
ret.filename = (ret.fd >= 0) ? carla_strdup_safe(filename) : nullptr;
#endif
}
catch(...) {
@@ -155,7 +155,7 @@ void carla_shm_close(shm_t& shm) noexcept
* @note One shared memory object can only have one mapping at a time.
*/
static inline
void* carla_shm_map(shm_t& shm, const size_t size) noexcept
void* carla_shm_map(shm_t& shm, const std::size_t size) noexcept
{
CARLA_SAFE_ASSERT_RETURN(carla_is_shm_valid(shm), nullptr);
CARLA_SAFE_ASSERT_RETURN(size > 0, nullptr);
@@ -192,7 +192,7 @@ void* carla_shm_map(shm_t& shm, const size_t size) noexcept
* Unmap a shared memory object address.
*/
static inline
void carla_shm_unmap(shm_t& shm, void* const ptr, const size_t size) noexcept
void carla_shm_unmap(shm_t& shm, void* const ptr, const std::size_t size) noexcept
{
CARLA_SAFE_ASSERT_RETURN(carla_is_shm_valid(shm),);
CARLA_SAFE_ASSERT_RETURN(ptr != nullptr,);
@@ -214,9 +214,8 @@ void carla_shm_unmap(shm_t& shm, void* const ptr, const size_t size) noexcept
#endif
} CARLA_SAFE_EXCEPTION("carla_shm_unmap");

return; // unused depending on platform
(void)shm;
(void)size;
// unused depending on platform
return; (void)shm; (void)size;
}

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


+ 19
- 0
source/utils/CarlaStateUtils.cpp View File

@@ -80,9 +80,13 @@ StateParameter::StateParameter() noexcept
index(-1),
name(nullptr),
symbol(nullptr),
#ifndef BUILD_BRIDGE
value(0.0f),
midiChannel(0),
midiCC(-1) {}
#else
value(0.0f) {}
#endif

StateParameter::~StateParameter() noexcept
{
@@ -134,6 +138,7 @@ StateSave::StateSave() noexcept
label(nullptr),
binary(nullptr),
uniqueId(0),
#ifndef BUILD_BRIDGE
active(false),
dryWet(1.0f),
volume(1.0f),
@@ -142,6 +147,7 @@ StateSave::StateSave() noexcept
panning(0.0f),
ctrlChannel(-1),
options(0x0),
#endif
currentProgramIndex(-1),
currentProgramName(nullptr),
currentMidiBank(-1),
@@ -187,6 +193,7 @@ void StateSave::clear() noexcept
}

uniqueId = 0;
#ifndef BUILD_BRIDGE
active = false;
dryWet = 1.0f;
volume = 1.0f;
@@ -195,6 +202,7 @@ void StateSave::clear() noexcept
panning = 0.0f;
ctrlChannel = -1;
options = 0x0;
#endif
currentProgramIndex = -1;
currentMidiBank = -1;
currentMidiProgram = -1;
@@ -261,6 +269,7 @@ bool StateSave::fillFromXmlElement(const XmlElement* const xmlElement)
const String& tag(xmlData->getTagName());
const String text(xmlData->getAllSubText().trim());

#ifndef BUILD_BRIDGE
// -------------------------------------------------------
// Internal Data

@@ -303,6 +312,9 @@ bool StateSave::fillFromXmlElement(const XmlElement* const xmlElement)
if (value > 0)
options = static_cast<uint>(value);
}
#else
if (false) {}
#endif

// -------------------------------------------------------
// Program (current)
@@ -364,6 +376,8 @@ bool StateSave::fillFromXmlElement(const XmlElement* const xmlElement)
{
stateParameter->value = pText.getFloatValue();
}

#ifndef BUILD_BRIDGE
else if (pTag.equalsIgnoreCase("midichannel") || pTag.equalsIgnoreCase("midi-channel"))
{
const int channel(pText.getIntValue());
@@ -376,6 +390,7 @@ bool StateSave::fillFromXmlElement(const XmlElement* const xmlElement)
if (cc >= 1 && cc < 0x5F)
stateParameter->midiCC = static_cast<int16_t>(cc);
}
#endif
}

parameters.append(stateParameter);
@@ -483,6 +498,7 @@ String StateSave::toString() const

content << " <Data>\n";

#ifndef BUILD_BRIDGE
{
String dataXml;

@@ -508,6 +524,7 @@ String StateSave::toString() const

content << dataXml;
}
#endif

for (StateParameterItenerator it = parameters.begin(); it.valid(); it.next())
{
@@ -524,11 +541,13 @@ String StateSave::toString() const
if (stateParameter->isInput)
parameterXml << " <Value>" << String(stateParameter->value, 15) << "</Value>\n";

#ifndef BUILD_BRIDGE
if (stateParameter->midiCC > 0)
{
parameterXml << " <MidiCC>" << stateParameter->midiCC << "</MidiCC>\n";
parameterXml << " <MidiChannel>" << stateParameter->midiChannel+1 << "</MidiChannel>\n";
}
#endif

parameterXml << " </Parameter>\n";



+ 10
- 6
source/utils/CarlaStateUtils.hpp View File

@@ -36,8 +36,10 @@ struct StateParameter {
const char* name;
const char* symbol;
float value;
#ifndef BUILD_BRIDGE
uint8_t midiChannel;
int16_t midiCC;
#endif

StateParameter() noexcept;
~StateParameter() noexcept;
@@ -69,14 +71,16 @@ struct StateSave {
const char* binary;
int64_t uniqueId;

bool active;
float dryWet;
float volume;
float balanceLeft;
float balanceRight;
float panning;
#ifndef BUILD_BRIDGE
bool active;
float dryWet;
float volume;
float balanceLeft;
float balanceRight;
float panning;
int8_t ctrlChannel;
uint options;
#endif

int32_t currentProgramIndex;
const char* currentProgramName;


Loading…
Cancel
Save