Browse Source

Make the backend compile again, even if broken for now

tags/1.9.4
falkTX 11 years ago
parent
commit
771b2dde4f
24 changed files with 548 additions and 237 deletions
  1. +6
    -1
      source/backend/engine/CarlaEngine.cpp
  2. +37
    -13
      source/backend/plugin/BridgePlugin.cpp
  3. +59
    -44
      source/backend/plugin/CarlaPlugin.cpp
  4. +15
    -8
      source/backend/plugin/CarlaPluginInternal.hpp
  5. +8
    -4
      source/backend/plugin/CarlaPluginThread.cpp
  6. +3
    -5
      source/backend/plugin/CarlaPluginThread.hpp
  7. +1
    -1
      source/backend/plugin/CsoundPlugin.cpp
  8. +49
    -22
      source/backend/plugin/DssiPlugin.cpp
  9. +28
    -10
      source/backend/plugin/FluidSynthPlugin.cpp
  10. +1
    -1
      source/backend/plugin/JucePlugin.cpp
  11. +37
    -10
      source/backend/plugin/LadspaPlugin.cpp
  12. +16
    -6
      source/backend/plugin/LinuxSamplerPlugin.cpp
  13. +56
    -34
      source/backend/plugin/Lv2Plugin.cpp
  14. +50
    -31
      source/backend/plugin/NativePlugin.cpp
  15. +30
    -12
      source/backend/plugin/VstPlugin.cpp
  16. +4
    -4
      source/modules/carla_native/Makefile
  17. +4
    -4
      source/modules/carla_native/_all.c
  18. +27
    -10
      source/modules/carla_native/audio-base.hpp
  19. +16
    -0
      source/modules/carla_native/audio-file.cpp
  20. +4
    -4
      source/modules/carla_native/midi-base.hpp
  21. +11
    -2
      source/modules/carla_native/zynaddsubfx-fx.cpp
  22. +17
    -11
      source/modules/carla_native/zynaddsubfx-synth.cpp
  23. +63
    -0
      source/utils/CarlaJuceUtils.hpp
  24. +6
    -0
      source/utils/CarlaLv2Utils.hpp

+ 6
- 1
source/backend/engine/CarlaEngine.cpp View File

@@ -32,7 +32,6 @@

#ifdef USE_JUCE
#include "juce_audio_basics.h"

using juce::FloatVectorOperations;
#endif

@@ -366,7 +365,9 @@ unsigned int CarlaEngine::getDriverCount()

#ifndef BUILD_BRIDGE
count += getRtAudioApiCount();
# ifdef USE_JUCE
count += getJuceApiCount();
# endif
#endif

return count;
@@ -385,10 +386,12 @@ const char* CarlaEngine::getDriverName(const unsigned int index)
if (rtAudioIndex < getRtAudioApiCount())
return getRtAudioApiName(rtAudioIndex);

# ifdef USE_JUCE
const unsigned int juceIndex(index-rtAudioIndex-1);

if (juceIndex < getJuceApiCount())
return getJuceApiName(juceIndex);
# endif
#endif

carla_stderr("CarlaEngine::getDriverName(%i) - invalid index", index);
@@ -411,10 +414,12 @@ const char** CarlaEngine::getDriverDeviceNames(const unsigned int index)
if (rtAudioIndex < getRtAudioApiCount())
return getRtAudioApiDeviceNames(rtAudioIndex);

# ifdef USE_JUCE
const unsigned int juceIndex(index-rtAudioIndex-1);

if (juceIndex < getJuceApiCount())
return getJuceApiDeviceNames(juceIndex);
# endif
#endif

carla_stderr("CarlaEngine::getDriverDeviceNames(%i) - invalid index", index);


+ 37
- 13
source/backend/plugin/BridgePlugin.cpp View File

@@ -277,7 +277,7 @@ public:
pData->active = false;
}

if (pData->osc.thread.isThreadRunning())
if (pData->osc.thread.isRunning())
{
fShmControl.writeOpcode(kPluginBridgeOpcodeQuit);
fShmControl.commitWrite();
@@ -291,7 +291,7 @@ public:
}

pData->osc.data.free();
pData->osc.thread.stopThread(6000);
pData->osc.thread.stop(6000);

if (fNeedsSemDestroy)
{
@@ -588,7 +588,7 @@ public:

void idleGui() override
{
if (! pData->osc.thread.isThreadRunning())
if (! pData->osc.thread.isRunning())
carla_stderr2("TESTING: Bridge has closed!");

CarlaPlugin::idleGui();
@@ -602,7 +602,7 @@ public:
CARLA_SAFE_ASSERT_RETURN(pData->engine != nullptr,);
carla_debug("BridgePlugin::reload() - start");

const ProcessMode processMode(pData->engine->getProccessMode());
const EngineProcessMode processMode(pData->engine->getProccessMode());

// Safely disable plugin for reload
const ScopedDisabler sd(this);
@@ -635,7 +635,7 @@ public:
{
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -659,7 +659,7 @@ public:
{
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -682,7 +682,7 @@ public:
{
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -698,7 +698,7 @@ public:
{
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -750,7 +750,13 @@ public:
{
// disable any output sound
for (i=0; i < pData->audioOut.count; ++i)
{
#ifdef USE_JUCE
FloatVectorOperations::clear(outBuffer[i], frames);
#else
carla_zeroFloat(outBuffer[i], frames);
#endif
}

return;
}
@@ -1055,7 +1061,12 @@ public:
else if (! pData->singleMutex.tryLock())
{
for (i=0; i < pData->audioOut.count; ++i)
{
#ifdef USE_JUCE
FloatVectorOperations::clear(outBuffer[i], frames);
#else
#endif
}

return false;
}
@@ -1064,7 +1075,12 @@ public:
// Reset audio buffers

for (i=0; i < fInfo.aIns; ++i)
{
#ifdef USE_JUCE
FloatVectorOperations::copy(fShmAudioPool.data + (i * frames), inBuffer[i], frames);
#else
#endif
}

// --------------------------------------------------------------------------------------------------------
// Run plugin
@@ -1079,7 +1095,12 @@ public:
}

for (i=0; i < fInfo.aOuts; ++i)
{
#ifdef USE_JUCE
FloatVectorOperations::copy(outBuffer[i], fShmAudioPool.data + ((i + fInfo.aIns) * frames), frames);
#else
#endif
}

// --------------------------------------------------------------------------------------------------------
// Post-processing (dry/wet, volume and balance)
@@ -1112,7 +1133,10 @@ public:
if (isPair)
{
CARLA_ASSERT(i+1 < pData->audioOut.count);
#ifdef USE_JUCE
FloatVectorOperations::copy(oldBufLeft, outBuffer[i], frames);
#else
#endif
}

float balRangeL = (pData->postProc.balanceLeft + 1.0f)/2.0f;
@@ -1486,7 +1510,7 @@ public:
break;

if (std::strcmp(key, CARLA_BRIDGE_MSG_HIDE_GUI) == 0)
pData->engine->callback(CALLBACK_SHOW_GUI, fId, 0, 0, 0.0f, nullptr);
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, fId, 0, 0, 0.0f, nullptr);
else if (std::strcmp(key, CARLA_BRIDGE_MSG_SAVED) == 0)
fSaved = true;

@@ -1775,12 +1799,12 @@ public:
std::strncat(shmIdStr, &fShmControl.filename[fShmControl.filename.length()-6], 6);

pData->osc.thread.setOscData(bridgeBinary, label, getPluginTypeAsString(fPluginType), shmIdStr);
pData->osc.thread.startThread(7);
pData->osc.thread.start();
}

for (int i=0; i < 200; ++i)
{
if (fInitiated || ! pData->osc.thread.isThreadRunning())
if (fInitiated || ! pData->osc.thread.isRunning())
break;
carla_msleep(50);
}
@@ -1790,7 +1814,7 @@ public:
// unregister so it gets handled properly
pData->engine->registerEnginePlugin(fId, nullptr);

pData->osc.thread.stopThread(6000);
pData->osc.thread.stop(6000);

if (! fInitError)
pData->engine->setLastError("Timeout while waiting for a response from plugin-bridge\n(or the plugin crashed on initialization?)");
@@ -1911,7 +1935,7 @@ CarlaPlugin* CarlaPlugin::newBridge(const Initializer& init, BinaryType btype, P

plugin->reload();

if (init.engine->getProccessMode() == PROCESS_MODE_CONTINUOUS_RACK && ! plugin->canRunInRack())
if (init.engine->getProccessMode() == ENGINE_PROCESS_MODE_CONTINUOUS_RACK && ! plugin->canRunInRack())
{
init.engine->setLastError("Carla's rack mode can only work with Stereo Bridged plugins, sorry!");
delete plugin;


+ 59
- 44
source/backend/plugin/CarlaPlugin.cpp View File

@@ -18,9 +18,11 @@
#include "CarlaPluginInternal.hpp"
#include "CarlaLibCounter.hpp"

#ifdef USE_JUCE
#include "juce_data_structures.h"

using namespace juce;
#endif

CARLA_BACKEND_START_NAMESPACE

@@ -107,6 +109,7 @@ void* CarlaPluginProtectedData::uiLibSymbol(const char* const symbol)

void CarlaPluginProtectedData::saveSetting(const unsigned int option, const bool yesNo)
{
#ifdef USE_JUCE
PropertiesFile::Options opts;
opts.applicationName = "common"; // TODO, (const char*)idStr
opts.filenameSuffix = ".cfg";
@@ -160,10 +163,12 @@ void CarlaPluginProtectedData::saveSetting(const unsigned int option, const bool

appProps.saveIfNeeded();
appProps.closeFiles();
#endif
}

unsigned int CarlaPluginProtectedData::loadSettings(const unsigned int options, const unsigned int availOptions)
{
#ifdef USE_JUCE
PropertiesFile::Options opts;
opts.applicationName = "common"; // TODO, (const char*)idStr
opts.filenameSuffix = ".cfg";
@@ -209,6 +214,8 @@ unsigned int CarlaPluginProtectedData::loadSettings(const unsigned int options,
#undef CHECK_AND_SET_OPTION

return newOptions;
#endif
return 0x0;
}

// -------------------------------------------------------------------
@@ -229,20 +236,20 @@ CarlaPlugin::CarlaPlugin(CarlaEngine* const engine, const unsigned int id)

switch (engine->getProccessMode())
{
case PROCESS_MODE_SINGLE_CLIENT:
case PROCESS_MODE_MULTIPLE_CLIENTS:
case ENGINE_PROCESS_MODE_SINGLE_CLIENT:
case ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS:
CARLA_ASSERT(id < MAX_DEFAULT_PLUGINS);
break;

case PROCESS_MODE_CONTINUOUS_RACK:
case ENGINE_PROCESS_MODE_CONTINUOUS_RACK:
CARLA_ASSERT(id < MAX_RACK_PLUGINS);
break;

case PROCESS_MODE_PATCHBAY:
case ENGINE_PROCESS_MODE_PATCHBAY:
CARLA_ASSERT(id < MAX_PATCHBAY_PLUGINS);
break;

case PROCESS_MODE_BRIDGE:
case ENGINE_PROCESS_MODE_BRIDGE:
CARLA_ASSERT(id == 0);
break;
}
@@ -509,6 +516,7 @@ const SaveState& CarlaPlugin::getSaveState()
pData->saveState.ctrlChannel = pData->ctrlChannel;
#endif

#ifdef USE_JUCE
// ---------------------------------------------------------------
// Chunk

@@ -526,6 +534,7 @@ const SaveState& CarlaPlugin::getSaveState()
return pData->saveState;
}
}
#endif

// ---------------------------------------------------------------
// Current Program
@@ -582,7 +591,7 @@ const SaveState& CarlaPlugin::getSaveState()
// ---------------------------------------------------------------
// Custom Data

for (NonRtList<CustomData>::Itenerator it = pData->custom.begin(); it.valid(); it.next())
for (List<CustomData>::Itenerator it = pData->custom.begin(); it.valid(); it.next())
{
const CustomData& cData(*it);

@@ -609,7 +618,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState)
// ---------------------------------------------------------------
// Part 1 - PRE-set custom data (only that which reload programs)

for (NonRtList<StateCustomData*>::Itenerator it = saveState.customData.begin(); it.valid(); it.next())
for (List<StateCustomData*>::Itenerator it = saveState.customData.begin(); it.valid(); it.next())
{
const StateCustomData* const stateCustomData(*it);
const char* const key(stateCustomData->key);
@@ -667,7 +676,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState)
// ---------------------------------------------------------------
// Part 4a - get plugin parameter symbols

NonRtList<ParamSymbol*> paramSymbols;
List<ParamSymbol*> paramSymbols;

if (getType() == PLUGIN_LADSPA || getType() == PLUGIN_LV2)
{
@@ -689,7 +698,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState)

const float sampleRate(pData->engine->getSampleRate());

for (NonRtList<StateParameter*>::Itenerator it = saveState.parameters.begin(); it.valid(); it.next())
for (List<StateParameter*>::Itenerator it = saveState.parameters.begin(); it.valid(); it.next())
{
StateParameter* const stateParameter(*it);

@@ -700,7 +709,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState)
// Try to set by symbol, otherwise use index
if (stateParameter->symbol != nullptr && stateParameter->symbol[0] != '\0')
{
for (NonRtList<ParamSymbol*>::Itenerator it = paramSymbols.begin(); it.valid(); it.next())
for (List<ParamSymbol*>::Itenerator it = paramSymbols.begin(); it.valid(); it.next())
{
ParamSymbol* const paramSymbol(*it);

@@ -721,7 +730,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState)
// Symbol only
if (stateParameter->symbol != nullptr && stateParameter->symbol[0] != '\0')
{
for (NonRtList<ParamSymbol*>::Itenerator it = paramSymbols.begin(); it.valid(); it.next())
for (List<ParamSymbol*>::Itenerator it = paramSymbols.begin(); it.valid(); it.next())
{
ParamSymbol* const paramSymbol(*it);

@@ -762,7 +771,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState)
// ---------------------------------------------------------------
// Part 4c - clear

for (NonRtList<ParamSymbol*>::Itenerator it = paramSymbols.begin(); it.valid(); it.next())
for (List<ParamSymbol*>::Itenerator it = paramSymbols.begin(); it.valid(); it.next())
{
ParamSymbol* const paramSymbol(*it);
delete paramSymbol;
@@ -773,7 +782,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState)
// ---------------------------------------------------------------
// Part 5 - set custom data

for (NonRtList<StateCustomData*>::Itenerator it = saveState.customData.begin(); it.valid(); it.next())
for (List<StateCustomData*>::Itenerator it = saveState.customData.begin(); it.valid(); it.next())
{
const StateCustomData* const stateCustomData(*it);
const char* const key(stateCustomData->key);
@@ -812,6 +821,7 @@ bool CarlaPlugin::saveStateToFile(const char* const filename)
CARLA_SAFE_ASSERT_RETURN(filename != nullptr && filename[0] != '\0', false);
carla_debug("CarlaPlugin::saveStateToFile(\"%s\")", filename);

#ifdef USE_JUCE
File file(filename);

String content;
@@ -825,6 +835,9 @@ bool CarlaPlugin::saveStateToFile(const char* const filename)
out << "</CARLA-PRESET>\n";

return file.replaceWithData(out.getData(), out.getDataSize());
#else
return false;
#endif
}

bool CarlaPlugin::loadStateFromFile(const char* const filename)
@@ -832,6 +845,7 @@ bool CarlaPlugin::loadStateFromFile(const char* const filename)
CARLA_SAFE_ASSERT_RETURN(filename != nullptr && filename[0] != '\0', false);
carla_debug("CarlaPlugin::loadStateFromFile(\"%s\")", filename);

#ifdef USE_JUCE
File file(filename);

XmlDocument xml(file);
@@ -859,6 +873,7 @@ bool CarlaPlugin::loadStateFromFile(const char* const filename)
delete xmlCheck;
return false;
}
#endif

pData->engine->setLastError("Not a valid file");
return false;
@@ -932,7 +947,7 @@ void CarlaPlugin::setActive(const bool active, const bool sendOsc, const bool se
pData->engine->oscSend_control_set_parameter_value(fId, PARAMETER_ACTIVE, value);

if (sendCallback)
pData->engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, fId, PARAMETER_ACTIVE, 0, value, nullptr);
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, fId, PARAMETER_ACTIVE, 0, value, nullptr);
#else
return;

@@ -958,7 +973,7 @@ void CarlaPlugin::setDryWet(const float value, const bool sendOsc, const bool se
pData->engine->oscSend_control_set_parameter_value(fId, PARAMETER_DRYWET, fixedValue);

if (sendCallback)
pData->engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, fId, PARAMETER_DRYWET, 0, fixedValue, nullptr);
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, fId, PARAMETER_DRYWET, 0, fixedValue, nullptr);
}

void CarlaPlugin::setVolume(const float value, const bool sendOsc, const bool sendCallback)
@@ -976,7 +991,7 @@ void CarlaPlugin::setVolume(const float value, const bool sendOsc, const bool se
pData->engine->oscSend_control_set_parameter_value(fId, PARAMETER_VOLUME, fixedValue);

if (sendCallback)
pData->engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, fId, PARAMETER_VOLUME, 0, fixedValue, nullptr);
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, fId, PARAMETER_VOLUME, 0, fixedValue, nullptr);
}

void CarlaPlugin::setBalanceLeft(const float value, const bool sendOsc, const bool sendCallback)
@@ -994,7 +1009,7 @@ void CarlaPlugin::setBalanceLeft(const float value, const bool sendOsc, const bo
pData->engine->oscSend_control_set_parameter_value(fId, PARAMETER_BALANCE_LEFT, fixedValue);

if (sendCallback)
pData->engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, fId, PARAMETER_BALANCE_LEFT, 0, fixedValue, nullptr);
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, fId, PARAMETER_BALANCE_LEFT, 0, fixedValue, nullptr);
}

