Browse Source

Adjustments as needed for Carla as OBS plugin

Signed-off-by: falkTX <falktx@falktx.com>
pull/1775/head
falkTX 2 years ago
parent
commit
96b67721b6
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
4 changed files with 91 additions and 13 deletions
  1. +72
    -1
      source/backend/engine/CarlaEngineNative.cpp
  2. +11
    -10
      source/includes/CarlaNative.h
  3. +2
    -1
      source/includes/CarlaNative.hpp
  4. +6
    -1
      source/includes/CarlaNativePlugin.h

+ 72
- 1
source/backend/engine/CarlaEngineNative.cpp View File

@@ -1,6 +1,6 @@
/*
* Carla Plugin Host
* Copyright (C) 2011-2022 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2023 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -1604,6 +1604,11 @@ public:
return new CarlaEngineNative(host, true, true, 64, 64, 32, 32);
}

static NativePluginHandle _instantiatePatchbayOBS(const NativeHostDescriptor* host)
{
return new CarlaEngineNative(host, true, true, 8, 8);
}

static void _cleanup(NativePluginHandle handle)
{
delete handlePtr;
@@ -1708,6 +1713,9 @@ public:
case NATIVE_PLUGIN_OPCODE_HOST_USES_EMBED:
handlePtr->fUsesEmbed = true;
return 0;
case NATIVE_PLUGIN_OPCODE_HOST_OPTION:
handlePtr->setOption(static_cast<EngineOption>(index), value, static_cast<const char*>(ptr));
return 0;
}

return 0;
@@ -2939,10 +2947,65 @@ static const NativePluginDescriptor carlaPatchbayCV32Desc = {
/* ui_height */ kUiHeight
};

static const NativePluginDescriptor carlaPatchbayOBS = {
/* category */ NATIVE_PLUGIN_CATEGORY_OTHER,
/* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_SYNTH
|NATIVE_PLUGIN_HAS_UI
|NATIVE_PLUGIN_NEEDS_UI_MAIN_THREAD
|NATIVE_PLUGIN_USES_STATE
|NATIVE_PLUGIN_USES_TIME
|NATIVE_PLUGIN_USES_UI_SIZE),
/* supports */ static_cast<NativePluginSupports>(NATIVE_PLUGIN_SUPPORTS_EVERYTHING),
/* audioIns */ 8,
/* audioOuts */ 8,
/* midiIns */ 0,
/* midiOuts */ 0,
/* paramIns */ kNumInParams,
/* paramOuts */ kNumOutParams,
/* name */ "Carla-Patchbay (OBS)",
/* label */ "carlapatchbayOBS",
/* maker */ "falkTX",
/* copyright */ "GNU GPL v2+",
CarlaEngineNative::_instantiatePatchbayOBS,
CarlaEngineNative::_cleanup,
CarlaEngineNative::_get_parameter_count,
CarlaEngineNative::_get_parameter_info,
CarlaEngineNative::_get_parameter_value,
/* _get_midi_program_count */ nullptr,
/* _get_midi_program_info */ nullptr,
CarlaEngineNative::_set_parameter_value,
/* _set_midi_program */ nullptr,
/* _set_custom_data */ nullptr,
#ifndef CARLA_ENGINE_WITHOUT_UI
CarlaEngineNative::_ui_show,
#else
nullptr,
#endif
CarlaEngineNative::_ui_idle,
CarlaEngineNative::_ui_set_parameter_value,
/* _ui_set_midi_program */ nullptr,
/* _ui_set_custom_data */ nullptr,
CarlaEngineNative::_activate,
CarlaEngineNative::_deactivate,
CarlaEngineNative::_process,
CarlaEngineNative::_get_state,
CarlaEngineNative::_set_state,
CarlaEngineNative::_dispatcher,
/* _render_inline_dsplay */ nullptr,
/* cvIns */ 0,
/* cvOuts */ 0,
/* _get_buffer_port_name */ nullptr,
/* _get_buffer_port_range */ nullptr,
/* ui_width */ kUiWidth,
/* ui_height */ kUiHeight
};

CARLA_BACKEND_END_NAMESPACE

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

#ifndef STATIC_PLUGIN_TARGET

CARLA_API_EXPORT
void carla_register_native_plugin_carla();

@@ -2959,6 +3022,8 @@ void carla_register_native_plugin_carla()
carla_register_native_plugin(&carlaPatchbayCVDesc);
}

