Browse Source

More work, move db and refresh code to shared

tags/1.9.4
falkTX 11 years ago
parent
commit
8e219a0bb3
7 changed files with 2044 additions and 2055 deletions
  1. +5
    -13
      source/backend/carla_engine.hpp
  2. +3
    -4
      source/backend/carla_standalone.hpp
  3. +14
    -13
      source/backend/engine/carla_engine.cpp
  4. +199
    -221
      source/backend/standalone/carla_standalone.cpp
  5. +0
    -1023
      source/carla.py
  6. +165
    -699
      source/carla_backend.py
  7. +1658
    -82
      source/carla_shared.py

+ 5
- 13
source/backend/carla_engine.hpp View File

@@ -627,6 +627,11 @@ public:
*/
virtual bool close();

/*!
* Idle.
*/
virtual void idle();

/*!
* Check if engine is running.
*/
@@ -651,14 +656,6 @@ public:
// -------------------------------------------------------------------
// Plugin management

#if 0
/*!
* Get next available plugin id.\n
* Returns -1 if no more plugins can be loaded.
*/
int getNewPluginId() const;
#endif

/*!
* Get plugin with id \a id.
*/
@@ -700,11 +697,6 @@ public:
*/
void removeAllPlugins();

/*!
* Idle all plugins GUIs.
*/
void idlePluginGuis();

// bridge, internal use only
// TODO - find a better way for this
//void __bridgePluginRegister(const unsigned short id, CarlaPlugin* const plugin);


+ 3
- 4
source/backend/carla_standalone.hpp View File

@@ -151,6 +151,7 @@ CARLA_EXPORT const CarlaNativePluginInfo* carla_get_internal_plugin_info(unsigne

CARLA_EXPORT bool carla_engine_init(const char* driverName, const char* clientName);
CARLA_EXPORT bool carla_engine_close();
CARLA_EXPORT void carla_engine_idle();
CARLA_EXPORT bool carla_is_engine_running();

CARLA_EXPORT bool carla_add_plugin(CarlaBinaryType btype, CarlaPluginType ptype, const char* filename, const char* name, const char* label, void* extraPtr);
@@ -204,11 +205,9 @@ CARLA_EXPORT void carla_set_midi_program(unsigned int pluginId, uint32_t midiPro
CARLA_EXPORT void carla_set_custom_data(unsigned int pluginId, const char* type, const char* key, const char* value);
CARLA_EXPORT void carla_set_chunk_data(unsigned int pluginId, const char* chunkData);

CARLA_EXPORT void carla_show_gui(unsigned int pluginId, bool yesNo);
CARLA_EXPORT void carla_idle_guis();

CARLA_EXPORT void carla_send_midi_note(unsigned int pluginId, uint8_t channel, uint8_t note, uint8_t velocity);
CARLA_EXPORT void carla_prepare_for_save(unsigned int pluginId);
CARLA_EXPORT void carla_send_midi_note(unsigned int pluginId, uint8_t channel, uint8_t note, uint8_t velocity);
CARLA_EXPORT void carla_show_gui(unsigned int pluginId, bool yesNo);

CARLA_EXPORT uint32_t carla_get_buffer_size();
CARLA_EXPORT double carla_get_sample_rate();


+ 14
- 13
source/backend/engine/carla_engine.cpp View File

@@ -584,6 +584,20 @@ bool CarlaEngine::close()
return true;
}

void CarlaEngine::idle()
{
CARLA_ASSERT(fData->plugins != nullptr);
CARLA_ASSERT(isRunning());

for (unsigned int i=0; i < fData->curPluginCount; i++)
{
CarlaPlugin* const plugin = fData->plugins[i].plugin;

if (plugin && plugin->enabled())
plugin->idleGui();
}
}

// -----------------------------------------------------------------------
// Plugin management

@@ -929,19 +943,6 @@ void CarlaEngine::removeAllPlugins()
}

#if 0
void CarlaEngine::idlePluginGuis()
{
CARLA_ASSERT(data->maxPluginNumber > 0);

for (unsigned short i=0; i < data->maxPluginNumber; i++)
{
CarlaPlugin* const plugin = data->carlaPlugins[i];

if (plugin && plugin->enabled())
plugin->idleGui();
}
}

void CarlaEngine::__bridgePluginRegister(const unsigned short id, CarlaPlugin* const plugin)
{
data->carlaPlugins[id] = plugin;


+ 199
- 221
source/backend/standalone/carla_standalone.cpp View File

@@ -16,9 +16,11 @@
*/

#include "carla_standalone.hpp"

#include "carla_backend_utils.hpp"
#include "carla_engine.hpp"
#include "carla_plugin.hpp"
#include "carla_midi.h"
#include "carla_native.h"

#include <QtCore/QByteArray>
@@ -270,6 +272,14 @@ bool carla_engine_close()
return closed;
}

void carla_engine_idle()
{
CARLA_ASSERT(standalone.engine != nullptr);

if (standalone.engine)
standalone.engine->idle();
}

bool carla_is_engine_running()
{
qDebug("carla_is_engine_running()");
@@ -656,14 +666,14 @@ const char* carla_get_chunk_data(unsigned int pluginId)
qDebug("carla_get_chunk_data(%i)", pluginId);
CARLA_ASSERT(standalone.engine != nullptr);

if (standalone.engine == nullptr)
return nullptr;

static CarlaString chunkData;

// cleanup
chunkData.clear();

if (standalone.engine == nullptr)
return nullptr;

if (CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId))
{
if (plugin->hints() & CarlaBackend::PLUGIN_USES_CHUNKS)
@@ -751,113 +761,88 @@ uint32_t carla_get_custom_data_count(unsigned int pluginId)
return 0;
}

#if 0
// -------------------------------------------------------------------------------------------------------------------

const char* carla_get_parameter_text(unsigned int pluginId, uint32_t parameter_id)
const char* carla_get_parameter_text(unsigned int pluginId, uint32_t parameterId)
{
qDebug("carla_get_parameter_text(%i, %i)", pluginId, parameter_id);
qDebug("carla_get_parameter_text(%i, %i)", pluginId, parameterId);
CARLA_ASSERT(standalone.engine != nullptr);

static char textBuf[STR_MAX];
memset(textBuf, 0, sizeof(char)*STR_MAX);

if (standalone.engine == nullptr)
return nullptr;

static char textBuf[STR_MAX];
carla_zeroMem(textBuf, sizeof(char)*STR_MAX);

if (CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId))
{
if (parameter_id < plugin->parameterCount())
if (parameterId < plugin->parameterCount())
{
plugin->getParameterText(parameter_id, textBuf);
plugin->getParameterText(parameterId, textBuf);
return textBuf;
}

qCritical("carla_get_parameter_text(%i, %i) - parameter_id out of bounds", pluginId, parameter_id);
qCritical("carla_get_parameter_text(%i, %i) - parameterId out of bounds", pluginId, parameterId);
return nullptr;
}

qCritical("carla_get_parameter_text(%i, %i) - could not find plugin", pluginId, parameter_id);
qCritical("carla_get_parameter_text(%i, %i) - could not find plugin", pluginId, parameterId);
return nullptr;
}

const char* carla_get_program_name(unsigned int pluginId, uint32_t program_id)
const char* carla_get_program_name(unsigned int pluginId, uint32_t programId)
{
qDebug("carla_get_program_name(%i, %i)", pluginId, program_id);
qDebug("carla_get_program_name(%i, %i)", pluginId, programId);
CARLA_ASSERT(standalone.engine != nullptr);

static const char* program_name = nullptr;

// cleanup
if (program_name)
{
free((void*)program_name);
program_name = nullptr;
}

if (standalone.engine == nullptr)
return nullptr;

if (! standalone.started)
return nullptr;
static char programName[STR_MAX];
carla_zeroMem(programName, sizeof(char)*STR_MAX);

if (CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId))
{
if (program_id < plugin->programCount())
if (programId < plugin->programCount())
{
char strBuf[STR_MAX] = { 0 };

plugin->getProgramName(program_id, strBuf);
program_name = strdup(strBuf);
plugin->getProgramName(programId, programName);

return program_name;
return programName;
}

qCritical("carla_get_program_name(%i, %i) - program_id out of bounds", pluginId, program_id);
qCritical("carla_get_program_name(%i, %i) - programId out of bounds", pluginId, programId);
return nullptr;
}

qCritical("carla_get_program_name(%i, %i) - could not find plugin", pluginId, program_id);
qCritical("carla_get_program_name(%i, %i) - could not find plugin", pluginId, programId);
return nullptr;
}

const char* carla_get_midi_program_name(unsigned int pluginId, uint32_t midi_program_id)
const char* carla_get_midi_program_name(unsigned int pluginId, uint32_t midiProgramId)
{
qDebug("carla_get_midi_program_name(%i, %i)", pluginId, midi_program_id);
qDebug("carla_get_midi_program_name(%i, %i)", pluginId, midiProgramId);
CARLA_ASSERT(standalone.engine != nullptr);

static const char* midi_program_name = nullptr;

// cleanup
if (midi_program_name)
{
free((void*)midi_program_name);
midi_program_name = nullptr;
}

if (standalone.engine == nullptr)
return nullptr;

if (! standalone.started)
return nullptr;
static char midiProgramName[STR_MAX];
carla_zeroMem(midiProgramName, sizeof(char)*STR_MAX);

if (CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId))
{
if (midi_program_id < plugin->midiProgramCount())
if (midiProgramId < plugin->midiProgramCount())
{
char strBuf[STR_MAX] = { 0 };

plugin->getMidiProgramName(midi_program_id, strBuf);
midi_program_name = strdup(strBuf);
plugin->getMidiProgramName(midiProgramId, midiProgramName);

return midi_program_name;
return midiProgramName;
}

qCritical("carla_get_midi_program_name(%i, %i) - program_id out of bounds", pluginId, midi_program_id);
qCritical("carla_get_midi_program_name(%i, %i) - midiProgramId out of bounds", pluginId, midiProgramId);
return nullptr;
}