void CarlaPlugin::setBalanceRight(const float value, const bool sendOsc, const bool sendCallback)
@@ -1012,7 +1027,7 @@ void CarlaPlugin::setBalanceRight(const float value, const bool sendOsc, const b
pData->engine->oscSend_control_set_parameter_value(fId, PARAMETER_BALANCE_RIGHT, fixedValue);

if (sendCallback)
pData->engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, fId, PARAMETER_BALANCE_RIGHT, 0, fixedValue, nullptr);
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, fId, PARAMETER_BALANCE_RIGHT, 0, fixedValue, nullptr);
}

void CarlaPlugin::setPanning(const float value, const bool sendOsc, const bool sendCallback)
@@ -1030,7 +1045,7 @@ void CarlaPlugin::setPanning(const float value, const bool sendOsc, const bool s
pData->engine->oscSend_control_set_parameter_value(fId, PARAMETER_PANNING, fixedValue);

if (sendCallback)
pData->engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, fId, PARAMETER_PANNING, 0, fixedValue, nullptr);
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, fId, PARAMETER_PANNING, 0, fixedValue, nullptr);
}
#endif

@@ -1053,7 +1068,7 @@ void CarlaPlugin::setCtrlChannel(const int8_t channel, const bool sendOsc, const
pData->engine->oscSend_control_set_parameter_value(fId, PARAMETER_CTRL_CHANNEL, ctrlf);

if (sendCallback)
pData->engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, fId, PARAMETER_CTRL_CHANNEL, 0, ctrlf, nullptr);
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, fId, PARAMETER_CTRL_CHANNEL, 0, ctrlf, nullptr);

if (fHints & PLUGIN_IS_BRIDGE)
osc_send_control(pData->osc.data, PARAMETER_CTRL_CHANNEL, ctrlf);
@@ -1088,7 +1103,7 @@ void CarlaPlugin::setParameterValue(const uint32_t parameterId, const float valu
#endif

if (sendCallback)
pData->engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, fId, parameterId, 0, value, nullptr);
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, fId, parameterId, 0, value, nullptr);

#ifdef BUILD_BRIDGE
return;
@@ -1152,7 +1167,7 @@ void CarlaPlugin::setParameterMidiChannel(const uint32_t parameterId, uint8_t ch
pData->engine->oscSend_control_set_parameter_midi_channel(fId, parameterId, channel);

if (sendCallback)
pData->engine->callback(CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED, fId, parameterId, channel, 0.0f, nullptr);
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED, fId, parameterId, channel, 0.0f, nullptr);

if (fHints & PLUGIN_IS_BRIDGE)
{} // TODO
@@ -1181,7 +1196,7 @@ void CarlaPlugin::setParameterMidiCC(const uint32_t parameterId, int16_t cc, con
pData->engine->oscSend_control_set_parameter_midi_cc(fId, parameterId, cc);

if (sendCallback)
pData->engine->callback(CALLBACK_PARAMETER_MIDI_CC_CHANGED, fId, parameterId, cc, 0.0f, nullptr);
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED, fId, parameterId, cc, 0.0f, nullptr);

if (fHints & PLUGIN_IS_BRIDGE)
{} // TODO
@@ -1217,7 +1232,7 @@ void CarlaPlugin::setCustomData(const char* const type, const char* const key, c

bool saveData = true;

if (std::strcmp(type, CUSTOM_DATA_STRING) == 0)
if (std::strcmp(type, CUSTOM_DATA_TYPE_STRING) == 0)
{
// Ignore some keys
if (std::strncmp(key, "OSC:", 4) == 0 || std::strncmp(key, "CarlaAlternateFile", 18) == 0 || std::strcmp(key, "guiVisible") == 0)
@@ -1230,7 +1245,7 @@ void CarlaPlugin::setCustomData(const char* const type, const char* const key, c
return;

// Check if we already have this key
for (NonRtList<CustomData>::Itenerator it = pData->custom.begin(); it.valid(); it.next())
for (List<CustomData>::Itenerator it = pData->custom.begin(); it.valid(); it.next())
{
CustomData& cData(*it);

@@ -1294,7 +1309,7 @@ void CarlaPlugin::setProgram(int32_t index, const bool sendGui, const bool sendO
#endif

if (sendCallback)
pData->engine->callback(CALLBACK_PROGRAM_CHANGED, fId, fixedIndex, 0, 0.0f, nullptr);
pData->engine->callback(ENGINE_CALLBACK_PROGRAM_CHANGED, fId, fixedIndex, 0, 0.0f, nullptr);

// Change default parameter values
if (fixedIndex >= 0)
@@ -1320,8 +1335,8 @@ void CarlaPlugin::setProgram(int32_t index, const bool sendGui, const bool sendO
pData->engine->oscSend_control_set_parameter_value(fId, i, value);
#endif

pData->engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, fId, i, 0, value, nullptr);
pData->engine->callback(CALLBACK_PARAMETER_DEFAULT_CHANGED, fId, i, 0, value, nullptr);
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, fId, i, 0, value, nullptr);
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED, fId, i, 0, value, nullptr);
}
}
}
@@ -1357,7 +1372,7 @@ void CarlaPlugin::setMidiProgram(int32_t index, const bool sendGui, const bool s
#endif

if (sendCallback)
pData->engine->callback(CALLBACK_MIDI_PROGRAM_CHANGED, fId, fixedIndex, 0, 0.0f, nullptr);
pData->engine->callback(ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED, fId, fixedIndex, 0, 0.0f, nullptr);

if (fixedIndex >= 0)
{
@@ -1382,8 +1397,8 @@ void CarlaPlugin::setMidiProgram(int32_t index, const bool sendGui, const bool s
pData->engine->oscSend_control_set_parameter_value(fId, i, value);
#endif

pData->engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, fId, i, 0, value, nullptr);
pData->engine->callback(CALLBACK_PARAMETER_DEFAULT_CHANGED, fId, i, 0, value, nullptr);
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, fId, i, 0, value, nullptr);
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED, fId, i, 0, value, nullptr);
}
}
}
@@ -1671,7 +1686,7 @@ void CarlaPlugin::updateOscData(const lo_address& source, const char* const url)

