Browse Source

Make things build again

tags/1.9.7
falkTX 9 years ago
parent
commit
8de9234e04
37 changed files with 237 additions and 237 deletions
  1. +13
    -13
      source/backend/CarlaStandalone.cpp
  2. +3
    -3
      source/backend/engine/CarlaEngine.cpp
  3. +27
    -27
      source/backend/engine/CarlaEngineBridge.cpp
  4. +6
    -6
      source/backend/engine/CarlaEngineData.cpp
  5. +8
    -8
      source/backend/engine/CarlaEngineGraph.cpp
  6. +2
    -2
      source/backend/engine/CarlaEngineInternal.cpp
  7. +6
    -6
      source/backend/engine/CarlaEngineJack.cpp
  8. +2
    -2
      source/backend/engine/CarlaEngineJuce.cpp
  9. +5
    -5
      source/backend/engine/CarlaEngineNative.cpp
  10. +2
    -2
      source/backend/engine/CarlaEnginePorts.cpp
  11. +4
    -4
      source/backend/engine/CarlaEngineRtAudio.cpp
  12. +17
    -17
      source/backend/plugin/CarlaPlugin.cpp
  13. +18
    -18
      source/backend/plugin/CarlaPluginBridge.cpp
  14. +4
    -4
      source/backend/plugin/CarlaPluginDSSI.cpp
  15. +2
    -2
      source/backend/plugin/CarlaPluginFluidSynth.cpp
  16. +7
    -7
      source/backend/plugin/CarlaPluginInternal.cpp
  17. +1
    -1
      source/backend/plugin/CarlaPluginJuce.cpp
  18. +3
    -3
      source/backend/plugin/CarlaPluginLADSPA.cpp
  19. +12
    -12
      source/backend/plugin/CarlaPluginLV2.cpp
  20. +6
    -6
      source/backend/plugin/CarlaPluginLinuxSampler.cpp
  21. +8
    -8
      source/backend/plugin/CarlaPluginNative.cpp
  22. +12
    -12
      source/backend/plugin/CarlaPluginVST2.cpp
  23. +13
    -13
      source/discovery/carla-discovery.cpp
  24. +1
    -1
      source/native-plugins/zynaddsubfx-fx.cpp
  25. +5
    -5
      source/native-plugins/zynaddsubfx-synth.cpp
  26. +4
    -4
      source/plugin/carla-dssi.cpp
  27. +7
    -7
      source/plugin/carla-lv2.cpp
  28. +6
    -6
      source/plugin/carla-vst.cpp
  29. +1
    -1
      source/tests/CarlaRingBuffer.cpp
  30. +12
    -12
      source/tests/CarlaUtils1.cpp
  31. +1
    -1
      source/utils/CarlaLibUtils.hpp
  32. +1
    -1
      source/utils/CarlaPipeUtils.cpp
  33. +2
    -2
      source/utils/CarlaPluginUI.cpp
  34. +2
    -2
      source/utils/CarlaRingBuffer.hpp
  35. +1
    -1
      source/utils/CarlaSemUtils.hpp
  36. +11
    -11
      source/utils/CarlaStateUtils.cpp
  37. +2
    -2
      source/utils/LinkedList.hpp

+ 13
- 13
source/backend/CarlaStandalone.cpp View File

@@ -949,9 +949,9 @@ const CarlaPluginInfo* carla_get_plugin_info(uint pluginId)
char strBufMaker[STR_MAX+1];
char strBufCopyright[STR_MAX+1];

carla_zeroChar(strBufLabel, STR_MAX+1);
carla_zeroChar(strBufMaker, STR_MAX+1);
carla_zeroChar(strBufCopyright, STR_MAX+1);
carla_zeroChars(strBufLabel, STR_MAX+1);
carla_zeroChars(strBufMaker, STR_MAX+1);
carla_zeroChars(strBufCopyright, STR_MAX+1);

