From 5b1d5f7a186b841f0e45df917cd1cbbd7d802c2a Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 1 Nov 2019 14:50:05 +0100 Subject: [PATCH] More constness cleanup --- source/backend/engine/CarlaEngineGraph.hpp | 80 +++++++++---------- source/backend/engine/CarlaEngineInternal.hpp | 62 +++++++------- source/backend/engine/CarlaEngineOsc.hpp | 46 +++++------ source/backend/engine/CarlaEngineThread.hpp | 2 +- source/backend/plugin/CarlaPluginInternal.cpp | 2 +- source/backend/plugin/CarlaPluginInternal.hpp | 40 +++++----- 6 files changed, 115 insertions(+), 117 deletions(-) diff --git a/source/backend/engine/CarlaEngineGraph.hpp b/source/backend/engine/CarlaEngineGraph.hpp index 3b6094097..7043ede15 100644 --- a/source/backend/engine/CarlaEngineGraph.hpp +++ b/source/backend/engine/CarlaEngineGraph.hpp @@ -70,8 +70,8 @@ enum ExternalGraphConnectionType { struct ExternalGraphPorts { LinkedList ins; LinkedList outs; - const char* getName(const bool isInput, const uint portId) const noexcept; - uint getPortId(const bool isInput, const char portName[], bool* const ok = nullptr) const noexcept; + const char* getName(bool isInput, uint portId) const noexcept; + uint getPortId(bool isInput, const char portName[], bool* ok = nullptr) const noexcept; ExternalGraphPorts() noexcept; CARLA_PREVENT_HEAP_ALLOCATION CARLA_DECLARE_NON_COPY_CLASS(ExternalGraphPorts) @@ -81,19 +81,19 @@ struct ExternalGraph { PatchbayConnectionList connections; ExternalGraphPorts audioPorts, midiPorts; mutable CharStringListPtr retCon; - ExternalGraph(CarlaEngine* const engine) noexcept; + ExternalGraph(CarlaEngine* engine) noexcept; void clear() noexcept; - bool connect(const bool sendHost, const bool sendOSC, - const uint groupA, const uint portA, const uint groupB, const uint portB) noexcept; - bool disconnect(const bool sendHost, const bool sendOSC, - const uint connectionId) noexcept; - void refresh(const bool sendHost, const bool sendOSC, - const char* const deviceName); + bool connect(bool sendHost, bool sendOSC, + uint groupA, uint portA, uint groupB, uint portB) noexcept; + bool disconnect(bool sendHost, bool sendOSC, + uint connectionId) noexcept; + void refresh(bool sendHost, bool sendOSC, + const char* deviceName); const char* const* getConnections() const noexcept; - bool getGroupAndPortIdFromFullName(const char* const fullPortName, uint& groupId, uint& portId) const noexcept; + bool getGroupAndPortIdFromFullName(const char* fullPortName, uint& groupId, uint& portId) const noexcept; CarlaEngine* const kEngine; CARLA_PREVENT_HEAP_ALLOCATION @@ -121,29 +121,29 @@ struct RackGraph { float* unusedBuf; Buffers() noexcept; ~Buffers() noexcept; - void setBufferSize(const uint32_t bufferSize, const bool createBuffers) noexcept; + void setBufferSize(uint32_t bufferSize, bool createBuffers) noexcept; CARLA_PREVENT_HEAP_ALLOCATION CARLA_DECLARE_NON_COPY_CLASS(Buffers) } audioBuffers; - RackGraph(CarlaEngine* const engine, const uint32_t inputs, const uint32_t outputs) noexcept; + RackGraph(CarlaEngine* engine, uint32_t inputs, uint32_t outputs) noexcept; ~RackGraph() noexcept; - void setBufferSize(const uint32_t bufferSize) noexcept; - void setOffline(const bool offline) noexcept; + void setBufferSize(uint32_t bufferSize) noexcept; + void setOffline(bool offline) noexcept; - bool connect(const uint groupA, const uint portA, const uint groupB, const uint portB) noexcept; - bool disconnect(const uint connectionId) noexcept; - void refresh(const bool sendHost, const bool sendOsc, const bool ignored, const char* const deviceName); + bool connect(uint groupA, uint portA, uint groupB, uint portB) noexcept; + bool disconnect(uint connectionId) noexcept; + void refresh(bool sendHost, bool sendOsc, bool ignored, const char* deviceName); const char* const* getConnections() const noexcept; - bool getGroupAndPortIdFromFullName(const char* const fullPortName, uint& groupId, uint& portId) const noexcept; + bool getGroupAndPortIdFromFullName(const char* fullPortName, uint& groupId, uint& portId) const noexcept; // the base, where plugins run - void process(CarlaEngine::ProtectedData* const data, const float* inBuf[2], float* outBuf[2], const uint32_t frames); + void process(CarlaEngine::ProtectedData* data, const float* inBuf[2], float* outBuf[2], uint32_t frames); // extended, will call process() in the middle - void processHelper(CarlaEngine::ProtectedData* const data, const float* const* const inBuf, float* const* const outBuf, const uint32_t frames); + void processHelper(CarlaEngine::ProtectedData* data, const float* const* inBuf, float* const* outBuf, uint32_t frames); CarlaEngine* const kEngine; CARLA_DECLARE_NON_COPY_CLASS(RackGraph) @@ -170,33 +170,33 @@ public: ExternalGraph extGraph; - PatchbayGraph(CarlaEngine* const engine, - const uint32_t audioIns, const uint32_t audioOuts, - const uint32_t cvIns, const uint32_t cvOuts); + PatchbayGraph(CarlaEngine* engine, + uint32_t audioIns, uint32_t audioOuts, + uint32_t cvIns, uint32_t cvOuts); ~PatchbayGraph(); - void setBufferSize(const uint32_t bufferSize); - void setSampleRate(const double sampleRate); - void setOffline(const bool offline); + void setBufferSize(uint32_t bufferSize); + void setSampleRate(double sampleRate); + void setOffline(bool offline); - void addPlugin(CarlaPlugin* const plugin); - void replacePlugin(CarlaPlugin* const oldPlugin, CarlaPlugin* const newPlugin); - void renamePlugin(CarlaPlugin* const plugin, const char* const newName); - void removePlugin(CarlaPlugin* const plugin); + void addPlugin(CarlaPlugin* plugin); + void replacePlugin(CarlaPlugin* oldPlugin, CarlaPlugin* newPlugin); + void renamePlugin(CarlaPlugin* plugin, const char* newName); + void removePlugin(CarlaPlugin* plugin); void removeAllPlugins(); - bool connect(const bool external, const uint groupA, const uint portA, const uint groupB, const uint portB); - bool disconnect(const bool external, const uint connectionId); - void disconnectInternalGroup(const uint groupId) noexcept; - void refresh(const bool sendHost, const bool sendOsc, const bool external, const char* const deviceName); + bool connect(bool external, uint groupA, uint portA, uint groupB, uint portB); + bool disconnect(bool external, uint connectionId); + void disconnectInternalGroup(uint groupId) noexcept; + void refresh(bool sendHost, bool sendOsc, bool external, const char* deviceName); - const char* const* getConnections(const bool external) const; - bool getGroupAndPortIdFromFullName(const bool external, const char* const fullPortName, uint& groupId, uint& portId) const; + const char* const* getConnections(bool external) const; + bool getGroupAndPortIdFromFullName(bool external, const char* fullPortName, uint& groupId, uint& portId) const; - void process(CarlaEngine::ProtectedData* const data, - const float* const* const inBuf, - float* const* const outBuf, - const uint32_t frames); + void process(CarlaEngine::ProtectedData* data, + const float* const* inBuf, + float* const* outBuf, + uint32_t frames); private: void run() override; diff --git a/source/backend/engine/CarlaEngineInternal.hpp b/source/backend/engine/CarlaEngineInternal.hpp index d9ce9a101..f66c3c971 100644 --- a/source/backend/engine/CarlaEngineInternal.hpp +++ b/source/backend/engine/CarlaEngineInternal.hpp @@ -71,37 +71,37 @@ class PatchbayGraph; class EngineInternalGraph { public: - EngineInternalGraph(CarlaEngine* const engine) noexcept; + EngineInternalGraph(CarlaEngine* engine) noexcept; ~EngineInternalGraph() noexcept; - void create(const uint32_t audioIns, const uint32_t audioOuts, const uint32_t cvIns, const uint32_t cvOuts); + void create(uint32_t audioIns, uint32_t audioOuts, uint32_t cvIns, uint32_t cvOuts); void destroy() noexcept; - void setBufferSize(const uint32_t bufferSize); - void setSampleRate(const double sampleRate); - void setOffline(const bool offline); + void setBufferSize(uint32_t bufferSize); + void setSampleRate(double sampleRate); + void setOffline(bool offline); bool isReady() const noexcept; RackGraph* getRackGraph() const noexcept; PatchbayGraph* getPatchbayGraph() const noexcept; - void process(CarlaEngine::ProtectedData* const data, const float* const* const inBuf, float* const* const outBuf, const uint32_t frames); + void process(CarlaEngine::ProtectedData* data, const float* const* inBuf, float* const* outBuf, uint32_t frames); // special direct process with connections already handled, used in JACK and Plugin - void processRack(CarlaEngine::ProtectedData* const data, const float* inBuf[2], float* outBuf[2], const uint32_t frames); + void processRack(CarlaEngine::ProtectedData* data, const float* inBuf[2], float* outBuf[2], uint32_t frames); // used for internal patchbay mode - void addPlugin(CarlaPlugin* const plugin); - void replacePlugin(CarlaPlugin* const oldPlugin, CarlaPlugin* const newPlugin); - void renamePlugin(CarlaPlugin* const plugin, const char* const newName); - void removePlugin(CarlaPlugin* const plugin); + void addPlugin(CarlaPlugin* plugin); + void replacePlugin(CarlaPlugin* oldPlugin, CarlaPlugin* newPlugin); + void renamePlugin(CarlaPlugin* plugin, const char* newName); + void removePlugin(CarlaPlugin* plugin); void removeAllPlugins(); bool isUsingExternalHost() const noexcept; bool isUsingExternalOSC() const noexcept; - void setUsingExternalHost(const bool usingExternal) noexcept; - void setUsingExternalOSC(const bool usingExternal) noexcept; + void setUsingExternalHost(bool usingExternal) noexcept; + void setUsingExternalOSC(bool usingExternal) noexcept; private: bool fIsRack; @@ -126,14 +126,14 @@ class EngineInternalTime { public: EngineInternalTime(EngineTimeInfo& timeInfo, const EngineTransportMode& transportMode) noexcept; - void init(const uint32_t bufferSize, double sampleRate); - void updateAudioValues(const uint32_t bufferSize, const double sampleRate); + void init(uint32_t bufferSize, double sampleRate); + void updateAudioValues(uint32_t bufferSize, double sampleRate); - void enableLink(const bool enable); - void setBPM(const double bpm); + void enableLink(bool enable); + void setBPM(double bpm); void setNeedsReset() noexcept; void pause() noexcept; - void relocate(const uint64_t frame) noexcept; + void relocate(uint64_t frame) noexcept; private: double beatsPerBar; @@ -161,11 +161,11 @@ private: const EngineTransportMode& transportMode; friend class PendingRtEventsRunner; - void preProcess(const uint32_t numFrames); - void fillEngineTimeInfo(const uint32_t newFrames) noexcept; + void preProcess(uint32_t numFrames); + void fillEngineTimeInfo(uint32_t newFrames) noexcept; friend class CarlaEngineJack; - void fillJackTimeInfo(jack_position_t* const pos, const uint32_t newFrames) noexcept; + void fillJackTimeInfo(jack_position_t* pos, uint32_t newFrames) noexcept; CARLA_DECLARE_NON_COPY_STRUCT(EngineInternalTime) }; @@ -264,20 +264,20 @@ struct CarlaEngine::ProtectedData { // ------------------------------------------------------------------- - ProtectedData(CarlaEngine* const engine) noexcept; + ProtectedData(CarlaEngine* engine) noexcept; ~ProtectedData() noexcept; // ------------------------------------------------------------------- - bool init(const char* const clientName); + bool init(const char* clientName); void close(); - void initTime(const char* const features); + void initTime(const char* features); // ------------------------------------------------------------------- - void doPluginRemove(const uint pluginId) noexcept; - void doPluginsSwitch(const uint idA, const uint idB) noexcept; + void doPluginRemove(uint pluginId) noexcept; + void doPluginsSwitch(uint idA, uint idB) noexcept; void doNextPluginAction() noexcept; // ------------------------------------------------------------------- @@ -293,9 +293,9 @@ struct CarlaEngine::ProtectedData { class PendingRtEventsRunner { public: - PendingRtEventsRunner(CarlaEngine* const engine, - const uint32_t numFrames, - const bool calcDSPLoad = false) noexcept; + PendingRtEventsRunner(CarlaEngine* engine, + uint32_t numFrames, + bool calcDSPLoad = false) noexcept; ~PendingRtEventsRunner() noexcept; private: @@ -311,7 +311,7 @@ private: class ScopedActionLock { public: - ScopedActionLock(CarlaEngine* const engine, const EnginePostAction action, const uint pluginId, const uint value) noexcept; + ScopedActionLock(CarlaEngine* engine, EnginePostAction action, uint pluginId, uint value) noexcept; ~ScopedActionLock() noexcept; private: @@ -326,7 +326,7 @@ private: class ScopedThreadStopper { public: - ScopedThreadStopper(CarlaEngine* const engine) noexcept; + ScopedThreadStopper(CarlaEngine* engine) noexcept; ~ScopedThreadStopper() noexcept; private: diff --git a/source/backend/engine/CarlaEngineOsc.hpp b/source/backend/engine/CarlaEngineOsc.hpp index fca29db6c..20323678e 100644 --- a/source/backend/engine/CarlaEngineOsc.hpp +++ b/source/backend/engine/CarlaEngineOsc.hpp @@ -58,10 +58,10 @@ CARLA_BACKEND_START_NAMESPACE class CarlaEngineOsc { public: - CarlaEngineOsc(CarlaEngine* const engine) noexcept; + CarlaEngineOsc(CarlaEngine* engine) noexcept; ~CarlaEngineOsc() noexcept; - void init(const char* const name, int tcpPort, int udpPort) noexcept; + void init(const char* name, int tcpPort, int udpPort) noexcept; void idle() const noexcept; void close() noexcept; @@ -92,28 +92,28 @@ public: // ------------------------------------------------------------------- // TCP - void sendCallback(const EngineCallbackOpcode action, const uint pluginId, - const int value1, const int value2, const int value3, - const float valuef, const char* const valueStr) const noexcept; - void sendPluginInfo(const CarlaPlugin* const plugin) const noexcept; - void sendPluginPortCount(const CarlaPlugin* const plugin) const noexcept; - void sendPluginParameterInfo(const CarlaPlugin* const plugin, const uint32_t index) const noexcept; - void sendPluginDataCount(const CarlaPlugin* const plugin) const noexcept; - void sendPluginProgramCount(const CarlaPlugin* const plugin) const noexcept; - void sendPluginProgram(const CarlaPlugin* const plugin, const uint32_t index) const noexcept; - void sendPluginMidiProgram(const CarlaPlugin* const plugin, const uint32_t index) const noexcept; - void sendPluginCustomData(const CarlaPlugin* const plugin, const uint32_t index) const noexcept; - void sendPluginInternalParameterValues(const CarlaPlugin* const plugin) const noexcept; + void sendCallback(EngineCallbackOpcode action, uint pluginId, + int value1, int value2, int value3, + float valuef, const char* valueStr) const noexcept; + void sendPluginInfo(const CarlaPlugin* plugin) const noexcept; + void sendPluginPortCount(const CarlaPlugin* plugin) const noexcept; + void sendPluginParameterInfo(const CarlaPlugin* plugin, uint32_t index) const noexcept; + void sendPluginDataCount(const CarlaPlugin* plugin) const noexcept; + void sendPluginProgramCount(const CarlaPlugin* plugin) const noexcept; + void sendPluginProgram(const CarlaPlugin* plugin, uint32_t index) const noexcept; + void sendPluginMidiProgram(const CarlaPlugin* plugin, uint32_t index) const noexcept; + void sendPluginCustomData(const CarlaPlugin* plugin, uint32_t index) const noexcept; + void sendPluginInternalParameterValues(const CarlaPlugin* plugin) const noexcept; void sendPing() const noexcept; - void sendResponse(const int messageId, const char* const error) const noexcept; + void sendResponse(int messageId, const char* error) const noexcept; void sendExit() const noexcept; // ------------------------------------------------------------------- // UDP void sendRuntimeInfo() const noexcept; - void sendParameterValue(const uint pluginId, const uint32_t index, const float value) const noexcept; - void sendPeaks(const uint pluginId, const float peaks[4]) const noexcept; + void sendParameterValue(uint pluginId, uint32_t index, float value) const noexcept; + void sendPeaks(uint pluginId, const float peaks[4]) const noexcept; // ------------------------------------------------------------------- @@ -132,13 +132,13 @@ private: // ------------------------------------------------------------------- - int handleMessage(const bool isTCP, const char* const path, - const int argc, const lo_arg* const* const argv, const char* const types, const lo_message msg); + int handleMessage(bool isTCP, const char* path, + int argc, const lo_arg* const* argv, const char* types, lo_message msg); - int handleMsgRegister(const bool isTCP, const int argc, const lo_arg* const* const argv, const char* const types); - int handleMsgUnregister(const bool isTCP, const int argc, const lo_arg* const* const argv, const char* const types); - int handleMsgControl(const char* const method, - const int argc, const lo_arg* const* const argv, const char* const types); + int handleMsgRegister(bool isTCP, int argc, const lo_arg* const* argv, const char* types); + int handleMsgUnregister(bool isTCP, int argc, const lo_arg* const* argv, const char* types); + int handleMsgControl(const char* method, + int argc, const lo_arg* const* argv, const char* types); // Internal methods int handleMsgSetActive(CARLA_ENGINE_OSC_HANDLE_ARGS); diff --git a/source/backend/engine/CarlaEngineThread.hpp b/source/backend/engine/CarlaEngineThread.hpp index c78236aa9..5ce20cdf0 100644 --- a/source/backend/engine/CarlaEngineThread.hpp +++ b/source/backend/engine/CarlaEngineThread.hpp @@ -29,7 +29,7 @@ CARLA_BACKEND_START_NAMESPACE class CarlaEngineThread : public CarlaThread { public: - CarlaEngineThread(CarlaEngine* const engine) noexcept; + CarlaEngineThread(CarlaEngine* engine) noexcept; ~CarlaEngineThread() noexcept override; protected: diff --git a/source/backend/plugin/CarlaPluginInternal.cpp b/source/backend/plugin/CarlaPluginInternal.cpp index 2f28f90fc..ca15a8169 100644 --- a/source/backend/plugin/CarlaPluginInternal.cpp +++ b/source/backend/plugin/CarlaPluginInternal.cpp @@ -244,7 +244,7 @@ void PluginParameterData::clear() noexcept count = 0; } -float PluginParameterData::getFixedValue(const uint32_t parameterId, const float& value) const noexcept +float PluginParameterData::getFixedValue(const uint32_t parameterId, float value) const noexcept { CARLA_SAFE_ASSERT_RETURN(parameterId < count, 0.0f); diff --git a/source/backend/plugin/CarlaPluginInternal.hpp b/source/backend/plugin/CarlaPluginInternal.hpp index 20251f4af..9d6d13dcd 100644 --- a/source/backend/plugin/CarlaPluginInternal.hpp +++ b/source/backend/plugin/CarlaPluginInternal.hpp @@ -115,7 +115,7 @@ struct PluginAudioData { PluginAudioData() noexcept; ~PluginAudioData() noexcept; - void createNew(const uint32_t newCount); + void createNew(uint32_t newCount); void clear() noexcept; void initBuffers() const noexcept; @@ -136,7 +136,7 @@ struct PluginCVData { PluginCVData() noexcept; ~PluginCVData() noexcept; - void createNew(const uint32_t newCount); + void createNew(uint32_t newCount); void clear() noexcept; void initBuffers() const noexcept; @@ -167,9 +167,9 @@ struct PluginParameterData { PluginParameterData() noexcept; ~PluginParameterData() noexcept; - void createNew(const uint32_t newCount, const bool withSpecial); + void createNew(uint32_t newCount, bool withSpecial); void clear() noexcept; - float getFixedValue(const uint32_t parameterId, const float& value) const noexcept; + float getFixedValue(uint32_t parameterId, float value) const noexcept; CARLA_DECLARE_NON_COPY_STRUCT(PluginParameterData) }; @@ -185,7 +185,7 @@ struct PluginProgramData { PluginProgramData() noexcept; ~PluginProgramData() noexcept; - void createNew(const uint32_t newCount); + void createNew(uint32_t newCount); void clear() noexcept; CARLA_DECLARE_NON_COPY_STRUCT(PluginProgramData) @@ -200,7 +200,7 @@ struct PluginMidiProgramData { PluginMidiProgramData() noexcept; ~PluginMidiProgramData() noexcept; - void createNew(const uint32_t newCount); + void createNew(uint32_t newCount); void clear() noexcept; const MidiProgramData& getCurrent() const noexcept; @@ -282,7 +282,7 @@ struct CarlaPlugin::ProtectedData { #ifndef BUILD_BRIDGE ~Latency() noexcept; void clearBuffers() noexcept; - void recreateBuffers(const uint32_t newChannels, const uint32_t newFrames); + void recreateBuffers(uint32_t newChannels, uint32_t newFrames); #endif CARLA_DECLARE_NON_COPY_STRUCT(Latency) @@ -348,7 +348,7 @@ struct CarlaPlugin::ProtectedData { } postProc; #endif - ProtectedData(CarlaEngine* const engine, const uint idx) noexcept; + ProtectedData(CarlaEngine* engine, uint idx) noexcept; ~ProtectedData() noexcept; // ------------------------------------------------------------------- @@ -360,31 +360,29 @@ struct CarlaPlugin::ProtectedData { // Post-poned events void postponeRtEvent(const PluginPostRtEvent& rtEvent) noexcept; - void postponeRtEvent(const PluginPostRtEventType type, - const bool sendCallbackLater, - const int32_t value1, const int32_t value2, const int32_t value3, - const float valuef) noexcept; + void postponeRtEvent(PluginPostRtEventType type, bool sendCallbackLater, + int32_t value1, int32_t value2, int32_t value3, float valuef) noexcept; // ------------------------------------------------------------------- // Library functions - static const char* libError(const char* const filename) noexcept; + static const char* libError(const char* filename) noexcept; - bool libOpen(const char* const filename) noexcept; + bool libOpen(const char* filename) noexcept; bool libClose() noexcept; - void setCanDeleteLib(const bool canDelete) noexcept; + void setCanDeleteLib(bool canDelete) noexcept; - bool uiLibOpen(const char* const filename, const bool canDelete) noexcept; + bool uiLibOpen(const char* filename, bool canDelete) noexcept; bool uiLibClose() noexcept; template - Func libSymbol(const char* const symbol) const noexcept + Func libSymbol(const char* symbol) const noexcept { return lib_symbol(lib, symbol); } template - Func uiLibSymbol(const char* const symbol) const noexcept + Func uiLibSymbol(const char* symbol) const noexcept { return lib_symbol(uiLib, symbol); } @@ -395,9 +393,9 @@ struct CarlaPlugin::ProtectedData { #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH void tryTransient() noexcept; #endif - void updateParameterValues(CarlaPlugin* const plugin, - const bool sendCallback, const bool sendOsc, const bool useDefault) noexcept; - void updateDefaultParameterValues(CarlaPlugin* const plugin) noexcept; + void updateParameterValues(CarlaPlugin* plugin, + bool sendCallback, bool sendOsc, bool useDefault) noexcept; + void updateDefaultParameterValues(CarlaPlugin* plugin) noexcept; // -------------------------------------------------------------------