Browse Source

Update native plugin API to not conflict with backend C API

tags/1.9.4
falkTX 11 years ago
parent
commit
76f7ededd0
30 changed files with 470 additions and 471 deletions
  1. +3
    -2
      source/backend/CarlaHost.h
  2. +2
    -2
      source/backend/CarlaPlugin.hpp
  3. +50
    -51
      source/backend/plugin/NativePlugin.cpp
  4. +16
    -18
      source/backend/standalone/CarlaStandalone.cpp
  5. +72
    -71
      source/modules/CarlaNative.h
  6. +41
    -41
      source/modules/CarlaNative.hpp
  7. +11
    -11
      source/modules/carla_native/audio-file.cpp
  8. +4
    -4
      source/modules/carla_native/bypass.c
  9. +3
    -3
      source/modules/carla_native/distrho-3bandeq.cpp
  10. +3
    -3
      source/modules/carla_native/distrho-3bandsplitter.cpp
  11. +3
    -3
      source/modules/carla_native/distrho-bigmeter.cpp
  12. +3
    -3
      source/modules/carla_native/distrho-bigmeterM.cpp
  13. +3
    -3
      source/modules/carla_native/distrho-nekobi.cpp
  14. +3
    -3
      source/modules/carla_native/distrho-notes.cpp
  15. +3
    -3
      source/modules/carla_native/distrho-pingpongpan.cpp
  16. +3
    -3
      source/modules/carla_native/distrho-stereoenhancer.cpp
  17. +16
    -16
      source/modules/carla_native/distrho/DistrhoPluginCarla.cpp
  18. +13
    -13
      source/modules/carla_native/lfo.c
  19. +12
    -12
      source/modules/carla_native/midi-file.cpp
  20. +14
    -14
      source/modules/carla_native/midi-gain.c
  21. +10
    -10
      source/modules/carla_native/midi-sequencer.cpp
  22. +7
    -7
      source/modules/carla_native/midi-split.c
  23. +5
    -5
      source/modules/carla_native/midi-through.c
  24. +13
    -13
      source/modules/carla_native/midi-transpose.c
  25. +2
    -2
      source/modules/carla_native/nekofilter.c
  26. +16
    -16
      source/modules/carla_native/nekofilter/nekofilter.c
  27. +2
    -2
      source/modules/carla_native/nekofilter/ui.c
  28. +45
    -45
      source/modules/carla_native/vex-fx.cpp
  29. +73
    -73
      source/modules/carla_native/zynaddsubfx-fx.cpp
  30. +19
    -19
      source/modules/carla_native/zynaddsubfx-synth.cpp

+ 3
- 2
source/backend/CarlaHost.h View File

@@ -508,9 +508,10 @@ CARLA_EXPORT const EngineDriverDeviceInfo* carla_get_engine_driver_device_info(u
CARLA_EXPORT unsigned int carla_get_internal_plugin_count();

/*!
* Get information about the internal plugin \a internalPluginId.
* Get information about an internal plugin.
* @param index Internal plugin Id
*/
CARLA_EXPORT const CarlaNativePluginInfo* carla_get_internal_plugin_info(unsigned int internalPluginId);
CARLA_EXPORT const CarlaNativePluginInfo* carla_get_internal_plugin_info(unsigned int index);

#ifdef __cplusplus
/*!


+ 2
- 2
source/backend/CarlaPlugin.hpp View File

@@ -23,7 +23,7 @@

// Avoid including extra libs here
typedef void* lo_address;
typedef struct _PluginDescriptor PluginDescriptor;
typedef struct _NativePluginDescriptor NativePluginDescriptor;
#ifndef LADSPA_RDF_HPP_INCLUDED
struct LADSPA_RDF_Descriptor;
#endif
@@ -852,7 +852,7 @@ public:
};

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

static CarlaPlugin* newNative(const Initializer& init);
static CarlaPlugin* newBridge(const Initializer& init, const BinaryType btype, const PluginType ptype, const char* const bridgeBinary);


+ 50
- 51
source/backend/plugin/NativePlugin.cpp View File

@@ -120,8 +120,8 @@ public:
carla_debug("NativePlugin::NativePlugin(%p, %i)", engine, id);

carla_fill<int32_t>(fCurMidiProgs, MAX_MIDI_CHANNELS, 0);
carla_zeroStruct< ::MidiEvent>(fMidiEvents, kPluginMaxMidiEvents*2);
carla_zeroStruct< ::TimeInfo>(fTimeInfo);
carla_zeroStruct<NativeMidiEvent>(fMidiEvents, kPluginMaxMidiEvents*2);
carla_zeroStruct<NativeTimeInfo>(fTimeInfo);

fHost.handle = this;
fHost.resourceDir = carla_strdup((const char*)engine->getOptions().resourceDir);
@@ -145,7 +145,7 @@ public:
carla_debug("NativePlugin::~NativePlugin()");

// close UI
if (fHints & PLUGIN_HAS_GUI)
if (fHints & PLUGIN_HAS_UI)
{
if (fIsUiVisible && fDescriptor != nullptr && fDescriptor->ui_show != nullptr && fHandle != nullptr)
fDescriptor->ui_show(fHandle, false);
@@ -230,7 +230,7 @@ public:
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr, 0);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, 0);

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

carla_safe_assert("const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)", __FILE__, __LINE__);
@@ -299,9 +299,9 @@ public:
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, 0.0f);
CARLA_SAFE_ASSERT_RETURN(scalePointId < getParameterScalePointCount(parameterId), 0.0f);

if (const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId))
if (const NativeParameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId))
{
const ParameterScalePoint* scalePoint(&param->scalePoints[scalePointId]);
const NativeParameterScalePoint* scalePoint(&param->scalePoints[scalePointId]);
return scalePoint->value;
}

@@ -356,7 +356,7 @@ public:
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);

if (const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId))
if (const NativeParameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId))
{
if (param->name != nullptr)
{
@@ -398,7 +398,7 @@ public:
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);

if (const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId))
if (const NativeParameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId))
{
if (param->unit != nullptr)
{
@@ -420,9 +420,9 @@ public:
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
CARLA_SAFE_ASSERT_RETURN(scalePointId < getParameterScalePointCount(parameterId),);

if (const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId))
if (const NativeParameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId))
{
const ParameterScalePoint* scalePoint(&param->scalePoints[scalePointId]);
const NativeParameterScalePoint* scalePoint(&param->scalePoints[scalePointId]);

if (scalePoint->label != nullptr)
{
@@ -889,12 +889,9 @@ public:

for (j=0; j < params; ++j)
{
const ::Parameter* const paramInfo(fDescriptor->get_parameter_info(fHandle, j));
const NativeParameter* const paramInfo(fDescriptor->get_parameter_info(fHandle, j));

CARLA_ASSERT(paramInfo != nullptr);

if (paramInfo == nullptr)
continue;
CARLA_SAFE_ASSERT_CONTINUE(paramInfo != nullptr);

pData->param.data[j].index = j;
pData->param.data[j].rindex = j;
@@ -1045,8 +1042,10 @@ public:
// native plugin hints
if (fDescriptor->hints & ::PLUGIN_IS_RTSAFE)
fHints |= PLUGIN_IS_RTSAFE;
if (fDescriptor->hints & ::PLUGIN_HAS_GUI)
fHints |= PLUGIN_HAS_GUI;
if (fDescriptor->hints & ::PLUGIN_IS_SYNTH)
fHints |= PLUGIN_IS_SYNTH;
if (fDescriptor->hints & ::PLUGIN_HAS_UI)
fHints |= PLUGIN_HAS_CUSTOM_UI;
if (fDescriptor->hints & ::PLUGIN_NEEDS_SINGLE_THREAD)
fHints |= PLUGIN_NEEDS_SINGLE_THREAD;
if (fDescriptor->hints & ::PLUGIN_NEEDS_FIXED_BUFFERS)
@@ -1088,7 +1087,7 @@ public:
// Update data
for (i=0; i < count; ++i)
{
const ::MidiProgram* const mpDesc = fDescriptor->get_midi_program_info(fHandle, i);
const NativeMidiProgram* const mpDesc(fDescriptor->get_midi_program_info(fHandle, i));
CARLA_ASSERT(mpDesc != nullptr);
CARLA_ASSERT(mpDesc->name != nullptr);

@@ -1209,7 +1208,7 @@ public:
}

fMidiEventCount = 0;
carla_zeroStruct< ::MidiEvent>(fMidiEvents, kPluginMaxMidiEvents*2);
carla_zeroStruct<NativeMidiEvent>(fMidiEvents, kPluginMaxMidiEvents*2);

// --------------------------------------------------------------------------------------------------------
// Check if needs reset
@@ -1348,7 +1347,7 @@ public:

if (fMidiEventCount > 0)
{
carla_zeroStruct< ::MidiEvent>(fMidiEvents, fMidiEventCount);
carla_zeroStruct<NativeMidiEvent>(fMidiEvents, fMidiEventCount);
fMidiEventCount = 0;
}
}
@@ -2011,14 +2010,14 @@ protected:
return pData->engine->isOffline();
}

const ::TimeInfo* handleGetTimeInfo() const
const NativeTimeInfo* handleGetTimeInfo() const
{
CARLA_SAFE_ASSERT_RETURN(fIsProcessing, nullptr);

return &fTimeInfo;
}

bool handleWriteMidiEvent(const ::MidiEvent* const event)
bool handleWriteMidiEvent(const NativeMidiEvent* const event)
{
CARLA_ASSERT(fEnabled);
CARLA_ASSERT(fIsProcessing);
@@ -2045,7 +2044,7 @@ protected:
{
if (fMidiEvents[i].data[0] == 0)
{
std::memcpy(&fMidiEvents[i], event, sizeof(::MidiEvent));
std::memcpy(&fMidiEvents[i], event, sizeof(NativeMidiEvent));
return true;
}
}
@@ -2091,7 +2090,7 @@ protected:
return retStr.isNotEmpty() ? (const char*)retStr : nullptr;
}

intptr_t handleDispatcher(const ::HostDispatcherOpcode opcode, const int32_t index, const intptr_t value, void* const ptr, const float opt)
intptr_t handleDispatcher(const NativeHostDispatcherOpcode opcode, const int32_t index, const intptr_t value, void* const ptr, const float opt)
{
carla_debug("NativePlugin::handleDispatcher(%i, %i, " P_INTPTR ", %p, %f)", opcode, index, value, ptr, opt);

@@ -2163,7 +2162,7 @@ public:
return sPluginDescriptors.count();
}

static const ::PluginDescriptor* getPluginDescriptor(const size_t index)
static const NativePluginDescriptor* getPluginDescriptor(const size_t index)
{
CARLA_ASSERT(index < sPluginDescriptors.count());

@@ -2173,7 +2172,7 @@ public:
return nullptr;
}

static void registerPlugin(const ::PluginDescriptor* desc)
static void registerPlugin(const NativePluginDescriptor* desc)
{
sPluginDescriptors.append(desc);
}
@@ -2205,7 +2204,7 @@ public:
// ---------------------------------------------------------------
// get descriptor that matches label

for (List<const ::PluginDescriptor*>::Itenerator it = sPluginDescriptors.begin(); it.valid(); it.next())
for (List<const NativePluginDescriptor*>::Itenerator it = sPluginDescriptors.begin(); it.valid(); it.next())
{
fDescriptor = *it;

@@ -2343,83 +2342,83 @@ public:
};

private:
::PluginHandle fHandle;
::PluginHandle fHandle2;
::HostDescriptor fHost;
const ::PluginDescriptor* fDescriptor;
NativePluginHandle fHandle;
NativePluginHandle fHandle2;
NativeHostDescriptor fHost;
const NativePluginDescriptor* fDescriptor;

bool fIsProcessing;
bool fIsUiVisible;

float** fAudioInBuffers;
float** fAudioOutBuffers;
uint32_t fMidiEventCount;
::MidiEvent fMidiEvents[kPluginMaxMidiEvents*2];
float** fAudioInBuffers;
float** fAudioOutBuffers;
uint32_t fMidiEventCount;
NativeMidiEvent fMidiEvents[kPluginMaxMidiEvents*2];

int32_t fCurMidiProgs[MAX_MIDI_CHANNELS];

NativePluginMidiData fMidiIn;
NativePluginMidiData fMidiOut;

::TimeInfo fTimeInfo;
NativeTimeInfo fTimeInfo;

static List<const ::PluginDescriptor*> sPluginDescriptors;
static List<const NativePluginDescriptor*> sPluginDescriptors;

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

#define handlePtr ((NativePlugin*)handle)

static uint32_t carla_host_get_buffer_size(::HostHandle handle)
static uint32_t carla_host_get_buffer_size(NativeHostHandle handle)
{
return handlePtr->handleGetBufferSize();
}

static double carla_host_get_sample_rate(::HostHandle handle)
static double carla_host_get_sample_rate(NativeHostHandle handle)
{
return handlePtr->handleGetSampleRate();
}

static bool carla_host_is_offline(::HostHandle handle)
static bool carla_host_is_offline(NativeHostHandle handle)
{
return handlePtr->handleIsOffline();
}

static const ::TimeInfo* carla_host_get_time_info(::HostHandle handle)
static const NativeTimeInfo* carla_host_get_time_info(NativeHostHandle handle)
{
return handlePtr->handleGetTimeInfo();
}

static bool carla_host_write_midi_event(::HostHandle handle, const ::MidiEvent* event)
static bool carla_host_write_midi_event(NativeHostHandle handle, const NativeMidiEvent* event)
{
return handlePtr->handleWriteMidiEvent(event);
}

static void carla_host_ui_parameter_changed(::HostHandle handle, uint32_t index, float value)
static void carla_host_ui_parameter_changed(NativeHostHandle handle, uint32_t index, float value)
{
handlePtr->handleUiParameterChanged(index, value);
}

static void carla_host_ui_custom_data_changed(::HostHandle handle, const char* key, const char* value)
static void carla_host_ui_custom_data_changed(NativeHostHandle handle, const char* key, const char* value)
{
handlePtr->handleUiCustomDataChanged(key, value);
}

static void carla_host_ui_closed(::HostHandle handle)
static void carla_host_ui_closed(NativeHostHandle handle)
{
handlePtr->handleUiClosed();
}

static const char* carla_host_ui_open_file(::HostHandle handle, bool isDir, const char* title, const char* filter)
static const char* carla_host_ui_open_file(NativeHostHandle handle, bool isDir, const char* title, const char* filter)
{
return handlePtr->handleUiOpenFile(isDir, title, filter);
}

static const char* carla_host_ui_save_file(::HostHandle handle, bool isDir, const char* title, const char* filter)
static const char* carla_host_ui_save_file(NativeHostHandle handle, bool isDir, const char* title, const char* filter)
{
return handlePtr->handleUiSaveFile(isDir, title, filter);
}

static intptr_t carla_host_dispatcher(::HostHandle handle, ::HostDispatcherOpcode opcode, int32_t index, intptr_t value, void* ptr, float opt)
static intptr_t carla_host_dispatcher(NativeHostHandle handle, NativeHostDispatcherOpcode opcode, int32_t index, intptr_t value, void* ptr, float opt)
{
return handlePtr->handleDispatcher(opcode, index, value, ptr, opt);
}
@@ -2429,13 +2428,13 @@ private:
CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(NativePlugin)
};

List<const ::PluginDescriptor*> NativePlugin::sPluginDescriptors;
List<const NativePluginDescriptor*> NativePlugin::sPluginDescriptors;

static const NativePlugin::ScopedInitializer _si;

CARLA_BACKEND_END_NAMESPACE

void carla_register_native_plugin(const PluginDescriptor* desc)
void carla_register_native_plugin(const NativePluginDescriptor* desc)
{
CARLA_BACKEND_USE_NAMESPACE
NativePlugin::registerPlugin(desc);
@@ -2455,7 +2454,7 @@ size_t CarlaPlugin::getNativePluginCount()
return NativePlugin::getPluginCount();
}

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


+ 16
- 18
source/backend/standalone/CarlaStandalone.cpp View File

@@ -24,7 +24,7 @@

#include "CarlaBackendUtils.hpp"
//#include "CarlaOscUtils.hpp"
//#include "CarlaNative.h"
#include "CarlaNative.h"

#ifdef USE_JUCE
# include "juce_gui_basics.h"
@@ -304,7 +304,6 @@ const EngineDriverDeviceInfo* carla_get_engine_driver_device_info(unsigned int i
return CarlaEngine::getDriverDeviceInfo(index, name);
}

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

unsigned int carla_get_internal_plugin_count()
@@ -318,29 +317,27 @@ unsigned int carla_get_internal_plugin_count()
#endif
}

const CarlaNativePluginInfo* carla_get_internal_plugin_info(unsigned int internalPluginId)
const CarlaNativePluginInfo* carla_get_internal_plugin_info(unsigned int index)
{
carla_debug("carla_get_internal_plugin_info(%i)", internalPluginId);
carla_debug("carla_get_internal_plugin_info(%i)", index);

#ifdef WANT_NATIVE
static CarlaNativePluginInfo info;

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

// as internal plugin, this must never fail
CARLA_SAFE_ASSERT_RETURN(nativePlugin != nullptr, nullptr);

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

if (nativePlugin->hints & PLUGIN_IS_RTSAFE)
if (nativePlugin->hints & ::PLUGIN_IS_RTSAFE)
info.hints |= CB::PLUGIN_IS_RTSAFE;
if (nativePlugin->hints & PLUGIN_HAS_GUI)
info.hints |= CB::PLUGIN_HAS_GUI;
if (nativePlugin->hints & PLUGIN_NEEDS_SINGLE_THREAD)
info.hints |= CB::PLUGIN_NEEDS_SINGLE_THREAD;
if (nativePlugin->hints & PLUGIN_NEEDS_FIXED_BUFFERS)
info.hints |= CB::PLUGIN_NEEDS_FIXED_BUFFERS;
if (nativePlugin->hints & ::PLUGIN_IS_SYNTH)
info.hints |= CB::PLUGIN_IS_SYNTH;
if (nativePlugin->hints & ::PLUGIN_HAS_UI)
info.hints |= CB::PLUGIN_HAS_CUSTOM_UI;

info.audioIns = nativePlugin->audioIns;
info.audioOuts = nativePlugin->audioOuts;
@@ -353,17 +350,17 @@ const CarlaNativePluginInfo* carla_get_internal_plugin_info(unsigned int interna
info.label = nativePlugin->label;
info.maker = nativePlugin->maker;
info.copyright = nativePlugin->copyright;
#endif

return &info;
#else
return nullptr;

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

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

bool carla_engine_init(const char* driverName, const char* clientName)
@@ -896,6 +893,7 @@ const CarlaTransportInfo* carla_get_transport_info()
return &info;
}
#endif
#endif

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



+ 72
- 71
source/modules/CarlaNative.h View File

@@ -33,28 +33,29 @@ extern "C" {
* @{
*/

typedef void* HostHandle;
typedef void* PluginHandle;
typedef void* NativeHostHandle;
typedef void* NativePluginHandle;

// -----------------------------------------------------------------------
// enums

typedef enum {
PLUGIN_CATEGORY_NONE = 0, //!< Null plugin category.
PLUGIN_CATEGORY_SYNTH = 1, //!< A synthesizer or generator.
PLUGIN_CATEGORY_DELAY = 2, //!< A delay or reverberator.
PLUGIN_CATEGORY_EQ = 3, //!< An equalizer.
PLUGIN_CATEGORY_FILTER = 4, //!< A filter.
PLUGIN_CATEGORY_DYNAMICS = 5, //!< A 'dynamic' plugin (amplifier, compressor, gate, etc).
PLUGIN_CATEGORY_MODULATOR = 6, //!< A 'modulator' plugin (chorus, flanger, phaser, etc).
PLUGIN_CATEGORY_UTILITY = 7, //!< An 'utility' plugin (analyzer, converter, mixer, etc).
PLUGIN_CATEGORY_OTHER = 8 //!< Misc plugin (used to check if the plugin has a category).
} PluginCategory;
PLUGIN_CATEGORY_NONE = 0, //!< Null plugin category.
PLUGIN_CATEGORY_SYNTH = 1, //!< A synthesizer or generator.
PLUGIN_CATEGORY_DELAY = 2, //!< A delay or reverberator.
PLUGIN_CATEGORY_EQ = 3, //!< An equalizer.
PLUGIN_CATEGORY_FILTER = 4, //!< A filter.
PLUGIN_CATEGORY_DISTORTION = 5, //!< A distortion plugin.
PLUGIN_CATEGORY_DYNAMICS = 6, //!< A 'dynamic' plugin (amplifier, compressor, gate, etc).
PLUGIN_CATEGORY_MODULATOR = 7, //!< A 'modulator' plugin (chorus, flanger, phaser, etc).
PLUGIN_CATEGORY_UTILITY = 8, //!< An 'utility' plugin (analyzer, converter, mixer, etc).
PLUGIN_CATEGORY_OTHER = 9 //!< Misc plugin (used to check if the plugin has a category).
} NativePluginCategory;

