Browse Source

Massive noexcept check; cleanup

tags/1.9.4
falkTX 11 years ago
parent
commit
7e56e3c7d5
20 changed files with 1751 additions and 5793 deletions
  1. +60
    -62
      source/backend/CarlaEngine.hpp
  2. +56
    -62
      source/backend/CarlaPlugin.hpp
  3. +345
    -384
      source/backend/engine/CarlaEngine.cpp
  4. +22
    -22
      source/backend/engine/CarlaEngineInternal.hpp
  5. +35
    -16
      source/backend/engine/CarlaEngineJack.cpp
  6. +37
    -49
      source/backend/engine/CarlaEngineOsc.cpp
  7. +1
    -1
      source/backend/engine/CarlaEngineOsc.hpp
  8. +26
    -23
      source/backend/plugin/BridgePlugin.cpp
  9. +79
    -78
      source/backend/plugin/CarlaPlugin.cpp
  10. +48
    -28
      source/backend/plugin/DssiPlugin.cpp
  11. +42
    -22
      source/backend/plugin/FluidSynthPlugin.cpp
  12. +34
    -22
      source/backend/plugin/LadspaPlugin.cpp
  13. +11
    -9
      source/backend/plugin/LinuxSamplerPlugin.cpp
  14. +833
    -4736
      source/backend/plugin/Lv2Plugin.cpp
  15. +65
    -41
      source/backend/plugin/NativePlugin.cpp
  16. +3
    -3
      source/modules/jackbridge/JackBridge.hpp
  17. +9
    -9
      source/modules/jackbridge/JackBridge2.cpp
  18. +0
    -207
      source/tests/CarlaBackendDummy.cpp
  19. +13
    -13
      source/utils/CarlaRingBuffer.hpp
  20. +32
    -6
      source/utils/LinkedList.hpp

+ 60
- 62
source/backend/CarlaEngine.hpp View File

@@ -618,13 +618,13 @@ public:
* Activate this client.\n * Activate this client.\n
* Client must be deactivated before calling this function. * Client must be deactivated before calling this function.
*/ */
virtual void activate();
virtual void activate() noexcept;


/*! /*!
* Deactivate this client.\n * Deactivate this client.\n
* Client must be activated before calling this function. * Client must be activated before calling this function.
*/ */
virtual void deactivate();
virtual void deactivate() noexcept;


/*! /*!
* Check if the client is activated. * Check if the client is activated.
@@ -920,15 +920,13 @@ public:


/*! /*!
* TODO. * TODO.
* \a id must be either 1 or 2.
*/ */
float getInputPeak(const unsigned int pluginId, const bool isLeft) const;
float getInputPeak(const unsigned int pluginId, const bool isLeft) const noexcept;


/*! /*!
* TODO. * TODO.
* \a id must be either 1 or 2.
*/ */
float getOutputPeak(const unsigned int pluginId, const bool isLeft) const;
float getOutputPeak(const unsigned int pluginId, const bool isLeft) const noexcept;


// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Callback // Callback
@@ -936,12 +934,12 @@ public:
/*! /*!
* TODO. * TODO.
*/ */
void callback(const EngineCallbackOpcode action, const unsigned int pluginId, const int value1, const int value2, const float value3, const char* const valueStr);
void callback(const EngineCallbackOpcode action, const unsigned int pluginId, const int value1, const int value2, const float value3, const char* const valueStr) noexcept;


/*! /*!
* TODO. * TODO.
*/ */
void setCallback(const EngineCallbackFunc func, void* const ptr);
void setCallback(const EngineCallbackFunc func, void* const ptr) noexcept;


#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
// ------------------------------------------------------------------- // -------------------------------------------------------------------
@@ -969,17 +967,17 @@ public:
/*! /*!
* Start playback of the engine transport. * Start playback of the engine transport.
*/ */
virtual void transportPlay();
virtual void transportPlay() noexcept;


/*! /*!
* Pause the engine transport. * Pause the engine transport.
*/ */
virtual void transportPause();
virtual void transportPause() noexcept;


/*! /*!
* Relocate the engine transport to \a frames. * Relocate the engine transport to \a frames.
*/ */
virtual void transportRelocate(const uint64_t frame);
virtual void transportRelocate(const uint64_t frame) noexcept;


// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Error handling // Error handling
@@ -1001,7 +999,7 @@ public:
* Tell the engine it's about to close.\n * Tell the engine it's about to close.\n
* This is used to prevent the engine thread(s) from reactivating. * This is used to prevent the engine thread(s) from reactivating.
*/ */
void setAboutToClose();
void setAboutToClose() noexcept;


// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Options // Options
@@ -1029,7 +1027,7 @@ public:
/*! /*!
* Idle OSC. * Idle OSC.
*/ */
void idleOsc();
void idleOsc() const noexcept;


/*! /*!
* Get OSC TCP server path. * Get OSC TCP server path.
@@ -1061,7 +1059,7 @@ public:
* Force register a plugin into slot \a id. \n * Force register a plugin into slot \a id. \n
* This is needed so we can receive OSC events for a plugin while it initializes. * This is needed so we can receive OSC events for a plugin while it initializes.
*/ */
void registerEnginePlugin(const unsigned int id, CarlaPlugin* const plugin);
void registerEnginePlugin(const unsigned int id, CarlaPlugin* const plugin) noexcept;


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


@@ -1096,7 +1094,7 @@ protected:
* Must always be called at the end of audio processing. * Must always be called at the end of audio processing.
* \note RT call * \note RT call
*/ */
void runPendingRtEvents();
void runPendingRtEvents() noexcept;


/*! /*!
* Set a plugin (stereo) peak values. * Set a plugin (stereo) peak values.
@@ -1159,55 +1157,55 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Bridge/Controller OSC stuff // Bridge/Controller OSC stuff


void oscSend_bridge_plugin_info1(const PluginCategory category, const uint hints, const long uniqueId) const;
void oscSend_bridge_plugin_info2(const char* const realName, const char* const label, const char* const maker, const char* const copyright) const;
void oscSend_bridge_audio_count(const uint32_t ins, const uint32_t outs) const;
void oscSend_bridge_midi_count(const uint32_t ins, const uint32_t outs) const;
void oscSend_bridge_parameter_count(const uint32_t ins, const uint32_t outs) const;
void oscSend_bridge_program_count(const uint32_t count) const;
void oscSend_bridge_midi_program_count(const uint32_t count) const;
void oscSend_bridge_parameter_data(const uint32_t index, const int32_t rindex, const ParameterType type, const uint hints, const char* const name, const char* const unit) const;
void oscSend_bridge_parameter_ranges1(const uint32_t index, const float def, const float min, const float max) const;
void oscSend_bridge_parameter_ranges2(const uint32_t index, const float step, const float stepSmall, const float stepLarge) const;
void oscSend_bridge_parameter_midi_cc(const uint32_t index, const int16_t cc) const;
void oscSend_bridge_parameter_midi_channel(const uint32_t index, const uint8_t channel) const;
void oscSend_bridge_parameter_value(const int32_t index, const float value) const; // may be used for internal params (< 0)
void oscSend_bridge_default_value(const uint32_t index, const float value) const;
void oscSend_bridge_current_program(const int32_t index) const;
void oscSend_bridge_current_midi_program(const int32_t index) const;
void oscSend_bridge_program_name(const uint32_t index, const char* const name) const;
void oscSend_bridge_midi_program_data(const uint32_t index, const uint32_t bank, const uint32_t program, const char* const name) const;
void oscSend_bridge_configure(const char* const key, const char* const value) const;
void oscSend_bridge_set_custom_data(const char* const type, const char* const key, const char* const value) const;
void oscSend_bridge_set_chunk_data(const char* const chunkFile) const;
void oscSend_bridge_set_peaks() const;
void oscSend_bridge_plugin_info1(const PluginCategory category, const uint hints, const long uniqueId) const noexcept;
void oscSend_bridge_plugin_info2(const char* const realName, const char* const label, const char* const maker, const char* const copyright) const noexcept;
void oscSend_bridge_audio_count(const uint32_t ins, const uint32_t outs) const noexcept;
void oscSend_bridge_midi_count(const uint32_t ins, const uint32_t outs) const noexcept;
void oscSend_bridge_parameter_count(const uint32_t ins, const uint32_t outs) const noexcept;
void oscSend_bridge_program_count(const uint32_t count) const noexcept;
void oscSend_bridge_midi_program_count(const uint32_t count) const noexcept;
void oscSend_bridge_parameter_data(const uint32_t index, const int32_t rindex, const ParameterType type, const uint hints, const char* const name, const char* const unit) const noexcept;
void oscSend_bridge_parameter_ranges1(const uint32_t index, const float def, const float min, const float max) const noexcept;
void oscSend_bridge_parameter_ranges2(const uint32_t index, const float step, const float stepSmall, const float stepLarge) const noexcept;
void oscSend_bridge_parameter_midi_cc(const uint32_t index, const int16_t cc) const noexcept;
void oscSend_bridge_parameter_midi_channel(const uint32_t index, const uint8_t channel) const noexcept;
void oscSend_bridge_parameter_value(const int32_t index, const float value) const noexcept; // may be used for internal params (< 0)
void oscSend_bridge_default_value(const uint32_t index, const float value) const noexcept;
void oscSend_bridge_current_program(const int32_t index) const noexcept;
void oscSend_bridge_current_midi_program(const int32_t index) const noexcept;
void oscSend_bridge_program_name(const uint32_t index, const char* const name) const noexcept;
void oscSend_bridge_midi_program_data(const uint32_t index, const uint32_t bank, const uint32_t program, const char* const name) const noexcept;
void oscSend_bridge_configure(const char* const key, const char* const value) const noexcept;
void oscSend_bridge_set_custom_data(const char* const type, const char* const key, const char* const value) const noexcept;
void oscSend_bridge_set_chunk_data(const char* const chunkFile) const noexcept;
void oscSend_bridge_set_peaks() const noexcept;
#else #else
public: public:
void oscSend_control_add_plugin_start(const uint pluginId, const char* const pluginName) const;
void oscSend_control_add_plugin_end(const uint pluginId) const;
void oscSend_control_remove_plugin(const uint pluginId) const;
void oscSend_control_set_plugin_info1(const uint pluginId, const PluginType type, const PluginCategory category, const uint hints, const long uniqueId) const;
void oscSend_control_set_plugin_info2(const uint pluginId, const char* const realName, const char* const label, const char* const maker, const char* const copyright) const;
void oscSend_control_set_audio_count(const uint pluginId, const uint32_t ins, const uint32_t outs) const;
void oscSend_control_set_midi_count(const uint pluginId, const uint32_t ins, const uint32_t outs) const;
void oscSend_control_set_parameter_count(const uint pluginId, const uint32_t ins, const uint32_t outs) const;
void oscSend_control_set_program_count(const uint pluginId, const uint32_t count) const;
void oscSend_control_set_midi_program_count(const uint pluginId, const uint32_t count) const;
void oscSend_control_set_parameter_data(const uint pluginId, const uint32_t index, const ParameterType type, const uint hints, const char* const name, const char* const unit) const;
void oscSend_control_set_parameter_ranges1(const uint pluginId, const uint32_t index, const float def, const float min, const float max) const;
void oscSend_control_set_parameter_ranges2(const uint pluginId, const uint32_t index, const float step, const float stepSmall, const float stepLarge) const;
void oscSend_control_set_parameter_midi_cc(const uint pluginId, const uint32_t index, const int16_t cc) const;
void oscSend_control_set_parameter_midi_channel(const uint pluginId, const uint32_t index, const uint8_t channel) const;
void oscSend_control_set_parameter_value(const uint pluginId, const int32_t index, const float value) const; // may be used for internal params (< 0)
void oscSend_control_set_default_value(const uint pluginId, const uint32_t index, const float value) const;
void oscSend_control_set_current_program(const uint pluginId, const int32_t index) const;
void oscSend_control_set_current_midi_program(const uint pluginId, const int32_t index) const;
void oscSend_control_set_program_name(const uint pluginId, const uint32_t index, const char* const name) const;
void oscSend_control_set_midi_program_data(const uint pluginId, const uint32_t index, const uint32_t bank, const uint32_t program, const char* const name) const;
void oscSend_control_note_on(const uint pluginId, const uint8_t channel, const uint8_t note, const uint8_t velo) const;
void oscSend_control_note_off(const uint pluginId, const uint8_t channel, const uint8_t note) const;
void oscSend_control_set_peaks(const uint pluginId) const;
void oscSend_control_exit() const;
void oscSend_control_add_plugin_start(const uint pluginId, const char* const pluginName) const noexcept;
void oscSend_control_add_plugin_end(const uint pluginId) const noexcept;
void oscSend_control_remove_plugin(const uint pluginId) const noexcept;
void oscSend_control_set_plugin_info1(const uint pluginId, const PluginType type, const PluginCategory category, const uint hints, const long uniqueId) const noexcept;
void oscSend_control_set_plugin_info2(const uint pluginId, const char* const realName, const char* const label, const char* const maker, const char* const copyright) const noexcept;
void oscSend_control_set_audio_count(const uint pluginId, const uint32_t ins, const uint32_t outs) const noexcept;
void oscSend_control_set_midi_count(const uint pluginId, const uint32_t ins, const uint32_t outs) const noexcept;
void oscSend_control_set_parameter_count(const uint pluginId, const uint32_t ins, const uint32_t outs) const noexcept;
void oscSend_control_set_program_count(const uint pluginId, const uint32_t count) const noexcept;
void oscSend_control_set_midi_program_count(const uint pluginId, const uint32_t count) const noexcept;
void oscSend_control_set_parameter_data(const uint pluginId, const uint32_t index, const ParameterType type, const uint hints, const char* const name, const char* const unit) const noexcept;
void oscSend_control_set_parameter_ranges1(const uint pluginId, const uint32_t index, const float def, const float min, const float max) const noexcept;
void oscSend_control_set_parameter_ranges2(const uint pluginId, const uint32_t index, const float step, const float stepSmall, const float stepLarge) const noexcept;
void oscSend_control_set_parameter_midi_cc(const uint pluginId, const uint32_t index, const int16_t cc) const noexcept;
void oscSend_control_set_parameter_midi_channel(const uint pluginId, const uint32_t index, const uint8_t channel) const noexcept;
void oscSend_control_set_parameter_value(const uint pluginId, const int32_t index, const float value) const noexcept; // may be used for internal params (< 0)
void oscSend_control_set_default_value(const uint pluginId, const uint32_t index, const float value) const noexcept;
void oscSend_control_set_current_program(const uint pluginId, const int32_t index) const noexcept;
void oscSend_control_set_current_midi_program(const uint pluginId, const int32_t index) const noexcept;
void oscSend_control_set_program_name(const uint pluginId, const uint32_t index, const char* const name) const noexcept;
void oscSend_control_set_midi_program_data(const uint pluginId, const uint32_t index, const uint32_t bank, const uint32_t program, const char* const name) const noexcept;
void oscSend_control_note_on(const uint pluginId, const uint8_t channel, const uint8_t note, const uint8_t velo) const noexcept;
void oscSend_control_note_off(const uint pluginId, const uint8_t channel, const uint8_t note) const noexcept;
void oscSend_control_set_peaks(const uint pluginId) const noexcept;
void oscSend_control_exit() const noexcept;
#endif #endif


CARLA_DECLARE_NON_COPY_CLASS(CarlaEngine) CARLA_DECLARE_NON_COPY_CLASS(CarlaEngine)


+ 56
- 62
source/backend/CarlaPlugin.hpp View File

@@ -148,19 +148,13 @@ public:
/*! /*!
* Get the plugin's category (delay, filter, synth, etc). * Get the plugin's category (delay, filter, synth, etc).
*/ */
virtual PluginCategory getCategory() const
{
return PLUGIN_CATEGORY_NONE;
}
virtual PluginCategory getCategory() const noexcept;


/*! /*!
* Get the plugin's native unique Id.\n * Get the plugin's native unique Id.\n
* May return 0 on plugin types that don't support Ids. * May return 0 on plugin types that don't support Ids.
*/ */
virtual long getUniqueId() const
{
return 0;
}
virtual long getUniqueId() const noexcept;


/*! /*!
* Get the plugin's latency, in sample frames. * Get the plugin's latency, in sample frames.
@@ -199,7 +193,7 @@ public:
/*! /*!
* 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;
virtual uint32_t getParameterScalePointCount(const uint32_t parameterId) const noexcept;


/*! /*!
* Get the number of programs. * Get the number of programs.
@@ -237,31 +231,31 @@ public:
/*! /*!
* Get the parameter data of \a parameterId. * Get the parameter data of \a parameterId.
*/ */
const ParameterData& getParameterData(const uint32_t parameterId) const;
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;
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;
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;
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;
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.
@@ -271,7 +265,7 @@ public:
* *
* \see setChunkData() * \see setChunkData()
*/ */
virtual int32_t getChunkData(void** const dataPtr) const;
virtual int32_t getChunkData(void** const dataPtr) const noexcept;


// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Information (per-plugin data) // Information (per-plugin data)
@@ -281,76 +275,76 @@ public:
* *
* \see PluginOptions, getOptions() and setOption() * \see PluginOptions, getOptions() and setOption()
*/ */
virtual unsigned int getOptionsAvailable() const;
virtual unsigned int 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;
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;
virtual float getParameterScalePointValue(const uint32_t parameterId, const uint32_t scalePointId) const noexcept;


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


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


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


