Browse Source

Expose inline display on internal plugins; 2.0 Backwards compat fix

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.1-rc1
falkTX 6 years ago
parent
commit
0514349938
20 changed files with 110 additions and 48 deletions
  1. +17
    -7
      source/backend/engine/CarlaEngineNative.cpp
  2. +9
    -13
      source/backend/plugin/CarlaPluginNative.cpp
  3. +15
    -3
      source/includes/CarlaNative.h
  4. +19
    -2
      source/includes/CarlaNative.hpp
  5. +3
    -2
      source/native-plugins/_data.cpp
  6. +1
    -0
      source/native-plugins/bigmeter.cpp
  7. +3
    -1
      source/native-plugins/bypass.c
  8. +3
    -1
      source/native-plugins/lfo.c
  9. +4
    -2
      source/native-plugins/midi-channel-ab.c
  10. +3
    -1
      source/native-plugins/midi-channel-filter.c
  11. +3
    -1
      source/native-plugins/midi-channelize.c
  12. +3
    -1
      source/native-plugins/midi-gain.c
  13. +3
    -1
      source/native-plugins/midi-join.c
  14. +3
    -1
      source/native-plugins/midi-split.c
  15. +3
    -1
      source/native-plugins/midi-through.c
  16. +3
    -1
      source/native-plugins/midi-transpose.c
  17. +0
    -1
      source/plugin/carla-lv2-export.cpp
  18. +7
    -1
      source/plugin/carla-lv2.cpp
  19. +0
    -1
      source/plugin/carla-native-plugin.cpp
  20. +8
    -7
      source/plugin/carla-vst.cpp

+ 17
- 7
source/backend/engine/CarlaEngineNative.cpp View File

@@ -352,7 +352,11 @@ public:
if (pluginId != 0)
return;

pHost->ui_parameter_touch(pHost->handle, index, touch);
pHost->dispatcher(pHost->handle,
NATIVE_HOST_OPCODE_UI_TOUCH_PARAMETER,
static_cast<int32_t>(index),
touch ? 1 : 0,
nullptr, 0.0f);
}

void reloadFromUI()
@@ -2338,7 +2342,8 @@ static const NativePluginDescriptor carlaRackDesc = {
CarlaEngineNative::_process,
CarlaEngineNative::_get_state,
CarlaEngineNative::_set_state,
CarlaEngineNative::_dispatcher
CarlaEngineNative::_dispatcher,
/* _render_inline_dsplay */ nullptr
};