#endif

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

const NativePluginDescriptor* carla_get_native_rack_plugin()
@@ -3009,6 +3074,12 @@ const NativePluginDescriptor* carla_get_native_patchbay_cv32_plugin()
return &carlaPatchbayCV32Desc;
}

const NativePluginDescriptor* carla_get_native_patchbay_obs_plugin()
{
CARLA_BACKEND_USE_NAMESPACE;
return &carlaPatchbayOBS;
}

// -----------------------------------------------------------------------
// Extra stuff for linking purposes



+ 11
- 10
source/includes/CarlaNative.h View File

@@ -1,6 +1,6 @@
/*
* Carla Native Plugin API
* Copyright (C) 2012-2019 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2023 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -100,15 +100,16 @@ typedef enum {
} NativeParameterHints;

typedef enum {
NATIVE_PLUGIN_OPCODE_NULL = 0, /** nothing */
NATIVE_PLUGIN_OPCODE_BUFFER_SIZE_CHANGED = 1, /** uses value */
NATIVE_PLUGIN_OPCODE_SAMPLE_RATE_CHANGED = 2, /** uses opt */
NATIVE_PLUGIN_OPCODE_OFFLINE_CHANGED = 3, /** uses value (0=off, 1=on) */
NATIVE_PLUGIN_OPCODE_UI_NAME_CHANGED = 4, /** uses ptr */
NATIVE_PLUGIN_OPCODE_GET_INTERNAL_HANDLE = 5, /** nothing */
NATIVE_PLUGIN_OPCODE_IDLE = 6, /** nothing */
NATIVE_PLUGIN_OPCODE_UI_MIDI_EVENT = 7, /** uses ptr */
NATIVE_PLUGIN_OPCODE_HOST_USES_EMBED = 8 /** nothing */
NATIVE_PLUGIN_OPCODE_NULL = 0, /** nothing */
NATIVE_PLUGIN_OPCODE_BUFFER_SIZE_CHANGED = 1, /** uses value */
NATIVE_PLUGIN_OPCODE_SAMPLE_RATE_CHANGED = 2, /** uses opt */
NATIVE_PLUGIN_OPCODE_OFFLINE_CHANGED = 3, /** uses value (0=off, 1=on) */
NATIVE_PLUGIN_OPCODE_UI_NAME_CHANGED = 4, /** uses ptr */
NATIVE_PLUGIN_OPCODE_GET_INTERNAL_HANDLE = 5, /** nothing */
NATIVE_PLUGIN_OPCODE_IDLE = 6, /** nothing */
NATIVE_PLUGIN_OPCODE_UI_MIDI_EVENT = 7, /** uses ptr */
NATIVE_PLUGIN_OPCODE_HOST_USES_EMBED = 8, /** nothing */
NATIVE_PLUGIN_OPCODE_HOST_OPTION = 9 /** uses index, value and ptr */
} NativePluginDispatcherOpcode;

typedef enum {


+ 2
- 1
source/includes/CarlaNative.hpp View File

@@ -1,6 +1,6 @@
/*
* Carla Native Plugin API (C++)
* Copyright (C) 2012-2019 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2023 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -567,6 +567,7 @@ public:
return handlePtr->uiMIDIEvent(static_cast<uint8_t>(index),
static_cast<uint8_t*>(ptr));
case NATIVE_PLUGIN_OPCODE_HOST_USES_EMBED:
case NATIVE_PLUGIN_OPCODE_HOST_OPTION:
return 0;
}



+ 6
- 1
source/includes/CarlaNativePlugin.h View File

@@ -1,6 +1,6 @@
/*
* Carla Plugin Host
* Copyright (C) 2011-2022 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2023 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -69,6 +69,11 @@ CARLA_API_EXPORT const NativePluginDescriptor* carla_get_native_patchbay_cv8_plu
*/
CARLA_API_EXPORT const NativePluginDescriptor* carla_get_native_patchbay_cv32_plugin(void);

/*!
* Get the native plugin descriptor for the carla-patchbay OBS plugin.
*/
CARLA_API_EXPORT const NativePluginDescriptor* carla_get_native_patchbay_obs_plugin(void);

/*!
* Create a CarlaHostHandle suitable for CarlaHost API calls.
* Returned value must be freed by the caller when no longer needed.


Loading…
Cancel
Save