Browse Source

Start doxygen docs and final API

tags/1.9.4
falkTX 13 years ago
parent
commit
98c06c6461
19 changed files with 661 additions and 1490 deletions
  1. +5
    -4
      source/backend/CarlaBackend.doxygen
  2. +8
    -0
      source/backend/CarlaBackend.hpp
  3. +26
    -6
      source/backend/CarlaEngine.hpp
  4. +3
    -0
      source/backend/CarlaNative.h
  5. +398
    -8
      source/backend/CarlaStandalone.hpp
  6. +2
    -1
      source/backend/native/Makefile
  7. +0
    -1239
      source/backend/native/nekofilter/ui.py
  8. +0
    -1
      source/backend/native/zynaddsubfx.cpp
  9. +7
    -4
      source/backend/plugin/CarlaPlugin.cpp
  10. +1
    -0
      source/backend/plugin/NativePlugin.cpp
  11. +3
    -3
      source/backend/plugin/VstPlugin.cpp
  12. +165
    -73
      source/backend/standalone/CarlaStandalone.cpp
  13. +2
    -6
      source/carla.py
  14. +16
    -4
      source/carla_backend.py
  15. +1
    -1
      source/discovery/carla-discovery.cpp
  16. +20
    -10
      source/tests/ANSI.cpp
  17. +0
    -123
      source/tests/Base64.cpp
  18. +2
    -5
      source/tests/Makefile
  19. +2
    -2
      source/utils/CarlaLv2Utils.hpp

+ 5
- 4
source/backend/CarlaBackend.doxygen View File

@@ -236,15 +236,16 @@ PERLMOD_MAKEVAR_PREFIX =
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED = DOXYGEN \
WANT_LADSPA WANT_DSSI WANT_LV2 WANT_VST WANT_FLUIDSYNTH WANT_LINUXSAMPLER \
WANT_NATIVE WANT_LADSPA WANT_DSSI WANT_LV2 WANT_VST WANT_FLUIDSYNTH WANT_LINUXSAMPLER \
WANT_JACK WANT_JACK_LATENCY WANT_JACK_PORT_RENAME WANT_RTAUDIO \
WANT_AUDIOFILE WANT_MIDIFILE WANT_OPENGL WANT_ZYNADDSUBFX WANT_ZYNADDSUBFX_UI
WANT_OPENGL WANT_AUDIOFILE WANT_MIDIFILE WANT_ZYNADDSUBFX WANT_ZYNADDSUBFX_UI \
CARLA_EXPORT=
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------


+ 8
- 0
source/backend/CarlaBackend.hpp View File

