Browse Source

Host API calls now require handle as first argument

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.2.0-RC1
falkTX 5 years ago
parent
commit
215103c05d
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
7 changed files with 1252 additions and 1136 deletions
  1. +147
    -101
      source/backend/CarlaHost.h
  2. +94
    -0
      source/backend/CarlaHostImpl.hpp
  3. +751
    -755
      source/backend/CarlaStandalone.cpp
  4. +26
    -28
      source/backend/CarlaStandaloneNSM.cpp
  5. +26
    -20
      source/bridges-plugin/CarlaBridgePlugin.cpp
  6. +204
    -199
      source/frontend/carla_backend.py
  7. +4
    -33
      source/utils/ThreadSafeFFTW.hpp

+ 147
- 101
source/backend/CarlaHost.h View File

@@ -1,6 +1,6 @@
/*
* Carla Plugin Host
* Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2020 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
@@ -350,6 +350,9 @@ typedef struct {
int stride;
} CarlaInlineDisplayImageSurface;

/*! Opaque data type for CarlaHost API calls */
typedef struct _CarlaHostHandle* CarlaHostHandle;

/* ------------------------------------------------------------------------------------------------------------
* Carla Host API (C functions) */

@@ -385,12 +388,17 @@ CARLA_EXPORT const EngineDriverDeviceInfo* carla_get_engine_driver_device_info(u
*/
CARLA_EXPORT bool carla_show_engine_driver_device_control_panel(uint index, const char* name);

/*!
* Create a global host handle for standalone application usage.
*/
CARLA_EXPORT CarlaHostHandle carla_standalone_host_init(void);

#ifdef __cplusplus
/*!
* Get the currently used engine, may be NULL.
* @note C++ only
*/
CARLA_EXPORT CarlaEngine* carla_get_engine(void);
CARLA_EXPORT CarlaEngine* carla_get_engine_from_handle(CarlaHostHandle handle);
#endif

/*!
@@ -399,14 +407,18 @@ CARLA_EXPORT CarlaEngine* carla_get_engine(void);
* @param driverName Driver to use
* @param clientName Engine master client name
*/
CARLA_EXPORT bool carla_engine_init(const char* driverName, const char* clientName);
CARLA_EXPORT bool carla_engine_init(CarlaHostHandle handle, const char* driverName, const char* clientName);

#ifdef BUILD_BRIDGE
/*!
* Initialize the engine in bridged mode.
*/
CARLA_EXPORT bool carla_engine_init_bridge(const char audioBaseName[6+1], const char rtClientBaseName[6+1], const char nonRtClientBaseName[6+1],
const char nonRtServerBaseName[6+1], const char* clientName);
CARLA_EXPORT bool carla_engine_init_bridge(CarlaHostHandle handle,
const char audioBaseName[6+1],
const char rtClientBaseName[6+1],
const char nonRtClientBaseName[6+1],
const char nonRtServerBaseName[6+1],
const char* clientName);
#endif

/*!
@@ -414,68 +426,68 @@ CARLA_EXPORT bool carla_engine_init_bridge(const char audioBaseName[6+1], const
* This function always closes the engine even if it returns false.
* In other words, even when something goes wrong when closing the engine it still be closed nonetheless.
*/
CARLA_EXPORT bool carla_engine_close(void);
CARLA_EXPORT bool carla_engine_close(CarlaHostHandle handle);

/*!
* Idle the engine.
* Do not call this if the engine is not running.
*/
CARLA_EXPORT void carla_engine_idle(void);
CARLA_EXPORT void carla_engine_idle(CarlaHostHandle handle);

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

/*!
* Get information about the currently running engine.
*/
CARLA_EXPORT const CarlaRuntimeEngineInfo* carla_get_runtime_engine_info(void);
CARLA_EXPORT const CarlaRuntimeEngineInfo* carla_get_runtime_engine_info(CarlaHostHandle handle);

#ifndef BUILD_BRIDGE
/*!
* Get information about the currently running engine driver device.
*/
CARLA_EXPORT const CarlaRuntimeEngineDriverDeviceInfo* carla_get_runtime_engine_driver_device_info(void);
CARLA_EXPORT const CarlaRuntimeEngineDriverDeviceInfo* carla_get_runtime_engine_driver_device_info(CarlaHostHandle handle);

/*!
* Dynamically change buffer size and/or sample rate while engine is running.
* @see ENGINE_DRIVER_DEVICE_VARIABLE_BUFFER_SIZE
* @see ENGINE_DRIVER_DEVICE_VARIABLE_SAMPLE_RATE
*/
CARLA_EXPORT bool carla_set_engine_buffer_size_and_sample_rate(uint bufferSize, double sampleRate);
CARLA_EXPORT bool carla_set_engine_buffer_size_and_sample_rate(CarlaHostHandle handle, uint bufferSize, double sampleRate);

/*!
* Show the custom control panel for the current engine device.
* @see ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL
*/
CARLA_EXPORT bool carla_show_engine_device_control_panel(void);
CARLA_EXPORT bool carla_show_engine_device_control_panel(CarlaHostHandle handle);
#endif

/*!
* Clear the xrun count on the engine, so that the next time carla_get_runtime_engine_info() is called, it returns 0.
*/
CARLA_EXPORT void carla_clear_engine_xruns(void);
CARLA_EXPORT void carla_clear_engine_xruns(CarlaHostHandle handle);

/*!
* Tell the engine to stop the current cancelable action.
* @see ENGINE_CALLBACK_CANCELABLE_ACTION
*/
CARLA_EXPORT void carla_cancel_engine_action(void);
CARLA_EXPORT void carla_cancel_engine_action(CarlaHostHandle handle);

/*!
* Tell the engine it's about to close.
* This is used to prevent the engine thread(s) from reactivating.
* Returns true if there's no pending engine events.
*/
CARLA_EXPORT bool carla_set_engine_about_to_close(void);
CARLA_EXPORT bool carla_set_engine_about_to_close(CarlaHostHandle handle);

/*!
* Set the engine callback function.
* @param func Callback function
* @param ptr Callback pointer
*/
CARLA_EXPORT void carla_set_engine_callback(EngineCallbackFunc func, void* ptr);
CARLA_EXPORT void carla_set_engine_callback(CarlaHostHandle handle, EngineCallbackFunc func, void* ptr);

#ifndef BUILD_BRIDGE
/*!
@@ -484,7 +496,7 @@ CARLA_EXPORT void carla_set_engine_callback(EngineCallbackFunc func, void* ptr);
* @param value Value as number
* @param valueStr Value as string
*/
CARLA_EXPORT void carla_set_engine_option(EngineOption option, int value, const char* valueStr);
CARLA_EXPORT void carla_set_engine_option(CarlaHostHandle handle, EngineOption option, int value, const char* valueStr);
#endif

/*!
@@ -492,7 +504,7 @@ CARLA_EXPORT void carla_set_engine_option(EngineOption option, int value, const
* @param func Callback function
* @param ptr Callback pointer
*/
CARLA_EXPORT void carla_set_file_callback(FileCallbackFunc func, void* ptr);
CARLA_EXPORT void carla_set_file_callback(CarlaHostHandle handle, FileCallbackFunc func, void* ptr);

/*!
* Load a file of any type.
@@ -500,24 +512,24 @@ CARLA_EXPORT void carla_set_file_callback(FileCallbackFunc func, void* ptr);
* either by direct handling (SF2 and SFZ) or by using an internal plugin (like Audio and MIDI).
* @see carla_get_supported_file_extensions()
*/
CARLA_EXPORT bool carla_load_file(const char* filename);
CARLA_EXPORT bool carla_load_file(CarlaHostHandle handle, const char* filename);

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

/*!
* Save current project to a file.
*/
CARLA_EXPORT bool carla_save_project(const char* filename);
CARLA_EXPORT bool carla_save_project(CarlaHostHandle handle, const char* filename);

#ifndef BUILD_BRIDGE
/*!
* Clear the currently set project filename.
*/
CARLA_EXPORT void carla_clear_project_filename(void);
CARLA_EXPORT void carla_clear_project_filename(CarlaHostHandle handle);

/*!
* Connect two patchbay ports.
@@ -527,63 +539,63 @@ CARLA_EXPORT void carla_clear_project_filename(void);
* @param portIdB Input port
* @see ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED
*/
CARLA_EXPORT bool carla_patchbay_connect(bool external, uint groupIdA, uint portIdA, uint groupIdB, uint portIdB);
CARLA_EXPORT bool carla_patchbay_connect(CarlaHostHandle handle, bool external, uint groupIdA, uint portIdA, uint groupIdB, uint portIdB);

/*!
* Disconnect two patchbay ports.
* @param connectionId Connection Id
* @see ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED
*/
CARLA_EXPORT bool carla_patchbay_disconnect(bool external, uint connectionId);
CARLA_EXPORT bool carla_patchbay_disconnect(CarlaHostHandle handle, bool external, uint connectionId);

/*!
* Force the engine to resend all patchbay clients, ports and connections again.
* @param external Wherever to show external/hardware ports instead of internal ones.
* Only valid in patchbay engine mode, other modes will ignore this.
*/
CARLA_EXPORT bool carla_patchbay_refresh(bool external);
CARLA_EXPORT bool carla_patchbay_refresh(CarlaHostHandle handle, bool external);

/*!
* Start playback of the engine transport.
*/
CARLA_EXPORT void carla_transport_play(void);
CARLA_EXPORT void carla_transport_play(CarlaHostHandle handle);

/*!
* Pause the engine transport.
*/
CARLA_EXPORT void carla_transport_pause(void);
CARLA_EXPORT void carla_transport_pause(CarlaHostHandle handle);

/*!
* Set the engine transport bpm.
*/
CARLA_EXPORT void carla_transport_bpm(double bpm);
CARLA_EXPORT void carla_transport_bpm(CarlaHostHandle handle, double bpm);

/*!
* Relocate the engine transport to a specific frame.
*/
CARLA_EXPORT void carla_transport_relocate(uint64_t frame);
CARLA_EXPORT void carla_transport_relocate(CarlaHostHandle handle, uint64_t frame);

/*!
* Get the current transport frame.
*/
CARLA_EXPORT uint64_t carla_get_current_transport_frame(void);
CARLA_EXPORT uint64_t carla_get_current_transport_frame(CarlaHostHandle handle);

/*!
* Get the engine transport information.
*/
CARLA_EXPORT const CarlaTransportInfo* carla_get_transport_info(void);
CARLA_EXPORT const CarlaTransportInfo* carla_get_transport_info(CarlaHostHandle handle);
#endif

/*!
* Current number of plugins loaded.
*/
CARLA_EXPORT uint32_t carla_get_current_plugin_count(void);
CARLA_EXPORT uint32_t carla_get_current_plugin_count(CarlaHostHandle handle);

/*!
* Maximum number of loadable plugins allowed.
* Returns 0 if engine is not started.
*/
CARLA_EXPORT uint32_t carla_get_max_plugin_number(void);
CARLA_EXPORT uint32_t carla_get_max_plugin_number(CarlaHostHandle handle);

/*!
* Add a new plugin.
@@ -597,7 +609,8 @@ CARLA_EXPORT uint32_t carla_get_max_plugin_number(void);
* @param extraPtr Extra pointer, defined per plugin type
* @param options Initial plugin options
*/
CARLA_EXPORT bool carla_add_plugin(BinaryType btype, PluginType ptype,
CARLA_EXPORT bool carla_add_plugin(CarlaHostHandle handle,
BinaryType btype, PluginType ptype,
const char* filename, const char* name, const char* label, int64_t uniqueId,
const void* extraPtr, uint options);

@@ -605,12 +618,12 @@ CARLA_EXPORT bool carla_add_plugin(BinaryType btype, PluginType ptype,
* Remove one plugin.
* @param pluginId Plugin to remove.
*/
CARLA_EXPORT bool carla_remove_plugin(uint pluginId);
CARLA_EXPORT bool carla_remove_plugin(CarlaHostHandle handle, uint pluginId);

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

#ifndef BUILD_BRIDGE
/*!
@@ -619,13 +632,13 @@ CARLA_EXPORT bool carla_remove_all_plugins(void);
* @param pluginId Plugin to rename
* @param newName New plugin name
*/
CARLA_EXPORT bool carla_rename_plugin(uint pluginId, const char* newName);
CARLA_EXPORT bool carla_rename_plugin(CarlaHostHandle handle, uint pluginId, const char* newName);

/*!
* Clone a plugin.
* @param pluginId Plugin to clone
*/
CARLA_EXPORT bool carla_clone_plugin(uint pluginId);
CARLA_EXPORT bool carla_clone_plugin(CarlaHostHandle handle, uint pluginId);

/*!
* Prepare replace of a plugin.
@@ -633,14 +646,14 @@ CARLA_EXPORT bool carla_clone_plugin(uint pluginId);
* @param pluginId Plugin to replace
* @note This function requires carla_add_plugin() to be called afterwards *as soon as possible*.
*/
CARLA_EXPORT bool carla_replace_plugin(uint pluginId);
CARLA_EXPORT bool carla_replace_plugin(CarlaHostHandle handle, uint pluginId);

/*!
* Switch two plugins positions.
* @param pluginIdA Plugin A
* @param pluginIdB Plugin B
*/
CARLA_EXPORT bool carla_switch_plugins(uint pluginIdA, uint pluginIdB);
CARLA_EXPORT bool carla_switch_plugins(CarlaHostHandle handle, uint pluginIdA, uint pluginIdB);
#endif

/*!
@@ -649,7 +662,7 @@ CARLA_EXPORT bool carla_switch_plugins(uint pluginIdA, uint pluginIdB);
* @param filename Path to plugin state
* @see carla_save_plugin_state()
*/
CARLA_EXPORT bool carla_load_plugin_state(uint pluginId, const char* filename);
CARLA_EXPORT bool carla_load_plugin_state(CarlaHostHandle handle, uint pluginId, const char* filename);

/*!
* Save a plugin state.
@@ -657,38 +670,38 @@ CARLA_EXPORT bool carla_load_plugin_state(uint pluginId, const char* filename);
* @param filename Path to plugin state
* @see carla_load_plugin_state()
*/
CARLA_EXPORT bool carla_save_plugin_state(uint pluginId, const char* filename);
CARLA_EXPORT bool carla_save_plugin_state(CarlaHostHandle handle, uint pluginId, const char* filename);

/*!
* Export plugin as LV2.
* @param pluginId Plugin
* @param lv2path Path to lv2 plugin folder
*/
CARLA_EXPORT bool carla_export_plugin_lv2(uint pluginId, const char* lv2path);
CARLA_EXPORT bool carla_export_plugin_lv2(CarlaHostHandle handle, uint pluginId, const char* lv2path);

/*!
* Get information from a plugin.
* @param pluginId Plugin
*/
CARLA_EXPORT const CarlaPluginInfo* carla_get_plugin_info(uint pluginId);
CARLA_EXPORT const CarlaPluginInfo* carla_get_plugin_info(CarlaHostHandle handle, uint pluginId);

/*!
* Get audio port count information from a plugin.
* @param pluginId Plugin
*/
CARLA_EXPORT const CarlaPortCountInfo* carla_get_audio_port_count_info(uint pluginId);
CARLA_EXPORT const CarlaPortCountInfo* carla_get_audio_port_count_info(CarlaHostHandle handle, uint pluginId);

/*!
* Get MIDI port count information from a plugin.
* @param pluginId Plugin
*/
CARLA_EXPORT const CarlaPortCountInfo* carla_get_midi_port_count_info(uint pluginId);
CARLA_EXPORT const CarlaPortCountInfo* carla_get_midi_port_count_info(CarlaHostHandle handle, uint pluginId);

/*!
* Get parameter count information from a plugin.
* @param pluginId Plugin
*/
CARLA_EXPORT const CarlaPortCountInfo* carla_get_parameter_count_info(uint pluginId);
CARLA_EXPORT const CarlaPortCountInfo* carla_get_parameter_count_info(CarlaHostHandle handle, uint pluginId);

/*!
* Get parameter information from a plugin.
@@ -696,7 +709,9 @@ CARLA_EXPORT const CarlaPortCountInfo* carla_get_parameter_count_info(uint plugi
* @param parameterId Parameter index
* @see carla_get_parameter_count()
*/
CARLA_EXPORT const CarlaParameterInfo* carla_get_parameter_info(uint pluginId, uint32_t parameterId);
CARLA_EXPORT const CarlaParameterInfo* carla_get_parameter_info(CarlaHostHandle handle,
uint pluginId,
uint32_t parameterId);

/*!
* Get parameter scale point information from a plugin.
@@ -705,7 +720,10 @@ CARLA_EXPORT const CarlaParameterInfo* carla_get_parameter_info(uint pluginId, u
* @param scalePointId Parameter scale-point index
* @see CarlaParameterInfo::scalePointCount
*/
CARLA_EXPORT const CarlaScalePointInfo* carla_get_parameter_scalepoint_info(uint pluginId, uint32_t parameterId, uint32_t scalePointId);
CARLA_EXPORT const CarlaScalePointInfo* carla_get_parameter_scalepoint_info(CarlaHostHandle handle,
uint pluginId,
uint32_t parameterId,
uint32_t scalePointId);

/*!
* Get a plugin's parameter data.
@@ -713,7 +731,9 @@ CARLA_EXPORT const CarlaScalePointInfo* carla_get_parameter_scalepoint_info(uint
* @param parameterId Parameter index
* @see carla_get_parameter_count()
*/
CARLA_EXPORT const ParameterData* carla_get_parameter_data(uint pluginId, uint32_t parameterId);
CARLA_EXPORT const ParameterData* carla_get_parameter_data(CarlaHostHandle handle,
uint pluginId,
uint32_t parameterId);

/*!
* Get a plugin's parameter ranges.
@@ -721,7 +741,9 @@ CARLA_EXPORT const ParameterData* carla_get_parameter_data(uint pluginId, uint32
* @param parameterId Parameter index
* @see carla_get_parameter_count()
*/
CARLA_EXPORT const ParameterRanges* carla_get_parameter_ranges(uint pluginId, uint32_t parameterId);
CARLA_EXPORT const ParameterRanges* carla_get_parameter_ranges(CarlaHostHandle handle,
uint pluginId,
uint32_t parameterId);

/*!
* Get a plugin's MIDI program data.
@@ -729,7 +751,9 @@ CARLA_EXPORT const ParameterRanges* carla_get_parameter_ranges(uint pluginId, ui
* @param midiProgramId MIDI Program index
* @see carla_get_midi_program_count()
*/
CARLA_EXPORT const MidiProgramData* carla_get_midi_program_data(uint pluginId, uint32_t midiProgramId);
CARLA_EXPORT const MidiProgramData* carla_get_midi_program_data(CarlaHostHandle handle,
uint pluginId,
uint32_t midiProgramId);

/*!
* Get a plugin's custom data, using index.
@@ -737,7 +761,7 @@ CARLA_EXPORT const MidiProgramData* carla_get_midi_program_data(uint pluginId, u
* @param customDataId Custom data index
* @see carla_get_custom_data_count()
*/
CARLA_EXPORT const CustomData* carla_get_custom_data(uint pluginId, uint32_t customDataId);
CARLA_EXPORT const CustomData* carla_get_custom_data(CarlaHostHandle handle, uint pluginId, uint32_t customDataId);

/*!
* Get a plugin's custom data value, using type and key.
@@ -746,41 +770,44 @@ CARLA_EXPORT const CustomData* carla_get_custom_data(uint pluginId, uint32_t cus
* @param key Custom data key
* @see carla_get_custom_data_count()
*/
CARLA_EXPORT const char* carla_get_custom_data_value(uint pluginId, const char* type, const char* key);
CARLA_EXPORT const char* carla_get_custom_data_value(CarlaHostHandle handle,
uint pluginId,
const char* type,
const char* key);

/*!
* Get a plugin's chunk data.
* @param pluginId Plugin
* @see PLUGIN_OPTION_USE_CHUNKS and carla_set_chunk_data()
*/
CARLA_EXPORT const char* carla_get_chunk_data(uint pluginId);
CARLA_EXPORT const char* carla_get_chunk_data(CarlaHostHandle handle, uint pluginId);

/*!
* Get how many parameters a plugin has.
* @param pluginId Plugin
*/
CARLA_EXPORT uint32_t carla_get_parameter_count(uint pluginId);
CARLA_EXPORT uint32_t carla_get_parameter_count(CarlaHostHandle handle, uint pluginId);

/*!
* Get how many programs a plugin has.
* @param pluginId Plugin
* @see carla_get_program_name()
*/
CARLA_EXPORT uint32_t carla_get_program_count(uint pluginId);
CARLA_EXPORT uint32_t carla_get_program_count(CarlaHostHandle handle, uint pluginId);

/*!
* Get how many MIDI programs a plugin has.
* @param pluginId Plugin
* @see carla_get_midi_program_name() and carla_get_midi_program_data()
*/
CARLA_EXPORT uint32_t carla_get_midi_program_count(uint pluginId);
CARLA_EXPORT uint32_t carla_get_midi_program_count(CarlaHostHandle handle, uint pluginId);

/*!
* Get how many custom data sets a plugin has.
* @param pluginId Plugin
* @see carla_get_custom_data()
*/
CARLA_EXPORT uint32_t carla_get_custom_data_count(uint pluginId);
CARLA_EXPORT uint32_t carla_get_custom_data_count(CarlaHostHandle handle, uint pluginId);

/*!
* Get a plugin's parameter text (custom display of internal values).
@@ -788,7 +815,7 @@ CARLA_EXPORT uint32_t carla_get_custom_data_count(uint pluginId);
* @param parameterId Parameter index
* @see PARAMETER_USES_CUSTOM_TEXT
*/
CARLA_EXPORT const char* carla_get_parameter_text(uint pluginId, uint32_t parameterId);
CARLA_EXPORT const char* carla_get_parameter_text(CarlaHostHandle handle, uint pluginId, uint32_t parameterId);

/*!
* Get a plugin's program name.
@@ -796,7 +823,7 @@ CARLA_EXPORT const char* carla_get_parameter_text(uint pluginId, uint32_t parame
* @param programId Program index
* @see carla_get_program_count()
*/
CARLA_EXPORT const char* carla_get_program_name(uint pluginId, uint32_t programId);
CARLA_EXPORT const char* carla_get_program_name(CarlaHostHandle handle, uint pluginId, uint32_t programId);

/*!
* Get a plugin's MIDI program name.
@@ -804,40 +831,40 @@ CARLA_EXPORT const char* carla_get_program_name(uint pluginId, uint32_t programI
* @param midiProgramId MIDI Program index
* @see carla_get_midi_program_count()
*/
CARLA_EXPORT const char* carla_get_midi_program_name(uint pluginId, uint32_t midiProgramId);
CARLA_EXPORT const char* carla_get_midi_program_name(CarlaHostHandle handle, uint pluginId, uint32_t midiProgramId);

/*!
* Get a plugin's real name.
* This is the name the plugin uses to identify itself; may not be unique.
* @param pluginId Plugin
*/
CARLA_EXPORT const char* carla_get_real_plugin_name(uint pluginId);
CARLA_EXPORT const char* carla_get_real_plugin_name(CarlaHostHandle handle, uint pluginId);

/*!
* Get a plugin's program index.
* @param pluginId Plugin
*/
CARLA_EXPORT int32_t carla_get_current_program_index(uint pluginId);
CARLA_EXPORT int32_t carla_get_current_program_index(CarlaHostHandle handle, uint pluginId);

/*!
* Get a plugin's midi program index.
* @param pluginId Plugin
*/
CARLA_EXPORT int32_t carla_get_current_midi_program_index(uint pluginId);
CARLA_EXPORT int32_t carla_get_current_midi_program_index(CarlaHostHandle handle, uint pluginId);

/*!
* Get a plugin's default parameter value.
* @param pluginId Plugin
* @param parameterId Parameter index
*/
CARLA_EXPORT float carla_get_default_parameter_value(uint pluginId, uint32_t parameterId);
CARLA_EXPORT float carla_get_default_parameter_value(CarlaHostHandle handle, uint pluginId, uint32_t parameterId);

/*!
* Get a plugin's current parameter value.
* @param pluginId Plugin
* @param parameterId Parameter index
*/
CARLA_EXPORT float carla_get_current_parameter_value(uint pluginId, uint32_t parameterId);
CARLA_EXPORT float carla_get_current_parameter_value(CarlaHostHandle handle, uint pluginId, uint32_t parameterId);

/*!
* Get a plugin's internal parameter value.
@@ -845,40 +872,43 @@ CARLA_EXPORT float carla_get_current_parameter_value(uint pluginId, uint32_t par
* @param parameterId Parameter index, maybe be negative
* @see InternalParameterIndex
*/
CARLA_EXPORT float carla_get_internal_parameter_value(uint pluginId, int32_t parameterId);
CARLA_EXPORT float carla_get_internal_parameter_value(CarlaHostHandle handle, uint pluginId, int32_t parameterId);

/*!
* Get a plugin's peak values.
* @param pluginId Plugin
*/
CARLA_EXPORT const float* carla_get_peak_values(uint pluginId);
CARLA_EXPORT const float* carla_get_peak_values(CarlaHostHandle handle, uint pluginId);

/*!
* Get a plugin's input peak value.
* @param pluginId Plugin
* @param isLeft Wherever to get the left/mono value, otherwise right.
*/
CARLA_EXPORT float carla_get_input_peak_value(uint pluginId, bool isLeft);
CARLA_EXPORT float carla_get_input_peak_value(CarlaHostHandle handle, uint pluginId, bool isLeft);

/*!
* Get a plugin's output peak value.
* @param pluginId Plugin
* @param isLeft Wherever to get the left/mono value, otherwise right.
*/
CARLA_EXPORT float carla_get_output_peak_value(uint pluginId, bool isLeft);
CARLA_EXPORT float carla_get_output_peak_value(CarlaHostHandle handle, uint pluginId, bool isLeft);

/*!
* Render a plugin's inline display.
* @param pluginId Plugin
*/
CARLA_EXPORT const CarlaInlineDisplayImageSurface* carla_render_inline_display(uint pluginId, uint32_t width, uint32_t height);
CARLA_EXPORT const CarlaInlineDisplayImageSurface* carla_render_inline_display(CarlaHostHandle handle,
uint pluginId,
uint32_t width,
uint32_t height);

/*!
* Enable or disable a plugin.
* @param pluginId Plugin
* @param onOff New active state
*/
CARLA_EXPORT void carla_set_active(uint pluginId, bool onOff);
CARLA_EXPORT void carla_set_active(CarlaHostHandle handle, uint pluginId, bool onOff);

#ifndef BUILD_BRIDGE
/*!
@@ -886,42 +916,42 @@ CARLA_EXPORT void carla_set_active(uint pluginId, bool onOff);
* @param pluginId Plugin
* @param value New dry/wet value
*/
CARLA_EXPORT void carla_set_drywet(uint pluginId, float value);
CARLA_EXPORT void carla_set_drywet(CarlaHostHandle handle, uint pluginId, float value);

/*!
* Change a plugin's internal volume.
* @param pluginId Plugin
* @param value New volume
*/
CARLA_EXPORT void carla_set_volume(uint pluginId, float value);
CARLA_EXPORT void carla_set_volume(CarlaHostHandle handle, uint pluginId, float value);

/*!
* Change a plugin's internal stereo balance, left channel.
* @param pluginId Plugin
* @param value New value
*/
CARLA_EXPORT void carla_set_balance_left(uint pluginId, float value);
CARLA_EXPORT void carla_set_balance_left(CarlaHostHandle handle, uint pluginId, float value);

/*!
* Change a plugin's internal stereo balance, right channel.
* @param pluginId Plugin
* @param value New value
*/
CARLA_EXPORT void carla_set_balance_right(uint pluginId, float value);
CARLA_EXPORT void carla_set_balance_right(CarlaHostHandle handle, uint pluginId, float value);

/*!
* Change a plugin's internal mono panning value.
* @param pluginId Plugin
* @param value New value
*/
CARLA_EXPORT void carla_set_panning(uint pluginId, float value);
CARLA_EXPORT void carla_set_panning(CarlaHostHandle handle, uint pluginId, float value);

/*!
* Change a plugin's internal control channel.
* @param pluginId Plugin
* @param channel New channel
*/
CARLA_EXPORT void carla_set_ctrl_channel(uint pluginId, int8_t channel);
CARLA_EXPORT void carla_set_ctrl_channel(CarlaHostHandle handle, uint pluginId, int8_t channel);
#endif

/*!
@@ -930,7 +960,7 @@ CARLA_EXPORT void carla_set_ctrl_channel(uint pluginId, int8_t channel);
* @param option An option from PluginOptions
* @param yesNo New enabled state
*/
CARLA_EXPORT void carla_set_option(uint pluginId, uint option, bool yesNo);
CARLA_EXPORT void carla_set_option(CarlaHostHandle handle, uint pluginId, uint option, bool yesNo);

/*!
* Change a plugin's parameter value.
@@ -938,7 +968,7 @@ CARLA_EXPORT void carla_set_option(uint pluginId, uint option, bool yesNo);
* @param parameterId Parameter index
* @param value New value
*/
CARLA_EXPORT void carla_set_parameter_value(uint pluginId, uint32_t parameterId, float value);
CARLA_EXPORT void carla_set_parameter_value(CarlaHostHandle handle, uint pluginId, uint32_t parameterId, float value);

#ifndef BUILD_BRIDGE
/*!
@@ -947,7 +977,10 @@ CARLA_EXPORT void carla_set_parameter_value(uint pluginId, uint32_t parameterId,
* @param parameterId Parameter index
* @param channel New MIDI channel
*/
CARLA_EXPORT void carla_set_parameter_midi_channel(uint pluginId, uint32_t parameterId, uint8_t channel);
CARLA_EXPORT void carla_set_parameter_midi_channel(CarlaHostHandle handle,
uint pluginId,
uint32_t parameterId,
uint8_t channel);

/*!
* Change a plugin's parameter mapped control index.
@@ -955,7 +988,10 @@ CARLA_EXPORT void carla_set_parameter_midi_channel(uint pluginId, uint32_t param
* @param parameterId Parameter index
* @param cc New control index
*/
CARLA_EXPORT void carla_set_parameter_mapped_control_index(uint pluginId, uint32_t parameterId, int16_t index);
CARLA_EXPORT void carla_set_parameter_mapped_control_index(CarlaHostHandle handle,
uint pluginId,
uint32_t parameterId,
int16_t index);

/*!
* Change a plugin's parameter mapped range.
@@ -964,7 +1000,10 @@ CARLA_EXPORT void carla_set_parameter_mapped_control_index(uint pluginId, uint32
* @param minimum New mapped minimum
* @param maximum New mapped maximum
*/
CARLA_EXPORT void carla_set_parameter_mapped_range(uint pluginId, uint32_t parameterId, float minimum, float maximum);
CARLA_EXPORT void carla_set_parameter_mapped_range(CarlaHostHandle handle,
uint pluginId,
uint32_t parameterId,
float minimum, float maximum);

/*!
* Change a plugin's parameter in drag/touch mode state.
@@ -973,7 +1012,10 @@ CARLA_EXPORT void carla_set_parameter_mapped_range(uint pluginId, uint32_t param
* @param parameterId Parameter index
* @param touch New state
*/
CARLA_EXPORT void carla_set_parameter_touch(uint pluginId, uint32_t parameterId, bool touch);
CARLA_EXPORT void carla_set_parameter_touch(CarlaHostHandle handle,
uint pluginId,
uint32_t parameterId,
bool touch);
#endif

/*!
@@ -981,14 +1023,14 @@ CARLA_EXPORT void carla_set_parameter_touch(uint pluginId, uint32_t parameterId,
* @param pluginId Plugin
* @param programId New program
*/
CARLA_EXPORT void carla_set_program(uint pluginId, uint32_t programId);
CARLA_EXPORT void carla_set_program(CarlaHostHandle handle, uint pluginId, uint32_t programId);

/*!
* Change a plugin's current MIDI program.
* @param pluginId Plugin
* @param midiProgramId New value
*/
CARLA_EXPORT void carla_set_midi_program(uint pluginId, uint32_t midiProgramId);
CARLA_EXPORT void carla_set_midi_program(CarlaHostHandle handle, uint pluginId, uint32_t midiProgramId);

/*!
* Set a plugin's custom data set.
@@ -998,7 +1040,9 @@ CARLA_EXPORT void carla_set_midi_program(uint pluginId, uint32_t midiProgramId);
* @param value New value
* @see CustomDataTypes and CustomDataKeys
*/
CARLA_EXPORT void carla_set_custom_data(uint pluginId, const char* type, const char* key, const char* value);
CARLA_EXPORT void carla_set_custom_data(CarlaHostHandle handle,
uint pluginId,
const char* type, const char* key, const char* value);

/*!
* Set a plugin's chunk data.
@@ -1006,26 +1050,26 @@ CARLA_EXPORT void carla_set_custom_data(uint pluginId, const char* type, const c
* @param chunkData New chunk data
* @see PLUGIN_OPTION_USE_CHUNKS and carla_get_chunk_data()
*/
CARLA_EXPORT void carla_set_chunk_data(uint pluginId, const char* chunkData);
CARLA_EXPORT void carla_set_chunk_data(CarlaHostHandle handle, uint pluginId, const char* chunkData);

/*!
* Tell a plugin to prepare for save.
* This should be called before saving custom data sets.
* @param pluginId Plugin
*/
CARLA_EXPORT void carla_prepare_for_save(uint pluginId);
CARLA_EXPORT void carla_prepare_for_save(CarlaHostHandle handle, uint pluginId);

/*!
* Reset all plugin's parameters.
* @param pluginId Plugin
*/
CARLA_EXPORT void carla_reset_parameters(uint pluginId);
CARLA_EXPORT void carla_reset_parameters(CarlaHostHandle handle, uint pluginId);

/*!
* Randomize all plugin's parameters.
* @param pluginId Plugin
*/
CARLA_EXPORT void carla_randomize_parameters(uint pluginId);
CARLA_EXPORT void carla_randomize_parameters(CarlaHostHandle handle, uint pluginId);

#ifndef BUILD_BRIDGE
/*!
@@ -1036,7 +1080,9 @@ CARLA_EXPORT void carla_randomize_parameters(uint pluginId);
* @param note Note pitch
* @param velocity Note velocity
*/
CARLA_EXPORT void carla_send_midi_note(uint pluginId, uint8_t channel, uint8_t note, uint8_t velocity);
CARLA_EXPORT void carla_send_midi_note(CarlaHostHandle handle,
uint pluginId,
uint8_t channel, uint8_t note, uint8_t velocity);
#endif

/*!
@@ -1045,32 +1091,32 @@ CARLA_EXPORT void carla_send_midi_note(uint pluginId, uint8_t channel, uint8_t n
* @param yesNo New UI state, visible or not
* @see PLUGIN_HAS_CUSTOM_UI
*/
CARLA_EXPORT void carla_show_custom_ui(uint pluginId, bool yesNo);
CARLA_EXPORT void carla_show_custom_ui(CarlaHostHandle handle, uint pluginId, bool yesNo);

/*!
* Get the current engine buffer size.
*/
CARLA_EXPORT uint32_t carla_get_buffer_size(void);
CARLA_EXPORT uint32_t carla_get_buffer_size(CarlaHostHandle handle);

/*!
* Get the current engine sample rate.
*/
CARLA_EXPORT double carla_get_sample_rate(void);
CARLA_EXPORT double carla_get_sample_rate(CarlaHostHandle handle);

/*!
* Get the last error.
*/
CARLA_EXPORT const char* carla_get_last_error(void);
CARLA_EXPORT const char* carla_get_last_error(CarlaHostHandle handle);

/*!
* Get the current engine OSC URL (TCP).
*/
CARLA_EXPORT const char* carla_get_host_osc_url_tcp(void);
CARLA_EXPORT const char* carla_get_host_osc_url_tcp(CarlaHostHandle handle);

/*!
* Get the current engine OSC URL (UDP).
*/
CARLA_EXPORT const char* carla_get_host_osc_url_udp(void);
CARLA_EXPORT const char* carla_get_host_osc_url_udp(CarlaHostHandle handle);

/*!
* Get the absolute filename of this carla library.
@@ -1087,12 +1133,12 @@ CARLA_EXPORT const char* carla_get_library_folder(void);
* Must be called as early as possible in the program's lifecycle.
* Returns true if NSM is available and initialized correctly.
*/
CARLA_EXPORT bool carla_nsm_init(uint64_t pid, const char* executableName);
CARLA_EXPORT bool carla_nsm_init(CarlaHostHandle handle, uint64_t pid, const char* executableName);

/*!
* Respond to an NSM callback.
*/
CARLA_EXPORT void carla_nsm_ready(NsmCallbackOpcode opcode);
CARLA_EXPORT void carla_nsm_ready(CarlaHostHandle handle, NsmCallbackOpcode opcode);

/** @} */



+ 94
- 0
source/backend/CarlaHostImpl.hpp View File

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

#ifndef CARLA_HOST_IMPL_HPP_INCLUDED
#define CARLA_HOST_IMPL_HPP_INCLUDED

#include "CarlaHost.h"
#include "CarlaEngine.hpp"

#ifdef BUILD_BRIDGE
# include "CarlaString.hpp"
#else
# include "CarlaLogThread.hpp"
#endif

namespace CB = CarlaBackend;
using CB::EngineOptions;

// --------------------------------------------------------------------------------------------------------------------
// Shared code, WIP

typedef struct _CarlaHostHandle {
// required pointers
CarlaEngine* engine;

// flags
bool isStandalone : 1;
bool isPlugin : 1;

_CarlaHostHandle() noexcept
: engine(nullptr),
isStandalone(false),
isPlugin(false) {}
} CarlaHostHandleImpl;

// --------------------------------------------------------------------------------------------------------------------
// Single, standalone engine

struct CarlaHostStandalone : CarlaHostHandleImpl {
EngineCallbackFunc engineCallback;
void* engineCallbackPtr;
FileCallbackFunc fileCallback;
void* fileCallbackPtr;

#ifndef BUILD_BRIDGE
EngineOptions engineOptions;
CarlaLogThread logThread;
bool logThreadEnabled;
#endif

CarlaString lastError;

CarlaHostStandalone() noexcept
: CarlaHostHandleImpl(),
engineCallback(nullptr),
engineCallbackPtr(nullptr),
fileCallback(nullptr),
fileCallbackPtr(nullptr),
#ifndef BUILD_BRIDGE
engineOptions(),
logThread(),
logThreadEnabled(false),
#endif
lastError()
{
isStandalone = true;
}

~CarlaHostStandalone() noexcept
{
CARLA_SAFE_ASSERT(engine == nullptr);
}

CARLA_PREVENT_HEAP_ALLOCATION
CARLA_DECLARE_NON_COPY_STRUCT(CarlaHostStandalone)
};

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

#endif // CARLA_HOST_IMPL_HPP_INCLUDED

+ 751
- 755
source/backend/CarlaStandalone.cpp
File diff suppressed because it is too large
View File


+ 26
- 28
source/backend/CarlaStandaloneNSM.cpp View File

@@ -1,6 +1,6 @@
/*
* Carla Standalone
* Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2020 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
@@ -15,7 +15,7 @@
* For a full copy of the GNU General Public License see the doc/GPL.txt file.
*/

#include "CarlaHost.h"
#include "CarlaHostImpl.hpp"

#ifdef HAVE_LIBLO

@@ -30,26 +30,14 @@

#include "water/files/File.h"

namespace CB = CarlaBackend;

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

struct CarlaBackendStandalone {
CarlaEngine* engine;
EngineCallbackFunc engineCallback;
void* engineCallbackPtr;
// ...
};

extern CarlaBackendStandalone gStandalone;

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

class CarlaNSM
{
public:
CarlaNSM() noexcept
: fReplyAddress(nullptr),
CarlaNSM(CarlaHostStandalone& shandle) noexcept
: gStandalone(shandle),
fReplyAddress(nullptr),
fServer(nullptr),
fServerThread(nullptr),
fServerURL(nullptr),
@@ -194,9 +182,9 @@ public:
}
}

static CarlaNSM& getInstance()
static CarlaNSM& getInstance(CarlaHostStandalone& shandle)
{
static CarlaNSM sInstance;
static CarlaNSM sInstance(shandle);
return sInstance;
}

@@ -305,10 +293,12 @@ protected:
{
using namespace water;

if (carla_is_engine_running())
carla_engine_close();
const CarlaHostHandle handle = (CarlaHostHandle)&gStandalone;

carla_engine_init("JACK", clientNameId);
if (carla_is_engine_running(handle))
carla_engine_close(handle);

carla_engine_init(handle, "JACK", clientNameId);

fProjectPath = projectPath;
fProjectPath += ".carxp";
@@ -316,7 +306,7 @@ protected:
const String jfilename = String(CharPointer_UTF8(fProjectPath));

if (File(jfilename).existsAsFile())
carla_load_project(fProjectPath);
carla_load_project(handle, fProjectPath);
}

fClientNameId = clientNameId;
@@ -360,7 +350,9 @@ protected:
{
CARLA_SAFE_ASSERT_RETURN(fProjectPath.isNotEmpty(), 0);

carla_save_project(fProjectPath);
const CarlaHostHandle handle = (CarlaHostHandle)&gStandalone;

carla_save_project(handle, fProjectPath);
}

lo_send_from(fReplyAddress, fServer, LO_TT_IMMEDIATE, "/reply", "ss", "/nsm/client/save", "OK");
@@ -532,6 +524,8 @@ protected:
}

private:
CarlaHostStandalone& gStandalone;

lo_address fReplyAddress;
lo_server fServer;
lo_server_thread fServerThread;
@@ -635,10 +629,12 @@ private:

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

bool carla_nsm_init(uint64_t pid, const char* executableName)
bool carla_nsm_init(CarlaHostHandle handle, uint64_t pid, const char* executableName)
{
CARLA_SAFE_ASSERT_RETURN(handle->isStandalone, false);

#ifdef HAVE_LIBLO
return CarlaNSM::getInstance().announce(pid, executableName);
return CarlaNSM::getInstance(*(CarlaHostStandalone*)handle).announce(pid, executableName);
#else
return false;

@@ -647,10 +643,12 @@ bool carla_nsm_init(uint64_t pid, const char* executableName)
#endif
}

void carla_nsm_ready(NsmCallbackOpcode action)
void carla_nsm_ready(CarlaHostHandle handle, NsmCallbackOpcode action)
{
CARLA_SAFE_ASSERT_RETURN(handle->isStandalone,);

#ifdef HAVE_LIBLO
CarlaNSM::getInstance().ready(action);
CarlaNSM::getInstance(*(CarlaHostStandalone*)handle).ready(action);
#else
// unused
return; (void)action;


+ 26
- 20
source/bridges-plugin/CarlaBridgePlugin.cpp View File

@@ -1,6 +1,6 @@
/*
* Carla Bridge Plugin
* Copyright (C) 2012-2019 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2020 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
@@ -129,10 +129,11 @@ static void initSignalHandler()
// -------------------------------------------------------------------------

static String gProjectFilename;
static CarlaHostHandle gHostHandle;

static void gIdle()
{
carla_engine_idle();
carla_engine_idle(gHostHandle);

if (gSaveNow)
{
@@ -140,8 +141,8 @@ static void gIdle()

if (gProjectFilename.isNotEmpty())
{
if (! carla_save_plugin_state(0, gProjectFilename.toRawUTF8()))
carla_stderr("Plugin preset save failed, error was:\n%s", carla_get_last_error());
if (! carla_save_plugin_state(gHostHandle, 0, gProjectFilename.toRawUTF8()))
carla_stderr("Plugin preset save failed, error was:\n%s", carla_get_last_error(gHostHandle));
}
}
}
@@ -210,11 +211,12 @@ public:
carla_debug("CarlaBridgePlugin::CarlaBridgePlugin(%s, \"%s\", %s, %s, %s, %s)",
bool2str(useBridge), clientName, audioPoolBaseName, rtClientBaseName, nonRtClientBaseName, nonRtServerBaseName);

carla_set_engine_callback(callback, this);
carla_set_engine_callback(gHostHandle, callback, this);

if (useBridge)
{
carla_engine_init_bridge(audioPoolBaseName,
carla_engine_init_bridge(gHostHandle,
audioPoolBaseName,
rtClientBaseName,
nonRtClientBaseName,
nonRtServerBaseName,
@@ -222,14 +224,14 @@ public:
}
else if (std::getenv("CARLA_BRIDGE_DUMMY") != nullptr)
{
carla_engine_init("Dummy", clientName);
carla_engine_init(gHostHandle, "Dummy", clientName);
}
else
{
carla_engine_init("JACK", clientName);
carla_engine_init(gHostHandle, "JACK", clientName);
}

fEngine = carla_get_engine();
fEngine = carla_get_engine_from_handle(gHostHandle);
}

~CarlaBridgePlugin()
@@ -237,7 +239,7 @@ public:
carla_debug("CarlaBridgePlugin::~CarlaBridgePlugin()");

if (! fUsingExec)
carla_engine_close();
carla_engine_close(gHostHandle);
}

bool isOk() const noexcept
@@ -254,7 +256,7 @@ public:

if (! useBridge)
{
const CarlaPluginInfo* const pInfo(carla_get_plugin_info(0));
const CarlaPluginInfo* const pInfo = carla_get_plugin_info(gHostHandle, 0);
CARLA_SAFE_ASSERT_RETURN(pInfo != nullptr,);

gProjectFilename = CharPointer_UTF8(pInfo->name);
@@ -265,10 +267,10 @@ public:

if (File(gProjectFilename).existsAsFile())
{
if (carla_load_plugin_state(0, gProjectFilename.toRawUTF8()))
if (carla_load_plugin_state(gHostHandle, 0, gProjectFilename.toRawUTF8()))
carla_stdout("Plugin state loaded successfully");
else
carla_stderr("Plugin state load failed, error was:\n%s", carla_get_last_error());
carla_stderr("Plugin state load failed, error was:\n%s", carla_get_last_error(gHostHandle));
}
else
{
@@ -299,7 +301,7 @@ public:
}
#endif

carla_engine_close();
carla_engine_close(gHostHandle);
}

// ---------------------------------------------------------------------
@@ -621,34 +623,38 @@ int main(int argc, char* argv[])
int ret;

{
gHostHandle = carla_standalone_host_init();

CarlaBridgePlugin bridge(useBridge, clientName,
audioPoolBaseName, rtClientBaseName, nonRtClientBaseName, nonRtServerBaseName);

if (! bridge.isOk())
{
carla_stderr("Failed to init engine, error was:\n%s", carla_get_last_error());
carla_stderr("Failed to init engine, error was:\n%s", carla_get_last_error(gHostHandle));
return 1;
}

// -----------------------------------------------------------------
// Init plugin

if (carla_add_plugin(btype, itype, file.getFullPathName().toRawUTF8(), name, label, uniqueId, extraStuff, 0x0))
if (carla_add_plugin(gHostHandle,
btype, itype,
file.getFullPathName().toRawUTF8(), name, label, uniqueId, extraStuff, 0x0))
{
ret = 0;

if (! useBridge)
{
carla_set_active(0, true);
carla_set_active(gHostHandle, 0, true);

if (const CarlaPluginInfo* const pluginInfo = carla_get_plugin_info(0))
if (const CarlaPluginInfo* const pluginInfo = carla_get_plugin_info(gHostHandle, 0))
{
if (pluginInfo->hints & CarlaBackend::PLUGIN_HAS_CUSTOM_UI)
{
#ifdef HAVE_X11
if (std::getenv("DISPLAY") != nullptr)
#endif
carla_show_custom_ui(0, true);
carla_show_custom_ui(gHostHandle, 0, true);
}
}
}
@@ -659,7 +665,7 @@ int main(int argc, char* argv[])
{
ret = 1;

const char* const lastError(carla_get_last_error());
const char* const lastError(carla_get_last_error(gHostHandle));
carla_stderr("Plugin failed to load, error was:\n%s", lastError);

if (useBridge)


+ 204
- 199
source/frontend/carla_backend.py View File

@@ -19,7 +19,7 @@
# ------------------------------------------------------------------------------------------------------------
# Imports (Global)

from abc import ABCMeta, abstractmethod
from abc import abstractmethod
from ctypes import *
from platform import architecture
from sys import platform, maxsize
@@ -1483,7 +1483,6 @@ else:
# Carla Host object (Meta)

class CarlaHostMeta(object):
#class CarlaHostMeta(object, metaclass=ABCMeta):
def __init__(self):
object.__init__(self)

@@ -2550,306 +2549,311 @@ class CarlaHostDLL(CarlaHostMeta):
self.lib.carla_get_engine_driver_count.argtypes = None
self.lib.carla_get_engine_driver_count.restype = c_uint

self.lib.carla_get_engine_driver_name.argtypes = [c_uint]
self.lib.carla_get_engine_driver_name.argtypes = (c_uint,)
self.lib.carla_get_engine_driver_name.restype = c_char_p

self.lib.carla_get_engine_driver_device_names.argtypes = [c_uint]
self.lib.carla_get_engine_driver_device_names.argtypes = (c_uint,)
self.lib.carla_get_engine_driver_device_names.restype = POINTER(c_char_p)

self.lib.carla_get_engine_driver_device_info.argtypes = [c_uint, c_char_p]
self.lib.carla_get_engine_driver_device_info.argtypes = (c_uint, c_char_p)
self.lib.carla_get_engine_driver_device_info.restype = POINTER(EngineDriverDeviceInfo)

self.lib.carla_show_engine_driver_device_control_panel.argtypes = [c_uint, c_char_p]
self.lib.carla_show_engine_driver_device_control_panel.argtypes = (c_uint, c_char_p)
self.lib.carla_show_engine_driver_device_control_panel.restype = c_bool

self.lib.carla_engine_init.argtypes = [c_char_p, c_char_p]
self.lib.carla_standalone_host_init.argtypes = None
self.lib.carla_standalone_host_init.restype = c_void_p

self.lib.carla_engine_init.argtypes = (c_void_p, c_char_p, c_char_p)
self.lib.carla_engine_init.restype = c_bool

self.lib.carla_engine_close.argtypes = None
self.lib.carla_engine_close.argtypes = (c_void_p,)
self.lib.carla_engine_close.restype = c_bool

self.lib.carla_engine_idle.argtypes = None
self.lib.carla_engine_idle.argtypes = (c_void_p,)
self.lib.carla_engine_idle.restype = None

self.lib.carla_is_engine_running.argtypes = None
self.lib.carla_is_engine_running.argtypes = (c_void_p,)
self.lib.carla_is_engine_running.restype = c_bool

self.lib.carla_get_runtime_engine_info.argtypes = None
self.lib.carla_get_runtime_engine_info.argtypes = (c_void_p,)
self.lib.carla_get_runtime_engine_info.restype = POINTER(CarlaRuntimeEngineInfo)

self.lib.carla_get_runtime_engine_driver_device_info.argtypes = None
self.lib.carla_get_runtime_engine_driver_device_info.argtypes = (c_void_p,)
self.lib.carla_get_runtime_engine_driver_device_info.restype = POINTER(CarlaRuntimeEngineDriverDeviceInfo)

self.lib.carla_set_engine_buffer_size_and_sample_rate.argtypes = [c_uint, c_double]
self.lib.carla_set_engine_buffer_size_and_sample_rate.argtypes = (c_void_p, c_uint, c_double)
self.lib.carla_set_engine_buffer_size_and_sample_rate.restype = c_bool

self.lib.carla_show_engine_device_control_panel.argtypes = None
self.lib.carla_show_engine_device_control_panel.argtypes = (c_void_p,)
self.lib.carla_show_engine_device_control_panel.restype = c_bool

self.lib.carla_clear_engine_xruns.argtypes = None
self.lib.carla_clear_engine_xruns.argtypes = (c_void_p,)
self.lib.carla_clear_engine_xruns.restype = None

self.lib.carla_cancel_engine_action.argtypes = None
self.lib.carla_cancel_engine_action.argtypes = (c_void_p,)
self.lib.carla_cancel_engine_action.restype = None

self.lib.carla_set_engine_about_to_close.argtypes = None
self.lib.carla_set_engine_about_to_close.argtypes = (c_void_p,)
self.lib.carla_set_engine_about_to_close.restype = c_bool

self.lib.carla_set_engine_callback.argtypes = [EngineCallbackFunc, c_void_p]
self.lib.carla_set_engine_callback.argtypes = (c_void_p, EngineCallbackFunc, c_void_p)
self.lib.carla_set_engine_callback.restype = None

self.lib.carla_set_engine_option.argtypes = [c_enum, c_int, c_char_p]
self.lib.carla_set_engine_option.argtypes = (c_void_p, c_enum, c_int, c_char_p)
self.lib.carla_set_engine_option.restype = None

self.lib.carla_set_file_callback.argtypes = [FileCallbackFunc, c_void_p]
self.lib.carla_set_file_callback.argtypes = (c_void_p, FileCallbackFunc, c_void_p)
self.lib.carla_set_file_callback.restype = None

self.lib.carla_load_file.argtypes = [c_char_p]
self.lib.carla_load_file.argtypes = (c_void_p, c_char_p)
self.lib.carla_load_file.restype = c_bool

self.lib.carla_load_project.argtypes = [c_char_p]
self.lib.carla_load_project.argtypes = (c_void_p, c_char_p)
self.lib.carla_load_project.restype = c_bool

self.lib.carla_save_project.argtypes = [c_char_p]
self.lib.carla_save_project.argtypes = (c_void_p, c_char_p)
self.lib.carla_save_project.restype = c_bool

self.lib.carla_clear_project_filename.argtypes = None
self.lib.carla_clear_project_filename.argtypes = (c_void_p,)
self.lib.carla_clear_project_filename.restype = None

self.lib.carla_patchbay_connect.argtypes = [c_bool, c_uint, c_uint, c_uint, c_uint]
self.lib.carla_patchbay_connect.argtypes = (c_void_p, c_bool, c_uint, c_uint, c_uint, c_uint)
self.lib.carla_patchbay_connect.restype = c_bool

self.lib.carla_patchbay_disconnect.argtypes = [c_bool, c_uint]
self.lib.carla_patchbay_disconnect.argtypes = (c_void_p, c_bool, c_uint)
self.lib.carla_patchbay_disconnect.restype = c_bool

self.lib.carla_patchbay_refresh.argtypes = [c_bool]
self.lib.carla_patchbay_refresh.argtypes = (c_void_p, c_bool)
self.lib.carla_patchbay_refresh.restype = c_bool

self.lib.carla_transport_play.argtypes = None
self.lib.carla_transport_play.argtypes = (c_void_p,)
self.lib.carla_transport_play.restype = None

self.lib.carla_transport_pause.argtypes = None
self.lib.carla_transport_pause.argtypes = (c_void_p,)
self.lib.carla_transport_pause.restype = None

self.lib.carla_transport_bpm.argtypes = [c_double]
self.lib.carla_transport_bpm.argtypes = (c_void_p, c_double)
self.lib.carla_transport_bpm.restype = None

self.lib.carla_transport_relocate.argtypes = [c_uint64]
self.lib.carla_transport_relocate.argtypes = (c_void_p, c_uint64)
self.lib.carla_transport_relocate.restype = None

self.lib.carla_get_current_transport_frame.argtypes = None
self.lib.carla_get_current_transport_frame.argtypes = (c_void_p,)
self.lib.carla_get_current_transport_frame.restype = c_uint64

self.lib.carla_get_transport_info.argtypes = None
self.lib.carla_get_transport_info.argtypes = (c_void_p,)
self.lib.carla_get_transport_info.restype = POINTER(CarlaTransportInfo)

self.lib.carla_get_current_plugin_count.argtypes = None
self.lib.carla_get_current_plugin_count.argtypes = (c_void_p,)
self.lib.carla_get_current_plugin_count.restype = c_uint32

self.lib.carla_get_max_plugin_number.argtypes = None
self.lib.carla_get_max_plugin_number.argtypes = (c_void_p,)
self.lib.carla_get_max_plugin_number.restype = c_uint32

self.lib.carla_add_plugin.argtypes = [c_enum, c_enum, c_char_p, c_char_p, c_char_p, c_int64, c_void_p, c_uint]
self.lib.carla_add_plugin.argtypes = (c_void_p, c_enum, c_enum, c_char_p, c_char_p, c_char_p, c_int64, c_void_p, c_uint)
self.lib.carla_add_plugin.restype = c_bool

self.lib.carla_remove_plugin.argtypes = [c_uint]
self.lib.carla_remove_plugin.argtypes = (c_void_p, c_uint)
self.lib.carla_remove_plugin.restype = c_bool

self.lib.carla_remove_all_plugins.argtypes = None
self.lib.carla_remove_all_plugins.argtypes = (c_void_p,)
self.lib.carla_remove_all_plugins.restype = c_bool

self.lib.carla_rename_plugin.argtypes = [c_uint, c_char_p]
self.lib.carla_rename_plugin.argtypes = (c_void_p, c_uint, c_char_p)
self.lib.carla_rename_plugin.restype = c_bool

self.lib.carla_clone_plugin.argtypes = [c_uint]
self.lib.carla_clone_plugin.argtypes = (c_void_p, c_uint)
self.lib.carla_clone_plugin.restype = c_bool

self.lib.carla_replace_plugin.argtypes = [c_uint]
self.lib.carla_replace_plugin.argtypes = (c_void_p, 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.argtypes = (c_void_p, c_uint, c_uint)
self.lib.carla_switch_plugins.restype = c_bool

self.lib.carla_load_plugin_state.argtypes = [c_uint, c_char_p]
self.lib.carla_load_plugin_state.argtypes = (c_void_p, c_uint, c_char_p)
self.lib.carla_load_plugin_state.restype = c_bool

self.lib.carla_save_plugin_state.argtypes = [c_uint, c_char_p]
self.lib.carla_save_plugin_state.argtypes = (c_void_p, c_uint, c_char_p)
self.lib.carla_save_plugin_state.restype = c_bool

self.lib.carla_export_plugin_lv2.argtypes = [c_uint, c_char_p]
self.lib.carla_export_plugin_lv2.argtypes = (c_void_p, c_uint, c_char_p)
self.lib.carla_export_plugin_lv2.restype = c_bool

self.lib.carla_get_plugin_info.argtypes = [c_uint]
self.lib.carla_get_plugin_info.argtypes = (c_void_p, c_uint)
self.lib.carla_get_plugin_info.restype = POINTER(CarlaPluginInfo)

self.lib.carla_get_audio_port_count_info.argtypes = [c_uint]
self.lib.carla_get_audio_port_count_info.argtypes = (c_void_p, c_uint)
self.lib.carla_get_audio_port_count_info.restype = POINTER(CarlaPortCountInfo)

self.lib.carla_get_midi_port_count_info.argtypes = [c_uint]
self.lib.carla_get_midi_port_count_info.argtypes = (c_void_p, c_uint)
self.lib.carla_get_midi_port_count_info.restype = POINTER(CarlaPortCountInfo)

self.lib.carla_get_parameter_count_info.argtypes = [c_uint]
self.lib.carla_get_parameter_count_info.argtypes = (c_void_p, c_uint)
self.lib.carla_get_parameter_count_info.restype = POINTER(CarlaPortCountInfo)

self.lib.carla_get_parameter_info.argtypes = [c_uint, c_uint32]
self.lib.carla_get_parameter_info.argtypes = (c_void_p, c_uint, c_uint32)
self.lib.carla_get_parameter_info.restype = POINTER(CarlaParameterInfo)

self.lib.carla_get_parameter_scalepoint_info.argtypes = [c_uint, c_uint32, c_uint32]
self.lib.carla_get_parameter_scalepoint_info.argtypes = (c_void_p, c_uint, c_uint32, c_uint32)
self.lib.carla_get_parameter_scalepoint_info.restype = POINTER(CarlaScalePointInfo)

self.lib.carla_get_parameter_data.argtypes = [c_uint, c_uint32]
self.lib.carla_get_parameter_data.argtypes = (c_void_p, c_uint, c_uint32)
self.lib.carla_get_parameter_data.restype = POINTER(ParameterData)

self.lib.carla_get_parameter_ranges.argtypes = [c_uint, c_uint32]
self.lib.carla_get_parameter_ranges.argtypes = (c_void_p, c_uint, c_uint32)
self.lib.carla_get_parameter_ranges.restype = POINTER(ParameterRanges)

self.lib.carla_get_midi_program_data.argtypes = [c_uint, c_uint32]
self.lib.carla_get_midi_program_data.argtypes = (c_void_p, c_uint, c_uint32)
self.lib.carla_get_midi_program_data.restype = POINTER(MidiProgramData)

self.lib.carla_get_custom_data.argtypes = [c_uint, c_uint32]
self.lib.carla_get_custom_data.argtypes = (c_void_p, c_uint, c_uint32)
self.lib.carla_get_custom_data.restype = POINTER(CustomData)

self.lib.carla_get_custom_data_value.argtypes = [c_uint, c_char_p, c_char_p]
self.lib.carla_get_custom_data_value.argtypes = (c_void_p, c_uint, c_char_p, c_char_p)
self.lib.carla_get_custom_data_value.restype = c_char_p

self.lib.carla_get_chunk_data.argtypes = [c_uint]
self.lib.carla_get_chunk_data.argtypes = (c_void_p, c_uint)
self.lib.carla_get_chunk_data.restype = c_char_p

self.lib.carla_get_parameter_count.argtypes = [c_uint]
self.lib.carla_get_parameter_count.argtypes = (c_void_p, c_uint)
self.lib.carla_get_parameter_count.restype = c_uint32

self.lib.carla_get_program_count.argtypes = [c_uint]
self.lib.carla_get_program_count.argtypes = (c_void_p, c_uint)
self.lib.carla_get_program_count.restype = c_uint32

self.lib.carla_get_midi_program_count.argtypes = [c_uint]
self.lib.carla_get_midi_program_count.argtypes = (c_void_p, c_uint)
self.lib.carla_get_midi_program_count.restype = c_uint32

self.lib.carla_get_custom_data_count.argtypes = [c_uint]
self.lib.carla_get_custom_data_count.argtypes = (c_void_p, c_uint)
self.lib.carla_get_custom_data_count.restype = c_uint32

self.lib.carla_get_parameter_text.argtypes = [c_uint, c_uint32]
self.lib.carla_get_parameter_text.argtypes = (c_void_p, c_uint, c_uint32)
self.lib.carla_get_parameter_text.restype = c_char_p

self.lib.carla_get_program_name.argtypes = [c_uint, c_uint32]
self.lib.carla_get_program_name.argtypes = (c_void_p, c_uint, c_uint32)
self.lib.carla_get_program_name.restype = c_char_p

self.lib.carla_get_midi_program_name.argtypes = [c_uint, c_uint32]
self.lib.carla_get_midi_program_name.argtypes = (c_void_p, c_uint, c_uint32)
self.lib.carla_get_midi_program_name.restype = c_char_p

self.lib.carla_get_real_plugin_name.argtypes = [c_uint]
self.lib.carla_get_real_plugin_name.argtypes = (c_void_p, c_uint)
self.lib.carla_get_real_plugin_name.restype = c_char_p

self.lib.carla_get_current_program_index.argtypes = [c_uint]
self.lib.carla_get_current_program_index.argtypes = (c_void_p, c_uint)
self.lib.carla_get_current_program_index.restype = c_int32

self.lib.carla_get_current_midi_program_index.argtypes = [c_uint]
self.lib.carla_get_current_midi_program_index.argtypes = (c_void_p, c_uint)
self.lib.carla_get_current_midi_program_index.restype = c_int32

self.lib.carla_get_default_parameter_value.argtypes = [c_uint, c_uint32]
self.lib.carla_get_default_parameter_value.argtypes = (c_void_p, c_uint, c_uint32)
self.lib.carla_get_default_parameter_value.restype = c_float

self.lib.carla_get_current_parameter_value.argtypes = [c_uint, c_uint32]
self.lib.carla_get_current_parameter_value.argtypes = (c_void_p, c_uint, c_uint32)
self.lib.carla_get_current_parameter_value.restype = c_float

self.lib.carla_get_internal_parameter_value.argtypes = [c_uint, c_int32]
self.lib.carla_get_internal_parameter_value.argtypes = (c_void_p, c_uint, c_int32)
self.lib.carla_get_internal_parameter_value.restype = c_float

self.lib.carla_get_input_peak_value.argtypes = [c_uint, c_bool]
self.lib.carla_get_input_peak_value.argtypes = (c_void_p, c_uint, c_bool)
self.lib.carla_get_input_peak_value.restype = c_float

self.lib.carla_get_output_peak_value.argtypes = [c_uint, c_bool]
self.lib.carla_get_output_peak_value.argtypes = (c_void_p, c_uint, c_bool)
self.lib.carla_get_output_peak_value.restype = c_float

self.lib.carla_render_inline_display.argtypes = [c_uint, c_uint, c_uint]
self.lib.carla_render_inline_display.argtypes = (c_void_p, c_uint, c_uint, c_uint)
self.lib.carla_render_inline_display.restype = POINTER(CarlaInlineDisplayImageSurface)

self.lib.carla_set_option.argtypes = [c_uint, c_uint, c_bool]
self.lib.carla_set_option.argtypes = (c_void_p, c_uint, c_uint, c_bool)
self.lib.carla_set_option.restype = None

self.lib.carla_set_active.argtypes = [c_uint, c_bool]
self.lib.carla_set_active.argtypes = (c_void_p, c_uint, c_bool)
self.lib.carla_set_active.restype = None

self.lib.carla_set_drywet.argtypes = [c_uint, c_float]
self.lib.carla_set_drywet.argtypes = (c_void_p, c_uint, c_float)
self.lib.carla_set_drywet.restype = None

self.lib.carla_set_volume.argtypes = [c_uint, c_float]
self.lib.carla_set_volume.argtypes = (c_void_p, c_uint, c_float)
self.lib.carla_set_volume.restype = None

self.lib.carla_set_balance_left.argtypes = [c_uint, c_float]
self.lib.carla_set_balance_left.argtypes = (c_void_p, c_uint, c_float)
self.lib.carla_set_balance_left.restype = None

self.lib.carla_set_balance_right.argtypes = [c_uint, c_float]
self.lib.carla_set_balance_right.argtypes = (c_void_p, c_uint, c_float)
self.lib.carla_set_balance_right.restype = None

self.lib.carla_set_panning.argtypes = [c_uint, c_float]
self.lib.carla_set_panning.argtypes = (c_void_p, c_uint, c_float)
self.lib.carla_set_panning.restype = None

self.lib.carla_set_ctrl_channel.argtypes = [c_uint, c_int8]
self.lib.carla_set_ctrl_channel.argtypes = (c_void_p, c_uint, c_int8)
self.lib.carla_set_ctrl_channel.restype = None

self.lib.carla_set_parameter_value.argtypes = [c_uint, c_uint32, c_float]
self.lib.carla_set_parameter_value.argtypes = (c_void_p, c_uint, c_uint32, c_float)
self.lib.carla_set_parameter_value.restype = None

self.lib.carla_set_parameter_midi_channel.argtypes = [c_uint, c_uint32, c_uint8]
self.lib.carla_set_parameter_midi_channel.argtypes = (c_void_p, c_uint, c_uint32, c_uint8)
self.lib.carla_set_parameter_midi_channel.restype = None

self.lib.carla_set_parameter_mapped_control_index.argtypes = [c_uint, c_uint32, c_int16]
self.lib.carla_set_parameter_mapped_control_index.argtypes = (c_void_p, c_uint, c_uint32, c_int16)
self.lib.carla_set_parameter_mapped_control_index.restype = None

self.lib.carla_set_parameter_mapped_range.argtypes = [c_uint, c_uint32, c_float, c_float]
self.lib.carla_set_parameter_mapped_range.argtypes = (c_void_p, c_uint, c_uint32, c_float, c_float)
self.lib.carla_set_parameter_mapped_range.restype = None

self.lib.carla_set_parameter_touch.argtypes = [c_uint, c_uint32, c_bool]
self.lib.carla_set_parameter_touch.argtypes = (c_void_p, c_uint, c_uint32, c_bool)
self.lib.carla_set_parameter_touch.restype = None

self.lib.carla_set_program.argtypes = [c_uint, c_uint32]
self.lib.carla_set_program.argtypes = (c_void_p, c_uint, c_uint32)
self.lib.carla_set_program.restype = None

self.lib.carla_set_midi_program.argtypes = [c_uint, c_uint32]
self.lib.carla_set_midi_program.argtypes = (c_void_p, c_uint, c_uint32)
self.lib.carla_set_midi_program.restype = None

self.lib.carla_set_custom_data.argtypes = [c_uint, c_char_p, c_char_p, c_char_p]
self.lib.carla_set_custom_data.argtypes = (c_void_p, c_uint, c_char_p, c_char_p, c_char_p)
self.lib.carla_set_custom_data.restype = None

self.lib.carla_set_chunk_data.argtypes = [c_uint, c_char_p]
self.lib.carla_set_chunk_data.argtypes = (c_void_p, c_uint, c_char_p)
self.lib.carla_set_chunk_data.restype = None

self.lib.carla_prepare_for_save.argtypes = [c_uint]
self.lib.carla_prepare_for_save.argtypes = (c_void_p, c_uint)
self.lib.carla_prepare_for_save.restype = None

self.lib.carla_reset_parameters.argtypes = [c_uint]
self.lib.carla_reset_parameters.argtypes = (c_void_p, c_uint)
self.lib.carla_reset_parameters.restype = None

self.lib.carla_randomize_parameters.argtypes = [c_uint]
self.lib.carla_randomize_parameters.argtypes = (c_void_p, c_uint)
self.lib.carla_randomize_parameters.restype = None

self.lib.carla_send_midi_note.argtypes = [c_uint, c_uint8, c_uint8, c_uint8]
self.lib.carla_send_midi_note.argtypes = (c_void_p, c_uint, c_uint8, c_uint8, c_uint8)
self.lib.carla_send_midi_note.restype = None

self.lib.carla_show_custom_ui.argtypes = [c_uint, c_bool]
self.lib.carla_show_custom_ui.argtypes = (c_void_p, c_uint, c_bool)
self.lib.carla_show_custom_ui.restype = None

self.lib.carla_get_buffer_size.argtypes = None
self.lib.carla_get_buffer_size.argtypes = (c_void_p,)
self.lib.carla_get_buffer_size.restype = c_uint32

self.lib.carla_get_sample_rate.argtypes = None
self.lib.carla_get_sample_rate.argtypes = (c_void_p,)
self.lib.carla_get_sample_rate.restype = c_double

self.lib.carla_get_last_error.argtypes = None
self.lib.carla_get_last_error.argtypes = (c_void_p,)
self.lib.carla_get_last_error.restype = c_char_p

self.lib.carla_get_host_osc_url_tcp.argtypes = None
self.lib.carla_get_host_osc_url_tcp.argtypes = (c_void_p,)
self.lib.carla_get_host_osc_url_tcp.restype = c_char_p

self.lib.carla_get_host_osc_url_udp.argtypes = None
self.lib.carla_get_host_osc_url_udp.argtypes = (c_void_p,)
self.lib.carla_get_host_osc_url_udp.restype = c_char_p

self.lib.carla_nsm_init.argtypes = [c_uint64, c_char_p]
self.lib.carla_nsm_init.argtypes = (c_void_p, c_uint64, c_char_p)
self.lib.carla_nsm_init.restype = c_bool

self.lib.carla_nsm_ready.argtypes = [c_int]
self.lib.carla_nsm_ready.argtypes = (c_void_p, c_int)
self.lib.carla_nsm_ready.restype = None

self.handle = self.lib.carla_standalone_host_init()

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

def get_engine_driver_count(self):
@@ -2868,210 +2872,212 @@ class CarlaHostDLL(CarlaHostMeta):
return bool(self.lib.carla_show_engine_driver_device_control_panel(index, name.encode("utf-8")))

def engine_init(self, driverName, clientName):
return bool(self.lib.carla_engine_init(driverName.encode("utf-8"), clientName.encode("utf-8")))
return bool(self.lib.carla_engine_init(self.handle, driverName.encode("utf-8"), clientName.encode("utf-8")))

def engine_close(self):
return bool(self.lib.carla_engine_close())
return bool(self.lib.carla_engine_close(self.handle))

def engine_idle(self):
self.lib.carla_engine_idle()
self.lib.carla_engine_idle(self.handle)

def is_engine_running(self):
return bool(self.lib.carla_is_engine_running())
return bool(self.lib.carla_is_engine_running(self.handle))

def get_runtime_engine_info(self):
return structToDict(self.lib.carla_get_runtime_engine_info().contents)
return structToDict(self.lib.carla_get_runtime_engine_info(self.handle).contents)

def get_runtime_engine_driver_device_info(self):
return structToDict(self.lib.carla_get_runtime_engine_driver_device_info().contents)
return structToDict(self.lib.carla_get_runtime_engine_driver_device_info(self.handle).contents)

def set_engine_buffer_size_and_sample_rate(self, bufferSize, sampleRate):
return bool(self.lib.carla_set_engine_buffer_size_and_sample_rate(bufferSize, sampleRate))
return bool(self.lib.carla_set_engine_buffer_size_and_sample_rate(self.handle, bufferSize, sampleRate))

def show_engine_device_control_panel(self):
return bool(self.lib.carla_show_engine_device_control_panel())
return bool(self.lib.carla_show_engine_device_control_panel(self.handle))

def clear_engine_xruns(self):
self.lib.carla_clear_engine_xruns()
self.lib.carla_clear_engine_xruns(self.handle)

def cancel_engine_action(self):
self.lib.carla_cancel_engine_action()
self.lib.carla_cancel_engine_action(self.handle)

def set_engine_about_to_close(self):
return bool(self.lib.carla_set_engine_about_to_close())
return bool(self.lib.carla_set_engine_about_to_close(self.handle))

def set_engine_callback(self, func):
self._engineCallback = EngineCallbackFunc(func)
self.lib.carla_set_engine_callback(self._engineCallback, None)
self.lib.carla_set_engine_callback(self.handle, self._engineCallback, None)

def set_engine_option(self, option, value, valueStr):
self.lib.carla_set_engine_option(option, value, valueStr.encode("utf-8"))
self.lib.carla_set_engine_option(self.handle, option, value, valueStr.encode("utf-8"))

def set_file_callback(self, func):
self._fileCallback = FileCallbackFunc(func)
self.lib.carla_set_file_callback(self._fileCallback, None)
self.lib.carla_set_file_callback(self.handle, self._fileCallback, None)

def load_file(self, filename):
return bool(self.lib.carla_load_file(filename.encode("utf-8")))
return bool(self.lib.carla_load_file(self.handle, filename.encode("utf-8")))

def load_project(self, filename):
return bool(self.lib.carla_load_project(filename.encode("utf-8")))
return bool(self.lib.carla_load_project(self.handle, filename.encode("utf-8")))

def save_project(self, filename):
return bool(self.lib.carla_save_project(filename.encode("utf-8")))
return bool(self.lib.carla_save_project(self.handle, filename.encode("utf-8")))

def clear_project_filename(self):
self.lib.carla_clear_project_filename()
self.lib.carla_clear_project_filename(self.handle)

def patchbay_connect(self, external, groupIdA, portIdA, groupIdB, portIdB):
return bool(self.lib.carla_patchbay_connect(external, groupIdA, portIdA, groupIdB, portIdB))
return bool(self.lib.carla_patchbay_connect(self.handle, external, groupIdA, portIdA, groupIdB, portIdB))

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

def patchbay_refresh(self, external):
return bool(self.lib.carla_patchbay_refresh(external))
return bool(self.lib.carla_patchbay_refresh(self.handle, external))

def transport_play(self):
self.lib.carla_transport_play()
self.lib.carla_transport_play(self.handle)

def transport_pause(self):
self.lib.carla_transport_pause()
self.lib.carla_transport_pause(self.handle)

def transport_bpm(self, bpm):
self.lib.carla_transport_bpm(bpm)
self.lib.carla_transport_bpm(self.handle, bpm)

def transport_relocate(self, frame):
self.lib.carla_transport_relocate(frame)
self.lib.carla_transport_relocate(self.handle, frame)

def get_current_transport_frame(self):
return int(self.lib.carla_get_current_transport_frame())
return int(self.lib.carla_get_current_transport_frame(self.handle))

def get_transport_info(self):
return structToDict(self.lib.carla_get_transport_info().contents)
return structToDict(self.lib.carla_get_transport_info(self.handle).contents)

def get_current_plugin_count(self):
return int(self.lib.carla_get_current_plugin_count())
return int(self.lib.carla_get_current_plugin_count(self.handle))

def get_max_plugin_number(self):
return int(self.lib.carla_get_max_plugin_number())
return int(self.lib.carla_get_max_plugin_number(self.handle))

def add_plugin(self, btype, ptype, filename, name, label, uniqueId, extraPtr, options):
cfilename = filename.encode("utf-8") if filename else None
cname = name.encode("utf-8") if name else None
clabel = label.encode("utf-8") if label else None
return bool(self.lib.carla_add_plugin(btype, ptype, cfilename, cname, clabel, uniqueId, cast(extraPtr, c_void_p), options))
return bool(self.lib.carla_add_plugin(self.handle,
btype, ptype,
cfilename, cname, clabel, uniqueId, cast(extraPtr, c_void_p), options))

def remove_plugin(self, pluginId):
return bool(self.lib.carla_remove_plugin(pluginId))
return bool(self.lib.carla_remove_plugin(self.handle, pluginId))

def remove_all_plugins(self):
return bool(self.lib.carla_remove_all_plugins())
return bool(self.lib.carla_remove_all_plugins(self.handle))

def rename_plugin(self, pluginId, newName):
return bool(self.lib.carla_rename_plugin(pluginId, newName.encode("utf-8")))
return bool(self.lib.carla_rename_plugin(self.handle, pluginId, newName.encode("utf-8")))

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

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

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

def load_plugin_state(self, pluginId, filename):
return bool(self.lib.carla_load_plugin_state(pluginId, filename.encode("utf-8")))
return bool(self.lib.carla_load_plugin_state(self.handle, pluginId, filename.encode("utf-8")))

def save_plugin_state(self, pluginId, filename):
return bool(self.lib.carla_save_plugin_state(pluginId, filename.encode("utf-8")))
return bool(self.lib.carla_save_plugin_state(self.handle, pluginId, filename.encode("utf-8")))

def export_plugin_lv2(self, pluginId, lv2path):
return bool(self.lib.carla_export_plugin_lv2(pluginId, lv2path.encode("utf-8")))
return bool(self.lib.carla_export_plugin_lv2(self.handle, pluginId, lv2path.encode("utf-8")))

def get_plugin_info(self, pluginId):
return structToDict(self.lib.carla_get_plugin_info(pluginId).contents)
return structToDict(self.lib.carla_get_plugin_info(self.handle, pluginId).contents)

def get_audio_port_count_info(self, pluginId):
return structToDict(self.lib.carla_get_audio_port_count_info(pluginId).contents)
return structToDict(self.lib.carla_get_audio_port_count_info(self.handle, pluginId).contents)

def get_midi_port_count_info(self, pluginId):
return structToDict(self.lib.carla_get_midi_port_count_info(pluginId).contents)
return structToDict(self.lib.carla_get_midi_port_count_info(self.handle, pluginId).contents)

def get_parameter_count_info(self, pluginId):
return structToDict(self.lib.carla_get_parameter_count_info(pluginId).contents)
return structToDict(self.lib.carla_get_parameter_count_info(self.handle, pluginId).contents)

def get_parameter_info(self, pluginId, parameterId):
return structToDict(self.lib.carla_get_parameter_info(pluginId, parameterId).contents)
return structToDict(self.lib.carla_get_parameter_info(self.handle, pluginId, parameterId).contents)

def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
return structToDict(self.lib.carla_get_parameter_scalepoint_info(pluginId, parameterId, scalePointId).contents)
return structToDict(self.lib.carla_get_parameter_scalepoint_info(self.handle, pluginId, parameterId, scalePointId).contents)

def get_parameter_data(self, pluginId, parameterId):
return structToDict(self.lib.carla_get_parameter_data(pluginId, parameterId).contents)
return structToDict(self.lib.carla_get_parameter_data(self.handle, pluginId, parameterId).contents)

def get_parameter_ranges(self, pluginId, parameterId):
return structToDict(self.lib.carla_get_parameter_ranges(pluginId, parameterId).contents)
return structToDict(self.lib.carla_get_parameter_ranges(self.handle, pluginId, parameterId).contents)

def get_midi_program_data(self, pluginId, midiProgramId):
return structToDict(self.lib.carla_get_midi_program_data(pluginId, midiProgramId).contents)
return structToDict(self.lib.carla_get_midi_program_data(self.handle, pluginId, midiProgramId).contents)

def get_custom_data(self, pluginId, customDataId):
return structToDict(self.lib.carla_get_custom_data(pluginId, customDataId).contents)
return structToDict(self.lib.carla_get_custom_data(self.handle, pluginId, customDataId).contents)

def get_custom_data_value(self, pluginId, type_, key):
return charPtrToString(self.lib.carla_get_custom_data_value(pluginId, type_.encode("utf-8"), key.encode("utf-8")))
return charPtrToString(self.lib.carla_get_custom_data_value(self.handle, pluginId, type_.encode("utf-8"), key.encode("utf-8")))

def get_chunk_data(self, pluginId):
return charPtrToString(self.lib.carla_get_chunk_data(pluginId))
return charPtrToString(self.lib.carla_get_chunk_data(self.handle, pluginId))

def get_parameter_count(self, pluginId):
return int(self.lib.carla_get_parameter_count(pluginId))
return int(self.lib.carla_get_parameter_count(self.handle, pluginId))

def get_program_count(self, pluginId):
return int(self.lib.carla_get_program_count(pluginId))
return int(self.lib.carla_get_program_count(self.handle, pluginId))

def get_midi_program_count(self, pluginId):
return int(self.lib.carla_get_midi_program_count(pluginId))
return int(self.lib.carla_get_midi_program_count(self.handle, pluginId))

def get_custom_data_count(self, pluginId):
return int(self.lib.carla_get_custom_data_count(pluginId))
return int(self.lib.carla_get_custom_data_count(self.handle, pluginId))

def get_parameter_text(self, pluginId, parameterId):
return charPtrToString(self.lib.carla_get_parameter_text(pluginId, parameterId))
return charPtrToString(self.lib.carla_get_parameter_text(self.handle, pluginId, parameterId))

def get_program_name(self, pluginId, programId):
return charPtrToString(self.lib.carla_get_program_name(pluginId, programId))
return charPtrToString(self.lib.carla_get_program_name(self.handle, pluginId, programId))

def get_midi_program_name(self, pluginId, midiProgramId):
return charPtrToString(self.lib.carla_get_midi_program_name(pluginId, midiProgramId))
return charPtrToString(self.lib.carla_get_midi_program_name(self.handle, pluginId, midiProgramId))

def get_real_plugin_name(self, pluginId):
return charPtrToString(self.lib.carla_get_real_plugin_name(pluginId))
return charPtrToString(self.lib.carla_get_real_plugin_name(self.handle, pluginId))

def get_current_program_index(self, pluginId):
return int(self.lib.carla_get_current_program_index(pluginId))
return int(self.lib.carla_get_current_program_index(self.handle, pluginId))

def get_current_midi_program_index(self, pluginId):
return int(self.lib.carla_get_current_midi_program_index(pluginId))
return int(self.lib.carla_get_current_midi_program_index(self.handle, pluginId))

def get_default_parameter_value(self, pluginId, parameterId):
return float(self.lib.carla_get_default_parameter_value(pluginId, parameterId))
return float(self.lib.carla_get_default_parameter_value(self.handle, pluginId, parameterId))

def get_current_parameter_value(self, pluginId, parameterId):
return float(self.lib.carla_get_current_parameter_value(pluginId, parameterId))
return float(self.lib.carla_get_current_parameter_value(self.handle, pluginId, parameterId))

def get_internal_parameter_value(self, pluginId, parameterId):
return float(self.lib.carla_get_internal_parameter_value(pluginId, parameterId))
return float(self.lib.carla_get_internal_parameter_value(self.handle, pluginId, parameterId))

def get_input_peak_value(self, pluginId, isLeft):
return float(self.lib.carla_get_input_peak_value(pluginId, isLeft))
return float(self.lib.carla_get_input_peak_value(self.handle, pluginId, isLeft))

def get_output_peak_value(self, pluginId, isLeft):
return float(self.lib.carla_get_output_peak_value(pluginId, isLeft))
return float(self.lib.carla_get_output_peak_value(self.handle, pluginId, isLeft))

def render_inline_display(self, pluginId, width, height):
ptr = self.lib.carla_render_inline_display(pluginId, width, height)
ptr = self.lib.carla_render_inline_display(self.handle, pluginId, width, height)
if not ptr or not ptr.contents:
return None
contents = ptr.contents
@@ -3086,91 +3092,91 @@ class CarlaHostDLL(CarlaHostMeta):
return data

def set_option(self, pluginId, option, yesNo):
self.lib.carla_set_option(pluginId, option, yesNo)
self.lib.carla_set_option(self.handle, pluginId, option, yesNo)

def set_active(self, pluginId, onOff):
self.lib.carla_set_active(pluginId, onOff)
self.lib.carla_set_active(self.handle, pluginId, onOff)

def set_drywet(self, pluginId, value):
self.lib.carla_set_drywet(pluginId, value)
self.lib.carla_set_drywet(self.handle, pluginId, value)

def set_volume(self, pluginId, value):
self.lib.carla_set_volume(pluginId, value)
self.lib.carla_set_volume(self.handle, pluginId, value)

def set_balance_left(self, pluginId, value):
self.lib.carla_set_balance_left(pluginId, value)
self.lib.carla_set_balance_left(self.handle, pluginId, value)

def set_balance_right(self, pluginId, value):
self.lib.carla_set_balance_right(pluginId, value)
self.lib.carla_set_balance_right(self.handle, pluginId, value)

def set_panning(self, pluginId, value):
self.lib.carla_set_panning(pluginId, value)
self.lib.carla_set_panning(self.handle, pluginId, value)

def set_ctrl_channel(self, pluginId, channel):
self.lib.carla_set_ctrl_channel(pluginId, channel)
self.lib.carla_set_ctrl_channel(self.handle, pluginId, channel)

def set_parameter_value(self, pluginId, parameterId, value):
self.lib.carla_set_parameter_value(pluginId, parameterId, value)
self.lib.carla_set_parameter_value(self.handle, pluginId, parameterId, value)

def set_parameter_midi_channel(self, pluginId, parameterId, channel):
self.lib.carla_set_parameter_midi_channel(pluginId, parameterId, channel)
self.lib.carla_set_parameter_midi_channel(self.handle, pluginId, parameterId, channel)

def set_parameter_mapped_control_index(self, pluginId, parameterId, index):
self.lib.carla_set_parameter_mapped_control_index(pluginId, parameterId, index)
self.lib.carla_set_parameter_mapped_control_index(self.handle, pluginId, parameterId, index)

def set_parameter_mapped_range(self, pluginId, parameterId, minimum, maximum):
self.lib.carla_set_parameter_mapped_range(pluginId, parameterId, minimum, maximum)
self.lib.carla_set_parameter_mapped_range(self.handle, pluginId, parameterId, minimum, maximum)

def set_parameter_touch(self, pluginId, parameterId, touch):
self.lib.carla_set_parameter_touch(pluginId, parameterId, touch)
self.lib.carla_set_parameter_touch(self.handle, pluginId, parameterId, touch)

def set_program(self, pluginId, programId):
self.lib.carla_set_program(pluginId, programId)
self.lib.carla_set_program(self.handle, pluginId, programId)

def set_midi_program(self, pluginId, midiProgramId):
self.lib.carla_set_midi_program(pluginId, midiProgramId)
self.lib.carla_set_midi_program(self.handle, pluginId, midiProgramId)

def set_custom_data(self, pluginId, type_, key, value):
self.lib.carla_set_custom_data(pluginId, type_.encode("utf-8"), key.encode("utf-8"), value.encode("utf-8"))
self.lib.carla_set_custom_data(self.handle, pluginId, type_.encode("utf-8"), key.encode("utf-8"), value.encode("utf-8"))

def set_chunk_data(self, pluginId, chunkData):
self.lib.carla_set_chunk_data(pluginId, chunkData.encode("utf-8"))
self.lib.carla_set_chunk_data(self.handle, pluginId, chunkData.encode("utf-8"))

def prepare_for_save(self, pluginId):
self.lib.carla_prepare_for_save(pluginId)
self.lib.carla_prepare_for_save(self.handle, pluginId)

def reset_parameters(self, pluginId):
self.lib.carla_reset_parameters(pluginId)
self.lib.carla_reset_parameters(self.handle, pluginId)

def randomize_parameters(self, pluginId):
self.lib.carla_randomize_parameters(pluginId)
self.lib.carla_randomize_parameters(self.handle, pluginId)

def send_midi_note(self, pluginId, channel, note, velocity):
self.lib.carla_send_midi_note(pluginId, channel, note, velocity)
self.lib.carla_send_midi_note(self.handle, pluginId, channel, note, velocity)

def show_custom_ui(self, pluginId, yesNo):
self.lib.carla_show_custom_ui(pluginId, yesNo)
self.lib.carla_show_custom_ui(self.handle, pluginId, yesNo)

def get_buffer_size(self):
return int(self.lib.carla_get_buffer_size())
return int(self.lib.carla_get_buffer_size(self.handle))

def get_sample_rate(self):
return float(self.lib.carla_get_sample_rate())
return float(self.lib.carla_get_sample_rate(self.handle))

def get_last_error(self):
return charPtrToString(self.lib.carla_get_last_error())
return charPtrToString(self.lib.carla_get_last_error(self.handle))

def get_host_osc_url_tcp(self):
return charPtrToString(self.lib.carla_get_host_osc_url_tcp())
return charPtrToString(self.lib.carla_get_host_osc_url_tcp(self.handle))

def get_host_osc_url_udp(self):
return charPtrToString(self.lib.carla_get_host_osc_url_udp())
return charPtrToString(self.lib.carla_get_host_osc_url_udp(self.handle))

def nsm_init(self, pid, executableName):
return bool(self.lib.carla_nsm_init(pid, executableName.encode("utf-8")))
return bool(self.lib.carla_nsm_init(self.handle, pid, executableName.encode("utf-8")))

def nsm_ready(self, opcode):
self.lib.carla_nsm_ready(opcode)
self.lib.carla_nsm_ready(self.handle, opcode)

# ------------------------------------------------------------------------------------------------------------
# Helper object for CarlaHostPlugin
@@ -3205,7 +3211,6 @@ class PluginStoreInfo(object):
# Carla Host object for plugins (using pipes)

class CarlaHostPlugin(CarlaHostMeta):
#class CarlaHostPlugin(CarlaHostMeta, metaclass=ABCMeta):
def __init__(self):
CarlaHostMeta.__init__(self)



+ 4
- 33
source/utils/ThreadSafeFFTW.hpp View File

@@ -1,6 +1,6 @@
/*
* Thread-safe fftw
* Copyright (C) 2018-2019 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2018-2020 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
@@ -31,36 +31,12 @@ class ThreadSafeFFTW
public:
typedef void (*void_func)(void);

struct Deinitializer {
Deinitializer(ThreadSafeFFTW& s)
: tsfftw(s) {}

~Deinitializer()
{
tsfftw.deinit();
}

ThreadSafeFFTW& tsfftw;
};

ThreadSafeFFTW()
: initialized(false),
libfftw3(nullptr),
: libfftw3(nullptr),
libfftw3f(nullptr),
libfftw3l(nullptr),
libfftw3q(nullptr) {}

~ThreadSafeFFTW()
libfftw3q(nullptr)
{
CARLA_SAFE_ASSERT(libfftw3 == nullptr);
}

void init()
{
if (initialized)
return;
initialized = true;

if ((libfftw3 = lib_open("libfftw3_threads.so.3")) != nullptr)
if (const void_func func = lib_symbol<void_func>(libfftw3, "fftw_make_planner_thread_safe"))
func();
@@ -78,12 +54,8 @@ public:
func();
}

void deinit()
~ThreadSafeFFTW()
{
if (! initialized)
return;
initialized = false;

if (libfftw3 != nullptr)
{
lib_close(libfftw3);
@@ -110,7 +82,6 @@ public:
}

private:
bool initialized;
lib_t libfftw3;
lib_t libfftw3f;
lib_t libfftw3l;


Loading…
Cancel
Save