/*! /*!
* Get the plugin's (real) name. * Get the plugin's (real) name.
* *
* \see getName() and setName() * \see getName() and setName()
*/ */
virtual void getRealName(char* const strBuf) const;
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;
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;
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, const float value, char* const strBuf) const;
virtual void getParameterText(const uint32_t parameterId, const float value, 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;
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;
virtual void getParameterScalePointLabel(const uint32_t parameterId, const uint32_t scalePointId, char* const strBuf) 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;
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;
void getMidiProgramName(const uint32_t index, char* const strBuf) const noexcept;


/*! /*!
* Get information about the plugin's parameter count.\n * Get information about the plugin's parameter count.\n
@@ -429,7 +423,7 @@ public:
* *
* \see isEnabled() * \see isEnabled()
*/ */
void setEnabled(const bool yesNo);
void setEnabled(const bool yesNo) noexcept;


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


#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
/*! /*!
@@ -447,7 +441,7 @@ public:
* \param sendOsc Send message change over OSC * \param sendOsc Send message change over OSC
* \param sendCallback Send message change to registered callback * \param sendCallback Send message change to registered callback
*/ */
void setDryWet(const float value, const bool sendOsc, const bool sendCallback);
void setDryWet(const float value, const bool sendOsc, const bool sendCallback) noexcept;


/*! /*!
* Set the plugin's output volume to \a value.\n * Set the plugin's output volume to \a value.\n
@@ -456,7 +450,7 @@ public:
* \param sendOsc Send message change over OSC * \param sendOsc Send message change over OSC
* \param sendCallback Send message change to registered callback * \param sendCallback Send message change to registered callback
*/ */
void setVolume(const float value, const bool sendOsc, const bool sendCallback);
void setVolume(const float value, const bool sendOsc, const bool sendCallback) noexcept;


/*! /*!
* Set the plugin's output left balance value to \a value.\n * Set the plugin's output left balance value to \a value.\n
@@ -467,7 +461,7 @@ public:
* *
* \note Pure-Stereo plugins only! * \note Pure-Stereo plugins only!
*/ */
void setBalanceLeft(const float value, const bool sendOsc, const bool sendCallback);
void setBalanceLeft(const float value, const bool sendOsc, const bool sendCallback) noexcept;


/*! /*!
* Set the plugin's output right balance value to \a value.\n * Set the plugin's output right balance value to \a value.\n
@@ -478,7 +472,7 @@ public:
* *
* \note Pure-Stereo plugins only! * \note Pure-Stereo plugins only!
*/ */
void setBalanceRight(const float value, const bool sendOsc, const bool sendCallback);
void setBalanceRight(const float value, const bool sendOsc, const bool sendCallback) noexcept;


/*! /*!
* Set the plugin's output panning value to \a value.\n * Set the plugin's output panning value to \a value.\n
@@ -489,7 +483,7 @@ public:
* *
* \note Force-Stereo plugins only! * \note Force-Stereo plugins only!
*/ */
void setPanning(const float value, const bool sendOsc, const bool sendCallback);
void setPanning(const float value, const bool sendOsc, const bool sendCallback) noexcept;
#endif #endif


/*! /*!
@@ -498,7 +492,7 @@ public:
* \param sendOsc Send message change over OSC * \param sendOsc Send message change over OSC
* \param sendCallback Send message change to registered callback * \param sendCallback Send message change to registered callback
*/ */
virtual void setCtrlChannel(const int8_t channel, const bool sendOsc, const bool sendCallback);
virtual void setCtrlChannel(const int8_t channel, const bool sendOsc, const bool sendCallback) noexcept;


// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Set data (plugin-specific stuff) // Set data (plugin-specific stuff)
@@ -514,7 +508,7 @@ public:
* *
* \see getParameterValue() * \see getParameterValue()
*/ */
virtual void setParameterValue(const uint32_t parameterId, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback);
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 * Set a plugin's parameter value, including internal parameters.\n
@@ -527,19 +521,19 @@ public:
* \see setBalanceLeft() * \see setBalanceLeft()
* \see setBalanceRight() * \see setBalanceRight()
*/ */
void setParameterValueByRealIndex(const int32_t rindex, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback);
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 * Set parameter's \a parameterId MIDI channel to \a channel.\n
* \a channel must be between 0 and 15. * \a channel must be between 0 and 15.
*/ */
void setParameterMidiChannel(const uint32_t parameterId, uint8_t channel, const bool sendOsc, const bool sendCallback);
void setParameterMidiChannel(const uint32_t parameterId, uint8_t channel, const bool sendOsc, const bool sendCallback) noexcept;


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


/*! /*!
* Add a custom data set.\n * Add a custom data set.\n
@@ -576,7 +570,7 @@ public:
* \param sendCallback Send message change to registered callback * \param sendCallback Send message change to registered callback
* \param block Block the audio callback * \param block Block the audio callback
*/ */
virtual void setProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback);
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.
@@ -590,13 +584,13 @@ public:
* \param sendCallback Send message change to registered callback * \param sendCallback Send message change to registered callback
* \param block Block the audio callback * \param block Block the audio callback
*/ */
virtual void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback);
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 * This is an overloaded call to setMidiProgram().\n
* It changes the current MIDI program using \a bank and \a program values instead of index. * 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);
void setMidiProgramById(const uint32_t bank, const uint32_t program, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept;


// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Set gui stuff // Set gui stuff
@@ -635,12 +629,12 @@ public:
/*! /*!
* Plugin activate call. * Plugin activate call.
*/ */
virtual void activate();
virtual void activate() noexcept;


/*! /*!
* Plugin activate call. * Plugin activate call.
*/ */
virtual void deactivate();
virtual void deactivate() noexcept;


/*! /*!
* Plugin process call. * Plugin process call.
@@ -673,12 +667,12 @@ public:
* Try to lock the plugin's master mutex. * Try to lock the plugin's master mutex.
* @param forcedOffline When true, always locks and returns true * @param forcedOffline When true, always locks and returns true
*/ */
bool tryLock(const bool forcedOffline);
bool tryLock(const bool forcedOffline) noexcept;


/*! /*!
* Unlock the plugin's master mutex. * Unlock the plugin's master mutex.
*/ */
void unlock();
void unlock() noexcept;


// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Plugin buffers // Plugin buffers
@@ -699,7 +693,7 @@ public:
/*! /*!
* Register this plugin to the engine's OSC client (controller or bridge). * Register this plugin to the engine's OSC client (controller or bridge).
*/ */
void registerToOscClient();
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.\n
@@ -732,7 +726,7 @@ public:


/*! /*!
* Send all midi notes off to the host callback.\n * Send all midi notes off to the host callback.\n
* This doesn't send the actual MIDI All-Notes-Off event, but 128 note-offs instead (ONLY IF ctrlChannel is valid).
* 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(); void sendMidiAllNotesOffToCallback();
@@ -752,27 +746,27 @@ public:
/*! /*!
* Tell the UI a parameter has changed. * Tell the UI a parameter has changed.
*/ */
virtual void uiParameterChange(const uint32_t index, const float value);
virtual void uiParameterChange(const uint32_t index, const float value) noexcept;


/*! /*!
* Tell the UI the current program has changed. * Tell the UI the current program has changed.
*/ */
virtual void uiProgramChange(const uint32_t index);
virtual void uiProgramChange(const uint32_t index) noexcept;


/*! /*!
* Tell the UI the current midi program has changed. * Tell the UI the current midi program has changed.
*/ */
virtual void uiMidiProgramChange(const uint32_t index);
virtual void uiMidiProgramChange(const uint32_t index) noexcept;


/*! /*!
* Tell the UI a note has been pressed. * Tell the UI a note has been pressed.
*/ */
virtual void uiNoteOn(const uint8_t channel, const uint8_t note, const uint8_t velo);
virtual void uiNoteOn(const uint8_t channel, const uint8_t note, const uint8_t velo) noexcept;


/*! /*!
* Tell the UI a note has been released. * Tell the UI a note has been released.
*/ */
virtual void uiNoteOff(const uint8_t channel, const uint8_t note);
virtual void uiNoteOff(const uint8_t channel, const uint8_t note) noexcept;


// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Helper functions // Helper functions
@@ -815,7 +809,7 @@ public:
} }


/*! /*!
* Handy function used and required by CarlaEngine::clonePlugin().
* Handy function required by CarlaEngine::clonePlugin().
*/ */
virtual const void* getExtraStuff() const noexcept virtual const void* getExtraStuff() const noexcept
{ {
@@ -831,8 +825,8 @@ public:
const char* const label; const char* const label;
}; };


static size_t getNativePluginCount();
static const NativePluginDescriptor* getNativePluginDescriptor(const size_t index);
static size_t getNativePluginCount() noexcept;
static const NativePluginDescriptor* getNativePluginDescriptor(const size_t index) noexcept;


