| @@ -949,9 +949,9 @@ const CarlaPluginInfo* carla_get_plugin_info(uint pluginId) | |||||
| char strBufMaker[STR_MAX+1]; | char strBufMaker[STR_MAX+1]; | ||||
| char strBufCopyright[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.type = plugin->getType(); | ||||
| info.category = plugin->getCategory(); | 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 strBufSymbol[STR_MAX+1]; | ||||
| char strBufUnit[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); | info.scalePointCount = plugin->getParameterScalePointCount(parameterId); | ||||
| @@ -1148,7 +1148,7 @@ const CarlaScalePointInfo* carla_get_parameter_scalepoint_info(uint pluginId, ui | |||||
| if (scalePointId < plugin->getParameterScalePointCount(parameterId)) | if (scalePointId < plugin->getParameterScalePointCount(parameterId)) | ||||
| { | { | ||||
| char strBufLabel[STR_MAX+1]; | char strBufLabel[STR_MAX+1]; | ||||
| carla_zeroChar(strBufLabel, STR_MAX+1); | |||||
| carla_zeroChars(strBufLabel, STR_MAX+1); | |||||
| info.value = plugin->getParameterScalePointValue(parameterId, scalePointId); | 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()) | if (midiProgramId < plugin->getMidiProgramCount()) | ||||
| { | { | ||||
| const MidiProgramData& ret(plugin->getMidiProgramData(midiProgramId)); | const MidiProgramData& ret(plugin->getMidiProgramData(midiProgramId)); | ||||
| carla_copyStruct<MidiProgramData>(midiProgData, ret); | |||||
| carla_copyStruct(midiProgData, ret); | |||||
| checkStringPtr(midiProgData.name); | checkStringPtr(midiProgData.name); | ||||
| return &midiProgData; | return &midiProgData; | ||||
| } | } | ||||
| @@ -1262,7 +1262,7 @@ const CustomData* carla_get_custom_data(uint pluginId, uint32_t customDataId) | |||||
| if (customDataId < plugin->getCustomDataCount()) | if (customDataId < plugin->getCustomDataCount()) | ||||
| { | { | ||||
| const CustomData& ret(plugin->getCustomData(customDataId)); | const CustomData& ret(plugin->getCustomData(customDataId)); | ||||
| carla_copyStruct<CustomData>(customData, ret); | |||||
| carla_copyStruct(customData, ret); | |||||
| checkStringPtr(customData.type); | checkStringPtr(customData.type); | ||||
| checkStringPtr(customData.key); | checkStringPtr(customData.key); | ||||
| checkStringPtr(customData.value); | checkStringPtr(customData.value); | ||||
| @@ -1376,7 +1376,7 @@ const char* carla_get_parameter_text(uint pluginId, uint32_t parameterId) | |||||
| { | { | ||||
| if (parameterId < plugin->getParameterCount()) | if (parameterId < plugin->getParameterCount()) | ||||
| { | { | ||||
| carla_zeroChar(textBuf, STR_MAX+1); | |||||
| carla_zeroChars(textBuf, STR_MAX+1); | |||||
| plugin->getParameterText(parameterId, textBuf); | plugin->getParameterText(parameterId, textBuf); | ||||
| return textBuf; | return textBuf; | ||||
| } | } | ||||
| @@ -1400,7 +1400,7 @@ const char* carla_get_program_name(uint pluginId, uint32_t programId) | |||||
| { | { | ||||
| if (programId < plugin->getProgramCount()) | if (programId < plugin->getProgramCount()) | ||||
| { | { | ||||
| carla_zeroChar(programName, STR_MAX+1); | |||||
| carla_zeroChars(programName, STR_MAX+1); | |||||
| plugin->getProgramName(programId, programName); | plugin->getProgramName(programId, programName); | ||||
| return programName; | return programName; | ||||
| } | } | ||||
| @@ -1424,7 +1424,7 @@ const char* carla_get_midi_program_name(uint pluginId, uint32_t midiProgramId) | |||||
| { | { | ||||
| if (midiProgramId < plugin->getMidiProgramCount()) | if (midiProgramId < plugin->getMidiProgramCount()) | ||||
| { | { | ||||
| carla_zeroChar(midiProgramName, STR_MAX+1); | |||||
| carla_zeroChars(midiProgramName, STR_MAX+1); | |||||
| plugin->getMidiProgramName(midiProgramId, midiProgramName); | plugin->getMidiProgramName(midiProgramId, midiProgramName); | ||||
| return midiProgramName; | return midiProgramName; | ||||
| } | } | ||||
| @@ -1446,7 +1446,7 @@ const char* carla_get_real_plugin_name(uint pluginId) | |||||
| if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId)) | if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId)) | ||||
| { | { | ||||
| carla_zeroChar(realPluginName, STR_MAX+1); | |||||
| carla_zeroChars(realPluginName, STR_MAX+1); | |||||
| plugin->getRealName(realPluginName); | plugin->getRealName(realPluginName); | ||||
| return realPluginName; | return realPluginName; | ||||
| } | } | ||||
| @@ -659,7 +659,7 @@ bool CarlaEngine::removePlugin(const uint id) | |||||
| # endif | # endif | ||||
| #else | #else | ||||
| pData->curPluginCount = 0; | pData->curPluginCount = 0; | ||||
| carla_zeroStruct(pData->plugins, 1); | |||||
| carla_zeroStructs(pData->plugins, 1); | |||||
| #endif | #endif | ||||
| delete plugin; | delete plugin; | ||||
| @@ -769,7 +769,7 @@ bool CarlaEngine::clonePlugin(const uint id) | |||||
| CARLA_SAFE_ASSERT_RETURN_ERR(plugin->getId() == id, "Invalid engine internal data"); | CARLA_SAFE_ASSERT_RETURN_ERR(plugin->getId() == id, "Invalid engine internal data"); | ||||
| char label[STR_MAX+1]; | char label[STR_MAX+1]; | ||||
| carla_zeroChar(label, STR_MAX+1); | |||||
| carla_zeroChars(label, STR_MAX+1); | |||||
| plugin->getLabel(label); | plugin->getLabel(label); | ||||
| const uint pluginCountBefore(pData->curPluginCount); | const uint pluginCountBefore(pData->curPluginCount); | ||||
| @@ -895,7 +895,7 @@ const char* CarlaEngine::getUniquePluginName(const char* const name) const | |||||
| return sname.dup(); | 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()) | if (maxNameSize == 0 || ! isRunning()) | ||||
| return sname.dup(); | return sname.dup(); | ||||
| @@ -54,7 +54,7 @@ struct BridgeAudioPool { | |||||
| : filename(), | : filename(), | ||||
| data(nullptr) | data(nullptr) | ||||
| { | { | ||||
| carla_zeroChar(shm, 64); | |||||
| carla_zeroChars(shm, 64); | |||||
| jackbridge_shm_init(shm); | jackbridge_shm_init(shm); | ||||
| } | } | ||||
| @@ -106,7 +106,7 @@ struct BridgeRtClientControl : public CarlaRingBufferControl<SmallStackBuffer> { | |||||
| : filename(), | : filename(), | ||||
| data(nullptr) | data(nullptr) | ||||
| { | { | ||||
| carla_zeroChar(shm, 64); | |||||
| carla_zeroChars(shm, 64); | |||||
| jackbridge_shm_init(shm); | jackbridge_shm_init(shm); | ||||
| } | } | ||||
| @@ -195,7 +195,7 @@ struct BridgeNonRtClientControl : public CarlaRingBufferControl<BigStackBuffer> | |||||
| : filename(), | : filename(), | ||||
| data(nullptr) | data(nullptr) | ||||
| { | { | ||||
| carla_zeroChar(shm, 64); | |||||
| carla_zeroChars(shm, 64); | |||||
| jackbridge_shm_init(shm); | jackbridge_shm_init(shm); | ||||
| } | } | ||||
| @@ -274,7 +274,7 @@ struct BridgeNonRtServerControl : public CarlaRingBufferControl<HugeStackBuffer> | |||||
| filename(), | filename(), | ||||
| data(nullptr) | data(nullptr) | ||||
| { | { | ||||
| carla_zeroChar(shm, 64); | |||||
| carla_zeroChars(shm, 64); | |||||
| jackbridge_shm_init(shm); | 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) | // uint/size, str[] (realName), uint/size, str[] (label), uint/size, str[] (maker), uint/size, str[] (copyright) | ||||
| fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerPluginInfo2); | fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerPluginInfo2); | ||||
| carla_zeroChar(bufStr, STR_MAX); | |||||
| carla_zeroChars(bufStr, STR_MAX); | |||||
| plugin->getRealName(bufStr); | 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.writeUInt(bufStrSize); | ||||
| fShmNonRtServerControl.writeCustomData(bufStr, bufStrSize); | fShmNonRtServerControl.writeCustomData(bufStr, bufStrSize); | ||||
| carla_zeroChar(bufStr, STR_MAX); | |||||
| carla_zeroChars(bufStr, STR_MAX); | |||||
| plugin->getLabel(bufStr); | 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.writeUInt(bufStrSize); | ||||
| fShmNonRtServerControl.writeCustomData(bufStr, bufStrSize); | fShmNonRtServerControl.writeCustomData(bufStr, bufStrSize); | ||||
| carla_zeroChar(bufStr, STR_MAX); | |||||
| carla_zeroChars(bufStr, STR_MAX); | |||||
| plugin->getMaker(bufStr); | 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.writeUInt(bufStrSize); | ||||
| fShmNonRtServerControl.writeCustomData(bufStr, bufStrSize); | fShmNonRtServerControl.writeCustomData(bufStr, bufStrSize); | ||||
| carla_zeroChar(bufStr, STR_MAX); | |||||
| carla_zeroChars(bufStr, STR_MAX); | |||||
| plugin->getCopyright(bufStr); | 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.writeUInt(bufStrSize); | ||||
| fShmNonRtServerControl.writeCustomData(bufStr, bufStrSize); | fShmNonRtServerControl.writeCustomData(bufStr, bufStrSize); | ||||
| @@ -656,21 +656,21 @@ public: | |||||
| fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerParameterData2); | fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerParameterData2); | ||||
| fShmNonRtServerControl.writeUInt(i); | fShmNonRtServerControl.writeUInt(i); | ||||
| carla_zeroChar(bufStr, STR_MAX); | |||||
| carla_zeroChars(bufStr, STR_MAX); | |||||
| plugin->getParameterName(i, bufStr); | 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.writeUInt(bufStrSize); | ||||
| fShmNonRtServerControl.writeCustomData(bufStr, bufStrSize); | fShmNonRtServerControl.writeCustomData(bufStr, bufStrSize); | ||||
| carla_zeroChar(bufStr, STR_MAX); | |||||
| carla_zeroChars(bufStr, STR_MAX); | |||||
| plugin->getParameterSymbol(i, bufStr); | 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.writeUInt(bufStrSize); | ||||
| fShmNonRtServerControl.writeCustomData(bufStr, bufStrSize); | fShmNonRtServerControl.writeCustomData(bufStr, bufStrSize); | ||||
| carla_zeroChar(bufStr, STR_MAX); | |||||
| carla_zeroChars(bufStr, STR_MAX); | |||||
| plugin->getParameterUnit(i, bufStr); | 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.writeUInt(bufStrSize); | ||||
| fShmNonRtServerControl.writeCustomData(bufStr, bufStrSize); | fShmNonRtServerControl.writeCustomData(bufStr, bufStrSize); | ||||
| @@ -720,9 +720,9 @@ public: | |||||
| fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerProgramName); | fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerProgramName); | ||||
| fShmNonRtServerControl.writeUInt(i); | fShmNonRtServerControl.writeUInt(i); | ||||
| carla_zeroChar(bufStr, STR_MAX); | |||||
| carla_zeroChars(bufStr, STR_MAX); | |||||
| plugin->getProgramName(i, bufStr); | 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.writeUInt(bufStrSize); | ||||
| fShmNonRtServerControl.writeCustomData(bufStr, bufStrSize); | fShmNonRtServerControl.writeCustomData(bufStr, bufStrSize); | ||||
| @@ -750,7 +750,7 @@ public: | |||||
| fShmNonRtServerControl.writeUInt(mpData.bank); | fShmNonRtServerControl.writeUInt(mpData.bank); | ||||
| fShmNonRtServerControl.writeUInt(mpData.program); | 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.writeUInt(bufStrSize); | ||||
| fShmNonRtServerControl.writeCustomData(mpData.name, bufStrSize); | fShmNonRtServerControl.writeCustomData(mpData.name, bufStrSize); | ||||
| @@ -989,19 +989,19 @@ public: | |||||
| // type | // type | ||||
| const uint32_t typeSize(fShmNonRtClientControl.readUInt()); | const uint32_t typeSize(fShmNonRtClientControl.readUInt()); | ||||
| char typeStr[typeSize+1]; | char typeStr[typeSize+1]; | ||||
| carla_zeroChar(typeStr, typeSize+1); | |||||
| carla_zeroChars(typeStr, typeSize+1); | |||||
| fShmNonRtClientControl.readCustomData(typeStr, typeSize); | fShmNonRtClientControl.readCustomData(typeStr, typeSize); | ||||
| // key | // key | ||||
| const uint32_t keySize(fShmNonRtClientControl.readUInt()); | const uint32_t keySize(fShmNonRtClientControl.readUInt()); | ||||
| char keyStr[keySize+1]; | char keyStr[keySize+1]; | ||||
| carla_zeroChar(keyStr, keySize+1); | |||||
| carla_zeroChars(keyStr, keySize+1); | |||||
| fShmNonRtClientControl.readCustomData(keyStr, keySize); | fShmNonRtClientControl.readCustomData(keyStr, keySize); | ||||
| // value | // value | ||||
| const uint32_t valueSize(fShmNonRtClientControl.readUInt()); | const uint32_t valueSize(fShmNonRtClientControl.readUInt()); | ||||
| char valueStr[valueSize+1]; | char valueStr[valueSize+1]; | ||||
| carla_zeroChar(valueStr, valueSize+1); | |||||
| carla_zeroChars(valueStr, valueSize+1); | |||||
| fShmNonRtClientControl.readCustomData(valueStr, valueSize); | fShmNonRtClientControl.readCustomData(valueStr, valueSize); | ||||
| if (plugin != nullptr && plugin->isEnabled()) | if (plugin != nullptr && plugin->isEnabled()) | ||||
| @@ -1014,7 +1014,7 @@ public: | |||||
| CARLA_SAFE_ASSERT_BREAK(size > 0); | CARLA_SAFE_ASSERT_BREAK(size > 0); | ||||
| char chunkFilePathTry[size+1]; | char chunkFilePathTry[size+1]; | ||||
| carla_zeroChar(chunkFilePathTry, size+1); | |||||
| carla_zeroChars(chunkFilePathTry, size+1); | |||||
| fShmNonRtClientControl.readCustomData(chunkFilePathTry, size); | fShmNonRtClientControl.readCustomData(chunkFilePathTry, size); | ||||
| CARLA_SAFE_ASSERT_BREAK(chunkFilePathTry[0] != '\0'); | CARLA_SAFE_ASSERT_BREAK(chunkFilePathTry[0] != '\0'); | ||||
| @@ -1430,7 +1430,7 @@ protected: | |||||
| std::size_t curMidiDataPos = 0; | std::size_t curMidiDataPos = 0; | ||||
| if (pData->events.in[0].type != kEngineEventTypeNull) | 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) | 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; | } break; | ||||
| @@ -43,14 +43,14 @@ void EngineControlEvent::convertToMidiData(const uint8_t channel, uint8_t& size, | |||||
| size = 3; | size = 3; | ||||
| data[0] = static_cast<uint8_t>(MIDI_STATUS_CONTROL_CHANGE | (channel & MIDI_CHANNEL_BIT)); | data[0] = static_cast<uint8_t>(MIDI_STATUS_CONTROL_CHANGE | (channel & MIDI_CHANNEL_BIT)); | ||||
| data[1] = MIDI_CONTROL_BANK_SELECT; | 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 | else | ||||
| { | { | ||||
| size = 3; | size = 3; | ||||
| data[0] = static_cast<uint8_t>(MIDI_STATUS_CONTROL_CHANGE | (channel & MIDI_CHANNEL_BIT)); | data[0] = static_cast<uint8_t>(MIDI_STATUS_CONTROL_CHANGE | (channel & MIDI_CHANNEL_BIT)); | ||||
| data[1] = static_cast<uint8_t>(param); | 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; | break; | ||||
| @@ -58,13 +58,13 @@ void EngineControlEvent::convertToMidiData(const uint8_t channel, uint8_t& size, | |||||
| size = 3; | size = 3; | ||||
| data[0] = static_cast<uint8_t>(MIDI_STATUS_CONTROL_CHANGE | (channel & MIDI_CHANNEL_BIT)); | data[0] = static_cast<uint8_t>(MIDI_STATUS_CONTROL_CHANGE | (channel & MIDI_CHANNEL_BIT)); | ||||
| data[1] = MIDI_CONTROL_BANK_SELECT; | 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; | break; | ||||
| case kEngineControlEventTypeMidiProgram: | case kEngineControlEventTypeMidiProgram: | ||||
| size = 2; | size = 2; | ||||
| data[0] = static_cast<uint8_t>(MIDI_STATUS_PROGRAM_CHANGE | (channel & MIDI_CHANNEL_BIT)); | 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; | break; | ||||
| case kEngineControlEventTypeAllSoundOff: | case kEngineControlEventTypeAllSoundOff: | ||||
| @@ -133,7 +133,7 @@ void EngineEvent::fillFromMidiData(const uint8_t size, const uint8_t* const data | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(size >= 3,); | 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.type = kEngineControlEventTypeParameter; | ||||
| ctrl.param = midiControl; | ctrl.param = midiControl; | ||||
| @@ -323,7 +323,7 @@ bool EngineTimeInfo::operator==(const EngineTimeInfo& timeInfo) const noexcept | |||||
| return false; | return false; | ||||
| if ((valid & kValidBBT) == 0) | if ((valid & kValidBBT) == 0) | ||||
| return true; | return true; | ||||
| if (! carla_compareFloats(timeInfo.bbt.beatsPerMinute, bbt.beatsPerMinute)) | |||||
| if (carla_isNotEqual(timeInfo.bbt.beatsPerMinute, bbt.beatsPerMinute)) | |||||
| return false; | return false; | ||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -789,7 +789,7 @@ void RackGraph::process(CarlaEngine::ProtectedData* const data, const float* inB | |||||
| FloatVectorOperations::clear(outBuf[1], iframes); | FloatVectorOperations::clear(outBuf[1], iframes); | ||||
| // initialize event outputs (zero) | // initialize event outputs (zero) | ||||
| carla_zeroStruct<EngineEvent>(data->events.out, kMaxEngineEventInternalCount); | |||||
| carla_zeroStructs(data->events.out, kMaxEngineEventInternalCount); | |||||
| uint32_t oldAudioInCount = 0; | uint32_t oldAudioInCount = 0; | ||||
| uint32_t oldAudioOutCount = 0; | uint32_t oldAudioOutCount = 0; | ||||
| @@ -827,10 +827,10 @@ void RackGraph::process(CarlaEngine::ProtectedData* const data, const float* inB | |||||
| else | else | ||||
| { | { | ||||
| // initialize event inputs from previous outputs | // 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) | // 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); | EngineEvent* const engineEvents(port->fBuffer); | ||||
| CARLA_SAFE_ASSERT_RETURN(engineEvents != nullptr,); | CARLA_SAFE_ASSERT_RETURN(engineEvents != nullptr,); | ||||
| carla_zeroStruct<EngineEvent>(engineEvents, kMaxEngineEventInternalCount); | |||||
| carla_zeroStructs(engineEvents, kMaxEngineEventInternalCount); | |||||
| fillEngineEventsFromJuceMidiBuffer(engineEvents, midi); | fillEngineEventsFromJuceMidiBuffer(engineEvents, midi); | ||||
| } | } | ||||
| @@ -1270,7 +1270,7 @@ public: | |||||
| CARLA_SAFE_ASSERT_RETURN(engineEvents != nullptr,); | CARLA_SAFE_ASSERT_RETURN(engineEvents != nullptr,); | ||||
| fillJuceMidiBufferFromEngineEvents(midi, engineEvents); | fillJuceMidiBufferFromEngineEvents(midi, engineEvents); | ||||
| carla_zeroStruct<EngineEvent>(engineEvents, kMaxEngineEventInternalCount); | |||||
| carla_zeroStructs(engineEvents, kMaxEngineEventInternalCount); | |||||
| } | } | ||||
| fPlugin->unlock(); | fPlugin->unlock(); | ||||
| @@ -1340,8 +1340,8 @@ PatchbayGraph::PatchbayGraph(CarlaEngine* const engine, const uint32_t ins, cons | |||||
| graph(), | graph(), | ||||
| audioBuffer(), | audioBuffer(), | ||||
| midiBuffer(), | 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(), | retCon(), | ||||
| usingExternal(false), | usingExternal(false), | ||||
| extGraph(engine), | extGraph(engine), | ||||
| @@ -1845,7 +1845,7 @@ void PatchbayGraph::process(CarlaEngine::ProtectedData* const data, const float* | |||||
| // put juce events in carla buffer | // put juce events in carla buffer | ||||
| { | { | ||||
| carla_zeroStruct<EngineEvent>(data->events.out, kMaxEngineEventInternalCount); | |||||
| carla_zeroStructs(data->events.out, kMaxEngineEventInternalCount); | |||||
| fillEngineEventsFromJuceMidiBuffer(data->events.out, midiBuffer); | fillEngineEventsFromJuceMidiBuffer(data->events.out, midiBuffer); | ||||
| midiBuffer.clear(); | midiBuffer.clear(); | ||||
| } | } | ||||
| @@ -127,7 +127,7 @@ CarlaEngine::ProtectedData::ProtectedData(CarlaEngine* const engine) noexcept | |||||
| nextAction() | nextAction() | ||||
| { | { | ||||
| #ifdef BUILD_BRIDGE | #ifdef BUILD_BRIDGE | ||||
| carla_zeroStruct(plugins, 1); | |||||
| carla_zeroStructs(plugins, 1); | |||||
| #endif | #endif | ||||
| } | } | ||||
| @@ -206,7 +206,7 @@ bool CarlaEngine::ProtectedData::init(const char* const clientName) | |||||
| #ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
| plugins = new EnginePluginData[maxPluginNumber]; | plugins = new EnginePluginData[maxPluginNumber]; | ||||
| carla_zeroStruct(plugins, maxPluginNumber); | |||||
| carla_zeroStructs(plugins, maxPluginNumber); | |||||
| #endif | #endif | ||||
| nextAction.ready(); | nextAction.ready(); | ||||
| @@ -690,7 +690,7 @@ public: | |||||
| // FIXME: Always enable JACK transport for now | // FIXME: Always enable JACK transport for now | ||||
| pData->options.transportMode = ENGINE_TRANSPORT_MODE_JACK; | pData->options.transportMode = ENGINE_TRANSPORT_MODE_JACK; | ||||
| carla_zeroStruct<jack_position_t>(fTransportPos); | |||||
| carla_zeroStruct(fTransportPos); | |||||
| } | } | ||||
| ~CarlaEngineJack() noexcept override | ~CarlaEngineJack() noexcept override | ||||
| @@ -749,7 +749,7 @@ public: | |||||
| fTransportState = JackTransportStopped; | fTransportState = JackTransportStopped; | ||||
| fExternalPatchbay = true; | fExternalPatchbay = true; | ||||
| carla_zeroStruct<jack_position_t>(fTransportPos); | |||||
| carla_zeroStruct(fTransportPos); | |||||
| CarlaString truncatedClientName(clientName); | CarlaString truncatedClientName(clientName); | ||||
| truncatedClientName.truncate(getMaxClientNameSize()); | truncatedClientName.truncate(getMaxClientNameSize()); | ||||
| @@ -764,7 +764,7 @@ public: | |||||
| return false; | 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 | // open temp client to get initial buffer-size and sample-rate values | ||||
| if (jack_client_t* const tmpClient = jackbridge_client_open(truncatedClientName, JackNoStartServer, nullptr)) | if (jack_client_t* const tmpClient = jackbridge_client_open(truncatedClientName, JackNoStartServer, nullptr)) | ||||
| @@ -1309,7 +1309,7 @@ protected: | |||||
| void handleJackSampleRateCallback(const double newSampleRate) | void handleJackSampleRateCallback(const double newSampleRate) | ||||
| { | { | ||||
| if (carla_compareFloats(pData->sampleRate, newSampleRate)) | |||||
| if (carla_isEqual(pData->sampleRate, newSampleRate)) | |||||
| return; | return; | ||||
| pData->sampleRate = newSampleRate; | pData->sampleRate = newSampleRate; | ||||
| @@ -1439,8 +1439,8 @@ protected: | |||||
| /**/ float* outBuf[2] = { audioOut1, audioOut2 }; | /**/ float* outBuf[2] = { audioOut1, audioOut2 }; | ||||
| // initialize events | // 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; | ushort engineEventIndex = 0; | ||||
| @@ -430,8 +430,8 @@ protected: | |||||
| FloatVectorOperations::clear(outputChannelData[i], numSamples); | FloatVectorOperations::clear(outputChannelData[i], numSamples); | ||||
| // initialize events | // 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()) | if (fMidiInEvents.mutex.tryLock()) | ||||
| { | { | ||||
| @@ -576,7 +576,7 @@ public: | |||||
| if (gNeedsJuceHandling && ++gJuceReferenceCounter == 1) | if (gNeedsJuceHandling && ++gJuceReferenceCounter == 1) | ||||
| juce::initialiseJuce_GUI(); | juce::initialiseJuce_GUI(); | ||||
| carla_zeroChar(fTmpBuf, STR_MAX+1); | |||||
| carla_zeroChars(fTmpBuf, STR_MAX+1); | |||||
| pData->bufferSize = pHost->get_buffer_size(pHost->handle); | pData->bufferSize = pHost->get_buffer_size(pHost->handle); | ||||
| pData->sampleRate = pHost->get_sample_rate(pHost->handle); | pData->sampleRate = pHost->get_sample_rate(pHost->handle); | ||||
| @@ -732,7 +732,7 @@ protected: | |||||
| void sampleRateChanged(const double newSampleRate) | void sampleRateChanged(const double newSampleRate) | ||||
| { | { | ||||
| if (carla_compareFloats(pData->sampleRate, newSampleRate)) | |||||
| if (carla_isEqual(pData->sampleRate, newSampleRate)) | |||||
| return; | return; | ||||
| { | { | ||||
| @@ -1339,8 +1339,8 @@ protected: | |||||
| // --------------------------------------------------------------- | // --------------------------------------------------------------- | ||||
| // initialize events | // 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) | // events input (before processing) | ||||
| @@ -1385,7 +1385,7 @@ protected: | |||||
| // --------------------------------------------------------------- | // --------------------------------------------------------------- | ||||
| // events output (after processing) | // events output (after processing) | ||||
| carla_zeroStruct<EngineEvent>(pData->events.in, kMaxEngineEventInternalCount); | |||||
| carla_zeroStructs(pData->events.in, kMaxEngineEventInternalCount); | |||||
| { | { | ||||
| NativeMidiEvent midiEvent; | NativeMidiEvent midiEvent; | ||||
| @@ -112,7 +112,7 @@ void CarlaEngineEventPort::initBuffer() noexcept | |||||
| if (kProcessMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK || kProcessMode == ENGINE_PROCESS_MODE_BRIDGE) | if (kProcessMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK || kProcessMode == ENGINE_PROCESS_MODE_BRIDGE) | ||||
| fBuffer = kClient.getEngine().getInternalEventBuffer(kIsInput); | fBuffer = kClient.getEngine().getInternalEventBuffer(kIsInput); | ||||
| else if (kProcessMode == ENGINE_PROCESS_MODE_PATCHBAY && ! kIsInput) | else if (kProcessMode == ENGINE_PROCESS_MODE_PATCHBAY && ! kIsInput) | ||||
| carla_zeroStruct<EngineEvent>(fBuffer, kMaxEngineEventInternalCount); | |||||
| carla_zeroStructs(fBuffer, kMaxEngineEventInternalCount); | |||||
| } | } | ||||
| uint32_t CarlaEngineEventPort::getEventCount() const noexcept | 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.type = type; | ||||
| event.ctrl.param = param; | 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; | return true; | ||||
| } | } | ||||
| @@ -249,8 +249,8 @@ public: | |||||
| return false; | 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; | fAudioInterleaved = fAudio.getCurrentApi() == RtAudio::LINUX_PULSE; | ||||
| RtAudio::StreamOptions rtOptions; | RtAudio::StreamOptions rtOptions; | ||||
| @@ -599,8 +599,8 @@ protected: | |||||
| } | } | ||||
| // initialize events | // 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()) | if (fMidiInEvents.mutex.tryLock()) | ||||
| { | { | ||||
| @@ -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); | 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; | return; | ||||
| pData->postProc.dryWet = fixedValue; | 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); | 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; | return; | ||||
| pData->postProc.volume = fixedValue; | 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); | 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; | return; | ||||
| pData->postProc.balanceLeft = fixedValue; | 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); | 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; | return; | ||||
| pData->postProc.balanceRight = fixedValue; | 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); | 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; | return; | ||||
| pData->postProc.panning = fixedValue; | 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 (pData->param.data[i].rindex == rindex) | ||||
| { | { | ||||
| //if (! carla_compareFloats(getParameterValue(i), value)) | |||||
| //if (carla_isNotEqual(getParameterValue(i), value)) | |||||
| setParameterValue(i, value, sendGui, sendOsc, sendCallback); | setParameterValue(i, value, sendGui, sendOsc, sendCallback); | ||||
| break; | break; | ||||
| } | } | ||||
| @@ -1648,10 +1648,10 @@ void CarlaPlugin::registerToOscClient() noexcept | |||||
| // Base data | // Base data | ||||
| { | { | ||||
| char bufName[STR_MAX+1], bufLabel[STR_MAX+1], bufMaker[STR_MAX+1], bufCopyright[STR_MAX+1]; | 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); | getRealName(bufName); | ||||
| getLabel(bufLabel); | 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) | 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); | getParameterName(i, bufName); | ||||
| getParameterUnit(i, bufUnit); | getParameterUnit(i, bufUnit); | ||||
| @@ -1794,9 +1794,9 @@ public: | |||||
| // Post-processing (dry/wet, volume and balance) | // 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; | bool isPair; | ||||
| float bufValue, oldBufLeft[doBalance ? frames : 1]; | float bufValue, oldBufLeft[doBalance ? frames : 1]; | ||||
| @@ -2022,25 +2022,25 @@ public: | |||||
| // realName | // realName | ||||
| const uint32_t realNameSize(fShmNonRtServerControl.readUInt()); | const uint32_t realNameSize(fShmNonRtServerControl.readUInt()); | ||||
| char realName[realNameSize+1]; | char realName[realNameSize+1]; | ||||
| carla_zeroChar(realName, realNameSize+1); | |||||
| carla_zeroChars(realName, realNameSize+1); | |||||
| fShmNonRtServerControl.readCustomData(realName, realNameSize); | fShmNonRtServerControl.readCustomData(realName, realNameSize); | ||||
| // label | // label | ||||
| const uint32_t labelSize(fShmNonRtServerControl.readUInt()); | const uint32_t labelSize(fShmNonRtServerControl.readUInt()); | ||||
| char label[labelSize+1]; | char label[labelSize+1]; | ||||
| carla_zeroChar(label, labelSize+1); | |||||
| carla_zeroChars(label, labelSize+1); | |||||
| fShmNonRtServerControl.readCustomData(label, labelSize); | fShmNonRtServerControl.readCustomData(label, labelSize); | ||||
| // maker | // maker | ||||
| const uint32_t makerSize(fShmNonRtServerControl.readUInt()); | const uint32_t makerSize(fShmNonRtServerControl.readUInt()); | ||||
| char maker[makerSize+1]; | char maker[makerSize+1]; | ||||
| carla_zeroChar(maker, makerSize+1); | |||||
| carla_zeroChars(maker, makerSize+1); | |||||
| fShmNonRtServerControl.readCustomData(maker, makerSize); | fShmNonRtServerControl.readCustomData(maker, makerSize); | ||||
| // copyright | // copyright | ||||
| const uint32_t copyrightSize(fShmNonRtServerControl.readUInt()); | const uint32_t copyrightSize(fShmNonRtServerControl.readUInt()); | ||||
| char copyright[copyrightSize+1]; | char copyright[copyrightSize+1]; | ||||
| carla_zeroChar(copyright, copyrightSize+1); | |||||
| carla_zeroChars(copyright, copyrightSize+1); | |||||
| fShmNonRtServerControl.readCustomData(copyright, copyrightSize); | fShmNonRtServerControl.readCustomData(copyright, copyrightSize); | ||||
| fInfo.name = realName; | fInfo.name = realName; | ||||
| @@ -2141,19 +2141,19 @@ public: | |||||
| // name | // name | ||||
| const uint32_t nameSize(fShmNonRtServerControl.readUInt()); | const uint32_t nameSize(fShmNonRtServerControl.readUInt()); | ||||
| char name[nameSize+1]; | char name[nameSize+1]; | ||||
| carla_zeroChar(name, nameSize+1); | |||||
| carla_zeroChars(name, nameSize+1); | |||||
| fShmNonRtServerControl.readCustomData(name, nameSize); | fShmNonRtServerControl.readCustomData(name, nameSize); | ||||
| // symbol | // symbol | ||||
| const uint32_t symbolSize(fShmNonRtServerControl.readUInt()); | const uint32_t symbolSize(fShmNonRtServerControl.readUInt()); | ||||
| char symbol[symbolSize+1]; | char symbol[symbolSize+1]; | ||||
| carla_zeroChar(symbol, symbolSize+1); | |||||
| carla_zeroChars(symbol, symbolSize+1); | |||||
| fShmNonRtServerControl.readCustomData(symbol, symbolSize); | fShmNonRtServerControl.readCustomData(symbol, symbolSize); | ||||
| // unit | // unit | ||||
| const uint32_t unitSize(fShmNonRtServerControl.readUInt()); | const uint32_t unitSize(fShmNonRtServerControl.readUInt()); | ||||
| char unit[unitSize+1]; | char unit[unitSize+1]; | ||||
| carla_zeroChar(unit, unitSize+1); | |||||
| carla_zeroChars(unit, unitSize+1); | |||||
| fShmNonRtServerControl.readCustomData(unit, unitSize); | fShmNonRtServerControl.readCustomData(unit, unitSize); | ||||
| CARLA_SAFE_ASSERT_INT2(index < pData->param.count, index, pData->param.count); | CARLA_SAFE_ASSERT_INT2(index < pData->param.count, index, pData->param.count); | ||||
| @@ -2254,7 +2254,7 @@ public: | |||||
| // name | // name | ||||
| const uint32_t nameSize(fShmNonRtServerControl.readUInt()); | const uint32_t nameSize(fShmNonRtServerControl.readUInt()); | ||||
| char name[nameSize+1]; | char name[nameSize+1]; | ||||
| carla_zeroChar(name, nameSize+1); | |||||
| carla_zeroChars(name, nameSize+1); | |||||
| fShmNonRtServerControl.readCustomData(name, nameSize); | fShmNonRtServerControl.readCustomData(name, nameSize); | ||||
| CARLA_SAFE_ASSERT_INT2(index < pData->prog.count, index, pData->prog.count); | CARLA_SAFE_ASSERT_INT2(index < pData->prog.count, index, pData->prog.count); | ||||
| @@ -2276,7 +2276,7 @@ public: | |||||
| // name | // name | ||||
| const uint32_t nameSize(fShmNonRtServerControl.readUInt()); | const uint32_t nameSize(fShmNonRtServerControl.readUInt()); | ||||
| char name[nameSize+1]; | char name[nameSize+1]; | ||||
| carla_zeroChar(name, nameSize+1); | |||||
| carla_zeroChars(name, nameSize+1); | |||||
| fShmNonRtServerControl.readCustomData(name, nameSize); | fShmNonRtServerControl.readCustomData(name, nameSize); | ||||
| CARLA_SAFE_ASSERT_INT2(index < pData->midiprog.count, index, pData->midiprog.count); | CARLA_SAFE_ASSERT_INT2(index < pData->midiprog.count, index, pData->midiprog.count); | ||||
| @@ -2297,19 +2297,19 @@ public: | |||||
| // type | // type | ||||
| const uint32_t typeSize(fShmNonRtServerControl.readUInt()); | const uint32_t typeSize(fShmNonRtServerControl.readUInt()); | ||||
| char type[typeSize+1]; | char type[typeSize+1]; | ||||
| carla_zeroChar(type, typeSize+1); | |||||
| carla_zeroChars(type, typeSize+1); | |||||
| fShmNonRtServerControl.readCustomData(type, typeSize); | fShmNonRtServerControl.readCustomData(type, typeSize); | ||||
| // key | // key | ||||
| const uint32_t keySize(fShmNonRtServerControl.readUInt()); | const uint32_t keySize(fShmNonRtServerControl.readUInt()); | ||||
| char key[keySize+1]; | char key[keySize+1]; | ||||
| carla_zeroChar(key, keySize+1); | |||||
| carla_zeroChars(key, keySize+1); | |||||
| fShmNonRtServerControl.readCustomData(key, keySize); | fShmNonRtServerControl.readCustomData(key, keySize); | ||||
| // value | // value | ||||
| const uint32_t valueSize(fShmNonRtServerControl.readUInt()); | const uint32_t valueSize(fShmNonRtServerControl.readUInt()); | ||||
| char value[valueSize+1]; | char value[valueSize+1]; | ||||
| carla_zeroChar(value, valueSize+1); | |||||
| carla_zeroChars(value, valueSize+1); | |||||
| fShmNonRtServerControl.readCustomData(value, valueSize); | fShmNonRtServerControl.readCustomData(value, valueSize); | ||||
| CarlaPlugin::setCustomData(type, key, value, false); | CarlaPlugin::setCustomData(type, key, value, false); | ||||
| @@ -2321,7 +2321,7 @@ public: | |||||
| // chunkFilePath | // chunkFilePath | ||||
| const uint32_t chunkFilePathSize(fShmNonRtServerControl.readUInt()); | const uint32_t chunkFilePathSize(fShmNonRtServerControl.readUInt()); | ||||
| char chunkFilePath[chunkFilePathSize+1]; | char chunkFilePath[chunkFilePathSize+1]; | ||||
| carla_zeroChar(chunkFilePath, chunkFilePathSize+1); | |||||
| carla_zeroChars(chunkFilePath, chunkFilePathSize+1); | |||||
| fShmNonRtServerControl.readCustomData(chunkFilePath, chunkFilePathSize); | fShmNonRtServerControl.readCustomData(chunkFilePath, chunkFilePathSize); | ||||
| String realChunkFilePath(chunkFilePath); | String realChunkFilePath(chunkFilePath); | ||||
| @@ -2382,7 +2382,7 @@ public: | |||||
| // error | // error | ||||
| const uint32_t errorSize(fShmNonRtServerControl.readUInt()); | const uint32_t errorSize(fShmNonRtServerControl.readUInt()); | ||||
| char error[errorSize+1]; | char error[errorSize+1]; | ||||
| carla_zeroChar(error, errorSize+1); | |||||
| carla_zeroChars(error, errorSize+1); | |||||
| fShmNonRtServerControl.readCustomData(error, errorSize); | fShmNonRtServerControl.readCustomData(error, errorSize); | ||||
| if (fInitiated) | if (fInitiated) | ||||
| @@ -2510,7 +2510,7 @@ public: | |||||
| // init bridge thread | // init bridge thread | ||||
| { | { | ||||
| char shmIdsStr[6*4+1]; | 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*0, &fShmAudioPool.filename[fShmAudioPool.filename.length()-6], 6); | ||||
| std::strncpy(shmIdsStr+6*1, &fShmRtClientControl.filename[fShmRtClientControl.filename.length()-6], 6); | std::strncpy(shmIdsStr+6*1, &fShmRtClientControl.filename[fShmRtClientControl.filename.length()-6], 6); | ||||
| @@ -914,7 +914,7 @@ public: | |||||
| carla_stderr2("WARNING - Broken plugin parameter '%s': min > max", paramName); | carla_stderr2("WARNING - Broken plugin parameter '%s': min > max", paramName); | ||||
| min = max - 0.1f; | 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); | carla_stderr2("WARNING - Broken plugin parameter '%s': min == max", paramName); | ||||
| max = min + 0.1f; | max = min + 0.1f; | ||||
| @@ -1341,7 +1341,7 @@ public: | |||||
| } | } | ||||
| ulong midiEventCount = 0; | ulong midiEventCount = 0; | ||||
| carla_zeroStruct<snd_seq_event_t>(fMidiEvents, kPluginMaxMidiEvents); | |||||
| carla_zeroStructs(fMidiEvents, kPluginMaxMidiEvents); | |||||
| // -------------------------------------------------------------------------------------------------------- | // -------------------------------------------------------------------------------------------------------- | ||||
| // Check if needs reset | // Check if needs reset | ||||
| @@ -1934,8 +1934,8 @@ public: | |||||
| // Post-processing (dry/wet, volume and balance) | // 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); | const bool isMono = (pData->audioIn.count == 1); | ||||
| bool isPair; | bool isPair; | ||||
| @@ -1418,8 +1418,8 @@ public: | |||||
| { | { | ||||
| // note - balance not possible with kUse16Outs, so we can safely skip fAudioOutBuffers | // 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]; | float oldBufLeft[doBalance ? frames : 1]; | ||||
| @@ -49,7 +49,7 @@ void PluginAudioData::createNew(const uint32_t newCount) | |||||
| CARLA_SAFE_ASSERT_RETURN(newCount > 0,); | CARLA_SAFE_ASSERT_RETURN(newCount > 0,); | ||||
| ports = new PluginAudioPort[newCount]; | ports = new PluginAudioPort[newCount]; | ||||
| carla_zeroStruct(ports, newCount); | |||||
| carla_zeroStructs(ports, newCount); | |||||
| count = newCount; | count = newCount; | ||||
| } | } | ||||
| @@ -103,7 +103,7 @@ void PluginCVData::createNew(const uint32_t newCount) | |||||
| CARLA_SAFE_ASSERT_RETURN(newCount > 0,); | CARLA_SAFE_ASSERT_RETURN(newCount > 0,); | ||||
| ports = new PluginCVPort[newCount]; | ports = new PluginCVPort[newCount]; | ||||
| carla_zeroStruct(ports, newCount); | |||||
| carla_zeroStructs(ports, newCount); | |||||
| count = newCount; | count = newCount; | ||||
| } | } | ||||
| @@ -200,7 +200,7 @@ void PluginParameterData::createNew(const uint32_t newCount, const bool withSpec | |||||
| CARLA_SAFE_ASSERT_RETURN(newCount > 0,); | CARLA_SAFE_ASSERT_RETURN(newCount > 0,); | ||||
| data = new ParameterData[newCount]; | data = new ParameterData[newCount]; | ||||
| carla_zeroStruct(data, newCount); | |||||
| carla_zeroStructs(data, newCount); | |||||
| for (uint32_t i=0; i < newCount; ++i) | 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]; | ranges = new ParameterRanges[newCount]; | ||||
| carla_zeroStruct(ranges, newCount); | |||||
| carla_zeroStructs(ranges, newCount); | |||||
| if (withSpecial) | if (withSpecial) | ||||
| { | { | ||||
| special = new SpecialParameterType[newCount]; | special = new SpecialParameterType[newCount]; | ||||
| carla_zeroStruct(special, newCount); | |||||
| carla_zeroStructs(special, newCount); | |||||
| } | } | ||||
| count = newCount; | count = newCount; | ||||
| @@ -289,7 +289,7 @@ void PluginProgramData::createNew(const uint32_t newCount) | |||||
| CARLA_SAFE_ASSERT_RETURN(newCount > 0,); | CARLA_SAFE_ASSERT_RETURN(newCount > 0,); | ||||
| names = new ProgramName[newCount]; | names = new ProgramName[newCount]; | ||||
| carla_zeroStruct(names, newCount); | |||||
| carla_zeroStructs(names, newCount); | |||||
| count = newCount; | count = newCount; | ||||
| current = -1; | current = -1; | ||||
| @@ -339,7 +339,7 @@ void PluginMidiProgramData::createNew(const uint32_t newCount) | |||||
| CARLA_SAFE_ASSERT_RETURN(newCount > 0,); | CARLA_SAFE_ASSERT_RETURN(newCount > 0,); | ||||
| data = new MidiProgramData[newCount]; | data = new MidiProgramData[newCount]; | ||||
| carla_zeroStruct(data, newCount); | |||||
| carla_zeroStructs(data, newCount); | |||||
| count = newCount; | count = newCount; | ||||
| current = -1; | current = -1; | ||||
| @@ -1113,7 +1113,7 @@ protected: | |||||
| bool getCurrentPosition(CurrentPositionInfo& result) override | bool getCurrentPosition(CurrentPositionInfo& result) override | ||||
| { | { | ||||
| carla_copyStruct<CurrentPositionInfo>(result, fPosInfo); | |||||
| carla_copyStruct(result, fPosInfo); | |||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -615,7 +615,7 @@ public: | |||||
| carla_stderr2("WARNING - Broken plugin parameter '%s': min > max", paramName); | carla_stderr2("WARNING - Broken plugin parameter '%s': min > max", paramName); | ||||
| min = max - 0.1f; | 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); | carla_stderr2("WARNING - Broken plugin parameter '%s': min == max", paramName); | ||||
| max = min + 0.1f; | max = min + 0.1f; | ||||
| @@ -1211,8 +1211,8 @@ public: | |||||
| // Post-processing (dry/wet, volume and balance) | // 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); | const bool isMono = (pData->audioIn.count == 1); | ||||
| bool isPair; | bool isPair; | ||||
| @@ -2091,7 +2091,7 @@ public: | |||||
| max = (float)0xffffff; | 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); | carla_stderr2("WARNING - Broken plugin parameter '%s': max == min", fRdfDescriptor->Ports[i].Name); | ||||
| max = min + 0.1f; | max = min + 0.1f; | ||||
| @@ -2809,7 +2809,7 @@ public: | |||||
| break; | break; | ||||
| case LV2_PORT_DESIGNATION_TIME_BAR_BEAT: | case LV2_PORT_DESIGNATION_TIME_BAR_BEAT: | ||||
| if ((timeInfo.valid & EngineTimeInfo::kValidBBT) != 0 && (fLastTimeInfo.bbt.tick != timeInfo.bbt.tick || | 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)); | fParamBuffers[k] = static_cast<float>(static_cast<double>(timeInfo.bbt.beat) - 1.0 + (static_cast<double>(timeInfo.bbt.tick) / timeInfo.bbt.ticksPerBeat)); | ||||
| doPostRt = true; | doPostRt = true; | ||||
| @@ -2823,28 +2823,28 @@ public: | |||||
| } | } | ||||
| break; | break; | ||||
| case LV2_PORT_DESIGNATION_TIME_BEAT_UNIT: | 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; | fParamBuffers[k] = timeInfo.bbt.beatType; | ||||
| doPostRt = true; | doPostRt = true; | ||||
| } | } | ||||
| break; | break; | ||||
| case LV2_PORT_DESIGNATION_TIME_BEATS_PER_BAR: | 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; | fParamBuffers[k] = timeInfo.bbt.beatsPerBar; | ||||
| doPostRt = true; | doPostRt = true; | ||||
| } | } | ||||
| break; | break; | ||||
| case LV2_PORT_DESIGNATION_TIME_BEATS_PER_MINUTE: | 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); | fParamBuffers[k] = static_cast<float>(timeInfo.bbt.beatsPerMinute); | ||||
| doPostRt = true; | doPostRt = true; | ||||
| } | } | ||||
| break; | break; | ||||
| case LV2_PORT_DESIGNATION_TIME_TICKS_PER_BEAT: | 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); | fParamBuffers[k] = static_cast<float>(timeInfo.bbt.ticksPerBeat); | ||||
| doPostRt = true; | doPostRt = true; | ||||
| @@ -2911,7 +2911,7 @@ public: | |||||
| pData->postRtEvents.trySplice(); | 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 (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; | fParamBuffers[k] = pData->param.ranges[k].def; | ||||
| pData->postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(k), 0, fParamBuffers[k]); | pData->postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(k), 0, fParamBuffers[k]); | ||||
| @@ -3618,8 +3618,8 @@ public: | |||||
| // Post-processing (dry/wet, volume and balance) | // 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); | const bool isMono = (pData->audioIn.count == 1); | ||||
| bool isPair; | bool isPair; | ||||
| @@ -3808,7 +3808,7 @@ public: | |||||
| CARLA_ASSERT_INT(newSampleRate > 0.0, newSampleRate); | CARLA_ASSERT_INT(newSampleRate > 0.0, newSampleRate); | ||||
| carla_debug("CarlaPluginLV2::sampleRateChanged(%g) - start", newSampleRate); | carla_debug("CarlaPluginLV2::sampleRateChanged(%g) - start", newSampleRate); | ||||
| if (! carla_compareFloats(fLv2Options.sampleRate, newSampleRate)) | |||||
| if (carla_isNotEqual(fLv2Options.sampleRate, newSampleRate)) | |||||
| { | { | ||||
| fLv2Options.sampleRate = newSampleRate; | fLv2Options.sampleRate = newSampleRate; | ||||
| @@ -4561,7 +4561,7 @@ public: | |||||
| const float value(*(const float*)buffer); | const float value(*(const float*)buffer); | ||||
| //if (! carla_compareFloats(fParamBuffers[index], value)) | |||||
| //if (carla_isNotEqual(fParamBuffers[index], value)) | |||||
| setParameterValue(index, value, false, true, true); | setParameterValue(index, value, false, true, true); | ||||
| } break; | } break; | ||||
| @@ -219,11 +219,11 @@ public: | |||||
| sSampler->SetGlobalMaxStreams(LinuxSampler::kMaxStreams); | sSampler->SetGlobalMaxStreams(LinuxSampler::kMaxStreams); | ||||
| sSampler->SetGlobalMaxVoices(LinuxSampler::kMaxVoices); | 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) | 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"); | 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) | // 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]; | float oldBufLeft[doBalance ? frames : 1]; | ||||
| @@ -190,9 +190,9 @@ public: | |||||
| { | { | ||||
| carla_debug("CarlaPluginNative::CarlaPluginNative(%p, %i)", engine, id); | 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.handle = this; | ||||
| fHost.resourceDir = carla_strdup(engine->getOptions().resourceDir); | fHost.resourceDir = carla_strdup(engine->getOptions().resourceDir); | ||||
| @@ -1019,7 +1019,7 @@ public: | |||||
| else if (max < min) | else if (max < min) | ||||
| min = max; | min = max; | ||||
| if (carla_compareFloats(min, max)) | |||||
| if (carla_isEqual(min, max)) | |||||
| { | { | ||||
| carla_stderr2("WARNING - Broken plugin parameter '%s': max == min", paramInfo->name); | carla_stderr2("WARNING - Broken plugin parameter '%s': max == min", paramInfo->name); | ||||
| max = min + 0.1f; | max = min + 0.1f; | ||||
| @@ -1320,7 +1320,7 @@ public: | |||||
| } | } | ||||
| fMidiEventCount = 0; | fMidiEventCount = 0; | ||||
| carla_zeroStruct<NativeMidiEvent>(fMidiEvents, kPluginMaxMidiEvents*2); | |||||
| carla_zeroStructs(fMidiEvents, kPluginMaxMidiEvents*2); | |||||
| // -------------------------------------------------------------------------------------------------------- | // -------------------------------------------------------------------------------------------------------- | ||||
| // Check if needs reset | // Check if needs reset | ||||
| @@ -1461,7 +1461,7 @@ public: | |||||
| if (fMidiEventCount > 0) | if (fMidiEventCount > 0) | ||||
| { | { | ||||
| carla_zeroStruct<NativeMidiEvent>(fMidiEvents, fMidiEventCount); | |||||
| carla_zeroStructs(fMidiEvents, fMidiEventCount); | |||||
| fMidiEventCount = 0; | fMidiEventCount = 0; | ||||
| } | } | ||||
| } | } | ||||
| @@ -1888,8 +1888,8 @@ public: | |||||
| // Post-processing (dry/wet, volume and balance) | // 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; | bool isPair; | ||||
| float bufValue, oldBufLeft[doBalance ? frames : 1]; | float bufValue, oldBufLeft[doBalance ? frames : 1]; | ||||
| @@ -77,8 +77,8 @@ public: | |||||
| { | { | ||||
| carla_debug("CarlaPluginVST2::CarlaPluginVST2(%p, %i)", engine, id); | 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) | for (ushort i=0; i < kPluginMaxMidiEvents*2; ++i) | ||||
| fEvents.data[i] = (VstEvent*)&fMidiEvents[i]; | fEvents.data[i] = (VstEvent*)&fMidiEvents[i]; | ||||
| @@ -620,7 +620,7 @@ public: | |||||
| float min, max, def, step, stepSmall, stepLarge; | float min, max, def, step, stepSmall, stepLarge; | ||||
| VstParameterProperties prop; | VstParameterProperties prop; | ||||
| carla_zeroStruct<VstParameterProperties>(prop); | |||||
| carla_zeroStruct(prop); | |||||
| if (pData->hints & PLUGIN_HAS_COCKOS_EXTENSIONS) | if (pData->hints & PLUGIN_HAS_COCKOS_EXTENSIONS) | ||||
| { | { | ||||
| @@ -637,7 +637,7 @@ public: | |||||
| carla_stderr2("WARNING - Broken plugin parameter min > max (with cockos extensions)"); | carla_stderr2("WARNING - Broken plugin parameter min > max (with cockos extensions)"); | ||||
| min = max - 0.1f; | 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)"); | carla_stderr2("WARNING - Broken plugin parameter min == max (with cockos extensions)"); | ||||
| max = min + 0.1f; | max = min + 0.1f; | ||||
| @@ -679,7 +679,7 @@ public: | |||||
| carla_stderr2("WARNING - Broken plugin parameter min > max"); | carla_stderr2("WARNING - Broken plugin parameter min > max"); | ||||
| min = max - 0.1f; | min = max - 0.1f; | ||||
| } | } | ||||
| else if (carla_compareFloats(min, max)) | |||||
| else if (carla_isEqual(min, max)) | |||||
| { | { | ||||
| carla_stderr2("WARNING - Broken plugin parameter min == max"); | carla_stderr2("WARNING - Broken plugin parameter min == max"); | ||||
| max = min + 0.1f; | max = min + 0.1f; | ||||
| @@ -1006,7 +1006,7 @@ public: | |||||
| } | } | ||||
| fMidiEventCount = 0; | fMidiEventCount = 0; | ||||
| carla_zeroStruct<VstMidiEvent>(fMidiEvents, kPluginMaxMidiEvents*2); | |||||
| carla_zeroStructs(fMidiEvents, kPluginMaxMidiEvents*2); | |||||
| // -------------------------------------------------------------------------------------------------------- | // -------------------------------------------------------------------------------------------------------- | ||||
| // Check if needs reset | // Check if needs reset | ||||
| @@ -1174,7 +1174,7 @@ public: | |||||
| if (fMidiEventCount > 0) | if (fMidiEventCount > 0) | ||||
| { | { | ||||
| carla_zeroStruct<VstMidiEvent>(fMidiEvents, fMidiEventCount); | |||||
| carla_zeroStructs(fMidiEvents, fMidiEventCount); | |||||
| fMidiEventCount = 0; | fMidiEventCount = 0; | ||||
| } | } | ||||
| } | } | ||||
| @@ -1528,9 +1528,9 @@ public: | |||||
| // Post-processing (dry/wet, volume and balance) | // 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; | bool isPair; | ||||
| float bufValue, oldBufLeft[doBalance ? frames : 1]; | float bufValue, oldBufLeft[doBalance ? frames : 1]; | ||||
| @@ -1798,7 +1798,7 @@ protected: | |||||
| case audioMasterGetNumAutomatableParameters: | case audioMasterGetNumAutomatableParameters: | ||||
| // Deprecated in VST SDK 2.4 | // 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; | break; | ||||
| case audioMasterGetParameterQuantization: | case audioMasterGetParameterQuantization: | ||||
| @@ -2139,7 +2139,7 @@ public: | |||||
| else | else | ||||
| { | { | ||||
| char strBuf[STR_MAX+1]; | char strBuf[STR_MAX+1]; | ||||
| carla_zeroChar(strBuf, STR_MAX+1); | |||||
| carla_zeroChars(strBuf, STR_MAX+1); | |||||
| dispatcher(effGetEffectName, 0, 0, strBuf, 0.0f); | dispatcher(effGetEffectName, 0, 0, strBuf, 0.0f); | ||||
| if (strBuf[0] != '\0') | if (strBuf[0] != '\0') | ||||
| @@ -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 (! 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\""); } | 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; | timeInfo.sampleRate = kSampleRate; | ||||
| // Tempo | // Tempo | ||||
| @@ -549,7 +549,7 @@ static void do_ladspa_check(lib_t& libHandle, const char* const filename, const | |||||
| if (LADSPA_IS_PORT_AUDIO(portDescriptor)) | if (LADSPA_IS_PORT_AUDIO(portDescriptor)) | ||||
| { | { | ||||
| carla_zeroFloat(bufferAudio[iA], kBufferSize); | |||||
| carla_zeroFloats(bufferAudio[iA], kBufferSize); | |||||
| descriptor->connect_port(handle, j, bufferAudio[iA++]); | descriptor->connect_port(handle, j, bufferAudio[iA++]); | ||||
| } | } | ||||
| else if (LADSPA_IS_PORT_CONTROL(portDescriptor)) | 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"); | DISCOVERY_OUT("warning", "Parameter '" << portName << "' is broken: min > max"); | ||||
| max = min + 0.1f; | 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"); | DISCOVERY_OUT("warning", "Parameter '" << portName << "' is broken: max == min"); | ||||
| max = min + 0.1f; | 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)) | if (LADSPA_IS_PORT_AUDIO(portDescriptor)) | ||||
| { | { | ||||
| carla_zeroFloat(bufferAudio[iA], kBufferSize); | |||||
| carla_zeroFloats(bufferAudio[iA], kBufferSize); | |||||
| ldescriptor->connect_port(handle, j, bufferAudio[iA++]); | ldescriptor->connect_port(handle, j, bufferAudio[iA++]); | ||||
| } | } | ||||
| else if (LADSPA_IS_PORT_CONTROL(portDescriptor)) | 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"); | DISCOVERY_OUT("warning", "Parameter '" << portName << "' is broken: min > max"); | ||||
| max = min + 0.1f; | 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"); | DISCOVERY_OUT("warning", "Parameter '" << portName << "' is broken: max == min"); | ||||
| max = min + 0.1f; | 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) | if (descriptor->run_synth != nullptr) | ||||
| { | { | ||||
| snd_seq_event_t midiEvents[2]; | snd_seq_event_t midiEvents[2]; | ||||
| carla_zeroStruct<snd_seq_event_t>(midiEvents, 2); | |||||
| carla_zeroStructs(midiEvents, 2); | |||||
| const unsigned long midiEventCount = 2; | const unsigned long midiEventCount = 2; | ||||
| @@ -1193,7 +1193,7 @@ static void do_vst_check(lib_t& libHandle, const bool doInit) | |||||
| { | { | ||||
| for (;;) | for (;;) | ||||
| { | { | ||||
| carla_zeroChar(strBuf, STR_MAX+1); | |||||
| carla_zeroChars(strBuf, STR_MAX+1); | |||||
| gVstCurrentUniqueId = effect->dispatcher(effect, effShellGetNextPlugin, 0, 0, strBuf, 0.0f); | 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 | // 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) | if (effect->dispatcher(effect, effGetEffectName, 0, 0, strBuf, 0.0f) == 1) | ||||
| cName = strBuf; | cName = strBuf; | ||||
| @@ -1240,7 +1240,7 @@ static void do_vst_check(lib_t& libHandle, const bool doInit) | |||||
| cName.clear(); | cName.clear(); | ||||
| // get product | // 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) | if (effect->dispatcher(effect, effGetProductString, 0, 0, strBuf, 0.0f) == 1) | ||||
| cProduct = strBuf; | cProduct = strBuf; | ||||
| @@ -1248,7 +1248,7 @@ static void do_vst_check(lib_t& libHandle, const bool doInit) | |||||
| cProduct.clear(); | cProduct.clear(); | ||||
| // get vendor | // 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) | if (effect->dispatcher(effect, effGetVendorString, 0, 0, strBuf, 0.0f) == 1) | ||||
| cVendor = strBuf; | cVendor = strBuf; | ||||
| @@ -1299,14 +1299,14 @@ static void do_vst_check(lib_t& libHandle, const bool doInit) | |||||
| for (int j=0; j < audioIns; ++j) | for (int j=0; j < audioIns; ++j) | ||||
| { | { | ||||
| bufferAudioIn[j] = new float[kBufferSize]; | bufferAudioIn[j] = new float[kBufferSize]; | ||||
| carla_zeroFloat(bufferAudioIn[j], kBufferSize); | |||||
| carla_zeroFloats(bufferAudioIn[j], kBufferSize); | |||||
| } | } | ||||
| float* bufferAudioOut[audioOuts]; | float* bufferAudioOut[audioOuts]; | ||||
| for (int j=0; j < audioOuts; ++j) | for (int j=0; j < audioOuts; ++j) | ||||
| { | { | ||||
| bufferAudioOut[j] = new float[kBufferSize]; | bufferAudioOut[j] = new float[kBufferSize]; | ||||
| carla_zeroFloat(bufferAudioOut[j], kBufferSize); | |||||
| carla_zeroFloats(bufferAudioOut[j], kBufferSize); | |||||
| } | } | ||||
| struct VstEventsFixed { | struct VstEventsFixed { | ||||
| @@ -1323,7 +1323,7 @@ static void do_vst_check(lib_t& libHandle, const bool doInit) | |||||
| } events; | } events; | ||||
| VstMidiEvent midiEvents[2]; | VstMidiEvent midiEvents[2]; | ||||
| carla_zeroStruct<VstMidiEvent>(midiEvents, 2); | |||||
| carla_zeroStructs(midiEvents, 2); | |||||
| midiEvents[0].type = kVstMidiType; | midiEvents[0].type = kVstMidiType; | ||||
| midiEvents[0].byteSize = sizeof(VstMidiEvent); | midiEvents[0].byteSize = sizeof(VstMidiEvent); | ||||
| @@ -106,7 +106,7 @@ protected: | |||||
| void setParameterValue(const uint32_t index, const float value) final | 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)); | fEffect->changepar(static_cast<int>(index+2), static_cast<uchar>(ivalue)); | ||||
| } | } | ||||
| @@ -449,10 +449,10 @@ protected: | |||||
| } | } | ||||
| else if (index <= kParamPart16Volume) | else if (index <= kParamPart16Volume) | ||||
| { | { | ||||
| if (carla_compareFloats(fParameters[index], value)) | |||||
| if (carla_isEqual(fParameters[index], value)) | |||||
| return; | 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->transmitMsg("/echo", "ss", "OSC_URL", ""); | ||||
| fMiddleWare->activeUrl(""); | fMiddleWare->activeUrl(""); | ||||
| @@ -463,10 +463,10 @@ protected: | |||||
| } | } | ||||
| else if (index <= kParamPart16Panning) | else if (index <= kParamPart16Panning) | ||||
| { | { | ||||
| if (carla_compareFloats(fParameters[index], value)) | |||||
| if (carla_isEqual(fParameters[index], value)) | |||||
| return; | 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->transmitMsg("/echo", "ss", "OSC_URL", ""); | ||||
| fMiddleWare->activeUrl(""); | fMiddleWare->activeUrl(""); | ||||
| @@ -480,7 +480,7 @@ protected: | |||||
| const uint zynIndex(getZynParameterFromIndex(index)); | const uint zynIndex(getZynParameterFromIndex(index)); | ||||
| CARLA_SAFE_ASSERT_RETURN(zynIndex != C_NULL,); | 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) | for (int npart=0; npart<NUM_MIDI_PARTS; ++npart) | ||||
| { | { | ||||
| @@ -208,8 +208,8 @@ public: | |||||
| if (fHandle == nullptr) | if (fHandle == nullptr) | ||||
| return false; | return false; | ||||
| carla_zeroStruct<NativeMidiEvent>(fMidiEvents, kMaxMidiEvents*2); | |||||
| carla_zeroStruct<NativeTimeInfo>(fTimeInfo); | |||||
| carla_zeroStructs(fMidiEvents, kMaxMidiEvents*2); | |||||
| carla_zeroStruct(fTimeInfo); | |||||
| fPorts.init(fDescriptor, fHandle); | fPorts.init(fDescriptor, fHandle); | ||||
| fUris.map(fUridMap); | fUris.map(fUridMap); | ||||
| @@ -230,7 +230,7 @@ public: | |||||
| if (fDescriptor->activate != nullptr) | if (fDescriptor->activate != nullptr) | ||||
| fDescriptor->activate(fHandle); | fDescriptor->activate(fHandle); | ||||
| carla_zeroStruct<NativeTimeInfo>(fTimeInfo); | |||||
| carla_zeroStruct(fTimeInfo); | |||||
| } | } | ||||
| void lv2_deactivate() | void lv2_deactivate() | ||||
| @@ -294,7 +294,7 @@ public: | |||||
| if (fDescriptor->midiIns > 0 || (fDescriptor->hints & PLUGIN_USES_TIME) != 0) | if (fDescriptor->midiIns > 0 || (fDescriptor->hints & PLUGIN_USES_TIME) != 0) | ||||
| { | { | ||||
| fMidiEventCount = 0; | fMidiEventCount = 0; | ||||
| carla_zeroStruct<NativeMidiEvent>(fMidiEvents, kMaxMidiEvents*2); | |||||
| carla_zeroStructs(fMidiEvents, kMaxMidiEvents*2); | |||||
| LV2_ATOM_SEQUENCE_FOREACH(fPorts.eventsIn[0], iter) | LV2_ATOM_SEQUENCE_FOREACH(fPorts.eventsIn[0], iter) | ||||
| { | { | ||||
| @@ -211,8 +211,8 @@ public: | |||||
| fHandle = fDescriptor->instantiate(&fHost); | fHandle = fDescriptor->instantiate(&fHost); | ||||
| CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr, false); | 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); | fPorts.init(fDescriptor, fHandle); | ||||
| fURIs.map(fUridMap); | fURIs.map(fUridMap); | ||||
| @@ -233,7 +233,7 @@ public: | |||||
| if (fDescriptor->activate != nullptr) | if (fDescriptor->activate != nullptr) | ||||
| fDescriptor->activate(fHandle); | fDescriptor->activate(fHandle); | ||||
| carla_zeroStruct<NativeTimeInfo>(fTimeInfo); | |||||
| carla_zeroStruct(fTimeInfo); | |||||
| } | } | ||||
| void lv2_deactivate() | void lv2_deactivate() | ||||
| @@ -270,7 +270,7 @@ public: | |||||
| curValue = *fPorts.paramsPtr[i]; | curValue = *fPorts.paramsPtr[i]; | ||||
| if (carla_compareFloats(fPorts.paramsLast[i], curValue)) | |||||
| if (carla_isEqual(fPorts.paramsLast[i], curValue)) | |||||
| continue; | continue; | ||||
| fPorts.paramsLast[i] = curValue; | fPorts.paramsLast[i] = curValue; | ||||
| @@ -280,7 +280,7 @@ public: | |||||
| if (fDescriptor->midiIns > 0 || fDescriptor->midiOuts > 0 || (fDescriptor->hints & NATIVE_PLUGIN_USES_TIME) != 0) | if (fDescriptor->midiIns > 0 || fDescriptor->midiOuts > 0 || (fDescriptor->hints & NATIVE_PLUGIN_USES_TIME) != 0) | ||||
| { | { | ||||
| fMidiEventCount = 0; | fMidiEventCount = 0; | ||||
| carla_zeroStruct<NativeMidiEvent>(fMidiEvents, kMaxMidiEvents*2); | |||||
| carla_zeroStructs(fMidiEvents, kMaxMidiEvents*2); | |||||
| if (fDescriptor->hints & NATIVE_PLUGIN_USES_TIME) | if (fDescriptor->hints & NATIVE_PLUGIN_USES_TIME) | ||||
| { | { | ||||
| @@ -432,7 +432,7 @@ public: | |||||
| if (speed != nullptr && speed->type == fURIs.atomFloat) | if (speed != nullptr && speed->type == fURIs.atomFloat) | ||||
| { | { | ||||
| fLastTimeSpeed = ((LV2_Atom_Float*)speed)->body; | 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); | fTimeInfo.bbt.valid = (beatsPerMinute != nullptr && beatsPerBar != nullptr && beatUnit != nullptr); | ||||
| @@ -477,7 +477,7 @@ public: | |||||
| fIsProcessing = false; | fIsProcessing = false; | ||||
| // update timePos for next callback | // update timePos for next callback | ||||
| if (! carla_compareFloats(fLastTimeSpeed, 0.0)) | |||||
| if (carla_isNotEqual(fLastTimeSpeed, 0.0)) | |||||
| { | { | ||||
| const double newFrames = fLastTimeSpeed*frames; | const double newFrames = fLastTimeSpeed*frames; | ||||
| @@ -168,8 +168,8 @@ public: | |||||
| fHandle = fDescriptor->instantiate(&fHost); | fHandle = fDescriptor->instantiate(&fHost); | ||||
| CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr, false); | 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; | return true; | ||||
| } | } | ||||
| @@ -185,7 +185,7 @@ public: | |||||
| switch (opcode) | switch (opcode) | ||||
| { | { | ||||
| case effSetSampleRate: | case effSetSampleRate: | ||||
| if (carla_compareFloats(fSampleRate, static_cast<double>(opt))) | |||||
| if (carla_isEqual(fSampleRate, static_cast<double>(opt))) | |||||
| return 0; | return 0; | ||||
| fSampleRate = opt; | fSampleRate = opt; | ||||
| @@ -208,7 +208,7 @@ public: | |||||
| if (value != 0) | if (value != 0) | ||||
| { | { | ||||
| fMidiEventCount = 0; | fMidiEventCount = 0; | ||||
| carla_zeroStruct<NativeTimeInfo>(fTimeInfo); | |||||
| carla_zeroStruct(fTimeInfo); | |||||
| // tell host we want MIDI events | // tell host we want MIDI events | ||||
| hostCallback(audioMasterWantMidi); | hostCallback(audioMasterWantMidi); | ||||
| @@ -229,7 +229,7 @@ public: | |||||
| fDescriptor->dispatcher(fHandle, NATIVE_PLUGIN_OPCODE_BUFFER_SIZE_CHANGED, 0, (int32_t)value, nullptr, 0.0f); | 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; | fSampleRate = sampleRate; | ||||
| @@ -588,7 +588,7 @@ private: | |||||
| { | { | ||||
| for (uint32_t i=0; i<kMaxMidiEvents; ++i) | for (uint32_t i=0; i<kMaxMidiEvents; ++i) | ||||
| data[i] = (VstEvent*)&mdata[i]; | data[i] = (VstEvent*)&mdata[i]; | ||||
| carla_zeroStruct<VstMidiEvent>(mdata, kMaxMidiEvents); | |||||
| carla_zeroStructs(mdata, kMaxMidiEvents); | |||||
| } | } | ||||
| CARLA_DECLARE_NON_COPY_STRUCT(FixedVstEvents); | CARLA_DECLARE_NON_COPY_STRUCT(FixedVstEvents); | ||||
| @@ -147,7 +147,7 @@ static void test_CarlaRingBuffer3(CarlaRingBuffer<BufferStruct>& b) noexcept | |||||
| // read data | // read data | ||||
| char license[kLicenseSize+1]; | char license[kLicenseSize+1]; | ||||
| carla_zeroChar(license, kLicenseSize+1); | |||||
| carla_zeroChars(license, kLicenseSize+1); | |||||
| b.readCustomData(license, kLicenseSize); | b.readCustomData(license, kLicenseSize); | ||||
| // now empty again | // now empty again | ||||
| @@ -473,18 +473,18 @@ static void test_CarlaMathUtils() noexcept | |||||
| assert(carla_max(5, 6, 3) == 3); | assert(carla_max(5, 6, 3) == 3); | ||||
| // Fix bounds of 'value' between 'min' and 'max'. | // 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. | // Get next power of 2. | ||||
| assert(carla_nextPowerOf2(0) == 0); | assert(carla_nextPowerOf2(0) == 0); | ||||
| @@ -97,7 +97,7 @@ const char* lib_error(const char* const filename) noexcept | |||||
| #ifdef CARLA_OS_WIN | #ifdef CARLA_OS_WIN | ||||
| static char libError[2048+1]; | static char libError[2048+1]; | ||||
| carla_zeroChar(libError, 2048+1); | |||||
| carla_zeroChars(libError, 2048+1); | |||||
| try { | try { | ||||
| const DWORD winErrorCode = ::GetLastError(); | const DWORD winErrorCode = ::GetLastError(); | ||||
| @@ -514,7 +514,7 @@ struct CarlaPipeCommon::PrivateData { | |||||
| } CARLA_SAFE_EXCEPTION("CreateEvent"); | } CARLA_SAFE_EXCEPTION("CreateEvent"); | ||||
| #endif | #endif | ||||
| carla_zeroChar(tmpBuf, 0xff+1); | |||||
| carla_zeroChars(tmpBuf, 0xff+1); | |||||
| } | } | ||||
| ~PrivateData() noexcept | ~PrivateData() noexcept | ||||
| @@ -305,7 +305,7 @@ public: | |||||
| const int screen = DefaultScreen(fDisplay); | const int screen = DefaultScreen(fDisplay); | ||||
| XSetWindowAttributes attr; | XSetWindowAttributes attr; | ||||
| carla_zeroStruct<XSetWindowAttributes>(attr); | |||||
| carla_zeroStruct(attr); | |||||
| attr.border_pixel = 0; | attr.border_pixel = 0; | ||||
| attr.event_mask = KeyPressMask|KeyReleaseMask; | attr.event_mask = KeyPressMask|KeyReleaseMask; | ||||
| @@ -485,7 +485,7 @@ public: | |||||
| if (! fIsResizable) | if (! fIsResizable) | ||||
| { | { | ||||
| XSizeHints sizeHints; | XSizeHints sizeHints; | ||||
| carla_zeroStruct<XSizeHints>(sizeHints); | |||||
| carla_zeroStruct(sizeHints); | |||||
| sizeHints.flags = PSize|PMinSize|PMaxSize; | sizeHints.flags = PSize|PMinSize|PMaxSize; | ||||
| sizeHints.width = static_cast<int>(width); | sizeHints.width = static_cast<int>(width); | ||||
| @@ -228,14 +228,14 @@ public: | |||||
| CARLA_SAFE_ASSERT_RETURN(size > 0,); | CARLA_SAFE_ASSERT_RETURN(size > 0,); | ||||
| if (! tryRead(data, size)) | if (! tryRead(data, size)) | ||||
| carla_zeroBytes(data, size); | |||||
| std::memset(data, 0, size); | |||||
| } | } | ||||
| template <typename T> | template <typename T> | ||||
| void readCustomType(T& type) noexcept | void readCustomType(T& type) noexcept | ||||
| { | { | ||||
| if (! tryRead(&type, sizeof(T))) | if (! tryRead(&type, sizeof(T))) | ||||
| carla_zeroStruct(type); | |||||
| std::memset(&type, 0, sizeof(T)); | |||||
| } | } | ||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| @@ -61,7 +61,7 @@ sem_t* carla_sem_create() noexcept | |||||
| std::srand(static_cast<uint>(std::time(nullptr))); | std::srand(static_cast<uint>(std::time(nullptr))); | ||||
| char strBuf[0xff+1]; | 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()); | std::snprintf(strBuf, 0xff, "carla-sem-%lu-%lu-%i", static_cast<ulong>(::getpid()), sCounter, std::rand()); | ||||
| ::sem_unlink(strBuf); | ::sem_unlink(strBuf); | ||||
| @@ -66,7 +66,7 @@ static std::string replaceStdString(const std::string& original, const std::stri | |||||
| { | { | ||||
| retval.append(current, next); | retval.append(current, next); | ||||
| retval.append(after); | retval.append(after); | ||||
| current = next + static_cast<std::ssize_t>(before.size()); | |||||
| current = next + static_cast<ssize_t>(before.size()); | |||||
| } | } | ||||
| retval.append(current, next); | retval.append(current, next); | ||||
| return retval; | return retval; | ||||
| @@ -330,23 +330,23 @@ bool CarlaStateSave::fillFromXmlElement(const XmlElement* const xmlElement) | |||||
| } | } | ||||
| else if (tag.equalsIgnoreCase("drywet")) | 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")) | 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")) | 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")) | 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")) | 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")) | 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"; | 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"; | 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"; | 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"; | 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"; | 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"; | dataXml << " <Panning>" << String(panning, 7) << "</Panning>\n"; | ||||
| if (ctrlChannel < 0) | if (ctrlChannel < 0) | ||||
| @@ -158,7 +158,7 @@ public: | |||||
| static T& _getFallback() | static T& _getFallback() | ||||
| { | { | ||||
| static T data; | static T data; | ||||
| carla_zeroStruct<T>(data); | |||||
| carla_zeroStruct(data); | |||||
| return data; | return data; | ||||
| } | } | ||||
| @@ -225,7 +225,7 @@ public: | |||||
| static T& _getFallback() | static T& _getFallback() | ||||
| { | { | ||||
| static T data; | static T data; | ||||
| carla_zeroStruct<T>(data); | |||||
| carla_zeroStruct(data); | |||||
| return data; | return data; | ||||
| } | } | ||||
| }; | }; | ||||