@@ -44,7 +44,7 @@ rm ${CARLA_DIR}/source/modules/dgl/src/pugl-upstream/include/pugl/vulkan.h | |||
rm ${CARLA_DIR}/source/modules/distrho/DistrhoInfo.hpp | |||
rm ${CARLA_DIR}/source/modules/distrho/src/DistrhoPlugin{JACK,LADSPA+DSSI,LV2,LV2export,VST2,VST3}.cpp | |||
rm ${CARLA_DIR}/source/modules/distrho/src/DistrhoPluginVST3.hpp | |||
rm ${CARLA_DIR}/source/modules/distrho/src/DistrhoPluginVST.hpp | |||
rm ${CARLA_DIR}/source/modules/distrho/src/DistrhoUI{DSSI,LV2,VST3}.cpp | |||
rm ${CARLA_DIR}/source/modules/distrho/DistrhoStandaloneUtils.hpp | |||
@@ -55,9 +55,9 @@ DGL_EXT(PFNGLUSEPROGRAMPROC, glUseProgram) | |||
DGL_EXT(PFNGLVERTEXATTRIBPOINTERPROC, glVertexAttribPointer) | |||
DGL_EXT(PFNGLBLENDFUNCSEPARATEPROC, glBlendFuncSeparate) | |||
# ifdef DGL_USE_NANOVG_FBO | |||
DGL_EXT(PFNGLCHECKFRAMEBUFFERSTATUSPROC, glCheckFramebufferStatus) | |||
DGL_EXT(PFNGLBINDFRAMEBUFFERPROC, glBindFramebuffer) | |||
DGL_EXT(PFNGLBINDRENDERBUFFERPROC, glBindRenderbuffer) | |||
DGL_EXT(PFNGLCHECKFRAMEBUFFERSTATUSPROC, glCheckFramebufferStatus) | |||
DGL_EXT(PFNGLDELETEFRAMEBUFFERSPROC, glDeleteFramebuffers) | |||
DGL_EXT(PFNGLDELETERENDERBUFFERSPROC, glDeleteRenderbuffers) | |||
DGL_EXT(PFNGLFRAMEBUFFERTEXTURE2DPROC, glFramebufferTexture2D) | |||
@@ -140,6 +140,11 @@ NVGcontext* nvgCreateGL(int flags) | |||
# define DGL_EXT(PROC, func) \ | |||
if (needsInit) func = (PROC) wglGetProcAddress ( #func ); \ | |||
DISTRHO_SAFE_ASSERT_RETURN(func != nullptr, nullptr); | |||
# define DGL_EXT2(PROC, func, fallback) \ | |||
if (needsInit) { \ | |||
func = (PROC) wglGetProcAddress ( #func ); \ | |||
if (func == nullptr) func = (PROC) wglGetProcAddress ( #fallback ); \ | |||
} DISTRHO_SAFE_ASSERT_RETURN(func != nullptr, nullptr); | |||
DGL_EXT(PFNGLACTIVETEXTUREPROC, glActiveTexture) | |||
DGL_EXT(PFNGLATTACHSHADERPROC, glAttachShader) | |||
DGL_EXT(PFNGLBINDATTRIBLOCATIONPROC, glBindAttribLocation) | |||
@@ -169,16 +174,16 @@ DGL_EXT(PFNGLUSEPROGRAMPROC, glUseProgram) | |||
DGL_EXT(PFNGLVERTEXATTRIBPOINTERPROC, glVertexAttribPointer) | |||
DGL_EXT(PFNGLBLENDFUNCSEPARATEPROC, glBlendFuncSeparate) | |||
# ifdef DGL_USE_NANOVG_FBO | |||
DGL_EXT(PFNGLBINDFRAMEBUFFERPROC, glBindFramebuffer) | |||
DGL_EXT(PFNGLBINDRENDERBUFFERPROC, glBindRenderbuffer) | |||
DGL_EXT(PFNGLCHECKFRAMEBUFFERSTATUSPROC, glCheckFramebufferStatus) | |||
DGL_EXT(PFNGLDELETEFRAMEBUFFERSPROC, glDeleteFramebuffers) | |||
DGL_EXT(PFNGLDELETERENDERBUFFERSPROC, glDeleteRenderbuffers) | |||
DGL_EXT(PFNGLFRAMEBUFFERTEXTURE2DPROC, glFramebufferTexture2D) | |||
DGL_EXT(PFNGLFRAMEBUFFERRENDERBUFFERPROC, glFramebufferRenderbuffer) | |||
DGL_EXT(PFNGLGENFRAMEBUFFERSPROC, glGenFramebuffers) | |||
DGL_EXT(PFNGLGENRENDERBUFFERSPROC, glGenRenderbuffers) | |||
DGL_EXT(PFNGLRENDERBUFFERSTORAGEPROC, glRenderbufferStorage) | |||
DGL_EXT2(PFNGLBINDFRAMEBUFFERPROC, glBindFramebuffer, glBindFramebufferEXT) | |||
DGL_EXT2(PFNGLBINDRENDERBUFFERPROC, glBindRenderbuffer, glBindRenderbufferEXT) | |||
DGL_EXT2(PFNGLDELETEFRAMEBUFFERSPROC, glDeleteFramebuffers, glDeleteFramebuffersEXT) | |||
DGL_EXT2(PFNGLDELETERENDERBUFFERSPROC, glDeleteRenderbuffers, glDeleteRenderbuffersEXT) | |||
DGL_EXT2(PFNGLFRAMEBUFFERTEXTURE2DPROC, glFramebufferTexture2D, glFramebufferTexture2DEXT) | |||
DGL_EXT2(PFNGLFRAMEBUFFERRENDERBUFFERPROC, glFramebufferRenderbuffer, glFramebufferRenderbufferEXT) | |||
DGL_EXT2(PFNGLGENFRAMEBUFFERSPROC, glGenFramebuffers, glGenFramebuffersEXT) | |||
DGL_EXT2(PFNGLGENRENDERBUFFERSPROC, glGenRenderbuffers, glGenRenderbuffersEXT) | |||
DGL_EXT2(PFNGLRENDERBUFFERSTORAGEPROC, glRenderbufferStorage, glRenderbufferStorageEXT) | |||
# endif | |||
# ifdef DGL_USE_OPENGL3 | |||
DGL_EXT(PFNGLBINDBUFFERRANGEPROC, glBindBufferRange) | |||
@@ -190,6 +195,7 @@ DGL_EXT(PFNGLGENVERTEXARRAYSPROC, glGenVertexArrays) | |||
DGL_EXT(PFNGLUNIFORMBLOCKBINDINGPROC, glUniformBlockBinding) | |||
# endif | |||
# undef DGL_EXT | |||
# undef DGL_EXT2 | |||
needsInit = false; | |||
# if defined(__GNUC__) && (__GNUC__ >= 9) | |||
# pragma GCC diagnostic pop | |||
@@ -318,12 +324,12 @@ NanoVG::NanoVG(int flags) | |||
fInFrame(false), | |||
fIsSubWidget(false) | |||
{ | |||
DISTRHO_SAFE_ASSERT(fContext); | |||
DISTRHO_CUSTOM_SAFE_ASSERT("Failed to create NanoVG context, expect a black screen", fContext != nullptr); | |||
} | |||
NanoVG::~NanoVG() | |||
{ | |||
DISTRHO_SAFE_ASSERT(! fInFrame); | |||
DISTRHO_CUSTOM_SAFE_ASSERT("Destroying NanoVG context with still active frame", ! fInFrame); | |||
if (fContext != nullptr && ! fIsSubWidget) | |||
nvgDeleteGL(fContext); | |||
@@ -951,7 +951,7 @@ puglGrabFocus(PuglView* const view) | |||
{ | |||
PuglInternals* const impl = view->impl; | |||
Display* const display = view->world->impl->display; | |||
XWindowAttributes attrs = {0}; | |||
XWindowAttributes attrs = PUGL_INIT_STRUCT; | |||
if (!impl->win || !XGetWindowAttributes(display, impl->win, &attrs)) { | |||
return PUGL_UNKNOWN_ERROR; | |||
@@ -980,7 +980,7 @@ puglRequestAttention(PuglView* const view) | |||
PuglInternals* const impl = view->impl; | |||
Display* const display = view->world->impl->display; | |||
const PuglX11Atoms* const atoms = &view->world->impl->atoms; | |||
XEvent event = {0}; | |||
XEvent event = PUGL_INIT_STRUCT; | |||
event.type = ClientMessage; | |||
event.xclient.window = impl->win; | |||
@@ -1081,7 +1081,7 @@ puglStopTimer(PuglView* const view, const uintptr_t id) | |||
static XEvent | |||
eventToX(PuglView* const view, const PuglEvent* const event) | |||
{ | |||
XEvent xev = {0}; | |||
XEvent xev = PUGL_INIT_STRUCT; | |||
xev.xany.send_event = True; | |||
switch (event->type) { | |||
@@ -636,6 +636,9 @@ struct Parameter { | |||
A group can be applied to both inputs and outputs (at the same time). | |||
The same group cannot be used in audio ports and parameters. | |||
When both audio and parameter groups are used, audio groups MUST be defined first. | |||
That is, group indexes start with audio ports, then parameters. | |||
An audio port group logically combines ports which should be considered part of the same stream.@n | |||
For example, two audio ports in a group may form a stereo stream. | |||
@@ -1,6 +1,6 @@ | |||
/* | |||
* DISTRHO Plugin Framework (DPF) | |||
* Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com> | |||
* Copyright (C) 2012-2022 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
* or without fee is hereby granted, provided that the above copyright notice and this | |||
@@ -20,7 +20,7 @@ | |||
#include "../DistrhoPlugin.hpp" | |||
#ifdef DISTRHO_PLUGIN_TARGET_VST3 | |||
# include "DistrhoPluginVST3.hpp" | |||
# include "DistrhoPluginVST.hpp" | |||
#endif | |||
#include <set> | |||
@@ -523,6 +523,36 @@ public: | |||
{ | |||
return getAudioPort(input, index).hints; | |||
} | |||
uint32_t getAudioPortCountWithGroupId(const bool input, const uint32_t groupId) const noexcept | |||
{ | |||
DISTRHO_SAFE_ASSERT_RETURN(fData != nullptr, 0); | |||
uint32_t numPorts = 0; | |||
if (input) | |||
{ | |||
#if DISTRHO_PLUGIN_NUM_INPUTS > 0 | |||
for (uint32_t i=0; i<DISTRHO_PLUGIN_NUM_INPUTS; ++i) | |||
{ | |||
if (fData->audioPorts[i].groupId == groupId) | |||
++numPorts; | |||
} | |||
#endif | |||
} | |||
else | |||
{ | |||
#if DISTRHO_PLUGIN_NUM_OUTPUTS > 0 | |||
for (uint32_t i=0; i<DISTRHO_PLUGIN_NUM_OUTPUTS; ++i) | |||
{ | |||
if (fData->audioPorts[i + DISTRHO_PLUGIN_NUM_INPUTS].groupId == groupId) | |||
++numPorts; | |||
} | |||
#endif | |||
} | |||
return numPorts; | |||
} | |||
#endif | |||
uint32_t getParameterCount() const noexcept | |||
@@ -329,53 +329,36 @@ public: | |||
} | |||
#if !DISTRHO_PLUGIN_HAS_EXTERNAL_UI | |||
bool handlePluginKeyboardVST2(const bool press, const uint key, const uint16_t mods) | |||
bool handlePluginKeyboardVST(const bool press, const bool special, const uint keychar, const uint keycode, const uint16_t mods) | |||
{ | |||
DGL_NAMESPACE::Widget::KeyboardEvent ev; | |||
ev.mod = mods; | |||
ev.press = press; | |||
ev.key = key; | |||
using namespace DGL_NAMESPACE; | |||
const bool ret = ui->onKeyboard(ev); | |||
if (! press) | |||
return ret; | |||
DGL_NAMESPACE::Widget::CharacterInputEvent cev; | |||
cev.mod = mods; | |||
cev.character = key; | |||
// if shift modifier is on, convert a-z -> A-Z for character input | |||
if (key >= 'a' && key <= 'z' && (mods & DGL_NAMESPACE::kModifierShift) != 0) | |||
cev.character -= 'a' - 'A'; | |||
ui->onCharacterInput(cev); | |||
return ret; | |||
} | |||
bool handlePluginKeyboardVST3(const bool press, const uint keychar, const uint keycode, const uint16_t mods) | |||
{ | |||
DGL_NAMESPACE::Widget::KeyboardEvent ev; | |||
Widget::KeyboardEvent ev; | |||
ev.mod = mods; | |||
ev.press = press; | |||
ev.key = keychar; | |||
ev.keycode = keycode; | |||
// keyboard events must always be lowercase | |||
if (ev.key >= 'A' && ev.key <= 'Z') | |||
ev.key += 'a' - 'A'; // A-Z -> a-z | |||
const bool ret = ui->onKeyboard(ev); | |||
if (! press) | |||
return ret; | |||
if (press && !special && (mods & (kModifierControl|kModifierAlt|kModifierSuper)) == 0) | |||
{ | |||
Widget::CharacterInputEvent cev; | |||
cev.mod = mods; | |||
cev.character = keychar; | |||
cev.keycode = keycode; | |||
DGL_NAMESPACE::Widget::CharacterInputEvent cev; | |||
cev.mod = mods; | |||
cev.keycode = keycode; | |||
cev.character = keychar; | |||
// if shift modifier is on, convert a-z -> A-Z for character input | |||
if (cev.character >= 'a' && cev.character <= 'z' && (mods & kModifierShift) != 0) | |||
cev.character -= 'a' - 'A'; | |||
// if shift modifier is on, convert a-z -> A-Z for character input | |||
if (keychar >= 'a' && keychar <= 'z' && (mods & DGL_NAMESPACE::kModifierShift) != 0) | |||
cev.character -= 'a' - 'A'; | |||
ui->onCharacterInput(cev); | |||
} | |||
ui->onCharacterInput(cev); | |||
return ret; | |||
} | |||
#endif | |||
@@ -20,7 +20,7 @@ | |||
#include "../DistrhoUI.hpp" | |||
#ifdef DISTRHO_PLUGIN_TARGET_VST3 | |||
# include "DistrhoPluginVST3.hpp" | |||
# include "DistrhoPluginVST.hpp" | |||
#endif | |||
#if DISTRHO_PLUGIN_HAS_EXTERNAL_UI | |||
@@ -19,6 +19,7 @@ | |||
#endif | |||
#include "../extra/String.hpp" | |||
#include "../DistrhoStandaloneUtils.hpp" | |||
#ifdef DISTRHO_OS_WINDOWS | |||
# include <windows.h> | |||
@@ -141,6 +142,20 @@ const char* getResourcePath(const char* const bundlePath) noexcept | |||
return nullptr; | |||
} | |||
#ifndef DISTRHO_PLUGIN_TARGET_JACK | |||
// all these are null for non-standalone targets | |||
bool isUsingNativeAudio() noexcept { return false; } | |||
bool supportsAudioInput() { return false; } | |||
bool supportsBufferSizeChanges() { return false; } | |||
bool supportsMIDI() { return false; } | |||
bool isAudioInputEnabled() { return false; } | |||
bool isMIDIEnabled() { return false; } | |||
uint getBufferSize() { return 0; } | |||
bool requestAudioInput() { return false; } | |||
bool requestBufferSizeChange(uint) { return false; } | |||
bool requestMIDI() { return false; } | |||
#endif | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DISTRHO |