static CarlaPlugin* newNative(const Initializer& init); static CarlaPlugin* newNative(const Initializer& init);
static CarlaPlugin* newBridge(const Initializer& init, const BinaryType btype, const PluginType ptype, const char* const bridgeBinary); static CarlaPlugin* newBridge(const Initializer& init, const BinaryType btype, const PluginType ptype, const char* const bridgeBinary);
@@ -871,8 +865,8 @@ protected:
class ScopedDisabler class ScopedDisabler
{ {
public: public:
ScopedDisabler(CarlaPlugin* const plugin);
~ScopedDisabler();
ScopedDisabler(CarlaPlugin* const plugin) noexcept;
~ScopedDisabler() noexcept;


private: private:
CarlaPlugin* const fPlugin; CarlaPlugin* const fPlugin;
@@ -889,8 +883,8 @@ protected:
class ScopedSingleProcessLocker class ScopedSingleProcessLocker
{ {
public: public:
ScopedSingleProcessLocker(CarlaPlugin* const plugin, const bool block);
~ScopedSingleProcessLocker();
ScopedSingleProcessLocker(CarlaPlugin* const plugin, const bool block) noexcept;
~ScopedSingleProcessLocker() noexcept;


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


+ 345
- 384
source/backend/engine/CarlaEngine.cpp
File diff suppressed because it is too large
View File


+ 22
- 22
source/backend/engine/CarlaEngineInternal.hpp View File

@@ -61,7 +61,7 @@ CARLA_BACKEND_START_NAMESPACE
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------


static inline static inline
const char* EngineType2Str(const EngineType type)
const char* EngineType2Str(const EngineType type) noexcept
{ {
switch (type) switch (type)
{ {
@@ -84,7 +84,7 @@ const char* EngineType2Str(const EngineType type)
} }


static inline static inline
const char* EnginePortType2Str(const EnginePortType type)
const char* EnginePortType2Str(const EnginePortType type) noexcept
{ {
switch (type) switch (type)
{ {
@@ -103,7 +103,7 @@ const char* EnginePortType2Str(const EnginePortType type)
} }


static inline static inline
const char* EngineEventType2Str(const EngineEventType type)
const char* EngineEventType2Str(const EngineEventType type) noexcept
{ {
switch (type) switch (type)
{ {
@@ -120,7 +120,7 @@ const char* EngineEventType2Str(const EngineEventType type)
} }


static inline static inline
const char* EngineControlEventType2Str(const EngineControlEventType type)
const char* EngineControlEventType2Str(const EngineControlEventType type) noexcept
{ {
switch (type) switch (type)
{ {
@@ -158,10 +158,10 @@ struct EnginePluginData {
float insPeak[2]; float insPeak[2];
float outsPeak[2]; float outsPeak[2];


void clear()
void clear() noexcept
{ {
plugin = nullptr; plugin = nullptr;
insPeak[0] = insPeak[1] = 0.0f;
insPeak[0] = insPeak[1] = 0.0f;
outsPeak[0] = outsPeak[1] = 0.0f; outsPeak[0] = outsPeak[1] = 0.0f;
} }
}; };
@@ -346,13 +346,13 @@ struct CarlaEngineProtectedData {
rack = nullptr; rack = nullptr;
} }


~InternalAudio()
~InternalAudio() noexcept
{ {
CARLA_ASSERT(! isReady); CARLA_ASSERT(! isReady);
CARLA_ASSERT(rack == nullptr); CARLA_ASSERT(rack == nullptr);
} }


void initPatchbay()
void initPatchbay() noexcept
{ {
if (usePatchbay) if (usePatchbay)
{ {
@@ -427,7 +427,7 @@ struct CarlaEngineProtectedData {
: in(nullptr), : in(nullptr),
out(nullptr) {} out(nullptr) {}


~InternalEvents()
~InternalEvents() noexcept
{ {
CARLA_ASSERT(in == nullptr); CARLA_ASSERT(in == nullptr);
CARLA_ASSERT(out == nullptr); CARLA_ASSERT(out == nullptr);
@@ -454,7 +454,7 @@ struct CarlaEngineProtectedData {
pluginId(0), pluginId(0),
value(0) {} value(0) {}


~NextAction()
~NextAction() noexcept
{ {
CARLA_ASSERT(opcode == kEnginePostActionNull); CARLA_ASSERT(opcode == kEnginePostActionNull);
} }
@@ -486,7 +486,7 @@ struct CarlaEngineProtectedData {
CARLA_DECLARE_NON_COPY_STRUCT(CarlaEngineProtectedData) CARLA_DECLARE_NON_COPY_STRUCT(CarlaEngineProtectedData)
#endif #endif


~CarlaEngineProtectedData()
~CarlaEngineProtectedData() noexcept
{ {
CARLA_ASSERT(curPluginCount == 0); CARLA_ASSERT(curPluginCount == 0);
CARLA_ASSERT(maxPluginNumber == 0); CARLA_ASSERT(maxPluginNumber == 0);
@@ -494,10 +494,10 @@ struct CarlaEngineProtectedData {
CARLA_ASSERT(plugins == nullptr); CARLA_ASSERT(plugins == nullptr);
} }


void doPluginRemove()
void doPluginRemove() noexcept
{ {
CARLA_ASSERT(curPluginCount > 0);
CARLA_ASSERT(nextAction.pluginId < curPluginCount);
CARLA_SAFE_ASSERT_RETURN(curPluginCount > 0,);
CARLA_SAFE_ASSERT_RETURN(nextAction.pluginId < curPluginCount,);
--curPluginCount; --curPluginCount;


// move all plugins 1 spot backwards // move all plugins 1 spot backwards
@@ -526,17 +526,17 @@ struct CarlaEngineProtectedData {
plugins[id].outsPeak[1] = 0.0f; plugins[id].outsPeak[1] = 0.0f;
} }


void doPluginsSwitch()
void doPluginsSwitch() noexcept
{ {
CARLA_ASSERT(curPluginCount >= 2);
CARLA_SAFE_ASSERT_RETURN(curPluginCount >= 2,);


const unsigned int idA(nextAction.pluginId); const unsigned int idA(nextAction.pluginId);
const unsigned int idB(nextAction.value); const unsigned int idB(nextAction.value);


CARLA_ASSERT(idA < curPluginCount);
CARLA_ASSERT(idB < curPluginCount);
CARLA_ASSERT(plugins[idA].plugin != nullptr);
CARLA_ASSERT(plugins[idB].plugin != nullptr);
CARLA_SAFE_ASSERT_RETURN(idA < curPluginCount,);
CARLA_SAFE_ASSERT_RETURN(idB < curPluginCount,);
CARLA_SAFE_ASSERT_RETURN(plugins[idA].plugin != nullptr,);
CARLA_SAFE_ASSERT_RETURN(plugins[idB].plugin != nullptr,);


#if 0 #if 0
std::swap(plugins[idA].plugin, plugins[idB].plugin); std::swap(plugins[idA].plugin, plugins[idB].plugin);
@@ -584,12 +584,12 @@ struct CarlaEngineProtectedData {
class ScopedActionLock class ScopedActionLock
{ {
public: public:
ScopedActionLock(CarlaEngineProtectedData* const data, const EnginePostAction action, const unsigned int pluginId, const unsigned int value, const bool lockWait)
ScopedActionLock(CarlaEngineProtectedData* const data, const EnginePostAction action, const unsigned int pluginId, const unsigned int value, const bool lockWait) noexcept
: fData(data) : fData(data)
{ {
fData->nextAction.mutex.lock(); fData->nextAction.mutex.lock();


CARLA_ASSERT(fData->nextAction.opcode == kEnginePostActionNull);
CARLA_SAFE_ASSERT_RETURN(fData->nextAction.opcode == kEnginePostActionNull,);


fData->nextAction.opcode = action; fData->nextAction.opcode = action;
fData->nextAction.pluginId = pluginId; fData->nextAction.pluginId = pluginId;


+ 35
- 16
source/backend/engine/CarlaEngineJack.cpp View File

@@ -329,7 +329,7 @@ public:
jackbridge_client_close(fClient); jackbridge_client_close(fClient);
} }


void activate() override
void activate() noexcept override
{ {
carla_debug("CarlaEngineJackClient::activate()"); carla_debug("CarlaEngineJackClient::activate()");


@@ -337,13 +337,15 @@ public:
{ {
CARLA_SAFE_ASSERT_RETURN(fClient != nullptr && ! fActive,); CARLA_SAFE_ASSERT_RETURN(fClient != nullptr && ! fActive,);


jackbridge_activate(fClient);
try {
jackbridge_activate(fClient);
} catch(...) {}
} }


CarlaEngineClient::activate(); CarlaEngineClient::activate();
} }


void deactivate() override
void deactivate() noexcept override
{ {
carla_debug("CarlaEngineJackClient::deactivate()"); carla_debug("CarlaEngineJackClient::deactivate()");


@@ -351,7 +353,9 @@ public:
{ {
CARLA_SAFE_ASSERT_RETURN(fClient != nullptr && fActive,); CARLA_SAFE_ASSERT_RETURN(fClient != nullptr && fActive,);


jackbridge_deactivate(fClient);
try {
jackbridge_deactivate(fClient);
} catch(...) {}
} }


CarlaEngineClient::deactivate(); CarlaEngineClient::deactivate();
@@ -922,28 +926,43 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Transport // Transport


void transportPlay() override
void transportPlay() noexcept override
{ {
if (pData->options.transportMode == ENGINE_TRANSPORT_MODE_INTERNAL) if (pData->options.transportMode == ENGINE_TRANSPORT_MODE_INTERNAL)
CarlaEngine::transportPlay();
else if (fClient != nullptr)
jackbridge_transport_start(fClient);
return CarlaEngine::transportPlay();

if (fClient != nullptr)
{
try {
jackbridge_transport_start(fClient);
} catch(...) {}
}
} }


void transportPause() override
void transportPause() noexcept override
{ {
if (pData->options.transportMode == ENGINE_TRANSPORT_MODE_INTERNAL) if (pData->options.transportMode == ENGINE_TRANSPORT_MODE_INTERNAL)
CarlaEngine::transportPause();
else if (fClient != nullptr)
jackbridge_transport_stop(fClient);
return CarlaEngine::transportPause();

if (fClient != nullptr)
{
try {
jackbridge_transport_stop(fClient);
} catch(...) {}
}
} }


void transportRelocate(const uint64_t frame) override
void transportRelocate(const uint64_t frame) noexcept override
{ {
if (pData->options.transportMode == ENGINE_TRANSPORT_MODE_INTERNAL) if (pData->options.transportMode == ENGINE_TRANSPORT_MODE_INTERNAL)
CarlaEngine::transportRelocate(frame);
else if (fClient != nullptr)
jackbridge_transport_locate(fClient, static_cast<jack_nframes_t>(frame));
return CarlaEngine::transportRelocate(frame);

if (fClient != nullptr)
{
try {
jackbridge_transport_locate(fClient, static_cast<jack_nframes_t>(frame));
} catch(...) {}
}
} }
#endif #endif




+ 37
- 49
source/backend/engine/CarlaEngineOsc.cpp View File

@@ -28,7 +28,7 @@ CARLA_BACKEND_START_NAMESPACE


#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Bridge Helper, defined in CarlaPlugin.cpp
// Bridge Helper, defined in BridgePlugin.cpp


extern int CarlaPluginSetOscBridgeInfo(CarlaPlugin* const plugin, const PluginBridgeInfoType type, extern int CarlaPluginSetOscBridgeInfo(CarlaPlugin* const plugin, const PluginBridgeInfoType type,
const int argc, const lo_arg* const* const argv, const char* const types); const int argc, const lo_arg* const* const argv, const char* const types);
@@ -41,31 +41,31 @@ CarlaEngineOsc::CarlaEngineOsc(CarlaEngine* const engine)
fServerTCP(nullptr), fServerTCP(nullptr),
fServerUDP(nullptr) fServerUDP(nullptr)
{ {
carla_debug("CarlaEngineOsc::CarlaEngineOsc(%p)", engine);
CARLA_ASSERT(engine != nullptr); CARLA_ASSERT(engine != nullptr);
carla_debug("CarlaEngineOsc::CarlaEngineOsc(%p)", engine);
} }


CarlaEngineOsc::~CarlaEngineOsc() CarlaEngineOsc::~CarlaEngineOsc()
{ {
carla_debug("CarlaEngineOsc::~CarlaEngineOsc()");
CARLA_ASSERT(fName.isEmpty()); CARLA_ASSERT(fName.isEmpty());
CARLA_ASSERT(fServerPathTCP.isEmpty()); CARLA_ASSERT(fServerPathTCP.isEmpty());
CARLA_ASSERT(fServerPathUDP.isEmpty()); CARLA_ASSERT(fServerPathUDP.isEmpty());
CARLA_ASSERT(fServerTCP == nullptr); CARLA_ASSERT(fServerTCP == nullptr);
CARLA_ASSERT(fServerUDP == nullptr); CARLA_ASSERT(fServerUDP == nullptr);
carla_debug("CarlaEngineOsc::~CarlaEngineOsc()");
} }


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


void CarlaEngineOsc::init(const char* const name) void CarlaEngineOsc::init(const char* const name)
{ {
CARLA_SAFE_ASSERT_RETURN(fName.isEmpty(),);
CARLA_SAFE_ASSERT_RETURN(fServerPathTCP.isEmpty(),);
CARLA_SAFE_ASSERT_RETURN(fServerPathUDP.isEmpty(),);
CARLA_SAFE_ASSERT_RETURN(fServerTCP == nullptr,);
CARLA_SAFE_ASSERT_RETURN(fServerUDP == nullptr,);
CARLA_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0',);
carla_debug("CarlaEngineOsc::init(\"%s\")", name); carla_debug("CarlaEngineOsc::init(\"%s\")", name);
CARLA_ASSERT(fName.isEmpty());
CARLA_ASSERT(fServerPathTCP.isEmpty());
CARLA_ASSERT(fServerPathUDP.isEmpty());
CARLA_ASSERT(fServerTCP == nullptr);
CARLA_ASSERT(fServerUDP == nullptr);
CARLA_ASSERT(name != nullptr);


fName = name; fName = name;
fName.toBasic(); fName.toBasic();
@@ -99,13 +99,13 @@ void CarlaEngineOsc::init(const char* const name)
} }


CARLA_ASSERT(fName.isNotEmpty()); CARLA_ASSERT(fName.isNotEmpty());
CARLA_ASSERT(fServerPathTCP.isNotEmpty());
CARLA_ASSERT(fServerPathUDP.isNotEmpty());
CARLA_ASSERT(fServerTCP != nullptr);
CARLA_ASSERT(fServerUDP != nullptr);
CARLA_SAFE_ASSERT(fServerPathTCP.isNotEmpty());
CARLA_SAFE_ASSERT(fServerPathUDP.isNotEmpty());
CARLA_SAFE_ASSERT(fServerTCP != nullptr);
CARLA_SAFE_ASSERT(fServerUDP != nullptr);
} }


void CarlaEngineOsc::idle()
void CarlaEngineOsc::idle() const
{ {
if (fServerTCP != nullptr) if (fServerTCP != nullptr)
{ {
@@ -120,12 +120,12 @@ void CarlaEngineOsc::idle()


void CarlaEngineOsc::close() void CarlaEngineOsc::close()
{ {
carla_debug("CarlaEngineOsc::close()");
CARLA_ASSERT(fName.isNotEmpty()); CARLA_ASSERT(fName.isNotEmpty());
CARLA_ASSERT(fServerPathTCP.isNotEmpty());
CARLA_ASSERT(fServerPathUDP.isNotEmpty());
CARLA_ASSERT(fServerTCP != nullptr);
CARLA_ASSERT(fServerUDP != nullptr);
CARLA_SAFE_ASSERT(fServerPathTCP.isNotEmpty());
CARLA_SAFE_ASSERT(fServerPathUDP.isNotEmpty());
CARLA_SAFE_ASSERT(fServerTCP != nullptr);
CARLA_SAFE_ASSERT(fServerUDP != nullptr);
carla_debug("CarlaEngineOsc::close()");


fName.clear(); fName.clear();


@@ -149,12 +149,6 @@ void CarlaEngineOsc::close()
#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
fControlData.free(); fControlData.free();
#endif #endif

CARLA_ASSERT(fName.isEmpty());
CARLA_ASSERT(fServerPathTCP.isEmpty());
CARLA_ASSERT(fServerPathUDP.isEmpty());
CARLA_ASSERT(fServerTCP == nullptr);
CARLA_ASSERT(fServerUDP == nullptr);
} }


// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
@@ -166,24 +160,19 @@ bool isDigit(const char c)


int CarlaEngineOsc::handleMessage(const bool isTCP, const char* const path, const int argc, const lo_arg* const* const argv, const char* const types, const lo_message msg) int CarlaEngineOsc::handleMessage(const bool isTCP, const char* const path, const int argc, const lo_arg* const* const argv, const char* const types, const lo_message msg)
{ {
CARLA_ASSERT(fName.isNotEmpty());
CARLA_ASSERT(fServerPathTCP.isNotEmpty());
CARLA_ASSERT(fServerPathUDP.isNotEmpty());
CARLA_ASSERT(fServerTCP != nullptr);
CARLA_ASSERT(fServerUDP != nullptr);
CARLA_ASSERT(path != nullptr);
CARLA_SAFE_ASSERT_RETURN(fName.isNotEmpty(), 1);
CARLA_SAFE_ASSERT_RETURN(path != nullptr && path[0] != '\0', 1);
carla_debug("CarlaEngineOsc::handleMessage(%s, \"%s\", %i, %p, \"%s\", %p)", bool2str(isTCP), path, argc, argv, types, msg); carla_debug("CarlaEngineOsc::handleMessage(%s, \"%s\", %i, %p, \"%s\", %p)", bool2str(isTCP), path, argc, argv, types, msg);


if (path == nullptr)
if (isTCP)
{ {
carla_stderr("CarlaEngineOsc::handleMessage() - got invalid path");
return 1;
CARLA_SAFE_ASSERT_RETURN(fServerPathTCP.isNotEmpty(), 1);
CARLA_SAFE_ASSERT_RETURN(fServerTCP != nullptr, 1);
} }

if (fName.isEmpty())
else
{ {
carla_stderr("CarlaEngineOsc::handleMessage(%s, \"%s\", ...) - received message but client is offline", bool2str(isTCP), path);
return 1;
CARLA_SAFE_ASSERT_RETURN(fServerPathUDP.isNotEmpty(), 1);
CARLA_SAFE_ASSERT_RETURN(fServerUDP != nullptr, 1);
} }


#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
@@ -199,18 +188,16 @@ int CarlaEngineOsc::handleMessage(const bool isTCP, const char* const path, cons
} }
#endif #endif


const size_t nameSize = fName.length();
const size_t nameSize(fName.length());


// Check if message is for this client // Check if message is for this client
if (std::strlen(path) <= nameSize || std::strncmp(path+1, (const char*)fName, nameSize) != 0)
if (std::strlen(path) <= nameSize || std::strncmp(path+1, fName.getBuffer(), nameSize) != 0)
{ {
carla_stderr("CarlaEngineOsc::handleMessage() - message not for this client -> '%s' != '/%s/'", path, (const char*)fName);
carla_stderr("CarlaEngineOsc::handleMessage() - message not for this client -> '%s' != '/%s/'", path, fName.getBuffer());
return 1; return 1;
} }


// Get plugin id from message
// eg, /carla/23/method

// Get plugin id from path, "/carla/23/method" -> 23
unsigned int pluginId = 0; unsigned int pluginId = 0;
size_t offset; size_t offset;


@@ -220,7 +207,7 @@ int CarlaEngineOsc::handleMessage(const bool isTCP, const char* const path, cons
{ {
if (isDigit(path[nameSize+5])) if (isDigit(path[nameSize+5]))
{ {
carla_stderr2("CarlaEngineOsc::handleMessage() - invalid plugin id, over 999? (value: \"%s\")", path+nameSize+1);
carla_stderr2("CarlaEngineOsc::handleMessage() - invalid plugin id, over 999? (value: \"%s\")", path+(nameSize+1));
return 1; return 1;
} }
else if (isDigit(path[nameSize+4])) else if (isDigit(path[nameSize+4]))
@@ -259,7 +246,7 @@ int CarlaEngineOsc::handleMessage(const bool isTCP, const char* const path, cons
} }


// Get plugin // Get plugin
CarlaPlugin* const plugin = fEngine->getPluginUnchecked(pluginId);
CarlaPlugin* const plugin(fEngine->getPluginUnchecked(pluginId));


if (plugin == nullptr || plugin->getId() != pluginId) if (plugin == nullptr || plugin->getId() != pluginId)
{ {
@@ -268,7 +255,8 @@ int CarlaEngineOsc::handleMessage(const bool isTCP, const char* const path, cons
} }


// Get method from path, "/Carla/i/method" -> "method" // Get method from path, "/Carla/i/method" -> "method"
char method[32] = { 0 };
char method[32];
carla_zeroChar(method, 32);
std::strncpy(method, path + (nameSize + offset), 31); std::strncpy(method, path + (nameSize + offset), 31);


if (method[0] == '\0') if (method[0] == '\0')
@@ -280,7 +268,7 @@ int CarlaEngineOsc::handleMessage(const bool isTCP, const char* const path, cons
// Common OSC methods (DSSI and bridge UIs) // Common OSC methods (DSSI and bridge UIs)
if (std::strcmp(method, "update") == 0) if (std::strcmp(method, "update") == 0)
{ {
const lo_address source = lo_message_get_source(msg);
const lo_address source(lo_message_get_source(msg));
return handleMsgUpdate(plugin, argc, argv, types, source); return handleMsgUpdate(plugin, argc, argv, types, source);
} }
if (std::strcmp(method, "configure") == 0) if (std::strcmp(method, "configure") == 0)
@@ -324,7 +312,7 @@ int CarlaEngineOsc::handleMessage(const bool isTCP, const char* const path, cons
return handleMsgNoteOff(plugin, argc, argv, types); return handleMsgNoteOff(plugin, argc, argv, types);


// Plugin Bridges // Plugin Bridges
if ((plugin->getHints() & PLUGIN_IS_BRIDGE) > 0 && std::strlen(method) > 11 && std::strncmp(method, "bridge_", 7) == 0)
if ((plugin->getHints() & PLUGIN_IS_BRIDGE) != 0 && std::strlen(method) > 11 && std::strncmp(method, "bridge_", 7) == 0)
{ {
if (std::strcmp(method+7, "audio_count") == 0) if (std::strcmp(method+7, "audio_count") == 0)
return CarlaPluginSetOscBridgeInfo(plugin, kPluginBridgeAudioCount, argc, argv, types); return CarlaPluginSetOscBridgeInfo(plugin, kPluginBridgeAudioCount, argc, argv, types);


+ 1
- 1
source/backend/engine/CarlaEngineOsc.hpp View File

@@ -61,7 +61,7 @@ public:
~CarlaEngineOsc(); ~CarlaEngineOsc();


void init(const char* const name); void init(const char* const name);
void idle();
void idle() const;
void close(); void close();


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


+ 26
- 23
source/backend/plugin/BridgePlugin.cpp View File

@@ -212,17 +212,14 @@ struct BridgeControl : public RingBufferControl {


bool waitForServer() bool waitForServer()
{ {
CARLA_ASSERT(data != nullptr);

if (data == nullptr)
return false;
CARLA_SAFE_ASSERT_RETURN(data != nullptr, false);


jackbridge_sem_post(&data->runServer); jackbridge_sem_post(&data->runServer);


return jackbridge_sem_timedwait(&data->runClient, 5); return jackbridge_sem_timedwait(&data->runClient, 5);
} }


void writeOpcode(const PluginBridgeOpcode opcode)
void writeOpcode(const PluginBridgeOpcode opcode) noexcept
{ {
writeInt(static_cast<int>(opcode)); writeInt(static_cast<int>(opcode));
} }
@@ -320,7 +317,7 @@ public:
return fPluginType; return fPluginType;
} }


PluginCategory getCategory() const override
PluginCategory getCategory() const noexcept override
{ {
return fInfo.category; return fInfo.category;
} }
@@ -346,7 +343,7 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Information (current data) // Information (current data)


int32_t getChunkData(void** const dataPtr) const override
int32_t getChunkData(void** const dataPtr) const noexcept override
{ {
CARLA_ASSERT(pData->options & PLUGIN_OPTION_USE_CHUNKS); CARLA_ASSERT(pData->options & PLUGIN_OPTION_USE_CHUNKS);
CARLA_ASSERT(dataPtr != nullptr); CARLA_ASSERT(dataPtr != nullptr);
@@ -365,7 +362,7 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Information (per-plugin data) // Information (per-plugin data)


unsigned int getOptionsAvailable() const override
unsigned int getOptionsAvailable() const noexcept override
{ {
unsigned int options = 0x0; unsigned int options = 0x0;


@@ -380,41 +377,41 @@ public:
return options; return options;
} }


float getParameterValue(const uint32_t parameterId) const override
float getParameterValue(const uint32_t parameterId) const noexcept override
{ {
CARLA_ASSERT(parameterId < pData->param.count);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, 0.0f);


return fParams[parameterId].value; return fParams[parameterId].value;
} }


void getLabel(char* const strBuf) const override
void getLabel(char* const strBuf) const noexcept override
{ {
std::strncpy(strBuf, (const char*)fInfo.label, STR_MAX); std::strncpy(strBuf, (const char*)fInfo.label, STR_MAX);
} }


void getMaker(char* const strBuf) const override
void getMaker(char* const strBuf) const noexcept override
{ {
std::strncpy(strBuf, (const char*)fInfo.maker, STR_MAX); std::strncpy(strBuf, (const char*)fInfo.maker, STR_MAX);
} }


void getCopyright(char* const strBuf) const override
void getCopyright(char* const strBuf) const noexcept override
{ {
std::strncpy(strBuf, (const char*)fInfo.copyright, STR_MAX); std::strncpy(strBuf, (const char*)fInfo.copyright, STR_MAX);
} }


void getRealName(char* const strBuf) const override
void getRealName(char* const strBuf) const noexcept override
{ {
std::strncpy(strBuf, (const char*)fInfo.name, STR_MAX); std::strncpy(strBuf, (const char*)fInfo.name, STR_MAX);
} }


void getParameterName(const uint32_t parameterId, char* const strBuf) const override
void getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept override
{ {
CARLA_ASSERT(parameterId < pData->param.count); CARLA_ASSERT(parameterId < pData->param.count);


std::strncpy(strBuf, (const char*)fParams[parameterId].name, STR_MAX); std::strncpy(strBuf, (const char*)fParams[parameterId].name, STR_MAX);
} }


void getParameterUnit(const uint32_t parameterId, char* const strBuf) const override
void getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept override
{ {
CARLA_ASSERT(parameterId < pData->param.count); CARLA_ASSERT(parameterId < pData->param.count);


@@ -452,7 +449,7 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Set data (plugin-specific stuff) // Set data (plugin-specific stuff)


void setParameterValue(const uint32_t parameterId, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback) override
void setParameterValue(const uint32_t parameterId, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept override
{ {
CARLA_ASSERT(parameterId < pData->param.count); CARLA_ASSERT(parameterId < pData->param.count);


@@ -477,7 +474,7 @@ public:
CarlaPlugin::setParameterValue(parameterId, fixedValue, sendGui, sendOsc, sendCallback); CarlaPlugin::setParameterValue(parameterId, fixedValue, sendGui, sendOsc, sendCallback);
} }


void setProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) override
void setProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->prog.count),); CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->prog.count),);


@@ -498,7 +495,7 @@ public:
CarlaPlugin::setProgram(index, sendGui, sendOsc, sendCallback); CarlaPlugin::setProgram(index, sendGui, sendOsc, sendCallback);
} }


void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) override
void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->midiprog.count),); CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->midiprog.count),);


@@ -709,24 +706,30 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Plugin processing // Plugin processing


void activate() override
void activate() noexcept override
{ {
// already locked before // already locked before
fShmControl.writeOpcode(kPluginBridgeOpcodeSetParameter); fShmControl.writeOpcode(kPluginBridgeOpcodeSetParameter);
fShmControl.writeInt(PARAMETER_ACTIVE); fShmControl.writeInt(PARAMETER_ACTIVE);
fShmControl.writeFloat(1.0f); fShmControl.writeFloat(1.0f);
fShmControl.commitWrite(); fShmControl.commitWrite();
waitForServer();

try {
waitForServer();
} catch(...) {}
} }


void deactivate() override
void deactivate() noexcept override
{ {
// already locked before // already locked before
fShmControl.writeOpcode(kPluginBridgeOpcodeSetParameter); fShmControl.writeOpcode(kPluginBridgeOpcodeSetParameter);
fShmControl.writeInt(PARAMETER_ACTIVE); fShmControl.writeInt(PARAMETER_ACTIVE);
fShmControl.writeFloat(0.0f); fShmControl.writeFloat(0.0f);
fShmControl.commitWrite(); fShmControl.commitWrite();
waitForServer();

try {
waitForServer();
} catch(...) {}
} }


void process(float** const inBuffer, float** const outBuffer, const uint32_t frames) override void process(float** const inBuffer, float** const outBuffer, const uint32_t frames) override


+ 79
- 78
source/backend/plugin/CarlaPlugin.cpp View File

@@ -261,6 +261,22 @@ const char* CarlaPlugin::getIconName() const noexcept
return pData->iconName; return pData->iconName;
} }


PluginCategory CarlaPlugin::getCategory() const noexcept
{
PluginCategory category = PLUGIN_CATEGORY_NONE;

try {
category = getPluginCategoryFromName(pData->name);
} catch(...) {}

return category;
}

long CarlaPlugin::getUniqueId() const noexcept
{
return 0;
}

uint32_t CarlaPlugin::getLatencyInFrames() const noexcept uint32_t CarlaPlugin::getLatencyInFrames() const noexcept
{ {
return pData->latency; return pData->latency;
@@ -294,7 +310,7 @@ uint32_t CarlaPlugin::getParameterCount() const noexcept
return pData->param.count; return pData->param.count;
} }


uint32_t CarlaPlugin::getParameterScalePointCount(const uint32_t parameterId) const
uint32_t CarlaPlugin::getParameterScalePointCount(const uint32_t parameterId) const noexcept
{ {
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, 0); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, 0);
return 0; return 0;
@@ -328,37 +344,37 @@ int32_t CarlaPlugin::getCurrentMidiProgram() const noexcept
return pData->midiprog.current; return pData->midiprog.current;
} }


const ParameterData& CarlaPlugin::getParameterData(const uint32_t parameterId) const
const ParameterData& CarlaPlugin::getParameterData(const uint32_t parameterId) const noexcept
{ {
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, kParameterDataNull); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, kParameterDataNull);
return pData->param.data[parameterId]; return pData->param.data[parameterId];
} }


const ParameterRanges& CarlaPlugin::getParameterRanges(const uint32_t parameterId) const
const ParameterRanges& CarlaPlugin::getParameterRanges(const uint32_t parameterId) const noexcept
{ {
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, kParameterRangesNull); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, kParameterRangesNull);
return pData->param.ranges[parameterId]; return pData->param.ranges[parameterId];
} }


bool CarlaPlugin::isParameterOutput(const uint32_t parameterId) const
bool CarlaPlugin::isParameterOutput(const uint32_t parameterId) const noexcept
{ {
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false);
return (pData->param.data[parameterId].type == PARAMETER_OUTPUT); return (pData->param.data[parameterId].type == PARAMETER_OUTPUT);
} }


const MidiProgramData& CarlaPlugin::getMidiProgramData(const uint32_t index) const
const MidiProgramData& CarlaPlugin::getMidiProgramData(const uint32_t index) const noexcept
{ {
CARLA_SAFE_ASSERT_RETURN(index < pData->midiprog.count, kMidiProgramDataNull); CARLA_SAFE_ASSERT_RETURN(index < pData->midiprog.count, kMidiProgramDataNull);
return pData->midiprog.data[index]; return pData->midiprog.data[index];
} }


const CustomData& CarlaPlugin::getCustomData(const uint32_t index) const
const CustomData& CarlaPlugin::getCustomData(const uint32_t index) const noexcept
{ {
CARLA_SAFE_ASSERT_RETURN(index < pData->custom.count(), kCustomDataNull); CARLA_SAFE_ASSERT_RETURN(index < pData->custom.count(), kCustomDataNull);
return pData->custom.getAt(index); return pData->custom.getAt(index);
} }


int32_t CarlaPlugin::getChunkData(void** const dataPtr) const
int32_t CarlaPlugin::getChunkData(void** const dataPtr) const noexcept
{ {
CARLA_SAFE_ASSERT_RETURN(dataPtr != nullptr, 0); CARLA_SAFE_ASSERT_RETURN(dataPtr != nullptr, 0);
CARLA_ASSERT(false); // this should never happen CARLA_ASSERT(false); // this should never happen
@@ -368,20 +384,20 @@ int32_t CarlaPlugin::getChunkData(void** const dataPtr) const
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Information (per-plugin data) // Information (per-plugin data)


unsigned int CarlaPlugin::getOptionsAvailable() const
unsigned int CarlaPlugin::getOptionsAvailable() const noexcept
{ {
CARLA_ASSERT(false); // this should never happen CARLA_ASSERT(false); // this should never happen
return 0x0; return 0x0;
} }


float CarlaPlugin::getParameterValue(const uint32_t parameterId) const
float CarlaPlugin::getParameterValue(const uint32_t parameterId) const noexcept
{ {
CARLA_SAFE_ASSERT_RETURN(parameterId < getParameterCount(), 0.0f); CARLA_SAFE_ASSERT_RETURN(parameterId < getParameterCount(), 0.0f);
CARLA_ASSERT(false); // this should never happen CARLA_ASSERT(false); // this should never happen
return 0.0f; return 0.0f;
} }


float CarlaPlugin::getParameterScalePointValue(const uint32_t parameterId, const uint32_t scalePointId) const
float CarlaPlugin::getParameterScalePointValue(const uint32_t parameterId, const uint32_t scalePointId) const noexcept
{ {
CARLA_SAFE_ASSERT_RETURN(parameterId < getParameterCount(), 0.0f); CARLA_SAFE_ASSERT_RETURN(parameterId < getParameterCount(), 0.0f);
CARLA_SAFE_ASSERT_RETURN(scalePointId < getParameterScalePointCount(parameterId), 0.0f); CARLA_SAFE_ASSERT_RETURN(scalePointId < getParameterScalePointCount(parameterId), 0.0f);
@@ -389,53 +405,53 @@ float CarlaPlugin::getParameterScalePointValue(const uint32_t parameterId, const
return 0.0f; return 0.0f;
} }


void CarlaPlugin::getLabel(char* const strBuf) const
void CarlaPlugin::getLabel(char* const strBuf) const noexcept
{ {
strBuf[0] = '\0'; strBuf[0] = '\0';
} }


void CarlaPlugin::getMaker(char* const strBuf) const
void CarlaPlugin::getMaker(char* const strBuf) const noexcept
{ {
strBuf[0] = '\0'; strBuf[0] = '\0';
} }


void CarlaPlugin::getCopyright(char* const strBuf) const
void CarlaPlugin::getCopyright(char* const strBuf) const noexcept
{ {
strBuf[0] = '\0'; strBuf[0] = '\0';
} }


void CarlaPlugin::getRealName(char* const strBuf) const
void CarlaPlugin::getRealName(char* const strBuf) const noexcept
{ {
strBuf[0] = '\0'; strBuf[0] = '\0';
} }


void CarlaPlugin::getParameterName(const uint32_t parameterId, char* const strBuf) const
void CarlaPlugin::getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept
{ {
CARLA_SAFE_ASSERT_RETURN(parameterId < getParameterCount(),); CARLA_SAFE_ASSERT_RETURN(parameterId < getParameterCount(),);
CARLA_ASSERT(false); // this should never happen CARLA_ASSERT(false); // this should never happen
strBuf[0] = '\0'; strBuf[0] = '\0';
} }


void CarlaPlugin::getParameterSymbol(const uint32_t parameterId, char* const strBuf) const
void CarlaPlugin::getParameterSymbol(const uint32_t parameterId, char* const strBuf) const noexcept
{ {
CARLA_SAFE_ASSERT_RETURN(parameterId < getParameterCount(),); CARLA_SAFE_ASSERT_RETURN(parameterId < getParameterCount(),);
strBuf[0] = '\0'; strBuf[0] = '\0';
} }


void CarlaPlugin::getParameterText(const uint32_t parameterId, const float, char* const strBuf) const
void CarlaPlugin::getParameterText(const uint32_t parameterId, const float, char* const strBuf) const noexcept
{ {
CARLA_SAFE_ASSERT_RETURN(parameterId < getParameterCount(),); CARLA_SAFE_ASSERT_RETURN(parameterId < getParameterCount(),);
CARLA_ASSERT(false); // this should never happen CARLA_ASSERT(false); // this should never happen
strBuf[0] = '\0'; strBuf[0] = '\0';
} }


void CarlaPlugin::getParameterUnit(const uint32_t parameterId, char* const strBuf) const
void CarlaPlugin::getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept
{ {
CARLA_SAFE_ASSERT_RETURN(parameterId < getParameterCount(),); CARLA_SAFE_ASSERT_RETURN(parameterId < getParameterCount(),);
strBuf[0] = '\0'; strBuf[0] = '\0';
} }


void CarlaPlugin::getParameterScalePointLabel(const uint32_t parameterId, const uint32_t scalePointId, char* const strBuf) const
void CarlaPlugin::getParameterScalePointLabel(const uint32_t parameterId, const uint32_t scalePointId, char* const strBuf) const noexcept
{ {
CARLA_SAFE_ASSERT_RETURN(parameterId < getParameterCount(),); CARLA_SAFE_ASSERT_RETURN(parameterId < getParameterCount(),);
CARLA_SAFE_ASSERT_RETURN(scalePointId < getParameterScalePointCount(parameterId),); CARLA_SAFE_ASSERT_RETURN(scalePointId < getParameterScalePointCount(parameterId),);
@@ -443,14 +459,14 @@ void CarlaPlugin::getParameterScalePointLabel(const uint32_t parameterId, const
strBuf[0] = '\0'; strBuf[0] = '\0';
} }


void CarlaPlugin::getProgramName(const uint32_t index, char* const strBuf) const
void CarlaPlugin::getProgramName(const uint32_t index, char* const strBuf) const noexcept
{ {
CARLA_SAFE_ASSERT_RETURN(index < pData->prog.count,); CARLA_SAFE_ASSERT_RETURN(index < pData->prog.count,);
CARLA_SAFE_ASSERT_RETURN(pData->prog.names[index] != nullptr,); CARLA_SAFE_ASSERT_RETURN(pData->prog.names[index] != nullptr,);
std::strncpy(strBuf, pData->prog.names[index], STR_MAX); std::strncpy(strBuf, pData->prog.names[index], STR_MAX);
} }


void CarlaPlugin::getMidiProgramName(const uint32_t index, char* const strBuf) const
void CarlaPlugin::getMidiProgramName(const uint32_t index, char* const strBuf) const noexcept
{ {
CARLA_SAFE_ASSERT_RETURN(index < pData->midiprog.count,); CARLA_SAFE_ASSERT_RETURN(index < pData->midiprog.count,);
CARLA_SAFE_ASSERT_RETURN(pData->midiprog.data[index].name != nullptr,); CARLA_SAFE_ASSERT_RETURN(pData->midiprog.data[index].name != nullptr,);
@@ -872,7 +888,10 @@ void CarlaPlugin::setName(const char* const newName)
{ {
CARLA_ASSERT(newName != nullptr && newName[0] != '\0'); CARLA_ASSERT(newName != nullptr && newName[0] != '\0');


pData->name = newName;
if (pData->name != nullptr)
delete[] pData->name;

pData->name = carla_strdup(newName);
} }


void CarlaPlugin::setOption(const unsigned int option, const bool yesNo) void CarlaPlugin::setOption(const unsigned int option, const bool yesNo)
@@ -887,7 +906,7 @@ void CarlaPlugin::setOption(const unsigned int option, const bool yesNo)
pData->saveSetting(option, yesNo); pData->saveSetting(option, yesNo);
} }


void CarlaPlugin::setEnabled(const bool yesNo)
void CarlaPlugin::setEnabled(const bool yesNo) noexcept
{ {
if (pData->enabled == yesNo) if (pData->enabled == yesNo)
return; return;
@@ -901,7 +920,7 @@ void CarlaPlugin::setEnabled(const bool yesNo)
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Set data (internal stuff) // Set data (internal stuff)


void CarlaPlugin::setActive(const bool active, const bool sendOsc, const bool sendCallback)
void CarlaPlugin::setActive(const bool active, const bool sendOsc, const bool sendCallback) noexcept
{ {
#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
CARLA_ASSERT(sendOsc || sendCallback); // never call this from RT CARLA_ASSERT(sendOsc || sendCallback); // never call this from RT
@@ -939,7 +958,7 @@ void CarlaPlugin::setActive(const bool active, const bool sendOsc, const bool se
} }


#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
void CarlaPlugin::setDryWet(const float value, const bool sendOsc, const bool sendCallback)
void CarlaPlugin::setDryWet(const float value, const bool sendOsc, const bool sendCallback) noexcept
{ {
CARLA_ASSERT(value >= 0.0f && value <= 1.0f); CARLA_ASSERT(value >= 0.0f && value <= 1.0f);


@@ -957,7 +976,7 @@ void CarlaPlugin::setDryWet(const float value, const bool sendOsc, const bool se
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, PARAMETER_DRYWET, 0, fixedValue, nullptr); pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, PARAMETER_DRYWET, 0, fixedValue, nullptr);
} }


void CarlaPlugin::setVolume(const float value, const bool sendOsc, const bool sendCallback)
void CarlaPlugin::setVolume(const float value, const bool sendOsc, const bool sendCallback) noexcept
{ {
CARLA_ASSERT(value >= 0.0f && value <= 1.27f); CARLA_ASSERT(value >= 0.0f && value <= 1.27f);


@@ -975,7 +994,7 @@ void CarlaPlugin::setVolume(const float value, const bool sendOsc, const bool se
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, PARAMETER_VOLUME, 0, fixedValue, nullptr); pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, PARAMETER_VOLUME, 0, fixedValue, nullptr);
} }


void CarlaPlugin::setBalanceLeft(const float value, const bool sendOsc, const bool sendCallback)
void CarlaPlugin::setBalanceLeft(const float value, const bool sendOsc, const bool sendCallback) noexcept
{ {
CARLA_ASSERT(value >= -1.0f && value <= 1.0f); CARLA_ASSERT(value >= -1.0f && value <= 1.0f);


@@ -993,7 +1012,7 @@ void CarlaPlugin::setBalanceLeft(const float value, const bool sendOsc, const bo
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, PARAMETER_BALANCE_LEFT, 0, fixedValue, nullptr); pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, PARAMETER_BALANCE_LEFT, 0, fixedValue, nullptr);
} }


void CarlaPlugin::setBalanceRight(const float value, const bool sendOsc, const bool sendCallback)
void CarlaPlugin::setBalanceRight(const float value, const bool sendOsc, const bool sendCallback) noexcept
{ {
CARLA_ASSERT(value >= -1.0f && value <= 1.0f); CARLA_ASSERT(value >= -1.0f && value <= 1.0f);


@@ -1011,7 +1030,7 @@ void CarlaPlugin::setBalanceRight(const float value, const bool sendOsc, const b
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, PARAMETER_BALANCE_RIGHT, 0, fixedValue, nullptr); pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, PARAMETER_BALANCE_RIGHT, 0, fixedValue, nullptr);
} }


void CarlaPlugin::setPanning(const float value, const bool sendOsc, const bool sendCallback)
void CarlaPlugin::setPanning(const float value, const bool sendOsc, const bool sendCallback) noexcept
{ {
CARLA_ASSERT(value >= -1.0f && value <= 1.0f); CARLA_ASSERT(value >= -1.0f && value <= 1.0f);


@@ -1030,7 +1049,7 @@ void CarlaPlugin::setPanning(const float value, const bool sendOsc, const bool s
} }
#endif #endif


void CarlaPlugin::setCtrlChannel(const int8_t channel, const bool sendOsc, const bool sendCallback)
void CarlaPlugin::setCtrlChannel(const int8_t channel, const bool sendOsc, const bool sendCallback) noexcept
{ {
#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
CARLA_ASSERT(sendOsc || sendCallback); // never call this from RT CARLA_ASSERT(sendOsc || sendCallback); // never call this from RT
@@ -1065,7 +1084,7 @@ void CarlaPlugin::setCtrlChannel(const int8_t channel, const bool sendOsc, const
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Set data (plugin-specific stuff) // Set data (plugin-specific stuff)


void CarlaPlugin::setParameterValue(const uint32_t parameterId, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback)
void CarlaPlugin::setParameterValue(const uint32_t parameterId, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept
{ {
CARLA_ASSERT(parameterId < pData->param.count); CARLA_ASSERT(parameterId < pData->param.count);
#ifdef BUILD_BRIDGE #ifdef BUILD_BRIDGE
@@ -1095,7 +1114,7 @@ void CarlaPlugin::setParameterValue(const uint32_t parameterId, const float valu
#endif #endif
} }


void CarlaPlugin::setParameterValueByRealIndex(const int32_t rindex, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback)
void CarlaPlugin::setParameterValueByRealIndex(const int32_t rindex, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept
{ {
CARLA_ASSERT(rindex > PARAMETER_MAX && rindex != PARAMETER_NULL); CARLA_ASSERT(rindex > PARAMETER_MAX && rindex != PARAMETER_NULL);


@@ -1132,7 +1151,7 @@ void CarlaPlugin::setParameterValueByRealIndex(const int32_t rindex, const float
} }
} }


void CarlaPlugin::setParameterMidiChannel(const uint32_t parameterId, uint8_t channel, const bool sendOsc, const bool sendCallback)
void CarlaPlugin::setParameterMidiChannel(const uint32_t parameterId, uint8_t channel, const bool sendOsc, const bool sendCallback) noexcept
{ {
CARLA_ASSERT(sendOsc || sendCallback); // never call this from RT CARLA_ASSERT(sendOsc || sendCallback); // never call this from RT
CARLA_ASSERT(parameterId < pData->param.count); CARLA_ASSERT(parameterId < pData->param.count);
@@ -1161,7 +1180,7 @@ void CarlaPlugin::setParameterMidiChannel(const uint32_t parameterId, uint8_t ch
#endif #endif
} }


void CarlaPlugin::setParameterMidiCC(const uint32_t parameterId, int16_t cc, const bool sendOsc, const bool sendCallback)
void CarlaPlugin::setParameterMidiCC(const uint32_t parameterId, int16_t cc, const bool sendOsc, const bool sendCallback) noexcept
{ {
CARLA_ASSERT(sendOsc || sendCallback); // never call this from RT CARLA_ASSERT(sendOsc || sendCallback); // never call this from RT
CARLA_ASSERT(parameterId < pData->param.count); CARLA_ASSERT(parameterId < pData->param.count);
@@ -1267,7 +1286,7 @@ void CarlaPlugin::setChunkData(const char* const stringData)
(void)stringData; (void)stringData;
} }


void CarlaPlugin::setProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback)
void CarlaPlugin::setProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept
{ {
CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->prog.count),); CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->prog.count),);
#ifdef BUILD_BRIDGE #ifdef BUILD_BRIDGE
@@ -1324,7 +1343,7 @@ void CarlaPlugin::setProgram(const int32_t index, const bool sendGui, const bool
#endif #endif
} }


void CarlaPlugin::setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback)
void CarlaPlugin::setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept
{ {
CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->midiprog.count),); CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->midiprog.count),);
#ifdef BUILD_BRIDGE #ifdef BUILD_BRIDGE
@@ -1380,7 +1399,7 @@ void CarlaPlugin::setMidiProgram(const int32_t index, const bool sendGui, const
#endif #endif
} }


void CarlaPlugin::setMidiProgramById(const uint32_t bank, const uint32_t program, const bool sendGui, const bool sendOsc, const bool sendCallback)
void CarlaPlugin::setMidiProgramById(const uint32_t bank, const uint32_t program, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept
{ {
for (uint32_t i=0; i < pData->midiprog.count; ++i) for (uint32_t i=0; i < pData->midiprog.count; ++i)
{ {
@@ -1392,15 +1411,6 @@ void CarlaPlugin::setMidiProgramById(const uint32_t bank, const uint32_t program
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Set ui stuff // Set ui stuff


void CarlaPlugin::showCustomUI(const bool yesNo)
{
CARLA_ASSERT(false);
return;

// unused
(void)yesNo;
}

void CarlaPlugin::idle() void CarlaPlugin::idle()
{ {
if (! pData->enabled) if (! pData->enabled)
@@ -1420,6 +1430,15 @@ void CarlaPlugin::idle()
} }
} }


void CarlaPlugin::showCustomUI(const bool yesNo)
{
CARLA_ASSERT(false);
return;

// unused
(void)yesNo;
}

// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Plugin state // Plugin state


@@ -1430,12 +1449,12 @@ void CarlaPlugin::reloadPrograms(const bool)
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Plugin processing // Plugin processing


void CarlaPlugin::activate()
void CarlaPlugin::activate() noexcept
{ {
CARLA_ASSERT(! pData->active); CARLA_ASSERT(! pData->active);
} }


void CarlaPlugin::deactivate()
void CarlaPlugin::deactivate() noexcept
{ {
CARLA_ASSERT(pData->active); CARLA_ASSERT(pData->active);
} }
@@ -1452,7 +1471,7 @@ void CarlaPlugin::offlineModeChanged(const bool)
{ {
} }


bool CarlaPlugin::tryLock(const bool forcedOffline)
bool CarlaPlugin::tryLock(const bool forcedOffline) noexcept
{ {
if (forcedOffline) if (forcedOffline)
{ {
@@ -1463,7 +1482,7 @@ bool CarlaPlugin::tryLock(const bool forcedOffline)
return pData->masterMutex.tryLock(); return pData->masterMutex.tryLock();
} }


void CarlaPlugin::unlock()
void CarlaPlugin::unlock() noexcept
{ {
pData->masterMutex.unlock(); pData->masterMutex.unlock();
} }
@@ -1486,7 +1505,7 @@ void CarlaPlugin::clearBuffers()
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// OSC stuff // OSC stuff


void CarlaPlugin::registerToOscClient()
void CarlaPlugin::registerToOscClient() noexcept
{ {
#ifdef BUILD_BRIDGE #ifdef BUILD_BRIDGE
if (! pData->engine->isOscBridgeRegistered()) if (! pData->engine->isOscBridgeRegistered())
@@ -1947,7 +1966,7 @@ void CarlaPlugin::postRtEventsRun()
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Post-poned UI Stuff // Post-poned UI Stuff


void CarlaPlugin::uiParameterChange(const uint32_t index, const float value)
void CarlaPlugin::uiParameterChange(const uint32_t index, const float value) noexcept
{ {
CARLA_ASSERT(index < getParameterCount()); CARLA_ASSERT(index < getParameterCount());
return; return;
@@ -1957,7 +1976,7 @@ void CarlaPlugin::uiParameterChange(const uint32_t index, const float value)
(void)value; (void)value;
} }


void CarlaPlugin::uiProgramChange(const uint32_t index)
void CarlaPlugin::uiProgramChange(const uint32_t index) noexcept
{ {
CARLA_ASSERT(index < getProgramCount()); CARLA_ASSERT(index < getProgramCount());
return; return;
@@ -1966,7 +1985,7 @@ void CarlaPlugin::uiProgramChange(const uint32_t index)
(void)index; (void)index;
} }


void CarlaPlugin::uiMidiProgramChange(const uint32_t index)
void CarlaPlugin::uiMidiProgramChange(const uint32_t index) noexcept
{ {
CARLA_ASSERT(index < getMidiProgramCount()); CARLA_ASSERT(index < getMidiProgramCount());
return; return;
@@ -1975,7 +1994,7 @@ void CarlaPlugin::uiMidiProgramChange(const uint32_t index)
(void)index; (void)index;
} }


void CarlaPlugin::uiNoteOn(const uint8_t channel, const uint8_t note, const uint8_t velo)
void CarlaPlugin::uiNoteOn(const uint8_t channel, const uint8_t note, const uint8_t velo) noexcept
{ {
CARLA_ASSERT(channel < MAX_MIDI_CHANNELS); CARLA_ASSERT(channel < MAX_MIDI_CHANNELS);
CARLA_ASSERT(note < MAX_MIDI_NOTE); CARLA_ASSERT(note < MAX_MIDI_NOTE);
@@ -1988,7 +2007,7 @@ void CarlaPlugin::uiNoteOn(const uint8_t channel, const uint8_t note, const uint
(void)velo; (void)velo;
} }


void CarlaPlugin::uiNoteOff(const uint8_t channel, const uint8_t note)
void CarlaPlugin::uiNoteOff(const uint8_t channel, const uint8_t note) noexcept
{ {
CARLA_ASSERT(channel < MAX_MIDI_CHANNELS); CARLA_ASSERT(channel < MAX_MIDI_CHANNELS);
CARLA_ASSERT(note < MAX_MIDI_NOTE); CARLA_ASSERT(note < MAX_MIDI_NOTE);
@@ -2027,7 +2046,7 @@ CarlaEngineAudioPort* CarlaPlugin::getAudioOutPort(const uint32_t index) const n
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Scoped Disabler // Scoped Disabler


CarlaPlugin::ScopedDisabler::ScopedDisabler(CarlaPlugin* const plugin)
CarlaPlugin::ScopedDisabler::ScopedDisabler(CarlaPlugin* const plugin) noexcept
: fPlugin(plugin) : fPlugin(plugin)
{ {
CARLA_SAFE_ASSERT_RETURN(plugin != nullptr,); CARLA_SAFE_ASSERT_RETURN(plugin != nullptr,);
@@ -2044,7 +2063,7 @@ CarlaPlugin::ScopedDisabler::ScopedDisabler(CarlaPlugin* const plugin)
plugin->pData->client->deactivate(); plugin->pData->client->deactivate();
} }


CarlaPlugin::ScopedDisabler::~ScopedDisabler()
CarlaPlugin::ScopedDisabler::~ScopedDisabler() noexcept
{ {
CARLA_SAFE_ASSERT_RETURN(fPlugin != nullptr,); CARLA_SAFE_ASSERT_RETURN(fPlugin != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fPlugin->pData != nullptr,); CARLA_SAFE_ASSERT_RETURN(fPlugin->pData != nullptr,);
@@ -2059,7 +2078,7 @@ CarlaPlugin::ScopedDisabler::~ScopedDisabler()
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Scoped Process Locker // Scoped Process Locker


CarlaPlugin::ScopedSingleProcessLocker::ScopedSingleProcessLocker(CarlaPlugin* const plugin, const bool block)
CarlaPlugin::ScopedSingleProcessLocker::ScopedSingleProcessLocker(CarlaPlugin* const plugin, const bool block) noexcept
: fPlugin(plugin), : fPlugin(plugin),
fBlock(block) fBlock(block)
{ {
@@ -2073,7 +2092,7 @@ CarlaPlugin::ScopedSingleProcessLocker::ScopedSingleProcessLocker(CarlaPlugin* c
plugin->pData->singleMutex.lock(); plugin->pData->singleMutex.lock();
} }


CarlaPlugin::ScopedSingleProcessLocker::~ScopedSingleProcessLocker()
CarlaPlugin::ScopedSingleProcessLocker::~ScopedSingleProcessLocker() noexcept
{ {
CARLA_SAFE_ASSERT_RETURN(fPlugin != nullptr,); CARLA_SAFE_ASSERT_RETURN(fPlugin != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fPlugin->pData != nullptr,); CARLA_SAFE_ASSERT_RETURN(fPlugin->pData != nullptr,);
@@ -2090,24 +2109,6 @@ CarlaPlugin::ScopedSingleProcessLocker::~ScopedSingleProcessLocker()
fPlugin->pData->singleMutex.unlock(); fPlugin->pData->singleMutex.unlock();
} }


// #ifdef BUILD_BRIDGE
// CarlaPlugin* newFailAsBridge(const CarlaPlugin::Initializer& init)
// {
// init.engine->setLastError("Can't use this in plugin bridges");
// return nullptr;
// }
//
// CarlaPlugin* CarlaPlugin::newNative(const Initializer& init) { return newFailAsBridge(init); }
// CarlaPlugin* CarlaPlugin::newGIG(const Initializer& init, const bool) { return newFailAsBridge(init); }
// CarlaPlugin* CarlaPlugin::newSF2(const Initializer& init, const bool) { return newFailAsBridge(init); }
// CarlaPlugin* CarlaPlugin::newSFZ(const Initializer& init, const bool) { return newFailAsBridge(init); }
//
// # ifdef WANT_NATIVE
// size_t CarlaPlugin::getNativePluginCount() { return 0; }
// const PluginDescriptor* CarlaPlugin::getNativePluginDescriptor(const size_t) { return nullptr; }
// # endif
// #endif

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


CARLA_BACKEND_END_NAMESPACE CARLA_BACKEND_END_NAMESPACE

+ 48
- 28
source/backend/plugin/DssiPlugin.cpp View File

@@ -108,17 +108,17 @@ public:
return PLUGIN_DSSI; return PLUGIN_DSSI;
} }


PluginCategory getCategory() const override
PluginCategory getCategory() const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDssiDescriptor != nullptr, PLUGIN_CATEGORY_NONE); CARLA_SAFE_ASSERT_RETURN(fDssiDescriptor != nullptr, PLUGIN_CATEGORY_NONE);


if (pData->audioIn.count == 0 && pData->audioOut.count > 0 && (fDssiDescriptor->run_synth != nullptr || fDssiDescriptor->run_multiple_synths != nullptr)) if (pData->audioIn.count == 0 && pData->audioOut.count > 0 && (fDssiDescriptor->run_synth != nullptr || fDssiDescriptor->run_multiple_synths != nullptr))
return PLUGIN_CATEGORY_SYNTH; return PLUGIN_CATEGORY_SYNTH;


return getPluginCategoryFromName(pData->name);
return CarlaPlugin::getCategory();
} }


long getUniqueId() const override
long getUniqueId() const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, 0); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, 0);


@@ -133,7 +133,7 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Information (current data) // Information (current data)


int32_t getChunkData(void** const dataPtr) const override
int32_t getChunkData(void** const dataPtr) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fUsesCustomData, 0); CARLA_SAFE_ASSERT_RETURN(fUsesCustomData, 0);
CARLA_SAFE_ASSERT_RETURN(pData->options & PLUGIN_OPTION_USE_CHUNKS, 0); CARLA_SAFE_ASSERT_RETURN(pData->options & PLUGIN_OPTION_USE_CHUNKS, 0);
@@ -143,18 +143,20 @@ public:
CARLA_SAFE_ASSERT_RETURN(fHandle2 == nullptr, 0); CARLA_SAFE_ASSERT_RETURN(fHandle2 == nullptr, 0);
CARLA_SAFE_ASSERT_RETURN(dataPtr != nullptr, 0); CARLA_SAFE_ASSERT_RETURN(dataPtr != nullptr, 0);


int ret = 0;
unsigned long dataSize = 0; unsigned long dataSize = 0;


if (fDssiDescriptor->get_custom_data(fHandle, dataPtr, &dataSize) != 0)
return static_cast<int32_t>(dataSize);
try {
ret = fDssiDescriptor->get_custom_data(fHandle, dataPtr, &dataSize);
} catch(...) {}


return 0;
return (ret != 0) ? static_cast<int32_t>(dataSize) : 0;
} }


// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Information (per-plugin data) // Information (per-plugin data)


unsigned int getOptionsAvailable() const override
unsigned int getOptionsAvailable() const noexcept override
{ {
#ifdef __USE_GNU #ifdef __USE_GNU
const bool isAmSynth(strcasestr(pData->filename, "amsynth")); const bool isAmSynth(strcasestr(pData->filename, "amsynth"));
@@ -196,7 +198,7 @@ public:
return options; return options;
} }


float getParameterValue(const uint32_t parameterId) const override
float getParameterValue(const uint32_t parameterId) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fParamBuffers != nullptr, 0.0f); CARLA_SAFE_ASSERT_RETURN(fParamBuffers != nullptr, 0.0f);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, 0.0f); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, 0.0f);
@@ -204,7 +206,7 @@ public:
return fParamBuffers[parameterId]; return fParamBuffers[parameterId];
} }


void getLabel(char* const strBuf) const override
void getLabel(char* const strBuf) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);


@@ -214,7 +216,7 @@ public:
CarlaPlugin::getLabel(strBuf); CarlaPlugin::getLabel(strBuf);
} }


void getMaker(char* const strBuf) const override
void getMaker(char* const strBuf) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);


@@ -224,7 +226,7 @@ public:
CarlaPlugin::getMaker(strBuf); CarlaPlugin::getMaker(strBuf);
} }


void getCopyright(char* const strBuf) const override
void getCopyright(char* const strBuf) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);


@@ -234,7 +236,7 @@ public:
CarlaPlugin::getCopyright(strBuf); CarlaPlugin::getCopyright(strBuf);
} }


void getRealName(char* const strBuf) const override
void getRealName(char* const strBuf) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);


@@ -244,7 +246,7 @@ public:
CarlaPlugin::getRealName(strBuf); CarlaPlugin::getRealName(strBuf);
} }


void getParameterName(const uint32_t parameterId, char* const strBuf) const override
void getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
@@ -270,7 +272,7 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Set data (plugin-specific stuff) // Set data (plugin-specific stuff)


void setParameterValue(const uint32_t parameterId, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback) override
void setParameterValue(const uint32_t parameterId, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fParamBuffers != nullptr,); CARLA_SAFE_ASSERT_RETURN(fParamBuffers != nullptr,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
@@ -331,7 +333,7 @@ public:
fDssiDescriptor->set_custom_data(fHandle, chunk.data(), chunk.size()); fDssiDescriptor->set_custom_data(fHandle, chunk.data(), chunk.size());
} }


void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) override
void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDssiDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDssiDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fDssiDescriptor->select_program != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDssiDescriptor->select_program != nullptr,);
@@ -345,10 +347,16 @@ public:


const ScopedSingleProcessLocker spl(this, (sendGui || sendOsc || sendCallback)); const ScopedSingleProcessLocker spl(this, (sendGui || sendOsc || sendCallback));


fDssiDescriptor->select_program(fHandle, bank, program);
try {
fDssiDescriptor->select_program(fHandle, bank, program);
} catch(...) {}


if (fHandle2 != nullptr) if (fHandle2 != nullptr)
fDssiDescriptor->select_program(fHandle2, bank, program);
{
try {
fDssiDescriptor->select_program(fHandle2, bank, program);
} catch(...) {}
}
} }


CarlaPlugin::setMidiProgram(index, sendGui, sendOsc, sendCallback); CarlaPlugin::setMidiProgram(index, sendGui, sendOsc, sendCallback);
@@ -916,31 +924,43 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Plugin processing // Plugin processing


void activate() override
void activate() noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,);


if (fDescriptor->activate != nullptr) if (fDescriptor->activate != nullptr)
{ {
fDescriptor->activate(fHandle);
try {
fDescriptor->activate(fHandle);
} catch(...) {}


if (fHandle2 != nullptr) if (fHandle2 != nullptr)
fDescriptor->activate(fHandle2);
{
try {
fDescriptor->activate(fHandle2);
} catch(...) {}
}
} }
} }


void deactivate() override
void deactivate() noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,);


if (fDescriptor->deactivate != nullptr) if (fDescriptor->deactivate != nullptr)
{ {
fDescriptor->deactivate(fHandle);
try {
fDescriptor->deactivate(fHandle);
} catch(...) {}


if (fHandle2 != nullptr) if (fHandle2 != nullptr)
fDescriptor->deactivate(fHandle2);
{
try {
fDescriptor->deactivate(fHandle2);
} catch(...) {}
}
} }
} }