osc_send_sample_rate(pData->osc.data, pData->engine->getSampleRate());

for (NonRtList<CustomData>::Itenerator it = pData->custom.begin(); it.valid(); it.next())
for (List<CustomData>::Itenerator it = pData->custom.begin(); it.valid(); it.next())
{
const CustomData& cData(*it);

@@ -1679,7 +1694,7 @@ void CarlaPlugin::updateOscData(const lo_address& source, const char* const url)
CARLA_ASSERT(cData.key != nullptr);
CARLA_ASSERT(cData.value != nullptr);

if (std::strcmp(cData.type, CUSTOM_DATA_STRING) == 0)
if (std::strcmp(cData.type, CUSTOM_DATA_TYPE_STRING) == 0)
osc_send_configure(pData->osc.data, cData.key, cData.value);
}

@@ -1766,7 +1781,7 @@ void CarlaPlugin::sendMidiSingleNote(const uint8_t channel, const uint8_t note,
}

if (sendCallback)
pData->engine->callback((velo > 0) ? CALLBACK_NOTE_ON : CALLBACK_NOTE_OFF, fId, channel, note, velo, nullptr);
pData->engine->callback((velo > 0) ? ENGINE_CALLBACK_NOTE_ON : ENGINE_CALLBACK_NOTE_OFF, fId, channel, note, velo, nullptr);
}
#endif

@@ -1806,7 +1821,7 @@ void CarlaPlugin::postRtEventsRun()

case kPluginPostRtEventDebug:
#ifndef BUILD_BRIDGE
pData->engine->callback(CALLBACK_DEBUG, fId, event.value1, event.value2, event.value3, nullptr);
pData->engine->callback(ENGINE_CALLBACK_DEBUG, fId, event.value1, event.value2, event.value3, nullptr);
#endif
break;

@@ -1823,7 +1838,7 @@ void CarlaPlugin::postRtEventsRun()
pData->engine->oscSend_control_set_parameter_value(fId, event.value1, event.value3);

// Update Host
pData->engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, fId, event.value1, 0, event.value3, nullptr);
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, fId, event.value1, 0, event.value3, nullptr);
}
#endif
break;
@@ -1839,7 +1854,7 @@ void CarlaPlugin::postRtEventsRun()
pData->engine->oscSend_control_set_program(fId, event.value1);

// Update Host
pData->engine->callback(CALLBACK_PROGRAM_CHANGED, fId, event.value1, 0, 0.0f, nullptr);
pData->engine->callback(ENGINE_CALLBACK_PROGRAM_CHANGED, fId, event.value1, 0, 0.0f, nullptr);

// Update param values
{
@@ -1855,8 +1870,8 @@ void CarlaPlugin::postRtEventsRun()
pData->engine->oscSend_control_set_default_value(fId, j, pData->param.ranges[j].def);
}

pData->engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, fId, j, 0, value, nullptr);
pData->engine->callback(CALLBACK_PARAMETER_DEFAULT_CHANGED, fId, j, 0, pData->param.ranges[j].def, nullptr);
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, fId, j, 0, value, nullptr);
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED, fId, j, 0, pData->param.ranges[j].def, nullptr);
}
}
#endif
@@ -1873,7 +1888,7 @@ void CarlaPlugin::postRtEventsRun()
pData->engine->oscSend_control_set_midi_program(fId, event.value1);

// Update Host
pData->engine->callback(CALLBACK_MIDI_PROGRAM_CHANGED, fId, event.value1, 0, 0.0f, nullptr);
pData->engine->callback(ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED, fId, event.value1, 0, 0.0f, nullptr);

// Update param values
{
@@ -1889,8 +1904,8 @@ void CarlaPlugin::postRtEventsRun()
pData->engine->oscSend_control_set_default_value(fId, j, pData->param.ranges[j].def);
}

pData->engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, fId, j, 0, value, nullptr);
pData->engine->callback(CALLBACK_PARAMETER_DEFAULT_CHANGED, fId, j, 0, pData->param.ranges[j].def, nullptr);
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, fId, j, 0, value, nullptr);
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED, fId, j, 0, pData->param.ranges[j].def, nullptr);
}
}
#endif
@@ -1906,7 +1921,7 @@ void CarlaPlugin::postRtEventsRun()
pData->engine->oscSend_control_note_on(fId, event.value1, event.value2, int(event.value3));

// Update Host
pData->engine->callback(CALLBACK_NOTE_ON, fId, event.value1, event.value2, int(event.value3), nullptr);
pData->engine->callback(ENGINE_CALLBACK_NOTE_ON, fId, event.value1, event.value2, int(event.value3), nullptr);
#endif
break;

@@ -1920,7 +1935,7 @@ void CarlaPlugin::postRtEventsRun()
pData->engine->oscSend_control_note_off(fId, event.value1, event.value2);

// Update Host
pData->engine->callback(CALLBACK_NOTE_OFF, fId, event.value1, event.value2, 0.0f, nullptr);
pData->engine->callback(ENGINE_CALLBACK_NOTE_OFF, fId, event.value1, event.value2, 0.0f, nullptr);
#endif
break;
}


+ 15
- 8
source/backend/plugin/CarlaPluginInternal.hpp View File

@@ -29,11 +29,14 @@
#include "CarlaMIDI.h"
#include "RtList.hpp"

#include "juce_audio_basics.h"
#include <cmath>

#define CARLA_PROCESS_CONTINUE_CHECK if (! fEnabled) { pData->engine->callback(CALLBACK_DEBUG, fId, 0, 0, 0.0f, "Processing while plugin is disabled!!"); return; }
#define CARLA_PROCESS_CONTINUE_CHECK if (! fEnabled) { pData->engine->callback(ENGINE_CALLBACK_DEBUG, fId, 0, 0, 0.0f, "Processing while plugin is disabled!!"); return; }

#ifdef USE_JUCE
#include "juce_audio_basics.h"
using juce::FloatVectorOperations;
#endif

CARLA_BACKEND_START_NAMESPACE

@@ -509,7 +512,7 @@ struct CarlaPluginProtectedData {
PluginParameterData param;
PluginProgramData prog;
PluginMidiProgramData midiprog;
NonRtList<CustomData> custom;
List<CustomData> custom;

SaveState saveState;

@@ -665,7 +668,7 @@ struct CarlaPluginProtectedData {
if (client->isActive())
{
// must not happen
carla_assert("client->isActive()", __FILE__, __LINE__);
carla_safe_assert("client->isActive()", __FILE__, __LINE__);
client->deactivate();
}

@@ -675,7 +678,7 @@ struct CarlaPluginProtectedData {
client = nullptr;
}

for (NonRtList<CustomData>::Itenerator it = custom.begin(); it.valid(); it.next())
for (List<CustomData>::Itenerator it = custom.begin(); it.valid(); it.next())
{
CustomData& cData(*it);

@@ -685,7 +688,7 @@ struct CarlaPluginProtectedData {
cData.type = nullptr;
}
else
carla_assert("cData.type != nullptr", __FILE__, __LINE__);
carla_safe_assert("cData.type != nullptr", __FILE__, __LINE__);

if (cData.key != nullptr)
{
@@ -693,7 +696,7 @@ struct CarlaPluginProtectedData {
cData.key = nullptr;
}
else
carla_assert("cData.key != nullptr", __FILE__, __LINE__);
carla_safe_assert("cData.key != nullptr", __FILE__, __LINE__);

if (cData.value != nullptr)
{
@@ -701,7 +704,7 @@ struct CarlaPluginProtectedData {
cData.value = nullptr;
}
else
carla_assert("cData.value != nullptr", __FILE__, __LINE__);
carla_safe_assert("cData.value != nullptr", __FILE__, __LINE__);
}

prog.clear();
@@ -773,7 +776,11 @@ 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
}
}
}


+ 8
- 4
source/backend/plugin/CarlaPluginThread.cpp View File

@@ -20,9 +20,11 @@
#include "CarlaPlugin.hpp"
#include "CarlaEngine.hpp"

#ifdef USE_JUCE
using juce::ChildProcess;
using juce::String;
using juce::StringArray;
#endif

CARLA_BACKEND_START_NAMESPACE

@@ -47,19 +49,19 @@ const char* PluginThreadMode2str(const CarlaPluginThread::Mode mode)
}

CarlaPluginThread::CarlaPluginThread(CarlaBackend::CarlaEngine* const engine, CarlaBackend::CarlaPlugin* const plugin, const Mode mode)
: juce::Thread("CarlaPluginThread"),
: CarlaThread("CarlaPluginThread"),
fEngine(engine),
fPlugin(plugin),
fMode(mode)
{
carla_debug("CarlaPluginThread::CarlaPluginThread(plugin:\"%s\", engine:\"%s\", %s)", plugin->getName(), engine->getName(), PluginThreadMode2str(mode));

setPriority(5);
//setPriority(5);
}

void CarlaPluginThread::setMode(const CarlaPluginThread::Mode mode)
{
CARLA_ASSERT(! isThreadRunning());
CARLA_ASSERT(! isRunning());
carla_debug("CarlaPluginThread::setMode(%s)", PluginThreadMode2str(mode));

fMode = mode;
@@ -67,7 +69,7 @@ void CarlaPluginThread::setMode(const CarlaPluginThread::Mode mode)

void CarlaPluginThread::setOscData(const char* const binary, const char* const label, const char* const extra1, const char* const extra2)
{
CARLA_ASSERT(! isThreadRunning());
CARLA_ASSERT(! isRunning());
carla_debug("CarlaPluginThread::setOscData(\"%s\", \"%s\", \"%s\", \"%s\")", binary, label, extra1, extra2);

fBinary = binary;
@@ -80,6 +82,7 @@ void CarlaPluginThread::run()
{
carla_debug("CarlaPluginThread::run()");

#ifdef USE_JUCE
ChildProcess process;

StringArray arguments;
@@ -180,6 +183,7 @@ void CarlaPluginThread::run()
}
break;
}
#endif
}

CARLA_BACKEND_END_NAMESPACE

+ 3
- 5
source/backend/plugin/CarlaPluginThread.hpp View File

@@ -19,9 +19,7 @@
#define CARLA_PLUGIN_THREAD_HPP_INCLUDED

#include "CarlaBackend.hpp"
#include "CarlaString.hpp"

#include "juce_core.h"
#include "CarlaThread.hpp"

CARLA_BACKEND_START_NAMESPACE

@@ -31,7 +29,7 @@ CARLA_BACKEND_START_NAMESPACE

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

class CarlaPluginThread : public juce::Thread
class CarlaPluginThread : public CarlaThread
{
public:
enum Mode {
@@ -60,7 +58,7 @@ private:
CarlaString fExtra1;
CarlaString fExtra2;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaPluginThread)
CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaPluginThread)
};

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


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

@@ -96,7 +96,7 @@ CarlaPlugin* CarlaPlugin::newCSOUND(const Initializer& init)

plugin->reload();