info.type = plugin->getType();
info.category = plugin->getCategory();
@@ -1093,9 +1093,9 @@ const CarlaParameterInfo* carla_get_parameter_info(uint pluginId, uint32_t param
char strBufSymbol[STR_MAX+1];
char strBufUnit[STR_MAX+1];

carla_zeroChar(strBufName, STR_MAX+1);
carla_zeroChar(strBufSymbol, STR_MAX+1);
carla_zeroChar(strBufUnit, STR_MAX+1);
carla_zeroChars(strBufName, STR_MAX+1);
carla_zeroChars(strBufSymbol, STR_MAX+1);
carla_zeroChars(strBufUnit, STR_MAX+1);

info.scalePointCount = plugin->getParameterScalePointCount(parameterId);

@@ -1148,7 +1148,7 @@ const CarlaScalePointInfo* carla_get_parameter_scalepoint_info(uint pluginId, ui
if (scalePointId < plugin->getParameterScalePointCount(parameterId))
{
char strBufLabel[STR_MAX+1];
carla_zeroChar(strBufLabel, STR_MAX+1);
carla_zeroChars(strBufLabel, STR_MAX+1);

info.value = plugin->getParameterScalePointValue(parameterId, scalePointId);

@@ -1231,7 +1231,7 @@ const MidiProgramData* carla_get_midi_program_data(uint pluginId, uint32_t midiP
if (midiProgramId < plugin->getMidiProgramCount())
{
const MidiProgramData& ret(plugin->getMidiProgramData(midiProgramId));
carla_copyStruct<MidiProgramData>(midiProgData, ret);
carla_copyStruct(midiProgData, ret);
checkStringPtr(midiProgData.name);
return &midiProgData;
}
@@ -1262,7 +1262,7 @@ const CustomData* carla_get_custom_data(uint pluginId, uint32_t customDataId)
if (customDataId < plugin->getCustomDataCount())
{
const CustomData& ret(plugin->getCustomData(customDataId));
carla_copyStruct<CustomData>(customData, ret);
carla_copyStruct(customData, ret);
checkStringPtr(customData.type);
checkStringPtr(customData.key);
checkStringPtr(customData.value);
@@ -1376,7 +1376,7 @@ const char* carla_get_parameter_text(uint pluginId, uint32_t parameterId)
{
if (parameterId < plugin->getParameterCount())
{
carla_zeroChar(textBuf, STR_MAX+1);
carla_zeroChars(textBuf, STR_MAX+1);
plugin->getParameterText(parameterId, textBuf);
return textBuf;
}
@@ -1400,7 +1400,7 @@ const char* carla_get_program_name(uint pluginId, uint32_t programId)
{
if (programId < plugin->getProgramCount())
{
carla_zeroChar(programName, STR_MAX+1);
carla_zeroChars(programName, STR_MAX+1);
plugin->getProgramName(programId, programName);
return programName;
}
@@ -1424,7 +1424,7 @@ const char* carla_get_midi_program_name(uint pluginId, uint32_t midiProgramId)
{
if (midiProgramId < plugin->getMidiProgramCount())
{
carla_zeroChar(midiProgramName, STR_MAX+1);
carla_zeroChars(midiProgramName, STR_MAX+1);
plugin->getMidiProgramName(midiProgramId, midiProgramName);
return midiProgramName;
}
@@ -1446,7 +1446,7 @@ const char* carla_get_real_plugin_name(uint pluginId)

if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
{
carla_zeroChar(realPluginName, STR_MAX+1);
carla_zeroChars(realPluginName, STR_MAX+1);
plugin->getRealName(realPluginName);
return realPluginName;
}


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

@@ -659,7 +659,7 @@ bool CarlaEngine::removePlugin(const uint id)
# endif
#else
pData->curPluginCount = 0;
carla_zeroStruct(pData->plugins, 1);
carla_zeroStructs(pData->plugins, 1);
#endif

delete plugin;
@@ -769,7 +769,7 @@ bool CarlaEngine::clonePlugin(const uint id)
CARLA_SAFE_ASSERT_RETURN_ERR(plugin->getId() == id, "Invalid engine internal data");

char label[STR_MAX+1];
carla_zeroChar(label, STR_MAX+1);
carla_zeroChars(label, STR_MAX+1);
plugin->getLabel(label);

const uint pluginCountBefore(pData->curPluginCount);
@@ -895,7 +895,7 @@ const char* CarlaEngine::getUniquePluginName(const char* const name) const
return sname.dup();
}

const std::size_t maxNameSize(carla_minWithBase<uint>(getMaxClientNameSize(), 0xff, 6U) - 6); // 6 = strlen(" (10)") + 1
const std::size_t maxNameSize(carla_minConstrained<uint>(getMaxClientNameSize(), 0xff, 6U) - 6); // 6 = strlen(" (10)") + 1

if (maxNameSize == 0 || ! isRunning())
return sname.dup();


+ 27
- 27
source/backend/engine/CarlaEngineBridge.cpp View File

@@ -54,7 +54,7 @@ struct BridgeAudioPool {
: filename(),
data(nullptr)
{
carla_zeroChar(shm, 64);
carla_zeroChars(shm, 64);
jackbridge_shm_init(shm);
}

@@ -106,7 +106,7 @@ struct BridgeRtClientControl : public CarlaRingBufferControl<SmallStackBuffer> {
: filename(),
data(nullptr)
{
carla_zeroChar(shm, 64);
carla_zeroChars(shm, 64);
jackbridge_shm_init(shm);
}

@@ -195,7 +195,7 @@ struct BridgeNonRtClientControl : public CarlaRingBufferControl<BigStackBuffer>
: filename(),
data(nullptr)
{
carla_zeroChar(shm, 64);
carla_zeroChars(shm, 64);
jackbridge_shm_init(shm);
}

@@ -274,7 +274,7 @@ struct BridgeNonRtServerControl : public CarlaRingBufferControl<HugeStackBuffer>
filename(),
data(nullptr)
{
carla_zeroChar(shm, 64);
carla_zeroChars(shm, 64);
jackbridge_shm_init(shm);
}

@@ -574,27 +574,27 @@ public:
// uint/size, str[] (realName), uint/size, str[] (label), uint/size, str[] (maker), uint/size, str[] (copyright)
fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerPluginInfo2);

carla_zeroChar(bufStr, STR_MAX);
carla_zeroChars(bufStr, STR_MAX);
plugin->getRealName(bufStr);
bufStrSize = carla_fixValue(1U, 64U, static_cast<uint32_t>(std::strlen(bufStr)));
bufStrSize = carla_fixedValue(1U, 64U, static_cast<uint32_t>(std::strlen(bufStr)));
fShmNonRtServerControl.writeUInt(bufStrSize);
fShmNonRtServerControl.writeCustomData(bufStr, bufStrSize);

carla_zeroChar(bufStr, STR_MAX);
carla_zeroChars(bufStr, STR_MAX);
plugin->getLabel(bufStr);
bufStrSize = carla_fixValue(1U, 256U, static_cast<uint32_t>(std::strlen(bufStr)));
bufStrSize = carla_fixedValue(1U, 256U, static_cast<uint32_t>(std::strlen(bufStr)));
fShmNonRtServerControl.writeUInt(bufStrSize);
fShmNonRtServerControl.writeCustomData(bufStr, bufStrSize);

carla_zeroChar(bufStr, STR_MAX);
carla_zeroChars(bufStr, STR_MAX);
plugin->getMaker(bufStr);
bufStrSize = carla_fixValue(1U, 64U, static_cast<uint32_t>(std::strlen(bufStr)));
bufStrSize = carla_fixedValue(1U, 64U, static_cast<uint32_t>(std::strlen(bufStr)));
fShmNonRtServerControl.writeUInt(bufStrSize);
fShmNonRtServerControl.writeCustomData(bufStr, bufStrSize);

carla_zeroChar(bufStr, STR_MAX);
carla_zeroChars(bufStr, STR_MAX);
plugin->getCopyright(bufStr);
bufStrSize = carla_fixValue(1U, 64U, static_cast<uint32_t>(std::strlen(bufStr)));
bufStrSize = carla_fixedValue(1U, 64U, static_cast<uint32_t>(std::strlen(bufStr)));
fShmNonRtServerControl.writeUInt(bufStrSize);
fShmNonRtServerControl.writeCustomData(bufStr, bufStrSize);

@@ -656,21 +656,21 @@ public:
fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerParameterData2);
fShmNonRtServerControl.writeUInt(i);

carla_zeroChar(bufStr, STR_MAX);
carla_zeroChars(bufStr, STR_MAX);
plugin->getParameterName(i, bufStr);
bufStrSize = carla_fixValue(1U, 32U, static_cast<uint32_t>(std::strlen(bufStr)));
bufStrSize = carla_fixedValue(1U, 32U, static_cast<uint32_t>(std::strlen(bufStr)));
fShmNonRtServerControl.writeUInt(bufStrSize);
fShmNonRtServerControl.writeCustomData(bufStr, bufStrSize);

carla_zeroChar(bufStr, STR_MAX);
carla_zeroChars(bufStr, STR_MAX);
plugin->getParameterSymbol(i, bufStr);
bufStrSize = carla_fixValue(1U, 64U, static_cast<uint32_t>(std::strlen(bufStr)));
bufStrSize = carla_fixedValue(1U, 64U, static_cast<uint32_t>(std::strlen(bufStr)));
fShmNonRtServerControl.writeUInt(bufStrSize);
fShmNonRtServerControl.writeCustomData(bufStr, bufStrSize);

carla_zeroChar(bufStr, STR_MAX);
carla_zeroChars(bufStr, STR_MAX);
plugin->getParameterUnit(i, bufStr);
bufStrSize = carla_fixValue(1U, 32U, static_cast<uint32_t>(std::strlen(bufStr)));
bufStrSize = carla_fixedValue(1U, 32U, static_cast<uint32_t>(std::strlen(bufStr)));
fShmNonRtServerControl.writeUInt(bufStrSize);
fShmNonRtServerControl.writeCustomData(bufStr, bufStrSize);

@@ -720,9 +720,9 @@ public:
fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerProgramName);
fShmNonRtServerControl.writeUInt(i);

carla_zeroChar(bufStr, STR_MAX);
carla_zeroChars(bufStr, STR_MAX);
plugin->getProgramName(i, bufStr);
bufStrSize = carla_fixValue(1U, 32U, static_cast<uint32_t>(std::strlen(bufStr)));
bufStrSize = carla_fixedValue(1U, 32U, static_cast<uint32_t>(std::strlen(bufStr)));
fShmNonRtServerControl.writeUInt(bufStrSize);
fShmNonRtServerControl.writeCustomData(bufStr, bufStrSize);

@@ -750,7 +750,7 @@ public:
fShmNonRtServerControl.writeUInt(mpData.bank);
fShmNonRtServerControl.writeUInt(mpData.program);

bufStrSize = carla_fixValue(1U, 32U, static_cast<uint32_t>(std::strlen(mpData.name)));
bufStrSize = carla_fixedValue(1U, 32U, static_cast<uint32_t>(std::strlen(mpData.name)));
fShmNonRtServerControl.writeUInt(bufStrSize);
fShmNonRtServerControl.writeCustomData(mpData.name, bufStrSize);

@@ -989,19 +989,19 @@ public:
// type
const uint32_t typeSize(fShmNonRtClientControl.readUInt());
char typeStr[typeSize+1];
carla_zeroChar(typeStr, typeSize+1);
carla_zeroChars(typeStr, typeSize+1);
fShmNonRtClientControl.readCustomData(typeStr, typeSize);

// key
const uint32_t keySize(fShmNonRtClientControl.readUInt());
char keyStr[keySize+1];
carla_zeroChar(keyStr, keySize+1);
carla_zeroChars(keyStr, keySize+1);
fShmNonRtClientControl.readCustomData(keyStr, keySize);

// value
const uint32_t valueSize(fShmNonRtClientControl.readUInt());
char valueStr[valueSize+1];
carla_zeroChar(valueStr, valueSize+1);
carla_zeroChars(valueStr, valueSize+1);
fShmNonRtClientControl.readCustomData(valueStr, valueSize);

if (plugin != nullptr && plugin->isEnabled())
@@ -1014,7 +1014,7 @@ public:
CARLA_SAFE_ASSERT_BREAK(size > 0);

char chunkFilePathTry[size+1];
carla_zeroChar(chunkFilePathTry, size+1);
carla_zeroChars(chunkFilePathTry, size+1);
fShmNonRtClientControl.readCustomData(chunkFilePathTry, size);

CARLA_SAFE_ASSERT_BREAK(chunkFilePathTry[0] != '\0');
@@ -1430,7 +1430,7 @@ protected:
std::size_t curMidiDataPos = 0;

if (pData->events.in[0].type != kEngineEventTypeNull)
carla_zeroStruct<EngineEvent>(pData->events.in, kMaxEngineEventInternalCount);
carla_zeroStructs(pData->events.in, kMaxEngineEventInternalCount);

if (pData->events.out[0].type != kEngineEventTypeNull)
{
@@ -1490,7 +1490,7 @@ protected:
}
}

carla_zeroStruct<EngineEvent>(pData->events.out, kMaxEngineEventInternalCount);
carla_zeroStructs(pData->events.out, kMaxEngineEventInternalCount);
}

} break;


+ 6
- 6
source/backend/engine/CarlaEngineData.cpp View File

@@ -43,14 +43,14 @@ void EngineControlEvent::convertToMidiData(const uint8_t channel, uint8_t& size,
size = 3;
data[0] = static_cast<uint8_t>(MIDI_STATUS_CONTROL_CHANGE | (channel & MIDI_CHANNEL_BIT));
data[1] = MIDI_CONTROL_BANK_SELECT;
data[2] = uint8_t(carla_fixValue<float>(0.0f, float(MAX_MIDI_VALUE-1), value));
data[2] = uint8_t(carla_fixedValue<float>(0.0f, float(MAX_MIDI_VALUE-1), value));
}
else
{
size = 3;
data[0] = static_cast<uint8_t>(MIDI_STATUS_CONTROL_CHANGE | (channel & MIDI_CHANNEL_BIT));
data[1] = static_cast<uint8_t>(param);
data[2] = uint8_t(carla_fixValue<float>(0.0f, 1.0f, value) * float(MAX_MIDI_VALUE-1));
data[2] = uint8_t(carla_fixedValue<float>(0.0f, 1.0f, value) * float(MAX_MIDI_VALUE-1));
}
break;

@@ -58,13 +58,13 @@ void EngineControlEvent::convertToMidiData(const uint8_t channel, uint8_t& size,
size = 3;
data[0] = static_cast<uint8_t>(MIDI_STATUS_CONTROL_CHANGE | (channel & MIDI_CHANNEL_BIT));
data[1] = MIDI_CONTROL_BANK_SELECT;
data[2] = uint8_t(carla_fixValue<uint16_t>(0, MAX_MIDI_VALUE-1, param));
data[2] = uint8_t(carla_fixedValue<uint16_t>(0, MAX_MIDI_VALUE-1, param));
break;

case kEngineControlEventTypeMidiProgram:
size = 2;
data[0] = static_cast<uint8_t>(MIDI_STATUS_PROGRAM_CHANGE | (channel & MIDI_CHANNEL_BIT));
data[1] = uint8_t(carla_fixValue<uint16_t>(0, MAX_MIDI_VALUE-1, param));
data[1] = uint8_t(carla_fixedValue<uint16_t>(0, MAX_MIDI_VALUE-1, param));
break;

case kEngineControlEventTypeAllSoundOff:
@@ -133,7 +133,7 @@ void EngineEvent::fillFromMidiData(const uint8_t size, const uint8_t* const data
{
CARLA_SAFE_ASSERT_RETURN(size >= 3,);

const uint8_t midiValue(carla_fixValue<uint8_t>(0, 127, data[2])); // ensures 0.0<->1.0 value range
const uint8_t midiValue(carla_fixedValue<uint8_t>(0, 127, data[2])); // ensures 0.0<->1.0 value range

ctrl.type = kEngineControlEventTypeParameter;
ctrl.param = midiControl;
@@ -323,7 +323,7 @@ bool EngineTimeInfo::operator==(const EngineTimeInfo& timeInfo) const noexcept
return false;
if ((valid & kValidBBT) == 0)
return true;
if (! carla_compareFloats(timeInfo.bbt.beatsPerMinute, bbt.beatsPerMinute))
if (carla_isNotEqual(timeInfo.bbt.beatsPerMinute, bbt.beatsPerMinute))
return false;
return true;
}


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

@@ -789,7 +789,7 @@ void RackGraph::process(CarlaEngine::ProtectedData* const data, const float* inB
FloatVectorOperations::clear(outBuf[1], iframes);

// initialize event outputs (zero)
carla_zeroStruct<EngineEvent>(data->events.out, kMaxEngineEventInternalCount);
carla_zeroStructs(data->events.out, kMaxEngineEventInternalCount);

uint32_t oldAudioInCount = 0;
uint32_t oldAudioOutCount = 0;
@@ -827,10 +827,10 @@ void RackGraph::process(CarlaEngine::ProtectedData* const data, const float* inB
else
{
// initialize event inputs from previous outputs
carla_copyStruct<EngineEvent>(data->events.in, data->events.out, kMaxEngineEventInternalCount);
carla_copyStructs(data->events.in, data->events.out, kMaxEngineEventInternalCount);

// initialize event outputs (zero)
carla_zeroStruct<EngineEvent>(data->events.out, kMaxEngineEventInternalCount);
carla_zeroStructs(data->events.out, kMaxEngineEventInternalCount);
}
}

@@ -1217,7 +1217,7 @@ public:
EngineEvent* const engineEvents(port->fBuffer);
CARLA_SAFE_ASSERT_RETURN(engineEvents != nullptr,);

carla_zeroStruct<EngineEvent>(engineEvents, kMaxEngineEventInternalCount);
carla_zeroStructs(engineEvents, kMaxEngineEventInternalCount);
fillEngineEventsFromJuceMidiBuffer(engineEvents, midi);
}

@@ -1270,7 +1270,7 @@ public:
CARLA_SAFE_ASSERT_RETURN(engineEvents != nullptr,);

fillJuceMidiBufferFromEngineEvents(midi, engineEvents);
carla_zeroStruct<EngineEvent>(engineEvents, kMaxEngineEventInternalCount);
carla_zeroStructs(engineEvents, kMaxEngineEventInternalCount);
}

fPlugin->unlock();
@@ -1340,8 +1340,8 @@ PatchbayGraph::PatchbayGraph(CarlaEngine* const engine, const uint32_t ins, cons
graph(),
audioBuffer(),
midiBuffer(),
inputs(carla_fixValue(0U, MAX_PATCHBAY_PLUGINS-2, ins)),
outputs(carla_fixValue(0U, MAX_PATCHBAY_PLUGINS-2, outs)),
inputs(carla_fixedValue(0U, MAX_PATCHBAY_PLUGINS-2, ins)),
outputs(carla_fixedValue(0U, MAX_PATCHBAY_PLUGINS-2, outs)),
retCon(),
usingExternal(false),
extGraph(engine),
@@ -1845,7 +1845,7 @@ void PatchbayGraph::process(CarlaEngine::ProtectedData* const data, const float*

// put juce events in carla buffer
{
carla_zeroStruct<EngineEvent>(data->events.out, kMaxEngineEventInternalCount);
carla_zeroStructs(data->events.out, kMaxEngineEventInternalCount);
fillEngineEventsFromJuceMidiBuffer(data->events.out, midiBuffer);
midiBuffer.clear();
}


+ 2
- 2
source/backend/engine/CarlaEngineInternal.cpp View File

@@ -127,7 +127,7 @@ CarlaEngine::ProtectedData::ProtectedData(CarlaEngine* const engine) noexcept
nextAction()
{
#ifdef BUILD_BRIDGE
carla_zeroStruct(plugins, 1);
carla_zeroStructs(plugins, 1);
#endif
}

@@ -206,7 +206,7 @@ bool CarlaEngine::ProtectedData::init(const char* const clientName)

#ifndef BUILD_BRIDGE
plugins = new EnginePluginData[maxPluginNumber];
carla_zeroStruct(plugins, maxPluginNumber);
carla_zeroStructs(plugins, maxPluginNumber);
#endif

nextAction.ready();


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

@@ -690,7 +690,7 @@ public:
// FIXME: Always enable JACK transport for now
pData->options.transportMode = ENGINE_TRANSPORT_MODE_JACK;

carla_zeroStruct<jack_position_t>(fTransportPos);
carla_zeroStruct(fTransportPos);
}

~CarlaEngineJack() noexcept override
@@ -749,7 +749,7 @@ public:
fTransportState = JackTransportStopped;
fExternalPatchbay = true;

carla_zeroStruct<jack_position_t>(fTransportPos);
carla_zeroStruct(fTransportPos);

CarlaString truncatedClientName(clientName);
truncatedClientName.truncate(getMaxClientNameSize());
@@ -764,7 +764,7 @@ public:
return false;
}

if (pData->bufferSize == 0 || carla_compareFloats(pData->sampleRate, 0.0))
if (pData->bufferSize == 0 || carla_isEqual(pData->sampleRate, 0.0))
{
// open temp client to get initial buffer-size and sample-rate values
if (jack_client_t* const tmpClient = jackbridge_client_open(truncatedClientName, JackNoStartServer, nullptr))
@@ -1309,7 +1309,7 @@ protected:

void handleJackSampleRateCallback(const double newSampleRate)
{
if (carla_compareFloats(pData->sampleRate, newSampleRate))
if (carla_isEqual(pData->sampleRate, newSampleRate))
return;

pData->sampleRate = newSampleRate;
@@ -1439,8 +1439,8 @@ protected:
/**/ float* outBuf[2] = { audioOut1, audioOut2 };

// initialize events
carla_zeroStruct<EngineEvent>(pData->events.in, kMaxEngineEventInternalCount);
carla_zeroStruct<EngineEvent>(pData->events.out, kMaxEngineEventInternalCount);
carla_zeroStructs(pData->events.in, kMaxEngineEventInternalCount);
carla_zeroStructs(pData->events.out, kMaxEngineEventInternalCount);

{
ushort engineEventIndex = 0;


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

@@ -430,8 +430,8 @@ protected:
FloatVectorOperations::clear(outputChannelData[i], numSamples);

// initialize events
carla_zeroStruct<EngineEvent>(pData->events.in, kMaxEngineEventInternalCount);
carla_zeroStruct<EngineEvent>(pData->events.out, kMaxEngineEventInternalCount);
carla_zeroStructs(pData->events.in, kMaxEngineEventInternalCount);
carla_zeroStructs(pData->events.out, kMaxEngineEventInternalCount);

if (fMidiInEvents.mutex.tryLock())
{


+ 5
- 5
source/backend/engine/CarlaEngineNative.cpp View File

@@ -576,7 +576,7 @@ public:
if (gNeedsJuceHandling && ++gJuceReferenceCounter == 1)
juce::initialiseJuce_GUI();

carla_zeroChar(fTmpBuf, STR_MAX+1);
carla_zeroChars(fTmpBuf, STR_MAX+1);

pData->bufferSize = pHost->get_buffer_size(pHost->handle);
pData->sampleRate = pHost->get_sample_rate(pHost->handle);
@@ -732,7 +732,7 @@ protected:

void sampleRateChanged(const double newSampleRate)
{
if (carla_compareFloats(pData->sampleRate, newSampleRate))
if (carla_isEqual(pData->sampleRate, newSampleRate))
return;

{
@@ -1339,8 +1339,8 @@ protected:
// ---------------------------------------------------------------
// initialize events

carla_zeroStruct<EngineEvent>(pData->events.in, kMaxEngineEventInternalCount);
carla_zeroStruct<EngineEvent>(pData->events.out, kMaxEngineEventInternalCount);
carla_zeroStructs(pData->events.in, kMaxEngineEventInternalCount);
carla_zeroStructs(pData->events.out, kMaxEngineEventInternalCount);

// ---------------------------------------------------------------
// events input (before processing)
@@ -1385,7 +1385,7 @@ protected:
// ---------------------------------------------------------------
// events output (after processing)

carla_zeroStruct<EngineEvent>(pData->events.in, kMaxEngineEventInternalCount);
carla_zeroStructs(pData->events.in, kMaxEngineEventInternalCount);

{
NativeMidiEvent midiEvent;


+ 2
- 2
source/backend/engine/CarlaEnginePorts.cpp View File

@@ -112,7 +112,7 @@ void CarlaEngineEventPort::initBuffer() noexcept
if (kProcessMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK || kProcessMode == ENGINE_PROCESS_MODE_BRIDGE)
fBuffer = kClient.getEngine().getInternalEventBuffer(kIsInput);
else if (kProcessMode == ENGINE_PROCESS_MODE_PATCHBAY && ! kIsInput)
carla_zeroStruct<EngineEvent>(fBuffer, kMaxEngineEventInternalCount);
carla_zeroStructs(fBuffer, kMaxEngineEventInternalCount);
}

uint32_t CarlaEngineEventPort::getEventCount() const noexcept
@@ -178,7 +178,7 @@ bool CarlaEngineEventPort::writeControlEvent(const uint32_t time, const uint8_t

event.ctrl.type = type;
event.ctrl.param = param;
event.ctrl.value = carla_fixValue<float>(0.0f, 1.0f, value);
event.ctrl.value = carla_fixedValue<float>(0.0f, 1.0f, value);

return true;
}


+ 4
- 4
source/backend/engine/CarlaEngineRtAudio.cpp View File

@@ -249,8 +249,8 @@ public:
return false;
}

iParams.nChannels = carla_fixValue(0U, 128U, iParams.nChannels);
oParams.nChannels = carla_fixValue(0U, 128U, oParams.nChannels);
iParams.nChannels = carla_fixedValue(0U, 128U, iParams.nChannels);
oParams.nChannels = carla_fixedValue(0U, 128U, oParams.nChannels);
fAudioInterleaved = fAudio.getCurrentApi() == RtAudio::LINUX_PULSE;

RtAudio::StreamOptions rtOptions;
@@ -599,8 +599,8 @@ protected:
}

// initialize events
carla_zeroStruct<EngineEvent>(pData->events.in, kMaxEngineEventInternalCount);
carla_zeroStruct<EngineEvent>(pData->events.out, kMaxEngineEventInternalCount);
carla_zeroStructs(pData->events.in, kMaxEngineEventInternalCount);
carla_zeroStructs(pData->events.out, kMaxEngineEventInternalCount);

if (fMidiInEvents.mutex.tryLock())
{


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

@@ -1007,9 +1007,9 @@ void CarlaPlugin::setDryWet(const float value, const bool sendOsc, const bool se
{
CARLA_SAFE_ASSERT(value >= 0.0f && value <= 1.0f);

const float fixedValue(carla_fixValue<float>(0.0f, 1.0f, value));
const float fixedValue(carla_fixedValue<float>(0.0f, 1.0f, value));

if (carla_compareFloats(pData->postProc.dryWet, fixedValue))
if (carla_isEqual(pData->postProc.dryWet, fixedValue))
return;

pData->postProc.dryWet = fixedValue;
@@ -1030,9 +1030,9 @@ void CarlaPlugin::setVolume(const float value, const bool sendOsc, const bool se
{
CARLA_SAFE_ASSERT(value >= 0.0f && value <= 1.27f);

const float fixedValue(carla_fixValue<float>(0.0f, 1.27f, value));
const float fixedValue(carla_fixedValue<float>(0.0f, 1.27f, value));

if (carla_compareFloats(pData->postProc.volume, fixedValue))
if (carla_isEqual(pData->postProc.volume, fixedValue))
return;

pData->postProc.volume = fixedValue;
@@ -1053,9 +1053,9 @@ void CarlaPlugin::setBalanceLeft(const float value, const bool sendOsc, const bo
{
CARLA_SAFE_ASSERT(value >= -1.0f && value <= 1.0f);

const float fixedValue(carla_fixValue<float>(-1.0f, 1.0f, value));
const float fixedValue(carla_fixedValue<float>(-1.0f, 1.0f, value));

if (carla_compareFloats(pData->postProc.balanceLeft, fixedValue))
if (carla_isEqual(pData->postProc.balanceLeft, fixedValue))
return;

pData->postProc.balanceLeft = fixedValue;
@@ -1076,9 +1076,9 @@ void CarlaPlugin::setBalanceRight(const float value, const bool sendOsc, const b
{
CARLA_SAFE_ASSERT(value >= -1.0f && value <= 1.0f);

const float fixedValue(carla_fixValue<float>(-1.0f, 1.0f, value));
const float fixedValue(carla_fixedValue<float>(-1.0f, 1.0f, value));

if (carla_compareFloats(pData->postProc.balanceRight, fixedValue))
if (carla_isEqual(pData->postProc.balanceRight, fixedValue))
return;

pData->postProc.balanceRight = fixedValue;
@@ -1099,9 +1099,9 @@ void CarlaPlugin::setPanning(const float value, const bool sendOsc, const bool s
{
CARLA_SAFE_ASSERT(value >= -1.0f && value <= 1.0f);

const float fixedValue(carla_fixValue<float>(-1.0f, 1.0f, value));
const float fixedValue(carla_fixedValue<float>(-1.0f, 1.0f, value));

if (carla_compareFloats(pData->postProc.panning, fixedValue))
if (carla_isEqual(pData->postProc.panning, fixedValue))
return;

pData->postProc.panning = fixedValue;
@@ -1198,7 +1198,7 @@ void CarlaPlugin::setParameterValueByRealIndex(const int32_t rindex, const float
{
if (pData->param.data[i].rindex == rindex)
{
//if (! carla_compareFloats(getParameterValue(i), value))
//if (carla_isNotEqual(getParameterValue(i), value))
setParameterValue(i, value, sendGui, sendOsc, sendCallback);
break;
}
@@ -1648,10 +1648,10 @@ void CarlaPlugin::registerToOscClient() noexcept
// Base data
{
char bufName[STR_MAX+1], bufLabel[STR_MAX+1], bufMaker[STR_MAX+1], bufCopyright[STR_MAX+1];
carla_zeroChar(bufName, STR_MAX);
carla_zeroChar(bufLabel, STR_MAX);
carla_zeroChar(bufMaker, STR_MAX);
carla_zeroChar(bufCopyright, STR_MAX);
carla_zeroChars(bufName, STR_MAX);
carla_zeroChars(bufLabel, STR_MAX);
carla_zeroChars(bufMaker, STR_MAX);
carla_zeroChars(bufCopyright, STR_MAX);

getRealName(bufName);
getLabel(bufLabel);
@@ -1679,8 +1679,8 @@ void CarlaPlugin::registerToOscClient() noexcept

for (uint32_t i=0, maxParams=pData->engine->getOptions().maxParameters; i<count && i<maxParams; ++i)
{
carla_zeroChar(bufName, STR_MAX);
carla_zeroChar(bufUnit, STR_MAX);
carla_zeroChars(bufName, STR_MAX);
carla_zeroChars(bufUnit, STR_MAX);

getParameterName(i, bufName);
getParameterUnit(i, bufUnit);


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

@@ -1794,9 +1794,9 @@ public:
// Post-processing (dry/wet, volume and balance)

{
const bool doVolume = (pData->hints & PLUGIN_CAN_VOLUME) != 0 && ! carla_compareFloats(pData->postProc.volume, 1.0f);
const bool doDryWet = (pData->hints & PLUGIN_CAN_DRYWET) != 0 && ! carla_compareFloats(pData->postProc.dryWet, 1.0f);
const bool doBalance = (pData->hints & PLUGIN_CAN_BALANCE) != 0 && ! (carla_compareFloats(pData->postProc.balanceLeft, -1.0f) && carla_compareFloats(pData->postProc.balanceRight, 1.0f));
const bool doVolume = (pData->hints & PLUGIN_CAN_VOLUME) != 0 && carla_isNotEqual(pData->postProc.volume, 1.0f);
const bool doDryWet = (pData->hints & PLUGIN_CAN_DRYWET) != 0 && carla_isNotEqual(pData->postProc.dryWet, 1.0f);
const bool doBalance = (pData->hints & PLUGIN_CAN_BALANCE) != 0 && ! (carla_isEqual(pData->postProc.balanceLeft, -1.0f) && carla_isEqual(pData->postProc.balanceRight, 1.0f));

bool isPair;
float bufValue, oldBufLeft[doBalance ? frames : 1];
@@ -2022,25 +2022,25 @@ public:
// realName
const uint32_t realNameSize(fShmNonRtServerControl.readUInt());
char realName[realNameSize+1];
carla_zeroChar(realName, realNameSize+1);
carla_zeroChars(realName, realNameSize+1);
fShmNonRtServerControl.readCustomData(realName, realNameSize);

// label
const uint32_t labelSize(fShmNonRtServerControl.readUInt());
char label[labelSize+1];
carla_zeroChar(label, labelSize+1);
carla_zeroChars(label, labelSize+1);
fShmNonRtServerControl.readCustomData(label, labelSize);

// maker
const uint32_t makerSize(fShmNonRtServerControl.readUInt());
char maker[makerSize+1];
carla_zeroChar(maker, makerSize+1);
carla_zeroChars(maker, makerSize+1);
fShmNonRtServerControl.readCustomData(maker, makerSize);

// copyright
const uint32_t copyrightSize(fShmNonRtServerControl.readUInt());
char copyright[copyrightSize+1];
carla_zeroChar(copyright, copyrightSize+1);
carla_zeroChars(copyright, copyrightSize+1);
fShmNonRtServerControl.readCustomData(copyright, copyrightSize);

fInfo.name = realName;
@@ -2141,19 +2141,19 @@ public:
// name
const uint32_t nameSize(fShmNonRtServerControl.readUInt());
char name[nameSize+1];
carla_zeroChar(name, nameSize+1);
carla_zeroChars(name, nameSize+1);
fShmNonRtServerControl.readCustomData(name, nameSize);

// symbol
const uint32_t symbolSize(fShmNonRtServerControl.readUInt());
char symbol[symbolSize+1];
carla_zeroChar(symbol, symbolSize+1);
carla_zeroChars(symbol, symbolSize+1);
fShmNonRtServerControl.readCustomData(symbol, symbolSize);

// unit
const uint32_t unitSize(fShmNonRtServerControl.readUInt());
char unit[unitSize+1];
carla_zeroChar(unit, unitSize+1);
carla_zeroChars(unit, unitSize+1);
fShmNonRtServerControl.readCustomData(unit, unitSize);

CARLA_SAFE_ASSERT_INT2(index < pData->param.count, index, pData->param.count);
@@ -2254,7 +2254,7 @@ public:
// name
const uint32_t nameSize(fShmNonRtServerControl.readUInt());
char name[nameSize+1];
carla_zeroChar(name, nameSize+1);
carla_zeroChars(name, nameSize+1);
fShmNonRtServerControl.readCustomData(name, nameSize);

CARLA_SAFE_ASSERT_INT2(index < pData->prog.count, index, pData->prog.count);
@@ -2276,7 +2276,7 @@ public:
// name
const uint32_t nameSize(fShmNonRtServerControl.readUInt());
char name[nameSize+1];
carla_zeroChar(name, nameSize+1);
carla_zeroChars(name, nameSize+1);
fShmNonRtServerControl.readCustomData(name, nameSize);

CARLA_SAFE_ASSERT_INT2(index < pData->midiprog.count, index, pData->midiprog.count);
@@ -2297,19 +2297,19 @@ public:
// type
const uint32_t typeSize(fShmNonRtServerControl.readUInt());
char type[typeSize+1];
carla_zeroChar(type, typeSize+1);
carla_zeroChars(type, typeSize+1);
fShmNonRtServerControl.readCustomData(type, typeSize);

// key
const uint32_t keySize(fShmNonRtServerControl.readUInt());
char key[keySize+1];
carla_zeroChar(key, keySize+1);
carla_zeroChars(key, keySize+1);
fShmNonRtServerControl.readCustomData(key, keySize);

// value
const uint32_t valueSize(fShmNonRtServerControl.readUInt());
char value[valueSize+1];
carla_zeroChar(value, valueSize+1);
carla_zeroChars(value, valueSize+1);
fShmNonRtServerControl.readCustomData(value, valueSize);

CarlaPlugin::setCustomData(type, key, value, false);
@@ -2321,7 +2321,7 @@ public:
// chunkFilePath
const uint32_t chunkFilePathSize(fShmNonRtServerControl.readUInt());
char chunkFilePath[chunkFilePathSize+1];
carla_zeroChar(chunkFilePath, chunkFilePathSize+1);
carla_zeroChars(chunkFilePath, chunkFilePathSize+1);
fShmNonRtServerControl.readCustomData(chunkFilePath, chunkFilePathSize);

String realChunkFilePath(chunkFilePath);
@@ -2382,7 +2382,7 @@ public:
// error
const uint32_t errorSize(fShmNonRtServerControl.readUInt());
char error[errorSize+1];
carla_zeroChar(error, errorSize+1);
carla_zeroChars(error, errorSize+1);
fShmNonRtServerControl.readCustomData(error, errorSize);

if (fInitiated)
@@ -2510,7 +2510,7 @@ public:
// init bridge thread
{
char shmIdsStr[6*4+1];
carla_zeroChar(shmIdsStr, 6*4+1);
carla_zeroChars(shmIdsStr, 6*4+1);

std::strncpy(shmIdsStr+6*0, &fShmAudioPool.filename[fShmAudioPool.filename.length()-6], 6);
std::strncpy(shmIdsStr+6*1, &fShmRtClientControl.filename[fShmRtClientControl.filename.length()-6], 6);


+ 4
- 4
source/backend/plugin/CarlaPluginDSSI.cpp View File

@@ -914,7 +914,7 @@ public:
carla_stderr2("WARNING - Broken plugin parameter '%s': min > max", paramName);
min = max - 0.1f;
}
else if (carla_compareFloats(min, max))
else if (carla_isEqual(min, max))
{
carla_stderr2("WARNING - Broken plugin parameter '%s': min == max", paramName);
max = min + 0.1f;
@@ -1341,7 +1341,7 @@ public:
}

ulong midiEventCount = 0;
carla_zeroStruct<snd_seq_event_t>(fMidiEvents, kPluginMaxMidiEvents);
carla_zeroStructs(fMidiEvents, kPluginMaxMidiEvents);

// --------------------------------------------------------------------------------------------------------
// Check if needs reset
@@ -1934,8 +1934,8 @@ public:
// Post-processing (dry/wet, volume and balance)

{
const bool doDryWet = (pData->hints & PLUGIN_CAN_DRYWET) != 0 && ! carla_compareFloats(pData->postProc.dryWet, 1.0f);
const bool doBalance = (pData->hints & PLUGIN_CAN_BALANCE) != 0 && ! (carla_compareFloats(pData->postProc.balanceLeft, -1.0f) && carla_compareFloats(pData->postProc.balanceRight, 1.0f));
const bool doDryWet = (pData->hints & PLUGIN_CAN_DRYWET) != 0 && carla_isNotEqual(pData->postProc.dryWet, 1.0f);
const bool doBalance = (pData->hints & PLUGIN_CAN_BALANCE) != 0 && ! (carla_isEqual(pData->postProc.balanceLeft, -1.0f) && carla_isEqual(pData->postProc.balanceRight, 1.0f));
const bool isMono = (pData->audioIn.count == 1);

bool isPair;


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

@@ -1418,8 +1418,8 @@ public:

{
// note - balance not possible with kUse16Outs, so we can safely skip fAudioOutBuffers
const bool doVolume = (pData->hints & PLUGIN_CAN_VOLUME) != 0 && ! carla_compareFloats(pData->postProc.volume, 1.0f);
const bool doBalance = (pData->hints & PLUGIN_CAN_BALANCE) != 0 && ! (carla_compareFloats(pData->postProc.balanceLeft, -1.0f) && carla_compareFloats(pData->postProc.balanceRight, 1.0f));
const bool doVolume = (pData->hints & PLUGIN_CAN_VOLUME) != 0 && carla_isNotEqual(pData->postProc.volume, 1.0f);
const bool doBalance = (pData->hints & PLUGIN_CAN_BALANCE) != 0 && ! (carla_isEqual(pData->postProc.balanceLeft, -1.0f) && carla_isEqual(pData->postProc.balanceRight, 1.0f));

float oldBufLeft[doBalance ? frames : 1];



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

@@ -49,7 +49,7 @@ void PluginAudioData::createNew(const uint32_t newCount)
CARLA_SAFE_ASSERT_RETURN(newCount > 0,);

ports = new PluginAudioPort[newCount];
carla_zeroStruct(ports, newCount);
carla_zeroStructs(ports, newCount);

count = newCount;
}
@@ -103,7 +103,7 @@ void PluginCVData::createNew(const uint32_t newCount)
CARLA_SAFE_ASSERT_RETURN(newCount > 0,);

ports = new PluginCVPort[newCount];
carla_zeroStruct(ports, newCount);
carla_zeroStructs(ports, newCount);

count = newCount;
}
@@ -200,7 +200,7 @@ void PluginParameterData::createNew(const uint32_t newCount, const bool withSpec
CARLA_SAFE_ASSERT_RETURN(newCount > 0,);

data = new ParameterData[newCount];
carla_zeroStruct(data, newCount);
carla_zeroStructs(data, newCount);

for (uint32_t i=0; i < newCount; ++i)
{
@@ -210,12 +210,12 @@ void PluginParameterData::createNew(const uint32_t newCount, const bool withSpec
}

ranges = new ParameterRanges[newCount];
carla_zeroStruct(ranges, newCount);
carla_zeroStructs(ranges, newCount);

if (withSpecial)
{
special = new SpecialParameterType[newCount];
carla_zeroStruct(special, newCount);
carla_zeroStructs(special, newCount);
}

count = newCount;
@@ -289,7 +289,7 @@ void PluginProgramData::createNew(const uint32_t newCount)
CARLA_SAFE_ASSERT_RETURN(newCount > 0,);

names = new ProgramName[newCount];
carla_zeroStruct(names, newCount);
carla_zeroStructs(names, newCount);

count = newCount;
current = -1;
@@ -339,7 +339,7 @@ void PluginMidiProgramData::createNew(const uint32_t newCount)
CARLA_SAFE_ASSERT_RETURN(newCount > 0,);

data = new MidiProgramData[newCount];
carla_zeroStruct(data, newCount);
carla_zeroStructs(data, newCount);

count = newCount;
current = -1;


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

@@ -1113,7 +1113,7 @@ protected:

bool getCurrentPosition(CurrentPositionInfo& result) override
{
carla_copyStruct<CurrentPositionInfo>(result, fPosInfo);
carla_copyStruct(result, fPosInfo);
return true;
}



+ 3
- 3
source/backend/plugin/CarlaPluginLADSPA.cpp View File

@@ -615,7 +615,7 @@ public:
carla_stderr2("WARNING - Broken plugin parameter '%s': min > max", paramName);
min = max - 0.1f;
}
else if (carla_compareFloats(min, max))
else if (carla_isEqual(min, max))
{
carla_stderr2("WARNING - Broken plugin parameter '%s': min == max", paramName);
max = min + 0.1f;
@@ -1211,8 +1211,8 @@ public:
// Post-processing (dry/wet, volume and balance)

{
const bool doDryWet = (pData->hints & PLUGIN_CAN_DRYWET) != 0 && ! carla_compareFloats(pData->postProc.dryWet, 1.0f);
const bool doBalance = (pData->hints & PLUGIN_CAN_BALANCE) != 0 && ! (carla_compareFloats(pData->postProc.balanceLeft, -1.0f) && carla_compareFloats(pData->postProc.balanceRight, 1.0f));
const bool doDryWet = (pData->hints & PLUGIN_CAN_DRYWET) != 0 && carla_isNotEqual(pData->postProc.dryWet, 1.0f);
const bool doBalance = (pData->hints & PLUGIN_CAN_BALANCE) != 0 && ! (carla_isEqual(pData->postProc.balanceLeft, -1.0f) && carla_isEqual(pData->postProc.balanceRight, 1.0f));
const bool isMono = (pData->audioIn.count == 1);

bool isPair;


+ 12
- 12
source/backend/plugin/CarlaPluginLV2.cpp View File

@@ -2091,7 +2091,7 @@ public:
max = (float)0xffffff;
}

if (carla_compareFloats(min, max))
if (carla_isEqual(min, max))
{
carla_stderr2("WARNING - Broken plugin parameter '%s': max == min", fRdfDescriptor->Ports[i].Name);
max = min + 0.1f;
@@ -2809,7 +2809,7 @@ public:
break;
case LV2_PORT_DESIGNATION_TIME_BAR_BEAT:
if ((timeInfo.valid & EngineTimeInfo::kValidBBT) != 0 && (fLastTimeInfo.bbt.tick != timeInfo.bbt.tick ||
!carla_compareFloats(fLastTimeInfo.bbt.ticksPerBeat, timeInfo.bbt.ticksPerBeat)))
!carla_isEqual(fLastTimeInfo.bbt.ticksPerBeat, timeInfo.bbt.ticksPerBeat)))
{
fParamBuffers[k] = static_cast<float>(static_cast<double>(timeInfo.bbt.beat) - 1.0 + (static_cast<double>(timeInfo.bbt.tick) / timeInfo.bbt.ticksPerBeat));
doPostRt = true;
@@ -2823,28 +2823,28 @@ public:
}
break;
case LV2_PORT_DESIGNATION_TIME_BEAT_UNIT:
if ((timeInfo.valid & EngineTimeInfo::kValidBBT) != 0 && ! carla_compareFloats(fLastTimeInfo.bbt.beatType, timeInfo.bbt.beatType))
if ((timeInfo.valid & EngineTimeInfo::kValidBBT) != 0 && carla_isNotEqual(fLastTimeInfo.bbt.beatType, timeInfo.bbt.beatType))
{
fParamBuffers[k] = timeInfo.bbt.beatType;
doPostRt = true;
}
break;
case LV2_PORT_DESIGNATION_TIME_BEATS_PER_BAR:
if ((timeInfo.valid & EngineTimeInfo::kValidBBT) != 0 && ! carla_compareFloats(fLastTimeInfo.bbt.beatsPerBar, timeInfo.bbt.beatsPerBar))
if ((timeInfo.valid & EngineTimeInfo::kValidBBT) != 0 && carla_isNotEqual(fLastTimeInfo.bbt.beatsPerBar, timeInfo.bbt.beatsPerBar))
{
fParamBuffers[k] = timeInfo.bbt.beatsPerBar;
doPostRt = true;
}
break;
case LV2_PORT_DESIGNATION_TIME_BEATS_PER_MINUTE:
if ((timeInfo.valid & EngineTimeInfo::kValidBBT) != 0 && ! carla_compareFloats(fLastTimeInfo.bbt.beatsPerMinute, timeInfo.bbt.beatsPerMinute))
if ((timeInfo.valid & EngineTimeInfo::kValidBBT) != 0 && carla_isNotEqual(fLastTimeInfo.bbt.beatsPerMinute, timeInfo.bbt.beatsPerMinute))
{
fParamBuffers[k] = static_cast<float>(timeInfo.bbt.beatsPerMinute);
doPostRt = true;
}
break;
case LV2_PORT_DESIGNATION_TIME_TICKS_PER_BEAT:
if ((timeInfo.valid & EngineTimeInfo::kValidBBT) != 0 && ! carla_compareFloats(fLastTimeInfo.bbt.ticksPerBeat, timeInfo.bbt.ticksPerBeat))
if ((timeInfo.valid & EngineTimeInfo::kValidBBT) != 0 && carla_isNotEqual(fLastTimeInfo.bbt.ticksPerBeat, timeInfo.bbt.ticksPerBeat))
{
fParamBuffers[k] = static_cast<float>(timeInfo.bbt.ticksPerBeat);
doPostRt = true;
@@ -2911,7 +2911,7 @@ public:

pData->postRtEvents.trySplice();

carla_copyStruct<EngineTimeInfo>(fLastTimeInfo, timeInfo);
carla_copyStruct(fLastTimeInfo, timeInfo);
}

// --------------------------------------------------------------------------------------------------------
@@ -3603,7 +3603,7 @@ public:

if (pData->param.data[k].hints & PARAMETER_IS_TRIGGER)
{
if (! carla_compareFloats(fParamBuffers[k], pData->param.ranges[k].def))
if (carla_isNotEqual(fParamBuffers[k], pData->param.ranges[k].def))
{
fParamBuffers[k] = pData->param.ranges[k].def;
pData->postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(k), 0, fParamBuffers[k]);
@@ -3618,8 +3618,8 @@ public:
// Post-processing (dry/wet, volume and balance)

{
const bool doDryWet = (pData->hints & PLUGIN_CAN_DRYWET) != 0 && ! carla_compareFloats(pData->postProc.dryWet, 1.0f);
const bool doBalance = (pData->hints & PLUGIN_CAN_BALANCE) != 0 && ! (carla_compareFloats(pData->postProc.balanceLeft, -1.0f) && carla_compareFloats(pData->postProc.balanceRight, 1.0f));
const bool doDryWet = (pData->hints & PLUGIN_CAN_DRYWET) != 0 && carla_isNotEqual(pData->postProc.dryWet, 1.0f);
const bool doBalance = (pData->hints & PLUGIN_CAN_BALANCE) != 0 && ! (carla_isEqual(pData->postProc.balanceLeft, -1.0f) && carla_isEqual(pData->postProc.balanceRight, 1.0f));
const bool isMono = (pData->audioIn.count == 1);

bool isPair;
@@ -3808,7 +3808,7 @@ public:
CARLA_ASSERT_INT(newSampleRate > 0.0, newSampleRate);
carla_debug("CarlaPluginLV2::sampleRateChanged(%g) - start", newSampleRate);

if (! carla_compareFloats(fLv2Options.sampleRate, newSampleRate))
if (carla_isNotEqual(fLv2Options.sampleRate, newSampleRate))
{
fLv2Options.sampleRate = newSampleRate;

@@ -4561,7 +4561,7 @@ public:

const float value(*(const float*)buffer);

//if (! carla_compareFloats(fParamBuffers[index], value))
//if (carla_isNotEqual(fParamBuffers[index], value))
setParameterValue(index, value, false, true, true);

} break;


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

@@ -219,11 +219,11 @@ public:
sSampler->SetGlobalMaxStreams(LinuxSampler::kMaxStreams);
sSampler->SetGlobalMaxVoices(LinuxSampler::kMaxVoices);

carla_zeroStruct(fCurProgs, MAX_MIDI_CHANNELS);
carla_zeroStruct(fSamplerChannels, MAX_MIDI_CHANNELS);
carla_zeroStruct(fEngineChannels, MAX_MIDI_CHANNELS);
carla_zeroStructs(fCurProgs, MAX_MIDI_CHANNELS);
carla_zeroStructs(fSamplerChannels, MAX_MIDI_CHANNELS);
carla_zeroStructs(fEngineChannels, MAX_MIDI_CHANNELS);

carla_zeroFloat(fParamBuffers, LinuxSamplerParametersMax);
carla_zeroFloats(fParamBuffers, LinuxSamplerParametersMax);

if (use16Outs && ! isGIG)
carla_stderr("Tried to use SFZ with 16 stereo outs, this doesn't make much sense so single stereo mode will be used instead");
@@ -1104,8 +1104,8 @@ public:
// Post-processing (dry/wet, volume and balance)

{
const bool doVolume = (pData->hints & PLUGIN_CAN_VOLUME) != 0 && ! carla_compareFloats(pData->postProc.volume, 1.0f);
const bool doBalance = (pData->hints & PLUGIN_CAN_BALANCE) != 0 && ! (carla_compareFloats(pData->postProc.balanceLeft, -1.0f) && carla_compareFloats(pData->postProc.balanceRight, 1.0f));
const bool doVolume = (pData->hints & PLUGIN_CAN_VOLUME) != 0 && carla_isNotEqual(pData->postProc.volume, 1.0f);
const bool doBalance = (pData->hints & PLUGIN_CAN_BALANCE) != 0 && ! (carla_isEqual(pData->postProc.balanceLeft, -1.0f) && carla_isEqual(pData->postProc.balanceRight, 1.0f));

float oldBufLeft[doBalance ? frames : 1];



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

@@ -190,9 +190,9 @@ public:
{
carla_debug("CarlaPluginNative::CarlaPluginNative(%p, %i)", engine, id);

carla_fill<int32_t>(fCurMidiProgs, 0, MAX_MIDI_CHANNELS);
carla_zeroStruct<NativeMidiEvent>(fMidiEvents, kPluginMaxMidiEvents*2);
carla_zeroStruct<NativeTimeInfo>(fTimeInfo);
carla_fill(fCurMidiProgs, 0, MAX_MIDI_CHANNELS);
carla_zeroStructs(fMidiEvents, kPluginMaxMidiEvents*2);
carla_zeroStruct(fTimeInfo);

fHost.handle = this;
fHost.resourceDir = carla_strdup(engine->getOptions().resourceDir);
@@ -1019,7 +1019,7 @@ public:
else if (max < min)
min = max;

if (carla_compareFloats(min, max))
if (carla_isEqual(min, max))
{
carla_stderr2("WARNING - Broken plugin parameter '%s': max == min", paramInfo->name);
max = min + 0.1f;
@@ -1320,7 +1320,7 @@ public:
}

fMidiEventCount = 0;
carla_zeroStruct<NativeMidiEvent>(fMidiEvents, kPluginMaxMidiEvents*2);
carla_zeroStructs(fMidiEvents, kPluginMaxMidiEvents*2);

// --------------------------------------------------------------------------------------------------------
// Check if needs reset
@@ -1461,7 +1461,7 @@ public:

if (fMidiEventCount > 0)
{
carla_zeroStruct<NativeMidiEvent>(fMidiEvents, fMidiEventCount);
carla_zeroStructs(fMidiEvents, fMidiEventCount);
fMidiEventCount = 0;
}
}
@@ -1888,8 +1888,8 @@ public:
// Post-processing (dry/wet, volume and balance)

{
const bool doDryWet = (pData->hints & PLUGIN_CAN_DRYWET) != 0 && ! carla_compareFloats(pData->postProc.dryWet, 1.0f);
const bool doBalance = (pData->hints & PLUGIN_CAN_BALANCE) != 0 && ! (carla_compareFloats(pData->postProc.balanceLeft, -1.0f) && carla_compareFloats(pData->postProc.balanceRight, 1.0f));
const bool doDryWet = (pData->hints & PLUGIN_CAN_DRYWET) != 0 && carla_isNotEqual(pData->postProc.dryWet, 1.0f);
const bool doBalance = (pData->hints & PLUGIN_CAN_BALANCE) != 0 && ! (carla_isEqual(pData->postProc.balanceLeft, -1.0f) && carla_isEqual(pData->postProc.balanceRight, 1.0f));

bool isPair;
float bufValue, oldBufLeft[doBalance ? frames : 1];


+ 12
- 12
source/backend/plugin/CarlaPluginVST2.cpp View File

@@ -77,8 +77,8 @@ public:
{
carla_debug("CarlaPluginVST2::CarlaPluginVST2(%p, %i)", engine, id);

carla_zeroStruct<VstMidiEvent>(fMidiEvents, kPluginMaxMidiEvents*2);
carla_zeroStruct<VstTimeInfo>(fTimeInfo);
carla_zeroStructs(fMidiEvents, kPluginMaxMidiEvents*2);
carla_zeroStruct(fTimeInfo);

for (ushort i=0; i < kPluginMaxMidiEvents*2; ++i)
fEvents.data[i] = (VstEvent*)&fMidiEvents[i];
@@ -620,7 +620,7 @@ public:
float min, max, def, step, stepSmall, stepLarge;

VstParameterProperties prop;
carla_zeroStruct<VstParameterProperties>(prop);
carla_zeroStruct(prop);

if (pData->hints & PLUGIN_HAS_COCKOS_EXTENSIONS)
{
@@ -637,7 +637,7 @@ public:
carla_stderr2("WARNING - Broken plugin parameter min > max (with cockos extensions)");
min = max - 0.1f;
}
else if (carla_compareFloats(min, max))
else if (carla_isEqual(min, max))
{
carla_stderr2("WARNING - Broken plugin parameter min == max (with cockos extensions)");
max = min + 0.1f;
@@ -679,7 +679,7 @@ public:
carla_stderr2("WARNING - Broken plugin parameter min > max");
min = max - 0.1f;
}
else if (carla_compareFloats(min, max))
else if (carla_isEqual(min, max))
{
carla_stderr2("WARNING - Broken plugin parameter min == max");
max = min + 0.1f;
@@ -1006,7 +1006,7 @@ public:
}

fMidiEventCount = 0;
carla_zeroStruct<VstMidiEvent>(fMidiEvents, kPluginMaxMidiEvents*2);
carla_zeroStructs(fMidiEvents, kPluginMaxMidiEvents*2);

// --------------------------------------------------------------------------------------------------------
// Check if needs reset
@@ -1174,7 +1174,7 @@ public:

if (fMidiEventCount > 0)
{
carla_zeroStruct<VstMidiEvent>(fMidiEvents, fMidiEventCount);
carla_zeroStructs(fMidiEvents, fMidiEventCount);
fMidiEventCount = 0;
}
}
@@ -1528,9 +1528,9 @@ public:
// Post-processing (dry/wet, volume and balance)

{
const bool doVolume = (pData->hints & PLUGIN_CAN_VOLUME) != 0 && ! carla_compareFloats(pData->postProc.volume, 1.0f);
const bool doDryWet = (pData->hints & PLUGIN_CAN_DRYWET) != 0 && ! carla_compareFloats(pData->postProc.dryWet, 1.0f);
const bool doBalance = (pData->hints & PLUGIN_CAN_BALANCE) != 0 && ! (carla_compareFloats(pData->postProc.balanceLeft, -1.0f) && carla_compareFloats(pData->postProc.balanceRight, 1.0f));
const bool doVolume = (pData->hints & PLUGIN_CAN_VOLUME) != 0 && carla_isNotEqual(pData->postProc.volume, 1.0f);
const bool doDryWet = (pData->hints & PLUGIN_CAN_DRYWET) != 0 && carla_isNotEqual(pData->postProc.dryWet, 1.0f);
const bool doBalance = (pData->hints & PLUGIN_CAN_BALANCE) != 0 && ! (carla_isEqual(pData->postProc.balanceLeft, -1.0f) && carla_isEqual(pData->postProc.balanceRight, 1.0f));

bool isPair;
float bufValue, oldBufLeft[doBalance ? frames : 1];
@@ -1798,7 +1798,7 @@ protected:

case audioMasterGetNumAutomatableParameters:
// Deprecated in VST SDK 2.4
ret = carla_fixValue<intptr_t>(0, static_cast<intptr_t>(pData->engine->getOptions().maxParameters), fEffect->numParams);
ret = carla_fixedValue<intptr_t>(0, static_cast<intptr_t>(pData->engine->getOptions().maxParameters), fEffect->numParams);
break;

case audioMasterGetParameterQuantization:
@@ -2139,7 +2139,7 @@ public:
else
{
char strBuf[STR_MAX+1];
carla_zeroChar(strBuf, STR_MAX+1);
carla_zeroChars(strBuf, STR_MAX+1);
dispatcher(effGetEffectName, 0, 0, strBuf, 0.0f);

if (strBuf[0] != '\0')


+ 13
- 13
source/discovery/carla-discovery.cpp View File

@@ -179,7 +179,7 @@ static intptr_t VSTCALLBACK vstHostCallback(AEffect* const effect, const int32_t
if (! gVstIsProcessing) { DISCOVERY_OUT("warning", "Plugin requested timeInfo out of process"); }
if (! gVstWantsTime) { DISCOVERY_OUT("warning", "Plugin requested timeInfo but didn't ask if host could do \"sendVstTimeInfo\""); }

carla_zeroStruct<VstTimeInfo>(timeInfo);
carla_zeroStruct(timeInfo);
timeInfo.sampleRate = kSampleRate;

// Tempo
@@ -549,7 +549,7 @@ static void do_ladspa_check(lib_t& libHandle, const char* const filename, const

if (LADSPA_IS_PORT_AUDIO(portDescriptor))
{
carla_zeroFloat(bufferAudio[iA], kBufferSize);
carla_zeroFloats(bufferAudio[iA], kBufferSize);
descriptor->connect_port(handle, j, bufferAudio[iA++]);
}
else if (LADSPA_IS_PORT_CONTROL(portDescriptor))
@@ -571,7 +571,7 @@ static void do_ladspa_check(lib_t& libHandle, const char* const filename, const
DISCOVERY_OUT("warning", "Parameter '" << portName << "' is broken: min > max");
max = min + 0.1f;
}
else if (carla_compareFloats(min, max))
else if (carla_isEqual(min, max))
{
DISCOVERY_OUT("warning", "Parameter '" << portName << "' is broken: max == min");
max = min + 0.1f;
@@ -820,7 +820,7 @@ static void do_dssi_check(lib_t& libHandle, const char* const filename, const bo

if (LADSPA_IS_PORT_AUDIO(portDescriptor))
{
carla_zeroFloat(bufferAudio[iA], kBufferSize);
carla_zeroFloats(bufferAudio[iA], kBufferSize);
ldescriptor->connect_port(handle, j, bufferAudio[iA++]);
}
else if (LADSPA_IS_PORT_CONTROL(portDescriptor))
@@ -842,7 +842,7 @@ static void do_dssi_check(lib_t& libHandle, const char* const filename, const bo
DISCOVERY_OUT("warning", "Parameter '" << portName << "' is broken: min > max");
max = min + 0.1f;
}
else if (carla_compareFloats(min, max))
else if (carla_isEqual(min, max))
{
DISCOVERY_OUT("warning", "Parameter '" << portName << "' is broken: max == min");
max = min + 0.1f;
@@ -889,7 +889,7 @@ static void do_dssi_check(lib_t& libHandle, const char* const filename, const bo
if (descriptor->run_synth != nullptr)
{
snd_seq_event_t midiEvents[2];
carla_zeroStruct<snd_seq_event_t>(midiEvents, 2);
carla_zeroStructs(midiEvents, 2);

const unsigned long midiEventCount = 2;

@@ -1193,7 +1193,7 @@ static void do_vst_check(lib_t& libHandle, const bool doInit)
{
for (;;)
{
carla_zeroChar(strBuf, STR_MAX+1);
carla_zeroChars(strBuf, STR_MAX+1);

gVstCurrentUniqueId = effect->dispatcher(effect, effShellGetNextPlugin, 0, 0, strBuf, 0.0f);

@@ -1232,7 +1232,7 @@ static void do_vst_check(lib_t& libHandle, const bool doInit)
}

// get name
carla_zeroChar(strBuf, STR_MAX+1);
carla_zeroChars(strBuf, STR_MAX+1);

if (effect->dispatcher(effect, effGetEffectName, 0, 0, strBuf, 0.0f) == 1)
cName = strBuf;
@@ -1240,7 +1240,7 @@ static void do_vst_check(lib_t& libHandle, const bool doInit)
cName.clear();

// get product
carla_zeroChar(strBuf, STR_MAX+1);
carla_zeroChars(strBuf, STR_MAX+1);

if (effect->dispatcher(effect, effGetProductString, 0, 0, strBuf, 0.0f) == 1)
cProduct = strBuf;
@@ -1248,7 +1248,7 @@ static void do_vst_check(lib_t& libHandle, const bool doInit)
cProduct.clear();

// get vendor
carla_zeroChar(strBuf, STR_MAX+1);
carla_zeroChars(strBuf, STR_MAX+1);

if (effect->dispatcher(effect, effGetVendorString, 0, 0, strBuf, 0.0f) == 1)
cVendor = strBuf;
@@ -1299,14 +1299,14 @@ static void do_vst_check(lib_t& libHandle, const bool doInit)
for (int j=0; j < audioIns; ++j)
{
bufferAudioIn[j] = new float[kBufferSize];
carla_zeroFloat(bufferAudioIn[j], kBufferSize);
carla_zeroFloats(bufferAudioIn[j], kBufferSize);
}

float* bufferAudioOut[audioOuts];
for (int j=0; j < audioOuts; ++j)
{
bufferAudioOut[j] = new float[kBufferSize];
carla_zeroFloat(bufferAudioOut[j], kBufferSize);
carla_zeroFloats(bufferAudioOut[j], kBufferSize);
}

struct VstEventsFixed {
@@ -1323,7 +1323,7 @@ static void do_vst_check(lib_t& libHandle, const bool doInit)
} events;

VstMidiEvent midiEvents[2];
carla_zeroStruct<VstMidiEvent>(midiEvents, 2);
carla_zeroStructs(midiEvents, 2);

midiEvents[0].type = kVstMidiType;
midiEvents[0].byteSize = sizeof(VstMidiEvent);


+ 1
- 1
source/native-plugins/zynaddsubfx-fx.cpp View File

@@ -106,7 +106,7 @@ protected:

void setParameterValue(const uint32_t index, const float value) final
{
const int ivalue(roundToIntAccurate(carla_fixValue(0.0f, 127.0f, value)));
const int ivalue(roundToIntAccurate(carla_fixedValue(0.0f, 127.0f, value)));

fEffect->changepar(static_cast<int>(index+2), static_cast<uchar>(ivalue));
}


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

@@ -449,10 +449,10 @@ protected:
}
else if (index <= kParamPart16Volume)
{
if (carla_compareFloats(fParameters[index], value))
if (carla_isEqual(fParameters[index], value))
return;

fParameters[index] = std::round(carla_fixValue(0.0f, 127.0f, value));
fParameters[index] = std::round(carla_fixedValue(0.0f, 127.0f, value));

fMiddleWare->transmitMsg("/echo", "ss", "OSC_URL", "");
fMiddleWare->activeUrl("");
@@ -463,10 +463,10 @@ protected:
}
else if (index <= kParamPart16Panning)
{
if (carla_compareFloats(fParameters[index], value))
if (carla_isEqual(fParameters[index], value))
return;

fParameters[index] = std::round(carla_fixValue(0.0f, 127.0f, value));
fParameters[index] = std::round(carla_fixedValue(0.0f, 127.0f, value));

fMiddleWare->transmitMsg("/echo", "ss", "OSC_URL", "");
fMiddleWare->activeUrl("");
@@ -480,7 +480,7 @@ protected:
const uint zynIndex(getZynParameterFromIndex(index));
CARLA_SAFE_ASSERT_RETURN(zynIndex != C_NULL,);

fParameters[index] = std::round(carla_fixValue(0.0f, 127.0f, value));
fParameters[index] = std::round(carla_fixedValue(0.0f, 127.0f, value));

for (int npart=0; npart<NUM_MIDI_PARTS; ++npart)
{


+ 4
- 4
source/plugin/carla-dssi.cpp View File

@@ -208,8 +208,8 @@ public:
if (fHandle == nullptr)
return false;

carla_zeroStruct<NativeMidiEvent>(fMidiEvents, kMaxMidiEvents*2);
carla_zeroStruct<NativeTimeInfo>(fTimeInfo);
carla_zeroStructs(fMidiEvents, kMaxMidiEvents*2);
carla_zeroStruct(fTimeInfo);

fPorts.init(fDescriptor, fHandle);
fUris.map(fUridMap);
@@ -230,7 +230,7 @@ public:
if (fDescriptor->activate != nullptr)
fDescriptor->activate(fHandle);

carla_zeroStruct<NativeTimeInfo>(fTimeInfo);
carla_zeroStruct(fTimeInfo);
}

void lv2_deactivate()
@@ -294,7 +294,7 @@ public:
if (fDescriptor->midiIns > 0 || (fDescriptor->hints & PLUGIN_USES_TIME) != 0)
{
fMidiEventCount = 0;
carla_zeroStruct<NativeMidiEvent>(fMidiEvents, kMaxMidiEvents*2);
carla_zeroStructs(fMidiEvents, kMaxMidiEvents*2);

LV2_ATOM_SEQUENCE_FOREACH(fPorts.eventsIn[0], iter)
{


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

@@ -211,8 +211,8 @@ public:
fHandle = fDescriptor->instantiate(&fHost);
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr, false);

carla_zeroStruct<NativeMidiEvent>(fMidiEvents, kMaxMidiEvents*2);
carla_zeroStruct<NativeTimeInfo>(fTimeInfo);
carla_zeroStructs(fMidiEvents, kMaxMidiEvents*2);
carla_zeroStruct(fTimeInfo);

fPorts.init(fDescriptor, fHandle);
fURIs.map(fUridMap);
@@ -233,7 +233,7 @@ public:
if (fDescriptor->activate != nullptr)
fDescriptor->activate(fHandle);

carla_zeroStruct<NativeTimeInfo>(fTimeInfo);
carla_zeroStruct(fTimeInfo);
}

void lv2_deactivate()
@@ -270,7 +270,7 @@ public:

curValue = *fPorts.paramsPtr[i];

if (carla_compareFloats(fPorts.paramsLast[i], curValue))
if (carla_isEqual(fPorts.paramsLast[i], curValue))
continue;

fPorts.paramsLast[i] = curValue;
@@ -280,7 +280,7 @@ public:
if (fDescriptor->midiIns > 0 || fDescriptor->midiOuts > 0 || (fDescriptor->hints & NATIVE_PLUGIN_USES_TIME) != 0)
{
fMidiEventCount = 0;
carla_zeroStruct<NativeMidiEvent>(fMidiEvents, kMaxMidiEvents*2);
carla_zeroStructs(fMidiEvents, kMaxMidiEvents*2);

if (fDescriptor->hints & NATIVE_PLUGIN_USES_TIME)
{
@@ -432,7 +432,7 @@ public:
if (speed != nullptr && speed->type == fURIs.atomFloat)
{
fLastTimeSpeed = ((LV2_Atom_Float*)speed)->body;
fTimeInfo.playing = carla_compareFloats(fLastTimeSpeed, 1.0);
fTimeInfo.playing = carla_isEqual(fLastTimeSpeed, 1.0);
}

fTimeInfo.bbt.valid = (beatsPerMinute != nullptr && beatsPerBar != nullptr && beatUnit != nullptr);
@@ -477,7 +477,7 @@ public:
fIsProcessing = false;

// update timePos for next callback
if (! carla_compareFloats(fLastTimeSpeed, 0.0))
if (carla_isNotEqual(fLastTimeSpeed, 0.0))
{
const double newFrames = fLastTimeSpeed*frames;



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

@@ -168,8 +168,8 @@ public:
fHandle = fDescriptor->instantiate(&fHost);
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr, false);

carla_zeroStruct<NativeMidiEvent>(fMidiEvents, kMaxMidiEvents);
carla_zeroStruct<NativeTimeInfo>(fTimeInfo);
carla_zeroStructs(fMidiEvents, kMaxMidiEvents);
carla_zeroStruct(fTimeInfo);

return true;
}
@@ -185,7 +185,7 @@ public:
switch (opcode)
{
case effSetSampleRate:
if (carla_compareFloats(fSampleRate, static_cast<double>(opt)))
if (carla_isEqual(fSampleRate, static_cast<double>(opt)))
return 0;

fSampleRate = opt;
@@ -208,7 +208,7 @@ public:
if (value != 0)
{
fMidiEventCount = 0;
carla_zeroStruct<NativeTimeInfo>(fTimeInfo);
carla_zeroStruct(fTimeInfo);

// tell host we want MIDI events
hostCallback(audioMasterWantMidi);
@@ -229,7 +229,7 @@ public:
fDescriptor->dispatcher(fHandle, NATIVE_PLUGIN_OPCODE_BUFFER_SIZE_CHANGED, 0, (int32_t)value, nullptr, 0.0f);
}

if (sampleRate != 0.0 && ! carla_compareFloats(fSampleRate, sampleRate))
if (sampleRate != 0.0 && carla_isNotEqual(fSampleRate, sampleRate))
{
fSampleRate = sampleRate;

@@ -588,7 +588,7 @@ private:
{
for (uint32_t i=0; i<kMaxMidiEvents; ++i)
data[i] = (VstEvent*)&mdata[i];
carla_zeroStruct<VstMidiEvent>(mdata, kMaxMidiEvents);
carla_zeroStructs(mdata, kMaxMidiEvents);
}

CARLA_DECLARE_NON_COPY_STRUCT(FixedVstEvents);


+ 1
- 1
source/tests/CarlaRingBuffer.cpp View File

@@ -147,7 +147,7 @@ static void test_CarlaRingBuffer3(CarlaRingBuffer<BufferStruct>& b) noexcept

// read data
char license[kLicenseSize+1];
carla_zeroChar(license, kLicenseSize+1);
carla_zeroChars(license, kLicenseSize+1);
b.readCustomData(license, kLicenseSize);

// now empty again


+ 12
- 12
source/tests/CarlaUtils1.cpp View File

@@ -473,18 +473,18 @@ static void test_CarlaMathUtils() noexcept
assert(carla_max(5, 6, 3) == 3);

// Fix bounds of 'value' between 'min' and 'max'.
assert(carla_fixValue(0, 1, -1) == 0);
assert(carla_fixValue(0, 1, 0) == 0);
assert(carla_fixValue(0, 1, 1) == 1);
assert(carla_fixValue(0, 1, 2) == 1);
assert(carla_fixValue(0.0, 1.0, -1.0) == 0.0);
assert(carla_fixValue(0.0, 1.0, 0.0) == 0.0);
assert(carla_fixValue(0.0, 1.0, 1.0) == 1.0);
assert(carla_fixValue(0.0, 1.0, 2.0) == 1.0);
assert(carla_fixValue(0.0, 1.0, -0.1) == 0.0);
assert(carla_fixValue(0.0, 1.0, 1.1) == 1.0);
assert(carla_fixedValue(0, 1, -1) == 0);
assert(carla_fixedValue(0, 1, 0) == 0);
assert(carla_fixedValue(0, 1, 1) == 1);
assert(carla_fixedValue(0, 1, 2) == 1);
assert(carla_fixedValue(0.0, 1.0, -1.0) == 0.0);
assert(carla_fixedValue(0.0, 1.0, 0.0) == 0.0);
assert(carla_fixedValue(0.0, 1.0, 1.0) == 1.0);
assert(carla_fixedValue(0.0, 1.0, 2.0) == 1.0);
assert(carla_fixedValue(0.0, 1.0, -0.1) == 0.0);
assert(carla_fixedValue(0.0, 1.0, 1.1) == 1.0);

// Get next power of 2.
assert(carla_nextPowerOf2(0) == 0);


+ 1
- 1
source/utils/CarlaLibUtils.hpp View File

@@ -97,7 +97,7 @@ const char* lib_error(const char* const filename) noexcept

#ifdef CARLA_OS_WIN
static char libError[2048+1];
carla_zeroChar(libError, 2048+1);
carla_zeroChars(libError, 2048+1);

try {
const DWORD winErrorCode = ::GetLastError();


+ 1
- 1
source/utils/CarlaPipeUtils.cpp View File

@@ -514,7 +514,7 @@ struct CarlaPipeCommon::PrivateData {
} CARLA_SAFE_EXCEPTION("CreateEvent");
#endif

carla_zeroChar(tmpBuf, 0xff+1);
carla_zeroChars(tmpBuf, 0xff+1);
}

~PrivateData() noexcept


+ 2
- 2
source/utils/CarlaPluginUI.cpp View File

@@ -305,7 +305,7 @@ public:
const int screen = DefaultScreen(fDisplay);

XSetWindowAttributes attr;
carla_zeroStruct<XSetWindowAttributes>(attr);
carla_zeroStruct(attr);

attr.border_pixel = 0;
attr.event_mask = KeyPressMask|KeyReleaseMask;
@@ -485,7 +485,7 @@ public:
if (! fIsResizable)
{
XSizeHints sizeHints;
carla_zeroStruct<XSizeHints>(sizeHints);
carla_zeroStruct(sizeHints);

sizeHints.flags = PSize|PMinSize|PMaxSize;
sizeHints.width = static_cast<int>(width);


+ 2
- 2
source/utils/CarlaRingBuffer.hpp View File

@@ -228,14 +228,14 @@ public:
CARLA_SAFE_ASSERT_RETURN(size > 0,);

if (! tryRead(data, size))
carla_zeroBytes(data, size);
std::memset(data, 0, size);
}

template <typename T>
void readCustomType(T& type) noexcept
{
if (! tryRead(&type, sizeof(T)))
carla_zeroStruct(type);
std::memset(&type, 0, sizeof(T));
}

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


+ 1
- 1
source/utils/CarlaSemUtils.hpp View File

@@ -61,7 +61,7 @@ sem_t* carla_sem_create() noexcept
std::srand(static_cast<uint>(std::time(nullptr)));

char strBuf[0xff+1];
carla_zeroChar(strBuf, 0xff+1);
carla_zeroChars(strBuf, 0xff+1);
std::snprintf(strBuf, 0xff, "carla-sem-%lu-%lu-%i", static_cast<ulong>(::getpid()), sCounter, std::rand());

::sem_unlink(strBuf);


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

@@ -66,7 +66,7 @@ static std::string replaceStdString(const std::string& original, const std::stri
{
retval.append(current, next);
retval.append(after);
current = next + static_cast<std::ssize_t>(before.size());
current = next + static_cast<ssize_t>(before.size());
}
retval.append(current, next);
return retval;
@@ -330,23 +330,23 @@ bool CarlaStateSave::fillFromXmlElement(const XmlElement* const xmlElement)
}
else if (tag.equalsIgnoreCase("drywet"))
{
dryWet = carla_fixValue(0.0f, 1.0f, text.getFloatValue());
dryWet = carla_fixedValue(0.0f, 1.0f, text.getFloatValue());
}
else if (tag.equalsIgnoreCase("volume"))
{
volume = carla_fixValue(0.0f, 1.27f, text.getFloatValue());
volume = carla_fixedValue(0.0f, 1.27f, text.getFloatValue());
}
else if (tag.equalsIgnoreCase("balanceleft") || tag.equalsIgnoreCase("balance-left"))
{
balanceLeft = carla_fixValue(-1.0f, 1.0f, text.getFloatValue());
balanceLeft = carla_fixedValue(-1.0f, 1.0f, text.getFloatValue());
}
else if (tag.equalsIgnoreCase("balanceright") || tag.equalsIgnoreCase("balance-right"))
{
balanceRight = carla_fixValue(-1.0f, 1.0f, text.getFloatValue());
balanceRight = carla_fixedValue(-1.0f, 1.0f, text.getFloatValue());
}
else if (tag.equalsIgnoreCase("panning"))
{
panning = carla_fixValue(-1.0f, 1.0f, text.getFloatValue());
panning = carla_fixedValue(-1.0f, 1.0f, text.getFloatValue());
}
else if (tag.equalsIgnoreCase("controlchannel") || tag.equalsIgnoreCase("control-channel"))
{
@@ -552,15 +552,15 @@ void CarlaStateSave::dumpToMemoryStream(MemoryOutputStream& content) const

dataXml << " <Active>" << (active ? "Yes" : "No") << "</Active>\n";

if (! carla_compareFloats(dryWet, 1.0f))
if (carla_isNotEqual(dryWet, 1.0f))
dataXml << " <DryWet>" << String(dryWet, 7) << "</DryWet>\n";
if (! carla_compareFloats(volume, 1.0f))
if (carla_isNotEqual(volume, 1.0f))
dataXml << " <Volume>" << String(volume, 7) << "</Volume>\n";
if (! carla_compareFloats(balanceLeft, -1.0f))
if (carla_isNotEqual(balanceLeft, -1.0f))
dataXml << " <Balance-Left>" << String(balanceLeft, 7) << "</Balance-Left>\n";
if (! carla_compareFloats(balanceRight, 1.0f))
if (carla_isNotEqual(balanceRight, 1.0f))
dataXml << " <Balance-Right>" << String(balanceRight, 7) << "</Balance-Right>\n";
if (! carla_compareFloats(panning, 0.0f))
if (carla_isNotEqual(panning, 0.0f))
dataXml << " <Panning>" << String(panning, 7) << "</Panning>\n";

if (ctrlChannel < 0)


+ 2
- 2
source/utils/LinkedList.hpp View File

@@ -158,7 +158,7 @@ public:
static T& _getFallback()
{
static T data;
carla_zeroStruct<T>(data);
carla_zeroStruct(data);
return data;
}

@@ -225,7 +225,7 @@ public:
static T& _getFallback()
{
static T data;
carla_zeroStruct<T>(data);
carla_zeroStruct(data);
return data;
}
};


Loading…
Cancel
Save