From c597da5b1a4fe16edcff9bbad9dd092e36e93c31 Mon Sep 17 00:00:00 2001 From: falkTX Date: Wed, 15 Jan 2020 12:25:08 +0000 Subject: [PATCH] Make some engine functions inline and protected Signed-off-by: falkTX --- source/backend/CarlaEngine.hpp | 64 +++++++++++----------- source/backend/engine/CarlaEngine.cpp | 12 +--- source/backend/engine/CarlaEngineGraph.cpp | 11 +++- 3 files changed, 44 insertions(+), 43 deletions(-) diff --git a/source/backend/CarlaEngine.hpp b/source/backend/CarlaEngine.hpp index 747cb6485..f62e02403 100644 --- a/source/backend/CarlaEngine.hpp +++ b/source/backend/CarlaEngine.hpp @@ -52,7 +52,7 @@ enum EngineType { kEngineTypeJack = 1, /*! - * Juce engine type, used to provide Native Audio and MIDI support. + * JUCE engine type, used to provide Native Audio and MIDI support. */ kEngineTypeJuce = 2, @@ -386,7 +386,7 @@ public: /*! * Check if this port is an input. */ - bool isInput() const noexcept + inline bool isInput() const noexcept { return kIsInput; } @@ -394,7 +394,7 @@ public: /*! * Get the index offset as passed in the constructor. */ - uint32_t getIndexOffset() const noexcept + inline uint32_t getIndexOffset() const noexcept { return kIndexOffset; } @@ -402,7 +402,7 @@ public: /*! * Get this ports' engine client. */ - const CarlaEngineClient& getEngineClient() const noexcept + inline const CarlaEngineClient& getEngineClient() const noexcept { return kClient; } @@ -442,7 +442,7 @@ public: /*! * Get the type of the port, in this case kEnginePortTypeAudio. */ - EnginePortType getType() const noexcept final + inline EnginePortType getType() const noexcept final { return kEnginePortTypeAudio; } @@ -456,7 +456,7 @@ public: * Direct access to the port's audio buffer. * May be null. */ - float* getBuffer() const noexcept + inline float* getBuffer() const noexcept { return fBuffer; } @@ -489,7 +489,7 @@ public: /*! * Get the type of the port, in this case kEnginePortTypeCV. */ - EnginePortType getType() const noexcept final + inline EnginePortType getType() const noexcept final { return kEnginePortTypeCV; } @@ -503,7 +503,7 @@ public: * Direct access to the port's CV buffer. * May be null. */ - float* getBuffer() const noexcept + inline float* getBuffer() const noexcept { return fBuffer; } @@ -511,7 +511,7 @@ public: /*! * Get min/max range for this CV port. */ - void getRange(float& min, float& max) const noexcept + inline void getRange(float& min, float& max) const noexcept { min = fMinimum; max = fMaximum; @@ -551,7 +551,7 @@ public: /*! * Get the type of the port, in this case kEnginePortTypeEvent. */ - EnginePortType getType() const noexcept final + inline EnginePortType getType() const noexcept final { return kEnginePortTypeEvent; } @@ -638,12 +638,12 @@ public: /*! * Add a CV port as a source of events. */ - bool addCVSource(CarlaEngineCVPort* port, uint32_t portIndexOffset); + virtual bool addCVSource(CarlaEngineCVPort* port, uint32_t portIndexOffset); /*! * Remove a CV port as a source of events. */ - bool removeCVSource(uint32_t portIndexOffset); + virtual bool removeCVSource(uint32_t portIndexOffset); /*! * Set value range for a CV port. @@ -1122,7 +1122,7 @@ public: * Call the main engine callback, if set. * May be called by plugins. */ - virtual void callback(bool sendHost, bool sendOsc, + virtual void callback(bool sendHost, bool sendOSC, EngineCallbackOpcode action, uint pluginId, int value1, int value2, int value3, float valuef, const char* valueStr) noexcept; @@ -1164,7 +1164,7 @@ public: /*! * Force the engine to resend all patchbay clients, ports and connections again. */ - virtual bool patchbayRefresh(bool sendHost, bool sendOsc, bool external); + virtual bool patchbayRefresh(bool sendHost, bool sendOSC, bool external); #endif // ------------------------------------------------------------------- @@ -1265,23 +1265,6 @@ public: #endif // ------------------------------------------------------------------- - // Helper functions - - /*! - * Return internal data, needed for EventPorts when used in Rack, Patchbay and Bridge modes. - * @note RT call - */ - EngineEvent* getInternalEventBuffer(bool isInput) const noexcept; - -#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH - /*! - * Virtual functions for handling external graph ports. - */ - virtual bool connectExternalGraphPort(uint, uint, const char*); - virtual bool disconnectExternalGraphPort(uint, uint, const char*); -#endif - - // ------------------------------------------------------------------- protected: /*! @@ -1293,14 +1276,16 @@ protected: /*! * Some internal classes read directly from pData or call protected functions. */ - friend class CarlaEngineThread; + friend class CarlaEngineEventPort; friend class CarlaEngineOsc; + friend class CarlaEngineThread; friend class CarlaPluginInstance; friend class EngineInternalGraph; friend class PendingRtEventsRunner; friend class ScopedActionLock; friend class ScopedEngineEnvironmentLocker; friend class ScopedThreadStopper; + friend class ExternalGraph; friend class PatchbayGraph; friend struct RackGraph; @@ -1339,6 +1324,15 @@ protected: */ bool loadProjectInternal(water::XmlDocument& xmlDoc); + // ------------------------------------------------------------------- + // Helper functions + + /*! + * Return internal data, needed for EventPorts when used in Rack, Patchbay and Bridge modes. + * @note RT call + */ + EngineEvent* getInternalEventBuffer(bool isInput) const noexcept; + #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH // ------------------------------------------------------------------- // Patchbay stuff @@ -1351,6 +1345,12 @@ protected: virtual void restorePatchbayConnection(bool external, const char* sourcePort, const char* targetPort); + + /*! + * Virtual functions for handling external graph ports. + */ + virtual bool connectExternalGraphPort(uint, uint, const char*); + virtual bool disconnectExternalGraphPort(uint, uint, const char*); #endif // ------------------------------------------------------------------- diff --git a/source/backend/engine/CarlaEngine.cpp b/source/backend/engine/CarlaEngine.cpp index 15c6677bd..f67a666c0 100644 --- a/source/backend/engine/CarlaEngine.cpp +++ b/source/backend/engine/CarlaEngine.cpp @@ -1364,7 +1364,7 @@ float CarlaEngine::getOutputPeak(const uint pluginId, const bool isLeft) const n // ----------------------------------------------------------------------- // Callback -void CarlaEngine::callback(const bool sendHost, const bool sendOsc, +void CarlaEngine::callback(const bool sendHost, const bool sendOSC, const EngineCallbackOpcode action, const uint pluginId, const int value1, const int value2, const int value3, const float valuef, const char* const valueStr) noexcept @@ -1400,7 +1400,7 @@ void CarlaEngine::callback(const bool sendHost, const bool sendOsc, --pData->isIdling; } - if (sendOsc) + if (sendOSC) { #if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) if (pData->osc.isControlRegisteredForTCP()) @@ -1990,14 +1990,6 @@ const char* CarlaEngine::getOscServerPathUDP() const noexcept } #endif -// ----------------------------------------------------------------------- -// Helper functions - -EngineEvent* CarlaEngine::getInternalEventBuffer(const bool isInput) const noexcept -{ - return isInput ? pData->events.in : pData->events.out; -} - // ----------------------------------------------------------------------- // Internal stuff diff --git a/source/backend/engine/CarlaEngineGraph.cpp b/source/backend/engine/CarlaEngineGraph.cpp index 3cce9a3a2..1d71ffc42 100644 --- a/source/backend/engine/CarlaEngineGraph.cpp +++ b/source/backend/engine/CarlaEngineGraph.cpp @@ -1,6 +1,6 @@ /* * Carla Plugin Host - * Copyright (C) 2011-2019 Filipe Coelho + * Copyright (C) 2011-2020 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -2656,6 +2656,15 @@ bool CarlaEngine::patchbayRefresh(const bool sendHost, const bool sendOSC, const } // ----------------------------------------------------------------------- +// Helper functions + +EngineEvent* CarlaEngine::getInternalEventBuffer(const bool isInput) const noexcept +{ + return isInput ? pData->events.in : pData->events.out; +} + +// ----------------------------------------------------------------------- +// Patchbay stuff const char* const* CarlaEngine::getPatchbayConnections(const bool external) const {