Browse Source

More cleanup

tags/1.9.4
falkTX 12 years ago
parent
commit
ebecc94154
10 changed files with 483 additions and 456 deletions
  1. +9
    -9
      source/backend/CarlaBackend.hpp
  2. +3
    -3
      source/backend/CarlaNative.hpp
  3. +128
    -96
      source/backend/CarlaPlugin.hpp
  4. +302
    -310
      source/backend/plugin/CarlaPlugin.cpp
  5. +3
    -3
      source/includes/ladspa_rdf.hpp
  6. +9
    -9
      source/includes/lv2_rdf.hpp
  7. +3
    -3
      source/utils/CarlaJuceUtils.hpp
  8. +5
    -2
      source/utils/CarlaMutex.hpp
  9. +17
    -17
      source/utils/CarlaString.hpp
  10. +4
    -4
      source/utils/CarlaUtils.hpp

+ 9
- 9
source/backend/CarlaBackend.hpp View File

@@ -688,7 +688,7 @@ struct ParameterData {
int16_t midiCC;

#ifndef DOXYGEN
ParameterData()
ParameterData() noexcept
: type(PARAMETER_UNKNOWN),
index(PARAMETER_NULL),
rindex(-1),
@@ -710,7 +710,7 @@ struct ParameterRanges {
float stepLarge;

#ifndef DOXYGEN
ParameterRanges()
ParameterRanges() noexcept
: def(0.0f),
min(0.0f),
max(1.0f),
@@ -719,12 +719,12 @@ struct ParameterRanges {
stepLarge(0.1f) {}
#endif

void fixDefault()
void fixDefault() noexcept
{
fixValue(def);
}

void fixValue(float& value) const
void fixValue(float& value) const noexcept
{
if (value < min)
value = min;
@@ -732,7 +732,7 @@ struct ParameterRanges {
value = max;
}

float getFixedValue(const float& value) const
float getFixedValue(const float& value) const noexcept
{
if (value < min)
return min;
@@ -741,7 +741,7 @@ struct ParameterRanges {
return value;
}

float getNormalizedValue(const float& value) const
float getNormalizedValue(const float& value) const noexcept
{
float newValue = (value - min) / (max - min);

@@ -753,7 +753,7 @@ struct ParameterRanges {
return newValue;
}

float getUnnormalizedValue(const float& value) const
float getUnnormalizedValue(const float& value) const noexcept
{
return value * (max - min) + min;
}
@@ -768,7 +768,7 @@ struct MidiProgramData {
const char* name;

#ifndef DOXYGEN
MidiProgramData()
MidiProgramData() noexcept
: bank(0),
program(0),
name(nullptr) {}
@@ -786,7 +786,7 @@ struct CustomData {
const char* value;

#ifndef DOXYGEN
CustomData()
CustomData() noexcept
: type(nullptr),
key(nullptr),
value(nullptr) {}


+ 3
- 3
source/backend/CarlaNative.hpp View File

@@ -47,12 +47,12 @@ protected:
// -------------------------------------------------------------------
// Host calls

const HostDescriptor* getHostHandle() const
const HostDescriptor* getHostHandle() const noexcept
{
return pHost;
}

const char* getResourceDir() const
const char* getResourceDir() const noexcept
{
CARLA_ASSERT(pHost != nullptr);

@@ -62,7 +62,7 @@ protected:
return nullptr;
}

const char* getUiName() const
const char* getUiName() const noexcept
{
CARLA_ASSERT(pHost != nullptr);



+ 128
- 96
source/backend/CarlaPlugin.hpp View File

@@ -41,7 +41,11 @@ CARLA_BACKEND_START_NAMESPACE
*/

/*!
* TODO.
* Post-Rt event type.\n
* These are events postponned from within the process function,
*
* During process, we cannot lock, allocate memory or do UI stuff,\n
* so events have to be postponned to be executed later, on a separate thread.
*/
enum PluginPostRtEventType {
kPluginPostRtEventNull,
@@ -67,12 +71,11 @@ struct CarlaPluginProtectedData;
// -----------------------------------------------------------------------

/*!
* \class CarlaPlugin
*
* \brief Carla Backend base plugin class
* Carla Backend base plugin class
*
* This is the base class for all available plugin types available in Carla Backend.\n
* All virtual calls are implemented in this class as fallback, so it's safe to only override needed calls.
* All virtual calls are implemented in this class as fallback (except reload and process),\n
* so it's safe to only override needed calls.
*
* \see PluginType
*/
@@ -97,23 +100,23 @@ public:
// Information (base)

/*!
* Get the plugin's type (ie, a subclass of CarlaPlugin).
* Get the plugin's type (a subclass of CarlaPlugin).
*
* \note Plugin bridges will return their respective plugin type, there is no plugin type such as "bridge".\n
* To check if a plugin is a bridge use:
* \code
* if (hints() & PLUGIN_IS_BRIDGE)
* if (getHints() & PLUGIN_IS_BRIDGE)
* ...
* \endcode
*/
virtual PluginType type() const = 0;
virtual PluginType getType() const noexcept = 0;

/*!
* Get the plugin's id (as passed in the constructor).
*
* \see setId()
*/
unsigned int id() const
unsigned int getId() const noexcept
{
return fId;
}
@@ -123,29 +126,28 @@ public:
*
* \see PluginHints
*/
unsigned int hints() const
unsigned int getHints() const noexcept
{
return fHints;
}

/*!
* Get the plugin's options.
* Get the plugin's options (currently in use).
*
* \see PluginOptions, availableOptions() and setOption()
* \see PluginOptions, getAvailableOptions() and setOption()
*/
unsigned int options() const
unsigned int getOptions() const noexcept
{
return fOptions;
}

/*!
* Check if the plugin is enabled.\n
* When a plugin is disabled, it will never be processed or managed in any way.\n
* To 'bypass' a plugin use setActive() instead.
* When a plugin is disabled, it will never be processed or managed in any way.
*
* \see setEnabled()
*/
bool enabled() const
bool isEnabled() const noexcept
{
return fEnabled;
}
@@ -154,9 +156,9 @@ public:
* Get the plugin's internal name.\n
* This name is unique within all plugins in an engine.
*
* \see getRealName()
* \see getRealName() and setName()
*/
const char* name() const
const char* getName() const noexcept
{
return (const char*)fName;
}
@@ -165,7 +167,7 @@ public:
* Get the currently loaded DLL filename for this plugin.\n
* (Sound kits return their exact filename).
*/
const char* filename() const
const char* getFilename() const noexcept
{
return (const char*)fFilename;
}
@@ -173,7 +175,7 @@ public:
/*!
* Get the plugins's icon name.
*/
const char* iconName() const
const char* getIconName() const noexcept
{
return (const char*)fIconName;
}
@@ -181,7 +183,7 @@ public:
/*!
* Get the plugin's category (delay, filter, synth, etc).
*/
virtual PluginCategory category()
virtual PluginCategory getCategory() const
{
return PLUGIN_CATEGORY_NONE;
}
@@ -190,7 +192,7 @@ public:
* Get the plugin's native unique Id.\n
* May return 0 on plugin types that don't support Ids.
*/
virtual long uniqueId() const
virtual long getUniqueId() const
{
return 0;
}
@@ -198,7 +200,7 @@ public:
/*!
* Get the plugin's latency, in sample frames.
*/
uint32_t latency() const;
uint32_t getLatencyInFrames() const noexcept;

// -------------------------------------------------------------------
// Information (count)
@@ -206,48 +208,48 @@ public:
/*!
* Get the number of audio inputs.
*/
uint32_t audioInCount() const;
uint32_t getAudioInCount() const noexcept;

/*!
* Get the number of audio outputs.
*/
uint32_t audioOutCount() const;
uint32_t getAudioOutCount() const noexcept;

/*!
* Get the number of MIDI inputs.
*/
virtual uint32_t midiInCount() const;
virtual uint32_t getMidiInCount() const noexcept;

/*!
* Get the number of MIDI outputs.
*/
virtual uint32_t midiOutCount() const;
virtual uint32_t getMidiOutCount() const noexcept;

/*!
* Get the number of parameters.\n
* To know the number of parameter inputs and outputs separately use getParameterCountInfo() instead.
*/
uint32_t parameterCount() const;
uint32_t getParameterCount() const noexcept;

/*!
* Get the number of scalepoints for parameter \a parameterId.
*/
virtual uint32_t parameterScalePointCount(const uint32_t parameterId) const;
virtual uint32_t getParameterScalePointCount(const uint32_t parameterId) const;

/*!
* Get the number of programs.
*/
uint32_t programCount() const;
uint32_t getProgramCount() const noexcept;

/*!
* Get the number of MIDI programs.
*/
uint32_t midiProgramCount() const;
uint32_t getMidiProgramCount() const noexcept;

/*!
* Get the number of custom data sets.
*/
uint32_t customDataCount() const;
uint32_t getCustomDataCount() const noexcept;

// -------------------------------------------------------------------
// Information (current data)
@@ -257,7 +259,7 @@ public:
*
* \see setProgram()
*/
int32_t currentProgram() const;
int32_t getCurrentProgram() const noexcept;

/*!
* Get the current MIDI program number (-1 if unset).
@@ -265,36 +267,36 @@ public:
* \see setMidiProgram()
* \see setMidiProgramById()
*/
int32_t currentMidiProgram() const;
int32_t getCurrentMidiProgram() const noexcept;

/*!
* Get the parameter data of \a parameterId.
*/
const ParameterData& parameterData(const uint32_t parameterId) const;
const ParameterData& getParameterData(const uint32_t parameterId) const;

/*!
* Get the parameter ranges of \a parameterId.
*/
const ParameterRanges& parameterRanges(const uint32_t parameterId) const;
const ParameterRanges& getParameterRanges(const uint32_t parameterId) const;

/*!
* Check if parameter \a parameterId is of output type.
*/
bool parameterIsOutput(const uint32_t parameterId) const;
bool isParameterOutput(const uint32_t parameterId) const;

/*!
* Get the MIDI program at \a index.
*
* \see getMidiProgramName()
*/
const MidiProgramData& midiProgramData(const uint32_t index) const;
const MidiProgramData& getMidiProgramData(const uint32_t index) const;

/*!
* Get the custom data set at \a index.
*
* \see setCustomData()
* \see getCustomDataCount() and setCustomData()
*/
const CustomData& customData(const uint32_t index) const;
const CustomData& getCustomData(const uint32_t index) const;

/*!
* Get the complete plugin chunk data into \a dataPtr.
@@ -304,7 +306,7 @@ public:
*
* \see setChunkData()
*/
virtual int32_t chunkData(void** const dataPtr);
virtual int32_t getChunkData(void** const dataPtr) const;

// -------------------------------------------------------------------
// Information (per-plugin data)
@@ -312,78 +314,78 @@ public:
/*!
* Get the plugin available options.
*
* \see PluginOptions
* \see PluginOptions, getOptions() and setOption()
*/
virtual unsigned int availableOptions();
virtual unsigned int getAvailableOptions() const;

/*!
* Get the current parameter value of \a parameterId.
*/
virtual float getParameterValue(const uint32_t parameterId);
virtual float getParameterValue(const uint32_t parameterId) const;

/*!
* Get the scalepoint \a scalePointId value of the parameter \a parameterId.
*/
virtual float getParameterScalePointValue(const uint32_t parameterId, const uint32_t scalePointId);
virtual float getParameterScalePointValue(const uint32_t parameterId, const uint32_t scalePointId) const;

/*!
* Get the plugin's label (URI for PLUGIN_LV2).
* Get the plugin's label (URI for LV2 plugins).
*/
virtual void getLabel(char* const strBuf);
virtual void getLabel(char* const strBuf) const noexcept;

/*!
* Get the plugin's maker.
*/
virtual void getMaker(char* const strBuf);
virtual void getMaker(char* const strBuf) const noexcept;

/*!
* Get the plugin's copyright/license.
*/
virtual void getCopyright(char* const strBuf);
virtual void getCopyright(char* const strBuf) const noexcept;

/*!
* Get the plugin's (real) name.
*
* \see name()
* \see getName() and setName()
*/
virtual void getRealName(char* const strBuf);
virtual void getRealName(char* const strBuf) const noexcept;

/*!
* Get the name of the parameter \a parameterId.
*/
virtual void getParameterName(const uint32_t parameterId, char* const strBuf);
virtual void getParameterName(const uint32_t parameterId, char* const strBuf) const;

/*!
* Get the symbol of the parameter \a parameterId.
*/
virtual void getParameterSymbol(const uint32_t parameterId, char* const strBuf);
virtual void getParameterSymbol(const uint32_t parameterId, char* const strBuf) const;

/*!
* Get the custom text of the parameter \a parameterId.
*/
virtual void getParameterText(const uint32_t parameterId, char* const strBuf);
virtual void getParameterText(const uint32_t parameterId, char* const strBuf) const;

/*!
* Get the unit of the parameter \a parameterId.
*/
virtual void getParameterUnit(const uint32_t parameterId, char* const strBuf);
virtual void getParameterUnit(const uint32_t parameterId, char* const strBuf) const;

/*!
* Get the scalepoint \a scalePointId label of the parameter \a parameterId.
*/
virtual void getParameterScalePointLabel(const uint32_t parameterId, const uint32_t scalePointId, char* const strBuf);
virtual void getParameterScalePointLabel(const uint32_t parameterId, const uint32_t scalePointId, char* const strBuf) const;

/*!
* Get the name of the program at \a index.
*/
void getProgramName(const uint32_t index, char* const strBuf);
void getProgramName(const uint32_t index, char* const strBuf) const;

/*!
* Get the name of the MIDI program at \a index.
*
* \see getMidiProgramInfo()
*/
void getMidiProgramName(const uint32_t index, char* const strBuf);
void getMidiProgramName(const uint32_t index, char* const strBuf) const;

/*!
* Get information about the plugin's parameter count.\n
@@ -391,9 +393,9 @@ public:
*
* \note Some parameters might not be input or output (ie, invalid).
*
* \see parameterCount()
* \see getParameterCount()
*/
void getParameterCountInfo(uint32_t* const ins, uint32_t* const outs, uint32_t* const total);
void getParameterCountInfo(uint32_t* const ins, uint32_t* const outs, uint32_t* const total) const;

// -------------------------------------------------------------------
// Set data (state)
@@ -420,11 +422,15 @@ public:

/*!
* Save the current plugin state to \a filename.
*
* \see loadStateFromFile()
*/
bool saveStateToFile(const char* const filename);

/*!
* Save the plugin state from \a filename.
*
* \see saveStateToFile()
*/
bool loadStateFromFile(const char* const filename);

@@ -434,31 +440,29 @@ public:
/*!
* Set the plugin's id to \a newId.
*
* \see id()
* \see getId()
*/
void setId(const unsigned int newId);
void setId(const unsigned int newId) noexcept;

/*!
* Set the plugin's name to \a newName.
*
* \see name()
* \see getName() and getRealName()
*/
virtual void setName(const char* const newName);

/*!
* Set a plugin's option.
*
* \see options()
* \see getOptions() and getAvailableOptions()
*/
void setOption(const unsigned int option, const bool yesNo);

/*!
* Enable or disable the plugin according to \a yesNo.
*
* When a plugin is disabled, it will never be processed or managed in any way.\n
* To 'bypass' a plugin use setActive() instead.
* Enable or disable the plugin according to \a yesNo. \n
* When a plugin is disabled, it will never be processed or managed in any way.
*
* \see enabled()
* \see isEnabled()
*/
void setEnabled(const bool yesNo);

@@ -583,7 +587,7 @@ public:
* \param value The value of the data set, of type \a type.
* \param sendGui Send message change to plugin's custom GUI, if any
*
* \see customData()
* \see getCustomDataCount() and getCustomData()
*/
virtual void setCustomData(const char* const type, const char* const key, const char* const value, const bool sendGui);

@@ -591,7 +595,7 @@ public:
* Set the complete chunk data as \a stringData.\n
* \a stringData must a base64 encoded string of binary data.
*
* \see chunkData()
* \see getChunkData()
*
* \note Make sure to verify the plugin supports chunks before calling this function!
*/
@@ -655,7 +659,7 @@ public:
* Reload the plugin's entire state (including programs).\n
* The plugin will be disabled during this call.
*/
virtual void reload();
virtual void reload() = 0;

/*!
* Reload the plugin's programs state.
@@ -678,7 +682,7 @@ public:
/*!
* Plugin process call.
*/
virtual void process(float** const inBuffer, float** const outBuffer, const uint32_t frames);
virtual void process(float** const inBuffer, float** const outBuffer, const uint32_t frames) = 0;

/*!
* Tell the plugin the current buffer size changed.
@@ -696,12 +700,13 @@ public:
virtual void offlineModeChanged(const bool isOffline);

/*!
* TODO.
* Try to lock the plugin's master mutex.
*/
bool tryLock();

/*!
* TODO.
* Unlock the plugin's master mutex.
* \note The mutex wasTryLockCalled() flag will be unset
*/
void unlock();

@@ -735,7 +740,7 @@ public:
/*!
* Free the plugin's internal OSC memory data.
*/
void freeOscData();
//void freeOscData();

/*!
* Show the plugin's OSC based GUI.\n
@@ -809,6 +814,15 @@ public:
// -------------------------------------------------------------------
// Plugin initializers

/*!
* Handy function used and required by CarlaEngine::clonePlugin().
*/
virtual const void* getExtraStuff() const noexcept
{
return nullptr;
}

#ifndef DOXYGEN
struct Initializer {
CarlaEngine* const engine;
const unsigned int id;
@@ -817,12 +831,6 @@ public:
const char* const label;
};

// used in CarlaEngine::clonePlugin()
virtual const void* getExtraStuff() const
{
return nullptr;
}

static size_t getNativePluginCount();
static const PluginDescriptor* getNativePluginDescriptor(const size_t index);

@@ -836,29 +844,51 @@ public:
static CarlaPlugin* newGIG(const Initializer& init, const bool use16Outs);
static CarlaPlugin* newSF2(const Initializer& init, const bool use16Outs);
static CarlaPlugin* newSFZ(const Initializer& init, const bool use16Outs);
#endif

// -------------------------------------------------------------------

protected:
unsigned int fId; //!< Plugin Id, as passed in the constructor, returned in id(). \see setId()
unsigned int fHints; //!< Hints, as returned in hints().
unsigned int fOptions; //!< Defined and currently in-use options, returned in options(). \see availableOptions()
/*!
* Plugin Id, as passed in the constructor, returned in getId().
* \see getId and setId()
*/
unsigned int fId;

bool fEnabled; //!< Wherever the plugin is ready for usage
/*!
* Hints, as returned in getHints().
* \see PluginHints and getHints()
*/
unsigned int fHints;

/*!
* Defined and currently in-use options, returned in getOptions().
* \see PluginOptions, getOptions(), getAvailableOptions() and setOption()
*/
unsigned int fOptions;

/*!
* Wherever the plugin is ready for usage.\n
* When a plugin is disabled, it will never be processed or managed in any way.
* \see isEnabled() and setEnabled()
*/
bool fEnabled;

CarlaString fName; //!< Plugin name
CarlaString fFilename; //!< Plugin filename, if applicable
CarlaString fIconName; //!< Icon name

//friend class CarlaEngineBridge;
friend struct CarlaPluginProtectedData;
CarlaPluginProtectedData* const pData; //!< Internal data, for CarlaPlugin subclasses only.
friend struct CarlaPluginProtectedData;
//friend class CarlaEngineBridge;

// -------------------------------------------------------------------
// Helper classes

// Fully disable plugin in scope and also its engine client
// May wait-block on constructor for plugin process to end
/*!
* Fully disable plugin in scope and also its engine client.\n
* May wait-block on constructor for plugin process to end.
*/
class ScopedDisabler
{
public:
@@ -866,15 +896,17 @@ protected:
~ScopedDisabler();

private:
CarlaPlugin* const kPlugin;
CarlaPlugin* const fPlugin;

CARLA_PREVENT_HEAP_ALLOCATION
CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ScopedDisabler)
};

// Lock the plugin's own run/process call
// Plugin will still work as normal, but output only silence
// On destructor needsReset flag might be set if the plugin might have missed some events
/*!
* Lock the plugin's own run/process call.\n
* Plugin will still work as normal, but output only silence.\n
* On destructor needsReset flag might be set if the plugin might have missed some events.
*/
class ScopedSingleProcessLocker
{
public:
@@ -882,8 +914,8 @@ protected:
~ScopedSingleProcessLocker();

private:
CarlaPlugin* const kPlugin;
const bool kBlock;
CarlaPlugin* const fPlugin;
const bool fBlock;

CARLA_PREVENT_HEAP_ALLOCATION
CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ScopedSingleProcessLocker)


+ 302
- 310
source/backend/plugin/CarlaPlugin.cpp
File diff suppressed because it is too large
View File


+ 3
- 3
source/includes/ladspa_rdf.hpp View File

@@ -120,7 +120,7 @@ struct LADSPA_RDF_ScalePoint {
LADSPA_Data Value;
const char* Label;

LADSPA_RDF_ScalePoint()
LADSPA_RDF_ScalePoint() noexcept
: Value(0.0f),
Label(nullptr) {}

@@ -145,7 +145,7 @@ struct LADSPA_RDF_Port {
unsigned long ScalePointCount;
LADSPA_RDF_ScalePoint* ScalePoints;

LADSPA_RDF_Port()
LADSPA_RDF_Port() noexcept
: Type(0x0),
Hints(0x0),
Label(nullptr),
@@ -179,7 +179,7 @@ struct LADSPA_RDF_Descriptor {
unsigned long PortCount;
LADSPA_RDF_Port* Ports;

LADSPA_RDF_Descriptor()
LADSPA_RDF_Descriptor() noexcept
: Type(0x0),
UniqueID(0),
Title(nullptr),


+ 9
- 9
source/includes/lv2_rdf.hpp View File

@@ -295,7 +295,7 @@ struct LV2_RDF_PortMidiMap {
LV2_Property Type;
uint32_t Number;

LV2_RDF_PortMidiMap()
LV2_RDF_PortMidiMap() noexcept
: Type(0),
Number(0) {}
};
@@ -307,7 +307,7 @@ struct LV2_RDF_PortPoints {
float Minimum;
float Maximum;

LV2_RDF_PortPoints()
LV2_RDF_PortPoints() noexcept
: Hints(0x0),
Default(0.0f),
Minimum(0.0f),
@@ -322,7 +322,7 @@ struct LV2_RDF_PortUnit {
const char* Symbol;
LV2_Property Unit;

LV2_RDF_PortUnit()
LV2_RDF_PortUnit() noexcept
: Hints(0x0),
Name(nullptr),
Render(nullptr),
@@ -354,7 +354,7 @@ struct LV2_RDF_PortScalePoint {
const char* Label;
float Value;

LV2_RDF_PortScalePoint()
LV2_RDF_PortScalePoint() noexcept
: Label(nullptr),
Value(0.0f) {}

@@ -383,7 +383,7 @@ struct LV2_RDF_Port {
uint32_t ScalePointCount;
LV2_RDF_PortScalePoint* ScalePoints;

LV2_RDF_Port()
LV2_RDF_Port() noexcept
: Types(0x0),
Properties(0x0),
Designation(0),
@@ -417,7 +417,7 @@ struct LV2_RDF_Preset {
LV2_URI URI;
const char* Label;

LV2_RDF_Preset()
LV2_RDF_Preset() noexcept
: URI(nullptr),
Label(nullptr) {}

@@ -441,7 +441,7 @@ struct LV2_RDF_Feature {
LV2_Property Type;
LV2_URI URI;

LV2_RDF_Feature()
LV2_RDF_Feature() noexcept
: Type(0),
URI(nullptr) {}

@@ -468,7 +468,7 @@ struct LV2_RDF_UI {
uint32_t ExtensionCount;
LV2_URI* Extensions;

LV2_RDF_UI()
LV2_RDF_UI() noexcept
: Type(0),
URI(nullptr),
Binary(nullptr),
@@ -534,7 +534,7 @@ struct LV2_RDF_Descriptor {
uint32_t UICount;
LV2_RDF_UI* UIs;

LV2_RDF_Descriptor()
LV2_RDF_Descriptor() noexcept
#ifdef CARLA_PROPER_CPP11_SUPPORT
: Type{0x0},
URI(nullptr),


+ 3
- 3
source/utils/CarlaJuceUtils.hpp View File

@@ -134,7 +134,7 @@ private:
volatile int numObjects;
};

static const char* getLeakedObjectClassName()
static const char* getLeakedObjectClassName() noexcept
{
return OwnerClass::getLeakedObjectClassName();
}
@@ -294,7 +294,7 @@ public:
/** Swaps this object with that of another ScopedPointer.
The two objects simply exchange their pointers.
*/
void swapWith(ScopedPointer<ObjectType>& other) noexcept
void swapWith(ScopedPointer<ObjectType>& other)
{
// Two ScopedPointers should never be able to refer to the same object - if
// this happens, you must have done something dodgy!
@@ -308,7 +308,7 @@ private:
ObjectType* object;

// (Required as an alternative to the overloaded & operator).
const ScopedPointer* getAddress() const { return this; }
const ScopedPointer* getAddress() const noexcept { return this; }

#if ! defined(CARLA_CC_MSVC) // (MSVC can't deal with multiple copy constructors)
/* The copy constructors are private to stop people accidentally copying a const ScopedPointer


+ 5
- 2
source/utils/CarlaMutex.hpp View File

@@ -69,8 +69,11 @@ public:
#endif
}

void unlock()
void unlock(const bool resetTryLock)
{
if (resetTryLock)
fTryLockWasCalled = false;

#ifdef CPP11_MUTEX
cmutex.unlock();
#else
@@ -80,7 +83,7 @@ public:

bool wasTryLockCalled()
{
const bool ret = fTryLockWasCalled;
const bool ret(fTryLockWasCalled);
fTryLockWasCalled = false;
return ret;
}


+ 17
- 17
source/utils/CarlaString.hpp View File

@@ -124,17 +124,17 @@ public:
// -------------------------------------------------------------------
// public methods

size_t length() const
size_t length() const noexcept
{
return fBufferLen;
}

bool isEmpty() const
bool isEmpty() const noexcept
{
return (fBufferLen == 0);
}

bool isNotEmpty() const
bool isNotEmpty() const noexcept
{
return (fBufferLen != 0);
}
@@ -170,7 +170,7 @@ public:
}
#endif

bool isDigit(const size_t pos) const
bool isDigit(const size_t pos) const noexcept
{
if (pos >= fBufferLen)
return false;
@@ -204,12 +204,12 @@ public:
return (std::strncmp(fBuffer + (fBufferLen-suffixLen), suffix, suffixLen) == 0);
}

void clear()
void clear() noexcept
{
truncate(0);
}

size_t find(const char c) const
size_t find(const char c) const noexcept
{
for (size_t i=0; i < fBufferLen; ++i)
{
@@ -220,7 +220,7 @@ public:
return 0;
}

size_t rfind(const char c) const
size_t rfind(const char c) const noexcept
{
for (size_t i=fBufferLen; i > 0; --i)
{
@@ -251,7 +251,7 @@ public:
return (ret > fBufferLen) ? fBufferLen : fBufferLen-ret;
}

void replace(const char before, const char after)
void replace(const char before, const char after) noexcept
{
if (after == '\0')
return;
@@ -265,7 +265,7 @@ public:
}
}

void truncate(const size_t n)
void truncate(const size_t n) noexcept
{
if (n >= fBufferLen)
return;
@@ -276,7 +276,7 @@ public:
fBufferLen = n;
}

void toBasic()
void toBasic() noexcept
{
for (size_t i=0; i < fBufferLen; ++i)
{
@@ -296,9 +296,9 @@ public:
#ifndef BUILD_ANSI_TEST
// Using '+=' and '-=' temporarily converts char into int

void toLower()
void toLower() noexcept
{
static const char kCharDiff = 'a' - 'A';
static const char kCharDiff('a' - 'A');

for (size_t i=0; i < fBufferLen; ++i)
{
@@ -307,9 +307,9 @@ public:
}
}

void toUpper()
void toUpper() noexcept
{
static const char kCharDiff = 'a' - 'A';
static const char kCharDiff('a' - 'A');

for (size_t i=0; i < fBufferLen; ++i)
{
@@ -322,12 +322,12 @@ public:
// -------------------------------------------------------------------
// public operators

operator const char*() const
operator const char*() const noexcept
{
return fBuffer;
}

char& operator[](const size_t pos)
char& operator[](const size_t pos) const noexcept
{
return fBuffer[pos];
}
@@ -405,7 +405,7 @@ private:
size_t fBufferLen;
bool fFirstInit;

void _init()
void _init() noexcept
{
fBuffer = nullptr;
fBufferLen = 0;


+ 4
- 4
source/utils/CarlaUtils.hpp View File

@@ -47,13 +47,13 @@
// misc functions

static inline
const char* bool2str(const bool yesNo)
const char* bool2str(const bool yesNo) noexcept
{
return yesNo ? "true" : "false";
}

static inline
void pass() {}
void pass() noexcept {}

// -----------------------------------------------------------------------
// string print functions
@@ -225,14 +225,14 @@ const char* carla_strdup_free(char* const strBuf)

template<typename T>
static inline
const T& carla_min(const T& v1, const T& v2, const T& min)
const T& carla_min(const T& v1, const T& v2, const T& min) noexcept
{
return ((v1 < min || v2 < min) ? min : (v1 < v2 ? v1 : v2));
}

template<typename T>
static inline
const T& carla_max(const T& v1, const T& v2, const T& max)
const T& carla_max(const T& v1, const T& v2, const T& max) noexcept
{
return ((v1 > max || v2 > max) ? max : (v1 > v2 ? v1 : v2));
}


Loading…
Cancel
Save