@@ -1692,7 +1712,7 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Post-poned UI Stuff // Post-poned UI Stuff


void uiParameterChange(const uint32_t index, const float value) override
void uiParameterChange(const uint32_t index, const float value) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(index < pData->param.count,); CARLA_SAFE_ASSERT_RETURN(index < pData->param.count,);


@@ -1702,7 +1722,7 @@ public:
osc_send_control(pData->osc.data, pData->param.data[index].rindex, value); osc_send_control(pData->osc.data, pData->param.data[index].rindex, value);
} }


void uiMidiProgramChange(const uint32_t index) override
void uiMidiProgramChange(const uint32_t index) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(index < pData->midiprog.count,); CARLA_SAFE_ASSERT_RETURN(index < pData->midiprog.count,);


@@ -1712,7 +1732,7 @@ public:
osc_send_program(pData->osc.data, pData->midiprog.data[index].bank, pData->midiprog.data[index].program); osc_send_program(pData->osc.data, pData->midiprog.data[index].bank, pData->midiprog.data[index].program);
} }


void uiNoteOn(const uint8_t channel, const uint8_t note, const uint8_t velo) override
void uiNoteOn(const uint8_t channel, const uint8_t note, const uint8_t velo) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS,); CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS,);
CARLA_SAFE_ASSERT_RETURN(note < MAX_MIDI_NOTE,); CARLA_SAFE_ASSERT_RETURN(note < MAX_MIDI_NOTE,);
@@ -1731,7 +1751,7 @@ public:
#endif #endif
} }


