Browse Source

Merge branch 'rework'

Conflicts:
	source/native-plugins/Makefile
tags/1.9.7
falkTX 9 years ago
parent
commit
eadc8d326c
35 changed files with 738 additions and 703 deletions
  1. +1
    -0
      Makefile
  2. +1
    -1
      source/backend/engine/CarlaEngineClient.cpp
  3. +19
    -19
      source/backend/engine/CarlaEngineGraph.cpp
  4. +8
    -8
      source/backend/engine/CarlaEngineJack.cpp
  5. +8
    -8
      source/backend/engine/CarlaEngineJuce.cpp
  6. +9
    -11
      source/backend/engine/CarlaEngineRtAudio.cpp
  7. +10
    -10
      source/backend/plugin/CarlaPlugin.cpp
  8. +1
    -1
      source/backend/plugin/CarlaPluginBridge.cpp
  9. +357
    -286
      source/backend/plugin/CarlaPluginDSSI.cpp
  10. +1
    -1
      source/backend/plugin/CarlaPluginFluidSynth.cpp
  11. +1
    -1
      source/backend/plugin/CarlaPluginInternal.cpp
  12. +1
    -1
      source/backend/plugin/CarlaPluginJuce.cpp
  13. +24
    -22
      source/backend/plugin/CarlaPluginLADSPA.cpp
  14. +8
    -5
      source/backend/plugin/CarlaPluginLV2.cpp
  15. +1
    -1
      source/backend/plugin/CarlaPluginLinuxSampler.cpp
  16. +2
    -2
      source/backend/plugin/CarlaPluginNative.cpp
  17. +59
    -5
      source/bridges-plugin/CarlaBridgePlugin.cpp
  18. +1
    -1
      source/bridges-ui/CarlaBridgeUI-LV2.cpp
  19. +11
    -14
      source/discovery/carla-discovery.cpp
  20. +6
    -6
      source/native-plugins/midi-base.hpp
  21. +0
    -205
      source/native-plugins/zita-common.hpp
  22. +2
    -2
      source/native-plugins/zynaddsubfx-synth.cpp
  23. +2
    -2
      source/plugin/carla-base.cpp
  24. +2
    -2
      source/plugin/carla-lv2-export.cpp
  25. +1
    -1
      source/plugin/carla-lv2.cpp
  26. +1
    -1
      source/plugin/carla-vst.cpp
  27. +29
    -28
      source/tests/RtLinkedList.cpp
  28. +7
    -7
      source/tests/ansi-pedantic-test.c
  29. +3
    -3
      source/utils/CarlaLibCounter.hpp
  30. +4
    -4
      source/utils/CarlaPatchbayUtils.cpp
  31. +4
    -4
      source/utils/CarlaStateUtils.cpp
  32. +6
    -6
      source/utils/CarlaStringList.hpp
  33. +18
    -14
      source/utils/CarlaUtils.hpp
  34. +127
    -18
      source/utils/LinkedList.hpp
  35. +3
    -3
      source/utils/RtLinkedList.hpp

+ 1
- 0
Makefile View File

@@ -697,6 +697,7 @@ uninstall:
rm -rf $(DESTDIR)$(PREFIX)/include/carla/
rm -rf $(DESTDIR)$(PREFIX)/lib/carla/
rm -rf $(DESTDIR)$(PREFIX)/lib/lv2/carla.lv2/
rm -rf $(DESTDIR)$(PREFIX)/lib/lv2/carla-native.lv2/
rm -rf $(DESTDIR)$(PREFIX)/lib/vst/carla.vst/
rm -rf $(DESTDIR)$(PREFIX)/share/carla/



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

