Browse Source

Cleanup inline data and other last commits

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.1-rc1
falkTX 6 years ago
parent
commit
feacbe3ad1
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
5 changed files with 71 additions and 5 deletions
  1. +1
    -4
      source/backend/plugin/CarlaPluginLV2.cpp
  2. +31
    -0
      source/backend/plugin/CarlaPluginNative.cpp
  3. +7
    -0
      source/includes/CarlaNative.hpp
  4. +1
    -1
      source/modules/distrho/src/DistrhoPluginCarla.cpp
  5. +31
    -0
      source/native-plugins/bigmeter.cpp

+ 1
- 4
source/backend/plugin/CarlaPluginLV2.cpp View File

@@ -4737,11 +4737,8 @@ public:
if (pData->hints & PLUGIN_HAS_EXTENSION_WORKER) if (pData->hints & PLUGIN_HAS_EXTENSION_WORKER)
fExt.worker = (const LV2_Worker_Interface*)fDescriptor->extension_data(LV2_WORKER__interface); fExt.worker = (const LV2_Worker_Interface*)fDescriptor->extension_data(LV2_WORKER__interface);


// FIXME
// if (pData->hints & PLUGIN_HAS_EXTENSION_INLINE_DISPLAY)
{
if (pData->hints & PLUGIN_HAS_EXTENSION_INLINE_DISPLAY)
fExt.inlineDisplay = (const LV2_Inline_Display_Interface*)fDescriptor->extension_data(LV2_INLINEDISPLAY__interface); fExt.inlineDisplay = (const LV2_Inline_Display_Interface*)fDescriptor->extension_data(LV2_INLINEDISPLAY__interface);
}


// check if invalid // check if invalid
if (fExt.options != nullptr && fExt.options->get == nullptr && fExt.options->set == nullptr) if (fExt.options != nullptr && fExt.options->get == nullptr && fExt.options->set == nullptr)


+ 31
- 0
source/backend/plugin/CarlaPluginNative.cpp View File

@@ -21,6 +21,7 @@
#include "CarlaMathUtils.hpp" #include "CarlaMathUtils.hpp"
#include "CarlaNative.h" #include "CarlaNative.h"


#include "water/misc/Time.h"
#include "water/text/StringArray.h" #include "water/text/StringArray.h"


using water::jmax; using water::jmax;
@@ -252,6 +253,7 @@ public:
fIsUiAvailable(false), fIsUiAvailable(false),
fIsUiVisible(false), fIsUiVisible(false),
fInlineDisplayNeedsRedraw(false), fInlineDisplayNeedsRedraw(false),
fInlineDisplayLastRedrawTime(0),
fAudioInBuffers(nullptr), fAudioInBuffers(nullptr),
fAudioOutBuffers(nullptr), fAudioOutBuffers(nullptr),
fMidiEventInCount(0), fMidiEventInCount(0),
@@ -291,6 +293,8 @@ public:
{ {
carla_debug("CarlaPluginNative::~CarlaPluginNative()"); carla_debug("CarlaPluginNative::~CarlaPluginNative()");


fInlineDisplayNeedsRedraw = false;

// close UI // close UI
if (pData->hints & PLUGIN_HAS_CUSTOM_UI) if (pData->hints & PLUGIN_HAS_CUSTOM_UI)
{ {
@@ -915,6 +919,32 @@ public:
} }
} }


void idle() override
{
if (fInlineDisplayNeedsRedraw)
{
// TESTING
CARLA_SAFE_ASSERT(pData->enabled)
CARLA_SAFE_ASSERT(!pData->engine->isAboutToClose());
CARLA_SAFE_ASSERT(pData->client->isActive());

if (pData->enabled && !pData->engine->isAboutToClose() && pData->client->isActive())
{
const int64_t timeNow = water::Time::currentTimeMillis();

if (timeNow - fInlineDisplayLastRedrawTime > (1000 / 30))
{
fInlineDisplayNeedsRedraw = false;
fInlineDisplayLastRedrawTime = timeNow;
pData->engine->callback(true, true,
ENGINE_CALLBACK_INLINE_DISPLAY_REDRAW,
pData->id,
0, 0, 0, 0.0f, nullptr);
}
}
}
}

void uiIdle() override void uiIdle() override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
@@ -2666,6 +2696,7 @@ private:
bool fIsUiAvailable; bool fIsUiAvailable;
bool fIsUiVisible; bool fIsUiVisible;
bool fInlineDisplayNeedsRedraw; bool fInlineDisplayNeedsRedraw;
int64_t fInlineDisplayLastRedrawTime;


float** fAudioInBuffers; float** fAudioInBuffers;
float** fAudioOutBuffers; float** fAudioOutBuffers;


+ 7
- 0
source/includes/CarlaNative.hpp View File

@@ -225,6 +225,13 @@ protected:
pHost->dispatcher(pHost->handle, NATIVE_HOST_OPCODE_HOST_IDLE, 0, 0, nullptr, 0.0f); pHost->dispatcher(pHost->handle, NATIVE_HOST_OPCODE_HOST_IDLE, 0, 0, nullptr, 0.0f);
} }


void hostQueueDrawInlineDisplay()
{
CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,);

pHost->dispatcher(pHost->handle, NATIVE_HOST_OPCODE_QUEUE_INLINE_DISPLAY, 0, 0, nullptr, 0.0f);
}

// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Plugin parameter calls // Plugin parameter calls




+ 1
- 1
source/modules/distrho/src/DistrhoPluginCarla.cpp View File

@@ -100,7 +100,7 @@ public:
protected: protected:
void handleEditParameter(const uint32_t rindex, const bool touch) void handleEditParameter(const uint32_t rindex, const bool touch)
{ {
pHost->dispatcher(pHost->handle,
fHost->dispatcher(fHost->handle,
NATIVE_HOST_OPCODE_UI_TOUCH_PARAMETER, NATIVE_HOST_OPCODE_UI_TOUCH_PARAMETER,
static_cast<int32_t>(rindex), static_cast<int32_t>(rindex),
touch ? 1 : 0, touch ? 1 : 0,


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

@@ -159,6 +159,37 @@ protected:
{ {
fOutLeft = carla_findMaxNormalizedFloat(inputs[0], frames); fOutLeft = carla_findMaxNormalizedFloat(inputs[0], frames);
fOutRight = carla_findMaxNormalizedFloat(inputs[1], frames); fOutRight = carla_findMaxNormalizedFloat(inputs[1], frames);

hostQueueDrawInlineDisplay();
}

// -------------------------------------------------------------------
// Plugin dispatcher calls

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

#if 0
static unsigned char data[0xffff];

for (uint i=0; i < 0xffff-4; i+=4)
{
data[i+0] = 200;
data[i+1] = 0;
data[i+2] = 0;
data[i+3] = 255;
}

static const NativeInlineDisplayImageSurface nidims = {
data, (int)width, (int)height, (int)width * 4,
};

carla_stdout("rendering bigmeter %u %u | %i %i %i %i", width, height, data[0], data[1], data[2], data[3]);
return &nidims;
#else
return nullptr;
#endif
} }


private: private:


Loading…
Cancel
Save