qCritical("carla_get_midi_program_name(%i, %i) - could not find plugin", pluginId, midi_program_id);
qCritical("carla_get_midi_program_name(%i, %i) - could not find plugin", pluginId, midiProgramId);
return nullptr;
}

@@ -866,29 +851,17 @@ const char* carla_get_real_plugin_name(unsigned int pluginId)
qDebug("carla_get_real_plugin_name(%i)", pluginId);
CARLA_ASSERT(standalone.engine != nullptr);

static const char* real_plugin_name = nullptr;

// cleanup
if (real_plugin_name)
{
free((void*)real_plugin_name);
real_plugin_name = nullptr;
}

if (standalone.engine == nullptr)
return nullptr;

if (! standalone.started)
return nullptr;
static char realPluginName[STR_MAX];
carla_zeroMem(realPluginName, sizeof(char)*STR_MAX);

if (CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId))
{
char strBuf[STR_MAX] = { 0 };

plugin->getRealName(strBuf);
real_plugin_name = strdup(strBuf);
plugin->getRealName(realPluginName);

return real_plugin_name;
return realPluginName;
}

qCritical("carla_get_real_plugin_name(%i) - could not find plugin", pluginId);
@@ -929,94 +902,90 @@ int32_t carla_get_current_midi_program_index(unsigned int pluginId)

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

double carla_get_default_parameter_value(unsigned int pluginId, uint32_t parameter_id)
float carla_get_default_parameter_value(unsigned int pluginId, uint32_t parameterId)
{
qDebug("carla_get_default_parameter_value(%i, %i)", pluginId, parameter_id);
qDebug("carla_get_default_parameter_value(%i, %i)", pluginId, parameterId);
CARLA_ASSERT(standalone.engine != nullptr);

if (standalone.engine == nullptr)
return 0.0;
return 0.0f;

if (CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId))
{
if (parameter_id < plugin->parameterCount())
return plugin->parameterRanges(parameter_id)->def;
if (parameterId < plugin->parameterCount())
return plugin->parameterRanges(parameterId).def;

qCritical("carla_get_default_parameter_value(%i, %i) - parameter_id out of bounds", pluginId, parameter_id);
return 0.0;
qCritical("carla_get_default_parameter_value(%i, %i) - parameterId out of bounds", pluginId, parameterId);
return 0.0f;
}

qCritical("carla_get_default_parameter_value(%i, %i) - could not find plugin", pluginId, parameter_id);
return 0.0;
qCritical("carla_get_default_parameter_value(%i, %i) - could not find plugin", pluginId, parameterId);
return 0.0f;
}

double carla_get_current_parameter_value(unsigned int pluginId, uint32_t parameter_id)
float carla_get_current_parameter_value(unsigned int pluginId, uint32_t parameterId)
{
qDebug("carla_get_current_parameter_value(%i, %i)", pluginId, parameter_id);
qDebug("carla_get_current_parameter_value(%i, %i)", pluginId, parameterId);
CARLA_ASSERT(standalone.engine != nullptr);

if (standalone.engine == nullptr)
return 0.0;
return 0.0f;

if (CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId))
{
if (parameter_id < plugin->parameterCount())
return plugin->getParameterValue(parameter_id);
if (parameterId < plugin->parameterCount())
return plugin->getParameterValue(parameterId);

qCritical("carla_get_current_parameter_value(%i, %i) - parameter_id out of bounds", pluginId, parameter_id);
return 0.0;
qCritical("carla_get_current_parameter_value(%i, %i) - parameterId out of bounds", pluginId, parameterId);
return 0.0f;
}

qCritical("carla_get_current_parameter_value(%i, %i) - could not find plugin", pluginId, parameter_id);
return 0.0;
qCritical("carla_get_current_parameter_value(%i, %i) - could not find plugin", pluginId, parameterId);
return 0.0f;
}

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

double carla_get_input_peak_value(unsigned int pluginId, unsigned short port_id)
float carla_get_input_peak_value(unsigned int pluginId, unsigned short portId)
{
CARLA_ASSERT(standalone.engine != nullptr);
CARLA_ASSERT(port_id == 1 || port_id == 2);
CARLA_ASSERT(portId == 1 || portId == 2);

if (standalone.engine == nullptr)
return 0.0;
return 0.0f;

#if 0
if (pluginId >= standalone.engine->maxPluginNumber())
if (pluginId >= standalone.engine->currentPluginCount())
{
qCritical("carla_get_input_peak_value(%i, %i) - invalid plugin value", pluginId, port_id);
return 0.0;
qCritical("carla_get_input_peak_value(%i, %i) - invalid plugin value", pluginId, portId);
return 0.0f;
}
#endif

if (port_id == 1 || port_id == 2)
return standalone.engine->getInputPeak(pluginId, port_id-1);
//if (portId == 1 || portId == 2)
// return standalone.engine->getInputPeak(pluginId, portId-1);

qCritical("carla_get_input_peak_value(%i, %i) - invalid port value", pluginId, port_id);
return 0.0;
qCritical("carla_get_input_peak_value(%i, %i) - invalid port value", pluginId, portId);
return 0.0f;
}

double carla_get_output_peak_value(unsigned int pluginId, unsigned short port_id)
float carla_get_output_peak_value(unsigned int pluginId, unsigned short portId)
{
CARLA_ASSERT(standalone.engine != nullptr);
CARLA_ASSERT(port_id == 1 || port_id == 2);
CARLA_ASSERT(portId == 1 || portId == 2);

if (standalone.engine == nullptr)
return 0.0;
return 0.0f;

#if 0
if (pluginId >= standalone.engine->maxPluginNumber())
if (pluginId >= standalone.engine->currentPluginCount())
{
qCritical("carla_get_input_peak_value(%i, %i) - invalid plugin value", pluginId, port_id);
return 0.0;
qCritical("carla_get_input_peak_value(%i, %i) - invalid plugin value", pluginId, portId);
return 0.0f;
}
#endif

if (port_id == 1 || port_id == 2)
return standalone.engine->getOutputPeak(pluginId, port_id-1);
//if (portId == 1 || portId == 2)
// return standalone.engine->getOutputPeak(pluginId, portId-1);

qCritical("carla_get_output_peak_value(%i, %i) - invalid port value", pluginId, port_id);
return 0.0;
qCritical("carla_get_output_peak_value(%i, %i) - invalid port value", pluginId, portId);
return 0.0f;
}

// -------------------------------------------------------------------------------------------------------------------
@@ -1035,9 +1004,9 @@ void carla_set_active(unsigned int pluginId, bool onOff)
qCritical("carla_set_active(%i, %s) - could not find plugin", pluginId, bool2str(onOff));
}

void carla_set_drywet(unsigned int pluginId, double value)
void carla_set_drywet(unsigned int pluginId, float value)
{
qDebug("carla_set_drywet(%i, %g)", pluginId, value);
qDebug("carla_set_drywet(%i, %f)", pluginId, value);
CARLA_ASSERT(standalone.engine != nullptr);

if (standalone.engine == nullptr)
@@ -1046,12 +1015,12 @@ void carla_set_drywet(unsigned int pluginId, double value)
if (CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId))
return plugin->setDryWet(value, true, false);

qCritical("carla_set_drywet(%i, %g) - could not find plugin", pluginId, value);
qCritical("carla_set_drywet(%i, %f) - could not find plugin", pluginId, value);
}

void carla_set_volume(unsigned int pluginId, double value)
void carla_set_volume(unsigned int pluginId, float value)
{
qDebug("carla_set_volume(%i, %g)", pluginId, value);
qDebug("carla_set_volume(%i, %f)", pluginId, value);
CARLA_ASSERT(standalone.engine != nullptr);

if (standalone.engine == nullptr)
@@ -1060,12 +1029,12 @@ void carla_set_volume(unsigned int pluginId, double value)
if (CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId))
return plugin->setVolume(value, true, false);

qCritical("carla_set_volume(%i, %g) - could not find plugin", pluginId, value);
qCritical("carla_set_volume(%i, %f) - could not find plugin", pluginId, value);
}

void carla_set_balance_left(unsigned int pluginId, double value)
void carla_set_balance_left(unsigned int pluginId, float value)
{
qDebug("carla_set_balance_left(%i, %g)", pluginId, value);
qDebug("carla_set_balance_left(%i, %f)", pluginId, value);
CARLA_ASSERT(standalone.engine != nullptr);

if (standalone.engine == nullptr)
@@ -1074,12 +1043,12 @@ void carla_set_balance_left(unsigned int pluginId, double value)
if (CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId))
return plugin->setBalanceLeft(value, true, false);

qCritical("carla_set_balance_left(%i, %g) - could not find plugin", pluginId, value);
qCritical("carla_set_balance_left(%i, %f) - could not find plugin", pluginId, value);
}

