Browse Source

Headers update for -Wdocumentation; Add carla_compareFloats function

tags/1.9.4
falkTX 11 years ago
parent
commit
a050a886bc
21 changed files with 331 additions and 325 deletions
  1. +2
    -2
      source/Makefile.mk
  2. +22
    -30
      source/backend/CarlaHost.h
  3. +150
    -152
      source/backend/CarlaPlugin.hpp
  4. +1
    -1
      source/backend/engine/CarlaEngineData.cpp
  5. +1
    -1
      source/backend/engine/CarlaEngineJack.cpp
  6. +3
    -3
      source/backend/plugin/BridgePlugin.cpp
  7. +7
    -7
      source/backend/plugin/CarlaPlugin.cpp
  8. +4
    -4
      source/backend/plugin/DssiPlugin.cpp
  9. +2
    -2
      source/backend/plugin/FluidSynthPlugin.cpp
  10. +4
    -4
      source/backend/plugin/LadspaPlugin.cpp
  11. +2
    -2
      source/backend/plugin/LinuxSamplerPlugin.cpp
  12. +12
    -12
      source/backend/plugin/Lv2Plugin.cpp
  13. +2
    -2
      source/backend/plugin/NativePlugin.cpp
  14. +5
    -5
      source/backend/plugin/VstPlugin.cpp
  15. +2
    -6
      source/carla_backend.py
  16. +70
    -70
      source/modules/rtmempool/list.h
  17. +3
    -0
      source/plugin/carla-native-lv2-export.cpp
  18. +5
    -15
      source/plugin/carla-native-lv2.cpp
  19. +18
    -2
      source/utils/CarlaLv2Utils.hpp
  20. +11
    -0
      source/utils/CarlaMathUtils.hpp
  21. +5
    -5
      source/utils/CarlaStateUtils.cpp

+ 2
- 2
source/Makefile.mk View File

@@ -106,11 +106,11 @@ endif

ifeq ($(TESTBUILD),true)
BASE_FLAGS += -Werror -Wcast-qual -Wconversion -Wformat -Wformat-security -Wredundant-decls -Wshadow -Wstrict-overflow -fstrict-overflow -Wundef -Wwrite-strings
BASE_FLAGS += -Wcast-align -Wfloat-equal -Wpointer-arith -Wstrict-overflow=5 -Waggregate-return -Wabi -Winit-self -Wuninitialized -Wold-style-definition
BASE_FLAGS += -Wfloat-equal -Wpointer-arith -Wstrict-overflow=5 -Waggregate-return -Wabi -Winit-self -Wuninitialized -Wold-style-definition
BASE_FLAGS += -Wdocumentation -Wdocumentation-unknown-command
# BASE_FLAGS += -Weverything
ifneq ($(CC),clang)
BASE_FLAGS += -Wunsafe-loop-optimizations
BASE_FLAGS += -Wcast-align -Wunsafe-loop-optimizations
endif
ifneq ($(MACOS),true)
BASE_FLAGS += -Wmissing-declarations -Wsign-conversion


+ 22
- 30
source/backend/CarlaHost.h View File