void uiNoteOff(const uint8_t channel, const uint8_t note) override
void uiNoteOff(const uint8_t channel, const uint8_t note) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS,); CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS,);
CARLA_SAFE_ASSERT_RETURN(note < MAX_MIDI_NOTE,); CARLA_SAFE_ASSERT_RETURN(note < MAX_MIDI_NOTE,);


+ 42
- 22
source/backend/plugin/FluidSynthPlugin.cpp View File

@@ -131,7 +131,7 @@ public:
return PLUGIN_FILE_SF2; return PLUGIN_FILE_SF2;
} }


PluginCategory getCategory() const override
PluginCategory getCategory() const noexcept override
{ {
return PLUGIN_CATEGORY_SYNTH; return PLUGIN_CATEGORY_SYNTH;
} }
@@ -139,7 +139,7 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Information (count) // Information (count)


uint32_t getParameterScalePointCount(const uint32_t parameterId) const override
uint32_t getParameterScalePointCount(const uint32_t parameterId) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, 0); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, 0);


@@ -162,7 +162,7 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Information (per-plugin data) // Information (per-plugin data)


unsigned int getOptionsAvailable() const override
unsigned int getOptionsAvailable() const noexcept override
{ {
unsigned int options = 0x0; unsigned int options = 0x0;


@@ -175,14 +175,14 @@ public:
return options; return options;
} }