@@ -655,6 +655,7 @@ struct ParameterData {
uint8_t midiChannel;
int16_t midiCC;

#ifndef DOXYGEN
ParameterData()
: type(PARAMETER_UNKNOWN),
index(PARAMETER_NULL),
@@ -662,6 +663,7 @@ struct ParameterData {
hints(0x0),
midiChannel(0),
midiCC(-1) {}
#endif
};

/*!
@@ -675,6 +677,7 @@ struct ParameterRanges {
float stepSmall;
float stepLarge;

#ifndef DOXYGEN
ParameterRanges()
: def(0.0f),
min(0.0f),
@@ -682,6 +685,7 @@ struct ParameterRanges {
step(0.01f),
stepSmall(0.0001f),
stepLarge(0.1f) {}
#endif

void fixDefault()
{
@@ -724,10 +728,12 @@ struct MidiProgramData {
uint32_t program;
const char* name;

#ifndef DOXYGEN
MidiProgramData()
: bank(0),
program(0),
name(nullptr) {}
#endif
};

/*!
@@ -741,10 +747,12 @@ struct CustomData {
const char* key;
const char* value;

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

/**@}*/


+ 26
- 6
source/backend/CarlaEngine.hpp View File

@@ -724,6 +724,29 @@ public:
*/
void removeAllPlugins();

/*!
* Rename plugin with id \a id to \a newName.\n
* Returns the new name, or nullptr if the operation failed.
*/
const char* renamePlugin(const unsigned int id, const char* const newName);

/*!
* Clone plugin with id \a id.
*/
bool clonePlugin(const unsigned int id);

/*!
* Prepare replace of plugin with id \a id.\n
* The next call to addPlugin() will use this id, replacing the current plugin.
* \note This function requires addPlugin() to be called afterwards as soon as possible.
*/
bool replacePlugin(const unsigned int id);

/*!
* Switch plugins with id \a idA and \a idB.
*/
bool switchPlugins(const unsigned int idA, const unsigned int idB);

/*!
* Get plugin with id \a id.
*/
@@ -746,7 +769,7 @@ public:
/*!
* Load \a filename of any type.\n
* This will try to load a generic file as a plugin,
* either by direct handling (GIG, SF2 and SFZ) or by using an internal plugin (Audio and MIDI)
* either by direct handling (GIG, SF2 and SFZ) or by using an internal plugin (like Audio and MIDI)
*/
bool loadFilename(const char* const filename);

@@ -827,9 +850,6 @@ public:
*/
float getOutputPeak(const unsigned int pluginId, const unsigned short id) const;

// FIXME - remove once IPC audio is implemented
void setPeaks(const unsigned int pluginId, float const inPeaks[MAX_PEAKS], float const outPeaks[MAX_PEAKS]);

// -------------------------------------------------------------------
// Callback

@@ -849,12 +869,12 @@ public:
/*!
* TODO.
*/
virtual void patchbayConnect(int portA, int portB);
virtual bool patchbayConnect(int portA, int portB);

/*!
* TODO.
*/
virtual void patchbayDisconnect(int connectionId);
virtual bool patchbayDisconnect(int connectionId);

/*!
* TODO.


+ 3
- 0
source/backend/CarlaNative.h View File

@@ -195,6 +195,8 @@ typedef struct _PluginDescriptor {
char* (*get_state)(PluginHandle handle);
void (*set_state)(PluginHandle handle, const char* data);

intptr_t (*dispatcher)(PluginHandle handle, int32_t code, int32_t index, intptr_t value, void* ptr);

} PluginDescriptor;

// -----------------------------------------------------------------------
@@ -210,6 +212,7 @@ void carla_register_native_plugin_midiSplit();
void carla_register_native_plugin_midiThrough();
void carla_register_native_plugin_midiTranspose();
void carla_register_native_plugin_nekofilter();
void carla_register_native_plugin_sunvoxfile();

// Carla
void carla_register_native_plugin_carla();


+ 398
- 8
source/backend/CarlaStandalone.hpp View File

@@ -24,17 +24,39 @@
/*!
* @defgroup CarlaStandaloneAPI Carla Standalone API
*
* The Carla Standalone API
* The Carla Standalone API.
*
* This API makes it possible to use the Carla Backend in a Standalone application.\n
* All functions are C-compatible, making it possible to use this API in non-C++ hosts.
*
* None of the returned values in this API calls need to be deleted or free'd.\n
* When a function fails (returns false or NULL), use carla_get_last_error() to find out what went wrong.
*
* @{
*/

/*!
* @defgroup HelperTypedefs Helper typedefs
*
* Basic typedefs to help make code cleaner.
* @{
*/
typedef CarlaBackend::BinaryType CarlaBinaryType;
typedef CarlaBackend::PluginType CarlaPluginType;
typedef CarlaBackend::PluginCategory CarlaPluginCategory;
typedef CarlaBackend::OptionsType CarlaOptionsType;
typedef CarlaBackend::CallbackType CarlaCallbackType;
typedef CarlaBackend::CallbackFunc CarlaCallbackFunc;
typedef CarlaBackend::ParameterData CarlaParameterData;
typedef CarlaBackend::ParameterRanges CarlaParameterRanges;
typedef CarlaBackend::MidiProgramData CarlaMidiProgramData;
typedef CarlaBackend::CustomData CarlaCustomData;
/**@}*/

/*!
* Plugin information.
* \see carla_get_plugin_info()
*/
struct CarlaPluginInfo {
CarlaPluginType type;
CarlaPluginCategory category;
@@ -49,6 +71,7 @@ struct CarlaPluginInfo {
long uniqueId;
uint32_t latency;

#ifndef DOXYGEN
CarlaPluginInfo()
: type(CarlaBackend::PLUGIN_NONE),
category(CarlaBackend::PLUGIN_CATEGORY_NONE),
@@ -74,8 +97,13 @@ struct CarlaPluginInfo {
}

CARLA_DECLARE_NON_COPY_STRUCT_WITH_LEAK_DETECTOR(CarlaPluginInfo)
#endif
};

/*!
* Native plugin information.
* \see carla_get_internal_plugin_info()
*/
struct CarlaNativePluginInfo {
CarlaPluginCategory category;
unsigned int hints;
@@ -90,6 +118,7 @@ struct CarlaNativePluginInfo {
const char* maker;
const char* copyright;

#ifndef DOXYGEN
CarlaNativePluginInfo()
: category(CarlaBackend::PLUGIN_CATEGORY_NONE),
hints(0x0),
@@ -105,27 +134,41 @@ struct CarlaNativePluginInfo {
copyright(nullptr) {}

CARLA_DECLARE_NON_COPY_STRUCT_WITH_LEAK_DETECTOR(CarlaNativePluginInfo)
#endif
};

/*!
* Port count information, used for Audio and MIDI ports and parameters.
* \see carla_get_audio_port_count_info()
* \see carla_get_midi_port_count_info()
* \see carla_get_parameter_count_info()
*/
struct CarlaPortCountInfo {
uint32_t ins;
uint32_t outs;
uint32_t total;

#ifndef DOXYGEN
CarlaPortCountInfo()
: ins(0),
outs(0),
total(0) {}

CARLA_DECLARE_NON_COPY_STRUCT_WITH_LEAK_DETECTOR(CarlaPortCountInfo)
#endif
};

/*!
* Parameter information.
* \see carla_get_parameter_info()
*/
struct CarlaParameterInfo {
const char* name;
const char* symbol;
const char* unit;
uint32_t scalePointCount;

#ifndef DOXYGEN
CarlaParameterInfo()
: name(nullptr),
symbol(nullptr),
@@ -143,12 +186,18 @@ struct CarlaParameterInfo {
}

CARLA_DECLARE_NON_COPY_STRUCT_WITH_LEAK_DETECTOR(CarlaParameterInfo)
#endif
};

/*!
* Parameter scale point information.
* \see carla_get_parameter_scalepoint_info()
*/
struct CarlaScalePointInfo {
float value;
const char* label;

#ifndef DOXYGEN
CarlaScalePointInfo()
: value(0.0f),
label(nullptr) {}
@@ -160,8 +209,13 @@ struct CarlaScalePointInfo {
}

CARLA_DECLARE_NON_COPY_STRUCT_WITH_LEAK_DETECTOR(CarlaScalePointInfo)
#endif
};

/*!
* Transport information.
* \see carla_get_transport_info()
*/
struct CarlaTransportInfo {
bool playing;
uint32_t frame;
@@ -170,6 +224,7 @@ struct CarlaTransportInfo {
int32_t tick;
double bpm;

#ifndef DOXYGEN
CarlaTransportInfo()
: playing(false),
frame(0),
@@ -178,117 +233,452 @@ struct CarlaTransportInfo {
bpm(0.0) {}

CARLA_DECLARE_NON_COPY_STRUCT_WITH_LEAK_DETECTOR(CarlaTransportInfo)
#endif
};

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

/*!
* Get the supported file types in carla_load_filename().\n
* Returned string uses this syntax:
* \code
* "*.file1;*.file2;*.file3"
* \endcode
*/
CARLA_EXPORT const char* carla_get_supported_file_types();

/*!
* Get how many engine drivers are available to use.
*/
CARLA_EXPORT unsigned int carla_get_engine_driver_count();

/*!
* Get the engine driver name \a index.
*/
CARLA_EXPORT const char* carla_get_engine_driver_name(unsigned int index);

/*!
* Get the engine driver options \a index.
* \note This call is not implemented yet and does nothing for now.
*/
CARLA_EXPORT const void* carla_get_engine_driver_options(unsigned int index); // TODO

/*!
* Get how many internal plugins are available to use.
*/
CARLA_EXPORT unsigned int carla_get_internal_plugin_count();

/*!
* Get information about the internal plugin \a internalPluginId.
*/
CARLA_EXPORT const CarlaNativePluginInfo* carla_get_internal_plugin_info(unsigned int internalPluginId);

/*!
* Initialize the engine with driver \a driverName, using \a clientName for its internal name.\n
* Make sure to call carla_engine_idle() at regular intervals afterwards.
*/
CARLA_EXPORT bool carla_engine_init(const char* driverName, const char* clientName);

/*!
* Close the running engine.\n
* This function always closes the engine even if it returns false.\n
* When false is returned, something went wrong when closing the engine, but it was still closed nonetheless.
*/
CARLA_EXPORT bool carla_engine_close();

/*!
* Idle the running engine.\n
* \note This should never be called if the engine is not running.
*/
CARLA_EXPORT void carla_engine_idle();

/*!
* Check if the engine is running.
*/
CARLA_EXPORT bool carla_is_engine_running();

/*!
* Tell the engine it's about to close.\n
* This is used to prevent the engine thread(s) from reactivating.
*/
CARLA_EXPORT void carla_set_engine_about_to_close();

/*!
* TODO
*/
CARLA_EXPORT void carla_set_engine_callback(CarlaCallbackFunc func, void* ptr);

/*!
* TODO
*/
CARLA_EXPORT void carla_set_engine_option(CarlaOptionsType option, int value, const char* valueStr);

/*!
* TODO
*/
CARLA_EXPORT bool carla_load_filename(const char* filename);

/*!
* TODO
*/
CARLA_EXPORT bool carla_load_project(const char* filename);

/*!
* TODO
*/
CARLA_EXPORT bool carla_save_project(const char* filename);

CARLA_EXPORT void carla_patchbay_connect(int portA, int portB);
CARLA_EXPORT void carla_patchbay_disconnect(int connectionId);
/*!
* TODO
*/
CARLA_EXPORT bool carla_patchbay_connect(int portA, int portB);

/*!
* TODO
*/
CARLA_EXPORT bool carla_patchbay_disconnect(int connectionId);

/*!
* TODO
*/
CARLA_EXPORT void carla_patchbay_refresh();

/*!
* TODO
*/
CARLA_EXPORT void carla_transport_play();

/*!
* TODO
*/
CARLA_EXPORT void carla_transport_pause();

/*!
* TODO
*/
CARLA_EXPORT void carla_transport_relocate(uint32_t frames);

/*!
* TODO
*/
CARLA_EXPORT uint32_t carla_get_current_transport_frame();

/*!
* TODO
*/
CARLA_EXPORT const CarlaTransportInfo* carla_get_transport_info();

/*!
* Add new plugin.\n
* If you don't know the binary type, use BINARY_NATIVE.
*/
CARLA_EXPORT bool carla_add_plugin(CarlaBinaryType btype, CarlaPluginType ptype, const char* filename, const char* name, const char* label, const void* extraPtr);

/*!
* Remove plugin with id \a pluginId.
*/
CARLA_EXPORT bool carla_remove_plugin(unsigned int pluginId);

/*!
* Remove all plugins.
*/
CARLA_EXPORT void carla_remove_all_plugins();

/*!
* Rename plugin with id \a pluginId to \a newName.\n
* Returns the new name, or NULL if the operation failed.
*/
CARLA_EXPORT const char* carla_rename_plugin(unsigned int pluginId, const char* newName);

/*!
* Clone plugin with id \a pluginId.
*/
CARLA_EXPORT bool carla_clone_plugin(unsigned int pluginId);

/*!
* Prepare replace of plugin with id \a pluginId.\n
* The next call to carla_add_plugin() will use this id, replacing the current plugin.
* \note This function requires carla_add_plugin() to be called afterwards as soon as possible.
*/
CARLA_EXPORT bool carla_replace_plugin(unsigned int pluginId);

/*!
* Switch plugins with id \a pluginIdA and \a pluginIdB.
*/
CARLA_EXPORT bool carla_switch_plugins(unsigned int pluginIdA, unsigned int pluginIdB);

/*!
* Load the plugin state at \a filename.\n
* (Plugin states have *.carxs extension).
* \see carla_save_plugin_state()
*/
CARLA_EXPORT bool carla_load_plugin_state(unsigned int pluginId, const char* filename);

/*!
* Load the plugin state at \a filename.\n
* (Plugin states have *.carxs extension).
* \see carla_load_plugin_state()
*/
CARLA_EXPORT bool carla_save_plugin_state(unsigned int pluginId, const char* filename);

/*!
* Get a plugin's information.
*/
CARLA_EXPORT const CarlaPluginInfo* carla_get_plugin_info(unsigned int pluginId);

/*!
* Get a plugin's audio port count information.
*/
CARLA_EXPORT const CarlaPortCountInfo* carla_get_audio_port_count_info(unsigned int pluginId);

/*!
* Get a plugin's midi port count information.
*/
CARLA_EXPORT const CarlaPortCountInfo* carla_get_midi_port_count_info(unsigned int pluginId);

/*!
* Get a plugin's parameter count information.
*/
CARLA_EXPORT const CarlaPortCountInfo* carla_get_parameter_count_info(unsigned int pluginId);

/*!
* * Get a plugin's parameter information.
*/
CARLA_EXPORT const CarlaParameterInfo* carla_get_parameter_info(unsigned int pluginId, uint32_t parameterId);

/*!
* Get a plugin's parameter scale point information.
*/
CARLA_EXPORT const CarlaScalePointInfo* carla_get_parameter_scalepoint_info(unsigned int pluginId, uint32_t parameterId, uint32_t scalePointId);

CARLA_EXPORT const CarlaBackend::ParameterData* carla_get_parameter_data(unsigned int pluginId, uint32_t parameterId);
CARLA_EXPORT const CarlaBackend::ParameterRanges* carla_get_parameter_ranges(unsigned int pluginId, uint32_t parameterId);
CARLA_EXPORT const CarlaBackend::MidiProgramData* carla_get_midi_program_data(unsigned int pluginId, uint32_t midiProgramId);
CARLA_EXPORT const CarlaBackend::CustomData* carla_get_custom_data(unsigned int pluginId, uint32_t customDataId);
/*!
* Get a plugin's parameter data.
*/
CARLA_EXPORT const CarlaParameterData* carla_get_parameter_data(unsigned int pluginId, uint32_t parameterId);

/*!
* Get a plugin's parameter ranges.
*/
CARLA_EXPORT const CarlaParameterRanges* carla_get_parameter_ranges(unsigned int pluginId, uint32_t parameterId);

/*!
* Get a plugin's midi program data.
*/
CARLA_EXPORT const CarlaMidiProgramData* carla_get_midi_program_data(unsigned int pluginId, uint32_t midiProgramId);

/*!
* Get a plugin's custom data.
*/
CARLA_EXPORT const CarlaCustomData* carla_get_custom_data(unsigned int pluginId, uint32_t customDataId);

/*!
* Get a plugin's chunk data.
*/
CARLA_EXPORT const char* carla_get_chunk_data(unsigned int pluginId);

/*!
* TODO
*/
CARLA_EXPORT uint32_t carla_get_parameter_count(unsigned int pluginId);

/*!
* TODO
*/
CARLA_EXPORT uint32_t carla_get_program_count(unsigned int pluginId);

/*!
* TODO
*/
CARLA_EXPORT uint32_t carla_get_midi_program_count(unsigned int pluginId);

/*!
* TODO
*/
CARLA_EXPORT uint32_t carla_get_custom_data_count(unsigned int pluginId);

/*!
* TODO
*/
CARLA_EXPORT const char* carla_get_parameter_text(unsigned int pluginId, uint32_t parameterId);

/*!
* TODO
*/
CARLA_EXPORT const char* carla_get_program_name(unsigned int pluginId, uint32_t programId);

/*!
* TODO
*/
CARLA_EXPORT const char* carla_get_midi_program_name(unsigned int pluginId, uint32_t midiProgramId);

/*!
* TODO
*/
CARLA_EXPORT const char* carla_get_real_plugin_name(unsigned int pluginId);

/*!
* TODO
*/
CARLA_EXPORT int32_t carla_get_current_program_index(unsigned int pluginId);

/*!
* TODO
*/
CARLA_EXPORT int32_t carla_get_current_midi_program_index(unsigned int pluginId);

/*!
* TODO
*/
CARLA_EXPORT float carla_get_default_parameter_value(unsigned int pluginId, uint32_t parameterId);

/*!
* TODO
*/
CARLA_EXPORT float carla_get_current_parameter_value(unsigned int pluginId, uint32_t parameterId);

/*!
* TODO
*/
CARLA_EXPORT float carla_get_input_peak_value(unsigned int pluginId, unsigned short portId);

/*!
* TODO
*/
CARLA_EXPORT float carla_get_output_peak_value(unsigned int pluginId, unsigned short portId);

/*!
* TODO
*/
CARLA_EXPORT void carla_set_option(unsigned int pluginId, unsigned int option, bool yesNo);

/*!
* TODO
*/
CARLA_EXPORT void carla_set_active(unsigned int pluginId, bool onOff);

/*!
* TODO
*/
CARLA_EXPORT void carla_set_drywet(unsigned int pluginId, float value);

/*!
* TODO
*/
CARLA_EXPORT void carla_set_volume(unsigned int pluginId, float value);

/*!
* TODO
*/
CARLA_EXPORT void carla_set_balance_left(unsigned int pluginId, float value);

/*!
* TODO
*/
CARLA_EXPORT void carla_set_balance_right(unsigned int pluginId, float value);

/*!
* TODO
*/
CARLA_EXPORT void carla_set_panning(unsigned int pluginId, float value);

/*!
* TODO
*/
CARLA_EXPORT void carla_set_ctrl_channel(unsigned int pluginId, int8_t channel);

/*!
* TODO
*/
CARLA_EXPORT void carla_set_parameter_value(unsigned int pluginId, uint32_t parameterId, float value);

/*!
* TODO
*/
CARLA_EXPORT void carla_set_parameter_midi_channel(unsigned int pluginId, uint32_t parameterId, uint8_t channel);

/*!
* TODO
*/
CARLA_EXPORT void carla_set_parameter_midi_cc(unsigned int pluginId, uint32_t parameterId, int16_t cc);

/*!
* TODO
*/
CARLA_EXPORT void carla_set_program(unsigned int pluginId, uint32_t programId);

/*!
* TODO
*/
CARLA_EXPORT void carla_set_midi_program(unsigned int pluginId, uint32_t midiProgramId);

/*!
* TODO
*/
CARLA_EXPORT void carla_set_custom_data(unsigned int pluginId, const char* type, const char* key, const char* value);

/*!
* TODO
*/
CARLA_EXPORT void carla_set_chunk_data(unsigned int pluginId, const char* chunkData);

/*!
* TODO
*/
CARLA_EXPORT void carla_prepare_for_save(unsigned int pluginId);

/*!
* TODO
*/
CARLA_EXPORT void carla_send_midi_note(unsigned int pluginId, uint8_t channel, uint8_t note, uint8_t velocity);

/*!
* TODO
*/
CARLA_EXPORT void carla_show_gui(unsigned int pluginId, bool yesNo);

/*!
* TODO
*/
CARLA_EXPORT uint32_t carla_get_buffer_size();

/*!
* TODO
*/
CARLA_EXPORT double carla_get_sample_rate();

/*!
* TODO
*/
CARLA_EXPORT const char* carla_get_last_error();

/*!
* TODO
*/
CARLA_EXPORT const char* carla_get_host_osc_url();

/*!
* TODO
*/
CARLA_EXPORT void carla_nsm_announce(const char* url, int pid);

/*!
* TODO
*/
CARLA_EXPORT void carla_nsm_reply_open();

/*!
* TODO
*/
CARLA_EXPORT void carla_nsm_reply_save();

#ifdef BUILD_BRIDGE
using CarlaBackend::CarlaEngine;
CARLA_EXPORT CarlaEngine* carla_get_standalone_engine();
CARLA_EXPORT bool carla_engine_init_bridge(const char* audioBaseName, const char* controlBaseName, const char* clientName);
CARLA_EXPORT CarlaBackend::CarlaEngine* carla_get_standalone_engine();
#endif

/**@}*/


+ 2
- 1
source/backend/native/Makefile View File

@@ -63,7 +63,8 @@ OBJS = \
midi-sequencer.cpp.o \
midi-split.c.o \
midi-through.c.o \
midi-transpose.c.o
midi-transpose.c.o \
sunvox-file.cpp.o

ifneq ($(WIN32),true)
OBJS += \


+ 0
- 1239
source/backend/native/nekofilter/ui.py
File diff suppressed because it is too large
View File


+ 0
- 1
source/backend/native/zynaddsubfx.cpp View File

@@ -22,7 +22,6 @@
#include "CarlaNative.hpp"
#include "CarlaMIDI.h"
#include "CarlaString.hpp"
//#include "CarlaThread.hpp"
#include "RtList.hpp"

#include <QtCore/QThread>


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

@@ -1584,10 +1584,10 @@ void CarlaPlugin::registerToOscClient()

// Base data
{
char bufName[STR_MAX+1] = { 0 };
char bufLabel[STR_MAX+1] = { 0 };
char bufMaker[STR_MAX+1] = { 0 };
char bufCopyright[STR_MAX+1] = { 0 };
char bufName[STR_MAX+1] = { '\0' };
char bufLabel[STR_MAX+1] = { '\0' };
char bufMaker[STR_MAX+1] = { '\0' };
char bufCopyright[STR_MAX+1] = { '\0' };
getRealName(bufName);
getLabel(bufLabel);
getMaker(bufMaker);
@@ -1621,6 +1621,9 @@ void CarlaPlugin::registerToOscClient()

for (uint32_t i=0; i < kData->param.count; i++)
{
carla_fill<char>(bufName, STR_MAX, '\0');
carla_fill<char>(bufUnit, STR_MAX, '\0');

getParameterName(i, bufName);
getParameterUnit(i, bufUnit);



+ 1
- 0
source/backend/plugin/NativePlugin.cpp View File

@@ -41,6 +41,7 @@ void carla_register_all_plugins()
#ifndef CARLA_OS_WIN
//carla_register_native_plugin_nekofilter(); // needs UI stuff
#endif
//carla_register_native_plugin_sunvoxfile(); // unfinished

// Carla
//carla_register_native_plugin_carla(); // unfinished


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

@@ -815,7 +815,7 @@ public:
// 1. IL Harmless - disable threaded processing
if (fEffect->uniqueID == 1229484653)
{
char strBuf[STR_MAX+1] = { 0 };
char strBuf[STR_MAX+1] = { '\0' };
getLabel(strBuf);

if (std::strcmp(strBuf, "IL Harmless") == 0)
@@ -852,7 +852,7 @@ public:
// Update names
for (i=0; i < count; ++i)
{
char strBuf[STR_MAX+1] = { 0 };
char strBuf[STR_MAX+1] = { '\0' };
if (dispatcher(effGetProgramNameIndexed, i, 0, strBuf, 0.0f) != 1)
{
// program will be [re-]changed later
@@ -2017,7 +2017,7 @@ protected:

if (current >= 0 && current < static_cast<int32_t>(kData->prog.count))
{
char strBuf[STR_MAX+1] = { 0 };
char strBuf[STR_MAX+1] = { '\0' };
dispatcher(effGetProgramName, 0, 0, strBuf, 0.0f);

if (kData->prog.names[current] != nullptr)


+ 165
- 73
source/backend/standalone/CarlaStandalone.cpp View File

@@ -35,13 +35,12 @@

using CarlaBackend::CarlaEngine;
using CarlaBackend::CarlaPlugin;

using CarlaBackend::CallbackFunc;
using CarlaBackend::EngineOptions;

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

// Single, standalone engine

struct CarlaBackendStandalone {
CallbackFunc callback;
void* callbackPtr;
@@ -66,6 +65,11 @@ struct CarlaBackendStandalone {
app->setStyle(new CarlaStyle());
}

~CarlaBackendStandalone()
{
CARLA_ASSERT(engine == nullptr);
}

void init()
{
if (! needsInit)
@@ -142,6 +146,7 @@ const char* carla_get_extended_license_text()
text1 += "<li>DISTRHO Mini-Series plugin code, based on LOSER-dev suite by Michael Gruhn</li>";
#endif
text1 += "<li>NekoFilter plugin code, based on lv2fil by Nedko Arnaudov and Fons Adriaensen</li>";
text1 += "<li>SunVox library file support, http://www.warmplace.ru/soft/sunvox/</li>";

#ifdef WANT_AUDIOFILE
text1 += "<li>AudioDecoder library for Audio file support, by Robin Gareus</li>";
@@ -167,7 +172,7 @@ const char* carla_get_extended_license_text()
text1 += "</ul>";

// code snippets
text2 = "<p>Additionally, Carla uses code snippets from the following projects:</p>";
text2 += "<p>Additionally, Carla uses code snippets from the following projects:</p>";
text2 += "<ul>";
text2 += "<li>Pointer and data leak utils from JUCE, http://www.rawmaterialsoftware.com/juce.php</li>";
text2 += "<li>Shared memory utils from dssi-vst, http://www.breakfastquay.com/dssi-vst/</li>";
@@ -188,12 +193,14 @@ const char* carla_get_extended_license_text()

const char* carla_get_supported_file_types()
{
carla_debug("carla_get_supported_file_types()");

static CarlaString retText;

if (retText.isEmpty())
{
// Base type
retText = "*.carxp;*.carxs";
// Base types
retText += "*.carxp;*.carxs";

// Sample kits
#ifdef WANT_FLUIDSYNTH
@@ -203,13 +210,18 @@ const char* carla_get_supported_file_types()
retText += ";*.gig;*.sfz";
#endif

// Special files provided by internal plugins
// Files provided by internal plugins
#ifdef WANT_AUDIOFILE
retText += ";*.aac;*.flac;*.oga;*.ogg;*.mp3;*.wav";
retText += "*.3g2;*.3gp;*.aac;*.ac3;*.aiff;*.amr;*.ape;*.flac;*.mp2;*.mp3;*.mpc;*.oga;*.ogg;*.w64;*.wav;*.wma;";
#endif
#ifdef WANT_MIDIFILE
retText += ";*.mid;*.midi";
#endif

// Plugin presets
#ifdef WANT_ZYNADDSUBFX
retText += ";*.xmz";
#endif
}

return retText;
@@ -236,6 +248,9 @@ const void* carla_get_engine_driver_options(unsigned int index)
carla_debug("carla_get_engine_driver_options(%i)", index);

return nullptr;

// unused
(void)index;
}

// -------------------------------------------------------------------------------------------------------------------
@@ -246,9 +261,9 @@ unsigned int carla_get_internal_plugin_count()

#ifdef WANT_NATIVE
return static_cast<unsigned int>(CarlaPlugin::getNativePluginCount());
#else
return 0;
#endif

return 0;
}

const CarlaNativePluginInfo* carla_get_internal_plugin_info(unsigned int internalPluginId)
@@ -258,7 +273,7 @@ const CarlaNativePluginInfo* carla_get_internal_plugin_info(unsigned int interna
static CarlaNativePluginInfo info;

#ifdef WANT_NATIVE
const PluginDescriptor* const nativePlugin = CarlaPlugin::getNativePluginDescriptor(internalPluginId);
const PluginDescriptor* const nativePlugin(CarlaPlugin::getNativePluginDescriptor(internalPluginId));

// as internal plugin, this must never fail
CARLA_ASSERT(nativePlugin != nullptr);
@@ -266,8 +281,8 @@ const CarlaNativePluginInfo* carla_get_internal_plugin_info(unsigned int interna
if (nativePlugin == nullptr)
return nullptr;

info.category = static_cast<CarlaPluginCategory>(nativePlugin->category);
info.hints = 0x0;
info.category = static_cast<CarlaPluginCategory>(nativePlugin->category);
info.hints = 0x0;

if (nativePlugin->hints & PLUGIN_IS_RTSAFE)
info.hints |= CarlaBackend::PLUGIN_IS_RTSAFE;
@@ -292,6 +307,11 @@ const CarlaNativePluginInfo* carla_get_internal_plugin_info(unsigned int interna
#endif

return &info;

#ifndef WANT_NATIVE
// unused
(void)internalPluginId;
#endif
}

// -------------------------------------------------------------------------------------------------------------------
@@ -303,6 +323,12 @@ bool carla_engine_init(const char* driverName, const char* clientName)
CARLA_ASSERT(driverName != nullptr);
CARLA_ASSERT(clientName != nullptr);

if (standalone.engine != nullptr)
{
standalone.lastError = "Engine is already running";
return false;
}

standalone.engine = CarlaEngine::newDriverByName(driverName);

if (standalone.engine == nullptr)
@@ -325,7 +351,9 @@ bool carla_engine_init(const char* driverName, const char* clientName)

#ifndef BUILD_BRIDGE
standalone.engine->setOption(CarlaBackend::OPTION_PROCESS_MODE, static_cast<int>(standalone.options.processMode), nullptr);
# if 0 // disabled for now
standalone.engine->setOption(CarlaBackend::OPTION_TRANSPORT_MODE, static_cast<int>(standalone.options.transportMode), nullptr);
# endif
standalone.engine->setOption(CarlaBackend::OPTION_FORCE_STEREO, standalone.options.forceStereo ? 1 : 0, nullptr);
standalone.engine->setOption(CarlaBackend::OPTION_PREFER_PLUGIN_BRIDGES, standalone.options.preferPluginBridges ? 1 : 0, nullptr);
standalone.engine->setOption(CarlaBackend::OPTION_PREFER_UI_BRIDGES, standalone.options.preferUiBridges ? 1 : 0, nullptr);
@@ -336,45 +364,43 @@ bool carla_engine_init(const char* driverName, const char* clientName)
standalone.engine->setOption(CarlaBackend::OPTION_PREFERRED_BUFFER_SIZE, static_cast<int>(standalone.options.preferredBufferSize), nullptr);
standalone.engine->setOption(CarlaBackend::OPTION_PREFERRED_SAMPLE_RATE, static_cast<int>(standalone.options.preferredSampleRate), nullptr);
standalone.engine->setOption(CarlaBackend::OPTION_OSC_UI_TIMEOUT, static_cast<int>(standalone.options.oscUiTimeout), nullptr);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_NATIVE, 0, standalone.options.bridge_native);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_POSIX32, 0, standalone.options.bridge_posix32);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_POSIX64, 0, standalone.options.bridge_posix64);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_WIN32, 0, standalone.options.bridge_win32);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_WIN64, 0, standalone.options.bridge_win64);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_NATIVE, 0, (const char*)standalone.options.bridge_native);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_POSIX32, 0, (const char*)standalone.options.bridge_posix32);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_POSIX64, 0, (const char*)standalone.options.bridge_posix64);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_WIN32, 0, (const char*)standalone.options.bridge_win32);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_WIN64, 0, (const char*)standalone.options.bridge_win64);
# ifdef WANT_LV2
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_GTK2, 0, standalone.options.bridge_lv2Gtk2);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_GTK3, 0, standalone.options.bridge_lv2Gtk3);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_QT4, 0, standalone.options.bridge_lv2Qt4);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_QT5, 0, standalone.options.bridge_lv2Qt5);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_COCOA, 0, standalone.options.bridge_lv2Cocoa);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_WINDOWS, 0, standalone.options.bridge_lv2Win);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_X11, 0, standalone.options.bridge_lv2X11);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_GTK2, 0, (const char*)standalone.options.bridge_lv2Gtk2);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_GTK3, 0, (const char*)standalone.options.bridge_lv2Gtk3);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_QT4, 0, (const char*)standalone.options.bridge_lv2Qt4);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_QT5, 0, (const char*)standalone.options.bridge_lv2Qt5);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_COCOA, 0, (const char*)standalone.options.bridge_lv2Cocoa);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_WINDOWS, 0, (const char*)standalone.options.bridge_lv2Win);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_X11, 0, (const char*)standalone.options.bridge_lv2X11);
# endif
# ifdef WANT_VST
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_VST_COCOA, 0, standalone.options.bridge_vstCocoa);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_VST_HWND, 0, standalone.options.bridge_vstHWND);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_VST_X11, 0, standalone.options.bridge_vstX11);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_VST_COCOA, 0, (const char*)standalone.options.bridge_vstCocoa);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_VST_HWND, 0, (const char*)standalone.options.bridge_vstHWND);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_VST_X11, 0, (const char*)standalone.options.bridge_vstX11);
# endif