static const NativePluginDescriptor carlaRackNoMidiOutDesc = {
@@ -2379,7 +2384,8 @@ static const NativePluginDescriptor carlaRackNoMidiOutDesc = {
CarlaEngineNative::_process,
CarlaEngineNative::_get_state,
CarlaEngineNative::_set_state,
CarlaEngineNative::_dispatcher
CarlaEngineNative::_dispatcher,
/* _render_inline_dsplay */ nullptr
};

static const NativePluginDescriptor carlaPatchbayDesc = {
@@ -2420,7 +2426,8 @@ static const NativePluginDescriptor carlaPatchbayDesc = {
CarlaEngineNative::_process,
CarlaEngineNative::_get_state,
CarlaEngineNative::_set_state,
CarlaEngineNative::_dispatcher
CarlaEngineNative::_dispatcher,
/* _render_inline_dsplay */ nullptr
};

static const NativePluginDescriptor carlaPatchbay3sDesc = {
@@ -2461,7 +2468,8 @@ static const NativePluginDescriptor carlaPatchbay3sDesc = {
CarlaEngineNative::_process,
CarlaEngineNative::_get_state,
CarlaEngineNative::_set_state,
CarlaEngineNative::_dispatcher
CarlaEngineNative::_dispatcher,
/* _render_inline_dsplay */ nullptr
};

static const NativePluginDescriptor carlaPatchbay16Desc = {
@@ -2502,7 +2510,8 @@ static const NativePluginDescriptor carlaPatchbay16Desc = {
CarlaEngineNative::_process,
CarlaEngineNative::_get_state,
CarlaEngineNative::_set_state,
CarlaEngineNative::_dispatcher
CarlaEngineNative::_dispatcher,
/* _render_inline_dsplay */ nullptr
};

static const NativePluginDescriptor carlaPatchbay32Desc = {
@@ -2543,7 +2552,8 @@ static const NativePluginDescriptor carlaPatchbay32Desc = {
CarlaEngineNative::_process,
CarlaEngineNative::_get_state,
CarlaEngineNative::_set_state,
CarlaEngineNative::_dispatcher
CarlaEngineNative::_dispatcher,
/* _render_inline_dsplay */ nullptr
};

CARLA_BACKEND_END_NAMESPACE


+ 9
- 13
source/backend/plugin/CarlaPluginNative.cpp View File

@@ -251,6 +251,7 @@ public:
fIsOffline(false),
fIsUiAvailable(false),
fIsUiVisible(false),
fInlineDisplayNeedsRedraw(false),
fAudioInBuffers(nullptr),
fAudioOutBuffers(nullptr),
fMidiEventInCount(0),
@@ -279,7 +280,6 @@ public:
fHost.get_time_info = carla_host_get_time_info;
fHost.write_midi_event = carla_host_write_midi_event;
fHost.ui_parameter_changed = carla_host_ui_parameter_changed;
fHost.ui_parameter_touch = carla_host_ui_parameter_touch;
fHost.ui_custom_data_changed = carla_host_ui_custom_data_changed;
fHost.ui_closed = carla_host_ui_closed;
fHost.ui_open_file = carla_host_ui_open_file;
@@ -2394,11 +2394,6 @@ protected:
setParameterValue(index, value, false, true, true);
}

void handleUiParameterTouch(const uint32_t index, const bool touch) const
{
pData->engine->touchPluginParameter(pData->id, index, touch);
}

void handleUiCustomDataChanged(const char* const key, const char* const value)
{
setCustomData(CUSTOM_DATA_TYPE_STRING, key, value, false);
@@ -2460,13 +2455,18 @@ protected:
case NATIVE_HOST_OPCODE_INTERNAL_PLUGIN:
ret = 1;
break;
case NATIVE_HOST_OPCODE_QUEUE_INLINE_DISPLAY:
fInlineDisplayNeedsRedraw = true;
break;
case NATIVE_HOST_OPCODE_UI_TOUCH_PARAMETER:
CARLA_SAFE_ASSERT_RETURN(index >= 0, 0);
pData->engine->touchPluginParameter(pData->id, static_cast<uint32_t>(index), value != 0);
break;
}

return ret;

// unused for now
(void)index;
(void)value;
(void)ptr;
(void)opt;
}
@@ -2651,6 +2651,7 @@ private:
bool fIsOffline;
bool fIsUiAvailable;
bool fIsUiVisible;
bool fInlineDisplayNeedsRedraw;

float** fAudioInBuffers;
float** fAudioOutBuffers;
@@ -2702,11 +2703,6 @@ private:
handlePtr->handleUiParameterChanged(index, value);
}

static void carla_host_ui_parameter_touch(NativeHostHandle handle, uint32_t index, bool touch)
{
handlePtr->handleUiParameterTouch(index, touch);
}

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


+ 15
- 3
source/includes/CarlaNative.h View File

@@ -63,7 +63,8 @@ typedef enum {
NATIVE_PLUGIN_USES_PANNING = 1 << 8, /** uses stereo balance if unset (default) */
NATIVE_PLUGIN_USES_STATE = 1 << 9,
NATIVE_PLUGIN_USES_TIME = 1 << 10,
NATIVE_PLUGIN_USES_PARENT_ID = 1 << 11 /** can set transient hint to parent */
NATIVE_PLUGIN_USES_PARENT_ID = 1 << 11, /** can set transient hint to parent */
NATIVE_PLUGIN_HAS_INLINE_DISPLAY = 1 << 12
} NativePluginHints;

typedef enum {
@@ -106,7 +107,9 @@ typedef enum {
NATIVE_HOST_OPCODE_RELOAD_ALL = 5, /** nothing */
NATIVE_HOST_OPCODE_UI_UNAVAILABLE = 6, /** nothing */
NATIVE_HOST_OPCODE_HOST_IDLE = 7, /** nothing */
NATIVE_HOST_OPCODE_INTERNAL_PLUGIN = 8 /** nothing */
NATIVE_HOST_OPCODE_INTERNAL_PLUGIN = 8, /** nothing */
NATIVE_HOST_OPCODE_QUEUE_INLINE_DISPLAY = 9, /** nothing */
NATIVE_HOST_OPCODE_UI_TOUCH_PARAMETER = 10 /** uses index, value as bool */
} NativeHostDispatcherOpcode;

/* ------------------------------------------------------------------------------------------------------------
@@ -175,6 +178,13 @@ typedef struct {
NativeTimeInfoBBT bbt;
} NativeTimeInfo;

typedef struct {
unsigned char* data;
int width;
int height;
int stride;
} NativeInlineDisplayImageSurface;

/* ------------------------------------------------------------------------------------------------------------
* HostDescriptor */

@@ -192,7 +202,6 @@ typedef struct {
bool (*write_midi_event)(NativeHostHandle handle, const NativeMidiEvent* event);

void (*ui_parameter_changed)(NativeHostHandle handle, uint32_t index, float value);
void (*ui_parameter_touch)(NativeHostHandle handle, uint32_t index, bool touch);
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);
@@ -256,6 +265,9 @@ typedef struct _NativePluginDescriptor {
intptr_t (*dispatcher)(NativePluginHandle handle,
NativePluginDispatcherOpcode opcode, int32_t index, intptr_t value, void* ptr, float opt);

const NativeInlineDisplayImageSurface* (*render_inline_display)(NativePluginHandle handle,
uint32_t width, uint32_t height);

} NativePluginDescriptor;

/* ------------------------------------------------------------------------------------------------------------


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

@@ -117,7 +117,11 @@ protected:
{
CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,);

pHost->ui_parameter_touch(pHost->handle, index, touch);
pHost->dispatcher(pHost->handle,
NATIVE_HOST_OPCODE_UI_TOUCH_PARAMETER,
static_cast<int32_t>(index),
touch ? 1 : 0,
nullptr, 0.0f);
}

void uiMidiProgramChanged(const uint8_t channel, const uint32_t bank, const uint32_t program) const
@@ -376,6 +380,13 @@ protected:
CARLA_SAFE_ASSERT_RETURN(uiName != nullptr && uiName[0] != '\0',);
}

virtual const NativeInlineDisplayImageSurface* renderInlineDisplay(const uint32_t width, const uint32_t height)
{
CARLA_SAFE_ASSERT_RETURN(width > 0 && height > 0, nullptr);

return nullptr;
}

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

private:
@@ -511,6 +522,11 @@ public:
(void)index;
}

static const NativeInlineDisplayImageSurface* _render_inline_display(NativePluginHandle handle, uint32_t width, uint32_t height)
{
return handlePtr->renderInlineDisplay(width, height);
}

#undef handlePtr

CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(NativePluginClass)
@@ -553,7 +569,8 @@ public: \
ClassName::_process, \
ClassName::_get_state, \
ClassName::_set_state, \
ClassName::_dispatcher
ClassName::_dispatcher, \
ClassName::_render_inline_display

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



+ 3
- 2
source/native-plugins/_data.cpp View File

@@ -1,6 +1,6 @@
/*
* Carla Native Plugins
* Copyright (C) 2012-2018 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2019 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
@@ -24,7 +24,8 @@
nullptr, nullptr, nullptr, nullptr, nullptr, \
nullptr, nullptr, nullptr, nullptr, nullptr, \
nullptr, nullptr, nullptr, nullptr, nullptr, \
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr
nullptr, nullptr, nullptr, nullptr, nullptr, \
nullptr, nullptr

static const NativePluginDescriptor sNativePluginDescriptors[] = {



+ 1
- 0
source/native-plugins/bigmeter.cpp View File

@@ -174,6 +174,7 @@ private:
static const NativePluginDescriptor bigmeterDesc = {
/* category */ NATIVE_PLUGIN_CATEGORY_UTILITY,
/* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_RTSAFE
|NATIVE_PLUGIN_HAS_INLINE_DISPLAY
|NATIVE_PLUGIN_HAS_UI
|NATIVE_PLUGIN_NEEDS_FIXED_BUFFERS),
/* supports */ NATIVE_PLUGIN_SUPPORTS_NOTHING,


+ 3
- 1
source/native-plugins/bypass.c View File

@@ -89,7 +89,9 @@ static const NativePluginDescriptor bypassDesc = {
.get_state = NULL,
.set_state = NULL,

.dispatcher = NULL
.dispatcher = NULL,

.render_inline_display = NULL
};

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


+ 3
- 1
source/native-plugins/lfo.c View File

@@ -309,7 +309,9 @@ static const NativePluginDescriptor lfoDesc = {
.get_state = NULL,
.set_state = NULL,

.dispatcher = NULL
.dispatcher = NULL,

.render_inline_display = NULL
};

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


+ 4
- 2
source/native-plugins/midi-channel-ab.c View File

@@ -1,6 +1,6 @@
/*
* Carla Native Plugins
* Copyright (C) 2012-2018 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2019 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2018 Milk Brewster <code@milkmiruku.com>
*
* This program is free software; you can redistribute it and/or
@@ -198,7 +198,9 @@ static const NativePluginDescriptor midichanabDesc = {
.get_state = NULL,
.set_state = NULL,

.dispatcher = NULL
.dispatcher = NULL,

.render_inline_display = NULL
};

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


+ 3
- 1
source/native-plugins/midi-channel-filter.c View File

@@ -189,7 +189,9 @@ static const NativePluginDescriptor midichanfilterDesc = {
.get_state = NULL,
.set_state = NULL,

.dispatcher = NULL
.dispatcher = NULL,

.render_inline_display = NULL
};

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


+ 3
- 1
source/native-plugins/midi-channelize.c View File

@@ -197,7 +197,9 @@ static const NativePluginDescriptor midichannelizeDesc = {
.get_state = NULL,
.set_state = NULL,

.dispatcher = NULL
.dispatcher = NULL,

.render_inline_display = NULL
};

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


+ 3
- 1
source/native-plugins/midi-gain.c View File

@@ -259,7 +259,9 @@ static const NativePluginDescriptor midigainDesc = {
.get_state = NULL,
.set_state = NULL,

.dispatcher = NULL
.dispatcher = NULL,

.render_inline_display = NULL
};

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


+ 3
- 1
source/native-plugins/midi-join.c View File

@@ -136,7 +136,9 @@ static const NativePluginDescriptor midijoinDesc = {
.get_state = NULL,
.set_state = NULL,

.dispatcher = NULL
.dispatcher = NULL,

.render_inline_display = NULL
};

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


+ 3
- 1
source/native-plugins/midi-split.c View File

@@ -129,7 +129,9 @@ static const NativePluginDescriptor midisplitDesc = {
.get_state = NULL,
.set_state = NULL,

.dispatcher = NULL
.dispatcher = NULL,

.render_inline_display = NULL
};

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


+ 3
- 1
source/native-plugins/midi-through.c View File

@@ -110,7 +110,9 @@ static const NativePluginDescriptor midithroughDesc = {
.get_state = NULL,
.set_state = NULL,

.dispatcher = NULL
.dispatcher = NULL,

.render_inline_display = NULL
};

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


+ 3
- 1
source/native-plugins/midi-transpose.c View File

@@ -222,7 +222,9 @@ static const NativePluginDescriptor miditransposeDesc = {
.get_state = NULL,
.set_state = NULL,

.dispatcher = NULL
.dispatcher = NULL,

.render_inline_display = NULL
};

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


+ 0
- 1
source/plugin/carla-lv2-export.cpp View File

@@ -198,7 +198,6 @@ static void writePluginFile(const NativePluginDescriptor* const pluginDesc)
hostDesc.get_time_info = nullptr;
hostDesc.write_midi_event = nullptr;
hostDesc.ui_parameter_changed = nullptr;
hostDesc.ui_parameter_touch = nullptr;
hostDesc.ui_midi_program_changed = nullptr;
hostDesc.ui_custom_data_changed = nullptr;
hostDesc.ui_closed = nullptr;


+ 7
- 1
source/plugin/carla-lv2.cpp View File

@@ -94,7 +94,6 @@ public:
fHost.get_time_info = host_get_time_info;
fHost.write_midi_event = host_write_midi_event;
fHost.ui_parameter_changed = host_ui_parameter_changed;
fHost.ui_parameter_touch = host_ui_parameter_touch;
fHost.ui_custom_data_changed = host_ui_custom_data_changed;
fHost.ui_closed = host_ui_closed;
fHost.ui_open_file = host_ui_open_file;
@@ -713,11 +712,18 @@ protected:
case NATIVE_HOST_OPCODE_RELOAD_ALL:
case NATIVE_HOST_OPCODE_HOST_IDLE:
case NATIVE_HOST_OPCODE_INTERNAL_PLUGIN:
case NATIVE_HOST_OPCODE_QUEUE_INLINE_DISPLAY:
// nothing
break;

case NATIVE_HOST_OPCODE_UI_UNAVAILABLE:
handleUiClosed();
break;

case NATIVE_HOST_OPCODE_UI_TOUCH_PARAMETER:
CARLA_SAFE_ASSERT_RETURN(index >= 0, 0);
handleUiParameterTouch(static_cast<uint32_t>(index), value != 0);
break;
}

return ret;


+ 0
- 1
source/plugin/carla-native-plugin.cpp View File

@@ -81,7 +81,6 @@ int main()
nullptr, // write_midi_event

nullptr, // ui_parameter_changed
nullptr, // ui_parameter_touch
nullptr, // ui_midi_program_changed
nullptr, // ui_custom_data_changed
nullptr, // ui_closed


+ 8
- 7
source/plugin/carla-vst.cpp View File

@@ -131,7 +131,6 @@ public:
fHost.get_time_info = host_get_time_info;
fHost.write_midi_event = host_write_midi_event;
fHost.ui_parameter_changed = host_ui_parameter_changed;
fHost.ui_parameter_touch = host_ui_parameter_touch;
fHost.ui_custom_data_changed = host_ui_custom_data_changed;
fHost.ui_closed = host_ui_closed;
fHost.ui_open_file = host_ui_open_file;
@@ -761,6 +760,8 @@ protected:
case NATIVE_HOST_OPCODE_RELOAD_MIDI_PROGRAMS:
case NATIVE_HOST_OPCODE_UI_UNAVAILABLE:
case NATIVE_HOST_OPCODE_INTERNAL_PLUGIN:
case NATIVE_HOST_OPCODE_QUEUE_INLINE_DISPLAY:
// nothing
break;

case NATIVE_HOST_OPCODE_RELOAD_ALL:
@@ -770,12 +771,17 @@ protected:
case NATIVE_HOST_OPCODE_HOST_IDLE:
hostCallback(audioMasterIdle);
break;

case NATIVE_HOST_OPCODE_UI_TOUCH_PARAMETER:
CARLA_SAFE_ASSERT_RETURN(index >= 0, 0);
handleUiParameterTouch(static_cast<uint32_t>(index), value != 0);
break;
}

// unused for now
return 0;

(void)index; (void)value; (void)ptr; (void)opt;
(void)ptr; (void)opt;
}

private:
@@ -879,11 +885,6 @@ private:
handlePtr->handleUiParameterChanged(index, value);
}

static void host_ui_parameter_touch(NativeHostHandle handle, uint32_t index, bool touch)
{
handlePtr->handleUiParameterTouch(index, touch);
}

static void host_ui_custom_data_changed(NativeHostHandle handle, const char* key, const char* value)
{
handlePtr->handleUiCustomDataChanged(key, value);


Loading…
Cancel
Save