if (init.engine->getProccessMode() == PROCESS_MODE_CONTINUOUS_RACK && ! plugin->canRunInRack())
if (init.engine->getProccessMode() == ENGINE_PROCESS_MODE_CONTINUOUS_RACK && ! plugin->canRunInRack())
{
init.engine->setLastError("Carla's rack mode can only work with Stereo VST3 plugins, sorry!");
delete plugin;


+ 49
- 22
source/backend/plugin/DssiPlugin.cpp View File

@@ -57,7 +57,7 @@ public:
{
showGui(false);

pData->osc.thread.stopThread(pData->engine->getOptions().uiBridgesTimeout * 2);
pData->osc.thread.stop(pData->engine->getOptions().uiBridgesTimeout * 2);
}

pData->singleMutex.lock();
@@ -167,7 +167,7 @@ public:
{
options |= PLUGIN_OPTION_FIXED_BUFFERS;

if (pData->engine->getProccessMode() != PROCESS_MODE_CONTINUOUS_RACK)
if (pData->engine->getProccessMode() != ENGINE_PROCESS_MODE_CONTINUOUS_RACK)
{
if (fOptions & PLUGIN_OPTION_FORCE_STEREO)
options |= PLUGIN_OPTION_FORCE_STEREO;
@@ -285,7 +285,7 @@ public:
CARLA_SAFE_ASSERT_RETURN(value != nullptr,);
carla_debug("DssiPlugin::setCustomData(%s, %s, %s, %s)", type, key, value, bool2str(sendGui));

if (std::strcmp(type, CUSTOM_DATA_STRING) != 0)
if (std::strcmp(type, CUSTOM_DATA_TYPE_STRING) != 0)
return carla_stderr2("DssiPlugin::setCustomData(\"%s\", \"%s\", \"%s\", %s) - type is not string", type, key, value, bool2str(sendGui));

if (fDssiDescriptor->configure != nullptr)
@@ -362,7 +362,7 @@ public:
{
if (yesNo)
{
pData->osc.thread.startThread();
pData->osc.thread.start();
}
else
{
@@ -373,7 +373,7 @@ public:
pData->osc.data.free();
}

pData->osc.thread.stopThread(pData->engine->getOptions().uiBridgesTimeout);
pData->osc.thread.stop(pData->engine->getOptions().uiBridgesTimeout);
}
}

@@ -388,7 +388,7 @@ public:
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,);
carla_debug("DssiPlugin::reload() - start");

const ProcessMode processMode(pData->engine->getProccessMode());
const EngineProcessMode processMode(pData->engine->getProccessMode());

// Safely disable plugin for reload
const ScopedDisabler sd(this);
@@ -483,7 +483,10 @@ public:
pData->param.createNew(params);

fParamBuffers = new float[params];
#ifdef USE_JUCE
FloatVectorOperations::clear(fParamBuffers, params);
#else
#endif
}

const uint portNameSize(pData->engine->getMaxPortNameSize());
@@ -500,7 +503,7 @@ public:
{
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -640,7 +643,7 @@ public:
stepSmall = 1.0f;
stepLarge = 1.0f;

pData->param.data[j].type = PARAMETER_LATENCY;
//pData->param.data[j].type = PARAMETER_LATENCY;
pData->param.data[j].hints = 0;
}
else if (std::strcmp(fDescriptor->PortNames[i], "_sample-rate") == 0)
@@ -650,7 +653,7 @@ public:
stepSmall = 1.0f;
stepLarge = 1.0f;

