diff --git a/source/backend/engine/CarlaEngineGraph.cpp b/source/backend/engine/CarlaEngineGraph.cpp index af1c00b7f..2d338bb5e 100644 --- a/source/backend/engine/CarlaEngineGraph.cpp +++ b/source/backend/engine/CarlaEngineGraph.cpp @@ -829,6 +829,7 @@ public: carla_zeroStruct(engineEvents, kMaxEngineEventInternalCount); fillEngineEventsFromJuceMidiBuffer(engineEvents, midi); } + midi.clear(); const uint32_t bufferSize(static_cast(audio.getNumSamples())); @@ -1069,6 +1070,7 @@ void PatchbayGraph::process(CarlaEngine::ProtectedData* const data, const float* { carla_zeroStruct(data->events.out, kMaxEngineEventInternalCount); fillEngineEventsFromJuceMidiBuffer(data->events.out, midiBuffer); + midiBuffer.clear(); } } #endif diff --git a/source/utils/CarlaBase64Utils.hpp b/source/utils/CarlaBase64Utils.hpp index 9f36c7ea6..2faeab8ce 100644 --- a/source/utils/CarlaBase64Utils.hpp +++ b/source/utils/CarlaBase64Utils.hpp @@ -54,7 +54,7 @@ bool isBase64Char(const char c) return (std::isalnum(c) || (c == '+') || (c == '/')); } -} +} // namespace CarlaBase64Helpers // ----------------------------------------------------------------------- diff --git a/source/utils/CarlaBinaryUtils.hpp b/source/utils/CarlaBinaryUtils.hpp index 6a073b220..8bb3932f7 100644 --- a/source/utils/CarlaBinaryUtils.hpp +++ b/source/utils/CarlaBinaryUtils.hpp @@ -60,12 +60,6 @@ private: CARLA_PREVENT_HEAP_ALLOCATION CARLA_DECLARE_NON_COPY_STRUCT(CarlaMagic) }; - -static const CarlaMagic& getCarlaMagicInstance() -{ - static CarlaMagic magic; - return magic; -} #endif // ----------------------------------------------------------------------- @@ -79,7 +73,7 @@ BinaryType getBinaryTypeFromFile(const char* const filename) if (filename == nullptr || filename[0] == '\0') return BINARY_NATIVE; - const CarlaMagic& magic(getCarlaMagicInstance()); + static const CarlaMagic magic; const char* const output(magic.getFileDescription(filename)); @@ -87,7 +81,7 @@ BinaryType getBinaryTypeFromFile(const char* const filename) return BINARY_NATIVE; if (std::strstr(output, "PE32 executable") != nullptr && std::strstr(output, "MS Windows") != nullptr) - return std::strstr(output, "x86-64") != nullptr ? BINARY_WIN64 : BINARY_WIN32; + return (std::strstr(output, "x86-64") != nullptr) ? BINARY_WIN64 : BINARY_WIN32; if (std::strstr(output, "ELF") != nullptr) return (std::strstr(output, "x86-64") != nullptr || std::strstr(output, "aarch64") != nullptr) ? BINARY_POSIX64 : BINARY_POSIX32; diff --git a/source/utils/CarlaEngineUtils.hpp b/source/utils/CarlaEngineUtils.hpp index 608b9f522..539c5fea0 100644 --- a/source/utils/CarlaEngineUtils.hpp +++ b/source/utils/CarlaEngineUtils.hpp @@ -163,9 +163,9 @@ void fillJuceMidiBufferFromEngineEvents(juce::MidiBuffer& midiBuffer, const Engi const EngineEvent& engineEvent(engineEvents[i]); if (engineEvent.type == kEngineEventTypeNull) + { break; - -#ifndef BUILD_BRIDGE + } else if (engineEvent.type == kEngineEventTypeControl) { const EngineControlEvent& ctrlEvent(engineEvent.ctrl); @@ -173,7 +173,6 @@ void fillJuceMidiBufferFromEngineEvents(juce::MidiBuffer& midiBuffer, const Engi ctrlEvent.convertToMidiData(engineEvent.channel, size, mdata); mdataPtr = mdata; } -#endif else if (engineEvent.type == kEngineEventTypeMidi) { const EngineMidiEvent& midiEvent(engineEvent.midi); diff --git a/source/utils/CarlaLibUtils.hpp b/source/utils/CarlaLibUtils.hpp index deeac6983..71675b47c 100644 --- a/source/utils/CarlaLibUtils.hpp +++ b/source/utils/CarlaLibUtils.hpp @@ -65,7 +65,7 @@ bool lib_close(void* const lib) noexcept /* * Get a library symbol (must not be null). - * May return null if the symbol is not found. + * Returns null if the symbol is not found. */ static inline void* lib_symbol(void* const lib, const char* const symbol) noexcept diff --git a/source/utils/CarlaMathUtils.hpp b/source/utils/CarlaMathUtils.hpp index b6538569d..d1740d00a 100644 --- a/source/utils/CarlaMathUtils.hpp +++ b/source/utils/CarlaMathUtils.hpp @@ -52,7 +52,7 @@ T carla_minPositive(const T& v1, const T& v2) noexcept return (v2 > 0) ? v2 : 0; if (v2 < 0) return (v1 > 0) ? v1 : 0; - return (v1 < v2 ? v1 : v2); + return (v1 < v2) ? v1 : v2; } /* diff --git a/source/utils/CarlaRingBuffer.hpp b/source/utils/CarlaRingBuffer.hpp index 27bf40829..7ec9de369 100644 --- a/source/utils/CarlaRingBuffer.hpp +++ b/source/utils/CarlaRingBuffer.hpp @@ -284,7 +284,7 @@ public: protected: void setRingBuffer(BufferStruct* const ringBuf, const bool reset) noexcept { - CARLA_SAFE_ASSERT_RETURN(ringBuf != fBuffer,); + CARLA_SAFE_ASSERT_RETURN(fBuffer != ringBuf,); fBuffer = ringBuf; diff --git a/source/utils/CarlaUtils.hpp b/source/utils/CarlaUtils.hpp index 61aa31f33..2381cdeed 100644 --- a/source/utils/CarlaUtils.hpp +++ b/source/utils/CarlaUtils.hpp @@ -298,10 +298,7 @@ const char* carla_strdup_safe(const char* const strBuf) noexcept try { buffer = new char[bufferLen+1]; - } - catch(...) { - return nullptr; - } + } CARLA_SAFE_EXCEPTION_RETURN("carla_strdup_safe", nullptr); if (strBuf != nullptr && bufferLen > 0) std::strncpy(buffer, strBuf, bufferLen);