void carla_set_balance_right(unsigned int pluginId, double value)
void carla_set_balance_right(unsigned int pluginId, float value)
{
qDebug("carla_set_balance_right(%i, %g)", pluginId, value);
qDebug("carla_set_balance_right(%i, %f)", pluginId, value);
CARLA_ASSERT(standalone.engine != nullptr);

if (standalone.engine == nullptr)
@@ -1088,14 +1057,28 @@ void carla_set_balance_right(unsigned int pluginId, double value)
if (CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId))
return plugin->setBalanceRight(value, true, false);

qCritical("carla_set_balance_right(%i, %g) - could not find plugin", pluginId, value);
qCritical("carla_set_balance_right(%i, %f) - could not find plugin", pluginId, value);
}

void carla_set_panning(unsigned int pluginId, float value)
{
qDebug("carla_set_panning(%i, %f)", pluginId, value);
CARLA_ASSERT(standalone.engine != nullptr);

if (standalone.engine == nullptr)
return;

if (CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId))
return plugin->setPanning(value, true, false);

qCritical("carla_set_panning(%i, %f) - could not find plugin", pluginId, value);
}

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

void carla_set_parameter_value(unsigned int pluginId, uint32_t parameter_id, double value)
void carla_set_parameter_value(unsigned int pluginId, uint32_t parameterId, float value)
{
qDebug("carla_set_parameter_value(%i, %i, %g)", pluginId, parameter_id, value);
qDebug("carla_set_parameter_value(%i, %i, %f)", pluginId, parameterId, value);
CARLA_ASSERT(standalone.engine != nullptr);

if (standalone.engine == nullptr)
@@ -1103,25 +1086,25 @@ void carla_set_parameter_value(unsigned int pluginId, uint32_t parameter_id, dou

if (CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId))
{
if (parameter_id < plugin->parameterCount())
return plugin->setParameterValue(parameter_id, value, true, true, false);
if (parameterId < plugin->parameterCount())
return plugin->setParameterValue(parameterId, value, true, true, false);

qCritical("carla_set_parameter_value(%i, %i, %g) - parameter_id out of bounds", pluginId, parameter_id, value);
qCritical("carla_set_parameter_value(%i, %i, %f) - parameterId out of bounds", pluginId, parameterId, value);
return;
}

qCritical("carla_set_parameter_value(%i, %i, %g) - could not find plugin", pluginId, parameter_id, value);
qCritical("carla_set_parameter_value(%i, %i, %f) - could not find plugin", pluginId, parameterId, value);
}

void carla_set_parameter_midi_channel(unsigned int pluginId, uint32_t parameter_id, uint8_t channel)
void carla_set_parameter_midi_channel(unsigned int pluginId, uint32_t parameterId, uint8_t channel)
{
qDebug("carla_set_parameter_midi_channel(%i, %i, %i)", pluginId, parameter_id, channel);
qDebug("carla_set_parameter_midi_channel(%i, %i, %i)", pluginId, parameterId, channel);
CARLA_ASSERT(standalone.engine != nullptr);
CARLA_ASSERT(channel < MAX_MIDI_CHANNELS);

if (channel >= MAX_MIDI_CHANNELS)
{
qCritical("carla_set_parameter_midi_channel(%i, %i, %i) - invalid channel number", pluginId, parameter_id, channel);
qCritical("carla_set_parameter_midi_channel(%i, %i, %i) - invalid channel number", pluginId, parameterId, channel);
return;
}

@@ -1130,19 +1113,19 @@ void carla_set_parameter_midi_channel(unsigned int pluginId, uint32_t parameter_

if (CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId))
{
if (parameter_id < plugin->parameterCount())
return plugin->setParameterMidiChannel(parameter_id, channel, true, false);
if (parameterId < plugin->parameterCount())
return plugin->setParameterMidiChannel(parameterId, channel, true, false);

qCritical("carla_set_parameter_midi_channel(%i, %i, %i) - parameter_id out of bounds", pluginId, parameter_id, channel);
qCritical("carla_set_parameter_midi_channel(%i, %i, %i) - parameterId out of bounds", pluginId, parameterId, channel);
return;
}

qCritical("carla_set_parameter_midi_channel(%i, %i, %i) - could not find plugin", pluginId, parameter_id, channel);
qCritical("carla_set_parameter_midi_channel(%i, %i, %i) - could not find plugin", pluginId, parameterId, channel);
}

void carla_set_parameter_midi_cc(unsigned int pluginId, uint32_t parameter_id, int16_t cc)
void carla_set_parameter_midi_cc(unsigned int pluginId, uint32_t parameterId, int16_t cc)
{
qDebug("carla_set_parameter_midi_cc(%i, %i, %i)", pluginId, parameter_id, cc);
qDebug("carla_set_parameter_midi_cc(%i, %i, %i)", pluginId, parameterId, cc);
CARLA_ASSERT(standalone.engine != nullptr);
CARLA_ASSERT(cc >= -1 && cc <= 0x5F);

@@ -1152,7 +1135,7 @@ void carla_set_parameter_midi_cc(unsigned int pluginId, uint32_t parameter_id, i
}
else if (cc > 0x5F) // 95
{
qCritical("carla_set_parameter_midi_cc(%i, %i, %i) - invalid cc number", pluginId, parameter_id, cc);
qCritical("carla_set_parameter_midi_cc(%i, %i, %i) - invalid cc number", pluginId, parameterId, cc);
return;
}

@@ -1161,19 +1144,19 @@ void carla_set_parameter_midi_cc(unsigned int pluginId, uint32_t parameter_id, i

if (CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId))
{
if (parameter_id < plugin->parameterCount())
return plugin->setParameterMidiCC(parameter_id, cc, true, false);
if (parameterId < plugin->parameterCount())
return plugin->setParameterMidiCC(parameterId, cc, true, false);

qCritical("carla_set_parameter_midi_cc(%i, %i, %i) - parameter_id out of bounds", pluginId, parameter_id, cc);
qCritical("carla_set_parameter_midi_cc(%i, %i, %i) - parameterId out of bounds", pluginId, parameterId, cc);
return;
}

qCritical("carla_set_parameter_midi_cc(%i, %i, %i) - could not find plugin", pluginId, parameter_id, cc);
qCritical("carla_set_parameter_midi_cc(%i, %i, %i) - could not find plugin", pluginId, parameterId, cc);
}

void carla_set_program(unsigned int pluginId, uint32_t program_id)
void carla_set_program(unsigned int pluginId, uint32_t programId)
{
qDebug("carla_set_program(%i, %i)", pluginId, program_id);
qDebug("carla_set_program(%i, %i)", pluginId, programId);
CARLA_ASSERT(standalone.engine != nullptr);

if (standalone.engine == nullptr)
@@ -1181,19 +1164,19 @@ void carla_set_program(unsigned int pluginId, uint32_t program_id)

if (CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId))
{
if (program_id < plugin->programCount())
return plugin->setProgram(program_id, true, true, false, true);
if (programId < plugin->programCount())
return plugin->setProgram(programId, true, true, false, true);

qCritical("carla_set_program(%i, %i) - program_id out of bounds", pluginId, program_id);
qCritical("carla_set_program(%i, %i) - programId out of bounds", pluginId, programId);
return;
}

qCritical("carla_set_program(%i, %i) - could not find plugin", pluginId, program_id);
qCritical("carla_set_program(%i, %i) - could not find plugin", pluginId, programId);
}

void carla_set_midi_program(unsigned int pluginId, uint32_t midi_program_id)
void carla_set_midi_program(unsigned int pluginId, uint32_t midiProgramId)
{
qDebug("carla_set_midi_program(%i, %i)", pluginId, midi_program_id);
qDebug("carla_set_midi_program(%i, %i)", pluginId, midiProgramId);
CARLA_ASSERT(standalone.engine != nullptr);

if (standalone.engine == nullptr)
@@ -1201,14 +1184,14 @@ void carla_set_midi_program(unsigned int pluginId, uint32_t midi_program_id)

if (CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId))
{
if (midi_program_id < plugin->midiProgramCount())
return plugin->setMidiProgram(midi_program_id, true, true, false, true);
if (midiProgramId < plugin->midiProgramCount())
return plugin->setMidiProgram(midiProgramId, true, true, false, true);

qCritical("carla_set_midi_program(%i, %i) - midi_program_id out of bounds", pluginId, midi_program_id);
qCritical("carla_set_midi_program(%i, %i) - midiProgramId out of bounds", pluginId, midiProgramId);
return;
}

qCritical("carla_set_midi_program(%i, %i) - could not find plugin", pluginId, midi_program_id);
qCritical("carla_set_midi_program(%i, %i) - could not find plugin", pluginId, midiProgramId);
}

// -------------------------------------------------------------------------------------------------------------------
@@ -1227,9 +1210,9 @@ void carla_set_custom_data(unsigned int pluginId, const char* type, const char*
qCritical("carla_set_custom_data(%i, \"%s\", \"%s\", \"%s\") - could not find plugin", pluginId, type, key, value);
}

void carla_set_chunk_data(unsigned int pluginId, const char* chunk_data)
void carla_set_chunk_data(unsigned int pluginId, const char* chunkData)
{
qDebug("carla_set_chunk_data(%i, \"%s\")", pluginId, chunk_data);
qDebug("carla_set_chunk_data(%i, \"%s\")", pluginId, chunkData);
CARLA_ASSERT(standalone.engine != nullptr);

if (standalone.engine == nullptr)
@@ -1238,47 +1221,37 @@ void carla_set_chunk_data(unsigned int pluginId, const char* chunk_data)
if (CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId))
{
if (plugin->hints() & CarlaBackend::PLUGIN_USES_CHUNKS)
return plugin->setChunkData(chunk_data);
return plugin->setChunkData(chunkData);

qCritical("carla_set_chunk_data(%i, \"%s\") - plugin does not support chunks", pluginId, chunk_data);
qCritical("carla_set_chunk_data(%i, \"%s\") - plugin does not support chunks", pluginId, chunkData);
return;
}