pData->param.data[j].type = PARAMETER_SAMPLE_RATE;
//pData->param.data[j].type = PARAMETER_SAMPLE_RATE;
pData->param.data[j].hints = 0;
}
else
@@ -702,7 +705,7 @@ public:
{
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -718,7 +721,7 @@ public:
{
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -767,8 +770,8 @@ public:
{
for (uint32_t i=0; i < pData->param.count; ++i)
{
if (pData->param.data[i].type != PARAMETER_LATENCY)
continue;
//if (pData->param.data[i].type != PARAMETER_LATENCY)
// continue;

// we need to pre-run the plugin so it can update its latency control-port

@@ -909,7 +912,7 @@ public:
if (programChanged)
setMidiProgram(pData->midiprog.current, true, true, true);

pData->engine->callback(CALLBACK_RELOAD_PROGRAMS, fId, 0, 0, 0.0f, nullptr);
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PROGRAMS, fId, 0, 0, 0.0f, nullptr);
}
}

@@ -953,7 +956,12 @@ public:
{
// disable any output sound
for (uint32_t i=0; i < pData->audioOut.count; ++i)
{
#ifdef USE_JUCE
FloatVectorOperations::clear(outBuffer[i], frames);
#else
#endif
}

return;
}
@@ -997,7 +1005,12 @@ public:
if (pData->latency > 0)
{
for (uint32_t i=0; i < pData->audioIn.count; ++i)
{
#ifdef USE_JUCE
FloatVectorOperations::clear(pData->latencyBuffers[i], pData->latency);
#else
#endif
}
}

pData->needsReset = false;
@@ -1448,9 +1461,20 @@ public:
// Reset audio buffers

for (uint32_t i=0; i < pData->audioIn.count; ++i)
{
#ifdef USE_JUCE
FloatVectorOperations::copy(fAudioInBuffers[i], inBuffer[i]+timeOffset, frames);
#else
#endif
}

for (uint32_t i=0; i < pData->audioOut.count; ++i)
{
#ifdef USE_JUCE
FloatVectorOperations::clear(fAudioOutBuffers[i], frames);
#else
#endif
}

// --------------------------------------------------------------------------------------------------------
// Run plugin
@@ -1515,7 +1539,10 @@ public:
if (isPair)
{
CARLA_ASSERT(i+1 < pData->audioOut.count);
#ifdef USE_JUCE
FloatVectorOperations::copy(oldBufLeft, fAudioOutBuffers[i], frames);
#else
#endif
}

float balRangeL = (pData->postProc.balanceLeft + 1.0f)/2.0f;
@@ -1884,10 +1911,10 @@ public:
// ---------------------------------------------------------------
// gui stuff

if (const char* const guiFilename = find_dssi_ui(filename, fDescriptor->Label))
//if (const char* const guiFilename = find_dssi_ui(filename, fDescriptor->Label))
{
pData->osc.thread.setOscData(guiFilename, fDescriptor->Label);
fGuiFilename = guiFilename;
//pData->osc.thread.setOscData(guiFilename, fDescriptor->Label);
//fGuiFilename = guiFilename;
}

// ---------------------------------------------------------------
@@ -1951,13 +1978,13 @@ private:
float* fParamBuffers;
snd_seq_event_t fMidiEvents[kPluginMaxMidiEvents];

static NonRtList<const char*> sMultiSynthList;
static List<const char*> sMultiSynthList;

static bool addUniqueMultiSynth(const char* const label)
{
CARLA_SAFE_ASSERT_RETURN(label != nullptr, true);

for (NonRtList<const char*>::Itenerator it = sMultiSynthList.begin(); it.valid(); it.next())
for (List<const char*>::Itenerator it = sMultiSynthList.begin(); it.valid(); it.next())
{
const char*& itLabel(*it);

@@ -1973,7 +2000,7 @@ private:
{
CARLA_SAFE_ASSERT_RETURN(label != nullptr,);

for (NonRtList<const char*>::Itenerator it = sMultiSynthList.begin(); it.valid(); it.next())
for (List<const char*>::Itenerator it = sMultiSynthList.begin(); it.valid(); it.next())
{
const char*& itLabel(*it);

@@ -1989,7 +2016,7 @@ private:
CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DssiPlugin)
};

NonRtList<const char*> DssiPlugin::sMultiSynthList;
List<const char*> DssiPlugin::sMultiSynthList;

CARLA_BACKEND_END_NAMESPACE

@@ -2014,7 +2041,7 @@ CarlaPlugin* CarlaPlugin::newDSSI(const Initializer& init)

plugin->reload();

if (init.engine->getProccessMode() == PROCESS_MODE_CONTINUOUS_RACK && ! plugin->canRunInRack())
if (init.engine->getProccessMode() == ENGINE_PROCESS_MODE_CONTINUOUS_RACK && ! plugin->canRunInRack())
{
init.engine->setLastError("Carla's rack mode can only work with Mono or Stereo DSSI plugins, sorry!");
delete plugin;


+ 28
- 10
source/backend/plugin/FluidSynthPlugin.cpp View File

@@ -46,7 +46,10 @@ public:
{
carla_debug("FluidSynthPlugin::FluidSynthPlugin(%p, %i, %s)", engine, id, bool2str(use16Outs));

#ifdef USE_JUCE
FloatVectorOperations::clear(fParamBuffers, FluidSynthParametersMax);
#else
#endif
carla_fill<int32_t>(fCurMidiProgs, MAX_MIDI_CHANNELS, 0);

// create settings
@@ -355,7 +358,7 @@ public:
fCurMidiProgs[8], fCurMidiProgs[9], fCurMidiProgs[10], fCurMidiProgs[11],
fCurMidiProgs[12], fCurMidiProgs[13], fCurMidiProgs[14], fCurMidiProgs[15]);

CarlaPlugin::setCustomData(CUSTOM_DATA_STRING, "midiPrograms", strBuf, false);
CarlaPlugin::setCustomData(CUSTOM_DATA_TYPE_STRING, "midiPrograms", strBuf, false);
}

// -------------------------------------------------------------------
@@ -432,7 +435,7 @@ public:
CARLA_SAFE_ASSERT_RETURN(value != nullptr,);
carla_debug("DssiPlugin::setCustomData(%s, %s, %s, %s)", type, key, value, bool2str(sendGui));

if (std::strcmp(type, CUSTOM_DATA_STRING) != 0)
if (std::strcmp(type, CUSTOM_DATA_TYPE_STRING) != 0)
return carla_stderr2("DssiPlugin::setCustomData(\"%s\", \"%s\", \"%s\", %s) - type is not string", type, key, value, bool2str(sendGui));

if (std::strcmp(key, "midiPrograms") != 0)
@@ -510,7 +513,7 @@ public:
CARLA_SAFE_ASSERT_RETURN(fSynth != nullptr,);
carla_debug("FluidSynthPlugin::reload() - start");

const ProcessMode processMode(pData->engine->getProccessMode());
const EngineProcessMode processMode(pData->engine->getProccessMode());

// Safely disable plugin for reload
const ScopedDisabler sd(this);
@@ -539,7 +542,7 @@ public:
{
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -573,7 +576,7 @@ public:
// out-left
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -588,7 +591,7 @@ public:
// out-right
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -607,7 +610,7 @@ public:
{
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -625,7 +628,7 @@ public:
{
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -985,7 +988,7 @@ public:
}
else
{
pData->engine->callback(CALLBACK_RELOAD_PROGRAMS, fId, 0, 0, 0.0f, nullptr);
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PROGRAMS, fId, 0, 0, 0.0f, nullptr);
}
}

@@ -1003,7 +1006,12 @@ public:
{
// disable any output sound
for (i=0; i < pData->audioOut.count; ++i)
{
#ifdef USE_JUCE
FloatVectorOperations::clear(outBuffer[i], frames);
#else
#endif
}

return;
}
@@ -1376,7 +1384,12 @@ public:
if (kUses16Outs)
{
for (i=0; i < pData->audioOut.count; ++i)
{
#ifdef USE_JUCE
FloatVectorOperations::clear(fAudio16Buffers[i], frames);
#else
#endif
}

fluid_synth_process(fSynth, frames, 0, nullptr, pData->audioOut.count, fAudio16Buffers);
}
@@ -1400,7 +1413,12 @@ public:
if (doBalance)
{
if (i % 2 == 0)
{
#ifdef USE_JUCE
FloatVectorOperations::copy(oldBufLeft, outBuffer[i]+timeOffset, frames);
#else
#endif
}

float balRangeL = (pData->postProc.balanceLeft + 1.0f)/2.0f;
float balRangeR = (pData->postProc.balanceRight + 1.0f)/2.0f;
@@ -1650,7 +1668,7 @@ CarlaPlugin* CarlaPlugin::newSF2(const Initializer& init, const bool use16Outs)
return nullptr;
}

if (init.engine->getProccessMode() == PROCESS_MODE_CONTINUOUS_RACK && use16Outs)
if (init.engine->getProccessMode() == ENGINE_PROCESS_MODE_CONTINUOUS_RACK && use16Outs)
{
init.engine->setLastError("Carla's rack mode can only work with Stereo modules, please choose the 2-channel only SoundFont version");
return nullptr;


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

@@ -73,7 +73,7 @@ CarlaPlugin* CarlaPlugin::newCsound(const Initializer& init)

plugin->reload();

if (init.engine->getProccessMode() == PROCESS_MODE_CONTINUOUS_RACK && ! plugin->canRunInRack())
if (init.engine->getProccessMode() == ENGINE_PROCESS_MODE_CONTINUOUS_RACK && ! plugin->canRunInRack())
{
init.engine->setLastError("Carla's rack mode can only work with Stereo VST3 plugins, sorry!");
delete plugin;


+ 37
- 10
source/backend/plugin/LadspaPlugin.cpp View File

@@ -173,7 +173,7 @@ public:
{
options |= PLUGIN_OPTION_FIXED_BUFFERS;

if (pData->engine->getProccessMode() != PROCESS_MODE_CONTINUOUS_RACK)
if (pData->engine->getProccessMode() != ENGINE_PROCESS_MODE_CONTINUOUS_RACK)
{
if (fOptions & PLUGIN_OPTION_FORCE_STEREO)
options |= PLUGIN_OPTION_FORCE_STEREO;
@@ -397,7 +397,7 @@ public:
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,);
carla_debug("LadspaPlugin::reload() - start");

const ProcessMode processMode(pData->engine->getProccessMode());
const EngineProcessMode processMode(pData->engine->getProccessMode());

// Safely disable plugin for reload
const ScopedDisabler sd(this);
@@ -486,7 +486,10 @@ public:
pData->param.createNew(params);

fParamBuffers = new float[params];
#ifdef USE_JUCE
FloatVectorOperations::clear(fParamBuffers, params);
#else
#endif
}

const uint portNameSize(pData->engine->getMaxPortNameSize());
@@ -504,7 +507,7 @@ public:
{
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -635,7 +638,7 @@ public:
stepSmall = 1.0f;
stepLarge = 1.0f;

pData->param.data[j].type = PARAMETER_LATENCY;
//pData->param.data[j].type = PARAMETER_LATENCY;
pData->param.data[j].hints = 0;
}
else if (std::strcmp(fDescriptor->PortNames[i], "_sample-rate") == 0)
@@ -645,7 +648,7 @@ public:
stepSmall = 1.0f;
stepLarge = 1.0f;

pData->param.data[j].type = PARAMETER_SAMPLE_RATE;
//pData->param.data[j].type = PARAMETER_SAMPLE_RATE;
pData->param.data[j].hints = 0;
}
else
@@ -701,7 +704,7 @@ public:
{
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -717,7 +720,7 @@ public:
{
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -760,8 +763,8 @@ public:
{
for (uint32_t i=0; i < pData->param.count; ++i)
{
if (pData->param.data[i].type != PARAMETER_LATENCY)
continue;
//if (pData->param.data[i].type != PARAMETER_LATENCY)
// continue;

// we need to pre-run the plugin so it can update its latency control-port

@@ -853,7 +856,12 @@ public:
{
// disable any output sound
for (uint32_t i=0; i < pData->audioOut.count; ++i)
{
#ifdef USE_JUCE
FloatVectorOperations::clear(outBuffer[i], frames);
#else
#endif
}

return;
}
@@ -866,7 +874,12 @@ public:
if (pData->latency > 0)
{
for (uint32_t i=0; i < pData->audioIn.count; ++i)
{
#ifdef USE_JUCE
FloatVectorOperations::clear(pData->latencyBuffers[i], pData->latency);
#else
#endif
}
}

pData->needsReset = false;
@@ -1098,9 +1111,20 @@ public:
// Reset audio buffers

for (uint32_t i=0; i < pData->audioIn.count; ++i)
{
#ifdef USE_JUCE
FloatVectorOperations::copy(fAudioInBuffers[i], inBuffer[i]+timeOffset, frames);
#else
#endif
}

for (uint32_t i=0; i < pData->audioOut.count; ++i)
{
#ifdef USE_JUCE
FloatVectorOperations::clear(fAudioOutBuffers[i], frames);
#else
#endif
}

// --------------------------------------------------------------------------------------------------------
// Run plugin
@@ -1147,7 +1171,10 @@ public:
if (isPair)
{
CARLA_ASSERT(i+1 < pData->audioOut.count);
#ifdef USE_JUCE
FloatVectorOperations::copy(oldBufLeft, fAudioOutBuffers[i], frames);
#else
#endif
}

float balRangeL = (pData->postProc.balanceLeft + 1.0f)/2.0f;
@@ -1500,7 +1527,7 @@ CarlaPlugin* CarlaPlugin::newLADSPA(const Initializer& init, const LADSPA_RDF_De

plugin->reload();

if (init.engine->getProccessMode() == PROCESS_MODE_CONTINUOUS_RACK && ! plugin->canRunInRack())
if (init.engine->getProccessMode() == ENGINE_PROCESS_MODE_CONTINUOUS_RACK && ! plugin->canRunInRack())
{
init.engine->setLastError("Carla's rack mode can only work with Mono or Stereo LADSPA plugins, sorry!");
delete plugin;


+ 16
- 6
source/backend/plugin/LinuxSamplerPlugin.cpp View File

@@ -333,7 +333,7 @@ public:
CARLA_SAFE_ASSERT_RETURN(fInstrument != nullptr,);
carla_debug("LinuxSamplerPlugin::reload() - start");

const ProcessMode processMode(pData->engine->getProccessMode());
const EngineProcessMode processMode(pData->engine->getProccessMode());

// Safely disable plugin for reload
const ScopedDisabler sd(this);
@@ -358,7 +358,7 @@ public:
// out-left
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -373,7 +373,7 @@ public:
// out-right
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -392,7 +392,7 @@ public:
{
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -479,7 +479,7 @@ public:
}
else
{
pData->engine->callback(CALLBACK_RELOAD_PROGRAMS, fId, 0, 0, 0.0f, nullptr);
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PROGRAMS, fId, 0, 0, 0.0f, nullptr);
}
}

@@ -511,7 +511,12 @@ public:
{
// disable any output sound
for (i=0; i < pData->audioOut.count; ++i)
{
#ifdef USE_JUCE
FloatVectorOperations::clear(outBuffer[i], frames);
#else
#endif
}

return;
}
@@ -879,7 +884,12 @@ public:
if (doBalance)
{
if (i % 2 == 0)
{
#ifdef USE_JUCE
FloatVectorOperations::copy(oldBufLeft, outBuffer[i], frames);
#else
#endif
}

float balRangeL = (pData->postProc.balanceLeft + 1.0f)/2.0f;
float balRangeR = (pData->postProc.balanceRight + 1.0f)/2.0f;
@@ -1132,7 +1142,7 @@ CarlaPlugin* LinuxSamplerPlugin::newLinuxSampler(const Initializer& init, const
{
carla_debug("LinuxSamplerPlugin::newLinuxSampler({%p, \"%s\", \"%s\", \"%s\"}, %s, %s)", init.engine, init.filename, init.name, init.label, bool2str(isGIG), bool2str(use16Outs));

if (init.engine->getProccessMode() == PROCESS_MODE_CONTINUOUS_RACK && use16Outs)
if (init.engine->getProccessMode() == ENGINE_PROCESS_MODE_CONTINUOUS_RACK && use16Outs)
{
init.engine->setLastError("Carla's rack mode can only work with Stereo modules, please choose the 2-channel only sample-library version");
return nullptr;


+ 56
- 34
source/backend/plugin/Lv2Plugin.cpp View File

@@ -401,7 +401,7 @@ public:

if (fUi.type == PLUGIN_UI_OSC)
{
pData->osc.thread.stopThread(pData->engine->getOptions().uiBridgesTimeout);
pData->osc.thread.stop(pData->engine->getOptions().uiBridgesTimeout);
}
else
{
@@ -503,7 +503,7 @@ public:
}
}

for (NonRtList<const char*>::Itenerator it = fCustomURIDs.begin(); it.valid(); it.next())
for (List<const char*>::Itenerator it = fCustomURIDs.begin(); it.valid(); it.next())
{
const char*& uri(*it);

@@ -641,7 +641,7 @@ public:
if (! (hasMidiIn || needsFixedBuffer()))
options |= PLUGIN_OPTION_FIXED_BUFFERS;

if (pData->engine->getProccessMode() != PROCESS_MODE_CONTINUOUS_RACK)
if (pData->engine->getProccessMode() != ENGINE_PROCESS_MODE_CONTINUOUS_RACK)
{
if (fOptions & PLUGIN_OPTION_FORCE_STEREO)
options |= PLUGIN_OPTION_FORCE_STEREO;
@@ -1075,7 +1075,7 @@ public:
{
if (yesNo)
{
pData->osc.thread.startThread();
pData->osc.thread.start();
}
else
{
@@ -1086,7 +1086,7 @@ public:
pData->osc.data.free();
}

pData->osc.thread.stopThread(pData->engine->getOptions().uiBridgesTimeout);
pData->osc.thread.stop(pData->engine->getOptions().uiBridgesTimeout);
}

return;
@@ -1136,8 +1136,8 @@ public:
{
fUi.handle = nullptr;
fUi.widget = nullptr;
pData->engine->callback(CALLBACK_ERROR, fId, 0, 0, 0.0f, "Plugin refused to open its own UI");
pData->engine->callback(CALLBACK_SHOW_GUI, fId, 0, 0, 0.0f, nullptr);
pData->engine->callback(ENGINE_CALLBACK_ERROR, fId, 0, 0, 0.0f, "Plugin refused to open its own UI");
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, fId, 0, 0, 0.0f, nullptr);
return;
}

@@ -1237,7 +1237,7 @@ public:
//if (! fAtomQueueOut.isEmpty())
{
Lv2AtomQueue tmpQueue;
tmpQueue.copyDataFrom(fAtomQueueOut);
tmpQueue.copyDataFromQueue(fAtomQueueOut);

uint32_t portIndex;
const LV2_Atom* atom;
@@ -1271,7 +1271,7 @@ public:
if (fExt.uiidle != nullptr && fExt.uiidle->idle(fUi.handle) != 0)
{
showGui(false);
pData->engine->callback(CALLBACK_SHOW_GUI, fId, 0, 0, 0.0f, nullptr);
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, fId, 0, 0, 0.0f, nullptr);
}
}

@@ -1289,7 +1289,7 @@ public:
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr,);
carla_debug("Lv2Plugin::reload() - start");

const ProcessMode processMode(pData->engine->getProccessMode());
const EngineProcessMode processMode(pData->engine->getProccessMode());

// Safely disable plugin for reload
const ScopedDisabler sd(this);
@@ -1304,7 +1304,7 @@ public:

uint32_t aIns, aOuts, cvIns, cvOuts, params, j;
aIns = aOuts = cvIns = cvOuts = params = 0;
NonRtList<unsigned int> evIns, evOuts;
List<unsigned int> evIns, evOuts;

bool forcedStereoIn, forcedStereoOut;
forcedStereoIn = forcedStereoOut = false;
@@ -1433,7 +1433,10 @@ public:
pData->param.createNew(params+cvIns+cvOuts);

fParamBuffers = new float[params+cvIns+cvOuts];
#ifdef USE_JUCE
FloatVectorOperations::clear(fParamBuffers, params+cvIns+cvOuts);
#else
#endif
}

if (evIns.count() > 0)
@@ -1511,7 +1514,7 @@ public:

if (LV2_IS_PORT_AUDIO(portTypes) || LV2_IS_PORT_ATOM_SEQUENCE(portTypes) || LV2_IS_PORT_CV(portTypes) || LV2_IS_PORT_EVENT(portTypes) || LV2_IS_PORT_MIDI_LL(portTypes))
{
if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -1944,16 +1947,16 @@ public:
stepSmall = 1.0f;
stepLarge = 1.0f;

pData->param.data[j].type = PARAMETER_SAMPLE_RATE;
//pData->param.data[j].type = PARAMETER_SAMPLE_RATE;
pData->param.data[j].hints = 0x0;
}
else if (LV2_IS_PORT_DESIGNATION_FREEWHEELING(portDesignation))
{
pData->param.data[j].type = PARAMETER_LV2_FREEWHEEL;
//pData->param.data[j].type = PARAMETER_LV2_FREEWHEEL;
}
else if (LV2_IS_PORT_DESIGNATION_TIME(portDesignation))
{
pData->param.data[j].type = PARAMETER_LV2_TIME;
//pData->param.data[j].type = PARAMETER_LV2_TIME;
}
else
{
@@ -1983,7 +1986,7 @@ public:
stepSmall = 1.0f;
stepLarge = 1.0f;

pData->param.data[j].type = PARAMETER_LATENCY;
//pData->param.data[j].type = PARAMETER_LATENCY;
pData->param.data[j].hints = 0x0;
}
else if (LV2_IS_PORT_DESIGNATION_SAMPLE_RATE(portDesignation))
@@ -1993,7 +1996,7 @@ public:
stepSmall = 1.0f;
stepLarge = 1.0f;

pData->param.data[j].type = PARAMETER_SAMPLE_RATE;
//pData->param.data[j].type = PARAMETER_SAMPLE_RATE;
pData->param.data[j].hints = 0x0;
}
else if (LV2_IS_PORT_DESIGNATION_FREEWHEELING(portDesignation))
@@ -2002,7 +2005,7 @@ public:
}
else if (LV2_IS_PORT_DESIGNATION_TIME(portDesignation))
{
pData->param.data[j].type = PARAMETER_LV2_TIME;
//pData->param.data[j].type = PARAMETER_LV2_TIME;
}
else
{
@@ -2047,10 +2050,10 @@ public:
pData->param.ranges[j].stepLarge = stepLarge;

// Start parameters in their default values
if (pData->param.data[j].type != PARAMETER_LV2_FREEWHEEL)
//if (pData->param.data[j].type != PARAMETER_LV2_FREEWHEEL)
fParamBuffers[j] = def;
else
fParamBuffers[j] = min;
//else
// fParamBuffers[j] = min;

fDescriptor->connect_port(fHandle, i, &fParamBuffers[j]);

@@ -2071,7 +2074,7 @@ public:
{
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -2087,7 +2090,7 @@ public:
{
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -2281,7 +2284,7 @@ public:
if (programChanged)
setMidiProgram(pData->midiprog.current, true, true, true);

pData->engine->callback(CALLBACK_RELOAD_PROGRAMS, fId, 0, 0, 0.0f, nullptr);
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PROGRAMS, fId, 0, 0, 0.0f, nullptr);
}
}

@@ -2329,7 +2332,12 @@ public:
{
// disable any output sound
for (i=0; i < pData->audioOut.count; ++i)
{
#ifdef USE_JUCE
FloatVectorOperations::clear(outBuffer[i], frames);
#else
#endif
}

return;
}
@@ -2464,7 +2472,7 @@ public:
// update input ports
for (k=0; k < pData->param.count; ++k)
{
if (pData->param.data[k].type != PARAMETER_LV2_TIME)
//if (pData->param.data[k].type != PARAMETER_LV2_TIME)
continue;

doPostRt = false;
@@ -3137,9 +3145,20 @@ public:
// Reset audio buffers

for (i=0; i < pData->audioIn.count; ++i)
{
#ifdef USE_JUCE
FloatVectorOperations::copy(fAudioInBuffers[i], inBuffer[i]+timeOffset, frames);
#else
#endif
}

for (i=0; i < pData->audioOut.count; ++i)
{
#ifdef USE_JUCE
FloatVectorOperations::clear(fAudioOutBuffers[i], frames);
#else
#endif
}

// --------------------------------------------------------------------------------------------------------
// Set CV input buffers
@@ -3221,7 +3240,10 @@ public:
if (isPair)
{
CARLA_ASSERT(i+1 < pData->audioOut.count);
#ifdef USE_JUCE
FloatVectorOperations::copy(oldBufLeft, fAudioOutBuffers[i], frames);
#else
#endif
}

float balRangeL = (pData->postProc.balanceLeft + 1.0f)/2.0f;
@@ -3400,7 +3422,7 @@ public:

for (uint32_t k=0; k < pData->param.count; ++k)
{
if (pData->param.data[k].type == PARAMETER_SAMPLE_RATE)
//if (pData->param.data[k].type == PARAMETER_SAMPLE_RATE)
{
fParamBuffers[k] = newSampleRate;
pData->postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(k), 1, fParamBuffers[k]);
@@ -3414,7 +3436,7 @@ public:
{
for (uint32_t k=0; k < pData->param.count; ++k)
{
if (pData->param.data[k].type == PARAMETER_LV2_FREEWHEEL)
//if (pData->param.data[k].type == PARAMETER_LV2_FREEWHEEL)
{
fParamBuffers[k] = isOffline ? pData->param.ranges[k].max : pData->param.ranges[k].min;
pData->postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(k), 1, fParamBuffers[k]);
@@ -3683,9 +3705,9 @@ protected:
pData->midiprog.data[index].name = carla_strdup(progDesc->name ? progDesc->name : "");

if (index == pData->midiprog.current)
pData->engine->callback(CALLBACK_UPDATE, fId, 0, 0, 0.0, nullptr);
pData->engine->callback(ENGINE_CALLBACK_UPDATE, fId, 0, 0, 0.0, nullptr);
else
pData->engine->callback(CALLBACK_RELOAD_PROGRAMS, fId, 0, 0, 0.0, nullptr);
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PROGRAMS, fId, 0, 0, 0.0, nullptr);
}
}
}
@@ -3735,7 +3757,7 @@ protected:
}

// Check if we already have this key
for (NonRtList<CustomData>::Itenerator it = pData->custom.begin(); it.valid(); it.next())
for (List<CustomData>::Itenerator it = pData->custom.begin(); it.valid(); it.next())
{
CustomData& data(*it);

@@ -3797,7 +3819,7 @@ protected:
const char* stype = nullptr;
const char* stringData = nullptr;

for (NonRtList<CustomData>::Itenerator it = pData->custom.begin(); it.valid(); it.next())
for (List<CustomData>::Itenerator it = pData->custom.begin(); it.valid(); it.next())
{
CustomData& data(*it);

@@ -3881,7 +3903,7 @@ protected:

fUi.handle = nullptr;
fUi.widget = nullptr;
pData->engine->callback(CALLBACK_SHOW_GUI, fId, 0, 0, 0.0f, nullptr);
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, fId, 0, 0, 0.0f, nullptr);
}

uint32_t handleUiPortMap(const char* const symbol)
@@ -4847,7 +4869,7 @@ private:
Lv2PluginEventData fEventsOut;
Lv2PluginOptions fLv2Options;

NonRtList<const char*> fCustomURIDs;
List<const char*> fCustomURIDs;

bool fFirstActive; // first process() call after activate()
EngineTimeInfo fLastTimeInfo;
@@ -5450,7 +5472,7 @@ CarlaPlugin* CarlaPlugin::newLV2(const Initializer& init)

plugin->reload();

if (init.engine->getProccessMode() == PROCESS_MODE_CONTINUOUS_RACK && ! plugin->canRunInRack())
if (init.engine->getProccessMode() == ENGINE_PROCESS_MODE_CONTINUOUS_RACK && ! plugin->canRunInRack())
{
init.engine->setLastError("Carla's rack mode can only work with Mono or Stereo LV2 plugins, sorry!");
delete plugin;


+ 50
- 31
source/backend/plugin/NativePlugin.cpp View File

@@ -233,7 +233,7 @@ public:
if (const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId))
return param->scalePointCount;

carla_assert("const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)", __FILE__, __LINE__);
carla_safe_assert("const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)", __FILE__, __LINE__);
return 0;
}

@@ -259,7 +259,7 @@ public:
if (getMidiInCount() == 0 && (fDescriptor->hints & ::PLUGIN_NEEDS_FIXED_BUFFERS) == 0)
options |= PLUGIN_OPTION_FIXED_BUFFERS;

if (pData->engine->getProccessMode() != PROCESS_MODE_CONTINUOUS_RACK)
if (pData->engine->getProccessMode() != ENGINE_PROCESS_MODE_CONTINUOUS_RACK)
{
if (fOptions & PLUGIN_OPTION_FORCE_STEREO)
options |= PLUGIN_OPTION_FORCE_STEREO;
@@ -305,7 +305,7 @@ public:
return scalePoint->value;
}

carla_assert("const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)", __FILE__, __LINE__);
carla_safe_assert("const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)", __FILE__, __LINE__);
return 0.0f;
}

@@ -363,11 +363,11 @@ public:
std::strncpy(strBuf, param->name, STR_MAX);
return;
}
carla_assert("param->name != nullptr", __FILE__, __LINE__);
carla_safe_assert("param->name != nullptr", __FILE__, __LINE__);
return CarlaPlugin::getParameterName(parameterId, strBuf);
}

carla_assert("const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)", __FILE__, __LINE__);
carla_safe_assert("const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)", __FILE__, __LINE__);
CarlaPlugin::getParameterName(parameterId, strBuf);
}

@@ -387,7 +387,7 @@ public:
return;
}