float getParameterValue(const uint32_t parameterId) const override
float getParameterValue(const uint32_t parameterId) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, 0.0f); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, 0.0f);


return fParamBuffers[parameterId]; return fParamBuffers[parameterId];
} }


float getParameterScalePointValue(const uint32_t parameterId, const uint32_t scalePointId) const override
float getParameterScalePointValue(const uint32_t parameterId, const uint32_t scalePointId) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, 0.0f); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, 0.0f);
CARLA_SAFE_ASSERT_RETURN(scalePointId < getParameterScalePointCount(parameterId), 0.0f); CARLA_SAFE_ASSERT_RETURN(scalePointId < getParameterScalePointCount(parameterId), 0.0f);
@@ -218,7 +218,7 @@ public:
} }
} }


void getLabel(char* const strBuf) const override
void getLabel(char* const strBuf) const noexcept override
{ {
if (fLabel != nullptr) if (fLabel != nullptr)
std::strncpy(strBuf, fLabel, STR_MAX); std::strncpy(strBuf, fLabel, STR_MAX);
@@ -226,22 +226,22 @@ public:
CarlaPlugin::getLabel(strBuf); CarlaPlugin::getLabel(strBuf);
} }


void getMaker(char* const strBuf) const override
void getMaker(char* const strBuf) const noexcept override
{ {
std::strncpy(strBuf, "FluidSynth SF2 engine", STR_MAX); std::strncpy(strBuf, "FluidSynth SF2 engine", STR_MAX);
} }


void getCopyright(char* const strBuf) const override
void getCopyright(char* const strBuf) const noexcept override
{ {
std::strncpy(strBuf, "GNU GPL v2+", STR_MAX); std::strncpy(strBuf, "GNU GPL v2+", STR_MAX);
} }


void getRealName(char* const strBuf) const override
void getRealName(char* const strBuf) const noexcept override
{ {
getLabel(strBuf); getLabel(strBuf);
} }


void getParameterName(const uint32_t parameterId, char* const strBuf) const override
void getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);


@@ -295,7 +295,7 @@ public:
} }
} }


void getParameterUnit(const uint32_t parameterId, char* const strBuf) const override
void getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);


@@ -313,7 +313,7 @@ public:
} }
} }


void getParameterScalePointLabel(const uint32_t parameterId, const uint32_t scalePointId, char* const strBuf) const override
void getParameterScalePointLabel(const uint32_t parameterId, const uint32_t scalePointId, char* const strBuf) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
CARLA_SAFE_ASSERT_RETURN(scalePointId < getParameterScalePointCount(parameterId),); CARLA_SAFE_ASSERT_RETURN(scalePointId < getParameterScalePointCount(parameterId),);
@@ -368,7 +368,7 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Set data (internal stuff) // Set data (internal stuff)


void setCtrlChannel(const int8_t channel, const bool sendOsc, const bool sendCallback) override
void setCtrlChannel(const int8_t channel, const bool sendOsc, const bool sendCallback) noexcept override
{ {
if (channel < MAX_MIDI_CHANNELS) if (channel < MAX_MIDI_CHANNELS)
pData->midiprog.current = fCurMidiProgs[channel]; pData->midiprog.current = fCurMidiProgs[channel];
@@ -379,7 +379,7 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Set data (plugin-specific stuff) // Set data (plugin-specific stuff)


void setParameterValue(const uint32_t parameterId, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback) override
void setParameterValue(const uint32_t parameterId, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);


@@ -392,18 +392,24 @@ public:
switch (parameterId) switch (parameterId)
{ {
case FluidSynthReverbOnOff: case FluidSynthReverbOnOff:
fluid_synth_set_reverb_on(fSynth, (fixedValue > 0.5f) ? 1 : 0);
try {
fluid_synth_set_reverb_on(fSynth, (fixedValue > 0.5f) ? 1 : 0);
} catch(...) {}
break; break;


case FluidSynthReverbRoomSize: case FluidSynthReverbRoomSize:
case FluidSynthReverbDamp: case FluidSynthReverbDamp:
case FluidSynthReverbLevel: case FluidSynthReverbLevel:
case FluidSynthReverbWidth: case FluidSynthReverbWidth:
fluid_synth_set_reverb(fSynth, fParamBuffers[FluidSynthReverbRoomSize], fParamBuffers[FluidSynthReverbDamp], fParamBuffers[FluidSynthReverbWidth], fParamBuffers[FluidSynthReverbLevel]);
try {
fluid_synth_set_reverb(fSynth, fParamBuffers[FluidSynthReverbRoomSize], fParamBuffers[FluidSynthReverbDamp], fParamBuffers[FluidSynthReverbWidth], fParamBuffers[FluidSynthReverbLevel]);
} catch(...) {}
break; break;


case FluidSynthChorusOnOff: case FluidSynthChorusOnOff:
fluid_synth_set_chorus_on(fSynth, (value > 0.5f) ? 1 : 0);
try {
fluid_synth_set_chorus_on(fSynth, (value > 0.5f) ? 1 : 0);
} catch(...) {}
break; break;


case FluidSynthChorusNr: case FluidSynthChorusNr:
@@ -411,16 +417,27 @@ public:
case FluidSynthChorusSpeedHz: case FluidSynthChorusSpeedHz:
case FluidSynthChorusDepthMs: case FluidSynthChorusDepthMs:
case FluidSynthChorusType: case FluidSynthChorusType:
fluid_synth_set_chorus(fSynth, (int)fParamBuffers[FluidSynthChorusNr], fParamBuffers[FluidSynthChorusLevel], fParamBuffers[FluidSynthChorusSpeedHz], fParamBuffers[FluidSynthChorusDepthMs], (int)fParamBuffers[FluidSynthChorusType]);
try {
fluid_synth_set_chorus(fSynth, (int)fParamBuffers[FluidSynthChorusNr], fParamBuffers[FluidSynthChorusLevel], fParamBuffers[FluidSynthChorusSpeedHz], fParamBuffers[FluidSynthChorusDepthMs], (int)fParamBuffers[FluidSynthChorusType]);
} catch(...) {}
break; break;


case FluidSynthPolyphony: case FluidSynthPolyphony:
fluid_synth_set_polyphony(fSynth, (int)value);
try {
fluid_synth_set_polyphony(fSynth, (int)value);
} catch(...) {}
break; break;


case FluidSynthInterpolation: case FluidSynthInterpolation:
for (int i=0; i < MAX_MIDI_CHANNELS; ++i) for (int i=0; i < MAX_MIDI_CHANNELS; ++i)
fluid_synth_set_interp_method(fSynth, i, (int)value);
{
try {
fluid_synth_set_interp_method(fSynth, i, (int)value);
}
catch(...) {
break;
}
}
break; break;


default: default:
@@ -484,7 +501,7 @@ public:
CarlaPlugin::setCustomData(type, key, value, sendGui); CarlaPlugin::setCustomData(type, key, value, sendGui);
} }


void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) override
void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fSynth != nullptr,); CARLA_SAFE_ASSERT_RETURN(fSynth != nullptr,);
CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->midiprog.count),); CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->midiprog.count),);
@@ -496,7 +513,10 @@ public:


//const ScopedSingleProcessLocker spl(this, (sendGui || sendOsc || sendCallback)); //const ScopedSingleProcessLocker spl(this, (sendGui || sendOsc || sendCallback));


fluid_synth_program_select(fSynth, pData->ctrlChannel, fSynthId, bank, program);
try {
fluid_synth_program_select(fSynth, pData->ctrlChannel, fSynthId, bank, program);
} catch(...) {}

fCurMidiProgs[pData->ctrlChannel] = index; fCurMidiProgs[pData->ctrlChannel] = index;
} }




+ 34
- 22
source/backend/plugin/LadspaPlugin.cpp View File

@@ -92,7 +92,7 @@ public:
return PLUGIN_LADSPA; return PLUGIN_LADSPA;
} }


PluginCategory getCategory() const override
PluginCategory getCategory() const noexcept override
{ {
if (fRdfDescriptor != nullptr) if (fRdfDescriptor != nullptr)
{ {
@@ -127,10 +127,10 @@ public:
return PLUGIN_CATEGORY_SYNTH; return PLUGIN_CATEGORY_SYNTH;
} }


return getPluginCategoryFromName(pData->name);
return CarlaPlugin::getCategory();
} }


long getUniqueId() const override
long getUniqueId() const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, 0); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, 0);


@@ -140,7 +140,7 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Information (count) // Information (count)


uint32_t getParameterScalePointCount(const uint32_t parameterId) const override
uint32_t getParameterScalePointCount(const uint32_t parameterId) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, 0); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, 0);


@@ -163,7 +163,7 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Information (per-plugin data) // Information (per-plugin data)


unsigned int getOptionsAvailable() const override
unsigned int getOptionsAvailable() const noexcept override
{ {
#ifdef __USE_GNU #ifdef __USE_GNU
const bool isDssiVst(strcasestr(pData->filename, "dssi-vst")); const bool isDssiVst(strcasestr(pData->filename, "dssi-vst"));
@@ -189,7 +189,7 @@ public:
return options; return options;
} }


float getParameterValue(const uint32_t parameterId) const override
float getParameterValue(const uint32_t parameterId) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fParamBuffers != nullptr, 0.0f); CARLA_SAFE_ASSERT_RETURN(fParamBuffers != nullptr, 0.0f);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, 0.0f); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, 0.0f);
@@ -197,7 +197,7 @@ public:
return fParamBuffers[parameterId]; return fParamBuffers[parameterId];
} }


float getParameterScalePointValue(const uint32_t parameterId, const uint32_t scalePointId) const override
float getParameterScalePointValue(const uint32_t parameterId, const uint32_t scalePointId) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr, 0.0f); CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr, 0.0f);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, 0.0f); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, 0.0f);
@@ -219,7 +219,7 @@ public:
return 0.0f; return 0.0f;
} }


void getLabel(char* const strBuf) const override
void getLabel(char* const strBuf) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);


@@ -229,7 +229,7 @@ public:
CarlaPlugin::getLabel(strBuf); CarlaPlugin::getLabel(strBuf);
} }


void getMaker(char* const strBuf) const override
void getMaker(char* const strBuf) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);


@@ -241,7 +241,7 @@ public:
CarlaPlugin::getMaker(strBuf); CarlaPlugin::getMaker(strBuf);
} }


void getCopyright(char* const strBuf) const override
void getCopyright(char* const strBuf) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);


@@ -251,7 +251,7 @@ public:
CarlaPlugin::getCopyright(strBuf); CarlaPlugin::getCopyright(strBuf);
} }


void getRealName(char* const strBuf) const override
void getRealName(char* const strBuf) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);


@@ -263,7 +263,7 @@ public:
CarlaPlugin::getRealName(strBuf); CarlaPlugin::getRealName(strBuf);
} }


void getParameterName(const uint32_t parameterId, char* const strBuf) const override
void getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
@@ -276,7 +276,7 @@ public:
CarlaPlugin::getParameterName(parameterId, strBuf); CarlaPlugin::getParameterName(parameterId, strBuf);
} }


void getParameterSymbol(const uint32_t parameterId, char* const strBuf) const override
void getParameterSymbol(const uint32_t parameterId, char* const strBuf) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);


@@ -296,7 +296,7 @@ public:
CarlaPlugin::getParameterSymbol(parameterId, strBuf); CarlaPlugin::getParameterSymbol(parameterId, strBuf);
} }


void getParameterUnit(const uint32_t parameterId, char* const strBuf) const override
void getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);


@@ -335,7 +335,7 @@ public:
CarlaPlugin::getParameterUnit(parameterId, strBuf); CarlaPlugin::getParameterUnit(parameterId, strBuf);
} }


void getParameterScalePointLabel(const uint32_t parameterId, const uint32_t scalePointId, char* const strBuf) const override
void getParameterScalePointLabel(const uint32_t parameterId, const uint32_t scalePointId, char* const strBuf) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
@@ -375,7 +375,7 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Set data (plugin-specific stuff) // Set data (plugin-specific stuff)


void setParameterValue(const uint32_t parameterId, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback) override
void setParameterValue(const uint32_t parameterId, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fParamBuffers != nullptr,); CARLA_SAFE_ASSERT_RETURN(fParamBuffers != nullptr,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
@@ -821,31 +821,43 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Plugin processing // Plugin processing


void activate() override
void activate() noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,);


if (fDescriptor->activate != nullptr) if (fDescriptor->activate != nullptr)
{ {
fDescriptor->activate(fHandle);
try {
fDescriptor->activate(fHandle);
} catch(...) {}


if (fHandle2 != nullptr) if (fHandle2 != nullptr)
fDescriptor->activate(fHandle2);
{
try {
fDescriptor->activate(fHandle2);
} catch(...) {}
}
} }
} }


void deactivate() override
void deactivate() noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,);


if (fDescriptor->deactivate != nullptr) if (fDescriptor->deactivate != nullptr)
{ {
fDescriptor->deactivate(fHandle);
try {
fDescriptor->deactivate(fHandle);
} catch(...) {}


if (fHandle2 != nullptr) if (fHandle2 != nullptr)
fDescriptor->deactivate(fHandle2);
{
try {
fDescriptor->deactivate(fHandle2);
} catch(...) {}
}
} }
} }




+ 11
- 9
source/backend/plugin/LinuxSamplerPlugin.cpp View File

@@ -295,7 +295,7 @@ public:
return getPluginTypeFromString(fFormat); return getPluginTypeFromString(fFormat);
} }


PluginCategory getCategory() const override
PluginCategory getCategory() const noexcept override
{ {
return PLUGIN_CATEGORY_SYNTH; return PLUGIN_CATEGORY_SYNTH;
} }
@@ -313,7 +313,7 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Information (per-plugin data) // Information (per-plugin data)


unsigned int getOptionsAvailable() const override
unsigned int getOptionsAvailable() const noexcept override
{ {
unsigned int options = 0x0; unsigned int options = 0x0;


@@ -326,7 +326,7 @@ public:
return options; return options;
} }


void getLabel(char* const strBuf) const override
void getLabel(char* const strBuf) const noexcept override
{ {
if (fLabel != nullptr) if (fLabel != nullptr)
std::strncpy(strBuf, fLabel, STR_MAX); std::strncpy(strBuf, fLabel, STR_MAX);
@@ -334,7 +334,7 @@ public:
CarlaPlugin::getLabel(strBuf); CarlaPlugin::getLabel(strBuf);
} }