qCritical("carla_set_chunk_data(%i, \"%s\") - could not find plugin", pluginId, chunk_data);
qCritical("carla_set_chunk_data(%i, \"%s\") - could not find plugin", pluginId, chunkData);
}

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

void carla_show_gui(unsigned int pluginId, bool yesno)
void carla_prepare_for_save(unsigned int pluginId)
{
qDebug("carla_show_gui(%i, %s)", pluginId, bool2str(yesno));
qDebug("carla_prepare_for_save(%i)", pluginId);
CARLA_ASSERT(standalone.engine != nullptr);

if (standalone.engine == nullptr)
return;

if (CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId))
return plugin->showGui(yesno);

qCritical("carla_show_gui(%i, %s) - could not find plugin", pluginId, bool2str(yesno));
}

void carla_idle_guis()
{
CARLA_ASSERT(standalone.engine != nullptr);
return plugin->prepareForSave();

if (standalone.engine)
standalone.engine->idlePluginGuis();
qCritical("carla_prepare_for_save(%i) - could not find plugin", pluginId);
}

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

void carla_send_midi_note(unsigned int pluginId, uint8_t channel, uint8_t note, uint8_t velocity)
{
qDebug("carla_send_midi_note(%i, %i, %i, %i)", pluginId, channel, note, velocity);
CARLA_ASSERT(standalone.engine != nullptr);

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

if (CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId))
@@ -1287,18 +1260,18 @@ void carla_send_midi_note(unsigned int pluginId, uint8_t channel, uint8_t note,
qCritical("carla_send_midi_note(%i, %i, %i, %i) - could not find plugin", pluginId, channel, note, velocity);
}

void carla_prepare_for_save(unsigned int pluginId)
void carla_show_gui(unsigned int pluginId, bool yesno)
{
qDebug("carla_prepare_for_save(%i)", pluginId);
qDebug("carla_show_gui(%i, %s)", pluginId, bool2str(yesno));
CARLA_ASSERT(standalone.engine != nullptr);

if (standalone.engine == nullptr)
return;

if (CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId))
return plugin->prepareForSave();
return plugin->showGui(yesno);

qCritical("carla_prepare_for_save(%i) - could not find plugin", pluginId);
qCritical("carla_show_gui(%i, %s) - could not find plugin", pluginId, bool2str(yesno));
}

// -------------------------------------------------------------------------------------------------------------------
@@ -1331,7 +1304,7 @@ const char* carla_get_last_error()
{
qDebug("carla_get_last_error()");

if (standalone.engine)
if (standalone.engine != nullptr)
return standalone.engine->getLastError();

return standalone.lastError;
@@ -1360,109 +1333,114 @@ void carla_set_callback_function(CarlaBackend::CallbackFunc func)
standalone.engine->setCallback(func, nullptr);
}

void carla_set_option(CarlaBackend::OptionsType option, int value, const char* value_str)
void carla_set_option(CarlaBackend::OptionsType option, int value, const char* valueStr)
{
qDebug("carla_set_option(%s, %i, \"%s\")", CarlaBackend::OptionsType2Str(option), value, value_str);
qDebug("carla_set_option(%s, %i, \"%s\")", CarlaBackend::OptionsType2Str(option), value, valueStr);

if (standalone.engine)
standalone.engine->setOption(option, value, value_str);
standalone.engine->setOption(option, value, valueStr);

switch (option)
{
case CarlaBackend::OPTION_PROCESS_NAME:
standalone.procName = value_str;
standalone.procName = valueStr;
break;

case CarlaBackend::OPTION_PROCESS_MODE:
if (value < CarlaBackend::PROCESS_MODE_SINGLE_CLIENT || value > CarlaBackend::PROCESS_MODE_PATCHBAY)
return qCritical("carla_set_option(%s, %i, \"%s\") - invalid value", OptionsType2Str(option), value, value_str);
return qCritical("carla_set_option(OPTION_PROCESS_MODE, %i, \"%s\") - invalid value", value, valueStr);

standalone.options.processMode = static_cast<CarlaBackend::ProcessMode>(value);
break;

case CarlaBackend::OPTION_PROCESS_HIGH_PRECISION:
standalone.options.processHighPrecision = value;
case CarlaBackend::OPTION_FORCE_STEREO:
standalone.options.forceStereo = value;
break;

case CarlaBackend::OPTION_MAX_PARAMETERS:
standalone.options.maxParameters = (value > 0) ? value : CarlaBackend::MAX_PARAMETERS;
case CarlaBackend::OPTION_PREFER_PLUGIN_BRIDGES:
standalone.options.preferPluginBridges = value;
break;

case CarlaBackend::OPTION_PREFERRED_BUFFER_SIZE:
standalone.options.preferredBufferSize = value;
case CarlaBackend::OPTION_PREFER_UI_BRIDGES:
standalone.options.preferUiBridges = value;
break;

case CarlaBackend::OPTION_PREFERRED_SAMPLE_RATE:
standalone.options.preferredSampleRate = value;
#ifdef WANT_DSSI
case CarlaBackend::OPTION_USE_DSSI_VST_CHUNKS:
standalone.options.useDssiVstChunks = value;
break;
#endif

case CarlaBackend::OPTION_FORCE_STEREO:
standalone.options.forceStereo = value;
case CarlaBackend::OPTION_MAX_PARAMETERS:
standalone.options.maxParameters = (value > 0) ? value : CarlaBackend::MAX_DEFAULT_PARAMETERS;
break;

case CarlaBackend::OPTION_USE_DSSI_VST_CHUNKS:
standalone.options.useDssiVstChunks = value;
case CarlaBackend::OPTION_OSC_UI_TIMEOUT:
standalone.options.oscUiTimeout = value;
break;

case CarlaBackend::OPTION_PREFER_PLUGIN_BRIDGES:
standalone.options.preferPluginBridges = value;
case CarlaBackend::OPTION_PREFERRED_BUFFER_SIZE:
standalone.options.preferredBufferSize = value;
break;

case CarlaBackend::OPTION_PREFER_UI_BRIDGES:
standalone.options.preferUiBridges = value;
case CarlaBackend::OPTION_PREFERRED_SAMPLE_RATE:
standalone.options.preferredSampleRate = value;
break;

case CarlaBackend::OPTION_OSC_UI_TIMEOUT:
standalone.options.oscUiTimeout = value;
case CarlaBackend::OPTION_PATH_BRIDGE_NATIVE:
standalone.options.bridge_native = valueStr;
break;

case CarlaBackend::OPTION_PATH_BRIDGE_POSIX32:
standalone.options.bridge_posix32 = value_str;
standalone.options.bridge_posix32 = valueStr;
break;
case CarlaBackend::OPTION_PATH_BRIDGE_POSIX64:
standalone.options.bridge_posix64 = value_str;
standalone.options.bridge_posix64 = valueStr;
break;
case CarlaBackend::OPTION_PATH_BRIDGE_WIN32:
standalone.options.bridge_win32 = value_str;
standalone.options.bridge_win32 = valueStr;
break;
case CarlaBackend::OPTION_PATH_BRIDGE_WIN64:
standalone.options.bridge_win64 = value_str;
standalone.options.bridge_win64 = valueStr;
break;

#ifdef WANT_LV2
case CarlaBackend::OPTION_PATH_BRIDGE_LV2_GTK2:
standalone.options.bridge_lv2gtk2 = value_str;
standalone.options.bridge_lv2gtk2 = valueStr;
break;
case CarlaBackend::OPTION_PATH_BRIDGE_LV2_GTK3:
standalone.options.bridge_lv2gtk3 = value_str;
standalone.options.bridge_lv2gtk3 = valueStr;
break;
case CarlaBackend::OPTION_PATH_BRIDGE_LV2_QT4:
standalone.options.bridge_lv2qt4 = value_str;
standalone.options.bridge_lv2qt4 = valueStr;
break;
case CarlaBackend::OPTION_PATH_BRIDGE_LV2_QT5:
standalone.options.bridge_lv2qt5 = value_str;
standalone.options.bridge_lv2qt5 = valueStr;
break;
case CarlaBackend::OPTION_PATH_BRIDGE_LV2_COCOA:
standalone.options.bridge_lv2cocoa = value_str;
standalone.options.bridge_lv2cocoa = valueStr;
break;
case CarlaBackend::OPTION_PATH_BRIDGE_LV2_WINDOWS:
standalone.options.bridge_lv2win = value_str;
standalone.options.bridge_lv2win = valueStr;
break;
case CarlaBackend::OPTION_PATH_BRIDGE_LV2_X11:
standalone.options.bridge_lv2x11 = value_str;
standalone.options.bridge_lv2x11 = valueStr;
break;

#endif
#ifdef WANT_VST
case CarlaBackend::OPTION_PATH_BRIDGE_VST_COCOA:
standalone.options.bridge_vstcocoa = value_str;
standalone.options.bridge_vstcocoa = valueStr;
break;
case CarlaBackend::OPTION_PATH_BRIDGE_VST_HWND:
standalone.options.bridge_vsthwnd = value_str;
standalone.options.bridge_vsthwnd = valueStr;
break;
case CarlaBackend::OPTION_PATH_BRIDGE_VST_X11:
standalone.options.bridge_vstx11 = value_str;
standalone.options.bridge_vstx11 = valueStr;
break;
#endif
}
}

