| @@ -233,27 +233,21 @@ const unsigned int PLUGIN_OPTION_SEND_ALL_SOUND_OFF = 0x100; | |||||
| * @{ | * @{ | ||||
| */ | */ | ||||
| /*! | |||||
| * Parameter is input.\n | |||||
| * When this hint is not set, parameter is assumed to be output. | |||||
| */ | |||||
| const unsigned int PARAMETER_IS_INPUT = 0x001; | |||||
| /*! | /*! | ||||
| * Parameter value is boolean. | * Parameter value is boolean. | ||||
| * It's always at either minimum or maximum value. | * It's always at either minimum or maximum value. | ||||
| */ | */ | ||||
| const unsigned int PARAMETER_IS_BOOLEAN = 0x002; | |||||
| const unsigned int PARAMETER_IS_BOOLEAN = 0x001; | |||||
| /*! | /*! | ||||
| * Parameter value is integer. | * Parameter value is integer. | ||||
| */ | */ | ||||
| const unsigned int PARAMETER_IS_INTEGER = 0x004; | |||||
| const unsigned int PARAMETER_IS_INTEGER = 0x002; | |||||
| /*! | /*! | ||||
| * Parameter value is logarithmic. | * Parameter value is logarithmic. | ||||
| */ | */ | ||||
| const unsigned int PARAMETER_IS_LOGARITHMIC = 0x008; | |||||
| const unsigned int PARAMETER_IS_LOGARITHMIC = 0x004; | |||||
| /*! | /*! | ||||
| * Parameter is enabled. | * Parameter is enabled. | ||||
| @@ -1165,46 +1165,53 @@ private: | |||||
| // Bridge/Controller OSC stuff | // Bridge/Controller OSC stuff | ||||
| public: | public: | ||||
| #ifdef BUILD_BRIDGE | #ifdef BUILD_BRIDGE | ||||
| void oscSend_bridge_audio_count(const int32_t ins, const int32_t outs, const int32_t total); | |||||
| void oscSend_bridge_midi_count(const int32_t ins, const int32_t outs, const int32_t total); | |||||
| void oscSend_bridge_parameter_count(const int32_t ins, const int32_t outs, const int32_t total); | |||||
| void oscSend_bridge_program_count(const int32_t count); | |||||
| void oscSend_bridge_midi_program_count(const int32_t count); | |||||
| void oscSend_bridge_plugin_info(const int32_t category, const int32_t hints, const char* const name, const char* const label, const char* const maker, const char* const copyright, const int64_t uniqueId); | |||||
| void oscSend_bridge_parameter_info(const int32_t index, const char* const name, const char* const unit); | |||||
| void oscSend_bridge_parameter_data(const int32_t index, const int32_t rindex, const int32_t hints, const int32_t midiChannel, const int32_t midiCC); | |||||
| void oscSend_bridge_parameter_ranges(const int32_t index, const float def, const float min, const float max, const float step, const float stepSmall, const float stepLarge); | |||||
| void oscSend_bridge_program_info(const int32_t index, const char* const name); | |||||
| void oscSend_bridge_midi_program_info(const int32_t index, const int32_t bank, const int32_t program, const char* const label); | |||||
| void oscSend_bridge_plugin_info1(const PluginType type, const PluginCategory category, const uint hints, const long uniqueId); | |||||
| void oscSend_bridge_plugin_info2(const char* const realName, const char* const label, const char* const maker, const char* const copyright); | |||||
| void oscSend_bridge_audio_count(const uint32_t ins, const uint32_t outs); | |||||
| void oscSend_bridge_midi_count(const uint32_t ins, const uint32_t outs); | |||||
| void oscSend_bridge_parameter_count(const uint32_t ins, const uint32_t outs); | |||||
| void oscSend_bridge_program_count(const uint32_t count); | |||||
| void oscSend_bridge_midi_program_count(const uint32_t count); | |||||
| 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); | |||||
| void oscSend_bridge_parameter_ranges1(const uint32_t index, const float def, const float min, const float max); | |||||
| void oscSend_bridge_parameter_ranges2(const uint32_t index, const float step, const float stepSmall, const float stepLarge); | |||||
| void oscSend_bridge_set_parameter_midi_cc(const uint32_t index, const int16_t cc); | |||||
| void oscSend_bridge_set_parameter_midi_channel(const uint32_t index, const uint8_t channel); | |||||
| void oscSend_bridge_set_parameter_value(const int32_t index, const float value); // may be used for internal params (< 0) | |||||
| void oscSend_bridge_set_default_value(const uint32_t index, const float value); | |||||
| void oscSend_bridge_set_current_program(const int32_t index); | |||||
| void oscSend_bridge_set_current_midi_program(const int32_t index); | |||||
| void oscSend_bridge_program_name(const uint32_t index, const char* const name); | |||||
| void oscSend_bridge_midi_program_data(const uint32_t index, const uint32_t bank, const uint32_t program, const char* const name); | |||||
| void oscSend_bridge_configure(const char* const key, const char* const value); | void oscSend_bridge_configure(const char* const key, const char* const value); | ||||
| void oscSend_bridge_set_parameter_value(const int32_t index, const float value); | |||||
| void oscSend_bridge_set_default_value(const int32_t index, const float value); | |||||
| void oscSend_bridge_set_program(const int32_t index); | |||||
| void oscSend_bridge_set_midi_program(const int32_t index); | |||||
| void oscSend_bridge_set_custom_data(const char* const type, const char* const key, const char* const value); | void oscSend_bridge_set_custom_data(const char* const type, const char* const key, const char* const value); | ||||
| void oscSend_bridge_set_chunk_data(const char* const chunkFile); | void oscSend_bridge_set_chunk_data(const char* const chunkFile); | ||||
| void oscSend_bridge_set_peaks(); | void oscSend_bridge_set_peaks(); | ||||
| #else | #else | ||||
| void oscSend_control_add_plugin_start(const int32_t pluginId, const char* const pluginName); | |||||
| void oscSend_control_add_plugin_end(const int32_t pluginId); | |||||
| void oscSend_control_remove_plugin(const int32_t pluginId); | |||||
| void oscSend_control_set_plugin_data(const int32_t pluginId, const int32_t type, const int32_t category, const int32_t hints, const char* const realName, const char* const label, const char* const maker, const char* const copyright, const int64_t uniqueId); | |||||
| void oscSend_control_set_plugin_ports(const int32_t pluginId, const int32_t audioIns, const int32_t audioOuts, const int32_t midiIns, const int32_t midiOuts, const int32_t cIns, const int32_t cOuts); | |||||
| void oscSend_control_set_parameter_data(const int32_t pluginId, const int32_t index, const int32_t hints, const char* const name, const char* const unit, const float current); | |||||
| void oscSend_control_set_parameter_ranges(const int32_t pluginId, const int32_t index, const float min, const float max, const float def, const float step, const float stepSmall, const float stepLarge); | |||||
| void oscSend_control_set_parameter_midi_cc(const int32_t pluginId, const int32_t index, const int32_t cc); | |||||
| void oscSend_control_set_parameter_midi_channel(const int32_t pluginId, const int32_t index, const int32_t channel); | |||||
| void oscSend_control_set_parameter_value(const int32_t pluginId, const int32_t index, const float value); | |||||
| void oscSend_control_set_default_value(const int32_t pluginId, const int32_t index, const float value); | |||||
| void oscSend_control_set_program(const int32_t pluginId, const int32_t index); | |||||
| void oscSend_control_set_program_count(const int32_t pluginId, const int32_t count); | |||||
| void oscSend_control_set_program_name(const int32_t pluginId, const int32_t index, const char* const name); | |||||
| void oscSend_control_set_midi_program(const int32_t pluginId, const int32_t index); | |||||
| void oscSend_control_set_midi_program_count(const int32_t pluginId, const int32_t count); | |||||
| void oscSend_control_set_midi_program_data(const int32_t pluginId, const int32_t index, const int32_t bank, const int32_t program, const char* const name); | |||||
| void oscSend_control_note_on(const int32_t pluginId, const int32_t channel, const int32_t note, const int32_t velo); | |||||
| void oscSend_control_note_off(const int32_t pluginId, const int32_t channel, const int32_t note); | |||||
| void oscSend_control_set_peaks(const int32_t pluginId); | |||||
| void oscSend_control_add_plugin_start(const uint pluginId, const char* const pluginName); | |||||
| void oscSend_control_add_plugin_end(const uint pluginId); | |||||
| void oscSend_control_remove_plugin(const uint pluginId); | |||||
| void oscSend_control_set_plugin_info1(const uint pluginId, const PluginType type, const PluginCategory category, const uint hints, const long uniqueId); | |||||
| 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); | |||||
| void oscSend_control_set_audio_count(const uint pluginId, const uint32_t ins, const uint32_t outs); | |||||
| void oscSend_control_set_midi_count(const uint pluginId, const uint32_t ins, const uint32_t outs); | |||||
| void oscSend_control_set_parameter_count(const uint pluginId, const uint32_t ins, const uint32_t outs); | |||||
| void oscSend_control_set_program_count(const uint pluginId, const uint32_t count); | |||||
| void oscSend_control_set_midi_program_count(const uint pluginId, const uint32_t count); | |||||
| 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); | |||||
| void oscSend_control_set_parameter_ranges1(const uint pluginId, const uint32_t index, const float def, const float min, const float max); | |||||
| void oscSend_control_set_parameter_ranges2(const uint pluginId, const uint32_t index, const float step, const float stepSmall, const float stepLarge); | |||||
| void oscSend_control_set_parameter_midi_cc(const uint pluginId, const uint32_t index, const int16_t cc); | |||||
| void oscSend_control_set_parameter_midi_channel(const uint pluginId, const uint32_t index, const uint8_t channel); | |||||
| void oscSend_control_set_parameter_value(const uint pluginId, const int32_t index, const float value); // may be used for internal params (< 0) | |||||
| void oscSend_control_set_default_value(const uint pluginId, const uint32_t index, const float value); | |||||
| void oscSend_control_set_current_program(const uint pluginId, const int32_t index); | |||||
| void oscSend_control_set_current_midi_program(const uint pluginId, const int32_t index); | |||||
| void oscSend_control_set_program_name(const uint pluginId, const uint32_t index, const char* const name); | |||||
| 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); | |||||
| void oscSend_control_note_on(const uint pluginId, const uint8_t channel, const uint8_t note, const uint8_t velo); | |||||
| void oscSend_control_note_off(const uint pluginId, const uint8_t channel, const uint8_t note); | |||||
| void oscSend_control_set_peaks(const uint pluginId); | |||||
| void oscSend_control_exit(); | void oscSend_control_exit(); | ||||
| #endif | #endif | ||||
| @@ -328,7 +328,7 @@ public: | |||||
| /*! | /*! | ||||
| * Get the custom text of the parameter \a parameterId. | * Get the custom text of the parameter \a parameterId. | ||||
| */ | */ | ||||
| virtual void getParameterText(const uint32_t parameterId, char* const strBuf) const; | |||||
| virtual void getParameterText(const uint32_t parameterId, const float value, char* const strBuf) const; | |||||
| /*! | /*! | ||||
| * Get the unit of the parameter \a parameterId. | * Get the unit of the parameter \a parameterId. | ||||
| @@ -662,15 +662,18 @@ public: | |||||
| */ | */ | ||||
| virtual void offlineModeChanged(const bool isOffline); | virtual void offlineModeChanged(const bool isOffline); | ||||
| #if 0 | |||||
| /*! | /*! | ||||
| * Lock the plugin's master mutex. | * Lock the plugin's master mutex. | ||||
| */ | */ | ||||
| void lock(); | void lock(); | ||||
| #endif | |||||
| /*! | /*! | ||||
| * 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 | |||||
| */ | */ | ||||
| bool tryLock(); | |||||
| bool tryLock(const bool forcedOffline); | |||||
| /*! | /*! | ||||
| * Unlock the plugin's master mutex. | * Unlock the plugin's master mutex. | ||||
| @@ -25,18 +25,38 @@ | |||||
| #include "CarlaMutex.hpp" | #include "CarlaMutex.hpp" | ||||
| CARLA_BACKEND_START_NAMESPACE | |||||
| #if 0 | |||||
| } // Fix editor indentation | |||||
| #ifdef HAVE_JUCE | |||||
| # include "juce_audio_basics.h" | |||||
| using juce::FloatVectorOperations; | |||||
| #endif | #endif | ||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| // Engine helper macro, sets lastError and returns false/NULL | // Engine helper macro, sets lastError and returns false/NULL | ||||
| #define CARLA_SAFE_ASSERT_RETURN_ERR(cond, err) if (cond) pass(); else { carla_safe_assert(#cond, __FILE__, __LINE__); setLastError(err); return false; } | #define CARLA_SAFE_ASSERT_RETURN_ERR(cond, err) if (cond) pass(); else { carla_safe_assert(#cond, __FILE__, __LINE__); setLastError(err); return false; } | ||||
| #define CARLA_SAFE_ASSERT_RETURN_ERRN(cond, err) if (cond) pass(); else { carla_safe_assert(#cond, __FILE__, __LINE__); setLastError(err); return nullptr; } | #define CARLA_SAFE_ASSERT_RETURN_ERRN(cond, err) if (cond) pass(); else { carla_safe_assert(#cond, __FILE__, __LINE__); setLastError(err); return nullptr; } | ||||
| // ----------------------------------------------------------------------- | |||||
| // Float operations | |||||
| #ifdef HAVE_JUCE | |||||
| # define FLOAT_ADD(bufDst, bufSrc, frames) FloatVectorOperations::add(bufDst, bufSrc, frames) | |||||
| # define FLOAT_COPY(bufDst, bufSrc, frames) FloatVectorOperations::copy(bufDst, bufSrc, frames) | |||||
| # define FLOAT_CLEAR(buf, frames) FloatVectorOperations::clear(buf, frames) | |||||
| #else | |||||
| # define FLOAT_ADD(bufDst, bufSrc, frames) carla_addFloat(bufDst, bufSrc, frames) | |||||
| # define FLOAT_COPY(bufDst, bufSrc, frames) carla_copyFloat(bufDst, bufSrc, frames) | |||||
| # define FLOAT_CLEAR(buf, frames) carla_zeroFloat(buf, frames) | |||||
| #endif | |||||
| // ----------------------------------------------------------------------- | |||||
| CARLA_BACKEND_START_NAMESPACE | |||||
| #if 0 | |||||
| } // Fix editor indentation | |||||
| #endif | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| static inline | static inline | ||||
| @@ -22,12 +22,8 @@ | |||||
| #include "List.hpp" | #include "List.hpp" | ||||
| #include "jackbridge/JackBridge.hpp" | #include "jackbridge/JackBridge.hpp" | ||||
| #ifdef HAVE_JUCE | |||||
| # include "juce_audio_basics.h" | |||||
| using juce::FloatVectorOperations; | |||||
| #endif | |||||
| #include <cmath> | #include <cmath> | ||||
| #include <QtCore/QStringList> | #include <QtCore/QStringList> | ||||
| #define URI_CANVAS_ICON "http://kxstudio.sf.net/ns/canvas/icon" | #define URI_CANVAS_ICON "http://kxstudio.sf.net/ns/canvas/icon" | ||||
| @@ -90,13 +86,7 @@ public: | |||||
| fBuffer = (float*)jackbridge_port_get_buffer(fPort, bufferSize); | fBuffer = (float*)jackbridge_port_get_buffer(fPort, bufferSize); | ||||
| if (! fIsInput) | if (! fIsInput) | ||||
| { | |||||
| #ifdef HAVE_JUCE | |||||
| FloatVectorOperations::clear(fBuffer, bufferSize); | |||||
| #else | |||||
| carla_zeroFloat(fBuffer, bufferSize); | |||||
| #endif | |||||
| } | |||||
| FLOAT_CLEAR(fBuffer, bufferSize); | |||||
| } | } | ||||
| private: | private: | ||||
| @@ -153,13 +143,7 @@ public: | |||||
| fBuffer = (float*)jackbridge_port_get_buffer(fPort, bufferSize); | fBuffer = (float*)jackbridge_port_get_buffer(fPort, bufferSize); | ||||
| if (! fIsInput) | if (! fIsInput) | ||||
| { | |||||
| #ifdef HAVE_JUCE | |||||
| FloatVectorOperations::clear(fBuffer, bufferSize); | |||||
| #else | |||||
| carla_zeroFloat(fBuffer, bufferSize); | |||||
| #endif | |||||
| } | |||||
| FLOAT_CLEAR(fBuffer, bufferSize); | |||||
| } | } | ||||
| private: | private: | ||||
| @@ -1060,13 +1044,9 @@ protected: | |||||
| float* const audioOut2 = (float*)jackbridge_port_get_buffer(fRackPorts[kRackPortAudioOut2], nframes); | float* const audioOut2 = (float*)jackbridge_port_get_buffer(fRackPorts[kRackPortAudioOut2], nframes); | ||||
| void* const eventOut = jackbridge_port_get_buffer(fRackPorts[kRackPortEventOut], nframes); | void* const eventOut = jackbridge_port_get_buffer(fRackPorts[kRackPortEventOut], nframes); | ||||
| # ifdef HAVE_JUCE | |||||
| FloatVectorOperations::copy(audioOut1, audioIn1, nframes); | |||||
| FloatVectorOperations::copy(audioOut2, audioIn2, nframes); | |||||
| # else | |||||
| carla_copyFloat(audioOut1, audioIn1, nframes); | |||||
| carla_copyFloat(audioOut2, audioIn2, nframes); | |||||
| # endif | |||||
| FLOAT_COPY(audioOut1, audioIn1, nframes); | |||||
| FLOAT_COPY(audioOut2, audioIn2, nframes); | |||||
| jackbridge_midi_clear_buffer(eventOut); | jackbridge_midi_clear_buffer(eventOut); | ||||
| } | } | ||||
| #endif | #endif | ||||
| @@ -1077,7 +1057,7 @@ protected: | |||||
| #ifdef BUILD_BRIDGE | #ifdef BUILD_BRIDGE | ||||
| CarlaPlugin* const plugin(pData->plugins[0].plugin); | CarlaPlugin* const plugin(pData->plugins[0].plugin); | ||||
| if (plugin != nullptr && plugin->isEnabled() && plugin->tryLock()) | |||||
| if (plugin != nullptr && plugin->isEnabled() && plugin->tryLock(fFreewheel)) | |||||
| { | { | ||||
| plugin->initBuffers(); | plugin->initBuffers(); | ||||
| processPlugin(plugin, nframes); | processPlugin(plugin, nframes); | ||||
| @@ -1092,7 +1072,7 @@ protected: | |||||
| { | { | ||||
| CarlaPlugin* const plugin(pData->plugins[i].plugin); | CarlaPlugin* const plugin(pData->plugins[i].plugin); | ||||
| if (plugin != nullptr && plugin->isEnabled() && plugin->tryLock()) | |||||
| if (plugin != nullptr && plugin->isEnabled() && plugin->tryLock(fFreewheel)) | |||||
| { | { | ||||
| plugin->initBuffers(); | plugin->initBuffers(); | ||||
| processPlugin(plugin, nframes); | processPlugin(plugin, nframes); | ||||
| @@ -1983,15 +1963,18 @@ private: | |||||
| { | { | ||||
| CarlaPlugin* const plugin((CarlaPlugin*)arg); | CarlaPlugin* const plugin((CarlaPlugin*)arg); | ||||
| if (plugin != nullptr && plugin->isEnabled() && plugin->tryLock()) | |||||
| if (plugin != nullptr && plugin->isEnabled()) | |||||
| { | { | ||||
| CarlaEngineJack* const engine((CarlaEngineJack*)plugin->getEngine()); | CarlaEngineJack* const engine((CarlaEngineJack*)plugin->getEngine()); | ||||
| CARLA_SAFE_ASSERT_RETURN(engine != nullptr,0); | CARLA_SAFE_ASSERT_RETURN(engine != nullptr,0); | ||||
| plugin->initBuffers(); | |||||
| engine->saveTransportInfo(); | |||||
| engine->processPlugin(plugin, nframes); | |||||
| plugin->unlock(); | |||||
| if (plugin->tryLock(engine->fFreewheel)) | |||||
| { | |||||
| plugin->initBuffers(); | |||||
| engine->saveTransportInfo(); | |||||
| engine->processPlugin(plugin, nframes); | |||||
| plugin->unlock(); | |||||
| } | |||||
| } | } | ||||
| return 0; | return 0; | ||||
| @@ -26,6 +26,7 @@ | |||||
| // #include "RtList.hpp" | // #include "RtList.hpp" | ||||
| #include "juce_audio_devices.h" | #include "juce_audio_devices.h" | ||||
| using namespace juce; | using namespace juce; | ||||
| CARLA_BACKEND_START_NAMESPACE | CARLA_BACKEND_START_NAMESPACE | ||||
| @@ -24,11 +24,6 @@ | |||||
| #include "CarlaNative.hpp" | #include "CarlaNative.hpp" | ||||
| #ifdef HAVE_JUCE | |||||
| # include "juce_audio_basics.h" | |||||
| using juce::FloatVectorOperations; | |||||
| #endif | |||||
| CARLA_BACKEND_START_NAMESPACE | CARLA_BACKEND_START_NAMESPACE | ||||
| #if 0 | #if 0 | ||||
| @@ -343,23 +338,7 @@ protected: | |||||
| static char strBuf[STR_MAX+1]; | static char strBuf[STR_MAX+1]; | ||||
| carla_zeroChar(strBuf, STR_MAX+1); | carla_zeroChar(strBuf, STR_MAX+1); | ||||
| float oldValue; | |||||
| plugin->lock(); | |||||
| oldValue = plugin->getParameterValue(index); | |||||
| if (oldValue != value) | |||||
| { | |||||
| plugin->setParameterValue(index, value, false, false, false); | |||||
| plugin->getParameterText(index, strBuf); | |||||
| plugin->setParameterValue(index, oldValue, false, false, false); | |||||
| } | |||||
| else | |||||
| { | |||||
| plugin->getParameterText(index, strBuf); | |||||
| } | |||||
| plugin->unlock(); | |||||
| plugin->getParameterText(index, value, strBuf); | |||||
| return strBuf; | return strBuf; | ||||
| } | } | ||||
| @@ -468,13 +447,9 @@ protected: | |||||
| { | { | ||||
| if (pData->curPluginCount == 0 && ! fIsPatchbay) | if (pData->curPluginCount == 0 && ! fIsPatchbay) | ||||
| { | { | ||||
| #ifdef HAVE_JUCE | |||||
| FloatVectorOperations::copy(outBuffer[0], inBuffer[0], frames); | |||||
| FloatVectorOperations::copy(outBuffer[1], inBuffer[1], frames); | |||||
| #else | |||||
| carla_copyFloat(outBuffer[0], inBuffer[0], frames); | |||||
| carla_copyFloat(outBuffer[1], inBuffer[1], frames); | |||||
| #endif | |||||
| FLOAT_COPY(outBuffer[0], inBuffer[0], frames); | |||||
| FLOAT_COPY(outBuffer[1], inBuffer[1], frames); | |||||
| return runPendingRtEvents();; | return runPendingRtEvents();; | ||||
| } | } | ||||
| @@ -769,10 +744,12 @@ public: | |||||
| return new CarlaEngineNative(host, false); | return new CarlaEngineNative(host, false); | ||||
| } | } | ||||
| #ifdef HAVE_JUCE | |||||
| static NativePluginHandle _instantiatePatchbay(const NativeHostDescriptor* host) | static NativePluginHandle _instantiatePatchbay(const NativeHostDescriptor* host) | ||||
| { | { | ||||
| return new CarlaEngineNative(host, true); | return new CarlaEngineNative(host, true); | ||||
| } | } | ||||
| #endif | |||||
| static void _cleanup(NativePluginHandle handle) | static void _cleanup(NativePluginHandle handle) | ||||
| { | { | ||||
| @@ -823,6 +800,7 @@ static const NativePluginDescriptor carlaRackDesc = { | |||||
| PluginDescriptorFILL2(CarlaEngineNative) | PluginDescriptorFILL2(CarlaEngineNative) | ||||
| }; | }; | ||||
| #ifdef HAVE_JUCE | |||||
| static const NativePluginDescriptor carlaPatchbayDesc = { | static const NativePluginDescriptor carlaPatchbayDesc = { | ||||
| /* category */ ::PLUGIN_CATEGORY_OTHER, | /* category */ ::PLUGIN_CATEGORY_OTHER, | ||||
| /* hints */ static_cast<NativePluginHints>(::PLUGIN_IS_SYNTH|::PLUGIN_HAS_UI|::PLUGIN_NEEDS_FIXED_BUFFERS|::PLUGIN_NEEDS_SINGLE_THREAD|::PLUGIN_USES_STATE|::PLUGIN_USES_TIME), | /* hints */ static_cast<NativePluginHints>(::PLUGIN_IS_SYNTH|::PLUGIN_HAS_UI|::PLUGIN_NEEDS_FIXED_BUFFERS|::PLUGIN_NEEDS_SINGLE_THREAD|::PLUGIN_USES_STATE|::PLUGIN_USES_TIME), | ||||
| @@ -841,6 +819,7 @@ static const NativePluginDescriptor carlaPatchbayDesc = { | |||||
| CarlaEngineNative::_cleanup, | CarlaEngineNative::_cleanup, | ||||
| PluginDescriptorFILL2(CarlaEngineNative) | PluginDescriptorFILL2(CarlaEngineNative) | ||||
| }; | }; | ||||
| #endif | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| @@ -853,7 +832,9 @@ void carla_register_native_plugin_carla() | |||||
| { | { | ||||
| CARLA_BACKEND_USE_NAMESPACE | CARLA_BACKEND_USE_NAMESPACE | ||||
| carla_register_native_plugin(&carlaRackDesc); | carla_register_native_plugin(&carlaRackDesc); | ||||
| #ifdef HAVE_JUCE | |||||
| carla_register_native_plugin(&carlaPatchbayDesc); | carla_register_native_plugin(&carlaPatchbayDesc); | ||||
| #endif | |||||
| } | } | ||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| @@ -23,11 +23,6 @@ | |||||
| #include "rtaudio/RtAudio.h" | #include "rtaudio/RtAudio.h" | ||||
| #include "rtmidi/RtMidi.h" | #include "rtmidi/RtMidi.h" | ||||
| #ifdef HAVE_JUCE | |||||
| # include "juce_audio_basics.h" | |||||
| using juce::FloatVectorOperations; | |||||
| #endif | |||||
| CARLA_BACKEND_START_NAMESPACE | CARLA_BACKEND_START_NAMESPACE | ||||
| #if 0 | #if 0 | ||||
| @@ -840,13 +835,7 @@ protected: | |||||
| if (pData->curPluginCount == 0 || fAudioCountOut == 0 || ! fAudioIsReady) | if (pData->curPluginCount == 0 || fAudioCountOut == 0 || ! fAudioIsReady) | ||||
| { | { | ||||
| if (fAudioCountOut > 0 && fAudioIsReady) | if (fAudioCountOut > 0 && fAudioIsReady) | ||||
| { | |||||
| #ifdef HAVE_JUCE | |||||
| FloatVectorOperations::clear(outsPtr, nframes*fAudioCountOut); | |||||
| #else | |||||
| carla_zeroFloat(outsPtr, nframes*fAudioCountOut); | |||||
| #endif | |||||
| } | |||||
| FLOAT_CLEAR(outsPtr, nframes*fAudioCountOut); | |||||
| return runPendingRtEvents(); | return runPendingRtEvents(); | ||||
| } | } | ||||
| @@ -865,30 +854,15 @@ protected: | |||||
| else | else | ||||
| { | { | ||||
| for (unsigned int i=0; i < fAudioCountIn; ++i) | for (unsigned int i=0; i < fAudioCountIn; ++i) | ||||
| { | |||||
| #ifdef HAVE_JUCE | |||||
| FloatVectorOperations::copy(fAudioBufIn[i], insPtr+(nframes*i), nframes); | |||||
| #else | |||||
| carla_copyFloat(fAudioBufIn[i], insPtr+(nframes*i), nframes); | |||||
| #endif | |||||
| } | |||||
| FLOAT_COPY(fAudioBufIn[i], insPtr+(nframes*i), nframes); | |||||
| } | } | ||||
| #ifdef HAVE_JUCE | |||||
| // initialize audio output | |||||
| for (unsigned int i=0; i < fAudioCountOut; ++i) | |||||
| FloatVectorOperations::clear(fAudioBufOut[i], nframes); | |||||
| FloatVectorOperations::clear(fAudioBufRackOut[0], nframes); | |||||
| FloatVectorOperations::clear(fAudioBufRackOut[1], nframes); | |||||
| #else | |||||
| // initialize audio output | // initialize audio output | ||||
| for (unsigned int i=0; i < fAudioCountOut; ++i) | for (unsigned int i=0; i < fAudioCountOut; ++i) | ||||
| carla_zeroFloat(fAudioBufOut[i], nframes); | |||||
| FLOAT_CLEAR(fAudioBufOut[i], nframes); | |||||
| carla_zeroFloat(fAudioBufRackOut[0], nframes); | |||||
| carla_zeroFloat(fAudioBufRackOut[1], nframes); | |||||
| #endif | |||||
| FLOAT_CLEAR(fAudioBufRackOut[0], nframes); | |||||
| FLOAT_CLEAR(fAudioBufRackOut[1], nframes); | |||||
| // initialize input events | // initialize input events | ||||
| carla_zeroMem(pData->bufEvents.in, sizeof(EngineEvent)*kEngineMaxInternalEventCount); | carla_zeroMem(pData->bufEvents.in, sizeof(EngineEvent)*kEngineMaxInternalEventCount); | ||||
| @@ -929,11 +903,7 @@ protected: | |||||
| // connect input buffers | // connect input buffers | ||||
| if (fConnectedAudioIns[0].count() == 0) | if (fConnectedAudioIns[0].count() == 0) | ||||
| { | { | ||||
| #ifdef HAVE_JUCE | |||||
| FloatVectorOperations::clear(fAudioBufRackIn[0], nframes); | |||||
| #else | |||||
| carla_zeroFloat(fAudioBufRackIn[0], nframes); | |||||
| #endif | |||||
| FLOAT_CLEAR(fAudioBufRackIn[0], nframes); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -946,40 +916,22 @@ protected: | |||||
| if (first) | if (first) | ||||
| { | { | ||||
| #ifdef HAVE_JUCE | |||||
| FloatVectorOperations::copy(fAudioBufRackIn[0], fAudioBufIn[port], nframes); | |||||
| #else | |||||
| carla_copyFloat(fAudioBufRackIn[0], fAudioBufIn[port], nframes); | |||||
| #endif | |||||
| FLOAT_COPY(fAudioBufRackIn[0], fAudioBufIn[port], nframes); | |||||
| first = false; | first = false; | ||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| #ifdef HAVE_JUCE | |||||
| FloatVectorOperations::add(fAudioBufRackIn[0], fAudioBufIn[port], nframes); | |||||
| #else | |||||
| carla_addFloat(fAudioBufRackIn[0], fAudioBufIn[port], nframes); | |||||
| #endif | |||||
| FLOAT_ADD(fAudioBufRackIn[0], fAudioBufIn[port], nframes); | |||||
| } | } | ||||
| } | } | ||||
| if (first) | if (first) | ||||
| { | |||||
| #ifdef HAVE_JUCE | |||||
| FloatVectorOperations::clear(fAudioBufRackIn[0], nframes); | |||||
| #else | |||||
| carla_zeroFloat(fAudioBufRackIn[0], nframes); | |||||
| #endif | |||||
| } | |||||
| FLOAT_CLEAR(fAudioBufRackIn[0], nframes); | |||||
| } | } | ||||
| if (fConnectedAudioIns[1].count() == 0) | if (fConnectedAudioIns[1].count() == 0) | ||||
| { | { | ||||
| #ifdef HAVE_JUCE | |||||
| FloatVectorOperations::clear(fAudioBufRackIn[1], nframes); | |||||
| #else | |||||
| carla_zeroFloat(fAudioBufRackIn[1], nframes); | |||||
| #endif | |||||
| FLOAT_CLEAR(fAudioBufRackIn[1], nframes); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -992,31 +944,17 @@ protected: | |||||
| if (first) | if (first) | ||||
| { | { | ||||
| #ifdef HAVE_JUCE | |||||
| FloatVectorOperations::copy(fAudioBufRackIn[1], fAudioBufIn[port], nframes); | |||||
| #else | |||||
| carla_copyFloat(fAudioBufRackIn[1], fAudioBufIn[port], nframes); | |||||
| #endif | |||||
| FLOAT_COPY(fAudioBufRackIn[1], fAudioBufIn[port], nframes); | |||||
| first = false; | first = false; | ||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| #ifdef HAVE_JUCE | |||||
| FloatVectorOperations::add(fAudioBufRackIn[1], fAudioBufIn[port], nframes); | |||||
| #else | |||||
| carla_addFloat(fAudioBufRackIn[1], fAudioBufIn[port], nframes); | |||||
| #endif | |||||
| FLOAT_ADD(fAudioBufRackIn[1], fAudioBufIn[port], nframes); | |||||
| } | } | ||||
| } | } | ||||
| if (first) | if (first) | ||||
| { | |||||
| #ifdef HAVE_JUCE | |||||
| FloatVectorOperations::clear(fAudioBufRackIn[1], nframes); | |||||
| #else | |||||
| carla_zeroFloat(fAudioBufRackIn[1], nframes); | |||||
| #endif | |||||
| } | |||||
| FLOAT_CLEAR(fAudioBufRackIn[1], nframes); | |||||
| } | } | ||||
| // process | // process | ||||
| @@ -1030,11 +968,7 @@ protected: | |||||
| const uint& port(*it); | const uint& port(*it); | ||||
| CARLA_ASSERT(port < fAudioCountOut); | CARLA_ASSERT(port < fAudioCountOut); | ||||
| #ifdef HAVE_JUCE | |||||
| FloatVectorOperations::add(fAudioBufOut[port], fAudioBufRackOut[0], nframes); | |||||
| #else | |||||
| carla_addFloat(fAudioBufOut[port], fAudioBufRackOut[0], nframes); | |||||
| #endif | |||||
| FLOAT_ADD(fAudioBufOut[port], fAudioBufRackOut[0], nframes); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1045,11 +979,7 @@ protected: | |||||
| const uint& port(*it); | const uint& port(*it); | ||||
| CARLA_ASSERT(port < fAudioCountOut); | CARLA_ASSERT(port < fAudioCountOut); | ||||
| #ifdef HAVE_JUCE | |||||
| FloatVectorOperations::add(fAudioBufOut[port], fAudioBufRackOut[1], nframes); | |||||
| #else | |||||
| carla_addFloat(fAudioBufOut[port], fAudioBufRackOut[1], nframes); | |||||
| #endif | |||||
| FLOAT_ADD(fAudioBufOut[port], fAudioBufRackOut[1], nframes); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1069,13 +999,7 @@ protected: | |||||
| else | else | ||||
| { | { | ||||
| for (unsigned int i=0; i < fAudioCountOut; ++i) | for (unsigned int i=0; i < fAudioCountOut; ++i) | ||||
| { | |||||
| #ifdef HAVE_JUCE | |||||
| FloatVectorOperations::copy(outsPtr+(nframes*i), fAudioBufOut[i], nframes); | |||||
| #else | |||||
| carla_copyFloat(outsPtr+(nframes*i), fAudioBufOut[i], nframes); | |||||
| #endif | |||||
| } | |||||
| FLOAT_COPY(outsPtr+(nframes*i), fAudioBufOut[i], nframes); | |||||
| } | } | ||||
| // output events | // output events | ||||
| @@ -18,11 +18,9 @@ | |||||
| #include "CarlaPluginInternal.hpp" | #include "CarlaPluginInternal.hpp" | ||||
| #include "CarlaLibCounter.hpp" | #include "CarlaLibCounter.hpp" | ||||
| #ifdef USE_JUCE | |||||
| #include "juce_data_structures.h" | |||||
| using namespace juce; | |||||
| #endif | |||||
| #include <QtCore/QFile> | |||||
| #include <QtCore/QTextStream> | |||||
| #include <QtCore/QSettings> | |||||
| CARLA_BACKEND_START_NAMESPACE | CARLA_BACKEND_START_NAMESPACE | ||||
| @@ -109,92 +107,62 @@ void* CarlaPluginProtectedData::uiLibSymbol(const char* const symbol) | |||||
| void CarlaPluginProtectedData::saveSetting(const unsigned int option, const bool yesNo) | void CarlaPluginProtectedData::saveSetting(const unsigned int option, const bool yesNo) | ||||
| { | { | ||||
| #ifdef USE_JUCE | |||||
| PropertiesFile::Options opts; | |||||
| opts.applicationName = "common"; // TODO, (const char*)idStr | |||||
| opts.filenameSuffix = ".cfg"; | |||||
| opts.osxLibrarySubFolder = "Application Support"; | |||||
| #ifdef CARLA_OS_LINUX | |||||
| opts.folderName = "config/falkTX/Carla/PluginSettings/"; | |||||
| #else | |||||
| opts.folderName = "falkTX\\Carla\\PluginSettings\\"; | |||||
| #endif | |||||
| CARLA_SAFE_ASSERT_RETURN(identifier != nullptr && identifier[0] != '\0',); | |||||
| ApplicationProperties appProps; | |||||
| appProps.setStorageParameters(opts); | |||||
| PropertiesFile* const props(appProps.getUserSettings()); | |||||
| CARLA_SAFE_ASSERT_RETURN(props != nullptr,); | |||||
| QSettings settings("falkTX", "CarlaPluginSettings"); | |||||
| settings.beginGroup(identifier); | |||||
| switch (option) | switch (option) | ||||
| { | { | ||||
| case PLUGIN_OPTION_FIXED_BUFFERS: | case PLUGIN_OPTION_FIXED_BUFFERS: | ||||
| props->setValue("FixedBuffers", yesNo); | |||||
| settings.setValue("FixedBuffers", yesNo); | |||||
| break; | break; | ||||
| case PLUGIN_OPTION_FORCE_STEREO: | case PLUGIN_OPTION_FORCE_STEREO: | ||||
| props->setValue("ForceStereo", yesNo); | |||||
| settings.setValue("ForceStereo", yesNo); | |||||
| break; | break; | ||||
| case PLUGIN_OPTION_MAP_PROGRAM_CHANGES: | case PLUGIN_OPTION_MAP_PROGRAM_CHANGES: | ||||
| props->setValue("MapProgramChanges", yesNo); | |||||
| settings.setValue("MapProgramChanges", yesNo); | |||||
| break; | break; | ||||
| case PLUGIN_OPTION_USE_CHUNKS: | case PLUGIN_OPTION_USE_CHUNKS: | ||||
| props->setValue("UseChunks", yesNo); | |||||
| settings.setValue("UseChunks", yesNo); | |||||
| break; | break; | ||||
| case PLUGIN_OPTION_SEND_CONTROL_CHANGES: | case PLUGIN_OPTION_SEND_CONTROL_CHANGES: | ||||
| props->setValue("SendControlChanges", yesNo); | |||||
| settings.setValue("SendControlChanges", yesNo); | |||||
| break; | break; | ||||
| case PLUGIN_OPTION_SEND_CHANNEL_PRESSURE: | case PLUGIN_OPTION_SEND_CHANNEL_PRESSURE: | ||||
| props->setValue("SendChannelPressure", yesNo); | |||||
| settings.setValue("SendChannelPressure", yesNo); | |||||
| break; | break; | ||||
| case PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH: | case PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH: | ||||
| props->setValue("SendNoteAftertouch", yesNo); | |||||
| settings.setValue("SendNoteAftertouch", yesNo); | |||||
| break; | break; | ||||
| case PLUGIN_OPTION_SEND_PITCHBEND: | case PLUGIN_OPTION_SEND_PITCHBEND: | ||||
| props->setValue("SendPitchbend", yesNo); | |||||
| settings.setValue("SendPitchbend", yesNo); | |||||
| break; | break; | ||||
| case PLUGIN_OPTION_SEND_ALL_SOUND_OFF: | case PLUGIN_OPTION_SEND_ALL_SOUND_OFF: | ||||
| props->setValue("SendAllSoundOff", yesNo); | |||||
| settings.setValue("SendAllSoundOff", yesNo); | |||||
| break; | break; | ||||
| default: | default: | ||||
| break; | break; | ||||
| } | } | ||||
| appProps.saveIfNeeded(); | |||||
| appProps.closeFiles(); | |||||
| #endif | |||||
| settings.endGroup(); | |||||
| } | } | ||||
| unsigned int CarlaPluginProtectedData::loadSettings(const unsigned int options, const unsigned int availOptions) | unsigned int CarlaPluginProtectedData::loadSettings(const unsigned int options, const unsigned int availOptions) | ||||
| { | { | ||||
| #ifdef USE_JUCE | |||||
| PropertiesFile::Options opts; | |||||
| opts.applicationName = "common"; // TODO, (const char*)idStr | |||||
| opts.filenameSuffix = ".cfg"; | |||||
| opts.osxLibrarySubFolder = "Application Support"; | |||||
| CARLA_SAFE_ASSERT_RETURN(identifier != nullptr && identifier[0] != '\0',); | |||||
| #ifdef CARLA_OS_LINUX | |||||
| opts.folderName = "config/falkTX/Carla/PluginSettings/"; | |||||
| #else | |||||
| opts.folderName = "falkTX\\Carla\\PluginSettings\\"; | |||||
| #endif | |||||
| ApplicationProperties appProps; | |||||
| appProps.setStorageParameters(opts); | |||||
| PropertiesFile* const props(appProps.getUserSettings()); | |||||
| CARLA_SAFE_ASSERT_RETURN(props != nullptr, options); | |||||
| QSettings settings("falkTX", "CarlaPluginSettings"); | |||||
| settings.beginGroup(identifier); | |||||
| unsigned int newOptions = 0x0; | unsigned int newOptions = 0x0; | ||||
| #define CHECK_AND_SET_OPTION(KEY, BIT) \ | |||||
| #define CHECK_AND_SET_OPTION(STR, BIT) \ | |||||
| if ((availOptions & BIT) != 0 || BIT == PLUGIN_OPTION_FORCE_STEREO) \ | if ((availOptions & BIT) != 0 || BIT == PLUGIN_OPTION_FORCE_STEREO) \ | ||||
| { \ | { \ | ||||
| if (props->containsKey(KEY)) \ | |||||
| if (settings.contains(STR)) \ | |||||
| { \ | { \ | ||||
| if (props->getBoolValue(KEY, bool(options & BIT))) \ | |||||
| if (settings.value(STR, (options & BIT) != 0).toBool()) \ | |||||
| newOptions |= BIT; \ | newOptions |= BIT; \ | ||||
| } \ | } \ | ||||
| else if (options & BIT) \ | else if (options & BIT) \ | ||||
| @@ -213,9 +181,9 @@ unsigned int CarlaPluginProtectedData::loadSettings(const unsigned int options, | |||||
| #undef CHECK_AND_SET_OPTION | #undef CHECK_AND_SET_OPTION | ||||
| settings.endGroup(); | |||||
| return newOptions; | return newOptions; | ||||
| #endif | |||||
| return 0x0; | |||||
| } | } | ||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| @@ -254,7 +222,6 @@ CarlaPlugin::~CarlaPlugin() | |||||
| { | { | ||||
| carla_debug("CarlaPlugin::~CarlaPlugin()"); | carla_debug("CarlaPlugin::~CarlaPlugin()"); | ||||
| pData->cleanup(); | |||||
| delete pData; | delete pData; | ||||
| } | } | ||||
| @@ -378,7 +345,7 @@ const ParameterRanges& CarlaPlugin::getParameterRanges(const uint32_t parameterI | |||||
| bool CarlaPlugin::isParameterOutput(const uint32_t parameterId) const | bool CarlaPlugin::isParameterOutput(const uint32_t parameterId) const | ||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false); | CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false); | ||||
| return ((pData->param.data[parameterId].hints & PARAMETER_IS_INPUT) == 0); | |||||
| 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 | ||||
| @@ -545,7 +512,6 @@ const SaveState& CarlaPlugin::getSaveState() | |||||
| pData->saveState.ctrlChannel = pData->ctrlChannel; | pData->saveState.ctrlChannel = pData->ctrlChannel; | ||||
| #endif | #endif | ||||
| #ifdef USE_JUCE | |||||
| // --------------------------------------------------------------- | // --------------------------------------------------------------- | ||||
| // Chunk | // Chunk | ||||
| @@ -556,14 +522,12 @@ const SaveState& CarlaPlugin::getSaveState() | |||||
| if (data != nullptr && dataSize > 0) | if (data != nullptr && dataSize > 0) | ||||
| { | { | ||||
| MemoryBlock memBlock(data, dataSize); | |||||
| pData->saveState.chunk = carla_strdup(memBlock.toBase64Encoding().toRawUTF8()); | |||||
| pData->saveState.chunk = carla_strdup(QByteArray((char*)data, dataSize).toBase64().constData()); | |||||
| // Don't save anything else if using chunks | // Don't save anything else if using chunks | ||||
| return pData->saveState; | return pData->saveState; | ||||
| } | } | ||||
| } | } | ||||
| #endif | |||||
| // --------------------------------------------------------------- | // --------------------------------------------------------------- | ||||
| // Current Program | // Current Program | ||||
| @@ -1512,8 +1476,14 @@ void CarlaPlugin::offlineModeChanged(const bool) | |||||
| { | { | ||||
| } | } | ||||
| bool CarlaPlugin::tryLock() | |||||
| bool CarlaPlugin::tryLock(const bool forcedOffline) | |||||
| { | { | ||||
| if (forcedOffline) | |||||
| { | |||||
| pData->masterMutex.lock(); | |||||
| return true; | |||||
| } | |||||
| return pData->masterMutex.tryLock(); | return pData->masterMutex.tryLock(); | ||||
| } | } | ||||
| @@ -1604,11 +1574,11 @@ void CarlaPlugin::registerToOscClient() | |||||
| #ifdef BUILD_BRIDGE | #ifdef BUILD_BRIDGE | ||||
| pData->engine->oscSend_bridge_parameter_info(i, bufName, bufUnit); | pData->engine->oscSend_bridge_parameter_info(i, bufName, bufUnit); | ||||
| pData->engine->oscSend_bridge_parameter_data(i, paramData.rindex, paramData.hints, paramData.midiChannel, paramData.midiCC); | |||||
| pData->engine->oscSend_bridge_parameter_data(i, paramData.type, paramData.hints, paramData.rindex, paramData.midiChannel, paramData.midiCC); | |||||
| pData->engine->oscSend_bridge_parameter_ranges(i, paramRanges.def, paramRanges.min, paramRanges.max, paramRanges.step, paramRanges.stepSmall, paramRanges.stepLarge); | pData->engine->oscSend_bridge_parameter_ranges(i, paramRanges.def, paramRanges.min, paramRanges.max, paramRanges.step, paramRanges.stepSmall, paramRanges.stepLarge); | ||||
| pData->engine->oscSend_bridge_set_parameter_value(i, getParameterValue(i)); | pData->engine->oscSend_bridge_set_parameter_value(i, getParameterValue(i)); | ||||
| #else | #else | ||||
| pData->engine->oscSend_control_set_parameter_data(pData->id, i,paramData.hints, bufName, bufUnit, getParameterValue(i)); | |||||
| pData->engine->oscSend_control_set_parameter_data(pData->id, i, paramData.type, paramData.hints, bufName, bufUnit, getParameterValue(i)); | |||||
| pData->engine->oscSend_control_set_parameter_ranges(pData->id, i, paramRanges.min, paramRanges.max, paramRanges.def, paramRanges.step, paramRanges.stepSmall, paramRanges.stepLarge); | pData->engine->oscSend_control_set_parameter_ranges(pData->id, i, paramRanges.min, paramRanges.max, paramRanges.def, paramRanges.step, paramRanges.stepSmall, paramRanges.stepLarge); | ||||
| pData->engine->oscSend_control_set_parameter_midi_cc(pData->id, i, paramData.midiCC); | pData->engine->oscSend_control_set_parameter_midi_cc(pData->id, i, paramData.midiCC); | ||||
| pData->engine->oscSend_control_set_parameter_midi_channel(pData->id, i, paramData.midiChannel); | pData->engine->oscSend_control_set_parameter_midi_channel(pData->id, i, paramData.midiChannel); | ||||
| @@ -2051,7 +2021,6 @@ CarlaEngineAudioPort* CarlaPlugin::getAudioOutPort(const uint32_t index) const n | |||||
| return pData->audioOut.ports[index].port; | return pData->audioOut.ports[index].port; | ||||
| } | } | ||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Scoped Disabler | // Scoped Disabler | ||||
| @@ -26,16 +26,30 @@ | |||||
| #include "CarlaOscUtils.hpp" | #include "CarlaOscUtils.hpp" | ||||
| #include "CarlaStateUtils.hpp" | #include "CarlaStateUtils.hpp" | ||||
| #include "CarlaMutex.hpp" | #include "CarlaMutex.hpp" | ||||
| #include "CarlaMIDI.h" | |||||
| #include "RtList.hpp" | #include "RtList.hpp" | ||||
| #ifdef HAVE_JUCE | |||||
| # include "juce_audio_basics.h" | |||||
| using juce::FloatVectorOperations; | |||||
| #endif | |||||
| #include <cmath> | #include <cmath> | ||||
| // ----------------------------------------------------------------------- | |||||
| #define CARLA_PROCESS_CONTINUE_CHECK if (! pData->enabled) { pData->engine->callback(ENGINE_CALLBACK_DEBUG, pData->id, 0, 0, 0.0f, "Processing while plugin is disabled!!"); return; } | #define CARLA_PROCESS_CONTINUE_CHECK if (! pData->enabled) { pData->engine->callback(ENGINE_CALLBACK_DEBUG, pData->id, 0, 0, 0.0f, "Processing while plugin is disabled!!"); return; } | ||||
| #ifdef USE_JUCE | |||||
| #include "juce_audio_basics.h" | |||||
| using juce::FloatVectorOperations; | |||||
| // ----------------------------------------------------------------------- | |||||
| // Float operations | |||||
| #ifdef HAVE_JUCE | |||||
| # define FLOAT_ADD(bufDst, bufSrc, frames) FloatVectorOperations::add(bufDst, bufSrc, frames) | |||||
| # define FLOAT_COPY(bufDst, bufSrc, frames) FloatVectorOperations::copy(bufDst, bufSrc, frames) | |||||
| # define FLOAT_CLEAR(buf, frames) FloatVectorOperations::clear(buf, frames) | |||||
| #else | |||||
| # define FLOAT_ADD(bufDst, bufSrc, frames) carla_addFloat(bufDst, bufSrc, frames) | |||||
| # define FLOAT_COPY(bufDst, bufSrc, frames) carla_copyFloat(bufDst, bufSrc, frames) | |||||
| # define FLOAT_CLEAR(buf, frames) carla_zeroFloat(buf, frames) | |||||
| #endif | #endif | ||||
| CARLA_BACKEND_START_NAMESPACE | CARLA_BACKEND_START_NAMESPACE | ||||
| @@ -80,12 +94,12 @@ struct PluginPostRtEvent { | |||||
| int32_t value1; | int32_t value1; | ||||
| int32_t value2; | int32_t value2; | ||||
| float value3; | float value3; | ||||
| }; | |||||
| PluginPostRtEvent() noexcept | |||||
| : type(kPluginPostRtEventNull), | |||||
| value1(-1), | |||||
| value2(-1), | |||||
| value3(0.0f) {} | |||||
| struct ExternalMidiNote { | |||||
| int8_t channel; // invalid if -1 | |||||
| uint8_t note; // 0 to 127 | |||||
| uint8_t velo; // note-off if 0 | |||||
| }; | }; | ||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| @@ -474,19 +488,6 @@ struct PluginMidiProgramData { | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| struct ExternalMidiNote { | |||||
| int8_t channel; // invalid if -1 | |||||
| uint8_t note; | |||||
| uint8_t velo; // note-off if 0 | |||||
| ExternalMidiNote() noexcept | |||||
| : channel(-1), | |||||
| note(0), | |||||
| velo(0) {} | |||||
| }; | |||||
| // ----------------------------------------------------------------------- | |||||
| struct CarlaPluginProtectedData { | struct CarlaPluginProtectedData { | ||||
| CarlaEngine* const engine; | CarlaEngine* const engine; | ||||
| CarlaEngineClient* client; | CarlaEngineClient* client; | ||||
| @@ -503,19 +504,19 @@ struct CarlaPluginProtectedData { | |||||
| void* uiLib; | void* uiLib; | ||||
| // misc | // misc | ||||
| int8_t ctrlChannel; | |||||
| unsigned int extraHints; | |||||
| int patchbayClientId; | |||||
| int8_t ctrlChannel; | |||||
| uint extraHints; | |||||
| int patchbayClientId; | |||||
| // latency | // latency | ||||
| uint32_t latency; | uint32_t latency; | ||||
| float** latencyBuffers; | float** latencyBuffers; | ||||
| // data 1 | // data 1 | ||||
| CarlaString name; | |||||
| CarlaString filename; | |||||
| CarlaString iconName; | |||||
| CarlaString idStr; | |||||
| const char* name; | |||||
| const char* filename; | |||||
| const char* iconName; | |||||
| const char* identifier; // used for save/restore settings per plugin | |||||
| // data 2 | // data 2 | ||||
| PluginAudioData audioIn; | PluginAudioData audioIn; | ||||
| @@ -633,8 +634,8 @@ struct CarlaPluginProtectedData { | |||||
| #endif | #endif | ||||
| } osc; | } osc; | ||||
| CarlaPluginProtectedData(CarlaEngine* const eng, CarlaPlugin* const plug) | |||||
| : engine(eng), | |||||
| CarlaPluginProtectedData(CarlaEngine* const e, CarlaPlugin* const p) | |||||
| : engine(e), | |||||
| client(nullptr), | client(nullptr), | ||||
| id(0), | id(0), | ||||
| hints(0x0), | hints(0x0), | ||||
| @@ -649,7 +650,11 @@ struct CarlaPluginProtectedData { | |||||
| patchbayClientId(0), | patchbayClientId(0), | ||||
| latency(0), | latency(0), | ||||
| latencyBuffers(nullptr), | latencyBuffers(nullptr), | ||||
| osc(eng, plug) {} | |||||
| name(nullptr), | |||||
| filename(nullptr), | |||||
| iconName(nullptr), | |||||
| identifier(nullptr), | |||||
| osc(e, p) {} | |||||
| #ifdef CARLA_PROPER_CPP11_SUPPORT | #ifdef CARLA_PROPER_CPP11_SUPPORT | ||||
| CarlaPluginProtectedData() = delete; | CarlaPluginProtectedData() = delete; | ||||
| @@ -658,20 +663,32 @@ struct CarlaPluginProtectedData { | |||||
| ~CarlaPluginProtectedData() | ~CarlaPluginProtectedData() | ||||
| { | { | ||||
| CARLA_ASSERT(client == nullptr); | |||||
| CARLA_ASSERT(! active); | |||||
| CARLA_ASSERT(lib == nullptr); | |||||
| CARLA_ASSERT(uiLib == nullptr); | |||||
| CARLA_ASSERT(latency == 0); | |||||
| CARLA_ASSERT(latencyBuffers == nullptr); | |||||
| CARLA_SAFE_ASSERT(! needsReset); | CARLA_SAFE_ASSERT(! needsReset); | ||||
| } | |||||
| // ------------------------------------------------------------------- | |||||
| // Cleanup | |||||
| if (name != nullptr) | |||||
| { | |||||
| delete[] name; | |||||
| name = nullptr; | |||||
| } | |||||
| if (filename != nullptr) | |||||
| { | |||||
| delete[] filename; | |||||
| filename = nullptr; | |||||
| } | |||||
| if (iconName != nullptr) | |||||
| { | |||||
| delete[] iconName; | |||||
| iconName = nullptr; | |||||
| } | |||||
| if (identifier != nullptr) | |||||
| { | |||||
| delete[] identifier; | |||||
| identifier = nullptr; | |||||
| } | |||||
| void cleanup() | |||||
| { | |||||
| { | { | ||||
| // mutex MUST have been locked before | // mutex MUST have been locked before | ||||
| const bool lockMaster(masterMutex.tryLock()); | const bool lockMaster(masterMutex.tryLock()); | ||||
| @@ -734,6 +751,8 @@ struct CarlaPluginProtectedData { | |||||
| if (lib != nullptr) | if (lib != nullptr) | ||||
| libClose(); | libClose(); | ||||
| CARLA_ASSERT(uiLib == nullptr); | |||||
| } | } | ||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| @@ -1358,13 +1358,8 @@ const char* carla_get_chunk_data(uint pluginId) | |||||
| if (data != nullptr && dataSize > 0) | if (data != nullptr && dataSize > 0) | ||||
| { | { | ||||
| #if 0 //def HAVE_JUCE | |||||
| juce::MemoryBlock memBlock(data, dataSize); | |||||
| chunkData = memBlock.toBase64Encoding().toRawUTF8(); | |||||
| #else | |||||
| QByteArray chunk(QByteArray((char*)data, dataSize).toBase64()); | |||||
| chunkData = chunk.constData(); | |||||
| #endif | |||||
| chunkData = QByteArray((char*)data, dataSize).toBase64().constData(); | |||||
| return (const char*)chunkData; | return (const char*)chunkData; | ||||
| } | } | ||||
| else | else | ||||
| @@ -222,18 +222,14 @@ PLUGIN_OPTION_SEND_ALL_SOUND_OFF = 0x100 | |||||
| # Various parameter hints. | # Various parameter hints. | ||||
| # @see CarlaPlugin::getParameterData() and carla_get_parameter_data() | # @see CarlaPlugin::getParameterData() and carla_get_parameter_data() | ||||
| # Parameter is input. | |||||
| # When this hint is not set, parameter is assumed to be output. | |||||
| PARAMETER_IS_INPUT = 0x001 | |||||
| # Parameter value is boolean. | # Parameter value is boolean. | ||||
| PARAMETER_IS_BOOLEAN = 0x002 | |||||
| PARAMETER_IS_BOOLEAN = 0x001 | |||||
| # Parameter value is integer. | # Parameter value is integer. | ||||
| PARAMETER_IS_INTEGER = 0x004 | |||||
| PARAMETER_IS_INTEGER = 0x002 | |||||
| # Parameter value is logarithmic. | # Parameter value is logarithmic. | ||||
| PARAMETER_IS_LOGARITHMIC = 0x008 | |||||
| PARAMETER_IS_LOGARITHMIC = 0x004 | |||||
| # Parameter is enabled. | # Parameter is enabled. | ||||
| # It can be viewed, changed and stored. | # It can be viewed, changed and stored. | ||||
| @@ -19,11 +19,6 @@ | |||||
| # ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
| # Imports (Global) | # Imports (Global) | ||||
| #try: | |||||
| #from PyQt5.QtCore import pyqtSignal, pyqtSlot, QByteArray, QSettings | |||||
| #from PyQt5.QtGui import QColor, QCursor, QFontMetrics, QPainter, QPainterPath | |||||
| #from PyQt5.QtWidgets import QDialog, QFrame, QInputDialog, QLineEdit, QMenu, QVBoxLayout, QWidget | |||||
| #except: | |||||
| from PyQt4.QtCore import pyqtSignal, pyqtSlot, QByteArray, QSettings | from PyQt4.QtCore import pyqtSignal, pyqtSlot, QByteArray, QSettings | ||||
| from PyQt4.QtGui import QColor, QCursor, QFontMetrics, QPainter, QPainterPath | from PyQt4.QtGui import QColor, QCursor, QFontMetrics, QPainter, QPainterPath | ||||
| from PyQt4.QtGui import QDialog, QFrame, QInputDialog, QLineEdit, QMenu, QVBoxLayout, QWidget | from PyQt4.QtGui import QDialog, QFrame, QInputDialog, QLineEdit, QMenu, QVBoxLayout, QWidget | ||||
| @@ -65,7 +60,7 @@ gFakePluginInfo = { | |||||
| } | } | ||||
| gFakeParamInfo = { | gFakeParamInfo = { | ||||
| "hints": PARAMETER_IS_INPUT|PARAMETER_IS_ENABLED|PARAMETER_IS_AUTOMABLE, | |||||
| "hints": PARAMETER_IS_ENABLED|PARAMETER_IS_AUTOMABLE, | |||||
| "name": "Parameter Name", | "name": "Parameter Name", | ||||
| "unit": "", | "unit": "", | ||||
| "scalePoints": [], | "scalePoints": [], | ||||
| @@ -45,7 +45,7 @@ | |||||
| /** Config: JUCE_ALSA | /** Config: JUCE_ALSA | ||||
| Enables ALSA audio devices (Linux only). | Enables ALSA audio devices (Linux only). | ||||
| */ | */ | ||||
| #if 0 //JUCE_LINUX | |||||
| #if JUCE_LINUX | |||||
| #define JUCE_ALSA 1 | #define JUCE_ALSA 1 | ||||
| #define JUCE_ALSA_MIDI_INPUT_NAME "Carla" | #define JUCE_ALSA_MIDI_INPUT_NAME "Carla" | ||||
| #define JUCE_ALSA_MIDI_OUTPUT_NAME "Carla" | #define JUCE_ALSA_MIDI_OUTPUT_NAME "Carla" | ||||
| @@ -74,7 +74,7 @@ void CarlaPlugin::getCopyright(char* const) const noexcept {} | |||||
| void CarlaPlugin::getRealName(char* const) const noexcept {} | void CarlaPlugin::getRealName(char* const) const noexcept {} | ||||
| void CarlaPlugin::getParameterName(const uint32_t, char* const) const {} | void CarlaPlugin::getParameterName(const uint32_t, char* const) const {} | ||||
| void CarlaPlugin::getParameterSymbol(const uint32_t, char* const) const {} | void CarlaPlugin::getParameterSymbol(const uint32_t, char* const) const {} | ||||
| void CarlaPlugin::getParameterText(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::getParameterUnit(const uint32_t, char* const) const {} | ||||
| void CarlaPlugin::getParameterScalePointLabel(const uint32_t, 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::getProgramName(const uint32_t, char* const) const {} | ||||