@@ -49,7 +49,7 @@ using CarlaBackend::CarlaPlugin;
*
* This API makes it possible to use the Carla Backend in a standalone host application..
*
* None of the returned values in this API calls need to be deleted or free'd.\n
* None of the returned values in this API calls need to be deleted or free'd.
* When a function fails (returns false or NULL), use carla_get_last_error() to find out what went wrong.
* @{
*/
@@ -85,20 +85,20 @@ typedef struct _CarlaPluginInfo {
uint optionsAvailable;

/*!
* Plugin options currently enabled.\n
* Plugin options currently enabled.
* Some options are enabled but not available, which means they will always be on.
* @see PluginOptions
*/
uint optionsEnabled;

/*!
* Plugin filename.\n
* Plugin filename.
* This can be the plugin binary or resource file.
*/
const char* filename;

/*!
* Plugin name.\n
* Plugin name.
* This name is unique within a Carla instance.
* @see carla_get_real_plugin_name()
*/
@@ -120,13 +120,13 @@ typedef struct _CarlaPluginInfo {
const char* copyright;

/*!
* Icon name for this plugin, in lowercase.\n
* Icon name for this plugin, in lowercase.
* Default is "plugin".
*/
const char* iconName;

/*!
* Plugin unique Id.\n
* Plugin unique Id.
* This Id is dependant on the plugin type and may sometimes be 0.
*/
int64_t uniqueId;
@@ -348,13 +348,13 @@ typedef struct _CarlaTransportInfo {
* Carla Host API (C functions) */

/*!
* Get the complete license text of used third-party code and features.\n
* Get the complete license text of used third-party code and features.
* Returned string is in basic html format.
*/
CARLA_EXPORT const char* carla_get_complete_license_text();

/*!
* Get all the supported file extensions in carla_load_file().\n
* Get all the supported file extensions in carla_load_file().
* Returned string uses this syntax:
* @code
* "*.ext1;*.ext2;*.ext3"
@@ -408,7 +408,7 @@ CARLA_EXPORT const CarlaEngine* carla_get_engine();
#endif

/*!
* Initialize the engine.\n
* Initialize the engine.
* Make sure to call carla_engine_idle() at regular intervals afterwards.
* @param driverName Driver to use
* @param clientName Engine master client name
@@ -418,23 +418,19 @@ CARLA_EXPORT bool carla_engine_init(const char* driverName, const char* clientNa
#ifdef BUILD_BRIDGE
/*!
* Initialize the engine in bridged mode.
* @param audioBaseName Shared memory key for audio pool
* @param controlBaseName Shared memory key for control messages
* @param timeBaseName Shared memory key for time info
* @param clientName Engine master client name
*/
CARLA_EXPORT bool carla_engine_init_bridge(const char audioBaseName[6+1], const char rtBaseName[6+1], const char nonRtBaseName[6+1], const char* clientName);
#endif

/*!
* Close the engine.\n
* This function always closes the engine even if it returns false.\n
* Close the engine.
* This function always closes the engine even if it returns false.
* In other words, even when something goes wrong when closing the engine it still be closed nonetheless.
*/
CARLA_EXPORT bool carla_engine_close();

/*!
* Idle the engine.\n
* Idle the engine.
* Do not call this if the engine is not running.
*/
CARLA_EXPORT void carla_engine_idle();
@@ -445,7 +441,7 @@ CARLA_EXPORT void carla_engine_idle();
CARLA_EXPORT bool carla_is_engine_running();

/*!
* Tell the engine it's about to close.\n
* Tell the engine it's about to close.
* This is used to prevent the engine thread(s) from reactivating.
*/
CARLA_EXPORT void carla_set_engine_about_to_close();
@@ -475,24 +471,21 @@ CARLA_EXPORT void carla_set_engine_option(EngineOption option, int value, const
CARLA_EXPORT void carla_set_file_callback(FileCallbackFunc func, void* ptr);

/*!
* Load a file of any type.\n
* Load a file of any type.
* This will try to load a generic file as a plugin,
* either by direct handling (GIG, SF2 and SFZ) or by using an internal plugin (like Audio and MIDI).
* @param Filename Filename
* @see carla_get_supported_file_extensions()
*/
CARLA_EXPORT bool carla_load_file(const char* filename);

/*!
* Load a Carla project file.
* @param Filename Filename
* @note Currently loaded plugins are not removed; call carla_remove_all_plugins() first if needed.
*/
CARLA_EXPORT bool carla_load_project(const char* filename);

/*!
* Save current project to a file.
* @param Filename Filename
*/
CARLA_EXPORT bool carla_save_project(const char* filename);

@@ -531,7 +524,6 @@ CARLA_EXPORT void carla_transport_pause();

/*!
* Relocate the engine transport to a specific frame.
* @param frames Frame to relocate to.
*/
CARLA_EXPORT void carla_transport_relocate(uint64_t frame);

@@ -547,7 +539,7 @@ CARLA_EXPORT const CarlaTransportInfo* carla_get_transport_info();
#endif

/*!
* Add a new plugin.\n
* Add a new plugin.
* If you don't know the binary type use the BINARY_NATIVE macro.
* @param btype Binary type
* @param ptype Plugin type
@@ -572,7 +564,7 @@ CARLA_EXPORT bool carla_remove_all_plugins();

#ifndef BUILD_BRIDGE
/*!
* Rename a plugin.\n
* Rename a plugin.
* Returns the new name, or NULL if the operation failed.
* @param pluginId Plugin to rename
* @param newName New plugin name
@@ -586,7 +578,7 @@ CARLA_EXPORT const char* carla_rename_plugin(uint pluginId, const char* newName)
CARLA_EXPORT bool carla_clone_plugin(uint pluginId);

/*!
* Prepare replace of a plugin.\n
* Prepare replace of a plugin.
* The next call to carla_add_plugin() will use this id, replacing the current plugin.
* @param pluginId Plugin to replace
* @note This function requires carla_add_plugin() to be called afterwards *as soon as possible*.
@@ -749,7 +741,7 @@ CARLA_EXPORT const char* carla_get_program_name(uint pluginId, uint32_t programI
CARLA_EXPORT const char* carla_get_midi_program_name(uint pluginId, uint32_t midiProgramId);

/*!
* Get a plugin's real name.\n
* Get a plugin's real name.
* This is the name the plugin uses to identify itself; may not be unique.
* @param pluginId Plugin
*/
@@ -914,14 +906,14 @@ CARLA_EXPORT void carla_set_custom_data(uint pluginId, const char* type, const c

/*!
* Set a plugin's chunk data.
* @param pluginId Plugin
* @param value New value
* @param pluginId Plugin
* @param chunkData New chunk data
* @see PLUGIN_OPTION_USE_CHUNKS and carla_get_chunk_data()
*/
CARLA_EXPORT void carla_set_chunk_data(uint pluginId, const char* chunkData);

/*!
* Tell a plugin to prepare for save.\n
* Tell a plugin to prepare for save.
* This should be called before saving custom data sets.
* @param pluginId Plugin
*/
@@ -941,7 +933,7 @@ CARLA_EXPORT void carla_randomize_parameters(uint pluginId);

#ifndef BUILD_BRIDGE
/*!
* Send a single note of a plugin.\n
* Send a single note of a plugin.
* If velocity is 0, note-off is sent; note-on otherwise.
* @param pluginId Plugin
* @param channel Note channel


+ 150
- 152
source/backend/CarlaPlugin.hpp View File

@@ -57,11 +57,11 @@ struct StateSave;
/*!
* 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 (except reload and process),\n
* This is the base class for all available plugin types available in Carla Backend.
* All virtual calls are implemented in this class as fallback (except reload and process),
* so it's safe to only override needed calls.
*
* \see PluginType
* @see PluginType
*/
class CarlaPlugin
{
@@ -69,8 +69,8 @@ protected:
/*!
* This is the constructor of the base plugin class.
*
* \param engine The engine which this plugin belongs to, must not be null
* \param id The 'id' of this plugin, must be between 0 and CarlaEngine::maxPluginNumber()
* @param engine The engine which this plugin belongs to, must not be null
* @param id The 'id' of this plugin, must be between 0 and CarlaEngine::maxPluginNumber()
*/
CarlaPlugin(CarlaEngine* const engine, const uint id);

@@ -86,54 +86,54 @@ public:
/*!
* 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
* @note Plugin bridges will return their respective plugin type, there is no plugin type such as "bridge".
* To check if a plugin is a bridge use:
* \code
* @code
* if (getHints() & PLUGIN_IS_BRIDGE)
* ...
* \endcode
* @endcode
*/
virtual PluginType getType() const noexcept = 0;

/*!
* Get the plugin's id (as passed in the constructor).
*
* \see setId()
* @see setId()
*/
uint getId() const noexcept;

/*!
* Get the plugin's hints.
*
* \see PluginHints
* @see PluginHints
*/
uint getHints() const noexcept;

/*!
* Get the plugin's options (currently in use).
*
* \see PluginOptions, getAvailableOptions() and setOption()
* @see PluginOptions, getAvailableOptions() and setOption()
*/
uint getOptionsEnabled() const noexcept;

/*!
* Check if the plugin is enabled.\n
* Check if the plugin is enabled.
* When a plugin is disabled, it will never be processed or managed in any way.
*
* \see setEnabled()
* @see setEnabled()
*/
bool isEnabled() const noexcept;

/*!
* Get the plugin's internal name.\n
* Get the plugin's internal name.
* This name is unique within all plugins in an engine.
*
* \see getRealName() and setName()
* @see getRealName() and setName()
*/
const char* getName() const noexcept;

/*!
* Get the currently loaded DLL filename for this plugin.\n
* Get the currently loaded DLL filename for this plugin.
* (Sound kits return their exact filename).
*/
const char* getFilename() const noexcept;
@@ -149,7 +149,7 @@ public:
virtual PluginCategory getCategory() const noexcept;

/*!
* Get the plugin's native unique Id.\n
* Get the plugin's native unique Id.
* May return 0 on plugin types that don't support Ids.
*/
virtual int64_t getUniqueId() const noexcept;
@@ -183,13 +183,13 @@ public:
virtual uint32_t getMidiOutCount() const noexcept;

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

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

@@ -214,54 +214,54 @@ public:
/*!
* Get the current program number (-1 if unset).
*
* \see setProgram()
* @see setProgram()
*/
int32_t getCurrentProgram() const noexcept;

/*!
* Get the current MIDI program number (-1 if unset).
*
* \see setMidiProgram()
* \see setMidiProgramById()
* @see setMidiProgram()
* @see setMidiProgramById()
*/
int32_t getCurrentMidiProgram() const noexcept;

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

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

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

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

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

/*!
* Get the complete plugin chunk data into \a dataPtr.
* Get the complete plugin chunk data into @a dataPtr.
*
* \note Make sure to verify the plugin supports chunks before calling this function!
* @note Make sure to verify the plugin supports chunks before calling this function!
* \return The size of the chunk or 0 if invalid.
*
* \see setChunkData()
* @see setChunkData()
*/
virtual std::size_t getChunkData(void** const dataPtr) noexcept;

@@ -271,17 +271,17 @@ public:
/*!
* Get the plugin available options.
*
* \see PluginOptions, getOptions() and setOption()
* @see PluginOptions, getOptions() and setOption()
*/
virtual uint getOptionsAvailable() const noexcept;

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

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

@@ -303,61 +303,61 @@ public:
/*!
* Get the plugin's (real) name.
*
* \see getName() and setName()
* @see getName() and setName()
*/
virtual void getRealName(char* const strBuf) const noexcept;

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

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

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

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

/*!
* Get the scalepoint \a scalePointId label of the parameter \a parameterId.
* 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) const noexcept;

/*!
* Get the current parameter value of \a parameterId.
* \a parameterId can be negative to allow internal parameters.
* \see InternalParametersIndex
* Get the current parameter value of @a parameterId.
* @a parameterId can be negative to allow internal parameters.
* @see InternalParametersIndex
*/
float getInternalParameterValue(const int32_t parameterId) const noexcept;

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

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

/*!
* Get information about the plugin's parameter count.\n
* This is used to check how many input, output and total parameters are available.\n
* Get information about the plugin's parameter count.
* This is used to check how many input, output and total parameters are available.
*
* \note Some parameters might not be input or output (ie, invalid).
* @note Some parameters might not be input or output (ie, invalid).
*
* \see getParameterCount()
* @see getParameterCount()
*/
void getParameterCountInfo(uint32_t& ins, uint32_t& outs) const noexcept;

@@ -380,31 +380,31 @@ public:
virtual void randomizeParameters() noexcept;

/*!
* Get the plugin's save state.\n
* Get the plugin's save state.
* The plugin will automatically call prepareForSave() as needed.
*
* \see loadStateSave()
* @see loadStateSave()
*/
const StateSave& getStateSave();

/*!
* Get the plugin's save state.
*
* \see getStateSave()
* @see getStateSave()
*/
void loadStateSave(const StateSave& stateSave);

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

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

@@ -412,91 +412,91 @@ public:
// Set data (internal stuff)

/*!
* Set the plugin's id to \a newId.
* Set the plugin's id to @a newId.
*
* \see getId()
* @see getId()
*/
void setId(const uint newId) noexcept;

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

/*!
* Set a plugin's option.
*
* \see getOptions() and getAvailableOptions()
* @see getOptions() and getAvailableOptions()
*/
virtual void setOption(const uint option, const bool yesNo, const bool sendCallback);

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

/*!
* Set plugin as active according to \a active.
* Set plugin as active according to @a active.
*
* \param sendOsc Send message change over OSC
* \param sendCallback Send message change to registered callback
* @param sendOsc Send message change over OSC
* @param sendCallback Send message change to registered callback
*/
void setActive(const bool active, const bool sendOsc, const bool sendCallback) noexcept;

#ifndef BUILD_BRIDGE
/*!
* Set the plugin's dry/wet signal value to \a value.\n
* \a value must be between 0.0 and 1.0.
* Set the plugin's dry/wet signal value to @a value.
* @a value must be between 0.0 and 1.0.
*
* \param sendOsc Send message change over OSC
* \param sendCallback Send message change to registered callback
* @param sendOsc Send message change over OSC
* @param sendCallback Send message change to registered callback
*/
void setDryWet(const float value, const bool sendOsc, const bool sendCallback) noexcept;

/*!
* Set the plugin's output volume to \a value.\n
* \a value must be between 0.0 and 1.27.
* Set the plugin's output volume to @a value.
* @a value must be between 0.0 and 1.27.
*
* \param sendOsc Send message change over OSC
* \param sendCallback Send message change to registered callback
* @param sendOsc Send message change over OSC
* @param sendCallback Send message change to registered callback
*/
void setVolume(const float value, const bool sendOsc, const bool sendCallback) noexcept;

/*!
* Set the plugin's output left balance value to \a value.\n
* \a value must be between -1.0 and 1.0.
* Set the plugin's output left balance value to @a value.
* @a value must be between -1.0 and 1.0.
*
* \param sendOsc Send message change over OSC
* \param sendCallback Send message change to registered callback
* @param sendOsc Send message change over OSC
* @param sendCallback Send message change to registered callback
*
* \note Pure-Stereo plugins only!
* @note Pure-Stereo plugins only!
*/
void setBalanceLeft(const float value, const bool sendOsc, const bool sendCallback) noexcept;

/*!
* Set the plugin's output right balance value to \a value.\n
* \a value must be between -1.0 and 1.0.
* Set the plugin's output right balance value to @a value.
* @a value must be between -1.0 and 1.0.
*
* \param sendOsc Send message change over OSC
* \param sendCallback Send message change to registered callback
* @param sendOsc Send message change over OSC
* @param sendCallback Send message change to registered callback
*
* \note Pure-Stereo plugins only!
* @note Pure-Stereo plugins only!
*/
void setBalanceRight(const float value, const bool sendOsc, const bool sendCallback) noexcept;

/*!
* Set the plugin's output panning value to \a value.\n
* \a value must be between -1.0 and 1.0.
* Set the plugin's output panning value to @a value.
* @a value must be between -1.0 and 1.0.
*
* \param sendOsc Send message change over OSC
* \param sendCallback Send message change to registered callback
* @param sendOsc Send message change over OSC
* @param sendCallback Send message change to registered callback
*
* \note Force-Stereo plugins only!
* @note Force-Stereo plugins only!
*/
void setPanning(const float value, const bool sendOsc, const bool sendCallback) noexcept;
#endif
@@ -504,8 +504,8 @@ public:
/*!
* Set the plugin's midi control channel.
*
* \param sendOsc Send message change over OSC
* \param sendCallback Send message change to registered callback
* @param sendOsc Send message change over OSC
* @param sendCallback Send message change to registered callback
*/
virtual void setCtrlChannel(const int8_t channel, const bool sendOsc, const bool sendCallback) noexcept;

@@ -515,94 +515,92 @@ public:
/*!
* Set a plugin's parameter value.
*
* \param parameterId The parameter to change
* \param value The new parameter value, must be within the parameter's range
* \param sendGui Send message change to plugin's custom GUI, if any
* \param sendOsc Send message change over OSC
* \param sendCallback Send message change to registered callback
* @param parameterId The parameter to change
* @param value The new parameter value, must be within the parameter's range
* @param sendGui Send message change to plugin's custom GUI, if any
* @param sendOsc Send message change over OSC
* @param sendCallback Send message change to registered callback
*
* \see getParameterValue()
* @see getParameterValue()
*/
virtual void setParameterValue(const uint32_t parameterId, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept;

/*!
* Set a plugin's parameter value, including internal parameters.\n
* \a rindex can be negative to allow internal parameters change (as defined in InternalParametersIndex).
* Set a plugin's parameter value, including internal parameters.
* @a rindex can be negative to allow internal parameters change (as defined in InternalParametersIndex).
*
* \see setParameterValue()
* \see setActive()
* \see setDryWet()
* \see setVolume()
* \see setBalanceLeft()
* \see setBalanceRight()
* @see setParameterValue()
* @see setActive()
* @see setDryWet()
* @see setVolume()
* @see setBalanceLeft()
* @see setBalanceRight()
*/
void setParameterValueByRealIndex(const int32_t rindex, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept;

/*!
* Set parameter's \a parameterId MIDI channel to \a channel.\n
* \a channel must be between 0 and 15.
* Set parameter's @a parameterId MIDI channel to @a channel.
* @a channel must be between 0 and 15.
*/
virtual void setParameterMidiChannel(const uint32_t parameterId, const uint8_t channel, const bool sendOsc, const bool sendCallback) noexcept;

/*!
* Set parameter's \a parameterId MIDI CC to \a cc.\n
* \a cc must be between 0 and 95 (0x5F), or -1 for invalid.
* Set parameter's @a parameterId MIDI CC to @a cc.
* @a cc must be between 0 and 95 (0x5F), or -1 for invalid.
*/
virtual void setParameterMidiCC(const uint32_t parameterId, const int16_t cc, const bool sendOsc, const bool sendCallback) noexcept;

/*!
* Add a custom data set.\n
* If \a key already exists, its current value will be swapped with \a value.
* Add a custom data set.
* If @a key already exists, its current value will be swapped with @a value.
*
* \param type Type of data used in \a value.
* \param key A key identifing this data set.
* \param value The value of the data set, of type \a type.
* \param sendGui Send message change to plugin's custom GUI, if any
* @param type Type of data used in @a value.
* @param key A key identifing this data set.
* @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 getCustomDataCount() and getCustomData()
* @see getCustomDataCount() and getCustomData()
*/
virtual void setCustomData(const char* const type, const char* const key, const char* const value, const bool sendGui);

/*!
* Set the complete chunk data as \a data.\n
* Set the complete chunk data as @a data.
*
* \see getChunkData()
* @see getChunkData()
*
* \note Make sure to verify the plugin supports chunks before calling this function
* @note Make sure to verify the plugin supports chunks before calling this function
*/
virtual void setChunkData(const void* const data, const std::size_t dataSize);

/*!
* Change the current plugin program to \a index.
* Change the current plugin program to @a index.
*
* If \a index is negative the plugin's program will be considered unset.\n
* If @a index is negative the plugin's program will be considered unset.
* The plugin's default parameter values will be updated when this function is called.
*
* \param index New program index to use
* \param sendGui Send message change to plugin's custom GUI, if any
* \param sendOsc Send message change over OSC
* \param sendCallback Send message change to registered callback
* \param block Block the audio callback
* @param index New program index to use
* @param sendGui Send message change to plugin's custom GUI, if any
* @param sendOsc Send message change over OSC
* @param sendCallback Send message change to registered callback
*/
virtual void setProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept;

/*!
* Change the current MIDI plugin program to \a index.
* Change the current MIDI plugin program to @a index.
*
* If \a index is negative the plugin's program will be considered unset.\n
* If @a index is negative the plugin's program will be considered unset.
* The plugin's default parameter values will be updated when this function is called.
*
* \param index New program index to use
* \param sendGui Send message change to plugin's custom GUI, if any
* \param sendOsc Send message change over OSC
* \param sendCallback Send message change to registered callback
* \param block Block the audio callback
* @param index New program index to use
* @param sendGui Send message change to plugin's custom GUI, if any
* @param sendOsc Send message change over OSC
* @param sendCallback Send message change to registered callback
*/
virtual void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept;

/*!
* This is an overloaded call to setMidiProgram().\n
* It changes the current MIDI program using \a bank and \a program values instead of index.
* This is an overloaded call to setMidiProgram().
* It changes the current MIDI program using @a bank and @a program values instead of index.
*/
void setMidiProgramById(const uint32_t bank, const uint32_t program, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept;

@@ -612,14 +610,14 @@ public:
/*!
* Idle function.
*
* \note This function must be always called from the main thread.
* @note This function must be always called from the main thread.
*/
virtual void idle();

/*!
* Show (or hide) the plugin's custom UI according to \a yesNo.
* Show (or hide) the plugin's custom UI according to @a yesNo.
*
* \note This function must be always called from the main thread.
* @note This function must be always called from the main thread.
*/
virtual void showCustomUI(const bool yesNo);

@@ -627,7 +625,7 @@ public:
// Plugin state

/*!
* Reload the plugin's entire state (including programs).\n
* Reload the plugin's entire state (including programs).
* The plugin will be disabled during this call.
*/
virtual void reload() = 0;
@@ -710,13 +708,13 @@ public:
void registerToOscClient() noexcept;

/*!
* Update the plugin's internal OSC data according to \a source and \a url.\n
* Update the plugin's internal OSC data according to @a source and @a url.
* This is used for OSC-GUI bridges.
*/
void updateOscData(const lo_address& source, const char* const url);

/*!
* Update the plugin's extra OSC data, called from the start of updateOscData().\n
* Update the plugin's extra OSC data, called from the start of updateOscData().
* The default implementation does nothing.
*/
virtual bool updateOscDataExtra();
@@ -728,7 +726,7 @@ public:
virtual void updateOscURL();

/*!
* Show the plugin's OSC based GUI.\n
* Show the plugin's OSC based GUI.
* This is a handy function that waits for the GUI to respond and automatically asks it to show itself.
*/
bool waitForOscGuiShow();
@@ -738,16 +736,16 @@ public:

#ifndef BUILD_BRIDGE
/*!
* Send a single midi note to be processed in the next audio callback.\n
* Send a single midi note to be processed in the next audio callback.
* A note with 0 velocity means note-off.
* \note Non-RT call
* @note Non-RT call
*/
void sendMidiSingleNote(const uint8_t channel, const uint8_t note, const uint8_t velo, const bool sendGui, const bool sendOsc, const bool sendCallback);

/*!
* Send all midi notes off to the host callback.\n
* Send all midi notes off to the host callback.
* This doesn't send the actual MIDI All-Notes-Off event, but 128 note-offs instead (IFF ctrlChannel is valid).
* \note RT call
* @note RT call
*/
void sendMidiAllNotesOffToCallback();
#endif
@@ -843,7 +841,7 @@ public:
// Plugin initializers

/*!
* Get a plugin's binary type.\n
* Get a plugin's binary type.
* This is always BINARY_NATIVE unless the plugin is a bridge.
*/
virtual BinaryType getBinaryType() const noexcept
@@ -904,7 +902,7 @@ protected:
// Helper classes

/*!
* Fully disable plugin in scope and also its engine client.\n
* Fully disable plugin in scope and also its engine client.
* May wait-block on constructor for plugin process to end.
*/
class ScopedDisabler
@@ -921,8 +919,8 @@ protected:
};

/*!
* Lock the plugin's own run/process call.\n
* Plugin will still work as normal, but output only silence.\n
* 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.
*/
class ScopedSingleProcessLocker


+ 1
- 1
source/backend/engine/CarlaEngineData.cpp View File

@@ -262,7 +262,7 @@ bool EngineTimeInfo::operator==(const EngineTimeInfo& timeInfo) const noexcept
return false;
if ((valid & kValidBBT) == 0)
return true;
if (timeInfo.bbt.beatsPerMinute != bbt.beatsPerMinute)
if (! carla_compareFloats(timeInfo.bbt.beatsPerMinute, bbt.beatsPerMinute))
return false;
return true;
}


+ 1
- 1
source/backend/engine/CarlaEngineJack.cpp View File

@@ -1203,7 +1203,7 @@ protected:

void handleJackSampleRateCallback(const double newSampleRate)
{
if (pData->sampleRate == newSampleRate)
if (carla_compareFloats(pData->sampleRate, newSampleRate))
return;

pData->sampleRate = newSampleRate;


+ 3
- 3
source/backend/plugin/BridgePlugin.cpp View File

@@ -1221,9 +1221,9 @@ public:
// Post-processing (dry/wet, volume and balance)

{
const bool doVolume = (pData->hints & PLUGIN_CAN_VOLUME) != 0 && pData->postProc.volume != 1.0f;
const bool doDryWet = (pData->hints & PLUGIN_CAN_DRYWET) != 0 && pData->postProc.dryWet != 1.0f;
const bool doBalance = (pData->hints & PLUGIN_CAN_BALANCE) != 0 && (pData->postProc.balanceLeft != -1.0f || pData->postProc.balanceRight != 1.0f);
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));

bool isPair;
float bufValue, oldBufLeft[doBalance ? frames : 1];


+ 7
- 7
source/backend/plugin/CarlaPlugin.cpp View File

@@ -953,7 +953,7 @@ void CarlaPlugin::setDryWet(const float value, const bool sendOsc, const bool se

const float fixedValue(carla_fixValue<float>(0.0f, 1.0f, value));

if (pData->postProc.dryWet == fixedValue)
if (carla_compareFloats(pData->postProc.dryWet, fixedValue))
return;

pData->postProc.dryWet = fixedValue;
@@ -971,7 +971,7 @@ void CarlaPlugin::setVolume(const float value, const bool sendOsc, const bool se

const float fixedValue(carla_fixValue<float>(0.0f, 1.27f, value));

if (pData->postProc.volume == fixedValue)
if (carla_compareFloats(pData->postProc.volume, fixedValue))
return;

pData->postProc.volume = fixedValue;
@@ -989,7 +989,7 @@ void CarlaPlugin::setBalanceLeft(const float value, const bool sendOsc, const bo

const float fixedValue(carla_fixValue<float>(-1.0f, 1.0f, value));

if (pData->postProc.balanceLeft == fixedValue)
if (carla_compareFloats(pData->postProc.balanceLeft, fixedValue))
return;

pData->postProc.balanceLeft = fixedValue;
@@ -1007,7 +1007,7 @@ void CarlaPlugin::setBalanceRight(const float value, const bool sendOsc, const b

const float fixedValue(carla_fixValue<float>(-1.0f, 1.0f, value));

if (pData->postProc.balanceRight == fixedValue)
if (carla_compareFloats(pData->postProc.balanceRight, fixedValue))
return;

pData->postProc.balanceRight = fixedValue;
@@ -1025,7 +1025,7 @@ void CarlaPlugin::setPanning(const float value, const bool sendOsc, const bool s

const float fixedValue(carla_fixValue<float>(-1.0f, 1.0f, value));

if (pData->postProc.panning == fixedValue)
if (carla_compareFloats(pData->postProc.panning, fixedValue))
return;

pData->postProc.panning = fixedValue;
@@ -1117,8 +1117,8 @@ void CarlaPlugin::setParameterValueByRealIndex(const int32_t rindex, const float
{
if (pData->param.data[i].rindex == rindex)
{
if (getParameterValue(i) != value)
setParameterValue(i, value, sendGui, sendOsc, sendCallback);
//if (! carla_compareFloats(getParameterValue(i), value))
setParameterValue(i, value, sendGui, sendOsc, sendCallback);
break;
}
}


+ 4
- 4
source/backend/plugin/DssiPlugin.cpp View File

@@ -663,9 +663,9 @@ public:
carla_stderr2("WARNING - Broken plugin parameter '%s': min > max", paramName);
min = max - 0.1f;
}
else if (min == max)
else if (carla_compareFloats(min, max))
{
carla_stderr2("WARNING - Broken plugin parameter '%s': min == maxf", paramName);
carla_stderr2("WARNING - Broken plugin parameter '%s': min == max", paramName);
max = min + 0.1f;
}

@@ -1651,8 +1651,8 @@ public:
// Post-processing (dry/wet, volume and balance)

{
const bool doDryWet = (pData->hints & PLUGIN_CAN_DRYWET) != 0 && pData->postProc.dryWet != 1.0f;
const bool doBalance = (pData->hints & PLUGIN_CAN_BALANCE) != 0 && (pData->postProc.balanceLeft != -1.0f || pData->postProc.balanceRight != 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 isMono = (pData->audioIn.count == 1);

bool isPair;


+ 2
- 2
source/backend/plugin/FluidSynthPlugin.cpp View File

@@ -1396,8 +1396,8 @@ public:

{
// note - balance not possible with kUse16Outs, so we can safely skip fAudioOutBuffers
const bool doVolume = (pData->hints & PLUGIN_CAN_VOLUME) > 0 && pData->postProc.volume != 1.0f;
const bool doBalance = (pData->hints & PLUGIN_CAN_BALANCE) > 0 && (pData->postProc.balanceLeft != -1.0f || pData->postProc.balanceRight != 1.0f);
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));

float oldBufLeft[doBalance ? frames : 1];



+ 4
- 4
source/backend/plugin/LadspaPlugin.cpp View File

@@ -637,9 +637,9 @@ public:
carla_stderr2("WARNING - Broken plugin parameter '%s': min > max", paramName);
min = max - 0.1f;
}
else if (min == max)
else if (carla_compareFloats(min, max))
{
carla_stderr2("WARNING - Broken plugin parameter '%s': min == maxf", paramName);
carla_stderr2("WARNING - Broken plugin parameter '%s': min == max", paramName);
max = min + 0.1f;
}

@@ -1248,8 +1248,8 @@ public:
// Post-processing (dry/wet, volume and balance)

{
const bool doDryWet = (pData->hints & PLUGIN_CAN_DRYWET) != 0 && pData->postProc.dryWet != 1.0f;
const bool doBalance = (pData->hints & PLUGIN_CAN_BALANCE) != 0 && (pData->postProc.balanceLeft != -1.0f || pData->postProc.balanceRight != 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 isMono = (pData->audioIn.count == 1);

bool isPair;


+ 2
- 2
source/backend/plugin/LinuxSamplerPlugin.cpp View File

@@ -1068,8 +1068,8 @@ public:
// Post-processing (dry/wet, volume and balance)

{
const bool doVolume = (pData->hints & PLUGIN_CAN_VOLUME) > 0 && pData->postProc.volume != 1.0f;
const bool doBalance = (pData->hints & PLUGIN_CAN_BALANCE) > 0 && (pData->postProc.balanceLeft != -1.0f || pData->postProc.balanceRight != 1.0f);
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));

float oldBufLeft[doBalance ? frames : 1];



+ 12
- 12
source/backend/plugin/Lv2Plugin.cpp View File

@@ -1925,9 +1925,9 @@ public:
max = (float)0xffffff;
}

if (max - min == 0.0f)
if (carla_compareFloats(min, max))
{
carla_stderr2("WARNING - Broken plugin parameter '%s': max - min == 0.0f", fRdfDescriptor->Ports[i].Name);
carla_stderr2("WARNING - Broken plugin parameter '%s': max == min", fRdfDescriptor->Ports[i].Name);
max = min + 0.1f;
}

@@ -2633,7 +2633,7 @@ public:
break;
case LV2_PORT_DESIGNATION_TIME_BAR_BEAT:
if ((timeInfo.valid & EngineTimeInfo::kValidBBT) != 0 && (fLastTimeInfo.bbt.tick != timeInfo.bbt.tick ||
fLastTimeInfo.bbt.ticksPerBeat != timeInfo.bbt.ticksPerBeat))
!carla_compareFloats(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));
doPostRt = true;
@@ -2647,21 +2647,21 @@ public:
}
break;
case LV2_PORT_DESIGNATION_TIME_BEAT_UNIT:
if ((timeInfo.valid & EngineTimeInfo::kValidBBT) != 0 && fLastTimeInfo.bbt.beatType != timeInfo.bbt.beatType)
if ((timeInfo.valid & EngineTimeInfo::kValidBBT) != 0 && ! carla_compareFloats(fLastTimeInfo.bbt.beatType, timeInfo.bbt.beatType))
{
fParamBuffers[k] = timeInfo.bbt.beatType;
doPostRt = true;
}
break;
case LV2_PORT_DESIGNATION_TIME_BEATS_PER_BAR:
if ((timeInfo.valid & EngineTimeInfo::kValidBBT) != 0 && fLastTimeInfo.bbt.beatsPerBar != timeInfo.bbt.beatsPerBar)
if ((timeInfo.valid & EngineTimeInfo::kValidBBT) != 0 && ! carla_compareFloats(fLastTimeInfo.bbt.beatsPerBar, timeInfo.bbt.beatsPerBar))
{
fParamBuffers[k] = timeInfo.bbt.beatsPerBar;
doPostRt = true;
}
break;
case LV2_PORT_DESIGNATION_TIME_BEATS_PER_MINUTE:
if ((timeInfo.valid & EngineTimeInfo::kValidBBT) != 0 && fLastTimeInfo.bbt.beatsPerMinute != timeInfo.bbt.beatsPerMinute)
if ((timeInfo.valid & EngineTimeInfo::kValidBBT) != 0 && ! carla_compareFloats(fLastTimeInfo.bbt.beatsPerMinute, timeInfo.bbt.beatsPerMinute))
{
fParamBuffers[k] = static_cast<float>(timeInfo.bbt.beatsPerMinute);
doPostRt = true;
@@ -3383,7 +3383,7 @@ public:

if (pData->param.data[k].hints & PARAMETER_IS_TRIGGER)
{
if (fParamBuffers[k] != pData->param.ranges[k].def)
if (! carla_compareFloats(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]);
@@ -3398,8 +3398,8 @@ public:
// Post-processing (dry/wet, volume and balance)

{
const bool doDryWet = (pData->hints & PLUGIN_CAN_DRYWET) != 0 && pData->postProc.dryWet != 1.0f;
const bool doBalance = (pData->hints & PLUGIN_CAN_BALANCE) != 0 && (pData->postProc.balanceLeft != -1.0f || pData->postProc.balanceRight != 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 isMono = (pData->audioIn.count == 1);

bool isPair;
@@ -3580,7 +3580,7 @@ public:
CARLA_ASSERT_INT(newSampleRate > 0.0, newSampleRate);
carla_debug("Lv2Plugin::sampleRateChanged(%g) - start", newSampleRate);

if (fLv2Options.sampleRate != newSampleRate)
if (! carla_compareFloats(fLv2Options.sampleRate, newSampleRate))
{
fLv2Options.sampleRate = newSampleRate;

@@ -4336,8 +4336,8 @@ public:

const float value(*(const float*)buffer);

if (fParamBuffers[index] != value)
setParameterValue(index, value, false, true, true);
//if (! carla_compareFloats(fParamBuffers[index], value))
setParameterValue(index, value, false, true, true);

} break;



+ 2
- 2
source/backend/plugin/NativePlugin.cpp View File

@@ -1804,8 +1804,8 @@ public:
// Post-processing (dry/wet, volume and balance)

{
const bool doDryWet = (pData->hints & PLUGIN_CAN_DRYWET) != 0 && pData->postProc.dryWet != 1.0f;
const bool doBalance = (pData->hints & PLUGIN_CAN_BALANCE) != 0 && (pData->postProc.balanceLeft != -1.0f || pData->postProc.balanceRight != 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));

bool isPair;
float bufValue, oldBufLeft[doBalance ? frames : 1];


+ 5
- 5
source/backend/plugin/VstPlugin.cpp View File

@@ -686,7 +686,7 @@ public:
carla_stderr2("WARNING - Broken plugin parameter min > max (with cockos extensions)");
min = max - 0.1f;
}
else if (min == max)
else if (carla_compareFloats(min, max))
{
carla_stderr2("WARNING - Broken plugin parameter min == max (with cockos extensions)");
max = min + 0.1f;
@@ -728,7 +728,7 @@ public:
carla_stderr2("WARNING - Broken plugin parameter min > max");
min = max - 0.1f;
}
else if (min == max)
else if (carla_compareFloats(min, max))
{
carla_stderr2("WARNING - Broken plugin parameter min == max");
max = min + 0.1f;
@@ -1593,9 +1593,9 @@ public:
// Post-processing (dry/wet, volume and balance)

{
const bool doVolume = (pData->hints & PLUGIN_CAN_VOLUME) != 0 && pData->postProc.volume != 1.0f;
const bool doDryWet = (pData->hints & PLUGIN_CAN_DRYWET) != 0 && pData->postProc.dryWet != 1.0f;
const bool doBalance = (pData->hints & PLUGIN_CAN_BALANCE) != 0 && (pData->postProc.balanceLeft != -1.0f || pData->postProc.balanceRight != 1.0f);
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));

bool isPair;
float bufValue, oldBufLeft[doBalance ? frames : 1];


+ 2
- 6
source/carla_backend.py View File

@@ -1311,19 +1311,16 @@ class Host(object):
# Load a file of any type.
# This will try to load a generic file as a plugin,
# either by direct handling (GIG, SF2 and SFZ) or by using an internal plugin (like Audio and MIDI).
# @param Filename Filename
# @see carla_get_supported_file_extensions()
def load_file(self, filename):
return bool(self.lib.carla_load_file(filename.encode("utf-8")))

# Load a Carla project file.
# @param Filename Filename
# @note Currently loaded plugins are not removed; call carla_remove_all_plugins() first if needed.
def load_project(self, filename):
return bool(self.lib.carla_load_project(filename.encode("utf-8")))

# Save current project to a file.
# @param Filename Filename
def save_project(self, filename):
return bool(self.lib.carla_save_project(filename.encode("utf-8")))

@@ -1355,7 +1352,6 @@ class Host(object):
self.lib.carla_transport_pause()

# Relocate the engine transport to a specific frame.
# @param frames Frame to relocate to.
def transport_relocate(self, frame):
self.lib.carla_transport_relocate(frame)

@@ -1682,8 +1678,8 @@ class Host(object):
self.lib.carla_set_custom_data(pluginId, type_.encode("utf-8"), key.encode("utf-8"), value.encode("utf-8"))

# Set a plugin's chunk data.
# @param pluginId Plugin
# @param value New value
# @param pluginId Plugin
# @param chunkData New chunk data
# @see PLUGIN_OPTION_USE_CHUNKS and carla_get_chunk_data()
def set_chunk_data(self, pluginId, chunkData):
self.lib.carla_set_chunk_data(pluginId, chunkData.encode("utf-8"))


+ 70
- 70
source/modules/rtmempool/list.h View File

@@ -44,9 +44,9 @@

/**
* container_of - cast a member of a structure out to the containing structure
* @ptr: the pointer to the member.
* @type: the type of the container struct this is embedded in.
* @member: the name of the member within the struct.
* @param ptr: the pointer to the member.
* @param type: the type of the container struct this is embedded in.
* @param member the name of the member within the struct.
*
*/
#define container_of(ptr, type, member) ({ \
@@ -108,8 +108,8 @@ static inline void __list_add(struct list_head *new_, struct list_head *prev, st

/**
* list_add - add a new entry
* @new: new entry to be added
* @head: list head to add it after
* @param new_ new entry to be added
* @param head list head to add it after
*
* Insert a new entry after the specified head.
* This is good for implementing stacks.
@@ -121,8 +121,8 @@ static inline void list_add(struct list_head *new_, struct list_head *head)

/**
* list_add_tail - add a new entry
* @new: new entry to be added
* @head: list head to add it before
* @param new_ new entry to be added
* @param head list head to add it before
*
* Insert a new entry before the specified head.
* This is useful for implementing queues.
@@ -147,7 +147,7 @@ static inline void __list_del(struct list_head *prev, struct list_head *next)

/**
* list_del - deletes entry from list.
* @entry: the element to delete from the list.
* @param entry the element to delete from the list.
* Note: list_empty on entry does not return true after this, the entry is
* in an undefined state.
*/
@@ -160,7 +160,7 @@ static inline void list_del(struct list_head *entry)

/**
* list_del_init - deletes entry from list and reinitialize it.
* @entry: the element to delete from the list.
* @param entry the element to delete from the list.
*/
static inline void list_del_init(struct list_head *entry)
{
@@ -170,8 +170,8 @@ static inline void list_del_init(struct list_head *entry)

/**
* list_move - delete from one list and add as another's head
* @list: the entry to move
* @head: the head that will precede our entry
* @param list the entry to move
* @param head the head that will precede our entry
*/
static inline void list_move(struct list_head *list, struct list_head *head)
{
@@ -181,8 +181,8 @@ static inline void list_move(struct list_head *list, struct list_head *head)

/**
* list_move_tail - delete from one list and add as another's tail
* @list: the entry to move
* @head: the head that will follow our entry
* @param list the entry to move
* @param head the head that will follow our entry
*/
static inline void list_move_tail(struct list_head *list, struct list_head *head)
{
@@ -192,7 +192,7 @@ static inline void list_move_tail(struct list_head *list, struct list_head *head

/**
* list_empty - tests whether a list is empty
* @head: the list to test.
* @param head the list to test.
*/
static inline int list_empty(const struct list_head *head)
{
@@ -209,7 +209,7 @@ static inline int list_empty(const struct list_head *head)
* to the list entry is list_del_init(). Eg. it cannot be used
* if another CPU could re-list_add() it.
*
* @head: the list to test.
* @param head the list to test.
*/
static inline int list_empty_careful(const struct list_head *head)
{
@@ -245,8 +245,8 @@ static inline void __list_splice_tail(struct list_head *list, struct list_head *

/**
* list_splice - join two lists
* @list: the new list to add.
* @head: the place to add it in the first list.
* @param list the new list to add.
* @param head the place to add it in the first list.
*/
static inline void list_splice(struct list_head *list, struct list_head *head)
{
@@ -256,10 +256,10 @@ static inline void list_splice(struct list_head *list, struct list_head *head)

/**
* list_splice_tail - join two lists
* @list: the new list to add.
* @head: the place to add it in the first list.
* @param list the new list to add.
* @param head the place to add it in the first list.
*
* @list goes to the end (at head->prev)
* @a list goes to the end (at head->prev)
*/
static inline void list_splice_tail(struct list_head *list, struct list_head *head)
{
@@ -269,10 +269,10 @@ static inline void list_splice_tail(struct list_head *list, struct list_head *he

/**
* list_splice_init - join two lists and reinitialise the emptied list.
* @list: the new list to add.
* @head: the place to add it in the first list.
* @param list the new list to add.
* @param head the place to add it in the first list.
*
* The list at @list is reinitialised
* The list at @a list is reinitialised
*/
static inline void list_splice_init(struct list_head *list, struct list_head *head)
{
@@ -284,11 +284,11 @@ static inline void list_splice_init(struct list_head *list, struct list_head *he

/**
* list_splice_tail_init - join two lists and reinitialise the emptied list.
* @list: the new list to add.
* @head: the place to add it in the first list.
* @param list the new list to add.
* @param head the place to add it in the first list.
*
* The list at @list is reinitialised
* @list goes to the end (at head->prev)
* The list @a list is reinitialised
* @a list goes to the end (at head->prev)
*/
static inline void list_splice_tail_init(struct list_head *list, struct list_head *head)
{
@@ -300,9 +300,9 @@ static inline void list_splice_tail_init(struct list_head *list, struct list_hea

/**
* list_entry - get the struct for this entry
* @ptr: the &struct list_head pointer.
* @type: the type of the struct this is embedded in.
* @member: the name of the list_struct within the struct.
* @param ptr: the &struct list_head pointer.
* @param type: the type of the struct this is embedded in.
* @param member the name of the list_struct within the struct.
*/
#if (defined(__GNUC__) || defined(__clang__)) && ! defined(__STRICT_ANSI__)
# define list_entry(ptr, type, member) \
@@ -318,8 +318,8 @@ static inline void list_splice_tail_init(struct list_head *list, struct list_hea

/**
* list_for_each - iterate over a list
* @pos: the &struct list_head to use as a loop counter.
* @head: the head for your list.
* @param pos the &struct list_head to use as a loop counter.
* @param head the head for your list.
*/
#define list_for_each(pos, head) \
for (pos = (head)->next; prefetch(pos->next), pos != (head); \
@@ -327,8 +327,8 @@ static inline void list_splice_tail_init(struct list_head *list, struct list_hea

/**
* __list_for_each - iterate over a list
* @pos: the &struct list_head to use as a loop counter.
* @head: the head for your list.
* @param pos the &struct list_head to use as a loop counter.
* @param head the head for your list.
*
* This variant differs from list_for_each() in that it's the
* simplest possible list iteration code, no prefetching is done.
@@ -340,8 +340,8 @@ static inline void list_splice_tail_init(struct list_head *list, struct list_hea

/**
* list_for_each_prev - iterate over a list backwards
* @pos: the &struct list_head to use as a loop counter.
* @head: the head for your list.
* @param pos the &struct list_head to use as a loop counter.
* @param head the head for your list.
*/
#define list_for_each_prev(pos, head) \
for (pos = (head)->prev; prefetch(pos->prev), pos != (head); \
@@ -349,9 +349,9 @@ static inline void list_splice_tail_init(struct list_head *list, struct list_hea

/**
* list_for_each_safe - iterate over a list safe against removal of list entry
* @pos: the &struct list_head to use as a loop counter.
* @n: another &struct list_head to use as temporary storage
* @head: the head for your list.
* @param pos the &struct list_head to use as a loop counter.
* @param n another &struct list_head to use as temporary storage
* @param head the head for your list.
*/
#define list_for_each_safe(pos, n, head) \
for (pos = (head)->next, n = pos->next; pos != (head); \
@@ -359,9 +359,9 @@ static inline void list_splice_tail_init(struct list_head *list, struct list_hea

/**
* list_for_each_entry - iterate over list of given type
* @pos: the type * to use as a loop counter.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
* @param pos the type * to use as a loop counter.
* @param head the head for your list.
* @param member the name of the list_struct within the struct.
*/
#define list_for_each_entry(pos, head, member) \
for (pos = list_entry((head)->next, typeof(*pos), member); \
@@ -370,9 +370,9 @@ static inline void list_splice_tail_init(struct list_head *list, struct list_hea

/**
* list_for_each_entry_reverse - iterate backwards over list of given type.
* @pos: the type * to use as a loop counter.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
* @param pos the type * to use as a loop counter.
* @param head the head for your list.
* @param member the name of the list_struct within the struct.
*/
#define list_for_each_entry_reverse(pos, head, member) \
for (pos = list_entry((head)->prev, typeof(*pos), member); \
@@ -381,18 +381,18 @@ static inline void list_splice_tail_init(struct list_head *list, struct list_hea

/**
* list_prepare_entry - prepare a pos entry for use as a start point in list_for_each_entry_continue
* @pos: the type * to use as a start point
* @head: the head of the list
* @member: the name of the list_struct within the struct.
* @param pos the type * to use as a start point
* @param head the head of the list
* @param member the name of the list_struct within the struct.
*/
#define list_prepare_entry(pos, head, member) \
((pos) ? : list_entry(head, typeof(*pos), member))

/**
* list_for_each_entry_continue - iterate over list of given type continuing after existing point
* @pos: the type * to use as a loop counter.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
* @param pos the type * to use as a loop counter.
* @param head the head for your list.
* @param member the name of the list_struct within the struct.
*/
#define list_for_each_entry_continue(pos, head, member) \
for (pos = list_entry(pos->member.next, typeof(*pos), member); \
@@ -401,9 +401,9 @@ static inline void list_splice_tail_init(struct list_head *list, struct list_hea

/**
* list_for_each_entry_from - iterate over list of given type continuing from existing point
* @pos: the type * to use as a loop counter.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
* @param pos the type * to use as a loop counter.
* @param head the head for your list.
* @param member the name of the list_struct within the struct.
*/
#define list_for_each_entry_from(pos, head, member) \
for (; prefetch(pos->member.next), &pos->member != (head); \
@@ -411,10 +411,10 @@ static inline void list_splice_tail_init(struct list_head *list, struct list_hea

/**
* list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
* @pos: the type * to use as a loop counter.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
* @param pos the type * to use as a loop counter.
* @param n another type * to use as temporary storage
* @param head the head for your list.
* @param member the name of the list_struct within the struct.
*/
#define list_for_each_entry_safe(pos, n, head, member) \
for (pos = list_entry((head)->next, typeof(*pos), member), \
@@ -424,10 +424,10 @@ static inline void list_splice_tail_init(struct list_head *list, struct list_hea

/**
* list_for_each_entry_safe_continue - iterate over list of given type continuing after existing point safe against removal of list entry
* @pos: the type * to use as a loop counter.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
* @param pos the type * to use as a loop counter.
* @param n another type * to use as temporary storage
* @param head the head for your list.
* @param member the name of the list_struct within the struct.
*/
#define list_for_each_entry_safe_continue(pos, n, head, member) \
for (pos = list_entry(pos->member.next, typeof(*pos), member), \
@@ -437,10 +437,10 @@ static inline void list_splice_tail_init(struct list_head *list, struct list_hea

/**
* list_for_each_entry_safe_from - iterate over list of given type from existing point safe against removal of list entry
* @pos: the type * to use as a loop counter.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
* @param pos the type * to use as a loop counter.
* @param n another type * to use as temporary storage
* @param head the head for your list.
* @param member the name of the list_struct within the struct.
*/
#define list_for_each_entry_safe_from(pos, n, head, member) \
for (n = list_entry(pos->member.next, typeof(*pos), member); \
@@ -449,10 +449,10 @@ static inline void list_splice_tail_init(struct list_head *list, struct list_hea

/**
* list_for_each_entry_safe_reverse - iterate backwards over list of given type safe against removal of list entry
* @pos: the type * to use as a loop counter.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
* @param pos the type * to use as a loop counter.
* @param n another type * to use as temporary storage
* @param head the head for your list.
* @param member the name of the list_struct within the struct.
*/
#define list_for_each_entry_safe_reverse(pos, n, head, member) \
for (pos = list_entry((head)->prev, typeof(*pos), member), \


+ 3
- 0
source/plugin/carla-native-lv2-export.cpp View File

@@ -15,6 +15,9 @@
* For a full copy of the GNU General Public License see the doc/GPL.txt file.
*/

// include this first to ignore documentation warnings
#include "CarlaLv2Utils.hpp"

#define CARLA_NATIVE_PLUGIN_LV2
#include "carla-native-base.cpp"



+ 5
- 15
source/plugin/carla-native-lv2.cpp View File

@@ -15,25 +15,15 @@
* For a full copy of the GNU General Public License see the doc/GPL.txt file.
*/

// include this first to ignore documentation warnings
#include "CarlaLv2Utils.hpp"

#define CARLA_NATIVE_PLUGIN_LV2
#include "carla-native-base.cpp"

// #include "CarlaMathUtils.hpp"
#include "CarlaMathUtils.hpp"
#include "CarlaString.hpp"

#include "lv2/atom.h"
#include "lv2/atom-util.h"
#include "lv2/buf-size.h"
#include "lv2/instance-access.h"
#include "lv2/midi.h"
#include "lv2/options.h"
#include "lv2/state.h"
#include "lv2/time.h"
#include "lv2/ui.h"
#include "lv2/urid.h"
#include "lv2/lv2_external_ui.h"
#include "lv2/lv2_programs.h"

#include "juce_audio_basics.h"
using juce::FloatVectorOperations;

@@ -274,7 +264,7 @@ public:

curValue = *fPorts.paramsPtr[i];

if (fPorts.paramsLast[i] != curValue && (fDescriptor->get_parameter_info(fHandle, i)->hints & PARAMETER_IS_OUTPUT) == 0)
if ((! carla_compareFloats(fPorts.paramsLast[i], curValue)) && (fDescriptor->get_parameter_info(fHandle, i)->hints & PARAMETER_IS_OUTPUT) == 0)
{
fPorts.paramsLast[i] = curValue;
fDescriptor->set_parameter_value(fHandle, i, curValue);


+ 18
- 2
source/utils/CarlaLv2Utils.hpp View File

@@ -25,6 +25,15 @@
# define NULL nullptr
#endif

// disable -Wdocumentation for LV2 headers
#if defined(__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdocumentation"
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdocumentation"
#endif

#include "lv2/lv2.h"
#include "lv2/atom.h"
#include "lv2/atom-forge.h"
@@ -61,11 +70,18 @@
#include "lv2/lv2_programs.h"
#include "lv2/lv2_rtmempool.h"

#include "lv2_rdf.hpp"

#include "lilv/lilvmm.hpp"
#include "sratom/sratom.h"

// enable -Wdocumentation again
#if defined(__clang__)
# pragma clang diagnostic pop
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
# pragma GCC diagnostic pop
#endif

#include "lv2_rdf.hpp"

#ifdef USE_QT
# include <QtCore/QStringList>
#else


+ 11
- 0
source/utils/CarlaMathUtils.hpp View File

@@ -21,6 +21,7 @@
#include "CarlaUtils.hpp"

#include <cmath>
#include <limits>

// -----------------------------------------------------------------------
// math functions (base)
@@ -96,6 +97,16 @@ uint32_t carla_nextPowerOf2(uint32_t size) noexcept
return ++size;
}

/*
* Safely compare two floating point numbers.
*/
template<typename T>
static inline
bool carla_compareFloats(const T& v1, const T& v2)
{
return std::abs(v1-v2) < std::numeric_limits<T>::epsilon();
}

#if 0
// -----------------------------------------------------------------------
// math functions (extended)


+ 5
- 5
source/utils/CarlaStateUtils.cpp View File

@@ -506,15 +506,15 @@ String StateSave::toString() const

dataXml << " <Active>" << (active ? "Yes" : "No") << "</Active>\n";

if (dryWet != 1.0f)
if (! carla_compareFloats(dryWet, 1.0f))
dataXml << " <DryWet>" << String(dryWet, 7) << "</DryWet>\n";
if (volume != 1.0f)
if (! carla_compareFloats(volume, 1.0f))
dataXml << " <Volume>" << String(volume, 7) << "</Volume>\n";
if (balanceLeft != -1.0f)
if (! carla_compareFloats(balanceLeft, -1.0f))
dataXml << " <Balance-Left>" << String(balanceLeft, 7) << "</Balance-Left>\n";
if (balanceRight != 1.0f)
if (! carla_compareFloats(balanceRight, 1.0f))
dataXml << " <Balance-Right>" << String(balanceRight, 7) << "</Balance-Right>\n";
if (panning != 0.0f)
if (! carla_compareFloats(panning, 0.0f))
dataXml << " <Panning>" << String(panning, 7) << "</Panning>\n";

if (ctrlChannel < 0)


Loading…
Cancel
Save