@@ -189,7 +189,7 @@ void CarlaEngineClient::_addEventPortName(const bool isInput, const char* const

static void getUniquePortName(CarlaString& sname, const CarlaStringList& list)
{
for (CarlaStringList::Itenerator it = list.begin(); it.valid(); it.next())
for (CarlaStringList::Itenerator it = list.begin2(); it.valid(); it.next())
{
const char* const portName(it.getValue(nullptr));
CARLA_SAFE_ASSERT_CONTINUE(portName != nullptr && portName[0] != '\0');


+ 19
- 19
source/backend/engine/CarlaEngineGraph.cpp View File

@@ -91,7 +91,7 @@ ExternalGraphPorts::ExternalGraphPorts() noexcept

const char* ExternalGraphPorts::getName(const bool isInput, const uint portId) const noexcept
{
for (LinkedList<PortNameToId>::Itenerator it = isInput ? ins.begin() : outs.begin(); it.valid(); it.next())
for (LinkedList<PortNameToId>::Itenerator it = isInput ? ins.begin2() : outs.begin2(); it.valid(); it.next())
{
static const PortNameToId portNameFallback = { 0, 0, { '\0' }, { '\0' } };

@@ -107,7 +107,7 @@ const char* ExternalGraphPorts::getName(const bool isInput, const uint portId) c

uint ExternalGraphPorts::getPortId(const bool isInput, const char portName[], bool* const ok) const noexcept
{
for (LinkedList<PortNameToId>::Itenerator it = isInput ? ins.begin() : outs.begin(); it.valid(); it.next())
for (LinkedList<PortNameToId>::Itenerator it = isInput ? ins.begin2() : outs.begin2(); it.valid(); it.next())
{
static const PortNameToId portNameFallback = { 0, 0, { '\0' }, { '\0' } };

@@ -230,7 +230,7 @@ bool ExternalGraph::disconnect(const uint connectionId) noexcept
{
CARLA_SAFE_ASSERT_RETURN(connections.list.count() > 0, false);

for (LinkedList<ConnectionToId>::Itenerator it=connections.list.begin(); it.valid(); it.next())
for (LinkedList<ConnectionToId>::Itenerator it=connections.list.begin2(); it.valid(); it.next())
{
static const ConnectionToId fallback = { 0, 0, 0, 0, 0 };

@@ -347,7 +347,7 @@ void ExternalGraph::refresh(const char* const deviceName)
const CarlaString groupName(strBuf);

int h = 0;
for (LinkedList<PortNameToId>::Itenerator it = audioPorts.ins.begin(); it.valid(); it.next())
for (LinkedList<PortNameToId>::Itenerator it = audioPorts.ins.begin2(); it.valid(); it.next())
{
PortNameToId& portNameToId(it.getValue());
portNameToId.setFullName(groupName + portNameToId.name);
@@ -370,7 +370,7 @@ void ExternalGraph::refresh(const char* const deviceName)
const CarlaString groupName(strBuf);

int h = 0;
for (LinkedList<PortNameToId>::Itenerator it = audioPorts.outs.begin(); it.valid(); it.next())
for (LinkedList<PortNameToId>::Itenerator it = audioPorts.outs.begin2(); it.valid(); it.next())
{
PortNameToId& portNameToId(it.getValue());
portNameToId.setFullName(groupName + portNameToId.name);
@@ -387,7 +387,7 @@ void ExternalGraph::refresh(const char* const deviceName)
const CarlaString groupNamePlus("Readable MIDI ports:");

int h = 0;
for (LinkedList<PortNameToId>::Itenerator it = midiPorts.ins.begin(); it.valid(); it.next())
for (LinkedList<PortNameToId>::Itenerator it = midiPorts.ins.begin2(); it.valid(); it.next())
{
PortNameToId& portNameToId(it.getValue());
portNameToId.setFullName(groupNamePlus + portNameToId.name);
@@ -404,7 +404,7 @@ void ExternalGraph::refresh(const char* const deviceName)
const CarlaString groupNamePlus("Writable MIDI ports:");

int h = 0;
for (LinkedList<PortNameToId>::Itenerator it = midiPorts.outs.begin(); it.valid(); it.next())
for (LinkedList<PortNameToId>::Itenerator it = midiPorts.outs.begin2(); it.valid(); it.next())
{
PortNameToId& portNameToId(it.getValue());
portNameToId.setFullName(groupNamePlus + portNameToId.name);
@@ -425,7 +425,7 @@ const char* const* ExternalGraph::getConnections() const noexcept
char strBuf[STR_MAX+1];
strBuf[STR_MAX] = '\0';

for (LinkedList<ConnectionToId>::Itenerator it=connections.list.begin(); it.valid(); it.next())
for (LinkedList<ConnectionToId>::Itenerator it=connections.list.begin2(); it.valid(); it.next())
{
static const ConnectionToId fallback = { 0, 0, 0, 0, 0 };

@@ -692,7 +692,7 @@ void RackGraph::refresh(const char* const deviceName)
// Connections
const CarlaRecursiveMutexLocker cml(audioBuffers.mutex);

for (LinkedList<uint>::Itenerator it = audioBuffers.connectedIn1.begin(); it.valid(); it.next())
for (LinkedList<uint>::Itenerator it = audioBuffers.connectedIn1.begin2(); it.valid(); it.next())
{
const uint& portId(it.getValue(0));
CARLA_SAFE_ASSERT_CONTINUE(portId > 0);
@@ -708,7 +708,7 @@ void RackGraph::refresh(const char* const deviceName)
extGraph.connections.list.append(connectionToId);
}

for (LinkedList<uint>::Itenerator it = audioBuffers.connectedIn2.begin(); it.valid(); it.next())
for (LinkedList<uint>::Itenerator it = audioBuffers.connectedIn2.begin2(); it.valid(); it.next())
{
const uint& portId(it.getValue(0));
CARLA_SAFE_ASSERT_CONTINUE(portId > 0);
@@ -724,7 +724,7 @@ void RackGraph::refresh(const char* const deviceName)
extGraph.connections.list.append(connectionToId);
}

for (LinkedList<uint>::Itenerator it = audioBuffers.connectedOut1.begin(); it.valid(); it.next())
for (LinkedList<uint>::Itenerator it = audioBuffers.connectedOut1.begin2(); it.valid(); it.next())
{
const uint& portId(it.getValue(0));
CARLA_SAFE_ASSERT_CONTINUE(portId > 0);
@@ -740,7 +740,7 @@ void RackGraph::refresh(const char* const deviceName)
extGraph.connections.list.append(connectionToId);
}

for (LinkedList<uint>::Itenerator it = audioBuffers.connectedOut2.begin(); it.valid(); it.next())
for (LinkedList<uint>::Itenerator it = audioBuffers.connectedOut2.begin2(); it.valid(); it.next())
{
const uint& portId(it.getValue(0));
CARLA_SAFE_ASSERT_CONTINUE(portId > 0);
@@ -906,7 +906,7 @@ void RackGraph::processHelper(CarlaEngine::ProtectedData* const data, const floa
bool noConnections = true;

// connect input buffers
for (LinkedList<uint>::Itenerator it = audioBuffers.connectedIn1.begin(); it.valid(); it.next())
for (LinkedList<uint>::Itenerator it = audioBuffers.connectedIn1.begin2(); it.valid(); it.next())
{
const uint& port(it.getValue(0));
CARLA_SAFE_ASSERT_CONTINUE(port > 0);
@@ -928,7 +928,7 @@ void RackGraph::processHelper(CarlaEngine::ProtectedData* const data, const floa

noConnections = true;

for (LinkedList<uint>::Itenerator it = audioBuffers.connectedIn2.begin(); it.valid(); it.next())
for (LinkedList<uint>::Itenerator it = audioBuffers.connectedIn2.begin2(); it.valid(); it.next())
{
const uint& port(it.getValue(0));
CARLA_SAFE_ASSERT_CONTINUE(port > 0);
@@ -963,7 +963,7 @@ void RackGraph::processHelper(CarlaEngine::ProtectedData* const data, const floa
// connect output buffers
if (audioBuffers.connectedOut1.count() != 0)
{
for (LinkedList<uint>::Itenerator it = audioBuffers.connectedOut1.begin(); it.valid(); it.next())
for (LinkedList<uint>::Itenerator it = audioBuffers.connectedOut1.begin2(); it.valid(); it.next())
{
const uint& port(it.getValue(0));
CARLA_SAFE_ASSERT_CONTINUE(port > 0);
@@ -975,7 +975,7 @@ void RackGraph::processHelper(CarlaEngine::ProtectedData* const data, const floa

if (audioBuffers.connectedOut2.count() != 0)
{
for (LinkedList<uint>::Itenerator it = audioBuffers.connectedOut2.begin(); it.valid(); it.next())
for (LinkedList<uint>::Itenerator it = audioBuffers.connectedOut2.begin2(); it.valid(); it.next())
{
const uint& port(it.getValue(0));
CARLA_SAFE_ASSERT_CONTINUE(port > 0);
@@ -1578,7 +1578,7 @@ bool PatchbayGraph::disconnect(const uint connectionId)
if (usingExternal)
return extGraph.disconnect(connectionId);

for (LinkedList<ConnectionToId>::Itenerator it=connections.list.begin(); it.valid(); it.next())
for (LinkedList<ConnectionToId>::Itenerator it=connections.list.begin2(); it.valid(); it.next())
{
static const ConnectionToId fallback = { 0, 0, 0, 0, 0 };

@@ -1614,7 +1614,7 @@ void PatchbayGraph::disconnectInternalGroup(const uint groupId) noexcept
{
CARLA_SAFE_ASSERT(! usingExternal);

for (LinkedList<ConnectionToId>::Itenerator it=connections.list.begin(); it.valid(); it.next())
for (LinkedList<ConnectionToId>::Itenerator it=connections.list.begin2(); it.valid(); it.next())
{
static const ConnectionToId fallback = { 0, 0, 0, 0, 0 };

@@ -1718,7 +1718,7 @@ const char* const* PatchbayGraph::getConnections(const bool external) const

CarlaStringList connList;

for (LinkedList<ConnectionToId>::Itenerator it=connections.list.begin(); it.valid(); it.next())
for (LinkedList<ConnectionToId>::Itenerator it=connections.list.begin2(); it.valid(); it.next())
{
static const ConnectionToId fallback = { 0, 0, 0, 0, 0 };



+ 8
- 8
source/backend/engine/CarlaEngineJack.cpp View File

@@ -590,7 +590,7 @@ public:

void invalidate() noexcept
{
for (LinkedList<CarlaEngineJackAudioPort*>::Itenerator it = fAudioPorts.begin(); it.valid(); it.next())
for (LinkedList<CarlaEngineJackAudioPort*>::Itenerator it = fAudioPorts.begin2(); it.valid(); it.next())
{
CarlaEngineJackAudioPort* const port(it.getValue(nullptr));
CARLA_SAFE_ASSERT_CONTINUE(port != nullptr);
@@ -598,7 +598,7 @@ public:
port->invalidate();
}

for (LinkedList<CarlaEngineJackCVPort*>::Itenerator it = fCVPorts.begin(); it.valid(); it.next())
for (LinkedList<CarlaEngineJackCVPort*>::Itenerator it = fCVPorts.begin2(); it.valid(); it.next())
{
CarlaEngineJackCVPort* const port(it.getValue(nullptr));
CARLA_SAFE_ASSERT_CONTINUE(port != nullptr);
@@ -606,7 +606,7 @@ public:
port->invalidate();
}

for (LinkedList<CarlaEngineJackEventPort*>::Itenerator it = fEventPorts.begin(); it.valid(); it.next())
for (LinkedList<CarlaEngineJackEventPort*>::Itenerator it = fEventPorts.begin2(); it.valid(); it.next())
{
CarlaEngineJackEventPort* const port(it.getValue(nullptr));
CARLA_SAFE_ASSERT_CONTINUE(port != nullptr);
@@ -924,7 +924,7 @@ public:
LinkedList<uint> newPlugins;
fNewGroups.moveTo(newPlugins);

for (LinkedList<uint>::Itenerator it = newPlugins.begin(); it.valid(); it.next())
for (LinkedList<uint>::Itenerator it = newPlugins.begin2(); it.valid(); it.next())
{
const uint groupId(it.getValue(0));
CARLA_SAFE_ASSERT_CONTINUE(groupId > 0);
@@ -1135,7 +1135,7 @@ public:
if (pData->options.processMode == ENGINE_PROCESS_MODE_PATCHBAY && ! fExternalPatchbay)
return CarlaEngine::patchbayDisconnect(connectionId);

for (LinkedList<ConnectionToId>::Itenerator it = fUsedConnections.list.begin(); it.valid(); it.next())
for (LinkedList<ConnectionToId>::Itenerator it = fUsedConnections.list.begin2(); it.valid(); it.next())
{
static const ConnectionToId fallback = { 0, 0, 0, 0, 0 };

@@ -1632,7 +1632,7 @@ protected:
}
else
{
for (LinkedList<ConnectionToId>::Itenerator it = fUsedConnections.list.begin(); it.valid(); it.next())
for (LinkedList<ConnectionToId>::Itenerator it = fUsedConnections.list.begin2(); it.valid(); it.next())
{
static const ConnectionToId fallback = { 0, 0, 0, 0, 0 };

@@ -1658,7 +1658,7 @@ protected:
// ignore this if on internal patchbay mode
if (! fExternalPatchbay) return;

for (LinkedList<GroupNameToId>::Itenerator it = fUsedGroups.list.begin(); it.valid(); it.next())
for (LinkedList<GroupNameToId>::Itenerator it = fUsedGroups.list.begin2(); it.valid(); it.next())
{
static GroupNameToId groupNameFallback = { 0, { '\0' } };

@@ -1697,7 +1697,7 @@ protected:
const uint groupId(fUsedGroups.getGroupId(groupName));
CARLA_SAFE_ASSERT_RETURN(groupId > 0,);

for (LinkedList<PortNameToId>::Itenerator it = fUsedPorts.list.begin(); it.valid(); it.next())
for (LinkedList<PortNameToId>::Itenerator it = fUsedPorts.list.begin2(); it.valid(); it.next())
{
static PortNameToId portNameFallback = { 0, 0, { '\0' }, { '\0' } };



+ 8
- 8
source/backend/engine/CarlaEngineJuce.cpp View File

@@ -203,7 +203,7 @@ public:

pData->graph.destroy();

for (LinkedList<MidiInPort>::Itenerator it = fMidiIns.begin(); it.valid(); it.next())
for (LinkedList<MidiInPort>::Itenerator it = fMidiIns.begin2(); it.valid(); it.next())
{
MidiInPort& inPort(it.getValue());
CARLA_SAFE_ASSERT_CONTINUE(inPort.port != nullptr);
@@ -217,7 +217,7 @@ public:

fMidiOutMutex.lock();

for (LinkedList<MidiOutPort>::Itenerator it = fMidiOuts.begin(); it.valid(); it.next())
for (LinkedList<MidiOutPort>::Itenerator it = fMidiOuts.begin2(); it.valid(); it.next())
{
MidiOutPort& outPort(it.getValue());
CARLA_SAFE_ASSERT_CONTINUE(outPort.port != nullptr);
@@ -348,7 +348,7 @@ public:
// ---------------------------------------------------------------
// add midi connections

for (LinkedList<MidiInPort>::Itenerator it=fMidiIns.begin(); it.valid(); it.next())
for (LinkedList<MidiInPort>::Itenerator it=fMidiIns.begin2(); it.valid(); it.next())
{
const MidiInPort& inPort(it.getValue());

@@ -367,7 +367,7 @@ public:

fMidiOutMutex.lock();

for (LinkedList<MidiOutPort>::Itenerator it=fMidiOuts.begin(); it.valid(); it.next())
for (LinkedList<MidiOutPort>::Itenerator it=fMidiOuts.begin2(); it.valid(); it.next())
{
const MidiOutPort& outPort(it.getValue());

@@ -438,7 +438,7 @@ protected:
uint32_t engineEventIndex = 0;
fMidiInEvents.splice();

for (LinkedList<RtMidiEvent>::Itenerator it = fMidiInEvents.data.begin(); it.valid(); it.next())
for (LinkedList<RtMidiEvent>::Itenerator it = fMidiInEvents.data.begin2(); it.valid(); it.next())
{
const RtMidiEvent& midiEvent(it.getValue());
EngineEvent& engineEvent(pData->events.in[engineEventIndex++]);
@@ -508,7 +508,7 @@ protected:
{
MidiMessage message(static_cast<const void*>(dataPtr), static_cast<int>(size), static_cast<double>(engineEvent.time)/nframes);

for (LinkedList<MidiOutPort>::Itenerator it=fMidiOuts.begin(); it.valid(); it.next())
for (LinkedList<MidiOutPort>::Itenerator it=fMidiOuts.begin2(); it.valid(); it.next())
{
MidiOutPort& outPort(it.getValue());
CARLA_SAFE_ASSERT_CONTINUE(outPort.port != nullptr);
@@ -633,7 +633,7 @@ protected:
return CarlaEngine::disconnectExternalGraphPort(connectionType, portId, portName);

case kExternalGraphConnectionMidiInput:
for (LinkedList<MidiInPort>::Itenerator it=fMidiIns.begin(); it.valid(); it.next())
for (LinkedList<MidiInPort>::Itenerator it=fMidiIns.begin2(); it.valid(); it.next())
{
MidiInPort& inPort(it.getValue());
CARLA_SAFE_ASSERT_CONTINUE(inPort.port != nullptr);
@@ -652,7 +652,7 @@ protected:
case kExternalGraphConnectionMidiOutput: {
const CarlaMutexLocker cml(fMidiOutMutex);

for (LinkedList<MidiOutPort>::Itenerator it=fMidiOuts.begin(); it.valid(); it.next())
for (LinkedList<MidiOutPort>::Itenerator it=fMidiOuts.begin2(); it.valid(); it.next())
{
MidiOutPort& outPort(it.getValue());
CARLA_SAFE_ASSERT_CONTINUE(outPort.port != nullptr);


+ 9
- 11
source/backend/engine/CarlaEngineRtAudio.cpp View File

@@ -57,10 +57,8 @@ static void initRtAudioAPIsIfNeeded()
std::vector<RtAudio::Api> apis;
RtAudio::getCompiledApi(apis);

for (std::vector<RtAudio::Api>::iterator it = apis.begin(), end = apis.end(); it != end; ++it)
for (const RtAudio::Api& api : apis)
{
const RtAudio::Api& api(*it);

if (api == RtAudio::MACOSX_CORE)
continue;
if (api == RtAudio::WINDOWS_ASIO)
@@ -339,7 +337,7 @@ public:

pData->graph.destroy();

for (LinkedList<MidiInPort>::Itenerator it = fMidiIns.begin(); it.valid(); it.next())
for (LinkedList<MidiInPort>::Itenerator it = fMidiIns.begin2(); it.valid(); it.next())
{
static MidiInPort fallback = { nullptr, { '\0' } };

@@ -356,7 +354,7 @@ public:

fMidiOutMutex.lock();

for (LinkedList<MidiOutPort>::Itenerator it = fMidiOuts.begin(); it.valid(); it.next())
for (LinkedList<MidiOutPort>::Itenerator it = fMidiOuts.begin2(); it.valid(); it.next())
{
static MidiOutPort fallback = { nullptr, { '\0' } };

@@ -480,7 +478,7 @@ public:
// ---------------------------------------------------------------
// add midi connections

for (LinkedList<MidiInPort>::Itenerator it=fMidiIns.begin(); it.valid(); it.next())
for (LinkedList<MidiInPort>::Itenerator it=fMidiIns.begin2(); it.valid(); it.next())
{
static const MidiInPort fallback = { nullptr, { '\0' } };

@@ -503,7 +501,7 @@ public:

fMidiOutMutex.lock();

for (LinkedList<MidiOutPort>::Itenerator it=fMidiOuts.begin(); it.valid(); it.next())
for (LinkedList<MidiOutPort>::Itenerator it=fMidiOuts.begin2(); it.valid(); it.next())
{
static const MidiOutPort fallback = { nullptr, { '\0' } };

@@ -609,7 +607,7 @@ protected:
uint32_t engineEventIndex = 0;
fMidiInEvents.splice();

for (LinkedList<RtMidiEvent>::Itenerator it = fMidiInEvents.data.begin(); it.valid(); it.next())
for (LinkedList<RtMidiEvent>::Itenerator it = fMidiInEvents.data.begin2(); it.valid(); it.next())
{
static const RtMidiEvent fallback = { 0, 0, { 0 } };

@@ -683,7 +681,7 @@ protected:
{
fMidiOutVector.assign(dataPtr, dataPtr + size);

for (LinkedList<MidiOutPort>::Itenerator it=fMidiOuts.begin(); it.valid(); it.next())
for (LinkedList<MidiOutPort>::Itenerator it=fMidiOuts.begin2(); it.valid(); it.next())
{
static MidiOutPort fallback = { nullptr, { '\0' } };

@@ -869,7 +867,7 @@ protected:
return CarlaEngine::disconnectExternalGraphPort(connectionType, portId, portName);

case kExternalGraphConnectionMidiInput:
for (LinkedList<MidiInPort>::Itenerator it=fMidiIns.begin(); it.valid(); it.next())
for (LinkedList<MidiInPort>::Itenerator it=fMidiIns.begin2(); it.valid(); it.next())
{
static MidiInPort fallback = { nullptr, { '\0' } };

@@ -891,7 +889,7 @@ protected:
case kExternalGraphConnectionMidiOutput: {
const CarlaMutexLocker cml(fMidiOutMutex);

for (LinkedList<MidiOutPort>::Itenerator it=fMidiOuts.begin(); it.valid(); it.next())
for (LinkedList<MidiOutPort>::Itenerator it=fMidiOuts.begin2(); it.valid(); it.next())
{
static MidiOutPort fallback = { nullptr, { '\0' } };



+ 10
- 10
source/backend/plugin/CarlaPlugin.cpp View File

@@ -601,7 +601,7 @@ const CarlaStateSave& CarlaPlugin::getStateSave(const bool callPrepareForSave)
// ---------------------------------------------------------------
// Custom Data

for (LinkedList<CustomData>::Itenerator it = pData->custom.begin(); it.valid(); it.next())
for (LinkedList<CustomData>::Itenerator it = pData->custom.begin2(); it.valid(); it.next())
{
const CustomData& cData(it.getValue(kCustomDataFallback));
CARLA_SAFE_ASSERT_CONTINUE(cData.isValid());
@@ -628,7 +628,7 @@ void CarlaPlugin::loadStateSave(const CarlaStateSave& stateSave)
// ---------------------------------------------------------------
// Part 1 - PRE-set custom data (only those which reload programs)

for (CarlaStateSave::CustomDataItenerator it = stateSave.customData.begin(); it.valid(); it.next())
for (CarlaStateSave::CustomDataItenerator it = stateSave.customData.begin2(); it.valid(); it.next())
{
const CarlaStateSave::CustomData* const stateCustomData(it.getValue(nullptr));
CARLA_SAFE_ASSERT_CONTINUE(stateCustomData != nullptr);
@@ -712,7 +712,7 @@ void CarlaPlugin::loadStateSave(const CarlaStateSave& stateSave)

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

for (CarlaStateSave::ParameterItenerator it = stateSave.parameters.begin(); it.valid(); it.next())
for (CarlaStateSave::ParameterItenerator it = stateSave.parameters.begin2(); it.valid(); it.next())
{
CarlaStateSave::Parameter* const stateParameter(it.getValue(nullptr));
CARLA_SAFE_ASSERT_CONTINUE(stateParameter != nullptr);
@@ -724,7 +724,7 @@ void CarlaPlugin::loadStateSave(const CarlaStateSave& stateSave)
// Try to set by symbol, otherwise use index
if (stateParameter->symbol != nullptr && stateParameter->symbol[0] != '\0')
{
for (LinkedList<ParamSymbol*>::Itenerator it2 = paramSymbols.begin(); it2.valid(); it2.next())
for (LinkedList<ParamSymbol*>::Itenerator it2 = paramSymbols.begin2(); it2.valid(); it2.next())
{
ParamSymbol* const paramSymbol(it2.getValue(nullptr));
CARLA_SAFE_ASSERT_CONTINUE(paramSymbol != nullptr);
@@ -747,7 +747,7 @@ void CarlaPlugin::loadStateSave(const CarlaStateSave& stateSave)
// Symbol only
if (stateParameter->symbol != nullptr && stateParameter->symbol[0] != '\0')
{
for (LinkedList<ParamSymbol*>::Itenerator it2 = paramSymbols.begin(); it2.valid(); it2.next())
for (LinkedList<ParamSymbol*>::Itenerator it2 = paramSymbols.begin2(); it2.valid(); it2.next())
{
ParamSymbol* const paramSymbol(it2.getValue(nullptr));
CARLA_SAFE_ASSERT_CONTINUE(paramSymbol != nullptr);
@@ -796,7 +796,7 @@ void CarlaPlugin::loadStateSave(const CarlaStateSave& stateSave)
// ---------------------------------------------------------------
// Part 4c - clear

for (LinkedList<ParamSymbol*>::Itenerator it = paramSymbols.begin(); it.valid(); it.next())
for (LinkedList<ParamSymbol*>::Itenerator it = paramSymbols.begin2(); it.valid(); it.next())
{
ParamSymbol* const paramSymbol(it.getValue(nullptr));
delete paramSymbol;
@@ -807,7 +807,7 @@ void CarlaPlugin::loadStateSave(const CarlaStateSave& stateSave)
// ---------------------------------------------------------------
// Part 5 - set custom data

for (CarlaStateSave::CustomDataItenerator it = stateSave.customData.begin(); it.valid(); it.next())
for (CarlaStateSave::CustomDataItenerator it = stateSave.customData.begin2(); it.valid(); it.next())
{
const CarlaStateSave::CustomData* const stateCustomData(it.getValue(nullptr));
CARLA_SAFE_ASSERT_CONTINUE(stateCustomData != nullptr);
@@ -1267,7 +1267,7 @@ void CarlaPlugin::setCustomData(const char* const type, const char* const key, c
}

// Check if we already have this key
for (LinkedList<CustomData>::Itenerator it = pData->custom.begin(); it.valid(); it.next())
for (LinkedList<CustomData>::Itenerator it = pData->custom.begin2(); it.valid(); it.next())
{
CustomData& customData(it.getValue(kCustomDataFallbackNC));
CARLA_SAFE_ASSERT_CONTINUE(customData.isValid());
@@ -1432,7 +1432,7 @@ void CarlaPlugin::idle()

const CarlaMutexLocker sl(pData->postRtEvents.mutex);

for (RtLinkedList<PluginPostRtEvent>::Itenerator it = pData->postRtEvents.data.begin(); it.valid(); it.next())
for (RtLinkedList<PluginPostRtEvent>::Itenerator it = pData->postRtEvents.data.begin2(); it.valid(); it.next())
{
const PluginPostRtEvent& event(it.getValue(kPluginPostRtEventFallback));
CARLA_SAFE_ASSERT_CONTINUE(event.type != kPluginPostRtEventNull);
@@ -1830,7 +1830,7 @@ void CarlaPlugin::uiIdle()

const CarlaMutexLocker sl(pData->postUiEvents.mutex);

for (LinkedList<PluginPostRtEvent>::Itenerator it = pData->postUiEvents.data.begin(); it.valid(); it.next())
for (LinkedList<PluginPostRtEvent>::Itenerator it = pData->postUiEvents.data.begin2(); it.valid(); it.next())
{
const PluginPostRtEvent& event(it.getValue(kPluginPostRtEventFallback));
CARLA_SAFE_ASSERT_CONTINUE(event.type != kPluginPostRtEventNull);


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

@@ -1434,7 +1434,7 @@ public:

if (pData->extNotes.mutex.tryLock())
{
for (RtLinkedList<ExternalMidiNote>::Itenerator it = pData->extNotes.data.begin(); it.valid(); it.next())
for (RtLinkedList<ExternalMidiNote>::Itenerator it = pData->extNotes.data.begin2(); it.valid(); it.next())
{
const ExternalMidiNote& note(it.getValue());



+ 357
- 286
source/backend/plugin/CarlaPluginDSSI.cpp
File diff suppressed because it is too large
View File


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

@@ -1054,7 +1054,7 @@ public:

if (pData->extNotes.mutex.tryLock())
{
for (RtLinkedList<ExternalMidiNote>::Itenerator it = pData->extNotes.data.begin(); it.valid(); it.next())
for (RtLinkedList<ExternalMidiNote>::Itenerator it = pData->extNotes.data.begin2(); it.valid(); it.next())
{
const ExternalMidiNote& note(it.getValue());



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

@@ -628,7 +628,7 @@ CarlaPlugin::ProtectedData::~ProtectedData() noexcept
iconName = nullptr;
}

for (LinkedList<CustomData>::Itenerator it = custom.begin(); it.valid(); it.next())
for (LinkedList<CustomData>::Itenerator it = custom.begin2(); it.valid(); it.next())
{
CustomData& customData(it.getValue(kCustomDataFallbackNC));
//CARLA_SAFE_ASSERT_CONTINUE(customData.isValid());


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

@@ -709,7 +709,7 @@ public:

if (pData->extNotes.mutex.tryLock())
{
for (RtLinkedList<ExternalMidiNote>::Itenerator it = pData->extNotes.data.begin(); it.valid(); it.next())
for (RtLinkedList<ExternalMidiNote>::Itenerator it = pData->extNotes.data.begin2(); it.valid(); it.next())
{
const ExternalMidiNote& note(it.getValue());



+ 24
- 22
source/backend/plugin/CarlaPluginLADSPA.cpp View File

@@ -38,9 +38,9 @@ public:
fExtraStereoBuffer(),
fParamBuffers(nullptr),
fLatencyIndex(-1),
fIsDssiVst(false),
fForcedStereoIn(false),
fForcedStereoOut(false),
fIsDssiVst(false),
leakDetector_CarlaPluginLADSPA()
{
carla_debug("CarlaPluginLADSPA::CarlaPluginLADSPA(%p, %i)", engine, id);
@@ -68,7 +68,7 @@ public:
{
if (fDescriptor->cleanup != nullptr)
{
for (LinkedList<LADSPA_Handle>::Itenerator it = fHandles.begin(); it.valid(); it.next())
for (LinkedList<LADSPA_Handle>::Itenerator it = fHandles.begin2(); it.valid(); it.next())
{
LADSPA_Handle const handle(it.getValue(nullptr));
CARLA_SAFE_ASSERT_CONTINUE(handle != nullptr);
@@ -426,6 +426,7 @@ public:
{
CARLA_SAFE_ASSERT_RETURN(pData->engine != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fHandles.count() > 0,);
carla_debug("CarlaPluginLADSPA::reload() - start");

const EngineProcessMode processMode(pData->engine->getProccessMode());
@@ -713,7 +714,7 @@ public:
// Start parameters in their default values
fParamBuffers[j] = def;

for (LinkedList<LADSPA_Handle>::Itenerator it = fHandles.begin(); it.valid(); it.next())
for (LinkedList<LADSPA_Handle>::Itenerator it = fHandles.begin2(); it.valid(); it.next())
{
LADSPA_Handle const handle(it.getValue(nullptr));
CARLA_SAFE_ASSERT_CONTINUE(handle != nullptr);
@@ -728,7 +729,7 @@ public:
// Not Audio or Control
carla_stderr2("ERROR - Got a broken Port (neither Audio or Control)");

for (LinkedList<LADSPA_Handle>::Itenerator it = fHandles.begin(); it.valid(); it.next())
for (LinkedList<LADSPA_Handle>::Itenerator it = fHandles.begin2(); it.valid(); it.next())
{
LADSPA_Handle const handle(it.getValue(nullptr));
CARLA_SAFE_ASSERT_CONTINUE(handle != nullptr);
@@ -879,7 +880,7 @@ public:

if (fDescriptor->activate != nullptr)
{
for (LinkedList<LADSPA_Handle>::Itenerator it = fHandles.begin(); it.valid(); it.next())
for (LinkedList<LADSPA_Handle>::Itenerator it = fHandles.begin2(); it.valid(); it.next())
{
LADSPA_Handle const handle(it.getValue(nullptr));
CARLA_SAFE_ASSERT_CONTINUE(handle != nullptr);
@@ -897,7 +898,7 @@ public:

if (fDescriptor->deactivate != nullptr)
{
for (LinkedList<LADSPA_Handle>::Itenerator it = fHandles.begin(); it.valid(); it.next())
for (LinkedList<LADSPA_Handle>::Itenerator it = fHandles.begin2(); it.valid(); it.next())
{
LADSPA_Handle const handle(it.getValue(nullptr));
CARLA_SAFE_ASSERT_CONTINUE(handle != nullptr);
@@ -1105,7 +1106,8 @@ public:
} // End of Control Output
}

bool processSingle(const float** const audioIn, float** const audioOut, const uint32_t frames, const uint32_t timeOffset)
bool processSingle(const float** const audioIn, float** const audioOut, const uint32_t frames,
const uint32_t timeOffset)
{
CARLA_SAFE_ASSERT_RETURN(frames > 0, false);

@@ -1171,7 +1173,7 @@ public:
// Run plugin

uint instn = 0;
for (LinkedList<LADSPA_Handle>::Itenerator it = fHandles.begin(); it.valid(); it.next(), ++instn)
for (LinkedList<LADSPA_Handle>::Itenerator it = fHandles.begin2(); it.valid(); it.next(), ++instn)
{
LADSPA_Handle const handle(it.getValue(nullptr));
CARLA_SAFE_ASSERT_CONTINUE(handle != nullptr);
@@ -1381,7 +1383,7 @@ public:

if (fDescriptor->cleanup == nullptr)
{
for (LinkedList<LADSPA_Handle>::Itenerator it = fHandles.begin(); it.valid(); it.next())
for (LinkedList<LADSPA_Handle>::Itenerator it = fHandles.begin2(); it.valid(); it.next())
{
LADSPA_Handle const handle(it.getValue(nullptr));
CARLA_SAFE_ASSERT_CONTINUE(handle != nullptr);
@@ -1425,7 +1427,7 @@ public:
}
else
{
for (LinkedList<LADSPA_Handle>::Itenerator it = fHandles.begin(); it.valid(); it.next())
for (LinkedList<LADSPA_Handle>::Itenerator it = fHandles.begin2(); it.valid(); it.next())
{
LADSPA_Handle const handle(it.getValue(nullptr));
CARLA_SAFE_ASSERT_CONTINUE(handle != nullptr);
@@ -1457,7 +1459,7 @@ public:
}
else
{
for (LinkedList<LADSPA_Handle>::Itenerator it = fHandles.begin(); it.valid(); it.next())
for (LinkedList<LADSPA_Handle>::Itenerator it = fHandles.begin2(); it.valid(); it.next())
{
LADSPA_Handle const handle(it.getValue(nullptr));
CARLA_SAFE_ASSERT_CONTINUE(handle != nullptr);
@@ -1534,11 +1536,6 @@ public:

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

void* getNativeHandle() const noexcept override
{
return nullptr; // fHandle;
}

const void* getNativeDescriptor() const noexcept override
{
return fDescriptor;
@@ -1577,8 +1574,6 @@ public:
return false;
}

fIsDssiVst = CarlaString(filename).contains("dssi-vst", true);

// ---------------------------------------------------------------
// open DLL

@@ -1699,6 +1694,11 @@ public:
}
}

// ---------------------------------------------------------------
// check if this is dssi-vst

fIsDssiVst = CarlaString(filename).contains("dssi-vst", true);

// ---------------------------------------------------------------
// set default options

@@ -1730,9 +1730,9 @@ private:
float* fParamBuffers;

int32_t fLatencyIndex; // -1 if invalid
bool fIsDssiVst;
bool fForcedStereoIn;
bool fForcedStereoOut;
bool fIsDssiVst;

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

@@ -1786,7 +1786,8 @@ private:
return false;
}

static bool _getSeparatedParameterNameOrUnitImpl(const char* const paramName, char* const strBuf, const bool wantName, const bool useBracket) noexcept
static bool _getSeparatedParameterNameOrUnitImpl(const char* const paramName, char* const strBuf,
const bool wantName, const bool useBracket) noexcept
{
const char* const sepBracketStart(std::strstr(paramName, useBracket ? " [" : " ("));

@@ -1806,7 +1807,7 @@ private:
const std::size_t sepIndex(std::strlen(paramName)-unitSize-3);

// just in case
if (sepIndex >= STR_MAX)
if (sepIndex+2 >= STR_MAX)
return false;

if (wantName)
@@ -1832,7 +1833,8 @@ private:

CarlaPlugin* CarlaPlugin::newLADSPA(const Initializer& init, const LADSPA_RDF_Descriptor* const rdfDescriptor)
{
carla_debug("CarlaPlugin::newLADSPA({%p, \"%s\", \"%s\", \"%s\", " P_INT64 ", %x}, %p)", init.engine, init.filename, init.name, init.label, init.uniqueId, init.options, rdfDescriptor);
carla_debug("CarlaPlugin::newLADSPA({%p, \"%s\", \"%s\", \"%s\", " P_INT64 ", %x}, %p)",
init.engine, init.filename, init.name, init.label, init.uniqueId, init.options, rdfDescriptor);

CarlaPluginLADSPA* const plugin(new CarlaPluginLADSPA(init.engine, init.id));



+ 8
- 5
source/backend/plugin/CarlaPluginLV2.cpp View File

@@ -31,6 +31,7 @@
#include "Lv2AtomRingBuffer.hpp"

#include "../engine/CarlaEngineOsc.hpp"
#include "../modules/lilv/config/lilv_config.h"

extern "C" {
#include "rtmempool/rtmempool-lv2.h"
@@ -684,7 +685,7 @@ public:
}
}

for (LinkedList<const char*>::Itenerator it = fCustomURIDs.begin(); it.valid(); it.next())
for (LinkedList<const char*>::Itenerator it = fCustomURIDs.begin2(); it.valid(); it.next())
{
const char* const uri(it.getValue());

@@ -2962,7 +2963,7 @@ public:
{
const uint32_t j = fEventsIn.ctrlIndex;

for (RtLinkedList<ExternalMidiNote>::Itenerator it = pData->extNotes.data.begin(); it.valid(); it.next())
for (RtLinkedList<ExternalMidiNote>::Itenerator it = pData->extNotes.data.begin2(); it.valid(); it.next())
{
const ExternalMidiNote& note(it.getValue());

@@ -4353,7 +4354,7 @@ public:
CARLA_SAFE_ASSERT_RETURN(stype != nullptr, LV2_STATE_ERR_BAD_TYPE);

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

@@ -4402,7 +4403,7 @@ public:
const char* stype = nullptr;
const char* stringData = nullptr;

for (LinkedList<CustomData>::Itenerator it = pData->custom.begin(); it.valid(); it.next())
for (LinkedList<CustomData>::Itenerator it = pData->custom.begin2(); it.valid(); it.next())
{
const CustomData& data(it.getValue());

@@ -4706,8 +4707,10 @@ public:

if (pData->engine->getOptions().pathLV2 != nullptr && pData->engine->getOptions().pathLV2[0] != '\0')
lv2World.initIfNeeded(pData->engine->getOptions().pathLV2);
else if (const char* const LV2_PATH = std::getenv("LV2_PATH"))
lv2World.initIfNeeded(LV2_PATH);
else
lv2World.initIfNeeded(std::getenv("LV2_PATH"));
lv2World.initIfNeeded(LILV_DEFAULT_LV2_PATH);

// ---------------------------------------------------------------
// get plugin from lv2_rdf (lilv)


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

@@ -821,7 +821,7 @@ public:

if (pData->extNotes.mutex.tryLock())
{
for (RtLinkedList<ExternalMidiNote>::Itenerator it = pData->extNotes.data.begin(); it.valid(); it.next())
for (RtLinkedList<ExternalMidiNote>::Itenerator it = pData->extNotes.data.begin2(); it.valid(); it.next())
{
const ExternalMidiNote& note(it.getValue());



+ 2
- 2
source/backend/plugin/CarlaPluginNative.cpp View File

@@ -749,7 +749,7 @@ public:

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

@@ -2299,7 +2299,7 @@ public:

sPluginInitializer.initIfNeeded();

for (LinkedList<const NativePluginDescriptor*>::Itenerator it = gPluginDescriptors.begin(); it.valid(); it.next())
for (LinkedList<const NativePluginDescriptor*>::Itenerator it = gPluginDescriptors.begin2(); it.valid(); it.next())
{
fDescriptor = it.getValue();



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

@@ -396,20 +396,74 @@ int main(int argc, char* argv[])
// ---------------------------------------------------------------------
// Set client name

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

// LV2 URI is not usable as client name
//if (itype == CarlaBackend::PLUGIN_LV2 && clientName == label)
if (name != nullptr)
{
clientName = name;
}
else if (itype == CarlaBackend::PLUGIN_LV2)
{
// LV2 requires URI
CARLA_SAFE_ASSERT_RETURN(label != nullptr && label[0] != '\0', 1);

if (clientName.isEmpty())
// LV2 URI is not usable as client name, create a usable name from URI
CarlaString label2(label);

// truncate until last valid char
for (std::size_t i=label2.length()-1; i != 0; --i)
{
if (! std::isalnum(label2[i]))
continue;

label2.truncate(i+1);
break;
}

// get last used separator
bool found;
std::size_t septmp, sep = 0;

septmp = label2.rfind('#', &found)+1;
if (found && septmp > sep)
sep = septmp;

septmp = label2.rfind('/', &found)+1;
if (found && septmp > sep)
sep = septmp;

septmp = label2.rfind('=', &found)+1;
if (found && septmp > sep)
sep = septmp;

septmp = label2.rfind(':', &found)+1;
if (found && septmp > sep)
sep = septmp;

// make name starting from the separator and first valid char
const char* name2 = label2.buffer() + sep;
for (; *name2 != '\0' && ! std::isalnum(*name2); ++name2) {}

if (*name2 != '\0')
clientName = name2;
}
else if (label != nullptr)
{
clientName = label;
}
else
{
const String jfilename = String(CharPointer_UTF8(filename));
clientName = File(jfilename).getFileNameWithoutExtension().toRawUTF8();
}

// if we still have no client name by now, use a dummy one
if (clientName.isEmpty())
clientName = "carla-plugin";

// just to be safe
clientName.toBasic();

// ---------------------------------------------------------------------
// Set extraStuff



+ 1
- 1
source/bridges-ui/CarlaBridgeUI-LV2.cpp View File

@@ -361,7 +361,7 @@ public:
}
}

for (LinkedList<const char*>::Itenerator it = fCustomURIDs.begin(); it.valid(); it.next())
for (LinkedList<const char*>::Itenerator it = fCustomURIDs.begin2(); it.valid(); it.next())
{
const char* const uri(it.getValue(nullptr));



+ 11
- 14
source/discovery/carla-discovery.cpp View File

@@ -720,9 +720,14 @@ static void do_dssi_check(lib_t& libHandle, const char* const filename, const bo
DISCOVERY_OUT("error", "Plugin '" << ldescriptor->Name << "' has no cleanup()");
continue;
}
if (ldescriptor->run == nullptr && descriptor->run_synth == nullptr && descriptor->run_multiple_synths == nullptr)
if (ldescriptor->run == nullptr && descriptor->run_synth == nullptr)
{
DISCOVERY_OUT("error", "Plugin '" << ldescriptor->Name << "' has no run(), run_synth() or run_multiple_synths()");
DISCOVERY_OUT("error", "Plugin '" << ldescriptor->Name << "' has no run() or run_synth()");
continue;
}
if (descriptor->run_synth == nullptr && descriptor->run_multiple_synths != nullptr)
{
DISCOVERY_OUT("error", "Plugin '" << ldescriptor->Name << "' requires run_multiple_synths which is not supported");
continue;
}
if (! LADSPA_IS_HARD_RT_CAPABLE(ldescriptor->Properties))
@@ -767,7 +772,7 @@ static void do_dssi_check(lib_t& libHandle, const char* const filename, const bo
}
}

if (descriptor->run_synth != nullptr || descriptor->run_multiple_synths != nullptr)
if (descriptor->run_synth != nullptr)
midiIns = 1;

if (midiIns > 0 && audioIns == 0 && audioOuts > 0)
@@ -881,7 +886,7 @@ static void do_dssi_check(lib_t& libHandle, const char* const filename, const bo
if (ldescriptor->activate != nullptr)
ldescriptor->activate(handle);

if (descriptor->run_synth != nullptr || descriptor->run_multiple_synths != nullptr)
if (descriptor->run_synth != nullptr)
{
snd_seq_event_t midiEvents[2];
carla_zeroStruct<snd_seq_event_t>(midiEvents, 2);
@@ -897,15 +902,7 @@ static void do_dssi_check(lib_t& libHandle, const char* const filename, const bo
midiEvents[1].data.note.velocity = 0;
midiEvents[1].time.tick = kBufferSize/2;

if (descriptor->run_multiple_synths != nullptr && descriptor->run_synth == nullptr)
{
LADSPA_Handle handlePtr[1] = { handle };
snd_seq_event_t* midiEventsPtr[1] = { midiEvents };
unsigned long midiEventCountPtr[1] = { midiEventCount };
descriptor->run_multiple_synths(1, handlePtr, kBufferSize, midiEventsPtr, midiEventCountPtr);
}
else
descriptor->run_synth(handle, kBufferSize, midiEvents, midiEventCount);
descriptor->run_synth(handle, kBufferSize, midiEvents, midiEventCount);
}
else
ldescriptor->run(handle, kBufferSize);
@@ -1214,7 +1211,7 @@ static void do_vst_check(lib_t& libHandle, const bool doInit)
uniqueIds.append(gVstCurrentUniqueId);
}

for (LinkedList<intptr_t>::Itenerator it = uniqueIds.begin(); it.valid(); it.next())
for (LinkedList<intptr_t>::Itenerator it = uniqueIds.begin2(); it.valid(); it.next())
{
gVstCurrentUniqueId = it.getValue(0);



+ 6
- 6
source/native-plugins/midi-base.hpp View File

@@ -186,7 +186,7 @@ public:
{
const CarlaMutexLocker sl(fMutex);

for (LinkedList<const RawMidiEvent*>::Itenerator it = fData.begin(); it.valid(); it.next())
for (LinkedList<const RawMidiEvent*>::Itenerator it = fData.begin2(); it.valid(); it.next())
{
const RawMidiEvent* const rawMidiEvent(it.getValue(nullptr));
CARLA_SAFE_ASSERT_CONTINUE(rawMidiEvent != nullptr);
@@ -214,7 +214,7 @@ public:
{
const CarlaMutexLocker sl(fMutex);

for (LinkedList<const RawMidiEvent*>::Itenerator it = fData.begin(); it.valid(); it.next())
for (LinkedList<const RawMidiEvent*>::Itenerator it = fData.begin2(); it.valid(); it.next())
delete it.getValue(nullptr);

fData.clear();
@@ -236,7 +236,7 @@ public:
if (fStartTime != 0)
timePosFrame += static_cast<long double>(fStartTime);

for (LinkedList<const RawMidiEvent*>::Itenerator it = fData.begin(); it.valid(); it.next())
for (LinkedList<const RawMidiEvent*>::Itenerator it = fData.begin2(); it.valid(); it.next())
{
const RawMidiEvent* const rawMidiEvent(it.getValue(nullptr));
CARLA_SAFE_ASSERT_CONTINUE(rawMidiEvent != nullptr);
@@ -275,7 +275,7 @@ public:

LinkedList<const RawMidiEvent*>::Itenerator iteneratorBegin() const noexcept
{
return fData.begin();
return fData.begin2();
}

// -------------------------------------------------------------------
@@ -298,7 +298,7 @@ public:
char* dataWrtn = data;
int wrtn;

for (LinkedList<const RawMidiEvent*>::Itenerator it = fData.begin(); it.valid(); it.next())
for (LinkedList<const RawMidiEvent*>::Itenerator it = fData.begin2(); it.valid(); it.next())
{
const RawMidiEvent* const rawMidiEvent(it.getValue(nullptr));
CARLA_SAFE_ASSERT_CONTINUE(rawMidiEvent != nullptr);
@@ -435,7 +435,7 @@ private:
return;
}

for (LinkedList<const RawMidiEvent*>::Itenerator it = fData.begin(); it.valid(); it.next())
for (LinkedList<const RawMidiEvent*>::Itenerator it = fData.begin2(); it.valid(); it.next())
{
const RawMidiEvent* const oldEvent(it.getValue(nullptr));
CARLA_SAFE_ASSERT_CONTINUE(oldEvent != nullptr);


+ 0
- 205
source/native-plugins/zita-common.hpp View File

@@ -1,205 +0,0 @@
/*
* Carla Native Plugins
* Copyright (C) 2012-2015 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the doc/GPL.txt file.
*/

#ifndef CARLA_ZITA_COMMON_HPP_INCLUDED
#define CARLA_ZITA_COMMON_HPP_INCLUDED

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

#include <png.h>
#include <clxclient.h>

#include <cairo/cairo.h>
#include <cairo/cairo-xlib.h>

#define EV_X11 16
#define EV_EXIT 31

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

struct x_cairo_t {
cairo_t * type;
cairo_surface_t* surf;

x_cairo_t() noexcept
: type(nullptr),
surf(nullptr) {}

~x_cairo_t()
{
cairo_destroy(type);
cairo_surface_destroy(surf);
}

void initIfNeeded(X_display* const disp)
{
if (surf != nullptr)
return;

surf = cairo_xlib_surface_create(disp->dpy(), 0, disp->dvi(), 50, 50);
type = cairo_create(surf);
}
};

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

struct X_handler_Param {
uint32_t index;
float value;
};

typedef LinkedList<X_handler_Param> ParamList;

template<class MainwinType>
class X_handler_thread : public CarlaThread
{
public:
struct SetValueCallback {
virtual ~SetValueCallback() {}
virtual void setParameterValueFromHandlerThread(const uint32_t index, const float value) = 0;
};

X_handler_thread(SetValueCallback* const cb)
: CarlaThread("X_handler"),
fCallback(cb),
fMutex(),
fHandler(nullptr),
fRootwin(nullptr),
fMainwin(nullptr),
fClosed(false),
fParamMutex(),
fParamChanges() {}

void setupAndRun(X_handler* const h, X_rootwin* const r, MainwinType* const m) noexcept
{
const CarlaMutexLocker cml(fMutex);

fHandler = h;
fRootwin = r;
fMainwin = m;

startThread();
}

void stopThread() noexcept
{
signalThreadShouldExit();

{
const CarlaMutexLocker cml(fMutex);
fHandler = nullptr;
fRootwin = nullptr;
fMainwin = nullptr;
}

CarlaThread::stopThread(1000);
}

CarlaMutex& getLock() noexcept
{
return fMutex;
}

void setParameterValueLater(const uint32_t index, const float value) noexcept
{
const CarlaMutexLocker cml(fParamMutex);

for (ParamList::Itenerator it = fParamChanges.begin(); it.valid(); it.next())
{
X_handler_Param& param(it.getValue());

if (param.index != index)
continue;

param.value = value;
return;
}

const X_handler_Param param = { index, value };
fParamChanges.append(param);
}

bool wasClosed() noexcept
{
if (fClosed)
{
fClosed = false;
return true;
}
return false;
}

private:
SetValueCallback* const fCallback;

CarlaMutex fMutex;
X_handler* fHandler;
X_rootwin* fRootwin;
MainwinType* fMainwin;
volatile bool fClosed;

CarlaMutex fParamMutex;
ParamList fParamChanges;

void run() override
{
for (; ! shouldThreadExit();)
{
const CarlaMutexLocker cml(fMutex);

CARLA_SAFE_ASSERT_RETURN(fMainwin != nullptr,);

{
const CarlaMutexLocker cml(fParamMutex);

for (ParamList::Itenerator it = fParamChanges.begin(); it.valid(); it.next())
{
const X_handler_Param& param(it.getValue());
fCallback->setParameterValueFromHandlerThread(param.index, param.value);
}

fParamChanges.clear();
}

switch (fMainwin->process())
{
case EV_X11:
fRootwin->handle_event();
fHandler->next_event();
break;
case EV_EXIT:
fClosed = true;
fHandler = nullptr;
fMainwin = nullptr;
fRootwin = nullptr;
return;
case Esync::EV_TIME:
fRootwin->handle_event();
break;
default:
carla_stdout("custom X11 event for zita plugs");
break;
}
}
}
};

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

#endif // CARLA_ZITA_COMMON_HPP_INCLUDED

+ 2
- 2
source/native-plugins/zynaddsubfx-synth.cpp View File

@@ -52,7 +52,7 @@ public:
if (! fInitiated)
return;

for (LinkedList<const ProgramInfo*>::Itenerator it = fPrograms.begin(); it.valid(); it.next())
for (LinkedList<const ProgramInfo*>::Itenerator it = fPrograms.begin2(); it.valid(); it.next())
{
const ProgramInfo* const& pInfo(it.getValue(nullptr));
delete pInfo;
@@ -118,7 +118,7 @@ public:

const char* getZynProgramFilename(const uint32_t bank, const uint32_t program) const noexcept
{
for (LinkedList<const ProgramInfo*>::Itenerator it = fPrograms.begin(); it.valid(); it.next())
for (LinkedList<const ProgramInfo*>::Itenerator it = fPrograms.begin2(); it.valid(); it.next())
{
const ProgramInfo* const& pInfo(it.getValue(nullptr));



+ 2
- 2
source/plugin/carla-base.cpp View File

@@ -86,7 +86,7 @@ struct PluginListManager {
~PluginListManager()
{
#ifdef CARLA_NATIVE_PLUGIN_DSSI
for (LinkedList<const DSSI_Descriptor*>::Itenerator it = dssiDescs.begin(); it.valid(); it.next())
for (LinkedList<const DSSI_Descriptor*>::Itenerator it = dssiDescs.begin2(); it.valid(); it.next())
{
const DSSI_Descriptor* const dssiDesc(it.getValue());
//delete[] lv2Desc->URI;
@@ -96,7 +96,7 @@ struct PluginListManager {
#endif

#ifdef CARLA_NATIVE_PLUGIN_LV2
for (LinkedList<const LV2_Descriptor*>::Itenerator it = lv2Descs.begin(); it.valid(); it.next())
for (LinkedList<const LV2_Descriptor*>::Itenerator it = lv2Descs.begin2(); it.valid(); it.next())
{
const LV2_Descriptor* const lv2Desc(it.getValue());
delete[] lv2Desc->URI;


+ 2
- 2
source/plugin/carla-lv2-export.cpp View File

@@ -115,7 +115,7 @@ static void writeManifestFile(PluginListManager& plm)
// -------------------------------------------------------------------
// Plugins

for (LinkedList<const NativePluginDescriptor*>::Itenerator it = plm.descs.begin(); it.valid(); it.next())
for (LinkedList<const NativePluginDescriptor*>::Itenerator it = plm.descs.begin2(); it.valid(); it.next())
{
const NativePluginDescriptor* const& pluginDesc(it.getValue());
const String label(pluginDesc->label);
@@ -576,7 +576,7 @@ int main()

writeManifestFile(plm);

for (LinkedList<const NativePluginDescriptor*>::Itenerator it = plm.descs.begin(); it.valid(); it.next())
for (LinkedList<const NativePluginDescriptor*>::Itenerator it = plm.descs.begin2(); it.valid(); it.next())
{
const NativePluginDescriptor* const& pluginDesc(it.getValue());
writePluginFile(pluginDesc);


+ 1
- 1
source/plugin/carla-lv2.cpp View File

@@ -1410,7 +1410,7 @@ static LV2_Handle lv2_instantiate(const LV2_Descriptor* lv2Descriptor, double sa

PluginListManager& plm(PluginListManager::getInstance());

for (LinkedList<const NativePluginDescriptor*>::Itenerator it = plm.descs.begin(); it.valid(); it.next())
for (LinkedList<const NativePluginDescriptor*>::Itenerator it = plm.descs.begin2(); it.valid(); it.next())
{
const NativePluginDescriptor* const& tmpDesc(it.getValue());



+ 1
- 1
source/plugin/carla-vst.cpp View File

@@ -715,7 +715,7 @@ static intptr_t vst_dispatcherCallback(AEffect* effect, int32_t opcode, int32_t

PluginListManager& plm(PluginListManager::getInstance());

for (LinkedList<const NativePluginDescriptor*>::Itenerator it = plm.descs.begin(); it.valid(); it.next())
for (LinkedList<const NativePluginDescriptor*>::Itenerator it = plm.descs.begin2(); it.valid(); it.next())
{
const NativePluginDescriptor* const& tmpDesc(it.getValue());



+ 29
- 28
source/tests/RtLinkedList.cpp View File

@@ -24,15 +24,8 @@ const unsigned short MIN_RT_EVENTS = 5;
const unsigned short MAX_RT_EVENTS = 10;

struct MyData {
CarlaString str;
char str[234];
int id;

MyData() noexcept
: id(-1) {}

MyData(int i) noexcept
: str(i),
id(i) {}
};

struct PostRtEvents {
@@ -43,8 +36,8 @@ struct PostRtEvents {

PostRtEvents() noexcept
: dataPool(MIN_RT_EVENTS, MAX_RT_EVENTS),
data(dataPool, true),
dataPendingRT(dataPool, true) {}
data(dataPool),
dataPendingRT(dataPool) {}

~PostRtEvents() noexcept
{
@@ -68,16 +61,17 @@ struct PostRtEvents {
{
if (mutex.tryLock())
{
dataPendingRT.spliceAppendTo(data);
dataPendingRT.moveTo(data, true);
mutex.unlock();
}
}

} postRtEvents;

void run5Tests();
void run5Tests()
{
unsigned short k = 0;
ushort k = 0;
MyData allMyData[MAX_RT_EVENTS];

// Make a safe copy of events while clearing them
@@ -85,7 +79,8 @@ void run5Tests()

while (! postRtEvents.data.isEmpty())
{
MyData& my(postRtEvents.data.getFirst(true));
static MyData fallback = { { '\0' }, 0 };
const MyData& my(postRtEvents.data.getFirst(fallback, true));
allMyData[k++] = my;
}

@@ -101,21 +96,21 @@ void run5Tests()
assert(postRtEvents.dataPendingRT.isEmpty());

// Handle events now
for (unsigned short i=0; i < k; ++i)
for (ushort i=0; i < k; ++i)
{
const MyData& my(allMyData[i]);

carla_stdout("Got data: %i %s", my.id, my.str.buffer());
carla_stdout("Got data: %i %s", my.id, my.str);
}
}

int main()
{
MyData m1(1);
MyData m2(2);
MyData m3(3);
MyData m4(4);
MyData m5(5);
MyData m1; m1.id = 1; std::strcpy(m1.str, "1");
MyData m2; m2.id = 2; std::strcpy(m2.str, "2");
MyData m3; m3.id = 3; std::strcpy(m3.str, "3");
MyData m4; m4.id = 4; std::strcpy(m4.str, "4");
MyData m5; m5.id = 5; std::strcpy(m5.str, "5");

// start
assert(postRtEvents.data.count() == 0);
@@ -125,6 +120,8 @@ int main()

// single append
postRtEvents.appendRT(m1);
assert(postRtEvents.data.count() == 0);
assert(postRtEvents.dataPendingRT.count() == 1);
postRtEvents.trySplice();
assert(postRtEvents.data.count() == 1);
assert(postRtEvents.dataPendingRT.count() == 0);
@@ -139,24 +136,28 @@ int main()
assert(postRtEvents.data.count() == 4);
assert(postRtEvents.dataPendingRT.count() == 0);

for (RtLinkedList<MyData>::Itenerator it = postRtEvents.data.begin(); it.valid(); it.next())
for (RtLinkedList<MyData>::Itenerator it = postRtEvents.data.begin2(); it.valid(); it.next())
{
const MyData& my(it.getValue());

carla_stdout("FOR DATA!!!: %i %s", my.id, my.str.buffer());
carla_stdout("FOR DATA!!!: %i %s", my.id, my.str);

if (my.id == 1)
if (my.id == 2)
{
// +1 append at
// +1 append
postRtEvents.dataPendingRT.insertAt(m5, it);
assert(postRtEvents.data.count() == 4);
assert(postRtEvents.dataPendingRT.count() == 1);
postRtEvents.trySplice();
assert(postRtEvents.data.count() == 5);
assert(postRtEvents.dataPendingRT.count() == 0);
}
}

for (const MyData& my : postRtEvents.data)
carla_stdout("FOR DATA!!! NEW AUTO Itenerator!!!: %i %s", my.id, my.str);

postRtEvents.trySplice();
assert(postRtEvents.data.count() == 5);
assert(postRtEvents.dataPendingRT.count() == 0);

run5Tests();

// reset
@@ -179,7 +180,7 @@ int main()
{
for (size_t j=0, count=evIns.count(); j < count; ++j)
{
const uint32_t& type(evIns.getAt(j));
const uint32_t& type(evIns.getAt(j, 0));

if (type == CARLA_EVENT_DATA_ATOM)
pass();


+ 7
- 7
source/tests/ansi-pedantic-test.c View File

@@ -47,22 +47,22 @@ int main(int argc, char* argv[])
EngineDriverDeviceInfo e;

CarlaPluginInfo f;
CarlaCachedPluginInfo g;
/*CarlaCachedPluginInfo g;*/
CarlaPortCountInfo h;
CarlaParameterInfo i;
CarlaScalePointInfo j;
CarlaTransportInfo k;

const char* licenseText;
const char* fileExtensions;
/*const char* licenseText;
const char* fileExtensions;*/

uint l, count;

licenseText = carla_get_complete_license_text();
/*licenseText = carla_get_complete_license_text();
printf("LICENSE:\n%s\n", licenseText);

fileExtensions = carla_get_supported_file_extensions();
printf("FILE EXTENSIONS:\n%s\n", fileExtensions);
printf("FILE EXTENSIONS:\n%s\n", fileExtensions);*/

count = carla_get_engine_driver_count();
printf("DRIVER COUNT: %i\n", count);
@@ -94,7 +94,7 @@ int main(int argc, char* argv[])
assert(engine != nullptr);
engine->getLastError();
#endif
if (carla_add_plugin(BINARY_NATIVE, PLUGIN_INTERNAL, NULL, NULL, "audiofile", 0, NULL))
if (carla_add_plugin(BINARY_NATIVE, PLUGIN_INTERNAL, NULL, NULL, "audiofile", 0, NULL, 0x0))
{
#ifdef __cplusplus
CarlaPlugin* const plugin(engine->getPlugin(0));
@@ -128,7 +128,7 @@ int main(int argc, char* argv[])
(void)argc;
(void)argv;
(void)a; (void)b; (void)c; (void)d; (void)e;
(void)f; (void)g; (void)h; (void)i; (void)j; (void)k;
(void)f; /*(void)g;*/ (void)h; (void)i; (void)j; (void)k;
#ifdef __cplusplus
(void)e1; (void)e2; (void)e4; (void)e5; (void)e6;
#endif


+ 3
- 3
source/utils/CarlaLibCounter.hpp View File

@@ -34,7 +34,7 @@ public:
~LibCounter() noexcept
{
// might have some leftovers
for (LinkedList<Lib>::Itenerator it = fLibs.begin(); it.valid(); it.next())
for (LinkedList<Lib>::Itenerator it = fLibs.begin2(); it.valid(); it.next())
{
static Lib libFallback = { nullptr, nullptr, 0, false };

@@ -73,7 +73,7 @@ public:

const CarlaMutexLocker cml(fMutex);

for (LinkedList<Lib>::Itenerator it = fLibs.begin(); it.valid(); it.next())
for (LinkedList<Lib>::Itenerator it = fLibs.begin2(); it.valid(); it.next())
{
static Lib libFallback = { nullptr, nullptr, 0, false };

@@ -118,7 +118,7 @@ public:

const CarlaMutexLocker cml(fMutex);

for (LinkedList<Lib>::Itenerator it = fLibs.begin(); it.valid(); it.next())
for (LinkedList<Lib>::Itenerator it = fLibs.begin2(); it.valid(); it.next())
{
static Lib libFallback = { nullptr, nullptr, 0, false };



+ 4
- 4
source/utils/CarlaPatchbayUtils.cpp View File

@@ -24,7 +24,7 @@ uint PatchbayGroupList::getGroupId(const char* const groupName) const noexcept
{
CARLA_SAFE_ASSERT_RETURN(groupName != nullptr && groupName[0] != '\0', 0);

for (LinkedList<GroupNameToId>::Itenerator it = list.begin(); it.valid(); it.next())
for (LinkedList<GroupNameToId>::Itenerator it = list.begin2(); it.valid(); it.next())
{
const GroupNameToId& groupNameToId(it.getValue(kGroupNameToIdFallback));
CARLA_SAFE_ASSERT_CONTINUE(groupNameToId.group != 0);
@@ -40,7 +40,7 @@ const char* PatchbayGroupList::getGroupName(const uint groupId) const noexcept
{
static const char fallback[] = { '\0' };

for (LinkedList<GroupNameToId>::Itenerator it = list.begin(); it.valid(); it.next())
for (LinkedList<GroupNameToId>::Itenerator it = list.begin2(); it.valid(); it.next())
{
const GroupNameToId& groupNameToId(it.getValue(kGroupNameToIdFallback));
CARLA_SAFE_ASSERT_CONTINUE(groupNameToId.group != 0);
@@ -56,7 +56,7 @@ const char* PatchbayPortList::getFullPortName(const uint groupId, const uint por
{
static const char fallback[] = { '\0' };

for (LinkedList<PortNameToId>::Itenerator it = list.begin(); it.valid(); it.next())
for (LinkedList<PortNameToId>::Itenerator it = list.begin2(); it.valid(); it.next())
{
const PortNameToId& portNameToId(it.getValue(kPortNameToIdFallback));
CARLA_SAFE_ASSERT_CONTINUE(portNameToId.group != 0);
@@ -72,7 +72,7 @@ const PortNameToId& PatchbayPortList::getPortNameToId(const char* const fullPort
{
CARLA_SAFE_ASSERT_RETURN(fullPortName != nullptr && fullPortName[0] != '\0', kPortNameToIdFallback);

for (LinkedList<PortNameToId>::Itenerator it = list.begin(); it.valid(); it.next())
for (LinkedList<PortNameToId>::Itenerator it = list.begin2(); it.valid(); it.next())
{
const PortNameToId& portNameToId(it.getValue(kPortNameToIdFallback));
CARLA_SAFE_ASSERT_CONTINUE(portNameToId.group != 0);


+ 4
- 4
source/utils/CarlaStateUtils.cpp View File

@@ -258,13 +258,13 @@ void CarlaStateSave::clear() noexcept
currentMidiBank = -1;
currentMidiProgram = -1;

for (ParameterItenerator it = parameters.begin(); it.valid(); it.next())
for (ParameterItenerator it = parameters.begin2(); it.valid(); it.next())
{
Parameter* const stateParameter(it.getValue(nullptr));
delete stateParameter;
}

for (CustomDataItenerator it = customData.begin(); it.valid(); it.next())
for (CustomDataItenerator it = customData.begin2(); it.valid(); it.next())
{
CustomData* const stateCustomData(it.getValue(nullptr));
delete stateCustomData;
@@ -574,7 +574,7 @@ void CarlaStateSave::dumpToMemoryStream(MemoryOutputStream& content) const
}
#endif

for (ParameterItenerator it = parameters.begin(); it.valid(); it.next())
for (ParameterItenerator it = parameters.begin2(); it.valid(); it.next())
{
Parameter* const stateParameter(it.getValue(nullptr));
CARLA_SAFE_ASSERT_CONTINUE(stateParameter != nullptr);
@@ -631,7 +631,7 @@ void CarlaStateSave::dumpToMemoryStream(MemoryOutputStream& content) const
content << midiProgramXml;
}

for (CustomDataItenerator it = customData.begin(); it.valid(); it.next())
for (CustomDataItenerator it = customData.begin2(); it.valid(); it.next())
{
CustomData* const stateCustomData(it.getValue(nullptr));
CARLA_SAFE_ASSERT_CONTINUE(stateCustomData != nullptr);


+ 6
- 6
source/utils/CarlaStringList.hpp View File

@@ -134,7 +134,7 @@ protected:
tmpList[count] = nullptr;

std::size_t i=0;
for (LinkedList<const char*>::Itenerator it = list.begin(); it.valid(); it.next(), ++i)
for (LinkedList<const char*>::Itenerator it = list.begin2(); it.valid(); it.next(), ++i)
{
tmpList[i] = carla_strdup_safe(it.getValue(nullptr));
CARLA_SAFE_ASSERT_BREAK(tmpList[i] != nullptr);
@@ -162,7 +162,7 @@ public:
CarlaStringList(const CarlaStringList& list) noexcept
: LinkedList<const char*>()
{
for (Itenerator it = list.begin(); it.valid(); it.next())
for (Itenerator it = list.begin2(); it.valid(); it.next())
LinkedList<const char*>::append(carla_strdup_safe(it.getValue(nullptr)));
}

@@ -175,7 +175,7 @@ public:

void clear() noexcept
{
for (Itenerator it = begin(); it.valid(); it.next())
for (Itenerator it = begin2(); it.valid(); it.next())
{
if (const char* const string = it.getValue(nullptr))
delete[] string;
@@ -256,7 +256,7 @@ public:
{
CARLA_SAFE_ASSERT_RETURN(string != nullptr, false);

for (Itenerator it = begin(); it.valid(); it.next())
for (Itenerator it = begin2(); it.valid(); it.next())
{
const char* const stringComp(it.getValue(nullptr));
CARLA_SAFE_ASSERT_CONTINUE(stringComp != nullptr);
@@ -276,7 +276,7 @@ public:
{
CARLA_SAFE_ASSERT_RETURN(string != nullptr,);

for (Itenerator it = begin(); it.valid(); it.next())
for (Itenerator it = begin2(); it.valid(); it.next())
{
const char* const stringComp(it.getValue(nullptr));
CARLA_SAFE_ASSERT_CONTINUE(stringComp != nullptr);
@@ -315,7 +315,7 @@ public:
{
clear();

for (Itenerator it = list.begin(); it.valid(); it.next())
for (Itenerator it = list.begin2(); it.valid(); it.next())
{
if (const char* const string = carla_strdup_safe(it.getValue(nullptr)))
LinkedList<const char*>::append(string);


+ 18
- 14
source/utils/CarlaUtils.hpp View File

@@ -1,6 +1,6 @@
/*
* Carla common utils
* Copyright (C) 2011-2014 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2015 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -39,7 +39,7 @@
# include <unistd.h>
#endif

// -----------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// misc functions

/*
@@ -66,7 +66,7 @@ void nullStrBuf(char* const strBuf) noexcept
static inline
void pass() noexcept {}

// -----------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// string print functions

/*
@@ -148,7 +148,7 @@ void carla_stderr2(const char* const fmt, ...) noexcept
} catch (...) {}
}

// -----------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// carla_safe_assert*

/*
@@ -164,12 +164,14 @@ void carla_safe_assert(const char* const assertion, const char* const file, cons
* Print a safe assertion error message, with 1 extra integer value.
*/
static inline
void carla_safe_assert_int(const char* const assertion, const char* const file, const int line, const int value) noexcept
void carla_safe_assert_int(const char* const assertion, const char* const file, const int line,
const int value) noexcept
{
carla_stderr2("Carla assertion failure: \"%s\" in file %s, line %i, value %i", assertion, file, line, value);
}
static inline
void carla_safe_assert_uint(const char* const assertion, const char* const file, const int line, const uint value) noexcept
void carla_safe_assert_uint(const char* const assertion, const char* const file, const int line,
const uint value) noexcept
{
carla_stderr2("Carla assertion failure: \"%s\" in file %s, line %i, value %u", assertion, file, line, value);
}
@@ -178,17 +180,19 @@ void carla_safe_assert_uint(const char* const assertion, const char* const file,
* Print a safe assertion error message, with 2 extra integer values.
*/
static inline
void carla_safe_assert_int2(const char* const assertion, const char* const file, const int line, const int v1, const int v2) noexcept
void carla_safe_assert_int2(const char* const assertion, const char* const file, const int line,
const int v1, const int v2) noexcept
{
carla_stderr2("Carla assertion failure: \"%s\" in file %s, line %i, v1 %i, v2 %i", assertion, file, line, v1, v2);
}
static inline
void carla_safe_assert_uint2(const char* const assertion, const char* const file, const int line, const uint v1, const uint v2) noexcept
void carla_safe_assert_uint2(const char* const assertion, const char* const file, const int line,
const uint v1, const uint v2) noexcept
{
carla_stderr2("Carla assertion failure: \"%s\" in file %s, line %i, v1 %u, v2 %u", assertion, file, line, v1, v2);
}

// -----------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// carla_safe_exception*

/*
@@ -200,7 +204,7 @@ void carla_safe_exception(const char* const exception, const char* const file, c
carla_stderr2("Carla exception caught: \"%s\" in file %s, line %i", exception, file, line);
}

// -----------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// carla_*sleep

/*
@@ -237,7 +241,7 @@ void carla_msleep(const uint msecs) noexcept
} CARLA_SAFE_EXCEPTION("carla_msleep");
}

// -----------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// carla_setenv

/*
@@ -275,7 +279,7 @@ void carla_unsetenv(const char* const key) noexcept
#endif
}

// -----------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// carla_strdup

/*
@@ -337,7 +341,7 @@ const char* carla_strdup_safe(const char* const strBuf) noexcept
return buffer;
}

// -----------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// memory functions

/*
@@ -474,6 +478,6 @@ void carla_copyStruct(T* const struct1, const T* const struct2, const std::size_
std::memcpy(struct1, struct2, count*sizeof(T));
}

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

#endif // CARLA_UTILS_HPP_INCLUDED

+ 127
- 18
source/utils/LinkedList.hpp View File

@@ -67,15 +67,17 @@ protected:

AbstractLinkedList() noexcept
: kDataSize(sizeof(Data)),
fCount(0)
fCount(0),
#ifdef CARLA_PROPER_CPP11_SUPPORT
, fQueue({&fQueue, &fQueue}) {}
#else
fQueue({&fQueue, &fQueue}),
#endif
fUsingItenerator(false)
{
#ifndef CARLA_PROPER_CPP11_SUPPORT
fQueue.next = &fQueue;
fQueue.prev = &fQueue;
}
#endif
}

public:
virtual ~AbstractLinkedList() noexcept
@@ -85,15 +87,22 @@ public:

class Itenerator {
public:
Itenerator(const ListHead& queue) noexcept
Itenerator(const ListHead& queue, bool* usingItenerator) noexcept
: fEntry(queue.next),
fEntry2(fEntry->next),
kQueue(queue)
kQueue(queue),
fUsingItenerator(usingItenerator)
{
CARLA_SAFE_ASSERT(fEntry != nullptr);
CARLA_SAFE_ASSERT(fEntry2 != nullptr);
}

~Itenerator()
{
if (fUsingItenerator != nullptr)
*fUsingItenerator = false;
}

bool valid() const noexcept
{
return (fEntry != nullptr && fEntry != &kQueue);
@@ -132,7 +141,11 @@ public:
// TODO: remove this, fallback should be mandatory
T& getValue() const noexcept
{
static T& fallback(_getFallback());

Data* const data(list_entry(fEntry, Data, siblings));
CARLA_SAFE_ASSERT_RETURN(data != nullptr, fallback);

return data->value;
}

@@ -140,13 +153,103 @@ public:
ListHead* fEntry;
ListHead* fEntry2;
const ListHead& kQueue;
bool* const fUsingItenerator;

static T& _getFallback()
{
static T data;
carla_zeroStruct<T>(data);
return data;
}

friend class AbstractLinkedList;
};

Itenerator begin() const noexcept
class AutoItenerator {
public:
AutoItenerator(const ListHead* entry, bool* usingItenerator) noexcept
: fEntry(entry),
fEntry2(entry != nullptr ? entry->next : nullptr),
fUsingItenerator(usingItenerator)
{
CARLA_SAFE_ASSERT(fEntry != nullptr);
CARLA_SAFE_ASSERT(fEntry2 != nullptr);
}

~AutoItenerator() noexcept
{
if (fUsingItenerator != nullptr)
*fUsingItenerator = false;
}

bool operator!=(AutoItenerator& it) const noexcept
{
CARLA_SAFE_ASSERT_RETURN(fEntry != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(it.fEntry != nullptr, false);

return fEntry != it.fEntry;
}

AutoItenerator& operator++() noexcept
{
fEntry = fEntry2;
fEntry2 = (fEntry != nullptr) ? fEntry->next : nullptr;
return *this;
}

T& operator*() noexcept
{
static T& fallback(_getFallback());

Data* const data(list_entry(fEntry, Data, siblings));
CARLA_SAFE_ASSERT_RETURN(data != nullptr, fallback);

return data->value;
}

const T& operator*() const noexcept
{
static const T& fallback(_getFallback());

const Data* const data(list_entry_const(fEntry, Data, siblings));
CARLA_SAFE_ASSERT_RETURN(data != nullptr, fallback);

return data->value;
}

private:
ListHead* fEntry;
ListHead* fEntry2;
bool* const fUsingItenerator;

static T& _getFallback()
{
static T data;
carla_zeroStruct<T>(data);
return data;
}
};

Itenerator begin2() const noexcept
{
static const ListHead fallback = { nullptr, nullptr };
CARLA_SAFE_ASSERT_RETURN(! fUsingItenerator, Itenerator(fallback, nullptr));

fUsingItenerator = true;
return Itenerator(fQueue, &fUsingItenerator);
}

AutoItenerator begin() const noexcept
{
return Itenerator(fQueue);
CARLA_SAFE_ASSERT_RETURN(! fUsingItenerator, AutoItenerator(nullptr, nullptr));

fUsingItenerator = true;
return AutoItenerator(fQueue.next, &fUsingItenerator);
}

AutoItenerator end() const noexcept
{
return AutoItenerator(&fQueue, nullptr);
}

void clear() noexcept
@@ -246,11 +349,11 @@ public:
return fallback;
}

const T& getFirst(const T& fallback) const noexcept
T getFirst(T& fallback, const bool removeObj) noexcept
{
CARLA_SAFE_ASSERT_RETURN(fCount > 0, fallback);

return _get(fQueue.next, fallback);
return _get(fQueue.next, fallback, removeObj);
}

T& getFirst(T& fallback) const noexcept
@@ -260,18 +363,18 @@ public:
return _get(fQueue.next, fallback);
}

T getFirst(T& fallback, const bool removeObj) noexcept
const T& getFirst(const T& fallback) const noexcept
{
CARLA_SAFE_ASSERT_RETURN(fCount > 0, fallback);

return _get(fQueue.next, fallback, removeObj);
return _get(fQueue.next, fallback);
}

const T& getLast(const T& fallback) const noexcept
T getLast(T& fallback, const bool removeObj) noexcept
{
CARLA_SAFE_ASSERT_RETURN(fCount > 0, fallback);

return _get(fQueue.prev, fallback);
return _get(fQueue.prev, fallback, removeObj);
}

T& getLast(T& fallback) const noexcept
@@ -281,11 +384,11 @@ public:
return _get(fQueue.prev, fallback);
}

T getLast(T& fallback, const bool removeObj) noexcept
const T& getLast(const T& fallback) const noexcept
{
CARLA_SAFE_ASSERT_RETURN(fCount > 0, fallback);

return _get(fQueue.prev, fallback, removeObj);
return _get(fQueue.prev, fallback);
}

void remove(Itenerator& it) noexcept
@@ -331,9 +434,11 @@ public:
}

// move data to a new list, and clear ourselves
void moveTo(AbstractLinkedList<T>& list, const bool inTail = true) noexcept
bool moveTo(AbstractLinkedList<T>& list, const bool inTail = true) noexcept
{
CARLA_SAFE_ASSERT_RETURN(fCount > 0,);
CARLA_SAFE_ASSERT_RETURN(fCount > 0, false);
CARLA_SAFE_ASSERT_RETURN(! fUsingItenerator, false);
CARLA_SAFE_ASSERT_RETURN(! list.fUsingItenerator, false);

if (inTail)
__list_splice_tail(&fQueue, &list.fQueue);
@@ -345,6 +450,8 @@ public:

//! and we get nothing
_init();

return true;
}

protected:
@@ -353,6 +460,8 @@ protected:
std::size_t fCount;
ListHead fQueue;

mutable bool fUsingItenerator;

virtual Data* _allocate() noexcept = 0;
virtual void _deallocate(Data* const dataPtr) noexcept = 0;



+ 3
- 3
source/utils/RtLinkedList.hpp View File

@@ -125,11 +125,11 @@ public:
fMemPool.resize(minPreallocated, maxPreallocated);
}

void moveTo(RtLinkedList<T>& list, const bool inTail) noexcept
bool moveTo(RtLinkedList<T>& list, const bool inTail) noexcept
{
CARLA_SAFE_ASSERT_RETURN(fMemPool == list.fMemPool,);
CARLA_SAFE_ASSERT_RETURN(fMemPool == list.fMemPool, false);

AbstractLinkedList<T>::moveTo(list, inTail);
return AbstractLinkedList<T>::moveTo(list, inTail);
}

protected:


Loading…
Cancel
Save