if (standalone.procName.isNotEmpty())
standalone.engine->setOption(CarlaBackend::OPTION_PROCESS_NAME, 0, standalone.procName);
standalone.engine->setOption(CarlaBackend::OPTION_PROCESS_NAME, 0, (const char*)standalone.procName);
#endif

const bool initiated = standalone.engine->init(clientName);

if (initiated)
if (standalone.engine->init(clientName))
{
standalone.lastError = "no error";
standalone.init();
return true;
}
else
{
standalone.lastError = standalone.engine->getLastError();
delete standalone.engine;
standalone.engine = nullptr;
return false;
}

return initiated;
}

bool carla_engine_close()
@@ -391,7 +417,10 @@ bool carla_engine_close()
standalone.engine->setAboutToClose();
standalone.engine->removeAllPlugins();

const bool closed = standalone.engine->close();
const bool closed(standalone.engine->close());

if (! closed)
standalone.lastError = standalone.engine->getLastError();

delete standalone.engine;
standalone.engine = nullptr;
@@ -427,7 +456,7 @@ void carla_set_engine_about_to_close()
standalone.engine->setAboutToClose();
}

void carla_set_engine_callback(CarlaBackend::CallbackFunc func, void* ptr)
void carla_set_engine_callback(CarlaCallbackFunc func, void* ptr)
{
carla_debug("carla_set_engine_callback(%p)", func);

@@ -438,14 +467,10 @@ void carla_set_engine_callback(CarlaBackend::CallbackFunc func, void* ptr)
standalone.engine->setCallback(func, ptr);
}