carla_assert("const char* const text = fDescriptor->get_parameter_text(fHandle, parameterId, value)", __FILE__, __LINE__);
carla_safe_assert("const char* const text = fDescriptor->get_parameter_text(fHandle, parameterId, value)", __FILE__, __LINE__);
CarlaPlugin::getParameterText(parameterId, strBuf);
}

@@ -408,7 +408,7 @@ public:
return CarlaPlugin::getParameterUnit(parameterId, strBuf);
}

carla_assert("const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)", __FILE__, __LINE__);
carla_safe_assert("const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)", __FILE__, __LINE__);
CarlaPlugin::getParameterUnit(parameterId, strBuf);
}

@@ -429,11 +429,11 @@ public:
std::strncpy(strBuf, scalePoint->label, STR_MAX);
return;
}
carla_assert("scalePoint->label != nullptr", __FILE__, __LINE__);
carla_safe_assert("scalePoint->label != nullptr", __FILE__, __LINE__);
return CarlaPlugin::getParameterScalePointLabel(parameterId, scalePointId, strBuf);
}

carla_assert("const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)", __FILE__, __LINE__);
carla_safe_assert("const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)", __FILE__, __LINE__);
CarlaPlugin::getParameterScalePointLabel(parameterId, scalePointId, strBuf);
}

@@ -455,7 +455,7 @@ public:
fCurMidiProgs[12], fCurMidiProgs[13], fCurMidiProgs[14], fCurMidiProgs[15]);
strBuf[STR_MAX] = '\0';

CarlaPlugin::setCustomData(CUSTOM_DATA_STRING, "midiPrograms", strBuf, false);
CarlaPlugin::setCustomData(CUSTOM_DATA_TYPE_STRING, "midiPrograms", strBuf, false);
}

if (fDescriptor == nullptr || fDescriptor->get_state == nullptr || (fDescriptor->hints & ::PLUGIN_USES_STATE) == 0)
@@ -463,7 +463,7 @@ public:

if (char* data = fDescriptor->get_state(fHandle))
{
CarlaPlugin::setCustomData(CUSTOM_DATA_CHUNK, "State", data, false);
CarlaPlugin::setCustomData(CUSTOM_DATA_TYPE_CHUNK, "State", data, false);
std::free(data);
}
}
@@ -528,10 +528,10 @@ public:
CARLA_SAFE_ASSERT_RETURN(value != nullptr,);
carla_debug("NativePlugin::setCustomData(%s, %s, %s, %s)", type, key, value, bool2str(sendGui));

if (std::strcmp(type, CUSTOM_DATA_STRING) != 0 && std::strcmp(type, CUSTOM_DATA_CHUNK) != 0)
if (std::strcmp(type, CUSTOM_DATA_TYPE_STRING) != 0 && std::strcmp(type, CUSTOM_DATA_TYPE_CHUNK) != 0)
return carla_stderr2("NativePlugin::setCustomData(\"%s\", \"%s\", \"%s\", %s) - type is invalid", type, key, value, bool2str(sendGui));

if (std::strcmp(type, CUSTOM_DATA_CHUNK) == 0)
if (std::strcmp(type, CUSTOM_DATA_TYPE_CHUNK) == 0)
{
if (fDescriptor->set_state != nullptr && (fDescriptor->hints & ::PLUGIN_USES_STATE) != 0)
{
@@ -571,7 +571,7 @@ public:
if (pData->ctrlChannel == static_cast<int32_t>(i))
{
pData->midiprog.current = index;
pData->engine->callback(CALLBACK_MIDI_PROGRAM_CHANGED, fId, index, 0, 0.0f, nullptr);
pData->engine->callback(ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED, fId, index, 0, 0.0f, nullptr);
}
}

@@ -644,11 +644,11 @@ public:

if (fDescriptor->ui_set_custom_data != nullptr)
{
for (NonRtList<CustomData>::Itenerator it = pData->custom.begin(); it.valid(); it.next())
for (List<CustomData>::Itenerator it = pData->custom.begin(); it.valid(); it.next())
{
const CustomData& cData(*it);

if (std::strcmp(cData.type, CUSTOM_DATA_STRING) == 0 && std::strcmp(cData.key, "midiPrograms") != 0)
if (std::strcmp(cData.type, CUSTOM_DATA_TYPE_STRING) == 0 && std::strcmp(cData.key, "midiPrograms") != 0)
fDescriptor->ui_set_custom_data(fHandle, cData.key, cData.value);
}
}
@@ -689,7 +689,7 @@ public:
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,);
carla_debug("NativePlugin::reload() - start");