void getMaker(char* const strBuf) const override
void getMaker(char* const strBuf) const noexcept override
{ {
if (fMaker != nullptr) if (fMaker != nullptr)
std::strncpy(strBuf, fMaker, STR_MAX); std::strncpy(strBuf, fMaker, STR_MAX);
@@ -342,12 +342,12 @@ public:
CarlaPlugin::getMaker(strBuf); CarlaPlugin::getMaker(strBuf);
} }


void getCopyright(char* const strBuf) const override
void getCopyright(char* const strBuf) const noexcept override
{ {
getMaker(strBuf); getMaker(strBuf);
} }


void getRealName(char* const strBuf) const override
void getRealName(char* const strBuf) const noexcept override
{ {
if (fRealName != nullptr) if (fRealName != nullptr)
std::strncpy(strBuf, fRealName, STR_MAX); std::strncpy(strBuf, fRealName, STR_MAX);
@@ -372,7 +372,7 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Set data (internal stuff) // Set data (internal stuff)


void setCtrlChannel(const int8_t channel, const bool sendOsc, const bool sendCallback) override
void setCtrlChannel(const int8_t channel, const bool sendOsc, const bool sendCallback) noexcept override
{ {
if (channel < MAX_MIDI_CHANNELS) if (channel < MAX_MIDI_CHANNELS)
pData->midiprog.current = fCurMidiProgs[channel]; pData->midiprog.current = fCurMidiProgs[channel];
@@ -445,7 +445,7 @@ public:
CarlaPlugin::setCustomData(type, key, value, sendGui); CarlaPlugin::setCustomData(type, key, value, sendGui);
} }


void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) override
void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->midiprog.count),); CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->midiprog.count),);


@@ -466,7 +466,9 @@ public:
} }
else*/ else*/
{ {
fInstrument->LoadInstrumentInBackground(fInstrumentIds[rIndex], engineChannel);
try {
fInstrument->LoadInstrumentInBackground(fInstrumentIds[rIndex], engineChannel);
} catch(...) {}
} }


fCurMidiProgs[pData->ctrlChannel] = index; fCurMidiProgs[pData->ctrlChannel] = index;


+ 833
- 4736
source/backend/plugin/Lv2Plugin.cpp
File diff suppressed because it is too large
View File


+ 65
- 41
source/backend/plugin/NativePlugin.cpp View File

@@ -205,7 +205,7 @@ public:
return PLUGIN_INTERNAL; return PLUGIN_INTERNAL;
} }


PluginCategory getCategory() const override
PluginCategory getCategory() const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, PLUGIN_CATEGORY_NONE); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, PLUGIN_CATEGORY_NONE);


@@ -225,13 +225,14 @@ public:
return fMidiOut.count; return fMidiOut.count;
} }


uint32_t getParameterScalePointCount(const uint32_t parameterId) const override
uint32_t getParameterScalePointCount(const uint32_t parameterId) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, 0); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, 0);
CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_info != nullptr, 0); CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_info != nullptr, 0);
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr, 0); CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr, 0);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, 0); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, 0);


// FIXME - try
if (const NativeParameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)) if (const NativeParameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId))
return param->scalePointCount; return param->scalePointCount;


@@ -247,11 +248,12 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Information (per-plugin data) // Information (per-plugin data)


unsigned int getOptionsAvailable() const override
unsigned int getOptionsAvailable() const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, 0x0); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, 0x0);
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr, 0); CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr, 0);


// FIXME - try
const bool hasMidiProgs(fDescriptor->get_midi_program_count != nullptr && fDescriptor->get_midi_program_count(fHandle) > 0); const bool hasMidiProgs(fDescriptor->get_midi_program_count != nullptr && fDescriptor->get_midi_program_count(fHandle) > 0);


unsigned int options = 0x0; unsigned int options = 0x0;
@@ -284,17 +286,18 @@ public:
return options; return options;
} }


float getParameterValue(const uint32_t parameterId) const override
float getParameterValue(const uint32_t parameterId) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, 0.0f); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, 0.0f);
CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_value != nullptr, 0.0f); CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_value != nullptr, 0.0f);
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr, 0.0f); CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr, 0.0f);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, 0.0f); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, 0.0f);


// FIXME - try
return fDescriptor->get_parameter_value(fHandle, parameterId); return fDescriptor->get_parameter_value(fHandle, parameterId);
} }


float getParameterScalePointValue(const uint32_t parameterId, const uint32_t scalePointId) const override
float getParameterScalePointValue(const uint32_t parameterId, const uint32_t scalePointId) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, 0.0f); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, 0.0f);
CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_info != nullptr, 0.0f); CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_info != nullptr, 0.0f);
@@ -302,6 +305,7 @@ public:
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, 0.0f); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, 0.0f);
CARLA_SAFE_ASSERT_RETURN(scalePointId < getParameterScalePointCount(parameterId), 0.0f); CARLA_SAFE_ASSERT_RETURN(scalePointId < getParameterScalePointCount(parameterId), 0.0f);


// FIXME - try
if (const NativeParameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)) if (const NativeParameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId))
{ {
const NativeParameterScalePoint* scalePoint(&param->scalePoints[scalePointId]); const NativeParameterScalePoint* scalePoint(&param->scalePoints[scalePointId]);
@@ -312,7 +316,7 @@ public:
return 0.0f; return 0.0f;
} }


void getLabel(char* const strBuf) const override
void getLabel(char* const strBuf) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);


@@ -322,7 +326,7 @@ public:
CarlaPlugin::getLabel(strBuf); CarlaPlugin::getLabel(strBuf);
} }


void getMaker(char* const strBuf) const override
void getMaker(char* const strBuf) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);


@@ -332,7 +336,7 @@ public:
CarlaPlugin::getMaker(strBuf); CarlaPlugin::getMaker(strBuf);
} }


void getCopyright(char* const strBuf) const override
void getCopyright(char* const strBuf) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);


@@ -342,7 +346,7 @@ public:
CarlaPlugin::getCopyright(strBuf); CarlaPlugin::getCopyright(strBuf);
} }


void getRealName(char* const strBuf) const override
void getRealName(char* const strBuf) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);


@@ -352,13 +356,14 @@ public:
CarlaPlugin::getRealName(strBuf); CarlaPlugin::getRealName(strBuf);
} }


void getParameterName(const uint32_t parameterId, char* const strBuf) const override
void getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_info != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_info != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);


// FIXME - try
if (const NativeParameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)) if (const NativeParameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId))
{ {
if (param->name != nullptr) if (param->name != nullptr)
@@ -374,7 +379,7 @@ public:
CarlaPlugin::getParameterName(parameterId, strBuf); CarlaPlugin::getParameterName(parameterId, strBuf);
} }


void getParameterText(const uint32_t parameterId, const float value, char* const strBuf) const override
void getParameterText(const uint32_t parameterId, const float value, char* const strBuf) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_text != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_text != nullptr,);
@@ -382,6 +387,7 @@ public:
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);


// FIXME - try
if (const char* const text = fDescriptor->get_parameter_text(fHandle, parameterId, value)) if (const char* const text = fDescriptor->get_parameter_text(fHandle, parameterId, value))
{ {
std::strncpy(strBuf, text, STR_MAX); std::strncpy(strBuf, text, STR_MAX);
@@ -392,13 +398,14 @@ public:
CarlaPlugin::getParameterText(parameterId, value, strBuf); CarlaPlugin::getParameterText(parameterId, value, strBuf);
} }


void getParameterUnit(const uint32_t parameterId, char* const strBuf) const override
void getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_info != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_info != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);


// FIXME - try
if (const NativeParameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)) if (const NativeParameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId))
{ {
if (param->unit != nullptr) if (param->unit != nullptr)
@@ -413,7 +420,7 @@ public:
CarlaPlugin::getParameterUnit(parameterId, strBuf); CarlaPlugin::getParameterUnit(parameterId, strBuf);
} }


void getParameterScalePointLabel(const uint32_t parameterId, const uint32_t scalePointId, char* const strBuf) const override
void getParameterScalePointLabel(const uint32_t parameterId, const uint32_t scalePointId, char* const strBuf) const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_info != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_info != nullptr,);
@@ -421,6 +428,7 @@ public:
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
CARLA_SAFE_ASSERT_RETURN(scalePointId < getParameterScalePointCount(parameterId),); CARLA_SAFE_ASSERT_RETURN(scalePointId < getParameterScalePointCount(parameterId),);


// FIXME - try
if (const NativeParameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)) if (const NativeParameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId))
{ {
const NativeParameterScalePoint* scalePoint(&param->scalePoints[scalePointId]); const NativeParameterScalePoint* scalePoint(&param->scalePoints[scalePointId]);
@@ -492,7 +500,7 @@ public:
CarlaPlugin::setName(newName); CarlaPlugin::setName(newName);
} }


void setCtrlChannel(const int8_t channel, const bool sendOsc, const bool sendCallback) override
void setCtrlChannel(const int8_t channel, const bool sendOsc, const bool sendCallback) noexcept override
{ {
if (channel < MAX_MIDI_CHANNELS && pData->midiprog.count > 0) if (channel < MAX_MIDI_CHANNELS && pData->midiprog.count > 0)
pData->midiprog.current = fCurMidiProgs[channel]; pData->midiprog.current = fCurMidiProgs[channel];
@@ -503,7 +511,7 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Set data (plugin-specific stuff) // Set data (plugin-specific stuff)


void setParameterValue(const uint32_t parameterId, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback) override
void setParameterValue(const uint32_t parameterId, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fDescriptor->set_parameter_value != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor->set_parameter_value != nullptr,);
@@ -512,6 +520,7 @@ public:


const float fixedValue(pData->param.getFixedValue(parameterId, value)); const float fixedValue(pData->param.getFixedValue(parameterId, value));


// FIXME - try
fDescriptor->set_parameter_value(fHandle, parameterId, fixedValue); fDescriptor->set_parameter_value(fHandle, parameterId, fixedValue);


if (fHandle2 != nullptr) if (fHandle2 != nullptr)
@@ -596,7 +605,7 @@ public:
CarlaPlugin::setCustomData(type, key, value, sendGui); CarlaPlugin::setCustomData(type, key, value, sendGui);
} }


void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) override
void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,);
@@ -614,10 +623,16 @@ public:


const ScopedSingleProcessLocker spl(this, (sendGui || sendOsc || sendCallback)); const ScopedSingleProcessLocker spl(this, (sendGui || sendOsc || sendCallback));


fDescriptor->set_midi_program(fHandle, channel, bank, program);
try {
fDescriptor->set_midi_program(fHandle, channel, bank, program);
} catch(...) {}


if (fHandle2 != nullptr) if (fHandle2 != nullptr)
fDescriptor->set_midi_program(fHandle2, channel, bank, program);
{
try {
fDescriptor->set_midi_program(fHandle2, channel, bank, program);
} catch(...) {}
}


fCurMidiProgs[channel] = index; fCurMidiProgs[channel] = index;
} }
@@ -1160,31 +1175,43 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Plugin processing // Plugin processing


void activate() override
void activate() noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,);


if (fDescriptor->activate != nullptr) if (fDescriptor->activate != nullptr)
{ {
fDescriptor->activate(fHandle);
try {
fDescriptor->activate(fHandle);
} catch(...) {}


if (fHandle2 != nullptr) if (fHandle2 != nullptr)
fDescriptor->activate(fHandle2);
{
try {
fDescriptor->activate(fHandle2);
} catch(...) {}
}
} }
} }


void deactivate() override
void deactivate() noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,);


if (fDescriptor->deactivate != nullptr) if (fDescriptor->deactivate != nullptr)
{ {
fDescriptor->deactivate(fHandle);
try {
fDescriptor->deactivate(fHandle);
} catch(...) {}


if (fHandle2 != nullptr) if (fHandle2 != nullptr)
fDescriptor->deactivate(fHandle2);
{
try {
fDescriptor->deactivate(fHandle2);
} catch(...) {}
}
} }
} }


@@ -1913,7 +1940,7 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Post-poned UI Stuff // Post-poned UI Stuff


void uiParameterChange(const uint32_t index, const float value) override
void uiParameterChange(const uint32_t index, const float /*value*/) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,);
@@ -1926,11 +1953,11 @@ public:
if (index >= pData->param.count) if (index >= pData->param.count)
return; return;


if (fDescriptor->ui_set_parameter_value != nullptr)
fDescriptor->ui_set_parameter_value(fHandle, index, value);
//if (fDescriptor->ui_set_parameter_value != nullptr)
// fDescriptor->ui_set_parameter_value(fHandle, index, value);
} }


void uiMidiProgramChange(const uint32_t index) override
void uiMidiProgramChange(const uint32_t index) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,);
@@ -1943,11 +1970,11 @@ public:
if (index >= pData->midiprog.count) if (index >= pData->midiprog.count)
return; return;


if (fDescriptor->ui_set_midi_program != nullptr) // TODO
fDescriptor->ui_set_midi_program(fHandle, 0, pData->midiprog.data[index].bank, pData->midiprog.data[index].program);
//if (fDescriptor->ui_set_midi_program != nullptr) // TODO
// fDescriptor->ui_set_midi_program(fHandle, 0, pData->midiprog.data[index].bank, pData->midiprog.data[index].program);
} }


void uiNoteOn(const uint8_t channel, const uint8_t note, const uint8_t velo) override
void uiNoteOn(const uint8_t channel, const uint8_t note, const uint8_t velo) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,);
@@ -1969,7 +1996,7 @@ public:
// TODO // TODO
} }


void uiNoteOff(const uint8_t channel, const uint8_t note) override
void uiNoteOff(const uint8_t channel, const uint8_t note) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,);
@@ -2151,19 +2178,16 @@ protected:
// ------------------------------------------------------------------- // -------------------------------------------------------------------


public: public:
static size_t getPluginCount()
static size_t getPluginCount() noexcept
{ {
return sPluginDescriptors.count(); return sPluginDescriptors.count();
} }


static const NativePluginDescriptor* getPluginDescriptor(const size_t index)
static const NativePluginDescriptor* getPluginDescriptor(const size_t index) noexcept
{ {
CARLA_ASSERT(index < sPluginDescriptors.count());
CARLA_SAFE_ASSERT_RETURN(index < sPluginDescriptors.count(), nullptr);


if (index < sPluginDescriptors.count())
return sPluginDescriptors.getAt(index);

return nullptr;
return sPluginDescriptors.getAt(index);
} }


static void registerPlugin(const NativePluginDescriptor* desc) static void registerPlugin(const NativePluginDescriptor* desc)
@@ -2441,12 +2465,12 @@ void carla_register_native_plugin(const NativePluginDescriptor* desc)
CARLA_BACKEND_START_NAMESPACE CARLA_BACKEND_START_NAMESPACE


#ifdef WANT_NATIVE #ifdef WANT_NATIVE
size_t CarlaPlugin::getNativePluginCount()
size_t CarlaPlugin::getNativePluginCount() noexcept
{ {
return NativePlugin::getPluginCount(); return NativePlugin::getPluginCount();
} }


const NativePluginDescriptor* CarlaPlugin::getNativePluginDescriptor(const size_t index)
const NativePluginDescriptor* CarlaPlugin::getNativePluginDescriptor(const size_t index) noexcept
{ {
return NativePlugin::getPluginDescriptor(index); return NativePlugin::getPluginDescriptor(index);
} }


+ 3
- 3
source/modules/jackbridge/JackBridge.hpp View File

