From 8de9234e04d379d49c64d1082fdaf289e0e5ea08 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 7 Jun 2015 00:29:50 +0200 Subject: [PATCH] Make things build again --- source/backend/CarlaStandalone.cpp | 26 ++++----- source/backend/engine/CarlaEngine.cpp | 6 +-- source/backend/engine/CarlaEngineBridge.cpp | 54 +++++++++---------- source/backend/engine/CarlaEngineData.cpp | 12 ++--- source/backend/engine/CarlaEngineGraph.cpp | 16 +++--- source/backend/engine/CarlaEngineInternal.cpp | 4 +- source/backend/engine/CarlaEngineJack.cpp | 12 ++--- source/backend/engine/CarlaEngineJuce.cpp | 4 +- source/backend/engine/CarlaEngineNative.cpp | 10 ++-- source/backend/engine/CarlaEnginePorts.cpp | 4 +- source/backend/engine/CarlaEngineRtAudio.cpp | 8 +-- source/backend/plugin/CarlaPlugin.cpp | 34 ++++++------ source/backend/plugin/CarlaPluginBridge.cpp | 36 ++++++------- source/backend/plugin/CarlaPluginDSSI.cpp | 8 +-- .../backend/plugin/CarlaPluginFluidSynth.cpp | 4 +- source/backend/plugin/CarlaPluginInternal.cpp | 14 ++--- source/backend/plugin/CarlaPluginJuce.cpp | 2 +- source/backend/plugin/CarlaPluginLADSPA.cpp | 6 +-- source/backend/plugin/CarlaPluginLV2.cpp | 24 ++++----- .../plugin/CarlaPluginLinuxSampler.cpp | 12 ++--- source/backend/plugin/CarlaPluginNative.cpp | 16 +++--- source/backend/plugin/CarlaPluginVST2.cpp | 24 ++++----- source/discovery/carla-discovery.cpp | 26 ++++----- source/native-plugins/zynaddsubfx-fx.cpp | 2 +- source/native-plugins/zynaddsubfx-synth.cpp | 10 ++-- source/plugin/carla-dssi.cpp | 8 +-- source/plugin/carla-lv2.cpp | 14 ++--- source/plugin/carla-vst.cpp | 12 ++--- source/tests/CarlaRingBuffer.cpp | 2 +- source/tests/CarlaUtils1.cpp | 24 ++++----- source/utils/CarlaLibUtils.hpp | 2 +- source/utils/CarlaPipeUtils.cpp | 2 +- source/utils/CarlaPluginUI.cpp | 4 +- source/utils/CarlaRingBuffer.hpp | 4 +- source/utils/CarlaSemUtils.hpp | 2 +- source/utils/CarlaStateUtils.cpp | 22 ++++---- source/utils/LinkedList.hpp | 4 +- 37 files changed, 237 insertions(+), 237 deletions(-) diff --git a/source/backend/CarlaStandalone.cpp b/source/backend/CarlaStandalone.cpp index 22e102c4b..9bb9469d3 100644 --- a/source/backend/CarlaStandalone.cpp +++ b/source/backend/CarlaStandalone.cpp @@ -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(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, 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; } diff --git a/source/backend/engine/CarlaEngine.cpp b/source/backend/engine/CarlaEngine.cpp index cbeed09d5..bab724475 100644 --- a/source/backend/engine/CarlaEngine.cpp +++ b/source/backend/engine/CarlaEngine.cpp @@ -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(getMaxClientNameSize(), 0xff, 6U) - 6); // 6 = strlen(" (10)") + 1 + const std::size_t maxNameSize(carla_minConstrained(getMaxClientNameSize(), 0xff, 6U) - 6); // 6 = strlen(" (10)") + 1 if (maxNameSize == 0 || ! isRunning()) return sname.dup(); diff --git a/source/backend/engine/CarlaEngineBridge.cpp b/source/backend/engine/CarlaEngineBridge.cpp index 538ef0fe8..90379db97 100644 --- a/source/backend/engine/CarlaEngineBridge.cpp +++ b/source/backend/engine/CarlaEngineBridge.cpp @@ -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 { : filename(), data(nullptr) { - carla_zeroChar(shm, 64); + carla_zeroChars(shm, 64); jackbridge_shm_init(shm); } @@ -195,7 +195,7 @@ struct BridgeNonRtClientControl : public CarlaRingBufferControl : filename(), data(nullptr) { - carla_zeroChar(shm, 64); + carla_zeroChars(shm, 64); jackbridge_shm_init(shm); } @@ -274,7 +274,7 @@ struct BridgeNonRtServerControl : public CarlaRingBufferControl 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(std::strlen(bufStr))); + bufStrSize = carla_fixedValue(1U, 64U, static_cast(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(std::strlen(bufStr))); + bufStrSize = carla_fixedValue(1U, 256U, static_cast(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(std::strlen(bufStr))); + bufStrSize = carla_fixedValue(1U, 64U, static_cast(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(std::strlen(bufStr))); + bufStrSize = carla_fixedValue(1U, 64U, static_cast(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(std::strlen(bufStr))); + bufStrSize = carla_fixedValue(1U, 32U, static_cast(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(std::strlen(bufStr))); + bufStrSize = carla_fixedValue(1U, 64U, static_cast(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(std::strlen(bufStr))); + bufStrSize = carla_fixedValue(1U, 32U, static_cast(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(std::strlen(bufStr))); + bufStrSize = carla_fixedValue(1U, 32U, static_cast(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(std::strlen(mpData.name))); + bufStrSize = carla_fixedValue(1U, 32U, static_cast(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(pData->events.in, kMaxEngineEventInternalCount); + carla_zeroStructs(pData->events.in, kMaxEngineEventInternalCount); if (pData->events.out[0].type != kEngineEventTypeNull) { @@ -1490,7 +1490,7 @@ protected: } } - carla_zeroStruct(pData->events.out, kMaxEngineEventInternalCount); + carla_zeroStructs(pData->events.out, kMaxEngineEventInternalCount); } } break; diff --git a/source/backend/engine/CarlaEngineData.cpp b/source/backend/engine/CarlaEngineData.cpp index c8e63f056..1bdfe1bc3 100644 --- a/source/backend/engine/CarlaEngineData.cpp +++ b/source/backend/engine/CarlaEngineData.cpp @@ -43,14 +43,14 @@ void EngineControlEvent::convertToMidiData(const uint8_t channel, uint8_t& size, size = 3; data[0] = static_cast(MIDI_STATUS_CONTROL_CHANGE | (channel & MIDI_CHANNEL_BIT)); data[1] = MIDI_CONTROL_BANK_SELECT; - data[2] = uint8_t(carla_fixValue(0.0f, float(MAX_MIDI_VALUE-1), value)); + data[2] = uint8_t(carla_fixedValue(0.0f, float(MAX_MIDI_VALUE-1), value)); } else { size = 3; data[0] = static_cast(MIDI_STATUS_CONTROL_CHANGE | (channel & MIDI_CHANNEL_BIT)); data[1] = static_cast(param); - data[2] = uint8_t(carla_fixValue(0.0f, 1.0f, value) * float(MAX_MIDI_VALUE-1)); + data[2] = uint8_t(carla_fixedValue(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(MIDI_STATUS_CONTROL_CHANGE | (channel & MIDI_CHANNEL_BIT)); data[1] = MIDI_CONTROL_BANK_SELECT; - data[2] = uint8_t(carla_fixValue(0, MAX_MIDI_VALUE-1, param)); + data[2] = uint8_t(carla_fixedValue(0, MAX_MIDI_VALUE-1, param)); break; case kEngineControlEventTypeMidiProgram: size = 2; data[0] = static_cast(MIDI_STATUS_PROGRAM_CHANGE | (channel & MIDI_CHANNEL_BIT)); - data[1] = uint8_t(carla_fixValue(0, MAX_MIDI_VALUE-1, param)); + data[1] = uint8_t(carla_fixedValue(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(0, 127, data[2])); // ensures 0.0<->1.0 value range + const uint8_t midiValue(carla_fixedValue(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; } diff --git a/source/backend/engine/CarlaEngineGraph.cpp b/source/backend/engine/CarlaEngineGraph.cpp index dd29e01b7..4c4eb0809 100644 --- a/source/backend/engine/CarlaEngineGraph.cpp +++ b/source/backend/engine/CarlaEngineGraph.cpp @@ -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(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(data->events.in, data->events.out, kMaxEngineEventInternalCount); + carla_copyStructs(data->events.in, data->events.out, kMaxEngineEventInternalCount); // initialize event outputs (zero) - carla_zeroStruct(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(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(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(data->events.out, kMaxEngineEventInternalCount); + carla_zeroStructs(data->events.out, kMaxEngineEventInternalCount); fillEngineEventsFromJuceMidiBuffer(data->events.out, midiBuffer); midiBuffer.clear(); } diff --git a/source/backend/engine/CarlaEngineInternal.cpp b/source/backend/engine/CarlaEngineInternal.cpp index 574244b82..a14a4cb82 100644 --- a/source/backend/engine/CarlaEngineInternal.cpp +++ b/source/backend/engine/CarlaEngineInternal.cpp @@ -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(); diff --git a/source/backend/engine/CarlaEngineJack.cpp b/source/backend/engine/CarlaEngineJack.cpp index c712c8502..68ed14982 100644 --- a/source/backend/engine/CarlaEngineJack.cpp +++ b/source/backend/engine/CarlaEngineJack.cpp @@ -690,7 +690,7 @@ public: // FIXME: Always enable JACK transport for now pData->options.transportMode = ENGINE_TRANSPORT_MODE_JACK; - carla_zeroStruct(fTransportPos); + carla_zeroStruct(fTransportPos); } ~CarlaEngineJack() noexcept override @@ -749,7 +749,7 @@ public: fTransportState = JackTransportStopped; fExternalPatchbay = true; - carla_zeroStruct(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(pData->events.in, kMaxEngineEventInternalCount); - carla_zeroStruct(pData->events.out, kMaxEngineEventInternalCount); + carla_zeroStructs(pData->events.in, kMaxEngineEventInternalCount); + carla_zeroStructs(pData->events.out, kMaxEngineEventInternalCount); { ushort engineEventIndex = 0; diff --git a/source/backend/engine/CarlaEngineJuce.cpp b/source/backend/engine/CarlaEngineJuce.cpp index 29079dcfb..acb849010 100644 --- a/source/backend/engine/CarlaEngineJuce.cpp +++ b/source/backend/engine/CarlaEngineJuce.cpp @@ -430,8 +430,8 @@ protected: FloatVectorOperations::clear(outputChannelData[i], numSamples); // initialize events - carla_zeroStruct(pData->events.in, kMaxEngineEventInternalCount); - carla_zeroStruct(pData->events.out, kMaxEngineEventInternalCount); + carla_zeroStructs(pData->events.in, kMaxEngineEventInternalCount); + carla_zeroStructs(pData->events.out, kMaxEngineEventInternalCount); if (fMidiInEvents.mutex.tryLock()) { diff --git a/source/backend/engine/CarlaEngineNative.cpp b/source/backend/engine/CarlaEngineNative.cpp index c90373502..9cf818d3b 100644 --- a/source/backend/engine/CarlaEngineNative.cpp +++ b/source/backend/engine/CarlaEngineNative.cpp @@ -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(pData->events.in, kMaxEngineEventInternalCount); - carla_zeroStruct(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(pData->events.in, kMaxEngineEventInternalCount); + carla_zeroStructs(pData->events.in, kMaxEngineEventInternalCount); { NativeMidiEvent midiEvent; diff --git a/source/backend/engine/CarlaEnginePorts.cpp b/source/backend/engine/CarlaEnginePorts.cpp index 4a39ab627..1444f3f74 100644 --- a/source/backend/engine/CarlaEnginePorts.cpp +++ b/source/backend/engine/CarlaEnginePorts.cpp @@ -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(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(0.0f, 1.0f, value); + event.ctrl.value = carla_fixedValue(0.0f, 1.0f, value); return true; } diff --git a/source/backend/engine/CarlaEngineRtAudio.cpp b/source/backend/engine/CarlaEngineRtAudio.cpp index 4c43fa1f8..d5080c081 100644 --- a/source/backend/engine/CarlaEngineRtAudio.cpp +++ b/source/backend/engine/CarlaEngineRtAudio.cpp @@ -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(pData->events.in, kMaxEngineEventInternalCount); - carla_zeroStruct(pData->events.out, kMaxEngineEventInternalCount); + carla_zeroStructs(pData->events.in, kMaxEngineEventInternalCount); + carla_zeroStructs(pData->events.out, kMaxEngineEventInternalCount); if (fMidiInEvents.mutex.tryLock()) { diff --git a/source/backend/plugin/CarlaPlugin.cpp b/source/backend/plugin/CarlaPlugin.cpp index 60259673d..20bd4646e 100644 --- a/source/backend/plugin/CarlaPlugin.cpp +++ b/source/backend/plugin/CarlaPlugin.cpp @@ -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(0.0f, 1.0f, value)); + const float fixedValue(carla_fixedValue(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(0.0f, 1.27f, value)); + const float fixedValue(carla_fixedValue(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(-1.0f, 1.0f, value)); + const float fixedValue(carla_fixedValue(-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(-1.0f, 1.0f, value)); + const float fixedValue(carla_fixedValue(-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(-1.0f, 1.0f, value)); + const float fixedValue(carla_fixedValue(-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; ihints & 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); diff --git a/source/backend/plugin/CarlaPluginDSSI.cpp b/source/backend/plugin/CarlaPluginDSSI.cpp index 99839d432..5f904a32b 100644 --- a/source/backend/plugin/CarlaPluginDSSI.cpp +++ b/source/backend/plugin/CarlaPluginDSSI.cpp @@ -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(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; diff --git a/source/backend/plugin/CarlaPluginFluidSynth.cpp b/source/backend/plugin/CarlaPluginFluidSynth.cpp index c9edb3bfd..791c593a9 100644 --- a/source/backend/plugin/CarlaPluginFluidSynth.cpp +++ b/source/backend/plugin/CarlaPluginFluidSynth.cpp @@ -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]; diff --git a/source/backend/plugin/CarlaPluginInternal.cpp b/source/backend/plugin/CarlaPluginInternal.cpp index a67a7e5df..38303f0ce 100644 --- a/source/backend/plugin/CarlaPluginInternal.cpp +++ b/source/backend/plugin/CarlaPluginInternal.cpp @@ -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; diff --git a/source/backend/plugin/CarlaPluginJuce.cpp b/source/backend/plugin/CarlaPluginJuce.cpp index 2efc7bac5..e6d26013b 100644 --- a/source/backend/plugin/CarlaPluginJuce.cpp +++ b/source/backend/plugin/CarlaPluginJuce.cpp @@ -1113,7 +1113,7 @@ protected: bool getCurrentPosition(CurrentPositionInfo& result) override { - carla_copyStruct(result, fPosInfo); + carla_copyStruct(result, fPosInfo); return true; } diff --git a/source/backend/plugin/CarlaPluginLADSPA.cpp b/source/backend/plugin/CarlaPluginLADSPA.cpp index 6580451cd..ee3abbb0b 100644 --- a/source/backend/plugin/CarlaPluginLADSPA.cpp +++ b/source/backend/plugin/CarlaPluginLADSPA.cpp @@ -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; diff --git a/source/backend/plugin/CarlaPluginLV2.cpp b/source/backend/plugin/CarlaPluginLV2.cpp index 7086b2878..87b7ade37 100644 --- a/source/backend/plugin/CarlaPluginLV2.cpp +++ b/source/backend/plugin/CarlaPluginLV2.cpp @@ -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(static_cast(timeInfo.bbt.beat) - 1.0 + (static_cast(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(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(timeInfo.bbt.ticksPerBeat); doPostRt = true; @@ -2911,7 +2911,7 @@ public: pData->postRtEvents.trySplice(); - carla_copyStruct(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(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; diff --git a/source/backend/plugin/CarlaPluginLinuxSampler.cpp b/source/backend/plugin/CarlaPluginLinuxSampler.cpp index f91634ef5..dcc1a597a 100644 --- a/source/backend/plugin/CarlaPluginLinuxSampler.cpp +++ b/source/backend/plugin/CarlaPluginLinuxSampler.cpp @@ -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]; diff --git a/source/backend/plugin/CarlaPluginNative.cpp b/source/backend/plugin/CarlaPluginNative.cpp index fd44df669..653819592 100644 --- a/source/backend/plugin/CarlaPluginNative.cpp +++ b/source/backend/plugin/CarlaPluginNative.cpp @@ -190,9 +190,9 @@ public: { carla_debug("CarlaPluginNative::CarlaPluginNative(%p, %i)", engine, id); - carla_fill(fCurMidiProgs, 0, MAX_MIDI_CHANNELS); - carla_zeroStruct(fMidiEvents, kPluginMaxMidiEvents*2); - carla_zeroStruct(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(fMidiEvents, kPluginMaxMidiEvents*2); + carla_zeroStructs(fMidiEvents, kPluginMaxMidiEvents*2); // -------------------------------------------------------------------------------------------------------- // Check if needs reset @@ -1461,7 +1461,7 @@ public: if (fMidiEventCount > 0) { - carla_zeroStruct(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]; diff --git a/source/backend/plugin/CarlaPluginVST2.cpp b/source/backend/plugin/CarlaPluginVST2.cpp index 7344d6e12..3262da9b6 100644 --- a/source/backend/plugin/CarlaPluginVST2.cpp +++ b/source/backend/plugin/CarlaPluginVST2.cpp @@ -77,8 +77,8 @@ public: { carla_debug("CarlaPluginVST2::CarlaPluginVST2(%p, %i)", engine, id); - carla_zeroStruct(fMidiEvents, kPluginMaxMidiEvents*2); - carla_zeroStruct(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(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(fMidiEvents, kPluginMaxMidiEvents*2); + carla_zeroStructs(fMidiEvents, kPluginMaxMidiEvents*2); // -------------------------------------------------------------------------------------------------------- // Check if needs reset @@ -1174,7 +1174,7 @@ public: if (fMidiEventCount > 0) { - carla_zeroStruct(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(0, static_cast(pData->engine->getOptions().maxParameters), fEffect->numParams); + ret = carla_fixedValue(0, static_cast(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') diff --git a/source/discovery/carla-discovery.cpp b/source/discovery/carla-discovery.cpp index 4206119a7..47aaa87ee 100644 --- a/source/discovery/carla-discovery.cpp +++ b/source/discovery/carla-discovery.cpp @@ -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(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(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(midiEvents, 2); + carla_zeroStructs(midiEvents, 2); midiEvents[0].type = kVstMidiType; midiEvents[0].byteSize = sizeof(VstMidiEvent); diff --git a/source/native-plugins/zynaddsubfx-fx.cpp b/source/native-plugins/zynaddsubfx-fx.cpp index 9044a7ef5..645604de1 100644 --- a/source/native-plugins/zynaddsubfx-fx.cpp +++ b/source/native-plugins/zynaddsubfx-fx.cpp @@ -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(index+2), static_cast(ivalue)); } diff --git a/source/native-plugins/zynaddsubfx-synth.cpp b/source/native-plugins/zynaddsubfx-synth.cpp index 7e9d7205d..3168c442f 100644 --- a/source/native-plugins/zynaddsubfx-synth.cpp +++ b/source/native-plugins/zynaddsubfx-synth.cpp @@ -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(fMidiEvents, kMaxMidiEvents*2); - carla_zeroStruct(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(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(fMidiEvents, kMaxMidiEvents*2); + carla_zeroStructs(fMidiEvents, kMaxMidiEvents*2); LV2_ATOM_SEQUENCE_FOREACH(fPorts.eventsIn[0], iter) { diff --git a/source/plugin/carla-lv2.cpp b/source/plugin/carla-lv2.cpp index 23af0f1b8..0770bd0e1 100644 --- a/source/plugin/carla-lv2.cpp +++ b/source/plugin/carla-lv2.cpp @@ -211,8 +211,8 @@ public: fHandle = fDescriptor->instantiate(&fHost); CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr, false); - carla_zeroStruct(fMidiEvents, kMaxMidiEvents*2); - carla_zeroStruct(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(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(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; diff --git a/source/plugin/carla-vst.cpp b/source/plugin/carla-vst.cpp index 18923bf5a..d621dd2d0 100644 --- a/source/plugin/carla-vst.cpp +++ b/source/plugin/carla-vst.cpp @@ -168,8 +168,8 @@ public: fHandle = fDescriptor->instantiate(&fHost); CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr, false); - carla_zeroStruct(fMidiEvents, kMaxMidiEvents); - carla_zeroStruct(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(opt))) + if (carla_isEqual(fSampleRate, static_cast(opt))) return 0; fSampleRate = opt; @@ -208,7 +208,7 @@ public: if (value != 0) { fMidiEventCount = 0; - carla_zeroStruct(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(mdata, kMaxMidiEvents); + carla_zeroStructs(mdata, kMaxMidiEvents); } CARLA_DECLARE_NON_COPY_STRUCT(FixedVstEvents); diff --git a/source/tests/CarlaRingBuffer.cpp b/source/tests/CarlaRingBuffer.cpp index 7b2fc3ced..5b5f8f210 100644 --- a/source/tests/CarlaRingBuffer.cpp +++ b/source/tests/CarlaRingBuffer.cpp @@ -147,7 +147,7 @@ static void test_CarlaRingBuffer3(CarlaRingBuffer& 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 diff --git a/source/tests/CarlaUtils1.cpp b/source/tests/CarlaUtils1.cpp index 98a324bdf..19f22bde2 100644 --- a/source/tests/CarlaUtils1.cpp +++ b/source/tests/CarlaUtils1.cpp @@ -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); diff --git a/source/utils/CarlaLibUtils.hpp b/source/utils/CarlaLibUtils.hpp index 9435dfd9e..ba6f3d74a 100644 --- a/source/utils/CarlaLibUtils.hpp +++ b/source/utils/CarlaLibUtils.hpp @@ -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(); diff --git a/source/utils/CarlaPipeUtils.cpp b/source/utils/CarlaPipeUtils.cpp index 56defac87..f73b2f379 100644 --- a/source/utils/CarlaPipeUtils.cpp +++ b/source/utils/CarlaPipeUtils.cpp @@ -514,7 +514,7 @@ struct CarlaPipeCommon::PrivateData { } CARLA_SAFE_EXCEPTION("CreateEvent"); #endif - carla_zeroChar(tmpBuf, 0xff+1); + carla_zeroChars(tmpBuf, 0xff+1); } ~PrivateData() noexcept diff --git a/source/utils/CarlaPluginUI.cpp b/source/utils/CarlaPluginUI.cpp index 6df306a7c..e09278db7 100644 --- a/source/utils/CarlaPluginUI.cpp +++ b/source/utils/CarlaPluginUI.cpp @@ -305,7 +305,7 @@ public: const int screen = DefaultScreen(fDisplay); XSetWindowAttributes attr; - carla_zeroStruct(attr); + carla_zeroStruct(attr); attr.border_pixel = 0; attr.event_mask = KeyPressMask|KeyReleaseMask; @@ -485,7 +485,7 @@ public: if (! fIsResizable) { XSizeHints sizeHints; - carla_zeroStruct(sizeHints); + carla_zeroStruct(sizeHints); sizeHints.flags = PSize|PMinSize|PMaxSize; sizeHints.width = static_cast(width); diff --git a/source/utils/CarlaRingBuffer.hpp b/source/utils/CarlaRingBuffer.hpp index 0406237f7..1d30197e5 100644 --- a/source/utils/CarlaRingBuffer.hpp +++ b/source/utils/CarlaRingBuffer.hpp @@ -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 void readCustomType(T& type) noexcept { if (! tryRead(&type, sizeof(T))) - carla_zeroStruct(type); + std::memset(&type, 0, sizeof(T)); } // ------------------------------------------------------------------- diff --git a/source/utils/CarlaSemUtils.hpp b/source/utils/CarlaSemUtils.hpp index 64f46f410..4e19dcb30 100644 --- a/source/utils/CarlaSemUtils.hpp +++ b/source/utils/CarlaSemUtils.hpp @@ -61,7 +61,7 @@ sem_t* carla_sem_create() noexcept std::srand(static_cast(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(::getpid()), sCounter, std::rand()); ::sem_unlink(strBuf); diff --git a/source/utils/CarlaStateUtils.cpp b/source/utils/CarlaStateUtils.cpp index c7b22c47c..384576c4d 100644 --- a/source/utils/CarlaStateUtils.cpp +++ b/source/utils/CarlaStateUtils.cpp @@ -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(before.size()); + current = next + static_cast(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 ? "Yes" : "No") << "\n"; - if (! carla_compareFloats(dryWet, 1.0f)) + if (carla_isNotEqual(dryWet, 1.0f)) dataXml << " " << String(dryWet, 7) << "\n"; - if (! carla_compareFloats(volume, 1.0f)) + if (carla_isNotEqual(volume, 1.0f)) dataXml << " " << String(volume, 7) << "\n"; - if (! carla_compareFloats(balanceLeft, -1.0f)) + if (carla_isNotEqual(balanceLeft, -1.0f)) dataXml << " " << String(balanceLeft, 7) << "\n"; - if (! carla_compareFloats(balanceRight, 1.0f)) + if (carla_isNotEqual(balanceRight, 1.0f)) dataXml << " " << String(balanceRight, 7) << "\n"; - if (! carla_compareFloats(panning, 0.0f)) + if (carla_isNotEqual(panning, 0.0f)) dataXml << " " << String(panning, 7) << "\n"; if (ctrlChannel < 0) diff --git a/source/utils/LinkedList.hpp b/source/utils/LinkedList.hpp index 51ab2d6bf..ac42ef362 100644 --- a/source/utils/LinkedList.hpp +++ b/source/utils/LinkedList.hpp @@ -158,7 +158,7 @@ public: static T& _getFallback() { static T data; - carla_zeroStruct(data); + carla_zeroStruct(data); return data; } @@ -225,7 +225,7 @@ public: static T& _getFallback() { static T data; - carla_zeroStruct(data); + carla_zeroStruct(data); return data; } };