Compare commits

..

No commits in common. "5f693136a8b7eadb977c06363db6e156bd494bde" and "269b9b606f24e3ee883f5bdf0b4ec6a5b30a1d5e" have entirely different histories.

6 changed files with 42 additions and 127 deletions

View File

@ -26,9 +26,6 @@ typedef struct {
const char * format;
const char * (*get_bindir)(void *handle);
const char * (*get_datadir)(void *handle);
{{?it.product.messaging}}
char (*send_to_ui)(void *handle, const void *data, size_t bytes);
{{?}}
} plugin_callbacks;
{{?it.product.state && it.product.state.dspCustom}}
@ -53,9 +50,6 @@ typedef struct {
void (*set_parameter)(void *handle, size_t index, float value);
void (*set_parameter_end)(void *handle, size_t index, float value);
{{?}}
{{?it.product.messaging}}
char (*send_to_dsp)(void *handle, const void *data, size_t bytes);
{{?}}
} plugin_ui_callbacks;
{{?it.product.parameters.length > 0}}

View File

@ -267,7 +267,3 @@ static size_t parameterInfoToDataIndex[DATA_PRODUCT_PARAMETERS_N] = {
{{?it.product.state && it.product.state.dspCustom}}
#define DATA_STATE_DSP_CUSTOM
{{?}}
{{?it.product.messaging}}
#define DATA_MESSAGING 1
{{?}}

View File

@ -26,8 +26,6 @@
#include "vst3_c_api.h"
#pragma GCC diagnostic pop
#define TEMPLATE_SUPPORTS_MESSAGING 1
#include "data.h"
#include "plugin_api.h"
#include "plugin.h"
@ -437,9 +435,8 @@ static Steinberg_tresult pluginIConnectionPointDisconnect(void* thisInterface, s
}
static Steinberg_tresult pluginIConnectionPointNotify(void* thisInterface, struct Steinberg_Vst_IMessage* message) {
pluginInstance *p = (pluginInstance *)((char *)thisInterface - offsetof(pluginInstance, vtblIConnectionPoint));
(void)thisInterface;
(void)message;
printf("pluginIConnectionPointNotify A \n"); fflush(stdout);
printf("pluginIConnectionPointNotify B Message ID: %s\n", message->lpVtbl->getMessageID(message)); fflush(stdout);
@ -450,7 +447,10 @@ static Steinberg_tresult pluginIConnectionPointNotify(void* thisInterface, struc
unsigned int size = 0;
alist->lpVtbl->getBinary(alist, "yoyoyo", &data, &size);
plugin_receive_from_ui(&(p->p), data, size);
printf("pluginIConnectionPointNotify D yoyoyo : %p %d \n", data, size); fflush(stdout);
for (unsigned int i = 0; i < size; i++)
printf("%d ", ((uint8_t*) data)[i]);
printf("pluginIConnectionPointNotify Z \n"); fflush(stdout);
return Steinberg_kResultOk;
}
@ -467,38 +467,6 @@ static Steinberg_Vst_IConnectionPointVtbl pluginVtblIConnectionPoint = {
/* .notify = */ pluginIConnectionPointNotify
};
# ifdef DATA_MESSAGING
static char send_to_ui (void *handle, const void *data, size_t bytes) {
pluginInstance *p = (pluginInstance *)handle;
Steinberg_Vst_IConnectionPointVtbl *ov = (Steinberg_Vst_IConnectionPointVtbl*) p->connectedPoint->lpVtbl;
printf("gonna A ov: %p \n", (void*) ov);
printf("gonna AA ctx: %p \n", (void*) p->context);
Steinberg_Vst_IHostApplication *app = (Steinberg_Vst_IHostApplication*) p->context;
Steinberg_Vst_IMessage *msg = NULL;
app->lpVtbl->createInstance(app, (char*) Steinberg_Vst_IMessage_iid, (char*) Steinberg_Vst_IMessage_iid, (void**)&msg);
printf("gonna AB msgp: %p \n", (void*) msg);
printf("gonna B \n");
msg->lpVtbl->setMessageID(msg, "HelloMessage");
printf("gonna C Message ID: %s \n", msg->lpVtbl->getMessageID(msg));
Steinberg_Vst_IAttributeList *alist = msg->lpVtbl->getAttributes(msg);
printf("gonna CA alist %p \n", (void*) alist);
alist->lpVtbl->setBinary(alist, "yoyoyo", data, bytes);
ov->notify(p->connectedPoint, msg);
printf("gonna Z \n");
return 0;
}
# endif
static Steinberg_tresult pluginIComponentQueryInterface(void *thisInterface, const Steinberg_TUID iid, void ** obj) {
TRACE("plugin IComponent queryInterface %p\n", thisInterface);
return pluginQueryInterface((pluginInstance *)((char *)thisInterface - offsetof(pluginInstance, vtblIComponent)), iid, obj);
@ -529,10 +497,7 @@ static Steinberg_tresult pluginInitialize(void *thisInterface, struct Steinberg_
/* .handle = */ (void *)p,
/* .format = */ "vst3",
/* .get_bindir = */ getBindirCb,
/* .get_datadir = */ getDatadirCb,
#ifdef DATA_MESSAGING
/* .send_to_ui = */ send_to_ui
#endif
/* .get_datadir = */ getDatadirCb
};
plugin_init(&p->p, &cbs);
#if DATA_PRODUCT_PARAMETERS_IN_N > 0
@ -1261,10 +1226,9 @@ typedef struct plugView plugView;
typedef struct controller {
Steinberg_Vst_IEditControllerVtbl * vtblIEditController; // must stay first
Steinberg_Vst_IMidiMappingVtbl * vtblIMidiMapping;
#ifdef DATA_MESSAGING
#ifdef DATA_UI
Steinberg_Vst_IConnectionPointVtbl *vtblIConnectionPoint;
Steinberg_Vst_IConnectionPoint *connectedPoint;
Steinberg_Vst_IMessage *msg;
#endif
Steinberg_uint32 refs;
Steinberg_FUnknown * context;
@ -1570,36 +1534,6 @@ static void plugViewSetParameterEndCb(void *handle, size_t index, float value) {
# endif
# ifdef DATA_MESSAGING
static char send_to_dsp (void *handle, const void *data, size_t bytes) {
plugView *v = (plugView *)handle;
Steinberg_Vst_IConnectionPointVtbl *ov = (Steinberg_Vst_IConnectionPointVtbl*) v->ctrl->connectedPoint->lpVtbl;
printf("gonna A ov: %p \n", (void*) ov);
printf("gonna AA ctx: %p \n", (void*) v->ctrl->context);
Steinberg_Vst_IMessage *msg = v->ctrl->msg;
printf("gonna AB msgp: %p \n", (void*) msg);
printf("gonna B \n");
msg->lpVtbl->setMessageID(msg, "HelloMessage");
printf("gonna C Message ID: %s \n", msg->lpVtbl->getMessageID(msg));
Steinberg_Vst_IAttributeList *alist = msg->lpVtbl->getAttributes(msg);
printf("gonna CA alist %p \n", (void*) alist);
alist->lpVtbl->setBinary(alist, "yoyoyo", data, bytes);
ov->notify(v->ctrl->connectedPoint, msg);
printf("gonna Z \n");
return 0;
}
# endif
# ifdef __APPLE__
static void plugViewTimerCb(CFRunLoopTimerRef timer, void *info) {
(void)timer;
@ -1635,10 +1569,7 @@ static Steinberg_tresult plugViewAttached(void* thisInterface, void* parent, Ste
# if DATA_PRODUCT_PARAMETERS_N > 0
/* .set_parameter_begin = */ plugViewSetParameterBeginCb,
/* .set_parameter = */ plugViewSetParameterCb,
/* .set_parameter_end = */ plugViewSetParameterEndCb,
# endif
# ifdef DATA_MESSAGING
/* .send_to_dsp = */ send_to_dsp
/* .set_parameter_end = */ plugViewSetParameterEndCb
# endif
};
v->ui = plugin_ui_create(1, parent, &cbs);
@ -1845,6 +1776,7 @@ static Steinberg_tresult plugViewCheckSizeConstraint(void* thisInterface, struct
# endif
}
int counter = 0;
# ifdef __linux__
static void plugViewOnTimer(void *thisInterface) {
TRACE("plugView onTimer %p\n", thisInterface);
@ -1864,6 +1796,37 @@ static void plugViewOnTimer(void *thisInterface) {
XResizeWindow(v->display, w, parent_attr.width, parent_attr.height);
}
// lame test
if (counter++ == 60) {
Steinberg_Vst_IConnectionPointVtbl *ov = (Steinberg_Vst_IConnectionPointVtbl*) v->ctrl->connectedPoint->lpVtbl;
printf("gonna A ov: %p \n", (void*) ov);
printf("gonna AA ctx: %p \n", (void*) v->ctrl->context);
Steinberg_Vst_IHostApplication *app = (Steinberg_Vst_IHostApplication*) v->ctrl->context;
Steinberg_Vst_IMessage *msg = NULL;
app->lpVtbl->createInstance(app, (char*) Steinberg_Vst_IMessage_iid, (char*) Steinberg_Vst_IMessage_iid, (void**)&msg);
printf("gonna AB msgp: %p \n", (void*) msg);
printf("gonna B \n");
msg->lpVtbl->setMessageID(msg, "HelloMessage");
printf("gonna C Message ID: %s \n", msg->lpVtbl->getMessageID(msg));
Steinberg_Vst_IAttributeList *alist = msg->lpVtbl->getAttributes(msg);
printf("gonna CA alist %p \n", (void*) alist);
const uint8_t tmp[8] = { 2, 3, 4, 5, 6, 7, 8, 9 };
alist->lpVtbl->setBinary(alist, "yoyoyo", tmp, 8);
ov->notify(v->ctrl->connectedPoint, msg);
printf("gonna Z \n");
}
plugin_ui_idle(v->ui);
}
# endif
@ -1976,10 +1939,6 @@ static Steinberg_tresult controllerInitialize(void* thisInterface, struct Steinb
c->parametersMidiIn[i + 1] = 0.5;
c->parametersMidiIn[i + 2] = 0.0;
}
#endif
#ifdef DATA_MESSAGING
Steinberg_Vst_IHostApplication *app = (Steinberg_Vst_IHostApplication*) context;
app->lpVtbl->createInstance(app, (char*) Steinberg_Vst_IMessage_iid, (char*) Steinberg_Vst_IMessage_iid, (void**)&(c->msg));
#endif
return Steinberg_kResultOk;
}
@ -2583,10 +2542,8 @@ static Steinberg_tresult factoryCreateInstance(void *thisInterface, Steinberg_FI
p->vtblIProcessContextRequirements = &pluginVtblIProcessContextRequirements;
p->refs = 1;
p->context = NULL;
#ifdef DATA_MESSAGING
p->vtblIConnectionPoint = &pluginVtblIConnectionPoint;
p->connectedPoint = NULL;
#endif
*obj = p;
TRACE(" instance: %p\n", (void *)p);
} else if (memcmp(cid, dataControllerCID, sizeof(Steinberg_TUID)) == 0) {
@ -2600,10 +2557,9 @@ static Steinberg_tresult factoryCreateInstance(void *thisInterface, Steinberg_FI
return Steinberg_kOutOfMemory;
c->vtblIEditController = &controllerVtblIEditController;
c->vtblIMidiMapping = &controllerVtblIMidiMapping;
#ifdef DATA_MESSAGING
#ifdef DATA_UI
c->vtblIConnectionPoint = &controllerVtblIConnectionPoint;
c->connectedPoint = NULL;
c->msg = NULL;
#endif
c->refs = 1;
c->context = NULL;

View File

@ -179,15 +179,3 @@ static int plugin_state_load(const plugin_state_callbacks *cbs, float cur_sample
cbs->unlock(cbs->handle);
return 0;
}
#include <stdio.h>
#if TEMPLATE_SUPPORTS_MESSAGING
static void plugin_receive_from_ui (plugin *instance, const void *data, size_t bytes) {
(void) instance;
printf("plugin_receive_from_ui %ld bytes at %p: \n", bytes, data);
for (size_t i = 0; i < bytes; i++) {
printf("%d ", ((uint8_t*) data)[i]);
}
printf("plugin_receive_from_ui END \n");
}
#endif

View File

@ -38,19 +38,6 @@ typedef struct {
plugin_ui_callbacks cbs;
} plugin_ui;
#if TEMPLATE_SUPPORTS_MESSAGING
static void plugin_ui_receive_from_dsp (plugin_ui *instance, const void *data, size_t bytes) {
(void) instance;
printf("plugin_ui_receive_from_ui %ld bytes at %p: \n", bytes, data);
for (size_t i = 0; i < bytes; i++) {
printf("%d ", ((uint8_t*) data)[i]);
}
printf("plugin_ui_receive_from_ui END \n");
}
#endif
#define RANDOM_DATA_SIZE 11
const uint8_t random_data[RANDOM_DATA_SIZE] = { 2, 3, 4, 5, 6, 7, 8, 9, 6, 9, 6 };
#define WIDTH 600.0
#define HEIGHT 400.0
@ -125,9 +112,6 @@ static void on_mouse_release (window *win, int32_t x, int32_t y, uint32_t state)
pui->bypass = !pui->bypass;
pui->cbs.set_parameter(pui->cbs.handle, 3, pui->bypass ? 1.f : 0.f);
draw_button(pui, 3, pui->bypass);
#if TEMPLATE_SUPPORTS_MESSAGING
pui->cbs.send_to_dsp(pui->cbs.handle, (const void*) random_data, RANDOM_DATA_SIZE);
#endif
}
if (pui->param_down != -1) {

View File

@ -138,9 +138,6 @@
"userResizable": true,
"selfResizable": false
},
"messaging": {
"maxSize": 10240
},
"state": {
"dspCustom": true
}