@@ -361,9 +361,9 @@ CARLA_EXPORT bool jackbridge_custom_set_data_appearance_callback(jack_client_t*
CARLA_EXPORT const char** jackbridge_custom_get_keys(jack_client_t* client, const char* client_name); CARLA_EXPORT const char** jackbridge_custom_get_keys(jack_client_t* client, const char* client_name);
#endif #endif


CARLA_EXPORT bool jackbridge_sem_init(void* sem);
CARLA_EXPORT bool jackbridge_sem_destroy(void* sem);
CARLA_EXPORT bool jackbridge_sem_post(void* sem);
CARLA_EXPORT bool jackbridge_sem_init(void* sem) noexcept;
CARLA_EXPORT bool jackbridge_sem_destroy(void* sem) noexcept;
CARLA_EXPORT bool jackbridge_sem_post(void* sem) noexcept;
CARLA_EXPORT bool jackbridge_sem_timedwait(void* sem, int secs); CARLA_EXPORT bool jackbridge_sem_timedwait(void* sem, int secs);


#endif // JACKBRIDGE_HPP_INCLUDED #endif // JACKBRIDGE_HPP_INCLUDED

+ 9
- 9
source/modules/jackbridge/JackBridge2.cpp View File

@@ -24,26 +24,26 @@


#ifndef JACKBRIDGE_HPP_INCLUDED #ifndef JACKBRIDGE_HPP_INCLUDED
// don't include the whole JACK API in this file // don't include the whole JACK API in this file
CARLA_EXPORT bool jackbridge_sem_init(void* sem);
CARLA_EXPORT bool jackbridge_sem_destroy(void* sem);
CARLA_EXPORT bool jackbridge_sem_post(void* sem);
CARLA_EXPORT bool jackbridge_sem_init(void* sem) noexcept;
CARLA_EXPORT bool jackbridge_sem_destroy(void* sem) noexcept;
CARLA_EXPORT bool jackbridge_sem_post(void* sem) noexcept;
CARLA_EXPORT bool jackbridge_sem_timedwait(void* sem, int secs); CARLA_EXPORT bool jackbridge_sem_timedwait(void* sem, int secs);
#endif #endif


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


#if JACKBRIDGE_DUMMY #if JACKBRIDGE_DUMMY
bool jackbridge_sem_init(void*)
bool jackbridge_sem_init(void*) noexcept
{ {
return false; return false;
} }


bool jackbridge_sem_destroy(void*)
bool jackbridge_sem_destroy(void*) noexcept
{ {
return false; return false;
} }


bool jackbridge_sem_post(void*)
bool jackbridge_sem_post(void*) noexcept
{ {
return false; return false;
} }
@@ -58,17 +58,17 @@ bool jackbridge_sem_timedwait(void*, int)
#include <sys/types.h> #include <sys/types.h>
#include <semaphore.h> #include <semaphore.h>


bool jackbridge_sem_init(void* sem)
bool jackbridge_sem_init(void* sem) noexcept
{ {
return (sem_init((sem_t*)sem, 1, 0) == 0); return (sem_init((sem_t*)sem, 1, 0) == 0);
} }


bool jackbridge_sem_destroy(void* sem)
bool jackbridge_sem_destroy(void* sem) noexcept
{ {
return (sem_destroy((sem_t*)sem) == 0); return (sem_destroy((sem_t*)sem) == 0);
} }


bool jackbridge_sem_post(void* sem)
bool jackbridge_sem_post(void* sem) noexcept
{ {
return (sem_post((sem_t*)sem) == 0); return (sem_post((sem_t*)sem) == 0);
} }


+ 0
- 207
source/tests/CarlaBackendDummy.cpp View File

@@ -1,207 +0,0 @@
/*
* Carla Tests
* Copyright (C) 2013 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the doc/GPL.txt file.
*/

#include "CarlaPlugin.hpp"
#include "CarlaEngine.hpp"

CARLA_BACKEND_START_NAMESPACE

// 1 - utils
// 2 - engine
// 3 - plugin
// 4 - standalone
#define ANSI_TEST_N 2

#if ANSI_TEST_N != 3
struct SaveState {};

// -----------------------------------------------------------------------
// Fallback data

static const ParameterData kParameterDataNull;
static const ParameterRanges kParameterRangesNull;
static const MidiProgramData kMidiProgramDataNull;
static const CustomData kCustomDataNull;

// -----------------------------------------------------------------------
// CarlaPlugin

CarlaPlugin::CarlaPlugin(CarlaEngine* const, const unsigned int id)
: fId(id), pData(nullptr) {}
CarlaPlugin::~CarlaPlugin() {}

uint32_t CarlaPlugin::getLatencyInFrames() const noexcept { return 0; }
uint32_t CarlaPlugin::getAudioInCount() const noexcept { return 0; }
uint32_t CarlaPlugin::getAudioOutCount() const noexcept { return 0; }
uint32_t CarlaPlugin::getMidiInCount() const noexcept { return 0; }
uint32_t CarlaPlugin::getMidiOutCount() const noexcept { return 0; }
uint32_t CarlaPlugin::getParameterCount() const noexcept { return 0; }
uint32_t CarlaPlugin::getParameterScalePointCount(const uint32_t) const { return 0; }
uint32_t CarlaPlugin::getProgramCount() const noexcept { return 0; }
uint32_t CarlaPlugin::getMidiProgramCount() const noexcept { return 0; }
uint32_t CarlaPlugin::getCustomDataCount() const noexcept { return 0; }
int32_t CarlaPlugin::getCurrentProgram() const noexcept { return 0; }
int32_t CarlaPlugin::getCurrentMidiProgram() const noexcept { return 0; }

const ParameterData& CarlaPlugin::getParameterData(const uint32_t) const { return kParameterDataNull; }
const ParameterRanges& CarlaPlugin::getParameterRanges(const uint32_t) const { return kParameterRangesNull; }
bool CarlaPlugin::isParameterOutput(const uint32_t) const { return false; }
const MidiProgramData& CarlaPlugin::getMidiProgramData(const uint32_t) const { return kMidiProgramDataNull; }
const CustomData& CarlaPlugin::getCustomData(const uint32_t) const { return kCustomDataNull; }
int32_t CarlaPlugin::getChunkData(void** const) const { return 0; }
unsigned int CarlaPlugin::getAvailableOptions() const { return 0x0; }

float CarlaPlugin::getParameterValue(const uint32_t) const { return 0.0f; }
float CarlaPlugin::getParameterScalePointValue(const uint32_t, const uint32_t) const { return 0.0f; }

void CarlaPlugin::getLabel(char* const) const noexcept {}
void CarlaPlugin::getMaker(char* const) const noexcept {}
void CarlaPlugin::getCopyright(char* const) const noexcept {}
void CarlaPlugin::getRealName(char* const) const noexcept {}
void CarlaPlugin::getParameterName(const uint32_t, char* const) const {}
void CarlaPlugin::getParameterSymbol(const uint32_t, char* const) const {}
void CarlaPlugin::getParameterText(const uint32_t, const float, char* const) const {}
void CarlaPlugin::getParameterUnit(const uint32_t, char* const) const {}
void CarlaPlugin::getParameterScalePointLabel(const uint32_t, const uint32_t, char* const) const {}
void CarlaPlugin::getProgramName(const uint32_t, char* const) const {}
void CarlaPlugin::getMidiProgramName(const uint32_t, char* const) const {}
void CarlaPlugin::getParameterCountInfo(uint32_t* const, uint32_t* const, uint32_t* const) const {}

void CarlaPlugin::prepareForSave() {}
const SaveState& CarlaPlugin::getSaveState() { static SaveState saveState; return saveState; }

void CarlaPlugin::loadSaveState(const SaveState&) {}
bool CarlaPlugin::saveStateToFile(const char* const) { return false; }
bool CarlaPlugin::loadStateFromFile(const char* const) { return false; }

void CarlaPlugin::setId(const unsigned int newId) noexcept { fId = newId; }
void CarlaPlugin::setName(const char* const newName) { fName = newName; }
void CarlaPlugin::setEnabled(const bool yesNo) { fEnabled = yesNo; }

void CarlaPlugin::setOption(const unsigned int, const bool) {}
void CarlaPlugin::setActive(const bool, const bool, const bool) {}
void CarlaPlugin::setDryWet(const float, const bool, const bool) {}
void CarlaPlugin::setVolume(const float, const bool, const bool) {}
void CarlaPlugin::setBalanceLeft(const float, const bool, const bool) {}
void CarlaPlugin::setBalanceRight(const float, const bool, const bool) {}
void CarlaPlugin::setPanning(const float, const bool, const bool) {}
void CarlaPlugin::setCtrlChannel(const int8_t, const bool, const bool) {}
void CarlaPlugin::setParameterValue(const uint32_t, const float, const bool, const bool, const bool) {}
void CarlaPlugin::setParameterValueByRealIndex(const int32_t, const float, const bool, const bool, const bool) {}
void CarlaPlugin::setParameterMidiChannel(const uint32_t, uint8_t, const bool, const bool) {}
void CarlaPlugin::setParameterMidiCC(const uint32_t, int16_t, const bool, const bool) {}
void CarlaPlugin::setCustomData(const char* const, const char* const, const char* const, const bool) {}
void CarlaPlugin::setChunkData(const char* const) {}
void CarlaPlugin::setProgram(int32_t, const bool, const bool, const bool) {}
void CarlaPlugin::setMidiProgram(int32_t, const bool, const bool, const bool) {}
void CarlaPlugin::setMidiProgramById(const uint32_t, const uint32_t, const bool, const bool, const bool) {}
void CarlaPlugin::showGui(const bool) {}
void CarlaPlugin::idleGui() {}
void CarlaPlugin::reloadPrograms(const bool) {}
void CarlaPlugin::activate() {}
void CarlaPlugin::deactivate() {}
void CarlaPlugin::bufferSizeChanged(const uint32_t) {}
void CarlaPlugin::sampleRateChanged(const double) {}
void CarlaPlugin::offlineModeChanged(const bool) {}
bool CarlaPlugin::tryLock() { return false; }
void CarlaPlugin::unlock() {}
void CarlaPlugin::initBuffers() {}
void CarlaPlugin::clearBuffers() {}
void CarlaPlugin::registerToOscClient() {}
void CarlaPlugin::updateOscData(const lo_address&, const char* const) {}
//void CarlaPlugin::freeOscData() {}
bool CarlaPlugin::waitForOscGuiShow() { return false; }
void CarlaPlugin::sendMidiSingleNote(const uint8_t, const uint8_t, const uint8_t, const bool, const bool, const bool) {}
void CarlaPlugin::sendMidiAllNotesOffToCallback() {}
void CarlaPlugin::postRtEventsRun() {}
void CarlaPlugin::uiParameterChange(const uint32_t, const float) {}
void CarlaPlugin::uiProgramChange(const uint32_t) {}
void CarlaPlugin::uiMidiProgramChange(const uint32_t) {}
void CarlaPlugin::uiNoteOn(const uint8_t, const uint8_t, const uint8_t) {}
void CarlaPlugin::uiNoteOff(const uint8_t, const uint8_t) {}

size_t CarlaPlugin::getNativePluginCount() { return 0; }
const PluginDescriptor* CarlaPlugin::getNativePluginDescriptor(const size_t) { return nullptr; }
#endif

#if ANSI_TEST_N != 2
// -----------------------------------------------------------------------
// CarlaEngine

CarlaEngine::CarlaEngine()
: fBufferSize(0),
fSampleRate(0.0),
pData(nullptr) {}
CarlaEngine::~CarlaEngine() {}

unsigned int CarlaEngine::getDriverCount() { return 0; }
const char* CarlaEngine::getDriverName(const unsigned int) { return nullptr; }
const char** CarlaEngine::getDriverDeviceNames(const unsigned int) { return nullptr; }
CarlaEngine* CarlaEngine::newDriverByName(const char* const) { return nullptr; }

unsigned int CarlaEngine::getMaxClientNameSize() const noexcept { return 0; }
unsigned int CarlaEngine::getMaxPortNameSize() const noexcept { return 0; }
unsigned int CarlaEngine::getCurrentPluginCount() const noexcept { return 0; }
unsigned int CarlaEngine::getMaxPluginNumber() const noexcept { return 0; }

bool CarlaEngine::init(const char* const) { return false; }
bool CarlaEngine::close() { return false; }
void CarlaEngine::idle() {}
CarlaEngineClient* CarlaEngine::addClient(CarlaPlugin* const) { return nullptr; }

void CarlaEngine::removeAllPlugins() {}
bool CarlaEngine::addPlugin(const BinaryType, const PluginType, const char* const, const char* const, const char* const,
const void* const) { return false; }
bool CarlaEngine::removePlugin(const unsigned int) { return false; }
bool CarlaEngine::clonePlugin(const unsigned int) { return false; }
bool CarlaEngine::replacePlugin(const unsigned int) { return false; }
bool CarlaEngine::switchPlugins(const unsigned int, const unsigned int) { return false; }

const char* CarlaEngine::renamePlugin(const unsigned int, const char* const) { return nullptr; }
CarlaPlugin* CarlaEngine::getPlugin(const unsigned int) const { return nullptr; }
CarlaPlugin* CarlaEngine::getPluginUnchecked(const unsigned int) const noexcept { return nullptr; }
const char* CarlaEngine::getUniquePluginName(const char* const) { return nullptr; }

bool CarlaEngine::loadFilename(const char* const) { return false; }
bool CarlaEngine::loadProject(const char* const) { return false; }
bool CarlaEngine::saveProject(const char* const) { return false; }

float CarlaEngine::getInputPeak(const unsigned int, const unsigned short) const { return 0.0f; }
float CarlaEngine::getOutputPeak(const unsigned int, const unsigned short) const { return 0.0f; }

void CarlaEngine::callback(const CallbackType, const unsigned int, const int, const int, const float, const char* const) {}
void CarlaEngine::setCallback(const CallbackFunc, void* const) {}
bool CarlaEngine::patchbayConnect(int, int) { return false; }
bool CarlaEngine::patchbayDisconnect(int) { return false; }
void CarlaEngine::patchbayRefresh() {}
void CarlaEngine::transportPlay() {}
void CarlaEngine::transportPause() {}
void CarlaEngine::transportRelocate(const uint32_t) {}

const char* CarlaEngine::getLastError() const noexcept { return nullptr; }
void CarlaEngine::setLastError(const char* const) {}
void CarlaEngine::setAboutToClose() {}
void CarlaEngine::setOption(const OptionsType, const int, const char* const) {}
bool CarlaEngine::isOscControlRegistered() const noexcept { return false; }
void CarlaEngine::idleOsc() {}
const char* CarlaEngine::getOscServerPathTCP() const noexcept { return nullptr; }
const char* CarlaEngine::getOscServerPathUDP() const noexcept { return nullptr; }
#endif

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

CARLA_BACKEND_END_NAMESPACE

+ 13
- 13
source/utils/CarlaRingBuffer.hpp View File

@@ -21,9 +21,9 @@


#include "CarlaUtils.hpp" #include "CarlaUtils.hpp"


#ifndef RING_BUFFER_SIZE
# define RING_BUFFER_SIZE 2048
#endif
//#ifndef RING_BUFFER_SIZE
#define RING_BUFFER_SIZE 2048
//#endif


// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// RingBuffer struct // RingBuffer struct
@@ -97,28 +97,28 @@ public:


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


char readChar()
char readChar() noexcept
{ {
char c = '\0'; char c = '\0';
tryRead(&c, sizeof(char)); tryRead(&c, sizeof(char));
return c; return c;
} }


int32_t readInt()
int32_t readInt() noexcept
{ {
int32_t i = 0; int32_t i = 0;
tryRead(&i, sizeof(int32_t)); tryRead(&i, sizeof(int32_t));
return i; return i;
} }


int64_t readLong()
int64_t readLong() noexcept
{ {
int64_t l = 0; int64_t l = 0;
tryRead(&l, sizeof(int64_t)); tryRead(&l, sizeof(int64_t));
return l; return l;
} }


float readFloat()
float readFloat() noexcept
{ {
float f = 0.0f; float f = 0.0f;
tryRead(&f, sizeof(float)); tryRead(&f, sizeof(float));
@@ -127,22 +127,22 @@ public:


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


void writeChar(const char value)
void writeChar(const char value) noexcept
{ {
tryWrite(&value, sizeof(char)); tryWrite(&value, sizeof(char));
} }


void writeInt(const int32_t value)
void writeInt(const int32_t value) noexcept
{ {
tryWrite(&value, sizeof(int32_t)); tryWrite(&value, sizeof(int32_t));
} }


void writeLong(const int64_t value)
void writeLong(const int64_t value) noexcept
{ {
tryWrite(&value, sizeof(int64_t)); tryWrite(&value, sizeof(int64_t));
} }


void writeFloat(const float value)
void writeFloat(const float value) noexcept
{ {
tryWrite(&value, sizeof(float)); tryWrite(&value, sizeof(float));
} }
@@ -150,7 +150,7 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------


protected: protected:
void tryRead(void* const buf, const size_t size)
void tryRead(void* const buf, const size_t size) noexcept
{ {
CARLA_SAFE_ASSERT_RETURN(fRingBuf != nullptr,); CARLA_SAFE_ASSERT_RETURN(fRingBuf != nullptr,);
CARLA_SAFE_ASSERT_RETURN(buf != nullptr,); CARLA_SAFE_ASSERT_RETURN(buf != nullptr,);
@@ -194,7 +194,7 @@ protected:
fRingBuf->tail = static_cast<int32_t>(readto); fRingBuf->tail = static_cast<int32_t>(readto);
} }


void tryWrite(const void* const buf, const size_t size)
void tryWrite(const void* const buf, const size_t size) noexcept
{ {
CARLA_SAFE_ASSERT_RETURN(fRingBuf != nullptr,); CARLA_SAFE_ASSERT_RETURN(fRingBuf != nullptr,);
CARLA_SAFE_ASSERT_RETURN(buf != nullptr,); CARLA_SAFE_ASSERT_RETURN(buf != nullptr,);


+ 32
- 6
source/utils/LinkedList.hpp View File

@@ -70,7 +70,7 @@ public:


class Itenerator { class Itenerator {
public: public:
Itenerator(const k_list_head* queue)
Itenerator(const k_list_head* queue) noexcept
: fData(nullptr), : fData(nullptr),
fEntry(queue->next), fEntry(queue->next),
fEntry2(fEntry->next), fEntry2(fEntry->next),
@@ -92,7 +92,7 @@ public:
fEntry2 = fEntry->next; fEntry2 = fEntry->next;
} }


T& getValue()
T& getValue() noexcept
{ {
fData = list_entry(fEntry, Data, siblings); fData = list_entry(fEntry, Data, siblings);
CARLA_ASSERT(fData != nullptr); CARLA_ASSERT(fData != nullptr);
@@ -108,7 +108,7 @@ public:
friend class AbstractLinkedList; friend class AbstractLinkedList;
}; };


Itenerator begin() const
Itenerator begin() const noexcept
{ {
return Itenerator(&fQueue); return Itenerator(&fQueue);
} }
@@ -199,7 +199,33 @@ public:
return false; return false;
} }


T& getAt(const size_t index, const bool remove = false)
T& getAt(const size_t index) noexcept
{
if (fCount == 0 || index >= fCount)
return fRetValue;

size_t i = 0;
Data* data = nullptr;
k_list_head* entry;
k_list_head* entry2;

list_for_each_safe(entry, entry2, &fQueue)
{
if (index != i++)
continue;

data = list_entry(entry, Data, siblings);

if (data != nullptr)
fRetValue = data->value;

break;
}

return fRetValue;
}

T& getAt(const size_t index, const bool remove)
{ {
if (fCount == 0 || index >= fCount) if (fCount == 0 || index >= fCount)
return fRetValue; return fRetValue;
@@ -309,7 +335,7 @@ public:
} }
} }


void spliceAppend(AbstractLinkedList& list, const bool init = true)
void spliceAppend(AbstractLinkedList& list, const bool init = true) noexcept
{ {
if (init) if (init)
{ {
@@ -324,7 +350,7 @@ public:
} }
} }


void spliceInsert(AbstractLinkedList& list, const bool init = true)
void spliceInsert(AbstractLinkedList& list, const bool init = true) noexcept
{ {
if (init) if (init)
{ {


Loading…
Cancel
Save