#ifndef BUILD_BRIDGE
void carla_set_engine_option(CarlaBackend::OptionsType option, int value, const char* valueStr)
{
carla_debug("carla_set_engine_option(%s, %i, \"%s\")", CarlaBackend::OptionsType2Str(option), value, valueStr);

if (standalone.engine != nullptr)
standalone.engine->setOption(option, value, valueStr);

switch (option)
{
case CarlaBackend::OPTION_PROCESS_NAME:
@@ -460,10 +485,12 @@ void carla_set_engine_option(CarlaBackend::OptionsType option, int value, const
break;

case CarlaBackend::OPTION_TRANSPORT_MODE:
#if 0 // disabled for now
if (value < CarlaBackend::TRANSPORT_MODE_INTERNAL || value > CarlaBackend::TRANSPORT_MODE_JACK)
return carla_stderr2("carla_set_engine_option(OPTION_TRANSPORT_MODE, %i, \"%s\") - invalid value", value, valueStr);

standalone.options.transportMode = static_cast<CarlaBackend::TransportMode>(value);
#endif
break;

case CarlaBackend::OPTION_FORCE_STEREO:
@@ -485,18 +512,30 @@ void carla_set_engine_option(CarlaBackend::OptionsType option, int value, const
#endif

case CarlaBackend::OPTION_MAX_PARAMETERS:
standalone.options.maxParameters = (value > 0) ? static_cast<unsigned int>(value) : CarlaBackend::MAX_DEFAULT_PARAMETERS;
if (value <= 0)
return carla_stderr2("carla_set_engine_option(OPTION_MAX_PARAMETERS, %i, \"%s\") - invalid value", value, valueStr);

standalone.options.maxParameters = static_cast<unsigned int>(value);
break;

case CarlaBackend::OPTION_OSC_UI_TIMEOUT:
if (value <= 0)
return carla_stderr2("carla_set_engine_option(OPTION_OSC_UI_TIMEOUT, %i, \"%s\") - invalid value", value, valueStr);

standalone.options.oscUiTimeout = static_cast<unsigned int>(value);
break;

case CarlaBackend::OPTION_PREFERRED_BUFFER_SIZE:
if (value <= 0)
return carla_stderr2("carla_set_engine_option(OPTION_PREFERRED_BUFFER_SIZE, %i, \"%s\") - invalid value", value, valueStr);

standalone.options.preferredBufferSize = static_cast<unsigned int>(value);
break;

case CarlaBackend::OPTION_PREFERRED_SAMPLE_RATE:
if (value <= 0)
return carla_stderr2("carla_set_engine_option(OPTION_PREFERRED_SAMPLE_RATE, %i, \"%s\") - invalid value", value, valueStr);

standalone.options.preferredSampleRate = static_cast<unsigned int>(value);
break;

@@ -552,8 +591,10 @@ void carla_set_engine_option(CarlaBackend::OptionsType option, int value, const
break;
#endif
}

if (standalone.engine != nullptr)
standalone.engine->setOption(option, value, valueStr);
}
#endif

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

@@ -563,7 +604,7 @@ bool carla_load_filename(const char* filename)
CARLA_ASSERT(standalone.engine != nullptr);
CARLA_ASSERT(filename != nullptr);

if (standalone.engine != nullptr)
if (standalone.engine != nullptr && standalone.engine->isRunning())
return standalone.engine->loadFilename(filename);

standalone.lastError = "Engine is not started";
@@ -576,7 +617,7 @@ bool carla_load_project(const char* filename)
CARLA_ASSERT(standalone.engine != nullptr);
CARLA_ASSERT(filename != nullptr);

if (standalone.engine != nullptr)
if (standalone.engine != nullptr && standalone.engine->isRunning())
return standalone.engine->loadProject(filename);

standalone.lastError = "Engine is not started";
@@ -589,7 +630,7 @@ bool carla_save_project(const char* filename)
CARLA_ASSERT(standalone.engine != nullptr);
CARLA_ASSERT(filename != nullptr);

if (standalone.engine != nullptr)
if (standalone.engine != nullptr) // allow to save even if engine stopped
return standalone.engine->saveProject(filename);

standalone.lastError = "Engine is not started";
@@ -598,22 +639,28 @@ bool carla_save_project(const char* filename)

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

void carla_patchbay_connect(int portA, int portB)
bool carla_patchbay_connect(int portA, int portB)
{
carla_debug("carla_patchbay_connect(%i, %i)", portA, portB);
CARLA_ASSERT(standalone.engine != nullptr);

if (standalone.engine != nullptr)
if (standalone.engine != nullptr && standalone.engine->isRunning())
return standalone.engine->patchbayConnect(portA, portB);

standalone.lastError = "Engine is not started";
return false;
}

void carla_patchbay_disconnect(int connectionId)
bool carla_patchbay_disconnect(int connectionId)
{
carla_debug("carla_patchbay_disconnect(%i)", connectionId);
CARLA_ASSERT(standalone.engine != nullptr);

if (standalone.engine != nullptr)
if (standalone.engine != nullptr && standalone.engine->isRunning())
return standalone.engine->patchbayDisconnect(connectionId);

standalone.lastError = "Engine is not started";
return false;
}

void carla_patchbay_refresh()
@@ -621,8 +668,8 @@ void carla_patchbay_refresh()
carla_debug("carla_patchbay_refresh()");
CARLA_ASSERT(standalone.engine != nullptr);

if (standalone.engine != nullptr)
return standalone.engine->patchbayRefresh();
if (standalone.engine != nullptr && standalone.engine->isRunning())
standalone.engine->patchbayRefresh();
}

// -------------------------------------------------------------------------------------------------------------------
@@ -632,7 +679,7 @@ void carla_transport_play()
carla_debug("carla_transport_play()");
CARLA_ASSERT(standalone.engine != nullptr);

if (standalone.engine != nullptr)
if (standalone.engine != nullptr && standalone.engine->isRunning())
standalone.engine->transportPlay();
}

@@ -641,7 +688,7 @@ void carla_transport_pause()
carla_debug("carla_transport_pause()");
CARLA_ASSERT(standalone.engine != nullptr);

if (standalone.engine != nullptr)
if (standalone.engine != nullptr && standalone.engine->isRunning())
standalone.engine->transportPause();
}

