@@ -2952,15 +2952,10 @@ public: | |||
break; | |||
if (ev->body.type == CARLA_URI_MAP_ID_MIDI_EVENT && fEventsOut.ctrl->port != nullptr) | |||
{ | |||
fEventsOut.ctrl->port->writeMidiEvent(ev->time.frames, data, ev->body.size); | |||
} | |||
else if (ev->body.type == CARLA_URI_MAP_ID_ATOM_BLANK) | |||
{ | |||
carla_debug("Event OUTPUT message TO BE SENT TO UI, type blank"); | |||
else if (ev->body.type == CARLA_URI_MAP_ID_ATOM_BLANK) | |||
fAtomQueueOut.put(rindex, &ev->body); | |||
} | |||
lv2_atom_buffer_increment(&iter); | |||
} | |||
@@ -3816,7 +3811,7 @@ protected: | |||
if (buffer == nullptr || bufferSize != sizeof(float)) | |||
return; | |||
float value = *(float*)buffer; | |||
const float value(*(const float*)buffer); | |||
for (uint32_t i=0; i < kData->param.count; ++i) | |||
{ | |||
@@ -3830,9 +3825,10 @@ protected: | |||
} | |||
else if (format == CARLA_URI_MAP_ID_ATOM_TRANSFER_ATOM || format == CARLA_URI_MAP_ID_ATOM_TRANSFER_EVENT) | |||
{ | |||
CARLA_ASSERT(bufferSize != 0); | |||
CARLA_ASSERT(buffer != nullptr); | |||
if (buffer == nullptr) | |||
if (bufferSize == 0 || buffer == nullptr) | |||
return; | |||
fAtomQueueIn.put(rindex, (const LV2_Atom*)buffer); | |||
@@ -41,6 +41,7 @@ public: | |||
// ui initialization | |||
virtual bool uiInit(const char* const, const char* const); | |||
virtual void uiIdle() {} | |||
virtual void uiClose(); | |||
// --------------------------------------------------------------------- | |||
@@ -174,6 +174,8 @@ int CarlaBridgeOsc::handleMessage(const char* const path, const int argc, const | |||
return handleMsgMidi(argc, argv, types); | |||
if (std::strcmp(method, "sample-rate") == 0) | |||
return 0; // unused | |||
#endif | |||
if (std::strcmp(method, "show") == 0) | |||
return handleMsgShow(); | |||
if (std::strcmp(method, "hide") == 0) | |||
@@ -181,13 +183,12 @@ int CarlaBridgeOsc::handleMessage(const char* const path, const int argc, const | |||
if (std::strcmp(method, "quit") == 0) | |||
return handleMsgQuit(); | |||
# ifdef BRIDGE_LV2 | |||
// LV2 UI methods | |||
#ifdef BRIDGE_LV2 | |||
// LV2 methods | |||
if (std::strcmp(method, "lv2_atom_transfer") == 0) | |||
return handleMsgLv2AtomTransfer(argc, argv, types); | |||
if (std::strcmp(method, "lv2_urid_map") == 0) | |||
return handleMsgLv2UridMap(argc, argv, types); | |||
# endif | |||
#endif | |||
#ifdef BUILD_BRIDGE_PLUGIN | |||
@@ -195,9 +196,9 @@ int CarlaBridgeOsc::handleMessage(const char* const path, const int argc, const | |||
if (std::strcmp(method, "plugin_save_now") == 0) | |||
return handleMsgPluginSaveNow(); | |||
if (std::strcmp(method, "plugin_set_parameter_midi_channel") == 0) | |||
return handleMsgPluginSetParameterMidiChannel(argv); | |||
return handleMsgPluginSetParameterMidiChannel(argc, argv, types); | |||
if (std::strcmp(method, "plugin_set_parameter_midi_cc") == 0) | |||
return handleMsgPluginSetParameterMidiCC(argv); | |||
return handleMsgPluginSetParameterMidiCC(argc, argv, types); | |||
if (std::strcmp(method, "plugin_set_chunk") == 0) | |||
return handleMsgPluginSetChunk(argc, argv, types); | |||
if (std::strcmp(method, "plugin_set_custom_data") == 0) | |||
@@ -102,14 +102,15 @@ private: | |||
int handleMsgProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS); | |||
int handleMsgMidiProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS); | |||
int handleMsgMidi(CARLA_BRIDGE_OSC_HANDLE_ARGS); | |||
#endif | |||
int handleMsgShow(); | |||
int handleMsgHide(); | |||
int handleMsgQuit(); | |||
# ifdef BRIDGE_LV2 | |||
#ifdef BRIDGE_LV2 | |||
int handleMsgLv2AtomTransfer(CARLA_BRIDGE_OSC_HANDLE_ARGS); | |||
int handleMsgLv2UridMap(CARLA_BRIDGE_OSC_HANDLE_ARGS); | |||
# endif | |||
#endif | |||
#ifdef BUILD_BRIDGE_PLUGIN | |||
@@ -429,6 +429,28 @@ int CarlaBridgeOsc::handleMsgPluginSaveNow() | |||
return 0; | |||
} | |||
int CarlaBridgeOsc::handleMsgPluginSetParameterMidiChannel(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||
{ | |||
carla_debug("CarlaBridgeOsc::handleMsgPluginSetParameterMidiChannel()"); | |||
CARLA_ASSERT(kClient != nullptr); | |||
//CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(1, "s"); | |||
// TODO | |||
return 0; | |||
} | |||
int CarlaBridgeOsc::handleMsgPluginSetParameterMidiCC(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||
{ | |||
carla_debug("CarlaBridgeOsc::handleMsgPluginSetParameterMidiCC()"); | |||
CARLA_ASSERT(kClient != nullptr); | |||
//CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(1, "s"); | |||
// TODO | |||
return 0; | |||
} | |||
int CarlaBridgeOsc::handleMsgPluginSetChunk(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||
{ | |||
carla_debug("CarlaBridgeOsc::handleMsgPluginSaveNow()"); | |||
@@ -205,6 +205,7 @@ protected: | |||
gtk_window_get_size(GTK_WINDOW(fWindow), &fLastWidth, &fLastHeight); | |||
} | |||
kClient->uiIdle(); | |||
return kClient->oscIdle(); | |||
} | |||
@@ -319,6 +319,8 @@ protected: | |||
if (kClient == nullptr) | |||
return; | |||
kClient->uiIdle(); | |||
if (! kClient->oscIdle()) | |||
{ | |||
killTimer(fMsgTimer); | |||
@@ -341,7 +343,7 @@ signals: | |||
private slots: | |||
void setSizeSafeSlot(int width, int height) | |||
{ | |||
CARLA_ASSERT(kClient != nullptr && kClient->isResizable()); | |||
CARLA_ASSERT(kClient != nullptr && ! kClient->isResizable()); | |||
CARLA_ASSERT(fWindow != nullptr); | |||
if (kClient == nullptr || fWindow == nullptr) | |||
@@ -15,8 +15,6 @@ | |||
* For a full copy of the GNU General Public License see the GPL.txt file | |||
*/ | |||
#ifdef BRIDGE_VST | |||
#include "CarlaBridgeClient.hpp" | |||
#include "CarlaBridgeToolkit.hpp" | |||
#include "CarlaVstUtils.hpp" | |||
@@ -37,13 +35,13 @@ CARLA_BRIDGE_START_NAMESPACE | |||
uint32_t bufferSize = 512; | |||
double sampleRate = 44100.0; | |||
class CarlaVstClient : public CarlaBridgeClient, | |||
public QObject | |||
class CarlaVstClient : public QObject, | |||
public CarlaBridgeClient | |||
{ | |||
public: | |||
CarlaVstClient(const char* const uiTitle) | |||
: CarlaBridgeClient(uiTitle), | |||
QObject(nullptr) | |||
: QObject(nullptr), | |||
CarlaBridgeClient(uiTitle) | |||
{ | |||
effect = nullptr; | |||
@@ -55,7 +53,7 @@ public: | |||
unique1 = unique2 = rand(); | |||
} | |||
~CarlaVstClient() | |||
~CarlaVstClient() override | |||
{ | |||
// make client invalid | |||
unique2 += 1; | |||
@@ -64,7 +62,7 @@ public: | |||
// --------------------------------------------------------------------- | |||
// ui initialization | |||
bool uiInit(const char* binary, const char*) | |||
bool uiInit(const char* binary, const char*) override | |||
{ | |||
// ----------------------------------------------------------------- | |||
// init | |||
@@ -85,10 +83,10 @@ public: | |||
VST_Function vstFn = (VST_Function)uiLibSymbol("VSTPluginMain"); | |||
if (! vstFn) | |||
if (vstFn == nullptr) | |||
vstFn = (VST_Function)uiLibSymbol("main"); | |||
if (! vstFn) | |||
if (vstFn == nullptr) | |||
return false; | |||
// ----------------------------------------------------------------- | |||
@@ -152,59 +150,67 @@ public: | |||
return true; | |||
} | |||
void uiClose() | |||
void uiIdle() override | |||
{ | |||
// TODO | |||
} | |||
void uiClose() override | |||
{ | |||
CarlaBridgeClient::uiClose(); | |||
if (effect) | |||
if (effect != nullptr) | |||
{ | |||
effect->dispatcher(effect, effEditClose, 0, 0, nullptr, 0.0f); | |||
effect->dispatcher(effect, effClose, 0, 0, nullptr, 0.0f); | |||
effect = nullptr; | |||
} | |||
uiLibClose(); | |||
} | |||
// --------------------------------------------------------------------- | |||
// ui management | |||
void* getWidget() const | |||
void* getWidget() const override | |||
{ | |||
return nullptr; // VST always uses reparent | |||
} | |||
bool isResizable() const | |||
bool isResizable() const override | |||
{ | |||
return false; | |||
} | |||
bool needsReparent() const | |||
bool needsReparent() const override | |||
{ | |||
return true; | |||
} | |||
// --------------------------------------------------------------------- | |||
// processing | |||
// ui processing | |||
void setParameter(const int32_t rindex, const float value) | |||
void setParameter(const int32_t rindex, const float value) override | |||
{ | |||
if (effect) | |||
if (effect != nullptr) | |||
effect->setParameter(effect, rindex, value); | |||
} | |||
void setProgram(const uint32_t index) | |||
void setProgram(const uint32_t index) override | |||
{ | |||
if (effect) | |||
if (effect != nullptr) | |||
effect->dispatcher(effect, effSetProgram, 0, index, nullptr, 0.0f); | |||
} | |||
void setMidiProgram(const uint32_t, const uint32_t) | |||
void setMidiProgram(const uint32_t, const uint32_t) override | |||
{ | |||
} | |||
void noteOn(const uint8_t, const uint8_t, const uint8_t) | |||
void noteOn(const uint8_t, const uint8_t, const uint8_t) override | |||
{ | |||
} | |||
void noteOff(const uint8_t, const uint8_t) | |||
void noteOff(const uint8_t, const uint8_t) override | |||
{ | |||
} | |||
@@ -586,6 +592,3 @@ int main(int argc, char* argv[]) | |||
return ret; | |||
} | |||
#endif // BRIDGE_VST | |||