const ProcessMode processMode(pData->engine->getProccessMode());
const EngineProcessMode processMode(pData->engine->getProccessMode());

// Safely disable plugin for reload
const ScopedDisabler sd(this);
@@ -780,7 +780,7 @@ public:
{
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -813,7 +813,7 @@ public:
{
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -848,7 +848,7 @@ public:
{
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -870,7 +870,7 @@ public:
{
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -996,7 +996,7 @@ public:
{
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -1012,7 +1012,7 @@ public:
{
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -1151,7 +1151,7 @@ public:
if (programChanged)
setMidiProgram(pData->midiprog.current, true, true, true);

pData->engine->callback(CALLBACK_RELOAD_PROGRAMS, fId, 0, 0, 0.0f, nullptr);
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PROGRAMS, fId, 0, 0, 0.0f, nullptr);
}
}

@@ -1197,7 +1197,12 @@ public:
{
// disable any output sound
for (i=0; i < pData->audioOut.count; ++i)
{
#ifdef USE_JUCE
FloatVectorOperations::clear(outBuffer[i], frames);
#else
#endif
}

return;
}
@@ -1684,9 +1689,20 @@ public:
// Reset audio buffers

for (i=0; i < pData->audioIn.count; ++i)
{
#ifdef USE_JUCE
FloatVectorOperations::copy(fAudioInBuffers[i], inBuffer[i]+timeOffset, frames);
#else
#endif
}

for (i=0; i < pData->audioOut.count; ++i)
{
#ifdef USE_JUCE
FloatVectorOperations::clear(fAudioOutBuffers[i], frames);
#else
#endif
}

// --------------------------------------------------------------------------------------------------------
// Run plugin
@@ -1744,7 +1760,10 @@ public:
if (isPair)
{
CARLA_ASSERT(i+1 < pData->audioOut.count);
#ifdef USE_JUCE
FloatVectorOperations::copy(oldBufLeft, fAudioOutBuffers[i], frames);
#else
#endif
}

float balRangeL = (pData->postProc.balanceLeft + 1.0f)/2.0f;
@@ -2040,12 +2059,12 @@ protected:

void handleUiCustomDataChanged(const char* const key, const char* const value)
{
setCustomData(CUSTOM_DATA_STRING, key, value, false);
setCustomData(CUSTOM_DATA_TYPE_STRING, key, value, false);
}

void handleUiClosed()
{
pData->engine->callback(CALLBACK_SHOW_GUI, fId, 0, 0, 0.0f, nullptr);
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, fId, 0, 0, 0.0f, nullptr);
fIsUiVisible = false;
}

@@ -2123,7 +2142,7 @@ protected:
case ::HOST_OPCODE_RELOAD_ALL:
break;
case HOST_OPCODE_UI_UNAVAILABLE:
pData->engine->callback(CALLBACK_SHOW_GUI, fId, -1, 0, 0.0f, nullptr);
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, fId, -1, 0, 0.0f, nullptr);
break;
}

@@ -2185,7 +2204,7 @@ public:
// ---------------------------------------------------------------
// get descriptor that matches label

for (NonRtList<const ::PluginDescriptor*>::Itenerator it = sPluginDescriptors.begin(); it.valid(); it.next())
for (List<const ::PluginDescriptor*>::Itenerator it = sPluginDescriptors.begin(); it.valid(); it.next())
{
fDescriptor = *it;

@@ -2343,7 +2362,7 @@ private:

::TimeInfo fTimeInfo;

static NonRtList<const ::PluginDescriptor*> sPluginDescriptors;
static List<const ::PluginDescriptor*> sPluginDescriptors;

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

@@ -2409,7 +2428,7 @@ private:
CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(NativePlugin)
};

NonRtList<const ::PluginDescriptor*> NativePlugin::sPluginDescriptors;
List<const ::PluginDescriptor*> NativePlugin::sPluginDescriptors;

static const NativePlugin::ScopedInitializer _si;

@@ -2458,7 +2477,7 @@ CarlaPlugin* CarlaPlugin::newNative(const Initializer& init)

plugin->reload();

if (init.engine->getProccessMode() == PROCESS_MODE_CONTINUOUS_RACK && ! plugin->canRunInRack())
if (init.engine->getProccessMode() == ENGINE_PROCESS_MODE_CONTINUOUS_RACK && ! plugin->canRunInRack())
{
init.engine->setLastError("Carla's rack mode can only work with Mono or Stereo Internal plugins, sorry!");
delete plugin;


+ 30
- 12
source/backend/plugin/VstPlugin.cpp View File

@@ -78,7 +78,7 @@ public:

if (fGui.isOsc)
{
pData->osc.thread.stopThread(pData->engine->getOptions().uiBridgesTimeout);
pData->osc.thread.stop(pData->engine->getOptions().uiBridgesTimeout);
}
}

@@ -372,7 +372,7 @@ public:
{
if (yesNo)
{
pData->osc.thread.startThread();
pData->osc.thread.start();
}
else
{
@@ -383,7 +383,7 @@ public:
pData->osc.data.free();
}

pData->osc.thread.stopThread(pData->engine->getOptions().uiBridgesTimeout);
pData->osc.thread.stop(pData->engine->getOptions().uiBridgesTimeout);
}
}
else
@@ -498,7 +498,7 @@ public:
CARLA_SAFE_ASSERT_RETURN(fEffect != nullptr,);
carla_debug("VstPlugin::reload() - start");

const ProcessMode processMode(pData->engine->getProccessMode());
const EngineProcessMode processMode(pData->engine->getProccessMode());