@@ -650,7 +697,7 @@ void carla_transport_relocate(uint32_t frames)
carla_debug("carla_transport_relocate(%i)", frames);
CARLA_ASSERT(standalone.engine != nullptr);

if (standalone.engine != nullptr)
if (standalone.engine != nullptr && standalone.engine->isRunning())
standalone.engine->transportRelocate(frames);
}

@@ -743,18 +790,39 @@ void carla_remove_all_plugins()
standalone.engine->removeAllPlugins();
}

const char* carla_rename_plugin(unsigned int pluginId, const char* newName)
{
carla_debug("carla_rename_plugin(%i, \"%s\")", pluginId, newName);
CARLA_ASSERT(standalone.engine != nullptr);

// -------------------------------------------------------------------------------------------------------------------
if (standalone.engine != nullptr && standalone.engine->isRunning())
return standalone.engine->renamePlugin(pluginId, newName);

standalone.lastError = "Engine is not started";
return nullptr;
}

bool carla_clone_plugin(unsigned int pluginId)
{
carla_debug("carla_clone_plugin(%i)", pluginId);
CARLA_ASSERT(standalone.engine != nullptr);

if (standalone.engine == nullptr)
return false;
if (standalone.engine != nullptr && standalone.engine->isRunning())
return standalone.engine->clonePlugin(pluginId);

standalone.lastError = "Engine is not started";
return false;
}