#if 0
// -------------------------------------------------------------------------------------------------------------------

#define NSM_API_VERSION_MAJOR 1


+ 0
- 1023
source/carla.py
File diff suppressed because it is too large
View File


+ 165
- 699
source/carla_backend.py View File

@@ -20,551 +20,18 @@
# Imports (Global)

from ctypes import *
from subprocess import Popen, PIPE

# ------------------------------------------------------------------------------------------------------------
# Imports (Custom)

from carla_shared import *

try:
import ladspa_rdf
haveLRDF = True
except:
print("LRDF Support not available (LADSPA-RDF will be disabled)")
haveLRDF = False

# ------------------------------------------------------------------------------------------------------------
# Convert a ctypes struct into a python dict

def structToDict(struct):
return dict((attr, getattr(struct, attr)) for attr, value in struct._fields_)

# ------------------------------------------------------------------------------------------------------------
# Default Plugin Folders

if WINDOWS:
splitter = ";"
APPDATA = os.getenv("APPDATA")
PROGRAMFILES = os.getenv("PROGRAMFILES")
PROGRAMFILESx86 = os.getenv("PROGRAMFILES(x86)")
COMMONPROGRAMFILES = os.getenv("COMMONPROGRAMFILES")

# Small integrity tests
if not APPDATA:
print("APPDATA variable not set, cannot continue")
sys.exit(1)

if not PROGRAMFILES:
print("PROGRAMFILES variable not set, cannot continue")
sys.exit(1)

if not COMMONPROGRAMFILES:
print("COMMONPROGRAMFILES variable not set, cannot continue")
sys.exit(1)

DEFAULT_LADSPA_PATH = [
os.path.join(APPDATA, "LADSPA"),
os.path.join(PROGRAMFILES, "LADSPA")
]

DEFAULT_DSSI_PATH = [
os.path.join(APPDATA, "DSSI"),
os.path.join(PROGRAMFILES, "DSSI")
]

DEFAULT_LV2_PATH = [
os.path.join(APPDATA, "LV2"),
os.path.join(COMMONPROGRAMFILES, "LV2")
]

DEFAULT_VST_PATH = [
os.path.join(PROGRAMFILES, "VstPlugins"),
os.path.join(PROGRAMFILES, "Steinberg", "VstPlugins")
]

DEFAULT_GIG_PATH = [
os.path.join(APPDATA, "GIG")
]

DEFAULT_SF2_PATH = [
os.path.join(APPDATA, "SF2")
]

DEFAULT_SFZ_PATH = [
os.path.join(APPDATA, "SFZ")
]

if PROGRAMFILESx86:
DEFAULT_LADSPA_PATH.append(os.path.join(PROGRAMFILESx86, "LADSPA"))
DEFAULT_DSSI_PATH.append(os.path.join(PROGRAMFILESx86, "DSSI"))
DEFAULT_VST_PATH.append(os.path.join(PROGRAMFILESx86, "VstPlugins"))
DEFAULT_VST_PATH.append(os.path.join(PROGRAMFILESx86, "Steinberg", "VstPlugins"))

elif HAIKU:
splitter = ":"

DEFAULT_LADSPA_PATH = [
# TODO
]

DEFAULT_DSSI_PATH = [
# TODO
]

DEFAULT_LV2_PATH = [
# TODO
]

DEFAULT_VST_PATH = [
# TODO
]

DEFAULT_GIG_PATH = [
# TODO
]

DEFAULT_SF2_PATH = [
# TODO
]

DEFAULT_SFZ_PATH = [
# TODO
]

elif MACOS:
splitter = ":"

DEFAULT_LADSPA_PATH = [
os.path.join(HOME, "Library", "Audio", "Plug-Ins", "LADSPA"),
os.path.join("/", "Library", "Audio", "Plug-Ins", "LADSPA")
]

DEFAULT_DSSI_PATH = [
os.path.join(HOME, "Library", "Audio", "Plug-Ins", "DSSI"),
os.path.join("/", "Library", "Audio", "Plug-Ins", "DSSI")
]

DEFAULT_LV2_PATH = [
os.path.join(HOME, "Library", "Audio", "Plug-Ins", "LV2"),
os.path.join("/", "Library", "Audio", "Plug-Ins", "LV2")
]

DEFAULT_VST_PATH = [
os.path.join(HOME, "Library", "Audio", "Plug-Ins", "VST"),
os.path.join("/", "Library", "Audio", "Plug-Ins", "VST")
]

DEFAULT_GIG_PATH = [
# TODO
]

DEFAULT_SF2_PATH = [
# TODO
]

DEFAULT_SFZ_PATH = [
# TODO
]

else:
splitter = ":"

DEFAULT_LADSPA_PATH = [
os.path.join(HOME, ".ladspa"),
os.path.join("/", "usr", "lib", "ladspa"),
os.path.join("/", "usr", "local", "lib", "ladspa")
]

DEFAULT_DSSI_PATH = [
os.path.join(HOME, ".dssi"),
os.path.join("/", "usr", "lib", "dssi"),
os.path.join("/", "usr", "local", "lib", "dssi")
]

DEFAULT_LV2_PATH = [
os.path.join(HOME, ".lv2"),
os.path.join("/", "usr", "lib", "lv2"),
os.path.join("/", "usr", "local", "lib", "lv2")
]

DEFAULT_VST_PATH = [
os.path.join(HOME, ".vst"),
os.path.join("/", "usr", "lib", "vst"),
os.path.join("/", "usr", "local", "lib", "vst")
]

DEFAULT_GIG_PATH = [
os.path.join(HOME, ".sounds"),
os.path.join("/", "usr", "share", "sounds", "gig")
]

DEFAULT_SF2_PATH = [
os.path.join(HOME, ".sounds"),
os.path.join("/", "usr", "share", "sounds", "sf2")
]

DEFAULT_SFZ_PATH = [
os.path.join(HOME, ".sounds"),
os.path.join("/", "usr", "share", "sounds", "sfz")
]

# ------------------------------------------------------------------------------------------------------------
# Default Plugin Folders (set)

global LADSPA_PATH, DSSI_PATH, LV2_PATH, VST_PATH, GIG_PATH, SF2_PATH, SFZ_PATH

LADSPA_PATH = os.getenv("LADSPA_PATH", DEFAULT_LADSPA_PATH)
DSSI_PATH = os.getenv("DSSI_PATH", DEFAULT_DSSI_PATH)
LV2_PATH = os.getenv("LV2_PATH", DEFAULT_LV2_PATH)
VST_PATH = os.getenv("VST_PATH", DEFAULT_VST_PATH)
GIG_PATH = os.getenv("GIG_PATH", DEFAULT_GIG_PATH)
SF2_PATH = os.getenv("SF2_PATH", DEFAULT_SF2_PATH)
SFZ_PATH = os.getenv("SFZ_PATH", DEFAULT_SFZ_PATH)

if haveLRDF:
LADSPA_RDF_PATH_env = os.getenv("LADSPA_RDF_PATH")
if LADSPA_RDF_PATH_env:
ladspa_rdf.set_rdf_path(LADSPA_RDF_PATH_env.split(splitter))
del LADSPA_RDF_PATH_env

# ------------------------------------------------------------------------------------------------------------
# Search for Carla library and tools

global carla_library_path
carla_library_path = ""

carla_discovery_native = ""
carla_discovery_posix32 = ""
carla_discovery_posix64 = ""
carla_discovery_win32 = ""
carla_discovery_win64 = ""

carla_bridge_native = ""
carla_bridge_posix32 = ""
carla_bridge_posix64 = ""
carla_bridge_win32 = ""
carla_bridge_win64 = ""

carla_bridge_lv2_gtk2 = ""
carla_bridge_lv2_gtk3 = ""
carla_bridge_lv2_qt4 = ""
carla_bridge_lv2_qt5 = ""
carla_bridge_lv2_cocoa = ""
carla_bridge_lv2_windows = ""
carla_bridge_lv2_x11 = ""

carla_bridge_vst_cocoa = ""
carla_bridge_vst_hwnd = ""
carla_bridge_vst_x11 = ""

if WINDOWS:
carla_libname = "libcarla_standalone.dll"
elif MACOS:
carla_libname = "libcarla_standalone.dylib"
else:
carla_libname = "libcarla_standalone.so"

CWD = sys.path[0]

# make it work with cxfreeze
if CWD.endswith("%scarla" % os.sep):
CWD = CWD.rsplit("%scarla" % os.sep, 1)[0]

# find carla_library_path
if os.path.exists(os.path.join(CWD, "backend", carla_libname)):
carla_library_path = os.path.join(CWD, "backend", carla_libname)
else:
if WINDOWS:
CARLA_PATH = (os.path.join(PROGRAMFILES, "Carla"),)
elif MACOS:
CARLA_PATH = ("/opt/local/lib", "/usr/local/lib/", "/usr/lib")
else:
CARLA_PATH = ("/usr/local/lib/", "/usr/lib")

for path in CARLA_PATH:
if os.path.exists(os.path.join(path, "carla", carla_libname)):
carla_library_path = os.path.join(path, "carla", carla_libname)
break

# find any tool
def findTool(tdir, tname):
if os.path.exists(os.path.join(CWD, tdir, tname)):
return os.path.join(CWD, tdir, tname)