// Safely disable plugin for reload
const ScopedDisabler sd(this);
@@ -558,7 +558,7 @@ public:
{
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -583,7 +583,7 @@ public:
{
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -749,7 +749,7 @@ public:
{
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -765,7 +765,7 @@ public:
{
portName.clear();

if (processMode == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT)
{
portName = fName;
portName += ":";
@@ -961,7 +961,7 @@ public:
dispatcher(effSetProgram, 0, pData->prog.current, nullptr, 0.0f);
}

pData->engine->callback(CALLBACK_RELOAD_PROGRAMS, fId, 0, 0, 0.0f, nullptr);
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PROGRAMS, fId, 0, 0, 0.0f, nullptr);
}
}

@@ -991,7 +991,12 @@ public:
{
// disable any output sound
for (i=0; i < pData->audioOut.count; ++i)
{
#ifdef USE_JUCE
FloatVectorOperations::clear(outBuffer[i], frames);
#else
#endif
}

return;
}
@@ -1037,7 +1042,12 @@ public:
if (pData->latency > 0)
{
for (i=0; i < pData->audioIn.count; ++i)
{
#ifdef USE_JUCE
FloatVectorOperations::clear(pData->latencyBuffers[i], pData->latency);
#else
#endif
}
}

pData->needsReset = false;
@@ -1512,7 +1522,12 @@ public:
else
{
for (i=0; i < pData->audioOut.count; ++i)
{
#ifdef USE_JUCE
FloatVectorOperations::clear(vstOutBuffer[i], frames);
#else
#endif
}

#if ! VST_FORCE_DEPRECATED
fEffect->process(fEffect,
@@ -1557,7 +1572,10 @@ public:
if (isPair)
{
CARLA_ASSERT(i+1 < pData->audioOut.count);
#ifdef USE_JUCE
FloatVectorOperations::copy(oldBufLeft, outBuffer[i]+timeOffset, frames);
#else
#endif
}

float balRangeL = (pData->postProc.balanceLeft + 1.0f)/2.0f;
@@ -2080,12 +2098,12 @@ protected:
if (pData->prog.current != current)
{
pData->prog.current = current;
pData->engine->callback(CALLBACK_PROGRAM_CHANGED, fId, current, 0, 0.0f, nullptr);
pData->engine->callback(ENGINE_CALLBACK_PROGRAM_CHANGED, fId, current, 0, 0.0f, nullptr);
}
}
}

pData->engine->callback(CALLBACK_UPDATE, fId, 0, 0, 0.0f, nullptr);
pData->engine->callback(ENGINE_CALLBACK_UPDATE, fId, 0, 0, 0.0f, nullptr);
ret = 1;
break;

@@ -2542,7 +2560,7 @@ CarlaPlugin* CarlaPlugin::newVST(const Initializer& init)

plugin->reload();

if (init.engine->getProccessMode() == PROCESS_MODE_CONTINUOUS_RACK && ! plugin->canRunInRack())
if (init.engine->getProccessMode() == ENGINE_PROCESS_MODE_CONTINUOUS_RACK && ! plugin->canRunInRack())
{
init.engine->setLastError("Carla's rack mode can only work with Stereo VST plugins, sorry!");
delete plugin;


+ 4
- 4
source/modules/carla_native/Makefile View File

@@ -79,10 +79,10 @@ OBJS += \
nekofilter.c.o

# Simple plugins (C++)
OBJS += \
vex-fx.cpp.o \
vex-synth.cpp.o \
vex-src.cpp.o
# OBJS += \
# vex-fx.cpp.o \
# vex-synth.cpp.o \
# vex-src.cpp.o

# AudioFile
ifeq ($(HAVE_AF_DEPS),true)


+ 4
- 4
source/modules/carla_native/_all.c View File

@@ -28,8 +28,8 @@ extern void carla_register_native_plugin_nekofilter();

// Simple plugins (C++)
extern void carla_register_native_plugin_sunvoxfile();
extern void carla_register_native_plugin_vex_fx();
extern void carla_register_native_plugin_vex_synth();
//extern void carla_register_native_plugin_vex_fx();
//extern void carla_register_native_plugin_vex_synth();

// Carla
extern void carla_register_native_plugin_carla();
@@ -77,8 +77,8 @@ void carla_register_all_plugins()

// Simple plugins (C++)
//carla_register_native_plugin_sunvoxfile(); // unfinished
carla_register_native_plugin_vex_fx();
carla_register_native_plugin_vex_synth();
//carla_register_native_plugin_vex_fx();
//carla_register_native_plugin_vex_synth();

// Carla
//carla_register_native_plugin_carla(); // kinda unfinished


+ 27
- 10
source/modules/carla_native/audio-base.hpp View File

@@ -18,12 +18,12 @@
#ifndef AUDIO_BASE_HPP_INCLUDED
#define AUDIO_BASE_HPP_INCLUDED

#include "CarlaMutex.hpp"
#include "CarlaThread.hpp"

#ifdef USE_JUCE
#include "juce_audio_basics.h"

using juce::FloatVectorOperations;
using juce::Thread;
#endif

extern "C" {
#include "audio_decoder/ad.h"
@@ -100,8 +100,14 @@ struct AudioFilePool {
CARLA_ASSERT(size != 0);

startFrame = 0;

#ifdef USE_JUCE
FloatVectorOperations::clear(buffer[0], size);
FloatVectorOperations::clear(buffer[1], size);
#else
carla_zeroFloat(buffer[0], size);
carla_zeroFloat(buffer[1], size);
#endif
}
};

@@ -112,11 +118,11 @@ public:
virtual uint32_t getLastFrame() const = 0;
};

class AudioFileThread : public Thread
class AudioFileThread : public CarlaThread
{
public:
AudioFileThread(AbstractAudioPlayer* const player, const double sampleRate)
: Thread("AudioFileThread"),
: CarlaThread("AudioFileThread"),
kPlayer(player),
fNeedsRead(false),
fFilePtr(nullptr)
@@ -138,7 +144,7 @@ public:

~AudioFileThread() override
{
CARLA_ASSERT(! isThreadRunning());
CARLA_ASSERT(! isRunning());

if (fFilePtr != nullptr)
ad_close(fFilePtr);
@@ -149,13 +155,13 @@ public:
void startNow()
{
fNeedsRead = true;
startThread(2);
start();
}

void stopNow()
{
fNeedsRead = false;
stopThread(1000);
stop(1000);

const CarlaMutex::ScopedLocker sl(fMutex);
fPool.reset();
@@ -173,7 +179,7 @@ public:

bool loadFilename(const char* const filename)
{
CARLA_ASSERT(! isThreadRunning());
CARLA_ASSERT(! isRunning());
CARLA_ASSERT(filename != nullptr);

fPool.startFrame = 0;
@@ -226,8 +232,14 @@ public:
//if (pool.startFrame != fPool.startFrame || pool.buffer[0] != fPool.buffer[0] || pool.buffer[1] != fPool.buffer[1])
{
pool.startFrame = fPool.startFrame;

#ifdef USE_JUCE
FloatVectorOperations::copy(pool.buffer[0], fPool.buffer[0], fPool.size);
FloatVectorOperations::copy(pool.buffer[1], fPool.buffer[1], fPool.size);
#else
carla_copyFloat(pool.buffer[0], fPool.buffer[0], fPool.size);
carla_copyFloat(pool.buffer[1], fPool.buffer[1], fPool.size);
#endif
}

fMutex.unlock();
@@ -277,7 +289,12 @@ public:
const size_t tmpSize = fPool.size * fFileNfo.channels;

float tmpData[tmpSize];

#ifdef USE_JUCE
FloatVectorOperations::clear(tmpData, tmpSize);
#else
carla_zeroFloat(tmpData, tmpSize);
#endif

{
carla_stderr("R: poll data - reading at %li:%02li", readFrame/44100/60, (readFrame/44100) % 60);
@@ -359,7 +376,7 @@ public:
protected:
void run() override
{
while (! threadShouldExit())
while (! shouldExit())
{
const uint32_t lastFrame(kPlayer->getLastFrame());



+ 16
- 0
source/modules/carla_native/audio-file.cpp View File

@@ -127,8 +127,14 @@ protected:
{
//carla_stderr("P: no process");
fLastFrame = timePos->frame;

#ifdef USE_JUCE
FloatVectorOperations::clear(out1, frames);
FloatVectorOperations::clear(out2, frames);
#else
carla_zeroFloat(out1, frames);
carla_zeroFloat(out2, frames);
#endif
return;
}

@@ -141,8 +147,13 @@ protected:
if (timePos->frame == 0 && fLastFrame > 0)
fThread.setNeedsRead();

#ifdef USE_JUCE
FloatVectorOperations::clear(out1, frames);
FloatVectorOperations::clear(out2, frames);
#else
carla_zeroFloat(out1, frames);
carla_zeroFloat(out2, frames);
#endif
return;
}

@@ -157,8 +168,13 @@ protected:
if (timePos->frame + frames < fPool.startFrame)
fThread.setNeedsRead();

#ifdef USE_JUCE
FloatVectorOperations::clear(out1, frames);
FloatVectorOperations::clear(out2, frames);
#else
carla_zeroFloat(out1, frames);
carla_zeroFloat(out2, frames);
#endif
return;
}



+ 4
- 4
source/modules/carla_native/midi-base.hpp View File

@@ -20,7 +20,7 @@

#include "CarlaMIDI.h"
#include "CarlaMutex.hpp"
#include "RtList.hpp"
#include "List.hpp"

#define MAX_EVENT_DATA_SIZE 4
#define MIN_PREALLOCATED_EVENT_COUNT 100
@@ -180,7 +180,7 @@ public:
if (! fMutex.tryLock())
return;

for (NonRtList<const RawMidiEvent*>::Itenerator it = fData.begin(); it.valid(); it.next())
for (List<const RawMidiEvent*>::Itenerator it = fData.begin(); it.valid(); it.next())
{
const RawMidiEvent* const rawMidiEvent(*it);

@@ -208,7 +208,7 @@ private:
uint32_t fDuration; // unused

CarlaMutex fMutex;
NonRtList<const RawMidiEvent*> fData;
List<const RawMidiEvent*> fData;

void append(const RawMidiEvent* const event)
{
@@ -219,7 +219,7 @@ private:
return;
}

for (NonRtList<const RawMidiEvent*>::Itenerator it = fData.begin(); it.valid(); it.next())
for (List<const RawMidiEvent*>::Itenerator it = fData.begin(); it.valid(); it.next())
{
const RawMidiEvent* const oldEvent(*it);



+ 11
- 2
source/modules/carla_native/zynaddsubfx-fx.cpp View File

@@ -25,9 +25,10 @@
#include "zynaddsubfx/Effects/Phaser.h"
#include "zynaddsubfx/Effects/Reverb.h"

#ifdef USE_JUCE
#include "juce_audio_basics.h"

using juce::FloatVectorOperations;
#endif

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

@@ -46,8 +47,11 @@ protected:
const uint32_t bufferSize(getBufferSize());
efxoutl = new float[bufferSize];
efxoutr = new float[bufferSize];
#ifdef USE_JUCE
FloatVectorOperations::clear(efxoutl, bufferSize);
FloatVectorOperations::clear(efxoutr, bufferSize);
#else
#endif
}

~FxAbstractPlugin() override
@@ -135,8 +139,11 @@ protected:
{
fEffect->out(Stereo<float*>(inBuffer[0], inBuffer[1]));

#ifdef USE_JUCE
FloatVectorOperations::copy(outBuffer[0], efxoutl, frames);
FloatVectorOperations::copy(outBuffer[1], efxoutr, frames);
#else
#endif
}

// -------------------------------------------------------------------
@@ -148,9 +155,11 @@ protected:
delete[] efxoutr;
efxoutl = new float[bufferSize];
efxoutr = new float[bufferSize];
#ifdef USE_JUCE
FloatVectorOperations::clear(efxoutl, bufferSize);
FloatVectorOperations::clear(efxoutr, bufferSize);

#else
#endif
doReinit(bufferSize, getSampleRate());
}



+ 17
- 11
source/modules/carla_native/zynaddsubfx-synth.cpp View File

@@ -21,8 +21,8 @@

#include "CarlaNative.hpp"
#include "CarlaMIDI.h"
#include "CarlaString.hpp"
#include "RtList.hpp"
#include "CarlaThread.hpp"
#include "List.hpp"

#include "zynaddsubfx/DSP/FFTwrapper.h"
#include "zynaddsubfx/Misc/Master.h"
@@ -51,9 +51,10 @@
#include <set>
#include <string>

#ifdef USE_JUCE
#include "juce_audio_basics.h"

using juce::FloatVectorOperations;
#endif

#ifdef WANT_ZYNADDSUBFX_UI
static Fl_Tiled_Image* gModuleBackdrop = nullptr;
@@ -218,7 +219,7 @@ private:

bool fInitiated;
MidiProgram fRetProgram;
NonRtList<const ProgramInfo*> fPrograms;
List<const ProgramInfo*> fPrograms;

CARLA_DECLARE_NON_COPY_CLASS(ZynAddSubFxPrograms)
};
@@ -331,11 +332,11 @@ static ZynAddSubFxInstanceCount sInstanceCount;

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

class ZynAddSubFxThread : public juce::Thread
class ZynAddSubFxThread : public CarlaThread
{
public:
ZynAddSubFxThread(Master* const master, const HostDescriptor* const host)
: juce::Thread("ZynAddSubFxThread"),
: CarlaThread("ZynAddSubFxThread"),
fMaster(master),
kHost(host),
#ifdef WANT_ZYNADDSUBFX_UI
@@ -410,7 +411,7 @@ public:
protected:
void run() override
{
while (! threadShouldExit())
while (! shouldExit())
{
#ifdef WANT_ZYNADDSUBFX_UI
Fl::lock();
@@ -509,7 +510,7 @@ protected:
}

#ifdef WANT_ZYNADDSUBFX_UI
if (threadShouldExit() || fUi != nullptr)
if (shouldExit() || fUi != nullptr)
{
Fl::lock();
delete fUi;
@@ -548,7 +549,7 @@ public:
fIsActive(false),
fThread(fMaster, host)
{
fThread.startThread(3);
fThread.start();

for (int i = 0; i < NUM_MIDI_PARTS; ++i)
fMaster->partonoff(i, 1);
@@ -624,8 +625,13 @@ protected:
{
if (pthread_mutex_trylock(&fMaster->mutex) != 0)
{
#ifdef USE_JUCE
FloatVectorOperations::clear(outBuffer[0], frames);
FloatVectorOperations::clear(outBuffer[1], frames);
#else
carla_zeroFloat(outBuffer[0], frames);
carla_zeroFloat(outBuffer[1], frames);
#endif
return;
}

@@ -734,7 +740,7 @@ protected:
{
fMaster = new Master();
fThread.setMaster(fMaster);
fThread.startThread(3);
fThread.start();

for (int i = 0; i < NUM_MIDI_PARTS; ++i)
fMaster->partonoff(i, 1);
@@ -745,7 +751,7 @@ protected:
//ensure that everything has stopped
pthread_mutex_lock(&fMaster->mutex);
pthread_mutex_unlock(&fMaster->mutex);
fThread.stopThread(-1);
fThread.stop(-1);

delete fMaster;
fMaster = nullptr;


+ 63
- 0
source/utils/CarlaJuceUtils.hpp View File

@@ -130,4 +130,67 @@ private:
}
};

//==============================================================================
/**
Helper class providing an RAII-based mechanism for temporarily setting and
then re-setting a value.

E.g. @code
int x = 1;

{
ScopedValueSetter setter (x, 2);

// x is now 2
}

// x is now 1 again

{
ScopedValueSetter setter (x, 3, 4);

// x is now 3
}

// x is now 4
@endcode
*/
template <typename ValueType>
class ScopedValueSetter
{
public:
/** Creates a ScopedValueSetter that will immediately change the specified value to the
given new value, and will then reset it to its original value when this object is deleted.
*/
ScopedValueSetter(ValueType& valueToSet, ValueType newValue)
: value(valueToSet),
originalValue(valueToSet)
{
valueToSet = newValue;
}

/** Creates a ScopedValueSetter that will immediately change the specified value to the
given new value, and will then reset it to be valueWhenDeleted when this object is deleted.
*/
ScopedValueSetter(ValueType& valueToSet, ValueType newValue, ValueType valueWhenDeleted)
: value(valueToSet),
originalValue(valueWhenDeleted)
{
valueToSet = newValue;
}

~ScopedValueSetter()
{
value = originalValue;
}

private:
//==============================================================================
ValueType& value;
const ValueType originalValue;

CARLA_DECLARE_NON_COPY_CLASS(ScopedValueSetter)
CARLA_PREVENT_HEAP_ALLOCATION
};

#endif // CARLA_JUCE_UTILS_HPP_INCLUDED

+ 6
- 0
source/utils/CarlaLv2Utils.hpp View File

@@ -61,7 +61,9 @@
#include "lilv/lilvmm.hpp"
#include "sratom/sratom.h"

#ifdef USE_JUCE
#include "juce_core.h"
#endif

// -----------------------------------------------------------------------
// Define namespaces and missing prefixes
@@ -550,6 +552,7 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri, const bool fillPresets)

if (replaceNode.is_uri())
{
#ifdef USE_JUCE
const juce::String replaceURI(replaceNode.as_uri());

if (replaceURI.startsWith("urn:"))
@@ -557,6 +560,7 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri, const bool fillPresets)
if (int uniqueId = replaceURI.getTrailingIntValue())
rdfDescriptor->UniqueID = (unsigned long)uniqueId;
}
#endif
}
}
}
@@ -1003,6 +1007,7 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri, const bool fillPresets)
}
}

#ifdef USE_JUCE
// -------------------------------------------------------------------
// Set Plugin Presets

@@ -1065,6 +1070,7 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri, const bool fillPresets)
}
}
}
#endif

// -------------------------------------------------------------------
// Set Plugin Features


Loading…
Cancel
Save