typedef enum {
PLUGIN_IS_RTSAFE = 1 << 0,
PLUGIN_IS_SYNTH = 1 << 1,
PLUGIN_HAS_GUI = 1 << 2,
PLUGIN_HAS_UI = 1 << 2,
PLUGIN_NEEDS_FIXED_BUFFERS = 1 << 3,
PLUGIN_NEEDS_SINGLE_THREAD = 1 << 4,
PLUGIN_NEEDS_UI_JUCE = 1 << 5,
@@ -62,7 +63,7 @@ typedef enum {
PLUGIN_USES_PANNING = 1 << 7, // uses stereo balance if unset (default)
PLUGIN_USES_STATE = 1 << 8,
PLUGIN_USES_TIME = 1 << 9
} PluginHints;
} NativePluginHints;

typedef enum {
PLUGIN_SUPPORTS_PROGRAM_CHANGES = 1 << 0, // handles MIDI programs internally instead of host-exposed/exported
@@ -72,7 +73,7 @@ typedef enum {
PLUGIN_SUPPORTS_PITCHBEND = 1 << 4,
PLUGIN_SUPPORTS_ALL_SOUND_OFF = 1 << 5,
PLUGIN_SUPPORTS_EVERYTHING = (1 << 6)-1
} PluginSupports;
} NativePluginSupports;

typedef enum {
PARAMETER_IS_OUTPUT = 1 << 0,
@@ -84,7 +85,7 @@ typedef enum {
PARAMETER_USES_SAMPLE_RATE = 1 << 6,
PARAMETER_USES_SCALEPOINTS = 1 << 7,
PARAMETER_USES_CUSTOM_TEXT = 1 << 8
} ParameterHints;
} NativeParameterHints;

typedef enum {
PLUGIN_OPCODE_NULL = 0, // nothing
@@ -92,7 +93,7 @@ typedef enum {
PLUGIN_OPCODE_SAMPLE_RATE_CHANGED = 2, // uses opt
PLUGIN_OPCODE_OFFLINE_CHANGED = 3, // uses value (0=off, 1=on)
PLUGIN_OPCODE_UI_NAME_CHANGED = 4 // uses ptr
} PluginDispatcherOpcode;
} NativePluginDispatcherOpcode;

typedef enum {
HOST_OPCODE_NULL = 0, // nothing
@@ -110,7 +111,7 @@ typedef enum {
HOST_OPCODE_RELOAD_MIDI_PROGRAMS = 12, // nothing
HOST_OPCODE_RELOAD_ALL = 13, // nothing
HOST_OPCODE_UI_UNAVAILABLE = 14 // nothing
} HostDispatcherOpcode;
} NativeHostDispatcherOpcode;

// -----------------------------------------------------------------------
// base structs
@@ -118,7 +119,7 @@ typedef enum {
typedef struct {
const char* label;
float value;
} ParameterScalePoint;
} NativeParameterScalePoint;

typedef struct {
float def;
@@ -127,34 +128,34 @@ typedef struct {
float step;
float stepSmall;
float stepLarge;
} ParameterRanges;
} NativeParameterRanges;

#define PARAMETER_RANGES_DEFAULT_STEP 0.01f
#define PARAMETER_RANGES_DEFAULT_STEP_SMALL 0.0001f
#define PARAMETER_RANGES_DEFAULT_STEP_LARGE 0.1f

typedef struct {
ParameterHints hints;
NativeParameterHints hints;
const char* name;
const char* unit;
ParameterRanges ranges;
NativeParameterRanges ranges;

uint32_t scalePointCount;
ParameterScalePoint* scalePoints;
} Parameter;
NativeParameterScalePoint* scalePoints;
} NativeParameter;

typedef struct {
uint8_t port;
uint32_t time;
uint8_t data[4];
uint8_t size;
} MidiEvent;
} NativeMidiEvent;

typedef struct {
uint32_t bank;
uint32_t program;
const char* name;
} MidiProgram;
} NativeMidiProgram;

typedef struct {
bool valid;
@@ -169,49 +170,49 @@ typedef struct {

double ticksPerBeat;
double beatsPerMinute;
} TimeInfoBBT;
} NativeTimeInfoBBT;

typedef struct {
bool playing;
uint64_t frame;
uint64_t usecs;
TimeInfoBBT bbt;
} TimeInfo;
NativeTimeInfoBBT bbt;
} NativeTimeInfo;

// -----------------------------------------------------------------------
// HostDescriptor

typedef struct {
HostHandle handle;
NativeHostHandle handle;
const char* resourceDir;
const char* uiName;

uint32_t (*get_buffer_size)(HostHandle handle);
double (*get_sample_rate)(HostHandle handle);
bool (*is_offline)(HostHandle handle);
uint32_t (*get_buffer_size)(NativeHostHandle handle);
double (*get_sample_rate)(NativeHostHandle handle);
bool (*is_offline)(NativeHostHandle handle);

const TimeInfo* (*get_time_info)(HostHandle handle);
bool (*write_midi_event)(HostHandle handle, const MidiEvent* event);
const NativeTimeInfo* (*get_time_info)(NativeHostHandle handle);
bool (*write_midi_event)(NativeHostHandle handle, const NativeMidiEvent* event);

void (*ui_parameter_changed)(HostHandle handle, uint32_t index, float value);
void (*ui_midi_program_changed)(HostHandle handle, uint8_t channel, uint32_t bank, uint32_t program);
void (*ui_custom_data_changed)(HostHandle handle, const char* key, const char* value);
void (*ui_closed)(HostHandle handle);
void (*ui_parameter_changed)(NativeHostHandle handle, uint32_t index, float value);
void (*ui_midi_program_changed)(NativeHostHandle handle, uint8_t channel, uint32_t bank, uint32_t program);
void (*ui_custom_data_changed)(NativeHostHandle handle, const char* key, const char* value);
void (*ui_closed)(NativeHostHandle handle);

const char* (*ui_open_file)(HostHandle handle, bool isDir, const char* title, const char* filter);
const char* (*ui_save_file)(HostHandle handle, bool isDir, const char* title, const char* filter);
const char* (*ui_open_file)(NativeHostHandle handle, bool isDir, const char* title, const char* filter);
const char* (*ui_save_file)(NativeHostHandle handle, bool isDir, const char* title, const char* filter);

intptr_t (*dispatcher)(HostHandle handle, HostDispatcherOpcode opcode, int32_t index, intptr_t value, void* ptr, float opt);
intptr_t (*dispatcher)(NativeHostHandle handle, NativeHostDispatcherOpcode opcode, int32_t index, intptr_t value, void* ptr, float opt);

} HostDescriptor;
} NativeHostDescriptor;