for p in PATH:
if os.path.exists(os.path.join(p, tname)):
return os.path.join(p, tname)

return ""

# find wine/windows tools
carla_discovery_win32 = findTool("carla-discovery", "carla-discovery-win32.exe")
carla_discovery_win64 = findTool("carla-discovery", "carla-discovery-win64.exe")
carla_bridge_win32 = findTool("carla-bridge", "carla-bridge-win32.exe")
carla_bridge_win64 = findTool("carla-bridge", "carla-bridge-win64.exe")

# find native and posix tools
if not WINDOWS:
carla_discovery_native = findTool("carla-discovery", "carla-discovery-native")
carla_discovery_posix32 = findTool("carla-discovery", "carla-discovery-posix32")
carla_discovery_posix64 = findTool("carla-discovery", "carla-discovery-posix64")
carla_bridge_native = findTool("carla-bridge", "carla-bridge-native")
carla_bridge_posix32 = findTool("carla-bridge", "carla-bridge-posix32")
carla_bridge_posix64 = findTool("carla-bridge", "carla-bridge-posix64")

# find windows only tools
if WINDOWS:
carla_bridge_lv2_windows = findTool("carla-bridge", "carla-bridge-lv2-windows.exe")
carla_bridge_vst_hwnd = findTool("carla-bridge", "carla-bridge-vst-hwnd.exe")

# find mac os only tools
elif MACOS:
carla_bridge_lv2_cocoa = findTool("carla-bridge", "carla-bridge-lv2-cocoa")
carla_bridge_vst_cocoa = findTool("carla-bridge", "carla-bridge-vst-cocoa")

# find generic tools
else:
carla_bridge_lv2_gtk2 = findTool("carla-bridge", "carla-bridge-lv2-gtk2")
carla_bridge_lv2_gtk3 = findTool("carla-bridge", "carla-bridge-lv2-gtk3")
carla_bridge_lv2_qt4 = findTool("carla-bridge", "carla-bridge-lv2-qt4")
carla_bridge_lv2_qt5 = findTool("carla-bridge", "carla-bridge-lv2-qt5")

# find linux only tools
if LINUX:
carla_bridge_lv2_x11 = os.path.join("carla-bridge", "carla-bridge-lv2-x11")
carla_bridge_vst_x11 = os.path.join("carla-bridge", "carla-bridge-vst-x11")

# ------------------------------------------------------------------------------------------------------------
# Plugin Query (helper functions)

def findBinaries(bPATH, OS):
binaries = []

if OS == "WINDOWS":
extensions = (".dll",)
elif OS == "MACOS":
extensions = (".dylib", ".so")
else:
extensions = (".so", ".sO", ".SO", ".So")

for root, dirs, files in os.walk(bPATH):
for name in [name for name in files if name.endswith(extensions)]:
binaries.append(os.path.join(root, name))

return binaries

# FIXME - may use any extension, just needs to have manifest.ttl
def findLV2Bundles(bPATH):
bundles = []
extensions = (".lv2", ".lV2", ".LV2", ".Lv2") if not WINDOWS else (".lv2",)

for root, dirs, files in os.walk(bPATH):
for dir_ in [dir_ for dir_ in dirs if dir_.endswith(extensions)]:
bundles.append(os.path.join(root, dir_))

return bundles

def findSoundKits(bPATH, stype):
soundfonts = []

if stype == "gig":
extensions = (".gig", ".giG", ".gIG", ".GIG", ".GIg", ".Gig") if not WINDOWS else (".gig",)
elif stype == "sf2":
extensions = (".sf2", ".sF2", ".SF2", ".Sf2") if not WINDOWS else (".sf2",)
elif stype == "sfz":
extensions = (".sfz", ".sfZ", ".sFZ", ".SFZ", ".SFz", ".Sfz") if not WINDOWS else (".sfz",)
else:
return []

for root, dirs, files in os.walk(bPATH):
for name in [name for name in files if name.endswith(extensions)]:
soundfonts.append(os.path.join(root, name))

return soundfonts

def findDSSIGUI(filename, name, label):
pluginDir = filename.rsplit(".", 1)[0]
shortName = os.path.basename(pluginDir)
guiFilename = ""

checkName = name.replace(" ", "_")
checkLabel = label
checkSName = shortName

if checkName[-1] != "_": checkName += "_"
if checkLabel[-1] != "_": checkLabel += "_"
if checkSName[-1] != "_": checkSName += "_"

for root, dirs, files in os.walk(pluginDir):
guiFiles = files
break
else:
guiFiles = []

for gui in guiFiles:
if gui.startswith(checkName) or gui.startswith(checkLabel) or gui.startswith(checkSName):
guiFilename = os.path.join(pluginDir, gui)
break

return guiFilename

# ------------------------------------------------------------------------------------------------------------
# Plugin Query

PLUGIN_QUERY_API_VERSION = 1

PyPluginInfo = {
'API': PLUGIN_QUERY_API_VERSION,
'build': 0, # BINARY_NONE
'type': 0, # PLUGIN_NONE
'hints': 0x0,
'binary': "",
'name': "",
'label': "",
'maker': "",
'copyright': "",
'uniqueId': 0,
'audio.ins': 0,
'audio.outs': 0,
'audio.totals': 0,
'midi.ins': 0,
'midi.outs': 0,
'midi.totals': 0,
'parameters.ins': 0,
'parameters.outs': 0,
'parameters.total': 0,
'programs.total': 0
}

def runCarlaDiscovery(itype, stype, filename, tool, isWine=False):
fakeLabel = os.path.basename(filename).rsplit(".", 1)[0]
plugins = []
command = []

if LINUX or MACOS:
command.append("env")
command.append("LANG=C")
if isWine:
command.append("WINEDEBUG=-all")

command.append(tool)
command.append(stype)
command.append(filename)

Ps = Popen(command, stdout=PIPE)
Ps.wait()
output = Ps.stdout.read().decode("utf-8", errors="ignore").split("\n")

pinfo = None

for line in output:
line = line.strip()
if line == "carla-discovery::init::-----------":
pinfo = deepcopy(PyPluginInfo)
pinfo['type'] = itype
pinfo['binary'] = filename

elif line == "carla-discovery::end::------------":
if pinfo != None:
plugins.append(pinfo)
pinfo = None

elif line == "Segmentation fault":
print("carla-discovery::crash::%s crashed during discovery" % filename)

elif line.startswith("err:module:import_dll Library"):
print(line)

elif line.startswith("carla-discovery::error::"):
print("%s - %s" % (line, filename))

elif line.startswith("carla-discovery::"):
if pinfo == None:
continue

prop, value = line.replace("carla-discovery::", "").split("::", 1)

if prop == "name":
pinfo['name'] = value if value else fakeLabel
elif prop == "label":
pinfo['label'] = value if value else fakeLabel
elif prop == "maker":
pinfo['maker'] = value
elif prop == "copyright":
pinfo['copyright'] = value
elif prop == "uniqueId":
if value.isdigit(): pinfo['uniqueId'] = int(value)
elif prop == "hints":
if value.isdigit(): pinfo['hints'] = int(value)
elif prop == "audio.ins":
if value.isdigit(): pinfo['audio.ins'] = int(value)
elif prop == "audio.outs":
if value.isdigit(): pinfo['audio.outs'] = int(value)
elif prop == "audio.total":
if value.isdigit(): pinfo['audio.total'] = int(value)
elif prop == "midi.ins":
if value.isdigit(): pinfo['midi.ins'] = int(value)
elif prop == "midi.outs":
if value.isdigit(): pinfo['midi.outs'] = int(value)
elif prop == "midi.total":
if value.isdigit(): pinfo['midi.total'] = int(value)
elif prop == "parameters.ins":
if value.isdigit(): pinfo['parameters.ins'] = int(value)
elif prop == "parameters.outs":
if value.isdigit(): pinfo['parameters.outs'] = int(value)
elif prop == "parameters.total":
if value.isdigit(): pinfo['parameters.total'] = int(value)
elif prop == "programs.total":
if value.isdigit(): pinfo['programs.total'] = int(value)
elif prop == "build":
if value.isdigit(): pinfo['build'] = int(value)

# Additional checks
for pinfo in plugins:
if itype == PLUGIN_DSSI:
if findDSSIGUI(pinfo['binary'], pinfo['name'], pinfo['label']):
pinfo['hints'] |= PLUGIN_HAS_GUI

return plugins

def checkPluginInternal(desc):
plugins = []

pinfo = deepcopy(PyPluginInfo)
pinfo['type'] = PLUGIN_INTERNAL
pinfo['name'] = cString(desc['name'])
pinfo['label'] = cString(desc['label'])
pinfo['maker'] = cString(desc['maker'])
pinfo['copyright'] = cString(desc['copyright'])
pinfo['hints'] = int(desc['hints'])
pinfo['build'] = BINARY_NATIVE

plugins.append(pinfo)

return plugins

def checkPluginLADSPA(filename, tool, isWine=False):
return runCarlaDiscovery(PLUGIN_LADSPA, "LADSPA", filename, tool, isWine)

def checkPluginDSSI(filename, tool, isWine=False):
return runCarlaDiscovery(PLUGIN_DSSI, "DSSI", filename, tool, isWine)

def checkPluginLV2(filename, tool, isWine=False):
return runCarlaDiscovery(PLUGIN_LV2, "LV2", filename, tool, isWine)

def checkPluginVST(filename, tool, isWine=False):
return runCarlaDiscovery(PLUGIN_VST, "VST", filename, tool, isWine)