bool carla_replace_plugin(unsigned int pluginId)
{
carla_debug("carla_replace_plugin(%i)", pluginId);
CARLA_ASSERT(standalone.engine != nullptr);

// TODO
if (standalone.engine != nullptr && standalone.engine->isRunning())
return standalone.engine->replacePlugin(pluginId);

standalone.lastError = "Engine is not started";
return false;
}

@@ -763,10 +831,10 @@ bool carla_switch_plugins(unsigned int pluginIdA, unsigned int pluginIdB)
carla_debug("carla_switch_plugins(%i, %i)", pluginIdA, pluginIdB);
CARLA_ASSERT(standalone.engine != nullptr);

if (standalone.engine == nullptr)
return false;
if (standalone.engine != nullptr && standalone.engine->isRunning())
return standalone.engine->switchPlugins(pluginIdA, pluginIdB);

// TODO
standalone.lastError = "Engine is not started";
return false;
}

@@ -1066,12 +1134,12 @@ const CarlaScalePointInfo* carla_get_parameter_scalepoint_info(unsigned int plug

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

const CarlaBackend::ParameterData* carla_get_parameter_data(unsigned int pluginId, uint32_t parameterId)
const CarlaParameterData* carla_get_parameter_data(unsigned int pluginId, uint32_t parameterId)
{
carla_debug("carla_get_parameter_data(%i, %i)", pluginId, parameterId);
CARLA_ASSERT(standalone.engine != nullptr);

static CarlaBackend::ParameterData data;
static CarlaParameterData data;

if (standalone.engine == nullptr)
return &data;
@@ -1089,12 +1157,12 @@ const CarlaBackend::ParameterData* carla_get_parameter_data(unsigned int pluginI
return &data;
}

const CarlaBackend::ParameterRanges* carla_get_parameter_ranges(unsigned int pluginId, uint32_t parameterId)
const CarlaParameterRanges* carla_get_parameter_ranges(unsigned int pluginId, uint32_t parameterId)
{
carla_debug("carla_get_parameter_ranges(%i, %i)", pluginId, parameterId);
CARLA_ASSERT(standalone.engine != nullptr);

static CarlaBackend::ParameterRanges ranges;
static CarlaParameterRanges ranges;

if (standalone.engine == nullptr)
return &ranges;
@@ -1112,12 +1180,12 @@ const CarlaBackend::ParameterRanges* carla_get_parameter_ranges(unsigned int plu
return &ranges;
}

const CarlaBackend::MidiProgramData* carla_get_midi_program_data(unsigned int pluginId, uint32_t midiProgramId)
const CarlaMidiProgramData* carla_get_midi_program_data(unsigned int pluginId, uint32_t midiProgramId)
{
carla_debug("carla_get_midi_program_data(%i, %i)", pluginId, midiProgramId);
CARLA_ASSERT(standalone.engine != nullptr);

static CarlaBackend::MidiProgramData data;
static CarlaMidiProgramData data;

if (standalone.engine == nullptr)
return &data;
@@ -1135,12 +1203,12 @@ const CarlaBackend::MidiProgramData* carla_get_midi_program_data(unsigned int pl
return &data;
}

const CarlaBackend::CustomData* carla_get_custom_data(unsigned int pluginId, uint32_t customDataId)
const CarlaCustomData* carla_get_custom_data(unsigned int pluginId, uint32_t customDataId)
{
carla_debug("carla_get_custom_data(%i, %i)", pluginId, customDataId);
CARLA_ASSERT(standalone.engine != nullptr);

static CarlaBackend::CustomData data;
static CarlaCustomData data;

if (standalone.engine == nullptr)
return &data;
@@ -1937,6 +2005,13 @@ protected:
standalone.callback(standalone.callbackPtr, CarlaBackend::CALLBACK_NSM_ANNOUNCE, 0, 0, 0, 0.0f, smName);

return 0;

#ifndef DEBUG
// unused
(void)path;
(void)types;
(void)argc;
#endif
}

int handleOpen(const char* const path, const char* const types, lo_arg** const argv, const int argc, const lo_message msg)
@@ -1967,6 +2042,14 @@ protected:
lo_send_from(fReplyAddr, lo_server_thread_get_server(fServerThread), LO_TT_IMMEDIATE, "/reply", "ss", "/nsm/client/open", "OK");

return 0;

#ifndef DEBUG
// unused
(void)path;
(void)types;
(void)argc;
(void)msg;
#endif
}

int handleSave(const char* const path, const char* const types, lo_arg** const argv, const int argc, const lo_message msg)
@@ -1989,6 +2072,15 @@ protected:
lo_send_from(fReplyAddr, lo_server_thread_get_server(fServerThread), LO_TT_IMMEDIATE, "/reply", "ss", "/nsm/client/save", "OK");

return 0;

#ifndef DEBUG
// unused
(void)path;
(void)types;
(void)argv;
(void)argc;
(void)msg;
#endif
}

private:
@@ -2043,6 +2135,11 @@ void carla_nsm_reply_save()
// -------------------------------------------------------------------------------------------------------------------

#ifdef BUILD_BRIDGE
CarlaEngine* carla_get_standalone_engine()
{
return standalone.engine;
}

bool carla_engine_init_bridge(const char* audioBaseName, const char* controlBaseName, const char* clientName)
{
carla_debug("carla_engine_init_bridge(\"%s\", \"%s\", \"%s\")", audioBaseName, controlBaseName, clientName);
@@ -2092,9 +2189,4 @@ bool carla_engine_init_bridge(const char* audioBaseName, const char* controlBase

return initiated;
}

CarlaEngine* carla_get_standalone_engine()
{
return standalone.engine;
}
#endif

+ 2
- 6
source/carla.py View File

@@ -1057,9 +1057,6 @@ class CarlaMainW(QMainWindow):

if Carla.host.is_engine_running() and not Carla.host.engine_close():
print(cString(Carla.host.get_last_error()))
# failed
self.fEngineStarted = True
return

self.fBufferSize = 0
self.fSampleRate = 0.0
@@ -1803,9 +1800,6 @@ class CarlaMainW(QMainWindow):
QMainWindow.timerEvent(self, event)

def closeEvent(self, event):
#if self.nsm_server:
#self.nsm_server.stop()

self.saveSettings()

if Carla.host.is_engine_running():
@@ -1955,6 +1949,8 @@ if __name__ == '__main__':
Carla.host.set_engine_callback(engineCallback)
Carla.host.set_engine_option(OPTION_PROCESS_NAME, 0, "carla")

print(app.palette())

# Set bridge paths
if carla_bridge_native:
Carla.host.set_engine_option(OPTION_PATH_BRIDGE_NATIVE, 0, carla_bridge_native)


+ 16
- 4
source/carla_backend.py View File

@@ -417,10 +417,10 @@ class Host(object):
self.lib.carla_save_project.restype = c_bool

self.lib.carla_patchbay_connect.argtypes = [c_int, c_int]
self.lib.carla_patchbay_connect.restype = None
self.lib.carla_patchbay_connect.restype = c_bool

self.lib.carla_patchbay_disconnect.argtypes = [c_int]
self.lib.carla_patchbay_disconnect.restype = None
self.lib.carla_patchbay_disconnect.restype = c_bool

self.lib.carla_patchbay_refresh.argtypes = None
self.lib.carla_patchbay_refresh.restype = None
@@ -449,9 +449,15 @@ class Host(object):
self.lib.carla_remove_all_plugins.argtypes = None
self.lib.carla_remove_all_plugins.restype = None

self.lib.carla_rename_plugin.argtypes = [c_uint, c_char_p]
self.lib.carla_rename_plugin.restype = c_char_p

self.lib.carla_clone_plugin.argtypes = [c_uint]
self.lib.carla_clone_plugin.restype = c_bool

self.lib.carla_replace_plugin.argtypes = [c_uint]
self.lib.carla_replace_plugin.restype = c_bool

self.lib.carla_switch_plugins.argtypes = [c_uint, c_uint]
self.lib.carla_switch_plugins.restype = c_bool

@@ -666,10 +672,10 @@ class Host(object):
return self.lib.carla_save_project(filename.encode("utf-8"))

def patchbay_connect(self, portIdA, portIdB):
self.lib.carla_patchbay_connect(portIdA, portIdB)
return self.lib.carla_patchbay_connect(portIdA, portIdB)

def patchbay_disconnect(self, connectionId):
self.lib.carla_patchbay_disconnect(connectionId)
return self.lib.carla_patchbay_disconnect(connectionId)

def patchbay_refresh(self):
self.lib.carla_patchbay_refresh()
@@ -701,9 +707,15 @@ class Host(object):
def remove_all_plugins(self):
self.lib.carla_remove_all_plugins()

def rename_plugin(self, pluginId, newName):
return self.lib.carla_rename_plugin(pluginId, newName)

def clone_plugin(self, pluginId):
return self.lib.carla_clone_plugin(pluginId)

def replace_plugin(self, pluginId):
return self.lib.carla_replace_plugin(pluginId)

def switch_plugins(self, pluginIdA, pluginIdB):
return self.lib.carla_switch_plugins(pluginIdA, pluginIdB)



+ 1
- 1
source/discovery/carla-discovery.cpp View File

@@ -1071,7 +1071,7 @@ void do_vst_check(void* const libHandle, const bool init)
return;
}

char strBuf[STR_MAX+1] = { 0 };
char strBuf[STR_MAX+1] = { '\0' };
CarlaString cName;
CarlaString cProduct;
CarlaString cVendor;


+ 20
- 10
source/tests/ANSI.cpp View File

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

//#include "CarlaBackendUtils.hpp"
//#include "CarlaLadspaUtils.hpp"
//#include "CarlaLibUtils.hpp"
//#include "CarlaLv2Utils.hpp"
//#include "CarlaOscUtils.hpp"
//#include "CarlaStateUtils.hpp"
//#include "CarlaString.hpp"
//#include "CarlaThread.hpp"
//#include "CarlaVstUtils.hpp"
//#include "RtList.hpp"
// #include "CarlaBackend.hpp"
// #include "CarlaEngine.hpp"
// #include "CarlaPlugin.hpp"
// #include "CarlaNative.h"
// #include "CarlaNative.hpp"
#include "standalone/CarlaStandalone.cpp"

// #include "CarlaMutex.hpp"
// #include "CarlaString.hpp"

// #include "CarlaBackendUtils.hpp"
// #include "CarlaBridgeUtils.hpp"
// #include "CarlaLadspaUtils.hpp"
// #include "CarlaLibUtils.hpp"
// #include "CarlaLv2Utils.hpp"
// #include "CarlaOscUtils.hpp"
// #include "CarlaShmUtils.hpp"
// #include "CarlaStateUtils.hpp"
// #include "CarlaVstUtils.hpp"
// #include "RtList.hpp"

int main()
{


+ 0
- 123
source/tests/Base64.cpp View File

@@ -1,123 +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 GPL.txt file
*/

#include "CarlaBase64Utils.hpp"
#include "CarlaString.hpp"

int main()
{
// First check, cannot fail
assert(std::strlen(kBase64) == 64);

// Test regular C strings
{
const char strHelloWorld[] = "Hello World\n\0";
const char b64HelloWorld[] = "SGVsbG8gV29ybGQK\0";

// encode "Hello World" to base64
size_t bufSize = std::strlen(strHelloWorld);
char bufEncoded[carla_base64_encoded_len(bufSize) + 1];
carla_base64_encode((const uint8_t*)strHelloWorld, bufSize, bufEncoded);
assert(std::strcmp(b64HelloWorld, bufEncoded) == 0);

// decode base64 "SGVsbG8gV29ybGQK" back to "Hello World"
uint8_t bufDecoded[carla_base64_decoded_max_len(b64HelloWorld)];
size_t bufDecSize = carla_base64_decode(b64HelloWorld, bufDecoded);
char strDecoded[bufDecSize+1];
std::strncpy(strDecoded, (char*)bufDecoded, bufDecSize);
strDecoded[bufDecSize] = '\0';
assert(std::strcmp(strHelloWorld, strDecoded) == 0);
assert(bufSize == bufDecSize);
}

struct Blob {
char s[4];
int i;
double d;
void* ptr;
char pad[17];
int32_t i32;
int64_t i64;
bool b;
};
Blob blob;

const size_t blobSize = sizeof(Blob);
carla_zeroStruct<Blob>(blob);

blob.s[0] = '1';
blob.s[1] = 's';
blob.s[2] = 't';
blob.i = 228;
blob.d = 3.33333333333;
blob.ptr = (void*)0x500;
blob.i32 = 32;
blob.i64 = 64;
blob.b = true;
blob.pad[11] = 71;

// binary -> base64
char blobEnc[carla_base64_encoded_len(blobSize) + 1];
carla_base64_encode((const uint8_t*)&blob, blobSize, blobEnc);
std::printf("BINARY '%s', size:" P_SIZE "\n", blobEnc, blobSize);

{
// base64 -> binary
uint8_t blobDec[carla_base64_decoded_max_len(blobEnc)];
carla_base64_decode(blobEnc, blobDec);

Blob blobTest;
carla_zeroStruct<Blob>(blobTest);

std::memcpy(&blobTest, blobDec, sizeof(Blob));
assert(blobTest.s[0] == '1');
assert(blobTest.s[1] == 's');
assert(blobTest.s[2] == 't');
assert(blobTest.i == 228);
assert(blobTest.d == 3.33333333333);
assert(blobTest.ptr == (void*)0x500);
assert(blobTest.i32 == 32);
assert(blobTest.i64 == 64);
assert(blobTest.b == true);
assert(blobTest.pad[11] == 71);
}

{
// CarlaString usage
CarlaString string;
string.importBinaryAsBase64<Blob>(&blob);
assert(std::strcmp(blobEnc, (const char*)string) == 0);
assert(std::strlen(blobEnc) == string.length());

Blob* blobNew = string.exportAsBase64Binary<Blob>();

assert(blobNew->s[0] == '1');
assert(blobNew->s[1] == 's');
assert(blobNew->s[2] == 't');
assert(blobNew->i == 228);
assert(blobNew->d == 3.33333333333);
assert(blobNew->ptr == (void*)0x500);
assert(blobNew->i32 == 32);
assert(blobNew->i64 == 64);
assert(blobNew->b == true);
assert(blobNew->pad[11] == 71);

delete blobNew;
}

return 0;
}

+ 2
- 5
source/tests/Makefile View File

@@ -8,7 +8,7 @@ include ../Makefile.mk

# --------------------------------------------------------------

BUILD_CXX_FLAGS += -I../backend -I../includes -I../libs -I../utils -Wall -Wextra
BUILD_CXX_FLAGS += -I../backend -I../includes -I../libs -I../theme -I../utils -Wall -Wextra
# BUILD_CXX_FLAGS += -isystem ../libs/juce
# BUILD_CXX_FLAGS += -DWANT_JACK -DWANT_LADSPA -DWANT_DSSI
BUILD_CXX_FLAGS += -isystem /usr/include/qt4
@@ -20,7 +20,7 @@ ANSI_CXX_FLAGS += -Wcast-qual -Wconversion -Wsign-conversion -Wlogical-op -Wagg
ANSI_CXX_FLAGS += -std=c++11 -Wzero-as-null-pointer-constant
ANSI_CXX_FLAGS += -DVESTIGE_HEADER -fPIC

TARGETS = ANSI Base64 CarlaString RtList Thread Print Utils
TARGETS = ANSI CarlaString RtList Thread Print Utils

all: $(TARGETS) RUN

@@ -29,9 +29,6 @@ all: $(TARGETS) RUN
ANSI: ANSI.cpp
$(CXX) $^ $(BUILD_CXX_FLAGS) $(ANSI_CXX_FLAGS) $(LINK_FLAGS) -o $@

Base64: Base64.cpp
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -o $@

CarlaString: CarlaString.cpp
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -o $@



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

@@ -758,7 +758,7 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri)
else
carla_stderr("lv2_rdf_new(\"%s\") - got unknown port Midi-Map type '%s'", uri, midiMapType);

rdfPort->MidiMap.Number = midiMapNumberNodes.get_first().as_int();
rdfPort->MidiMap.Number = static_cast<uint32_t>(midiMapNumberNodes.get_first().as_int());
}
}
}
@@ -942,7 +942,7 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri)
presetListURIs.sort();

// create presets with unique URIs
rdfDescriptor->PresetCount = presetListURIs.count();
rdfDescriptor->PresetCount = static_cast<uint32_t>(presetListURIs.count());
rdfDescriptor->Presets = new LV2_RDF_Preset[rdfDescriptor->PresetCount];

// set preset data


Loading…
Cancel
Save