// -----------------------------------------------------------------------
// PluginDescriptor

typedef struct _PluginDescriptor {
const PluginCategory category;
const PluginHints hints;
const PluginSupports supports;
typedef struct _NativePluginDescriptor {
const NativePluginCategory category;
const NativePluginHints hints;
const NativePluginSupports supports;
const uint32_t audioIns;
const uint32_t audioOuts;
const uint32_t midiIns;
@@ -223,44 +224,44 @@ typedef struct _PluginDescriptor {
const char* const maker;
const char* const copyright;

PluginHandle (*instantiate)(const HostDescriptor* host);
void (*cleanup)(PluginHandle handle);
NativePluginHandle (*instantiate)(const NativeHostDescriptor* host);
void (*cleanup)(NativePluginHandle handle);

uint32_t (*get_parameter_count)(PluginHandle handle);
const Parameter* (*get_parameter_info)(PluginHandle handle, uint32_t index);
float (*get_parameter_value)(PluginHandle handle, uint32_t index);
const char* (*get_parameter_text)(PluginHandle handle, uint32_t index, float value);
uint32_t (*get_parameter_count)(NativePluginHandle handle);
const NativeParameter* (*get_parameter_info)(NativePluginHandle handle, uint32_t index);
float (*get_parameter_value)(NativePluginHandle handle, uint32_t index);
const char* (*get_parameter_text)(NativePluginHandle handle, uint32_t index, float value);

uint32_t (*get_midi_program_count)(PluginHandle handle);
const MidiProgram* (*get_midi_program_info)(PluginHandle handle, uint32_t index);
uint32_t (*get_midi_program_count)(NativePluginHandle handle);
const NativeMidiProgram* (*get_midi_program_info)(NativePluginHandle handle, uint32_t index);

void (*set_parameter_value)(PluginHandle handle, uint32_t index, float value);
void (*set_midi_program)(PluginHandle handle, uint8_t channel, uint32_t bank, uint32_t program);
void (*set_custom_data)(PluginHandle handle, const char* key, const char* value);
void (*set_parameter_value)(NativePluginHandle handle, uint32_t index, float value);
void (*set_midi_program)(NativePluginHandle handle, uint8_t channel, uint32_t bank, uint32_t program);
void (*set_custom_data)(NativePluginHandle handle, const char* key, const char* value);

void (*ui_show)(PluginHandle handle, bool show);
void (*ui_idle)(PluginHandle handle);
void (*ui_show)(NativePluginHandle handle, bool show);
void (*ui_idle)(NativePluginHandle handle);

void (*ui_set_parameter_value)(PluginHandle handle, uint32_t index, float value);
void (*ui_set_midi_program)(PluginHandle handle, uint8_t channel, uint32_t bank, uint32_t program);
void (*ui_set_custom_data)(PluginHandle handle, const char* key, const char* value);
void (*ui_set_parameter_value)(NativePluginHandle handle, uint32_t index, float value);
void (*ui_set_midi_program)(NativePluginHandle handle, uint8_t channel, uint32_t bank, uint32_t program);
void (*ui_set_custom_data)(NativePluginHandle handle, const char* key, const char* value);

void (*activate)(PluginHandle handle);
void (*deactivate)(PluginHandle handle);
void (*process)(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount);
void (*activate)(NativePluginHandle handle);
void (*deactivate)(NativePluginHandle handle);
void (*process)(NativePluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const NativeMidiEvent* midiEvents, uint32_t midiEventCount);

char* (*get_state)(PluginHandle handle);
void (*set_state)(PluginHandle handle, const char* data);
char* (*get_state)(NativePluginHandle handle);
void (*set_state)(NativePluginHandle handle, const char* data);

intptr_t (*dispatcher)(PluginHandle handle, PluginDispatcherOpcode opcode, int32_t index, intptr_t value, void* ptr, float opt);
intptr_t (*dispatcher)(NativePluginHandle handle, NativePluginDispatcherOpcode opcode, int32_t index, intptr_t value, void* ptr, float opt);

} PluginDescriptor;
} NativePluginDescriptor;

// -----------------------------------------------------------------------
// Register plugin

// Implemented by host
extern void carla_register_native_plugin(const PluginDescriptor* desc);
extern void carla_register_native_plugin(const NativePluginDescriptor* desc);

// Called once on host init
void carla_register_all_plugins();


+ 41
- 41
source/modules/CarlaNative.hpp View File

@@ -30,16 +30,16 @@
// -----------------------------------------------------------------------
// Plugin Class

class PluginClass
class NativePluginClass
{
public:
PluginClass(const HostDescriptor* const host)
NativePluginClass(const NativeHostDescriptor* const host)
: pHost(host)
{
CARLA_ASSERT(host != nullptr);
}

virtual ~PluginClass()
virtual ~NativePluginClass()
{
}

@@ -47,7 +47,7 @@ protected:
// -------------------------------------------------------------------
// Host calls

const HostDescriptor* getHostHandle() const noexcept
const NativeHostDescriptor* getHostHandle() const noexcept
{
return pHost;
}
@@ -87,14 +87,14 @@ protected:
return pHost->is_offline(pHost->handle);
}

const TimeInfo* getTimeInfo() const
const NativeTimeInfo* getTimeInfo() const
{
CARLA_SAFE_ASSERT_RETURN(pHost != nullptr, nullptr);

return pHost->get_time_info(pHost->handle);
}

void writeMidiEvent(const MidiEvent* const event) const
void writeMidiEvent(const NativeMidiEvent* const event) const
{
CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,);

@@ -266,7 +266,7 @@ protected:
return 0;
}

virtual const Parameter* getParameterInfo(const uint32_t index) const
virtual const NativeParameter* getParameterInfo(const uint32_t index) const
{
CARLA_SAFE_ASSERT_RETURN(index < getParameterCount(), nullptr);
return nullptr;
@@ -295,7 +295,7 @@ protected:
return 0;
}

virtual const MidiProgram* getMidiProgramInfo(const uint32_t index) const
virtual const NativeMidiProgram* getMidiProgramInfo(const uint32_t index) const
{
CARLA_SAFE_ASSERT_RETURN(index < getMidiProgramCount(), nullptr);
return nullptr;
@@ -340,7 +340,7 @@ protected:
{
}

virtual void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const MidiEvent* const midiEvents, const uint32_t midiEventCount) = 0;
virtual void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const NativeMidiEvent* const midiEvents, const uint32_t midiEventCount) = 0;

// -------------------------------------------------------------------
// Plugin UI calls
@@ -427,110 +427,110 @@ protected:
// -------------------------------------------------------------------

private:
const HostDescriptor* const pHost;
const NativeHostDescriptor* const pHost;

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

#ifndef DOXYGEN
public:
#define handlePtr ((PluginClass*)handle)
#define handlePtr ((NativePluginClass*)handle)

static uint32_t _get_parameter_count(PluginHandle handle)
static uint32_t _get_parameter_count(NativePluginHandle handle)
{
return handlePtr->getParameterCount();
}

static const Parameter* _get_parameter_info(PluginHandle handle, uint32_t index)
static const NativeParameter* _get_parameter_info(NativePluginHandle handle, uint32_t index)
{
return handlePtr->getParameterInfo(index);
}

static float _get_parameter_value(PluginHandle handle, uint32_t index)
static float _get_parameter_value(NativePluginHandle handle, uint32_t index)
{
return handlePtr->getParameterValue(index);
}

static const char* _get_parameter_text(PluginHandle handle, uint32_t index, float value)
static const char* _get_parameter_text(NativePluginHandle handle, uint32_t index, float value)
{
return handlePtr->getParameterText(index, value);
}

static uint32_t _get_midi_program_count(PluginHandle handle)
static uint32_t _get_midi_program_count(NativePluginHandle handle)
{
return handlePtr->getMidiProgramCount();
}

static const MidiProgram* _get_midi_program_info(PluginHandle handle, uint32_t index)
static const NativeMidiProgram* _get_midi_program_info(NativePluginHandle handle, uint32_t index)
{
return handlePtr->getMidiProgramInfo(index);
}

static void _set_parameter_value(PluginHandle handle, uint32_t index, float value)
static void _set_parameter_value(NativePluginHandle handle, uint32_t index, float value)
{
handlePtr->setParameterValue(index, value);
}

static void _set_midi_program(PluginHandle handle, uint8_t channel, uint32_t bank, uint32_t program)
static void _set_midi_program(NativePluginHandle handle, uint8_t channel, uint32_t bank, uint32_t program)
{
handlePtr->setMidiProgram(channel, bank, program);
}

static void _set_custom_data(PluginHandle handle, const char* key, const char* value)
static void _set_custom_data(NativePluginHandle handle, const char* key, const char* value)
{
handlePtr->setCustomData(key, value);
}

static void _ui_show(PluginHandle handle, bool show)
static void _ui_show(NativePluginHandle handle, bool show)
{
handlePtr->uiShow(show);
}

static void _ui_idle(PluginHandle handle)
static void _ui_idle(NativePluginHandle handle)
{
handlePtr->uiIdle();
}

static void _ui_set_parameter_value(PluginHandle handle, uint32_t index, float value)
static void _ui_set_parameter_value(NativePluginHandle handle, uint32_t index, float value)
{
handlePtr->uiSetParameterValue(index, value);
}

static void _ui_set_midi_program(PluginHandle handle, uint8_t channel, uint32_t bank, uint32_t program)
static void _ui_set_midi_program(NativePluginHandle handle, uint8_t channel, uint32_t bank, uint32_t program)
{
handlePtr->uiSetMidiProgram(channel, bank, program);
}

static void _ui_set_custom_data(PluginHandle handle, const char* key, const char* value)
static void _ui_set_custom_data(NativePluginHandle handle, const char* key, const char* value)
{
handlePtr->uiSetCustomData(key, value);
}

static void _activate(PluginHandle handle)
static void _activate(NativePluginHandle handle)
{
handlePtr->activate();
}

static void _deactivate(PluginHandle handle)
static void _deactivate(NativePluginHandle handle)
{
handlePtr->deactivate();
}

static void _process(PluginHandle handle, float** inBuffer, float** outBuffer, const uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount)
static void _process(NativePluginHandle handle, float** inBuffer, float** outBuffer, const uint32_t frames, const NativeMidiEvent* midiEvents, uint32_t midiEventCount)
{
handlePtr->process(inBuffer, outBuffer, frames, midiEvents, midiEventCount);
}

static char* _get_state(PluginHandle handle)
static char* _get_state(NativePluginHandle handle)
{
return handlePtr->getState();
}

static void _set_state(PluginHandle handle, const char* data)
static void _set_state(NativePluginHandle handle, const char* data)
{
handlePtr->setState(data);
}

static intptr_t _dispatcher(PluginHandle handle, PluginDispatcherOpcode opcode, int32_t index, intptr_t value, void* ptr, float opt)
static intptr_t _dispatcher(NativePluginHandle handle, NativePluginDispatcherOpcode opcode, int32_t index, intptr_t value, void* ptr, float opt)
{
switch(opcode)
{
@@ -559,7 +559,7 @@ public:

#undef handlePtr

CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PluginClass)
CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(NativePluginClass)
#endif
};

@@ -567,15 +567,15 @@ public:

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