def checkPluginGIG(filename, tool):
return runCarlaDiscovery(PLUGIN_GIG, "GIG", filename, tool)

def checkPluginSF2(filename, tool):
return runCarlaDiscovery(PLUGIN_SF2, "SF2", filename, tool)

def checkPluginSFZ(filename, tool):
return runCarlaDiscovery(PLUGIN_SFZ, "SFZ", filename, tool)

# ------------------------------------------------------------------------------------------------------------
# Backend C++ -> Python variables

@@ -705,6 +172,9 @@ class Host(object):
self.lib.carla_engine_close.argtypes = None
self.lib.carla_engine_close.restype = c_bool

self.lib.carla_engine_idle.argtypes = None
self.lib.carla_engine_idle.restype = None

self.lib.carla_is_engine_running.argtypes = None
self.lib.carla_is_engine_running.restype = c_bool

@@ -759,104 +229,103 @@ class Host(object):
self.lib.carla_get_custom_data_count.argtypes = [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.restype = c_char_p

#self.lib.carla_get_program_name.argtypes = [c_uint, c_uint32]
#self.lib.carla_get_program_name.restype = c_char_p
self.lib.carla_get_parameter_text.argtypes = [c_uint, c_uint32]
self.lib.carla_get_parameter_text.restype = c_char_p

#self.lib.carla_get_midi_program_name.argtypes = [c_uint, c_uint32]
#self.lib.carla_get_midi_program_name.restype = c_char_p
self.lib.carla_get_program_name.argtypes = [c_uint, c_uint32]
self.lib.carla_get_program_name.restype = c_char_p

#self.lib.carla_get_real_plugin_name.argtypes = [c_uint]
#self.lib.carla_get_real_plugin_name.restype = c_char_p
self.lib.carla_get_midi_program_name.argtypes = [c_uint, c_uint32]
self.lib.carla_get_midi_program_name.restype = c_char_p

#self.lib.carla_get_current_program_index.argtypes = [c_uint]
#self.lib.carla_get_current_program_index.restype = c_int32
self.lib.carla_get_real_plugin_name.argtypes = [c_uint]
self.lib.carla_get_real_plugin_name.restype = c_char_p

#self.lib.carla_get_current_midi_program_index.argtypes = [c_uint]
#self.lib.carla_get_current_midi_program_index.restype = c_int32
self.lib.carla_get_current_program_index.argtypes = [c_uint]
self.lib.carla_get_current_program_index.restype = c_int32

#self.lib.carla_get_default_parameter_value.argtypes = [c_uint, c_uint32]
#self.lib.carla_get_default_parameter_value.restype = c_double
self.lib.carla_get_current_midi_program_index.argtypes = [c_uint]
self.lib.carla_get_current_midi_program_index.restype = c_int32

#self.lib.carla_get_current_parameter_value.argtypes = [c_uint, c_uint32]
#self.lib.carla_get_current_parameter_value.restype = c_double
# TODO - consider removal
self.lib.carla_get_default_parameter_value.argtypes = [c_uint, c_uint32]
self.lib.carla_get_default_parameter_value.restype = c_float

#self.lib.carla_get_input_peak_value.argtypes = [c_uint, c_ushort]
#self.lib.carla_get_input_peak_value.restype = c_double
# TODO - consider removal
self.lib.carla_get_current_parameter_value.argtypes = [c_uint, c_uint32]
self.lib.carla_get_current_parameter_value.restype = c_float

#self.lib.carla_get_output_peak_value.argtypes = [c_uint, c_ushort]
#self.lib.carla_get_output_peak_value.restype = c_double
self.lib.carla_get_input_peak_value.argtypes = [c_uint, c_ushort]
self.lib.carla_get_input_peak_value.restype = c_float

#self.lib.carla_set_active.argtypes = [c_uint, c_bool]
#self.lib.carla_set_active.restype = None
self.lib.carla_get_output_peak_value.argtypes = [c_uint, c_ushort]
self.lib.carla_get_output_peak_value.restype = c_float

#self.lib.carla_set_drywet.argtypes = [c_uint, c_double]
#self.lib.carla_set_drywet.restype = None
self.lib.carla_set_active.argtypes = [c_uint, c_bool]
self.lib.carla_set_active.restype = None

#self.lib.carla_set_volume.argtypes = [c_uint, c_double]
#self.lib.carla_set_volume.restype = None
self.lib.carla_set_drywet.argtypes = [c_uint, c_float]
self.lib.carla_set_drywet.restype = None

#self.lib.carla_set_balance_left.argtypes = [c_uint, c_double]
#self.lib.carla_set_balance_left.restype = None
self.lib.carla_set_volume.argtypes = [c_uint, c_float]
self.lib.carla_set_volume.restype = None

#self.lib.carla_set_balance_right.argtypes = [c_uint, c_double]
#self.lib.carla_set_balance_right.restype = None
self.lib.carla_set_balance_left.argtypes = [c_uint, c_float]
self.lib.carla_set_balance_left.restype = None

#self.lib.carla_set_parameter_value.argtypes = [c_uint, c_uint32, c_double]
#self.lib.carla_set_parameter_value.restype = None
self.lib.carla_set_balance_right.argtypes = [c_uint, c_float]
self.lib.carla_set_balance_right.restype = None

#self.lib.carla_set_parameter_midi_cc.argtypes = [c_uint, c_uint32, c_int16]
#self.lib.carla_set_parameter_midi_cc.restype = None
self.lib.carla_set_panning.argtypes = [c_uint, c_float]
self.lib.carla_set_panning.restype = None

#self.lib.carla_set_parameter_midi_channel.argtypes = [c_uint, c_uint32, c_uint8]
#self.lib.carla_set_parameter_midi_channel.restype = None
self.lib.carla_set_parameter_value.argtypes = [c_uint, c_uint32, c_float]
self.lib.carla_set_parameter_value.restype = None

#self.lib.carla_set_program.argtypes = [c_uint, c_uint32]
#self.lib.carla_set_program.restype = None
self.lib.carla_set_parameter_midi_cc.argtypes = [c_uint, c_uint32, c_int16]
self.lib.carla_set_parameter_midi_cc.restype = None

#self.lib.carla_set_midi_program.argtypes = [c_uint, c_uint32]
#self.lib.carla_set_midi_program.restype = None
self.lib.carla_set_parameter_midi_channel.argtypes = [c_uint, c_uint32, c_uint8]
self.lib.carla_set_parameter_midi_channel.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.restype = None
self.lib.carla_set_program.argtypes = [c_uint, c_uint32]
self.lib.carla_set_program.restype = None

#self.lib.carla_set_chunk_data.argtypes = [c_uint, c_char_p]
#self.lib.carla_set_chunk_data.restype = None
self.lib.carla_set_midi_program.argtypes = [c_uint, c_uint32]
self.lib.carla_set_midi_program.restype = None

#self.lib.carla_set_gui_container.argtypes = [c_uint, c_uintptr]
#self.lib.carla_set_gui_container.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.restype = None

#self.lib.show_gui.argtypes = [c_uint, c_bool]
#self.lib.show_gui.restype = None
self.lib.carla_set_chunk_data.argtypes = [c_uint, c_char_p]
self.lib.carla_set_chunk_data.restype = None

#self.lib.idle_guis.argtypes = None
#self.lib.idle_guis.restype = None
self.lib.carla_prepare_for_save.argtypes = [c_uint]
self.lib.carla_prepare_for_save.restype = None

#self.lib.send_midi_note.argtypes = [c_uint, c_uint8, c_uint8, c_uint8]
#self.lib.send_midi_note.restype = None
self.lib.carla_send_midi_note.argtypes = [c_uint, c_uint8, c_uint8, c_uint8]
self.lib.carla_send_midi_note.restype = None

#self.lib.prepare_for_save.argtypes = [c_uint]
#self.lib.prepare_for_save.restype = None
self.lib.carla_show_gui.argtypes = [c_uint, c_bool]
self.lib.carla_show_gui.restype = None

#self.lib.carla_get_buffer_size.argtypes = None
#self.lib.carla_get_buffer_size.restype = c_uint32
self.lib.carla_get_buffer_size.argtypes = None
self.lib.carla_get_buffer_size.restype = c_uint32

#self.lib.carla_get_sample_rate.argtypes = None
#self.lib.carla_get_sample_rate.restype = c_double
self.lib.carla_get_sample_rate.argtypes = None
self.lib.carla_get_sample_rate.restype = c_double

#self.lib.carla_get_last_error.argtypes = None
#self.lib.carla_get_last_error.restype = c_char_p
self.lib.carla_get_last_error.argtypes = None
self.lib.carla_get_last_error.restype = c_char_p

#self.lib.carla_get_host_osc_url.argtypes = None
#self.lib.carla_get_host_osc_url.restype = c_char_p
self.lib.carla_get_host_osc_url.argtypes = None
self.lib.carla_get_host_osc_url.restype = c_char_p

#self.lib.carla_set_callback_function.argtypes = [CallbackFunc]
#self.lib.carla_set_callback_function.restype = None
self.lib.carla_set_callback_function.argtypes = [CallbackFunc]
self.lib.carla_set_callback_function.restype = None

#self.lib.carla_set_option.argtypes = [c_enum, c_int, c_char_p]
#self.lib.carla_set_option.restype = None
self.lib.carla_set_option.argtypes = [c_enum, c_int, c_char_p]
self.lib.carla_set_option.restype = None

#self.lib.nsm_announce.argtypes = [c_char_p, c_int]
#self.lib.nsm_announce.restype = None
@@ -888,6 +357,9 @@ class Host(object):
def engine_close(self):
return self.lib.carla_engine_close()

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

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

@@ -925,126 +397,120 @@ class Host(object):
def get_midi_program_data(self, pluginId, midiProgramId):
return structToDict(self.lib.carla_get_midi_program_data(pluginId, midiProgramId).contents)

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

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

#def get_gui_info(self, pluginId):
#return structToDict(self.lib.carla_get_gui_info(pluginId).contents)
def get_custom_data(self, pluginId, customDataId):
return structToDict(self.lib.carla_get_custom_data(pluginId, customDataId).contents)

#def get_parameter_count(self, pluginId):
#return self.lib.carla_get_parameter_count(pluginId)
def get_chunk_data(self, pluginId):
return self.lib.carla_get_chunk_data(pluginId)

#def get_program_count(self, pluginId):
#return self.lib.carla_get_program_count(pluginId)
def get_parameter_count(self, pluginId):
return self.lib.carla_get_parameter_count(pluginId)

#def get_midi_program_count(self, pluginId):
#return self.lib.carla_get_midi_program_count(pluginId)
def get_program_count(self, pluginId):
return self.lib.carla_get_program_count(pluginId)

#def get_custom_data_count(self, pluginId):
#return self.lib.carla_get_custom_data_count(pluginId)
def get_midi_program_count(self, pluginId):
return self.lib.carla_get_midi_program_count(pluginId)

#def get_parameter_text(self, pluginId, parameterId):
#return self.lib.carla_get_parameter_text(pluginId, parameterId)
def get_custom_data_count(self, pluginId):
return self.lib.carla_get_custom_data_count(pluginId)

#def get_program_name(self, pluginId, programId):
#return self.lib.carla_get_program_name(pluginId, programId)
def get_parameter_text(self, pluginId, parameterId):
return self.lib.carla_get_parameter_text(pluginId, parameterId)

#def get_midi_program_name(self, pluginId, midiProgramId):
#return self.lib.carla_get_midi_program_name(pluginId, midiProgramId)
def get_program_name(self, pluginId, programId):
return self.lib.carla_get_program_name(pluginId, programId)

#def get_real_plugin_name(self, pluginId):
#return self.lib.carla_get_real_plugin_name(pluginId)
def get_midi_program_name(self, pluginId, midiProgramId):
return self.lib.carla_get_midi_program_name(pluginId, midiProgramId)

#def get_current_program_index(self, pluginId):
#return self.lib.carla_get_current_program_index(pluginId)
def get_real_plugin_name(self, pluginId):
return self.lib.carla_get_real_plugin_name(pluginId)

#def get_current_midi_program_index(self, pluginId):
#return self.lib.carla_get_current_midi_program_index(pluginId)
def get_current_program_index(self, pluginId):
return self.lib.carla_get_current_program_index(pluginId)

#def get_default_parameter_value(self, pluginId, parameterId):
#return self.lib.carla_get_default_parameter_value(pluginId, parameterId)
def get_current_midi_program_index(self, pluginId):
return self.lib.carla_get_current_midi_program_index(pluginId)

#def get_current_parameter_value(self, pluginId, parameterId):
#return self.lib.carla_get_current_parameter_value(pluginId, parameterId)
def get_default_parameter_value(self, pluginId, parameterId):
return self.lib.carla_get_default_parameter_value(pluginId, parameterId)

#def get_input_peak_value(self, pluginId, portId):
#return self.lib.carla_get_input_peak_value(pluginId, portId)
def get_current_parameter_value(self, pluginId, parameterId):
return self.lib.carla_get_current_parameter_value(pluginId, parameterId)

#def get_output_peak_value(self, pluginId, portId):
#return self.lib.carla_get_output_peak_value(pluginId, portId)
def get_input_peak_value(self, pluginId, portId):
return self.lib.carla_get_input_peak_value(pluginId, portId)

#def set_active(self, pluginId, onOff):
#self.lib.carla_set_active(pluginId, onOff)
def get_output_peak_value(self, pluginId, portId):
return self.lib.carla_get_output_peak_value(pluginId, portId)

#def set_drywet(self, pluginId, value):
#self.lib.carla_set_drywet(pluginId, value)
def set_active(self, pluginId, onOff):
self.lib.carla_set_active(pluginId, onOff)

#def set_volume(self, pluginId, value):
#self.lib.carla_set_volume(pluginId, value)
def set_drywet(self, pluginId, value):
self.lib.carla_set_drywet(pluginId, value)

#def set_balance_left(self, pluginId, value):
#self.lib.carla_set_balance_left(pluginId, value)
def set_volume(self, pluginId, value):
self.lib.carla_set_volume(pluginId, value)

#def set_balance_right(self, pluginId, value):
#self.lib.carla_set_balance_right(pluginId, value)
def set_balance_left(self, pluginId, value):
self.lib.carla_set_balance_left(pluginId, value)

#def set_parameter_value(self, pluginId, parameterId, value):
#self.lib.carla_set_parameter_value(pluginId, parameterId, value)
def set_balance_right(self, pluginId, value):
self.lib.carla_set_balance_right(pluginId, value)

#def set_parameter_midi_cc(self, pluginId, parameterId, cc):
#self.lib.carla_set_parameter_midi_cc(pluginId, parameterId, cc)
def set_panning(self, pluginId, value):
self.lib.carla_set_panning(pluginId, value)

#def set_parameter_midi_channel(self, pluginId, parameterId, channel):
#self.lib.carla_set_parameter_midi_channel(pluginId, parameterId, channel)
def set_parameter_value(self, pluginId, parameterId, value):
self.lib.carla_set_parameter_value(pluginId, parameterId, value)

#def set_program(self, pluginId, programId):
#self.lib.carla_set_program(pluginId, programId)
def set_parameter_midi_cc(self, pluginId, parameterId, cc):
self.lib.carla_set_parameter_midi_cc(pluginId, parameterId, cc)

#def set_midi_program(self, pluginId, midiProgramId):
#self.lib.carla_set_midi_program(pluginId, midiProgramId)
def set_parameter_midi_channel(self, pluginId, parameterId, channel):
self.lib.carla_set_parameter_midi_channel(pluginId, parameterId, channel)

#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"))
def set_program(self, pluginId, programId):
self.lib.carla_set_program(pluginId, programId)

#def set_chunk_data(self, pluginId, chunkData):
#self.lib.carla_set_chunk_data(pluginId, chunkData.encode("utf-8"))
def set_midi_program(self, pluginId, midiProgramId):
self.lib.carla_set_midi_program(pluginId, midiProgramId)

#def set_gui_container(self, pluginId, guiAddr):
#self.lib.carla_set_gui_container(pluginId, guiAddr)
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"))

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

#def idle_guis(self):
#self.lib.idle_guis()
def prepare_for_save(self, pluginId):
self.lib.carla_prepare_for_save(pluginId)

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

#def prepare_for_save(self, pluginId):
#self.lib.prepare_for_save(pluginId)
def show_gui(self, pluginId, yesNo):
self.lib.carla_show_gui(pluginId, yesNo)

#def set_callback_function(self, func):
#self.callback = CallbackFunc(func)
#self.lib.carla_set_callback_function(self.callback)
def get_last_error(self):
return self.lib.carla_get_last_error()

#def set_option(self, option, value, valueStr):
#self.lib.carla_set_option(option, value, valueStr.encode("utf-8"))
def get_host_osc_url(self):
return self.lib.carla_get_host_osc_url()

#def get_last_error(self):
#return self.lib.carla_get_last_error()
def get_buffer_size(self):
return self.lib.carla_get_buffer_size()

#def get_host_osc_url(self):
#return self.lib.carla_get_host_osc_url()
def get_sample_rate(self):
return self.lib.carla_get_sample_rate()

#def get_buffer_size(self):
#return self.lib.carla_get_buffer_size()
def set_callback_function(self, func):
self._callback = CallbackFunc(func)
self.lib.carla_set_callback_function(self._callback)

#def get_sample_rate(self):
#return self.lib.carla_get_sample_rate()
def set_option(self, option, value, valueStr):
self.lib.carla_set_option(option, value, valueStr.encode("utf-8"))

#def nsm_announce(self, url, pid):
#self.lib.nsm_announce(url.encode("utf-8"), pid)
@@ -1055,19 +521,19 @@ class Host(object):
#def nsm_reply_save(self):
#self.lib.nsm_reply_save()

Carla.host = Host(None)
# Test available drivers
driverCount = Carla.host.get_engine_driver_count()
driverList = []
for i in range(driverCount):
driver = cString(Carla.host.get_engine_driver_name(i))
if driver:
driverList.append(driver)
print(i, driver)
# Test available internal plugins
pluginCount = Carla.host.get_internal_plugin_count()
for i in range(pluginCount):
plugin = Carla.host.get_internal_plugin_info(i)
print(plugin)
#Carla.host = Host(None)
## Test available drivers
#driverCount = Carla.host.get_engine_driver_count()
#driverList = []
#for i in range(driverCount):
#driver = cString(Carla.host.get_engine_driver_name(i))
#if driver:
#driverList.append(driver)
#print(i, driver)
## Test available internal plugins
#pluginCount = Carla.host.get_internal_plugin_count()
#for i in range(pluginCount):
#plugin = Carla.host.get_internal_plugin_info(i)
#print(plugin)

+ 1658
- 82
source/carla_shared.py
File diff suppressed because it is too large
View File


Loading…
Cancel
Save