#define PluginClassEND(ClassName) \
public: \
static PluginHandle _instantiate(const HostDescriptor* host) \
{ \
return new ClassName(host); \
} \
static void _cleanup(PluginHandle handle) \
{ \
delete (ClassName*)handle; \
#define PluginClassEND(ClassName) \
public: \
static NativePluginHandle _instantiate(const NativeHostDescriptor* host) \
{ \
return new ClassName(host); \
} \
static void _cleanup(NativePluginHandle handle) \
{ \
delete (ClassName*)handle; \
}

#define PluginDescriptorFILL(ClassName) \


+ 11
- 11
source/modules/carla_native/audio-file.cpp View File

@@ -22,12 +22,12 @@

#define PROGRAM_COUNT 16

class AudioFilePlugin : public PluginClass,
class AudioFilePlugin : public NativePluginClass,
public AbstractAudioPlayer
{
public:
AudioFilePlugin(const HostDescriptor* const host)
: PluginClass(host),
AudioFilePlugin(const NativeHostDescriptor* const host)
: NativePluginClass(host),
AbstractAudioPlayer(),
fLoopMode(false),
fDoProcess(false),
@@ -58,16 +58,16 @@ protected:
return 0; // TODO - loopMode
}

const Parameter* getParameterInfo(const uint32_t index) const override
const NativeParameter* getParameterInfo(const uint32_t index) const override
{
if (index != 0)
return nullptr;

static Parameter param;
static NativeParameter param;

param.name = "Loop Mode";
param.unit = nullptr;
param.hints = static_cast<ParameterHints>(PARAMETER_IS_ENABLED|PARAMETER_IS_BOOLEAN);
param.hints = static_cast<NativeParameterHints>(PARAMETER_IS_ENABLED|PARAMETER_IS_BOOLEAN);
param.ranges.def = 1.0f;
param.ranges.min = 0.0f;
param.ranges.max = 1.0f;
@@ -116,9 +116,9 @@ protected:
// -------------------------------------------------------------------
// Plugin process calls

void process(float**, float** const outBuffer, const uint32_t frames, const MidiEvent* const, const uint32_t) override
void process(float**, float** const outBuffer, const uint32_t frames, const NativeMidiEvent* const, const uint32_t) override
{
const TimeInfo* const timePos(getTimeInfo());
const NativeTimeInfo* const timePos(getTimeInfo());

float* out1 = outBuffer[0];
float* out2 = outBuffer[1];
@@ -259,10 +259,10 @@ private:

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

static const PluginDescriptor audiofileDesc = {
static const NativePluginDescriptor audiofileDesc = {
/* category */ PLUGIN_CATEGORY_UTILITY,
/* hints */ static_cast<PluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_GUI|PLUGIN_NEEDS_UI_OPEN_SAVE),
/* supports */ static_cast<PluginSupports>(0x0),
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_UI|PLUGIN_NEEDS_UI_OPEN_SAVE),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ 0,
/* audioOuts */ 2,
/* midiIns */ 0,


+ 4
- 4
source/modules/carla_native/bypass.c View File

@@ -21,13 +21,13 @@

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

static PluginHandle bypass_instantiate(const HostDescriptor* host)
static NativePluginHandle bypass_instantiate(const NativeHostDescriptor* host)
{
// dummy, return non-NULL
return (PluginHandle)host;
return (NativePluginHandle)host;
}

static void bypass_process(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount)
static void bypass_process(NativePluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const NativeMidiEvent* midiEvents, uint32_t midiEventCount)
{
memcpy(outBuffer[0], inBuffer[0], sizeof(float)*frames);
return;
@@ -40,7 +40,7 @@ static void bypass_process(PluginHandle handle, float** inBuffer, float** outBuf

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

static const PluginDescriptor bypassDesc = {
static const NativePluginDescriptor bypassDesc = {
.category = PLUGIN_CATEGORY_NONE,
.hints = PLUGIN_IS_RTSAFE,
.supports = 0x0,


+ 3
- 3
source/modules/carla_native/distrho-3bandeq.cpp View File

@@ -29,10 +29,10 @@ START_NAMESPACE_DISTRHO

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

static const PluginDescriptor tBandEqDesc = {
static const NativePluginDescriptor tBandEqDesc = {
/* category */ PLUGIN_CATEGORY_EQ,
/* hints */ static_cast<PluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_GUI),
/* supports */ static_cast<PluginSupports>(0x0),
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_UI),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 0,


+ 3
- 3
source/modules/carla_native/distrho-3bandsplitter.cpp View File

@@ -29,10 +29,10 @@ START_NAMESPACE_DISTRHO

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

static const PluginDescriptor tBandSplitterDesc = {
static const NativePluginDescriptor tBandSplitterDesc = {
/* category */ PLUGIN_CATEGORY_EQ,
/* hints */ static_cast<PluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_GUI),
/* supports */ static_cast<PluginSupports>(0x0),
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_UI),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 0,


+ 3
- 3
source/modules/carla_native/distrho-bigmeter.cpp View File

@@ -28,10 +28,10 @@ START_NAMESPACE_DISTRHO

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

static const PluginDescriptor bigMeterDesc = {
static const NativePluginDescriptor bigMeterDesc = {
/* category */ PLUGIN_CATEGORY_UTILITY,
/* hints */ static_cast<PluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_GUI),
/* supports */ static_cast<PluginSupports>(0x0),
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_UI),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 0,


+ 3
- 3
source/modules/carla_native/distrho-bigmeterM.cpp View File

@@ -28,10 +28,10 @@ START_NAMESPACE_DISTRHO

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

static const PluginDescriptor bigMeterMDesc = {
static const NativePluginDescriptor bigMeterMDesc = {
/* category */ PLUGIN_CATEGORY_UTILITY,
/* hints */ static_cast<PluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_GUI),
/* supports */ static_cast<PluginSupports>(0x0),
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_UI),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 0,


+ 3
- 3
source/modules/carla_native/distrho-nekobi.cpp View File

@@ -29,10 +29,10 @@ START_NAMESPACE_DISTRHO

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

static const PluginDescriptor nekobiDesc = {
static const NativePluginDescriptor nekobiDesc = {
/* category */ PLUGIN_CATEGORY_SYNTH,
/* hints */ static_cast<PluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_GUI),
/* supports */ static_cast<PluginSupports>(PLUGIN_SUPPORTS_CONTROL_CHANGES|PLUGIN_SUPPORTS_ALL_SOUND_OFF),
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_UI),
/* supports */ static_cast<NativePluginSupports>(PLUGIN_SUPPORTS_CONTROL_CHANGES|PLUGIN_SUPPORTS_ALL_SOUND_OFF),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 1,


+ 3
- 3
source/modules/carla_native/distrho-notes.cpp View File

@@ -28,10 +28,10 @@ START_NAMESPACE_DISTRHO

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

static const PluginDescriptor notesDesc = {
static const NativePluginDescriptor notesDesc = {
/* category */ PLUGIN_CATEGORY_UTILITY,
/* hints */ static_cast<PluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_GUI),
/* supports */ static_cast<PluginSupports>(0x0),
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_UI),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 0,


+ 3
- 3
source/modules/carla_native/distrho-pingpongpan.cpp View File

@@ -29,10 +29,10 @@ START_NAMESPACE_DISTRHO

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

static PluginDescriptor pppDesc = {
static const NativePluginDescriptor pppDesc = {
/* category */ PLUGIN_CATEGORY_UTILITY,
/* hints */ static_cast<PluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_GUI),
/* supports */ static_cast<PluginSupports>(0x0),
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_UI),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 0,


+ 3
- 3
source/modules/carla_native/distrho-stereoenhancer.cpp View File

@@ -29,10 +29,10 @@ START_NAMESPACE_DISTRHO

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

static const PluginDescriptor stereoenhancerDesc = {
static const NativePluginDescriptor stereoenhancerDesc = {
/* category */ PLUGIN_CATEGORY_EQ,
/* hints */ static_cast<PluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_GUI),
/* supports */ static_cast<PluginSupports>(0x0),
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_UI),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 0,


+ 16
- 16
source/modules/carla_native/distrho/DistrhoPluginCarla.cpp View File

@@ -63,7 +63,7 @@ class UICarla
#endif
{
public:
UICarla(const HostDescriptor* const host, PluginInternal* const plugin)
UICarla(const NativeHostDescriptor* const host, PluginInternal* const plugin)
: fHost(host),
fPlugin(plugin),
fUi(this, 0, editParameterCallback, setParameterCallback, setStateCallback, sendNoteCallback, uiResizeCallback)
@@ -254,7 +254,7 @@ protected:

private:
// Plugin stuff
const HostDescriptor* const fHost;
const NativeHostDescriptor* const fHost;
PluginInternal* const fPlugin;

// UI
@@ -310,11 +310,11 @@ private:
// -----------------------------------------------------------------------
// Carla Plugin

class PluginCarla : public PluginClass
class PluginCarla : public NativePluginClass
{
public:
PluginCarla(const HostDescriptor* const host)
: PluginClass(host)
PluginCarla(const NativeHostDescriptor* const host)
: NativePluginClass(host)
{
#if DISTRHO_PLUGIN_HAS_UI
fUiPtr = nullptr;
@@ -341,11 +341,11 @@ protected:
return fPlugin.getParameterCount();
}

const ::Parameter* getParameterInfo(const uint32_t index) const override
const NativeParameter* getParameterInfo(const uint32_t index) const override
{
CARLA_ASSERT(index < getParameterCount());

static ::Parameter param;
static NativeParameter param;

// reset
param.hints = ::PARAMETER_IS_ENABLED;
@@ -367,7 +367,7 @@ protected:
if (paramHints & PARAMETER_IS_OUTPUT)
nativeParamHints |= ::PARAMETER_IS_OUTPUT;

param.hints = static_cast<ParameterHints>(nativeParamHints);
param.hints = static_cast<NativeParameterHints>(nativeParamHints);
}

param.name = fPlugin.getParameterName(index);
@@ -403,14 +403,14 @@ protected:
return fPlugin.getProgramCount();
}

const ::MidiProgram* getMidiProgramInfo(const uint32_t index) const override
const NativeMidiProgram* getMidiProgramInfo(const uint32_t index) const override
{
CARLA_ASSERT(index < getMidiProgramCount());

if (index >= fPlugin.getProgramCount())
return nullptr;

static ::MidiProgram midiProgram;
static NativeMidiProgram midiProgram;

midiProgram.bank = index / 128;
midiProgram.program = index % 128;
@@ -466,14 +466,14 @@ protected:
}

#if DISTRHO_PLUGIN_IS_SYNTH
void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const ::MidiEvent* const midiEvents, const uint32_t midiEventCount) override
void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const NativeMidiEvent* const midiEvents, const uint32_t midiEventCount) override
{
uint32_t i;

for (i=0; i < midiEventCount && i < MAX_MIDI_EVENTS; ++i)
{
const ::MidiEvent* const midiEvent = &midiEvents[i];
MidiEvent* const realMidiEvent = &fRealMidiEvents[i];
const NativeMidiEvent* const midiEvent(&midiEvents[i]);
MidiEvent* const realMidiEvent(&fRealMidiEvents[i]);

realMidiEvent->frame = midiEvent->time;
realMidiEvent->size = midiEvent->size;
@@ -485,7 +485,7 @@ protected:
fPlugin.run(inBuffer, outBuffer, frames, fRealMidiEvents, i);
}
#else
void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const ::MidiEvent* const, const uint32_t) override
void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const NativeMidiEvent* const, const uint32_t) override
{
fPlugin.run(inBuffer, outBuffer, frames, nullptr, 0);
}
@@ -598,14 +598,14 @@ private:
// -------------------------------------------------------------------

public:
static PluginHandle _instantiate(const HostDescriptor* host)
static NativePluginHandle _instantiate(const NativeHostDescriptor* host)
{
d_lastBufferSize = host->get_buffer_size(host->handle);
d_lastSampleRate = host->get_sample_rate(host->handle);
return new PluginCarla(host);
}

static void _cleanup(PluginHandle handle)
static void _cleanup(NativePluginHandle handle)
{
delete (PluginCarla*)handle;
}


+ 13
- 13
source/modules/carla_native/lfo.c View File

@@ -35,7 +35,7 @@ typedef enum {
} LfoParams;

typedef struct {
const HostDescriptor* host;
const NativeHostDescriptor* host;
int mode;
float speed;
float multiplier;
@@ -45,7 +45,7 @@ typedef struct {

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

static PluginHandle lfo_instantiate(const HostDescriptor* host)
static NativePluginHandle lfo_instantiate(const NativeHostDescriptor* host)
{
LfoHandle* const handle = (LfoHandle*)malloc(sizeof(LfoHandle));

@@ -65,12 +65,12 @@ static PluginHandle lfo_instantiate(const HostDescriptor* host)

#define handlePtr ((LfoHandle*)handle)

static void lfo_cleanup(PluginHandle handle)
static void lfo_cleanup(NativePluginHandle handle)
{
free(handlePtr);
}

static uint32_t lfo_get_parameter_count(PluginHandle handle)
static uint32_t lfo_get_parameter_count(NativePluginHandle handle)
{
return PARAM_COUNT;

@@ -78,13 +78,13 @@ static uint32_t lfo_get_parameter_count(PluginHandle handle)
(void)handle;
}

const Parameter* lfo_get_parameter_info(PluginHandle handle, uint32_t index)
const NativeParameter* lfo_get_parameter_info(NativePluginHandle handle, uint32_t index)
{
if (index > PARAM_COUNT)
return NULL;

static Parameter param;
static ParameterScalePoint paramModes[5];
static NativeParameter param;
static NativeParameterScalePoint paramModes[5];

param.hints = PARAMETER_IS_ENABLED|PARAMETER_IS_AUTOMABLE;
param.scalePointCount = 0;
@@ -166,7 +166,7 @@ const Parameter* lfo_get_parameter_info(PluginHandle handle, uint32_t index)
(void)handle;
}

static float lfo_get_parameter_value(PluginHandle handle, uint32_t index)
static float lfo_get_parameter_value(NativePluginHandle handle, uint32_t index)
{
switch (index)
{
@@ -185,7 +185,7 @@ static float lfo_get_parameter_value(PluginHandle handle, uint32_t index)
}
}

static void lfo_set_parameter_value(PluginHandle handle, uint32_t index, float value)
static void lfo_set_parameter_value(NativePluginHandle handle, uint32_t index, float value)
{
switch (index)
{
@@ -207,10 +207,10 @@ static void lfo_set_parameter_value(PluginHandle handle, uint32_t index, float v
}
}

static void lfo_process(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount)
static void lfo_process(NativePluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const NativeMidiEvent* midiEvents, uint32_t midiEventCount)
{
const HostDescriptor* const host = handlePtr->host;
const TimeInfo* const timeInfo = host->get_time_info(host->handle);
const NativeHostDescriptor* const host = handlePtr->host;
const NativeTimeInfo* const timeInfo = host->get_time_info(host->handle);

if (! timeInfo->playing)
return;
@@ -266,7 +266,7 @@ static void lfo_process(PluginHandle handle, float** inBuffer, float** outBuffer

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

static const PluginDescriptor lfoDesc = {
static const NativePluginDescriptor lfoDesc = {
.category = PLUGIN_CATEGORY_UTILITY,
.hints = PLUGIN_IS_RTSAFE,
.supports = 0x0,


+ 12
- 12
source/modules/carla_native/midi-file.cpp View File

@@ -20,12 +20,12 @@

#include <smf.h>

class MidiFilePlugin : public PluginClass,
class MidiFilePlugin : public NativePluginClass,
public AbstractMidiPlayer
{
public:
MidiFilePlugin(const HostDescriptor* const host)
: PluginClass(host),
MidiFilePlugin(const NativeHostDescriptor* const host)
: NativePluginClass(host),
fMidiOut(this),
fWasPlayingBefore(false)
{
@@ -53,9 +53,9 @@ protected:
// -------------------------------------------------------------------
// Plugin process calls

void process(float**, float**, const uint32_t frames, const MidiEvent* const, const uint32_t) override
void process(float**, float**, const uint32_t frames, const NativeMidiEvent* const, const uint32_t) override
{
const TimeInfo* const timePos(getTimeInfo());
const NativeTimeInfo* const timePos(getTimeInfo());

if (timePos->playing)
{
@@ -63,7 +63,7 @@ protected:
}
else if (fWasPlayingBefore)
{
MidiEvent midiEvent;
NativeMidiEvent midiEvent;

midiEvent.port = 0;
midiEvent.time = 0;
@@ -76,7 +76,7 @@ protected:
for (int i=0; i < MAX_MIDI_CHANNELS; ++i)
{
midiEvent.data[0] = MIDI_STATUS_CONTROL_CHANGE+i;
PluginClass::writeMidiEvent(&midiEvent);
NativePluginClass::writeMidiEvent(&midiEvent);
}

carla_stdout("WAS PLAYING BEFORE, NOW STOPPED");
@@ -106,7 +106,7 @@ protected:

void writeMidiEvent(const uint32_t timePosFrame, const RawMidiEvent* const event) override
{
MidiEvent midiEvent;
NativeMidiEvent midiEvent;

midiEvent.port = 0;
midiEvent.time = event->time-timePosFrame;
@@ -116,7 +116,7 @@ protected:
midiEvent.data[3] = event->data[3];
midiEvent.size = event->size;

PluginClass::writeMidiEvent(&midiEvent);
NativePluginClass::writeMidiEvent(&midiEvent);
}

private:
@@ -218,10 +218,10 @@ private:

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

static const PluginDescriptor midifileDesc = {
static const NativePluginDescriptor midifileDesc = {
/* category */ PLUGIN_CATEGORY_UTILITY,
/* hints */ static_cast<PluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_GUI|PLUGIN_NEEDS_UI_OPEN_SAVE),
/* supports */ static_cast<PluginSupports>(0x0),
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_UI|PLUGIN_NEEDS_UI_OPEN_SAVE),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ 0,
/* audioOuts */ 0,
/* midiIns */ 0,


+ 14
- 14
source/modules/carla_native/midi-gain.c View File

@@ -32,7 +32,7 @@ typedef enum {
} MidiGainParams;

typedef struct {
const HostDescriptor* host;
const NativeHostDescriptor* host;
float gain;
bool applyNotes;
bool applyAftertouch;
@@ -41,7 +41,7 @@ typedef struct {

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

static PluginHandle midiGain_instantiate(const HostDescriptor* host)
static NativePluginHandle midiGain_instantiate(const NativeHostDescriptor* host)
{
MidiGainHandle* const handle = (MidiGainHandle*)malloc(sizeof(MidiGainHandle));

@@ -58,12 +58,12 @@ static PluginHandle midiGain_instantiate(const HostDescriptor* host)

#define handlePtr ((MidiGainHandle*)handle)

static void midiGain_cleanup(PluginHandle handle)
static void midiGain_cleanup(NativePluginHandle handle)
{
free(handlePtr);
}

static uint32_t midiGain_get_parameter_count(PluginHandle handle)
static uint32_t midiGain_get_parameter_count(NativePluginHandle handle)
{
return PARAM_COUNT;

@@ -71,12 +71,12 @@ static uint32_t midiGain_get_parameter_count(PluginHandle handle)
(void)handle;
}

const Parameter* midiGain_get_parameter_info(PluginHandle handle, uint32_t index)
const NativeParameter* midiGain_get_parameter_info(NativePluginHandle handle, uint32_t index)
{
if (index > PARAM_COUNT)
return NULL;

static Parameter param;
static NativeParameter param;

param.hints = PARAMETER_IS_ENABLED|PARAMETER_IS_AUTOMABLE;
param.unit = NULL;
@@ -132,7 +132,7 @@ const Parameter* midiGain_get_parameter_info(PluginHandle handle, uint32_t index
(void)handle;
}

static float midiGain_get_parameter_value(PluginHandle handle, uint32_t index)
static float midiGain_get_parameter_value(NativePluginHandle handle, uint32_t index)
{
switch (index)
{
@@ -149,7 +149,7 @@ static float midiGain_get_parameter_value(PluginHandle handle, uint32_t index)
}
}

static void midiGain_set_parameter_value(PluginHandle handle, uint32_t index, float value)
static void midiGain_set_parameter_value(NativePluginHandle handle, uint32_t index, float value)
{
switch (index)
{
@@ -168,18 +168,18 @@ static void midiGain_set_parameter_value(PluginHandle handle, uint32_t index, fl
}
}

static void midiGain_process(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount)
static void midiGain_process(NativePluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const NativeMidiEvent* midiEvents, uint32_t midiEventCount)
{
const HostDescriptor* const host = handlePtr->host;
const NativeHostDescriptor* const host = handlePtr->host;
const float gain = handlePtr->gain;
const bool applyNotes = handlePtr->applyNotes;
const bool applyAftertouch = handlePtr->applyAftertouch;
const bool applyCC = handlePtr->applyCC;
MidiEvent tmpEvent;
NativeMidiEvent tmpEvent;

for (uint32_t i=0; i < midiEventCount; ++i)
{
const MidiEvent* const midiEvent = &midiEvents[i];
const NativeMidiEvent* const midiEvent = &midiEvents[i];

const uint8_t status = MIDI_GET_STATUS_FROM_DATA(midiEvent->data);

@@ -187,7 +187,7 @@ static void midiGain_process(PluginHandle handle, float** inBuffer, float** outB
(applyAftertouch && status == MIDI_STATUS_POLYPHONIC_AFTERTOUCH) ||
(applyCC && status == MIDI_STATUS_CONTROL_CHANGE)))
{
memcpy(&tmpEvent, midiEvent, sizeof(MidiEvent));
memcpy(&tmpEvent, midiEvent, sizeof(NativeMidiEvent));

float value = (float)midiEvent->data[2] * gain;

@@ -214,7 +214,7 @@ static void midiGain_process(PluginHandle handle, float** inBuffer, float** outB

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

static const PluginDescriptor midiGainDesc = {
static const NativePluginDescriptor midiGainDesc = {
.category = PLUGIN_CATEGORY_UTILITY,
.hints = PLUGIN_IS_RTSAFE,
.supports = PLUGIN_SUPPORTS_EVERYTHING,


+ 10
- 10
source/modules/carla_native/midi-sequencer.cpp View File

@@ -18,12 +18,12 @@
#include "CarlaNative.hpp"
#include "midi-base.hpp"

class MidiSequencerPlugin : public PluginClass,
class MidiSequencerPlugin : public NativePluginClass,
public AbstractMidiPlayer
{
public:
MidiSequencerPlugin(const HostDescriptor* const host)
: PluginClass(host),
MidiSequencerPlugin(const NativeHostDescriptor* const host)
: NativePluginClass(host),
fWantInEvents(false),
fMidiOut(this)
{
@@ -136,9 +136,9 @@ protected:
{
}

void process(float**, float**, const uint32_t frames, const MidiEvent* const midiEvents, const uint32_t midiEventCount) override
void process(float**, float**, const uint32_t frames, const NativeMidiEvent* const midiEvents, const uint32_t midiEventCount) override
{
const TimeInfo* const timePos = getTimeInfo();
const NativeTimeInfo* const timePos = getTimeInfo();

if (fWantInEvents)
{
@@ -146,7 +146,7 @@ protected:

for (uint32_t i=0; i < midiEventCount; ++i)
{
const MidiEvent* const midiEvent = &midiEvents[i];
const NativeMidiEvent* const midiEvent = &midiEvents[i];

rawMidiEvent.data[0] = midiEvent->data[0];
rawMidiEvent.data[1] = midiEvent->data[1];
@@ -174,7 +174,7 @@ protected:

void writeMidiEvent(const uint32_t timePosFrame, const RawMidiEvent* const event) override
{
MidiEvent midiEvent;
NativeMidiEvent midiEvent;

midiEvent.port = 0;
midiEvent.time = event->time-timePosFrame;
@@ -184,7 +184,7 @@ protected:
midiEvent.data[3] = event->data[3];
midiEvent.size = event->size;

PluginClass::writeMidiEvent(&midiEvent);
NativePluginClass::writeMidiEvent(&midiEvent);
}

private:
@@ -232,10 +232,10 @@ private:

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

static const PluginDescriptor midiSequencerDesc = {
static const NativePluginDescriptor midiSequencerDesc = {
/* category */ PLUGIN_CATEGORY_UTILITY,
/* hints */ PLUGIN_IS_RTSAFE/*|PLUGIN_HAS_GUI*/,
/* supports */ static_cast<PluginSupports>(0x0),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ 0,
/* audioOuts */ 0,
/* midiIns */ 1,


+ 7
- 7
source/modules/carla_native/midi-split.c View File

@@ -20,20 +20,20 @@

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

static PluginHandle midiSplit_instantiate(const HostDescriptor* host)
static NativePluginHandle midiSplit_instantiate(const NativeHostDescriptor* host)
{
// use HostDescriptor as PluginHandle
return (PluginHandle)host;
return (NativePluginHandle)host;
}

static void midiSplit_process(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount)
static void midiSplit_process(NativePluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const NativeMidiEvent* midiEvents, uint32_t midiEventCount)
{
const HostDescriptor* const host = (const HostDescriptor*)handle;
MidiEvent tmpEvent;
const NativeHostDescriptor* const host = (const NativeHostDescriptor*)handle;
NativeMidiEvent tmpEvent;

for (uint32_t i=0; i < midiEventCount; ++i)
{
const MidiEvent* const midiEvent = &midiEvents[i];
const NativeMidiEvent* const midiEvent = &midiEvents[i];

const uint8_t status = MIDI_GET_STATUS_FROM_DATA(midiEvent->data);
const uint8_t channel = MIDI_GET_CHANNEL_FROM_DATA(midiEvent->data);
@@ -62,7 +62,7 @@ static void midiSplit_process(PluginHandle handle, float** inBuffer, float** out

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

static const PluginDescriptor midiSplitDesc = {
static const NativePluginDescriptor midiSplitDesc = {
.category = PLUGIN_CATEGORY_UTILITY,
.hints = PLUGIN_IS_RTSAFE,
.supports = PLUGIN_SUPPORTS_EVERYTHING,


+ 5
- 5
source/modules/carla_native/midi-through.c View File

@@ -20,15 +20,15 @@

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

static PluginHandle midiThrough_instantiate(const HostDescriptor* host)
static NativePluginHandle midiThrough_instantiate(const NativeHostDescriptor* host)
{
// use HostDescriptor as PluginHandle
return (PluginHandle)host;
return (NativePluginHandle)host;
}

static void midiThrough_process(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount)
static void midiThrough_process(NativePluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const NativeMidiEvent* midiEvents, uint32_t midiEventCount)
{
const HostDescriptor* const host = (const HostDescriptor*)handle;
const NativeHostDescriptor* const host = (const NativeHostDescriptor*)handle;

for (uint32_t i=0; i < midiEventCount; ++i)
host->write_midi_event(host->handle, &midiEvents[i]);
@@ -43,7 +43,7 @@ static void midiThrough_process(PluginHandle handle, float** inBuffer, float** o

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

static const PluginDescriptor midiThroughDesc = {
static const NativePluginDescriptor midiThroughDesc = {
.category = PLUGIN_CATEGORY_UTILITY,
.hints = PLUGIN_IS_RTSAFE,
.supports = PLUGIN_SUPPORTS_EVERYTHING,


+ 13
- 13
source/modules/carla_native/midi-transpose.c View File

@@ -23,13 +23,13 @@
// -----------------------------------------------------------------------

typedef struct {
const HostDescriptor* host;
const NativeHostDescriptor* host;
int octaves;
} MidiTransposeHandle;

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

static PluginHandle midiTranspose_instantiate(const HostDescriptor* host)
static NativePluginHandle midiTranspose_instantiate(const NativeHostDescriptor* host)
{
MidiTransposeHandle* const handle = (MidiTransposeHandle*)malloc(sizeof(MidiTransposeHandle));

@@ -43,12 +43,12 @@ static PluginHandle midiTranspose_instantiate(const HostDescriptor* host)

#define handlePtr ((MidiTransposeHandle*)handle)

static void midiTranspose_cleanup(PluginHandle handle)
static void midiTranspose_cleanup(NativePluginHandle handle)
{
free(handlePtr);
}

static uint32_t midiTranspose_get_parameter_count(PluginHandle handle)
static uint32_t midiTranspose_get_parameter_count(NativePluginHandle handle)
{
return 1;

@@ -56,12 +56,12 @@ static uint32_t midiTranspose_get_parameter_count(PluginHandle handle)
(void)handle;
}

const Parameter* midiTranspose_get_parameter_info(PluginHandle handle, uint32_t index)
const NativeParameter* midiTranspose_get_parameter_info(NativePluginHandle handle, uint32_t index)
{
if (index != 0)
return NULL;

static Parameter param;
static NativeParameter param;

param.name = "Octaves";
param.unit = NULL;
@@ -81,7 +81,7 @@ const Parameter* midiTranspose_get_parameter_info(PluginHandle handle, uint32_t
(void)handle;
}

static float midiTranspose_get_parameter_value(PluginHandle handle, uint32_t index)
static float midiTranspose_get_parameter_value(NativePluginHandle handle, uint32_t index)
{
if (index != 0)
return 0.0f;
@@ -89,7 +89,7 @@ static float midiTranspose_get_parameter_value(PluginHandle handle, uint32_t ind
return (float)handlePtr->octaves;
}

static void midiTranspose_set_parameter_value(PluginHandle handle, uint32_t index, float value)
static void midiTranspose_set_parameter_value(NativePluginHandle handle, uint32_t index, float value)
{
if (index != 0)
return;
@@ -97,15 +97,15 @@ static void midiTranspose_set_parameter_value(PluginHandle handle, uint32_t inde
handlePtr->octaves = (int)value;
}

static void midiTranspose_process(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount)
static void midiTranspose_process(NativePluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const NativeMidiEvent* midiEvents, uint32_t midiEventCount)
{
const HostDescriptor* const host = handlePtr->host;
const NativeHostDescriptor* const host = handlePtr->host;
const int octaves = handlePtr->octaves;
MidiEvent tmpEvent;
NativeMidiEvent tmpEvent;

for (uint32_t i=0; i < midiEventCount; ++i)
{
const MidiEvent* const midiEvent = &midiEvents[i];
const NativeMidiEvent* const midiEvent = &midiEvents[i];

const uint8_t status = MIDI_GET_STATUS_FROM_DATA(midiEvent->data);

@@ -143,7 +143,7 @@ static void midiTranspose_process(PluginHandle handle, float** inBuffer, float**

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

static const PluginDescriptor midiTransposeDesc = {
static const NativePluginDescriptor midiTransposeDesc = {
.category = PLUGIN_CATEGORY_UTILITY,
.hints = PLUGIN_IS_RTSAFE,
.supports = PLUGIN_SUPPORTS_EVERYTHING,


+ 2
- 2
source/modules/carla_native/nekofilter.c View File

@@ -26,10 +26,10 @@

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

static const PluginDescriptor nekofilterDesc = {
static const NativePluginDescriptor nekofilterDesc = {
.category = PLUGIN_CATEGORY_FILTER,
#ifdef WANT_UI
.hints = PLUGIN_IS_RTSAFE|PLUGIN_HAS_GUI,
.hints = PLUGIN_IS_RTSAFE|PLUGIN_HAS_UI,
#else
.hints = PLUGIN_IS_RTSAFE,
#endif


+ 16
- 16
source/modules/carla_native/nekofilter/nekofilter.c View File

@@ -47,15 +47,15 @@ struct nekofilter
filter_handle filter;
float params_global[GLOBAL_PARAMETERS_COUNT];
float params_bands[BAND_PARAMETERS_COUNT*BANDS_COUNT];
const HostDescriptor* host;
const NativeHostDescriptor* host;
#ifdef WANT_UI
struct control* ui;
#endif
};

PluginHandle
NativePluginHandle
nekofilter_instantiate(
const HostDescriptor* host)
const NativeHostDescriptor* host)
{
struct nekofilter * nekofilter_ptr;
unsigned int i;
@@ -134,14 +134,14 @@ nekofilter_instantiate(
&nekofilter_ptr->params_bands[i*BAND_PARAMETERS_COUNT + BAND_PARAMETER_GAIN]);
}

return (PluginHandle)nekofilter_ptr;
return (NativePluginHandle)nekofilter_ptr;
}

#define nekofilter_ptr ((struct nekofilter *)handle)

uint32_t
nekofilter_get_parameter_count(
PluginHandle handle)
NativePluginHandle handle)
{
return GLOBAL_PARAMETERS_COUNT + BAND_PARAMETERS_COUNT*BANDS_COUNT;

@@ -149,12 +149,12 @@ nekofilter_get_parameter_count(
(void)handle;
}

const Parameter*
const NativeParameter*
nekofilter_get_parameter_info(
PluginHandle handle,
NativePluginHandle handle,
uint32_t index)
{
static Parameter param;
static NativeParameter param;
static bool first_init = true;
uint32_t band;
char strBuf[32];
@@ -288,7 +288,7 @@ ready:

float
nekofilter_get_parameter_value(
PluginHandle handle,
NativePluginHandle handle,
uint32_t index)
{
if (index < GLOBAL_PARAMETERS_COUNT)
@@ -306,7 +306,7 @@ nekofilter_get_parameter_value(

void
nekofilter_set_parameter_value(
PluginHandle handle,
NativePluginHandle handle,
uint32_t index,
float value)
{
@@ -325,11 +325,11 @@ nekofilter_set_parameter_value(

void
nekofilter_process(
PluginHandle handle,
NativePluginHandle handle,
float** inBuffer,
float** outBuffer,
uint32_t frames,
const MidiEvent* midiEvents,
const NativeMidiEvent* midiEvents,
uint32_t midiEventCount)
{
LOG_DEBUG("nekofilter_run");
@@ -348,7 +348,7 @@ nekofilter_process(

#ifdef WANT_UI
void nekofilter_ui_show(
PluginHandle handle,
NativePluginHandle handle,
bool show)
{
if (show)
@@ -365,14 +365,14 @@ void nekofilter_ui_show(
}

void nekofilter_ui_idle(
PluginHandle handle)
NativePluginHandle handle)
{
if (nekofilter_ptr->ui != NULL)
nekoui_run(nekofilter_ptr->ui);
}

void nekofilter_ui_set_parameter_value(
PluginHandle handle,
NativePluginHandle handle,
uint32_t index,
float value)
{
@@ -383,7 +383,7 @@ void nekofilter_ui_set_parameter_value(

void
nekofilter_cleanup(
PluginHandle handle)
NativePluginHandle handle)
{
#ifdef WANT_UI
if (nekofilter_ptr->ui != NULL)


+ 2
- 2
source/modules/carla_native/nekofilter/ui.c View File

@@ -69,7 +69,7 @@

struct control
{
const HostDescriptor* host;
const NativeHostDescriptor* host;

bool running; /* true if UI launched and 'exiting' not received */
bool visible; /* true if 'show' sent */
@@ -365,7 +365,7 @@ static bool do_fork(const char * argv[6], int* ret)
static
struct control*
nekoui_instantiate(
const HostDescriptor* host)
const NativeHostDescriptor* host)
{
struct control * control_ptr;
char * filename;


+ 45
- 45
source/modules/carla_native/vex-fx.cpp View File

@@ -30,7 +30,7 @@ using namespace juce;

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

class VexArpPlugin : public PluginClass,
class VexArpPlugin : public NativePluginClass,
public PeggyViewComponent::Callback
{
public:
@@ -45,8 +45,8 @@ public:
kParamCount = kParamLast + VexArpSettings::kVelocitiesSize + VexArpSettings::kGridSize
};

VexArpPlugin(const HostDescriptor* const host)
: PluginClass(host),
VexArpPlugin(const NativeHostDescriptor* const host)
: NativePluginClass(host),
fArp(&fSettings),
fNeedsUpdate(true)
{
@@ -63,10 +63,10 @@ protected:
return kParamCount;
}

const Parameter* getParameterInfo(const uint32_t index) const override
const NativeParameter* getParameterInfo(const uint32_t index) const override
{
static Parameter paramInfo;
static ParameterScalePoint scalePoints[4];
static NativeParameter paramInfo;
static NativeParameterScalePoint scalePoints[4];
static char bufName[24+1];

int hints = PARAMETER_IS_ENABLED|PARAMETER_IS_AUTOMABLE;
@@ -183,7 +183,7 @@ protected:
paramInfo.name = bufName;
}

paramInfo.hints = static_cast<ParameterHints>(hints);
paramInfo.hints = static_cast<NativeParameterHints>(hints);
return &paramInfo;
}

@@ -261,7 +261,7 @@ protected:
// -------------------------------------------------------------------
// Plugin process calls

void process(float**, float**, const uint32_t frames, const MidiEvent* const midiEvents, const uint32_t midiEventCount) override
void process(float**, float**, const uint32_t frames, const NativeMidiEvent* const midiEvents, const uint32_t midiEventCount) override
{
if (! fSettings.on)
{
@@ -271,7 +271,7 @@ protected:
return;
}

const TimeInfo* const timeInfo(getTimeInfo());
const NativeTimeInfo* const timeInfo(getTimeInfo());

bool timePlaying = false;
double ppqPos = 0.0;
@@ -298,7 +298,7 @@ protected:

for (uint32_t i=0; i < midiEventCount; ++i)
{
const MidiEvent* const midiEvent(&midiEvents[i]);
const NativeMidiEvent* const midiEvent(&midiEvents[i]);
fMidiInBuffer.addEvent(midiEvent->data, midiEvent->size, midiEvent->time);
}

@@ -309,7 +309,7 @@ protected:
int numBytes;
int sampleNumber;

MidiEvent tmpEvent;
NativeMidiEvent tmpEvent;
tmpEvent.port = 0;

while (outBufferIterator.getNextEvent(midiData, numBytes, sampleNumber))
@@ -429,7 +429,7 @@ private:

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

class VexChorusPlugin : public PluginClass
class VexChorusPlugin : public NativePluginClass
{
public:
enum Params {
@@ -438,8 +438,8 @@ public:
kParamCount
};

VexChorusPlugin(const HostDescriptor* const host)
: PluginClass(host),
VexChorusPlugin(const NativeHostDescriptor* const host)
: NativePluginClass(host),
fChorus(fParameters)
{
std::memset(fParameters, 0, sizeof(float)*92);
@@ -459,9 +459,9 @@ protected:
return kParamCount;
}

const Parameter* getParameterInfo(const uint32_t index) const override
const NativeParameter* getParameterInfo(const uint32_t index) const override
{
static Parameter paramInfo;
static NativeParameter paramInfo;

int hints = PARAMETER_IS_ENABLED|PARAMETER_IS_AUTOMABLE;

@@ -488,7 +488,7 @@ protected:
break;
}

paramInfo.hints = static_cast<ParameterHints>(hints);
paramInfo.hints = static_cast<NativeParameterHints>(hints);

return &paramInfo;
}
@@ -527,7 +527,7 @@ protected:
// -------------------------------------------------------------------
// Plugin process calls

void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const MidiEvent* const, const uint32_t) override
void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const NativeMidiEvent* const, const uint32_t) override
{
if (inBuffer[0] != outBuffer[0])
FloatVectorOperations::copy(outBuffer[0], inBuffer[0], frames);
@@ -555,7 +555,7 @@ private:

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

class VexDelayPlugin : public PluginClass
class VexDelayPlugin : public NativePluginClass
{
public:
enum Params {
@@ -564,8 +564,8 @@ public:
kParamCount
};

VexDelayPlugin(const HostDescriptor* const host)
: PluginClass(host),
VexDelayPlugin(const NativeHostDescriptor* const host)
: NativePluginClass(host),
fDelay(fParameters)
{
std::memset(fParameters, 0, sizeof(float)*92);
@@ -585,9 +585,9 @@ protected:
return kParamCount;
}

const Parameter* getParameterInfo(const uint32_t index) const override
const NativeParameter* getParameterInfo(const uint32_t index) const override
{
static Parameter paramInfo;
static NativeParameter paramInfo;

int hints = PARAMETER_IS_ENABLED|PARAMETER_IS_AUTOMABLE;

@@ -621,7 +621,7 @@ protected:
break;
}

paramInfo.hints = static_cast<ParameterHints>(hints);
paramInfo.hints = static_cast<NativeParameterHints>(hints);

return &paramInfo;
}
@@ -660,14 +660,14 @@ protected:
// -------------------------------------------------------------------
// Plugin process calls

void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const MidiEvent* const, const uint32_t) override
void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const NativeMidiEvent* const, const uint32_t) override
{
if (inBuffer[0] != outBuffer[0])
FloatVectorOperations::copy(outBuffer[0], inBuffer[0], frames);
if (inBuffer[1] != outBuffer[1])
FloatVectorOperations::copy(outBuffer[1], inBuffer[1], frames);

const TimeInfo* const timeInfo(getTimeInfo());
const NativeTimeInfo* const timeInfo(getTimeInfo());
const double bpm((timeInfo != nullptr && timeInfo->bbt.valid) ? timeInfo->bbt.beatsPerMinute : 120.0);

fDelay.processBlock(outBuffer[0], outBuffer[1], frames, bpm);
@@ -691,7 +691,7 @@ private:

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

class VexReverbPlugin : public PluginClass
class VexReverbPlugin : public NativePluginClass
{
public:
enum Params {
@@ -701,8 +701,8 @@ public:
kParamCount
};

VexReverbPlugin(const HostDescriptor* const host)
: PluginClass(host),
VexReverbPlugin(const NativeHostDescriptor* const host)
: NativePluginClass(host),
fReverb(fParameters)
{
std::memset(fParameters, 0, sizeof(float)*92);
@@ -721,9 +721,9 @@ protected:
return kParamCount;
}

const Parameter* getParameterInfo(const uint32_t index) const override
const NativeParameter* getParameterInfo(const uint32_t index) const override
{
static Parameter paramInfo;
static NativeParameter paramInfo;

int hints = PARAMETER_IS_ENABLED|PARAMETER_IS_AUTOMABLE;

@@ -754,7 +754,7 @@ protected:
break;
}

paramInfo.hints = static_cast<ParameterHints>(hints);
paramInfo.hints = static_cast<NativeParameterHints>(hints);

return &paramInfo;
}
@@ -798,7 +798,7 @@ protected:
// -------------------------------------------------------------------
// Plugin process calls

void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const MidiEvent* const, const uint32_t) override
void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const NativeMidiEvent* const, const uint32_t) override
{
for (uint32_t i=0; i< frames; ++i)
FloatVectorOperations::copyWithMultiply(outBuffer[0], inBuffer[0], 0.5f, frames);
@@ -818,10 +818,10 @@ private:

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

static const PluginDescriptor vexArpDesc = {
static const NativePluginDescriptor vexArpDesc = {
/* category */ PLUGIN_CATEGORY_UTILITY,
/* hints */ static_cast<PluginHints>(PLUGIN_HAS_GUI|PLUGIN_NEEDS_UI_JUCE|PLUGIN_USES_TIME),
/* supports */ static_cast<PluginSupports>(PLUGIN_SUPPORTS_EVERYTHING),
/* hints */ static_cast<NativePluginHints>(PLUGIN_HAS_UI|PLUGIN_NEEDS_UI_JUCE|PLUGIN_USES_TIME),
/* supports */ static_cast<NativePluginSupports>(PLUGIN_SUPPORTS_EVERYTHING),
/* audioIns */ 0,
/* audioOuts */ 0,
/* midiIns */ 1,
@@ -835,10 +835,10 @@ static const PluginDescriptor vexArpDesc = {
PluginDescriptorFILL(VexArpPlugin)
};

static const PluginDescriptor vexChorusDesc = {
static const NativePluginDescriptor vexChorusDesc = {
/* category */ PLUGIN_CATEGORY_MODULATOR,
/* hints */ static_cast<PluginHints>(PLUGIN_IS_RTSAFE),
/* supports */ static_cast<PluginSupports>(0x0),
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ 2,
/* audioOuts */ 2,
/* midiIns */ 0,
@@ -852,10 +852,10 @@ static const PluginDescriptor vexChorusDesc = {
PluginDescriptorFILL(VexChorusPlugin)
};

static const PluginDescriptor vexDelayDesc = {
static const NativePluginDescriptor vexDelayDesc = {
/* category */ PLUGIN_CATEGORY_DELAY,
/* hints */ static_cast<PluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_USES_TIME),
/* supports */ static_cast<PluginSupports>(0x0),
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_USES_TIME),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ 2,
/* audioOuts */ 2,
/* midiIns */ 0,
@@ -869,10 +869,10 @@ static const PluginDescriptor vexDelayDesc = {
PluginDescriptorFILL(VexDelayPlugin)
};

static const PluginDescriptor vexReverbDesc = {
static const NativePluginDescriptor vexReverbDesc = {
/* category */ PLUGIN_CATEGORY_DELAY,
/* hints */ static_cast<PluginHints>(PLUGIN_IS_RTSAFE),
/* supports */ static_cast<PluginSupports>(0x0),
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ 2,
/* audioOuts */ 2,
/* midiIns */ 0,


+ 73
- 73
source/modules/carla_native/zynaddsubfx-fx.cpp View File

@@ -32,11 +32,11 @@ using juce::FloatVectorOperations;

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

class FxAbstractPlugin : public PluginClass
class FxAbstractPlugin : public NativePluginClass
{
protected:
FxAbstractPlugin(const HostDescriptor* const host, const uint32_t paramCount, const uint32_t programCount)
: PluginClass(host),
FxAbstractPlugin(const NativeHostDescriptor* const host, const uint32_t paramCount, const uint32_t programCount)
: NativePluginClass(host),
fParamCount(paramCount-2), // volume and pan handled by host
fProgramCount(programCount),
fEffect(nullptr),
@@ -135,7 +135,7 @@ protected:
}
}

void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const MidiEvent* const, const uint32_t) final
void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const NativeMidiEvent* const, const uint32_t) final
{
fEffect->out(Stereo<float*>(inBuffer[0], inBuffer[1]));

@@ -199,7 +199,7 @@ protected:
class FxAlienWahPlugin : public FxAbstractPlugin
{
public:
FxAlienWahPlugin(const HostDescriptor* const host)
FxAlienWahPlugin(const NativeHostDescriptor* const host)
: FxAbstractPlugin(host, 11, 4)
{
fEffect = new Alienwah(false, efxoutl, efxoutr, getSampleRate(), getBufferSize());
@@ -209,13 +209,13 @@ protected:
// -------------------------------------------------------------------
// Plugin parameter calls

const Parameter* getParameterInfo(const uint32_t index) const override
const NativeParameter* getParameterInfo(const uint32_t index) const override
{
if (index >= fParamCount)
return nullptr;

static Parameter param;
static ParameterScalePoint scalePoints[2];
static NativeParameter param;
static NativeParameterScalePoint scalePoints[2];

int hints = PARAMETER_IS_ENABLED|PARAMETER_IS_INTEGER;

@@ -287,7 +287,7 @@ protected:
break;
}

param.hints = static_cast<ParameterHints>(hints);
param.hints = static_cast<NativeParameterHints>(hints);

return &param;
}
@@ -295,12 +295,12 @@ protected:
// -------------------------------------------------------------------
// Plugin midi-program calls

const MidiProgram* getMidiProgramInfo(const uint32_t index) const override
const NativeMidiProgram* getMidiProgramInfo(const uint32_t index) const override
{
if (index >= fProgramCount)
return nullptr;

static MidiProgram midiProg;
static NativeMidiProgram midiProg;

midiProg.bank = 0;
midiProg.program = index;
@@ -344,7 +344,7 @@ protected:
class FxChorusPlugin : public FxAbstractPlugin
{
public:
FxChorusPlugin(const HostDescriptor* const host)
FxChorusPlugin(const NativeHostDescriptor* const host)
: FxAbstractPlugin(host, 12, 10)
{
fEffect = new Chorus(false, efxoutl, efxoutr, getSampleRate(), getBufferSize());
@@ -354,13 +354,13 @@ protected:
// -------------------------------------------------------------------
// Plugin parameter calls

const Parameter* getParameterInfo(const uint32_t index) const override
const NativeParameter* getParameterInfo(const uint32_t index) const override
{
if (index >= fParamCount)
return nullptr;

static Parameter param;
static ParameterScalePoint scalePoints[2];
static NativeParameter param;
static NativeParameterScalePoint scalePoints[2];

int hints = PARAMETER_IS_ENABLED|PARAMETER_IS_INTEGER;

@@ -438,7 +438,7 @@ protected:
break;
}

param.hints = static_cast<ParameterHints>(hints);
param.hints = static_cast<NativeParameterHints>(hints);

return &param;
}
@@ -446,12 +446,12 @@ protected:
// -------------------------------------------------------------------
// Plugin midi-program calls

const MidiProgram* getMidiProgramInfo(const uint32_t index) const override
const NativeMidiProgram* getMidiProgramInfo(const uint32_t index) const override
{
if (index >= fProgramCount)
return nullptr;

static MidiProgram midiProg;
static NativeMidiProgram midiProg;

midiProg.bank = 0;
midiProg.program = index;
@@ -513,7 +513,7 @@ protected:
class FxDistortionPlugin : public FxAbstractPlugin
{
public:
FxDistortionPlugin(const HostDescriptor* const host)
FxDistortionPlugin(const NativeHostDescriptor* const host)
: FxAbstractPlugin(host, 11, 6)
{
fEffect = new Distorsion(false, efxoutl, efxoutr, getSampleRate(), getBufferSize());
@@ -523,13 +523,13 @@ protected:
// -------------------------------------------------------------------
// Plugin parameter calls

const Parameter* getParameterInfo(const uint32_t index) const override
const NativeParameter* getParameterInfo(const uint32_t index) const override
{
if (index >= fParamCount)
return nullptr;

static Parameter param;
static ParameterScalePoint scalePoints[14];
static NativeParameter param;
static NativeParameterScalePoint scalePoints[14];

int hints = PARAMETER_IS_ENABLED|PARAMETER_IS_INTEGER;

@@ -627,7 +627,7 @@ protected:
break;
}

param.hints = static_cast<ParameterHints>(hints);
param.hints = static_cast<NativeParameterHints>(hints);

return &param;
}
@@ -635,12 +635,12 @@ protected:
// -------------------------------------------------------------------
// Plugin midi-program calls

const MidiProgram* getMidiProgramInfo(const uint32_t index) const override
const NativeMidiProgram* getMidiProgramInfo(const uint32_t index) const override
{
if (index >= fProgramCount)
return nullptr;

static MidiProgram midiProg;
static NativeMidiProgram midiProg;

midiProg.bank = 0;
midiProg.program = index;
@@ -690,7 +690,7 @@ protected:
class FxDynamicFilterPlugin : public FxAbstractPlugin
{
public:
FxDynamicFilterPlugin(const HostDescriptor* const host)
FxDynamicFilterPlugin(const NativeHostDescriptor* const host)
: FxAbstractPlugin(host, 10, 5)
{
fEffect = new DynamicFilter(false, efxoutl, efxoutr, getSampleRate(), getBufferSize());
@@ -700,13 +700,13 @@ protected:
// -------------------------------------------------------------------
// Plugin parameter calls

const Parameter* getParameterInfo(const uint32_t index) const override
const NativeParameter* getParameterInfo(const uint32_t index) const override
{
if (index >= fParamCount)
return nullptr;

static Parameter param;
static ParameterScalePoint scalePoints[2];
static NativeParameter param;
static NativeParameterScalePoint scalePoints[2];

int hints = PARAMETER_IS_ENABLED|PARAMETER_IS_INTEGER;

@@ -773,7 +773,7 @@ protected:
break;
}

param.hints = static_cast<ParameterHints>(hints);
param.hints = static_cast<NativeParameterHints>(hints);

return &param;
}
@@ -781,12 +781,12 @@ protected:
// -------------------------------------------------------------------
// Plugin midi-program calls

const MidiProgram* getMidiProgramInfo(const uint32_t index) const override
const NativeMidiProgram* getMidiProgramInfo(const uint32_t index) const override
{
if (index >= fProgramCount)
return nullptr;

static MidiProgram midiProg;
static NativeMidiProgram midiProg;

midiProg.bank = 0;
midiProg.program = index;
@@ -833,7 +833,7 @@ protected:
class FxEchoPlugin : public FxAbstractPlugin
{
public:
FxEchoPlugin(const HostDescriptor* const host)
FxEchoPlugin(const NativeHostDescriptor* const host)
: FxAbstractPlugin(host, 7, 9)
{
fEffect = new Echo(false, efxoutl, efxoutr, getSampleRate(), getBufferSize());
@@ -843,12 +843,12 @@ protected:
// -------------------------------------------------------------------
// Plugin parameter calls

const Parameter* getParameterInfo(const uint32_t index) const override
const NativeParameter* getParameterInfo(const uint32_t index) const override
{
if (index >= fParamCount)
return nullptr;

static Parameter param;
static NativeParameter param;

int hints = PARAMETER_IS_ENABLED|PARAMETER_IS_INTEGER;

@@ -892,7 +892,7 @@ protected:
break;
}

param.hints = static_cast<ParameterHints>(hints);
param.hints = static_cast<NativeParameterHints>(hints);

return &param;
}
@@ -900,12 +900,12 @@ protected:
// -------------------------------------------------------------------
// Plugin midi-program calls

const MidiProgram* getMidiProgramInfo(const uint32_t index) const override
const NativeMidiProgram* getMidiProgramInfo(const uint32_t index) const override
{
if (index >= fProgramCount)
return nullptr;

static MidiProgram midiProg;
static NativeMidiProgram midiProg;

midiProg.bank = 0;
midiProg.program = index;
@@ -964,7 +964,7 @@ protected:
class FxPhaserPlugin : public FxAbstractPlugin
{
public:
FxPhaserPlugin(const HostDescriptor* const host)
FxPhaserPlugin(const NativeHostDescriptor* const host)
: FxAbstractPlugin(host, 15, 12)
{
fEffect = new Phaser(false, efxoutl, efxoutr, getSampleRate(), getBufferSize());
@@ -974,13 +974,13 @@ protected:
// -------------------------------------------------------------------
// Plugin parameter calls

const Parameter* getParameterInfo(const uint32_t index) const override
const NativeParameter* getParameterInfo(const uint32_t index) const override
{
if (index >= fParamCount)
return nullptr;

static Parameter param;
static ParameterScalePoint scalePoints[2];
static NativeParameter param;
static NativeParameterScalePoint scalePoints[2];

int hints = PARAMETER_IS_ENABLED|PARAMETER_IS_INTEGER;

@@ -1075,7 +1075,7 @@ protected:
break;
}

param.hints = static_cast<ParameterHints>(hints);
param.hints = static_cast<NativeParameterHints>(hints);

return &param;
}
@@ -1083,12 +1083,12 @@ protected:
// -------------------------------------------------------------------
// Plugin midi-program calls

const MidiProgram* getMidiProgramInfo(const uint32_t index) const override
const NativeMidiProgram* getMidiProgramInfo(const uint32_t index) const override
{
if (index >= fProgramCount)
return nullptr;

static MidiProgram midiProg;
static NativeMidiProgram midiProg;

midiProg.bank = 0;
midiProg.program = index;
@@ -1156,7 +1156,7 @@ protected:
class FxReverbPlugin : public FxAbstractPlugin
{
public:
FxReverbPlugin(const HostDescriptor* const host)
FxReverbPlugin(const NativeHostDescriptor* const host)
: FxAbstractPlugin(host, 13, 13)
{
fEffect = new Reverb(false, efxoutl, efxoutr, getSampleRate(), getBufferSize());
@@ -1166,13 +1166,13 @@ protected:
// -------------------------------------------------------------------
// Plugin parameter calls

const Parameter* getParameterInfo(const uint32_t index) const override
const NativeParameter* getParameterInfo(const uint32_t index) const override
{
if (index >= fParamCount)
return nullptr;

static Parameter param;
static ParameterScalePoint scalePoints[3];
static NativeParameter param;
static NativeParameterScalePoint scalePoints[3];

int hints = PARAMETER_IS_ENABLED | PARAMETER_IS_INTEGER;

@@ -1250,7 +1250,7 @@ protected:
break;
}

param.hints = static_cast<ParameterHints>(hints);
param.hints = static_cast<NativeParameterHints>(hints);

return &param;
}
@@ -1258,12 +1258,12 @@ protected:
// -------------------------------------------------------------------
// Plugin midi-program calls

const MidiProgram* getMidiProgramInfo(const uint32_t index) const override
const NativeMidiProgram* getMidiProgramInfo(const uint32_t index) const override
{
if (index >= fProgramCount)
return nullptr;

static MidiProgram midiProg;
static NativeMidiProgram midiProg;

midiProg.bank = 0;
midiProg.program = index;
@@ -1331,10 +1331,10 @@ protected:

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

static const PluginDescriptor fxAlienWahDesc = {
static const NativePluginDescriptor fxAlienWahDesc = {
/* category */ PLUGIN_CATEGORY_MODULATOR,
/* hints */ static_cast<PluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_USES_PANNING|PLUGIN_NEEDS_FIXED_BUFFERS),
/* supports */ static_cast<PluginSupports>(0x0),
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_USES_PANNING|PLUGIN_NEEDS_FIXED_BUFFERS),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ 2,
/* audioOuts */ 2,
/* midiIns */ 0,
@@ -1348,10 +1348,10 @@ static const PluginDescriptor fxAlienWahDesc = {
PluginDescriptorFILL(FxAlienWahPlugin)
};

static const PluginDescriptor fxChorusDesc = {
static const NativePluginDescriptor fxChorusDesc = {
/* category */ PLUGIN_CATEGORY_MODULATOR,
/* hints */ static_cast<PluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_USES_PANNING|PLUGIN_NEEDS_FIXED_BUFFERS),
/* supports */ static_cast<PluginSupports>(0x0),
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_USES_PANNING|PLUGIN_NEEDS_FIXED_BUFFERS),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ 2,
/* audioOuts */ 2,
/* midiIns */ 0,
@@ -1365,10 +1365,10 @@ static const PluginDescriptor fxChorusDesc = {
PluginDescriptorFILL(FxChorusPlugin)
};

static const PluginDescriptor fxDistortionDesc = {
static const NativePluginDescriptor fxDistortionDesc = {
/* category */ PLUGIN_CATEGORY_MODULATOR,
/* hints */ static_cast<PluginHints>(PLUGIN_USES_PANNING|PLUGIN_NEEDS_FIXED_BUFFERS),
/* supports */ static_cast<PluginSupports>(0x0),
/* hints */ static_cast<NativePluginHints>(PLUGIN_USES_PANNING|PLUGIN_NEEDS_FIXED_BUFFERS),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ 2,
/* audioOuts */ 2,
/* midiIns */ 0,
@@ -1382,10 +1382,10 @@ static const PluginDescriptor fxDistortionDesc = {
PluginDescriptorFILL(FxDistortionPlugin)
};

static const PluginDescriptor fxDynamicFilterDesc = {
static const NativePluginDescriptor fxDynamicFilterDesc = {
/* category */ PLUGIN_CATEGORY_FILTER,
/* hints */ static_cast<PluginHints>(PLUGIN_USES_PANNING|PLUGIN_NEEDS_FIXED_BUFFERS),
/* supports */ static_cast<PluginSupports>(0x0),
/* hints */ static_cast<NativePluginHints>(PLUGIN_USES_PANNING|PLUGIN_NEEDS_FIXED_BUFFERS),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ 2,
/* audioOuts */ 2,
/* midiIns */ 0,
@@ -1399,10 +1399,10 @@ static const PluginDescriptor fxDynamicFilterDesc = {
PluginDescriptorFILL(FxDynamicFilterPlugin)
};

static const PluginDescriptor fxEchoDesc = {
static const NativePluginDescriptor fxEchoDesc = {
/* category */ PLUGIN_CATEGORY_DELAY,
/* hints */ static_cast<PluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_USES_PANNING|PLUGIN_NEEDS_FIXED_BUFFERS),
/* supports */ static_cast<PluginSupports>(0x0),
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_USES_PANNING|PLUGIN_NEEDS_FIXED_BUFFERS),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ 2,
/* audioOuts */ 2,
/* midiIns */ 0,
@@ -1416,10 +1416,10 @@ static const PluginDescriptor fxEchoDesc = {
PluginDescriptorFILL(FxEchoPlugin)
};

static const PluginDescriptor fxPhaserDesc = {
static const NativePluginDescriptor fxPhaserDesc = {
/* category */ PLUGIN_CATEGORY_MODULATOR,
/* hints */ static_cast<PluginHints>(PLUGIN_USES_PANNING|PLUGIN_NEEDS_FIXED_BUFFERS),
/* supports */ static_cast<PluginSupports>(0x0),
/* hints */ static_cast<NativePluginHints>(PLUGIN_USES_PANNING|PLUGIN_NEEDS_FIXED_BUFFERS),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ 2,
/* audioOuts */ 2,
/* midiIns */ 0,
@@ -1433,10 +1433,10 @@ static const PluginDescriptor fxPhaserDesc = {
PluginDescriptorFILL(FxPhaserPlugin)
};

static const PluginDescriptor fxReverbDesc = {
static const NativePluginDescriptor fxReverbDesc = {
/* category */ PLUGIN_CATEGORY_DELAY,
/* hints */ static_cast<PluginHints>(PLUGIN_USES_PANNING|PLUGIN_NEEDS_FIXED_BUFFERS),
/* supports */ static_cast<PluginSupports>(0x0),
/* hints */ static_cast<NativePluginHints>(PLUGIN_USES_PANNING|PLUGIN_NEEDS_FIXED_BUFFERS),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ 2,
/* audioOuts */ 2,
/* midiIns */ 0,


+ 19
- 19
source/modules/carla_native/zynaddsubfx-synth.cpp View File

@@ -174,7 +174,7 @@ public:
return fPrograms.count();
}

const MidiProgram* getInfo(const uint32_t index)
const NativeMidiProgram* getInfo(const uint32_t index)
{
if (index >= fPrograms.count())
return nullptr;
@@ -218,7 +218,7 @@ private:
};

bool fInitiated;
MidiProgram fRetProgram;
NativeMidiProgram fRetProgram;
List<const ProgramInfo*> fPrograms;

CARLA_DECLARE_NON_COPY_CLASS(ZynAddSubFxPrograms)
@@ -241,7 +241,7 @@ public:
CARLA_ASSERT(fCount == 0);
}

void addOne(const HostDescriptor* const host)
void addOne(const NativeHostDescriptor* const host)
{
if (fCount++ == 0)
{
@@ -278,7 +278,7 @@ public:
}
}

void reinit(const HostDescriptor* const host)
void reinit(const NativeHostDescriptor* const host)
{
Master::deleteInstance();

@@ -313,7 +313,7 @@ public:
Master::getInstance();
}

void maybeReinit(const HostDescriptor* const host)
void maybeReinit(const NativeHostDescriptor* const host)
{
if (host->get_buffer_size(host->handle) == static_cast<uint32_t>(synth->buffersize) &&
host->get_sample_rate(host->handle) == static_cast<double>(synth->samplerate))
@@ -335,7 +335,7 @@ static ZynAddSubFxInstanceCount sInstanceCount;
class ZynAddSubFxThread : public CarlaThread
{
public:
ZynAddSubFxThread(Master* const master, const HostDescriptor* const host)
ZynAddSubFxThread(Master* const master, const NativeHostDescriptor* const host)
: CarlaThread("ZynAddSubFxThread"),
fMaster(master),
kHost(host),
@@ -523,7 +523,7 @@ protected:

private:
Master* fMaster;
const HostDescriptor* const kHost;
const NativeHostDescriptor* const kHost;

#ifdef WANT_ZYNADDSUBFX_UI
MasterUI* fUi;
@@ -539,11 +539,11 @@ private:

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

class ZynAddSubFxPlugin : public PluginClass
class ZynAddSubFxPlugin : public NativePluginClass
{
public:
ZynAddSubFxPlugin(const HostDescriptor* const host)
: PluginClass(host),
ZynAddSubFxPlugin(const NativeHostDescriptor* const host)
: NativePluginClass(host),
fMaster(new Master()),
fSampleRate(getSampleRate()),
fIsActive(false),
@@ -571,7 +571,7 @@ protected:
return sPrograms.count();
}

const MidiProgram* getMidiProgramInfo(const uint32_t index) const override
const NativeMidiProgram* getMidiProgramInfo(const uint32_t index) const override
{
return sPrograms.getInfo(index);
}
@@ -621,7 +621,7 @@ protected:
fIsActive = false;
}

void process(float**, float** const outBuffer, const uint32_t frames, const MidiEvent* const midiEvents, const uint32_t midiEventCount) override
void process(float**, float** const outBuffer, const uint32_t frames, const NativeMidiEvent* const midiEvents, const uint32_t midiEventCount) override
{
if (pthread_mutex_trylock(&fMaster->mutex) != 0)
{
@@ -637,7 +637,7 @@ protected:

for (uint32_t i=0; i < midiEventCount; ++i)
{
const MidiEvent* const midiEvent(&midiEvents[i]);
const NativeMidiEvent* const midiEvent(&midiEvents[i]);

const uint8_t status = MIDI_GET_STATUS_FROM_DATA(midiEvent->data);
const uint8_t channel = MIDI_GET_CHANNEL_FROM_DATA(midiEvent->data);
@@ -774,12 +774,12 @@ private:
ZynAddSubFxThread fThread;

public:
static PluginHandle _instantiate(const HostDescriptor* host)
static NativePluginHandle _instantiate(const NativeHostDescriptor* host)
{
sInstanceCount.addOne(host);
return new ZynAddSubFxPlugin(host);
}
static void _cleanup(PluginHandle handle)
static void _cleanup(NativePluginHandle handle)
{
delete (ZynAddSubFxPlugin*)handle;
sInstanceCount.removeOne();
@@ -790,14 +790,14 @@ public:

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

static const PluginDescriptor zynaddsubfxDesc = {
static const NativePluginDescriptor zynaddsubfxDesc = {
/* category */ PLUGIN_CATEGORY_SYNTH,
#ifdef WANT_ZYNADDSUBFX_UI
/* hints */ static_cast<PluginHints>(PLUGIN_HAS_GUI|PLUGIN_USES_STATE),
/* hints */ static_cast<NativePluginHints>(PLUGIN_HAS_UI|PLUGIN_USES_STATE),
#else
/* hints */ static_cast<PluginHints>(PLUGIN_USES_STATE),
/* hints */ static_cast<NativePluginHints>(PLUGIN_USES_STATE),
#endif
/* supports */ static_cast<PluginSupports>(PLUGIN_SUPPORTS_CONTROL_CHANGES|PLUGIN_SUPPORTS_NOTE_AFTERTOUCH|PLUGIN_SUPPORTS_PITCHBEND|PLUGIN_SUPPORTS_ALL_SOUND_OFF),
/* supports */ static_cast<NativePluginSupports>(PLUGIN_SUPPORTS_CONTROL_CHANGES|PLUGIN_SUPPORTS_NOTE_AFTERTOUCH|PLUGIN_SUPPORTS_PITCHBEND|PLUGIN_SUPPORTS_ALL_SOUND_OFF),
/* audioIns */ 0,
/* audioOuts */ 2,
/* midiIns */ 1,


Loading…
Cancel
Save