@@ -164,7 +164,7 @@ CARLA_EXPORT void carla_set_engine_about_to_close(); | |||
CARLA_EXPORT bool carla_load_project(const char* filename); | |||
CARLA_EXPORT bool carla_save_project(const char* filename); | |||
CARLA_EXPORT bool carla_add_plugin(CarlaBinaryType btype, CarlaPluginType ptype, const char* filename, const char* name, const char* label, void* extraPtr); | |||
CARLA_EXPORT bool carla_add_plugin(CarlaBinaryType btype, CarlaPluginType ptype, const char* filename, const char* name, const char* label, const void* extraPtr); | |||
CARLA_EXPORT bool carla_remove_plugin(unsigned int pluginId); | |||
CARLA_EXPORT void carla_remove_all_plugins(); | |||
@@ -229,7 +229,7 @@ CARLA_EXPORT double carla_get_sample_rate(); | |||
CARLA_EXPORT const char* carla_get_last_error(); | |||
CARLA_EXPORT const char* carla_get_host_osc_url(); | |||
CARLA_EXPORT void carla_set_callback_function(CarlaCallbackFunc func); | |||
CARLA_EXPORT void carla_set_callback_function(CarlaCallbackFunc func, void* ptr); | |||
CARLA_EXPORT void carla_set_option(CarlaOptionsType option, int value, const char* valueStr); | |||
#if 0 | |||
@@ -822,38 +822,41 @@ void CarlaEngine::removeAllPlugins() | |||
kData->thread.stopNow(); | |||
const unsigned int oldCount = kData->curPluginCount; | |||
if (kData->curPluginCount > 0) | |||
{ | |||
const unsigned int oldCount = kData->curPluginCount; | |||
kData->curPluginCount = 0; | |||
kData->curPluginCount = 0; | |||
for (unsigned int i=0; i < oldCount; i++) | |||
{ | |||
CarlaPlugin* const plugin = kData->plugins[i].plugin; | |||
for (unsigned int i=0; i < oldCount; i++) | |||
{ | |||
CarlaPlugin* const plugin = kData->plugins[i].plugin; | |||
CARLA_ASSERT(plugin != nullptr); | |||
CARLA_ASSERT(plugin != nullptr); | |||
if (plugin != nullptr) | |||
plugin->setEnabled(false); | |||
} | |||
if (plugin != nullptr) | |||
plugin->setEnabled(false); | |||
} | |||
// wait for processing | |||
waitForProccessEnd(); | |||
// wait for processing | |||
waitForProccessEnd(); | |||
for (unsigned int i=0; i < oldCount; i++) | |||
{ | |||
CarlaPlugin* const plugin = kData->plugins[i].plugin; | |||
for (unsigned int i=0; i < oldCount; i++) | |||
{ | |||
CarlaPlugin* const plugin = kData->plugins[i].plugin; | |||
CARLA_ASSERT(plugin != nullptr); | |||
CARLA_ASSERT(plugin != nullptr); | |||
if (plugin != nullptr) | |||
delete plugin; | |||
if (plugin != nullptr) | |||
delete plugin; | |||
// clear this plugin | |||
kData->plugins[i].plugin = nullptr; | |||
kData->plugins[i].insPeak[0] = 0.0; | |||
kData->plugins[i].insPeak[1] = 0.0; | |||
kData->plugins[i].outsPeak[0] = 0.0; | |||
kData->plugins[i].outsPeak[1] = 0.0; | |||
// clear this plugin | |||
kData->plugins[i].plugin = nullptr; | |||
kData->plugins[i].insPeak[0] = 0.0; | |||
kData->plugins[i].insPeak[1] = 0.0; | |||
kData->plugins[i].outsPeak[0] = 0.0; | |||
kData->plugins[i].outsPeak[1] = 0.0; | |||
} | |||
} | |||
if (isRunning() && ! kData->aboutToClose) | |||
@@ -1304,6 +1307,8 @@ void CarlaEngine::sampleRateChanged(const double newSampleRate) | |||
void CarlaEngine::proccessPendingEvents() | |||
{ | |||
//carla_stderr("proccessPendingEvents(%i)", kData->nextAction.opcode); | |||
switch (kData->nextAction.opcode) | |||
{ | |||
case EnginePostActionNull: | |||
@@ -40,6 +40,7 @@ using CarlaBackend::EngineOptions; | |||
// Single, standalone engine | |||
struct CarlaBackendStandalone { | |||
CallbackFunc callback; | |||
void* callbackPtr; | |||
CarlaEngine* engine; | |||
CarlaString lastError; | |||
CarlaString procName; | |||
@@ -47,11 +48,21 @@ struct CarlaBackendStandalone { | |||
CarlaBackendStandalone() | |||
: callback(nullptr), | |||
callbackPtr(nullptr), | |||
engine(nullptr) {} | |||
} standalone; | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
// Helpers | |||
CarlaEngine* carla_get_standalone_engine() | |||
{ | |||
return standalone.engine; | |||
} | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
// API | |||
const char* carla_get_extended_license_text() | |||
{ | |||
@@ -338,7 +349,7 @@ bool carla_save_project(const char* filename) | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
bool carla_add_plugin(CarlaBackend::BinaryType btype, CarlaBackend::PluginType ptype, const char* filename, const char* const name, const char* label, void* extraStuff) | |||
bool carla_add_plugin(CarlaBackend::BinaryType btype, CarlaBackend::PluginType ptype, const char* filename, const char* const name, const char* label, const void* extraStuff) | |||
{ | |||
carla_debug("carla_add_plugin(%s, %s, \"%s\", \"%s\", \"%s\", %p)", CarlaBackend::BinaryType2Str(btype), CarlaBackend::PluginType2Str(ptype), filename, name, label, extraStuff); | |||
CARLA_ASSERT(standalone.engine != nullptr); | |||
@@ -1383,14 +1394,15 @@ const char* carla_get_host_osc_url() | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
void carla_set_callback_function(CarlaBackend::CallbackFunc func) | |||
void carla_set_callback_function(CarlaBackend::CallbackFunc func, void* ptr) | |||
{ | |||
carla_debug("carla_set_callback_function(%p)", func); | |||
standalone.callback = func; | |||
standalone.callback = func; | |||
standalone.callbackPtr = ptr; | |||
if (standalone.engine) | |||
standalone.engine->setCallback(func, nullptr); | |||
if (standalone.engine != nullptr) | |||
standalone.engine->setCallback(func, ptr); | |||
} | |||
void carla_set_option(CarlaBackend::OptionsType option, int value, const char* valueStr) | |||
@@ -26,8 +26,11 @@ | |||
CARLA_BRIDGE_START_NAMESPACE | |||
// forward declarations of commonly used Carla-Bridge classes | |||
class CarlaBridgeClient; | |||
#ifdef BUILD_BRIDGE_UI | |||
class CarlaBridgeToolkit; | |||
#endif | |||
CARLA_BRIDGE_END_NAMESPACE | |||
@@ -15,33 +15,28 @@ | |||
* For a full copy of the GNU General Public License see the GPL.txt file | |||
*/ | |||
#include "carla_bridge_client.hpp" | |||
#include "carla_bridge_toolkit.hpp" | |||
#include "CarlaBridgeClient.hpp" | |||
#ifdef BUILD_BRIDGE_UI | |||
# include "CarlaBridgeToolkit.hpp" | |||
# include "CarlaLibUtils.hpp" | |||
#endif | |||
#include <cstdlib> | |||
#include <cstring> | |||
CARLA_BRIDGE_START_NAMESPACE | |||
// --------------------------------------------------------------------- | |||
CarlaBridgeClient::CarlaBridgeClient(const char* const uiTitle) | |||
: m_osc(this), | |||
m_toolkit(CarlaBridgeToolkit::createNew(this, uiTitle)) | |||
{ | |||
carla_debug("CarlaBridgeClient::CarlaBridgeClient(\"%s\")", uiTitle); | |||
m_oscData = nullptr; | |||
: kOsc(this), | |||
#ifdef BUILD_BRIDGE_UI | |||
m_uiFilename = nullptr; | |||
m_uiLib = nullptr; | |||
m_uiQuit = false; | |||
kUiToolkit(CarlaBridgeToolkit::createNew(this, uiTitle)), | |||
fUiFilename(nullptr), | |||
fUiLib(nullptr), | |||
fUiQuit(false), | |||
#endif | |||
fOscData(nullptr) | |||
{ | |||
carla_debug("CarlaBridgeClient::CarlaBridgeClient(\"%s\")", uiTitle); | |||
} | |||
CarlaBridgeClient::~CarlaBridgeClient() | |||
@@ -49,20 +44,20 @@ CarlaBridgeClient::~CarlaBridgeClient() | |||
carla_debug("CarlaBridgeClient::~CarlaBridgeClient()"); | |||
#ifdef BUILD_BRIDGE_UI | |||
if (m_uiFilename) | |||
free(m_uiFilename); | |||
#endif | |||
if (fUiFilename != nullptr) | |||
delete[] fUiFilename; | |||
delete m_toolkit; | |||
delete kUiToolkit; | |||
#endif | |||
} | |||
#ifdef BUILD_BRIDGE_UI | |||
// --------------------------------------------------------------------- | |||
// ui initialization | |||
bool CarlaBridgeClient::init(const char* const, const char* const) | |||
bool CarlaBridgeClient::uiInit(const char* const, const char* const) | |||
{ | |||
carla_debug("CarlaBridgeClient::init()"); | |||
carla_debug("CarlaBridgeClient::uiInit()"); | |||
// Test for single init | |||
{ | |||
@@ -71,48 +66,45 @@ bool CarlaBridgeClient::init(const char* const, const char* const) | |||
initiated = true; | |||
} | |||
m_uiQuit = false; | |||
m_toolkit->init(); | |||
fUiQuit = false; | |||
kUiToolkit->init(); | |||
return false; | |||
} | |||
void CarlaBridgeClient::close() | |||
void CarlaBridgeClient::uiClose() | |||
{ | |||
carla_debug("CarlaBridgeClient::close()"); | |||
carla_debug("CarlaBridgeClient::uiClose()"); | |||
if (! m_uiQuit) | |||
if (! fUiQuit) | |||
{ | |||
m_uiQuit = true; | |||
fUiQuit = true; | |||
if (isOscControlRegistered()) | |||
sendOscExiting(); | |||
} | |||
m_toolkit->quit(); | |||
kUiToolkit->quit(); | |||
} | |||
#endif | |||
// --------------------------------------------------------------------- | |||
// osc stuff | |||
bool CarlaBridgeClient::oscInit(const char* const url) | |||
void CarlaBridgeClient::oscInit(const char* const url) | |||
{ | |||
carla_debug("CarlaBridgeClient::oscInit(\"%s\")", url); | |||
const bool ret = m_osc.init(url); | |||
m_oscData = m_osc.getControlData(); | |||
return ret; | |||
kOsc.init(url); | |||
fOscData = kOsc.getControlData(); | |||
} | |||
bool CarlaBridgeClient::oscIdle() | |||
{ | |||
m_osc.idle(); | |||
kOsc.idle(); | |||
#ifdef BUILD_BRIDGE_UI | |||
return ! m_uiQuit; | |||
return ! fUiQuit; | |||
#else | |||
return true; | |||
#endif | |||
@@ -121,48 +113,49 @@ bool CarlaBridgeClient::oscIdle() | |||
void CarlaBridgeClient::oscClose() | |||
{ | |||
carla_debug("CarlaBridgeClient::oscClose()"); | |||
CARLA_ASSERT(m_oscData); | |||
CARLA_ASSERT(fOscData != nullptr); | |||
m_osc.close(); | |||
m_oscData = nullptr; | |||
kOsc.close(); | |||
fOscData = nullptr; | |||
} | |||
bool CarlaBridgeClient::isOscControlRegistered() const | |||
{ | |||
return m_osc.isControlRegistered(); | |||
return kOsc.isControlRegistered(); | |||
} | |||
void CarlaBridgeClient::sendOscUpdate() | |||
{ | |||
carla_debug("CarlaBridgeClient::sendOscUpdate()"); | |||
CARLA_ASSERT(m_oscData); | |||
CARLA_ASSERT(fOscData != nullptr); | |||
if (m_oscData && m_oscData->target) | |||
osc_send_update(m_oscData, m_osc.getServerPath()); | |||
if (fOscData != nullptr && fOscData->target != nullptr) | |||
osc_send_update(fOscData, kOsc.getServerPath()); | |||
} | |||
#ifdef BUILD_BRIDGE_PLUGIN | |||
void CarlaBridgeClient::sendOscBridgeUpdate() | |||
{ | |||
carla_debug("CarlaBridgeClient::sendOscBridgeUpdate()"); | |||
CARLA_ASSERT(m_oscData); | |||
CARLA_ASSERT(m_oscData->target && m_oscData->path); | |||
CARLA_ASSERT(fOscData != nullptr); | |||
CARLA_ASSERT(fOscData->target != nullptr && fOscData->path != nullptr); | |||
if (m_oscData && m_oscData->target && m_oscData->path) | |||
osc_send_bridge_update(m_oscData, m_oscData->path); | |||
if (fOscData != nullptr && fOscData->target != nullptr && fOscData->path != nullptr) | |||
osc_send_bridge_update(fOscData, fOscData->path); | |||
} | |||
void CarlaBridgeClient::sendOscBridgeError(const char* const error) | |||
{ | |||
carla_debug("CarlaBridgeClient::sendOscBridgeError(\"%s\")", error); | |||
CARLA_ASSERT(m_oscData); | |||
CARLA_ASSERT(error); | |||
CARLA_ASSERT(fOscData != nullptr); | |||
CARLA_ASSERT(error != nullptr); | |||
if (m_oscData && m_oscData->target) | |||
osc_send_bridge_error(m_oscData, error); | |||
if (fOscData != nullptr && fOscData->target != nullptr && error != nullptr) | |||
osc_send_bridge_error(fOscData, error); | |||
} | |||
#endif | |||
#ifdef BUILD_BRIDGE_UI | |||
// --------------------------------------------------------------------- | |||
// toolkit | |||
@@ -170,146 +163,147 @@ void CarlaBridgeClient::toolkitShow() | |||
{ | |||
carla_debug("CarlaBridgeClient::toolkitShow()"); | |||
m_toolkit->show(); | |||
kUiToolkit->show(); | |||
} | |||
void CarlaBridgeClient::toolkitHide() | |||
{ | |||
carla_debug("CarlaBridgeClient::toolkitHide()"); | |||
m_toolkit->hide(); | |||
kUiToolkit->hide(); | |||
} | |||
void CarlaBridgeClient::toolkitResize(const int width, const int height) | |||
{ | |||
carla_debug("CarlaBridgeClient::toolkitResize(%i, %i)", width, height); | |||
m_toolkit->resize(width, height); | |||
kUiToolkit->resize(width, height); | |||
} | |||
void CarlaBridgeClient::toolkitExec(const bool showGui) | |||
{ | |||
carla_debug("CarlaBridgeClient::toolkitExec(%s)", bool2str(showGui)); | |||
m_toolkit->exec(showGui); | |||
kUiToolkit->exec(showGui); | |||
} | |||
void CarlaBridgeClient::toolkitQuit() | |||
{ | |||
carla_debug("CarlaBridgeClient::toolkitQuit()"); | |||
#ifdef BUILD_BRIDGE_UI | |||
m_uiQuit = true; | |||
#endif | |||
m_toolkit->quit(); | |||
fUiQuit = true; | |||
kUiToolkit->quit(); | |||
} | |||
#endif | |||
// --------------------------------------------------------------------- | |||
void CarlaBridgeClient::sendOscConfigure(const char* const key, const char* const value) | |||
{ | |||
carla_debug("CarlaBridgeClient::sendOscConfigure(\"%s\", \"%s\")", key, value); | |||
CARLA_ASSERT(m_oscData); | |||
CARLA_ASSERT(fOscData != nullptr); | |||
if (m_oscData && m_oscData->target) | |||
osc_send_configure(m_oscData, key, value); | |||
if (fOscData != nullptr && fOscData->target != nullptr) | |||
osc_send_configure(fOscData, key, value); | |||
} | |||
void CarlaBridgeClient::sendOscControl(const int32_t index, const float value) | |||
{ | |||
carla_debug("CarlaBridgeClient::sendOscControl(%i, %f)", index, value); | |||
CARLA_ASSERT(m_oscData); | |||
CARLA_ASSERT(fOscData != nullptr); | |||
if (m_oscData && m_oscData->target) | |||
osc_send_control(m_oscData, index, value); | |||
if (fOscData != nullptr && fOscData->target != nullptr) | |||
osc_send_control(fOscData, index, value); | |||
} | |||
void CarlaBridgeClient::sendOscProgram(const int32_t index) | |||
{ | |||
carla_debug("CarlaBridgeClient::sendOscProgram(%i)", index); | |||
CARLA_ASSERT(m_oscData); | |||
CARLA_ASSERT(fOscData != nullptr); | |||
if (m_oscData && m_oscData->target) | |||
osc_send_program(m_oscData, index); | |||
if (fOscData != nullptr && fOscData->target != nullptr) | |||
osc_send_program(fOscData, index); | |||
} | |||
#ifdef BUILD_BRIDGE_PLUGIN | |||
void CarlaBridgeClient::sendOscMidiProgram(const int32_t index) | |||
{ | |||
carla_debug("CarlaBridgeClient::sendOscMidiProgram(%i)", index); | |||
CARLA_ASSERT(m_oscData); | |||
CARLA_ASSERT(fOscData != nullptr); | |||
if (m_oscData && m_oscData->target) | |||
osc_send_midi_program(m_oscData, index); | |||
if (fOscData != nullptr && fOscData->target != nullptr) | |||
osc_send_midi_program(fOscData, index); | |||
} | |||
#endif | |||
void CarlaBridgeClient::sendOscMidi(const uint8_t midiBuf[4]) | |||
{ | |||
carla_debug("CarlaBridgeClient::sendOscMidi(%p)", midiBuf); | |||
CARLA_ASSERT(m_oscData); | |||
CARLA_ASSERT(fOscData != nullptr); | |||
if (m_oscData && m_oscData->target) | |||
osc_send_midi(m_oscData, midiBuf); | |||
if (fOscData != nullptr && fOscData->target != nullptr) | |||
osc_send_midi(fOscData, midiBuf); | |||
} | |||
void CarlaBridgeClient::sendOscExiting() | |||
{ | |||
carla_debug("CarlaBridgeClient::sendOscExiting()"); | |||
CARLA_ASSERT(m_oscData); | |||
CARLA_ASSERT(fOscData != nullptr); | |||
if (m_oscData && m_oscData->target) | |||
osc_send_exiting(m_oscData); | |||
if (fOscData != nullptr && fOscData->target != nullptr) | |||
osc_send_exiting(fOscData); | |||
} | |||
#ifdef BRIDGE_LV2 | |||
void CarlaBridgeClient::sendOscLv2TransferAtom(const int32_t portIndex, const char* const typeStr, const char* const atomBuf) | |||
{ | |||
carla_debug("CarlaBridgeClient::sendOscLv2TransferAtom(%i, \"%s\", \"%s\")", portIndex, typeStr, atomBuf); | |||
CARLA_ASSERT(m_oscData); | |||
CARLA_ASSERT(fOscData != nullptr); | |||
if (m_oscData && m_oscData->target) | |||
osc_send_lv2_transfer_atom(m_oscData, portIndex, typeStr, atomBuf); | |||
if (fOscData != nullptr && fOscData->target != nullptr) | |||
osc_send_lv2_transfer_atom(fOscData, portIndex, typeStr, atomBuf); | |||
} | |||
void CarlaBridgeClient::sendOscLv2TransferEvent(const int32_t portIndex, const char* const typeStr, const char* const atomBuf) | |||
{ | |||
carla_debug("CarlaBridgeClient::sendOscLv2TransferEvent(%i, \"%s\", \"%s\")", portIndex, typeStr, atomBuf); | |||
CARLA_ASSERT(m_oscData); | |||
CARLA_ASSERT(fOscData != nullptr); | |||
if (m_oscData && m_oscData->target) | |||
osc_send_lv2_transfer_event(m_oscData, portIndex, typeStr, atomBuf); | |||
if (fOscData != nullptr && fOscData->target != nullptr) | |||
osc_send_lv2_transfer_event(fOscData, portIndex, typeStr, atomBuf); | |||
} | |||
#endif | |||
// --------------------------------------------------------------------- | |||
#ifdef BUILD_BRIDGE_UI | |||
void* CarlaBridgeClient::getContainerId() | |||
{ | |||
return m_toolkit->getContainerId(); | |||
return kToolkit->getContainerId(); | |||
} | |||
#ifdef BUILD_BRIDGE_UI | |||
bool CarlaBridgeClient::uiLibOpen(const char* const filename) | |||
{ | |||
CARLA_ASSERT(! m_uiLib); | |||
CARLA_ASSERT(filename); | |||
CARLA_ASSERT(fLib == nullptr); | |||
CARLA_ASSERT(filename != nullptr); | |||
if (m_uiFilename) | |||
free(m_uiFilename); | |||
if (fFilename != nullptr) | |||
delete[] fFilename; | |||
m_uiLib = lib_open(filename); | |||
m_uiFilename = strdup(filename ? filename : ""); | |||
fLib = lib_open(filename); | |||
fFilename = carla_strdup(filename ? filename : ""); | |||
return bool(m_uiLib); | |||
return (fLib != nullptr); | |||
} | |||
bool CarlaBridgeClient::uiLibClose() | |||
{ | |||
CARLA_ASSERT(m_uiLib); | |||
CARLA_ASSERT(fLib != nullptr); | |||
if (m_uiLib) | |||
if (fLib != nullptr) | |||
{ | |||
const bool closed = lib_close(m_uiLib); | |||
m_uiLib = nullptr; | |||
const bool closed = lib_close(fLib); | |||
fLib = nullptr; | |||
return closed; | |||
} | |||
@@ -318,17 +312,17 @@ bool CarlaBridgeClient::uiLibClose() | |||
void* CarlaBridgeClient::uiLibSymbol(const char* const symbol) | |||
{ | |||
CARLA_ASSERT(m_uiLib); | |||
CARLA_ASSERT(fLib != nullptr); | |||
if (m_uiLib) | |||
return lib_symbol(m_uiLib, symbol); | |||
if (fLib != nullptr) | |||
return lib_symbol(fLib, symbol); | |||
return nullptr; | |||
} | |||
const char* CarlaBridgeClient::uiLibError() | |||
{ | |||
return lib_error(m_uiFilename); | |||
return lib_error(fFilename); | |||
} | |||
#endif | |||
@@ -43,11 +43,9 @@ public: | |||
// --------------------------------------------------------------------- | |||
// ui initialization | |||
virtual bool init(const char* const, const char* const); | |||
virtual void close(); | |||
#endif | |||
virtual bool uiInit(const char* const, const char* const); | |||
virtual void uiClose(); | |||
#ifdef BUILD_BRIDGE_UI | |||
// --------------------------------------------------------------------- | |||
// ui management | |||
@@ -56,6 +54,15 @@ public: | |||
virtual bool needsReparent() const = 0; | |||
#endif | |||
#ifdef BUILD_BRIDGE_PLUGIN | |||
// --------------------------------------------------------------------- | |||
// plugin management | |||
virtual void saveNow() = 0; | |||
virtual void setCustomData(const char* const type, const char* const key, const char* const value) = 0; | |||
virtual void setChunkData(const char* const filePath) = 0; | |||
#endif | |||
// --------------------------------------------------------------------- | |||
// processing | |||
@@ -63,26 +70,16 @@ public: | |||
virtual void setProgram(const uint32_t index) = 0; | |||
#ifdef BUILD_BRIDGE_PLUGIN | |||
virtual void setMidiProgram(const uint32_t index) = 0; | |||
#endif | |||
#ifdef BUILD_BRIDGE_UI | |||
#else | |||
virtual void setMidiProgram(const uint32_t bank, const uint32_t program) = 0; | |||
#endif | |||
virtual void noteOn(const uint8_t channel, const uint8_t note, const uint8_t velo) = 0; | |||
virtual void noteOff(const uint8_t channel, const uint8_t note) = 0; | |||
#ifdef BUILD_BRIDGE_PLUGIN | |||
// --------------------------------------------------------------------- | |||
// plugin | |||
virtual void saveNow() = 0; | |||
virtual void setCustomData(const char* const type, const char* const key, const char* const value) = 0; | |||
virtual void setChunkData(const char* const filePath) = 0; | |||
#endif | |||
// --------------------------------------------------------------------- | |||
// osc stuff | |||
bool oscInit(const char* const url); | |||
void oscInit(const char* const url); | |||
bool oscIdle(); | |||
void oscClose(); | |||
@@ -94,6 +91,7 @@ public: | |||
void sendOscBridgeError(const char* const error); | |||
#endif | |||
#ifdef BUILD_BRIDGE_UI | |||
// --------------------------------------------------------------------- | |||
// toolkit | |||
@@ -102,6 +100,7 @@ public: | |||
void toolkitResize(const int width, const int height); | |||
void toolkitExec(const bool showGui); | |||
void toolkitQuit(); | |||
#endif | |||
// --------------------------------------------------------------------- | |||
@@ -109,7 +108,9 @@ protected: | |||
void sendOscConfigure(const char* const key, const char* const value); | |||
void sendOscControl(const int32_t index, const float value); | |||
void sendOscProgram(const int32_t index); | |||
#ifdef BUILD_BRIDGE_PLUGIN | |||
void sendOscMidiProgram(const int32_t index); | |||
#endif | |||
void sendOscMidi(const uint8_t midiBuf[4]); | |||
void sendOscExiting(); | |||
@@ -120,11 +121,10 @@ protected: | |||
// --------------------------------------------------------------------- | |||
void* getContainerId(); | |||
#ifdef BUILD_BRIDGE_UI | |||
bool uiLibOpen(const char* const filename); | |||
bool uiLibClose(); | |||
void* getContainerId(); | |||
bool uiLibOpen(const char* const filename); | |||
bool uiLibClose(); | |||
void* uiLibSymbol(const char* const symbol); | |||
const char* uiLibError(); | |||
#endif | |||
@@ -132,18 +132,19 @@ protected: | |||
// --------------------------------------------------------------------- | |||
private: | |||
CarlaBridgeOsc const kOsc; | |||
CarlaBridgeToolkit* const kToolkit; | |||
const CarlaOscData* fOscData; | |||
CarlaBridgeOsc kOsc; | |||
#ifdef BUILD_BRIDGE_UI | |||
char* fFilename; | |||
void* fLib; | |||
bool fQuit; | |||
#else | |||
friend class CarlaPluginClient; | |||
CarlaBridgeToolkit* const kUiToolkit; | |||
char* fUiFilename; | |||
void* fUiLib; | |||
bool fUiQuit; | |||
#endif | |||
const CarlaOscData* fOscData; | |||
CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaBridgeClient) | |||
}; | |||
/**@}*/ | |||
@@ -21,8 +21,6 @@ | |||
#include "CarlaMIDI.h" | |||
#include "CarlaUtils.hpp" | |||
int main() { return 0; } | |||
CARLA_BRIDGE_START_NAMESPACE | |||
// ----------------------------------------------------------------------- | |||
@@ -362,6 +360,7 @@ int CarlaBridgeOsc::handleMsgMidi(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||
return 0; | |||
} | |||
#ifdef BUILD_BRIDGE_UI | |||
int CarlaBridgeOsc::handleMsgShow() | |||
{ | |||
carla_debug("CarlaBridgeOsc::handleMsgShow()"); | |||
@@ -400,5 +399,6 @@ int CarlaBridgeOsc::handleMsgQuit() | |||
return 0; | |||
} | |||
#endif | |||
CARLA_BRIDGE_END_NAMESPACE |
@@ -19,6 +19,7 @@ | |||
#define __CARLA_BRIDGE_OSC_HPP__ | |||
#include "CarlaBridge.hpp" | |||
#include "CarlaJuceUtils.hpp" | |||
#include "CarlaOscUtils.hpp" | |||
#include "CarlaString.hpp" | |||
@@ -127,6 +128,8 @@ private: | |||
{ | |||
return ((CarlaBridgeOsc*)userData)->handleMessage(path, argc, argv, types, msg); | |||
} | |||
CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaBridgeOsc) | |||
}; | |||
CARLA_BRIDGE_END_NAMESPACE | |||
@@ -15,29 +15,25 @@ | |||
* For a full copy of the GNU General Public License see the GPL.txt file | |||
*/ | |||
#include "carla_bridge_toolkit.hpp" | |||
#include "CarlaBridgeToolkit.hpp" | |||
#include "CarlaUtils.hpp" | |||
#include <cstdlib> | |||
#include <cstring> | |||
CARLA_BRIDGE_START_NAMESPACE | |||
CarlaBridgeToolkit::CarlaBridgeToolkit(CarlaBridgeClient* const client_, const char* const newTitle) | |||
: client(client_) | |||
CarlaBridgeToolkit::CarlaBridgeToolkit(CarlaBridgeClient* const client, const char* const uiTitle) | |||
: kClient(client), | |||
kUiTitle(carla_strdup((uiTitle != nullptr) ? uiTitle : "(null)")) | |||
{ | |||
carla_debug("CarlaBridgeToolkit::CarlaBridgeToolkit(%p, \"%s\")", client, newTitle); | |||
CARLA_ASSERT(client); | |||
CARLA_ASSERT(newTitle); | |||
uiTitle = strdup(newTitle ? newTitle : "(null)"); | |||
carla_debug("CarlaBridgeToolkit::CarlaBridgeToolkit(%p, \"%s\")", client, uiTitle); | |||
CARLA_ASSERT(client != nullptr); | |||
CARLA_ASSERT(uiTitle != nullptr); | |||
} | |||
CarlaBridgeToolkit::~CarlaBridgeToolkit() | |||
{ | |||
carla_debug("CarlaBridgeToolkit::~CarlaBridgeToolkit()"); | |||
free(uiTitle); | |||
delete[] kUiTitle; | |||
} | |||
void* CarlaBridgeToolkit::getContainerId() | |||
@@ -53,7 +53,7 @@ public: | |||
protected: | |||
CarlaBridgeClient* const kClient; | |||
char* fUiTitle; | |||
const char* kUiTitle; | |||
}; | |||
/**@}*/ | |||
@@ -15,9 +15,9 @@ | |||
* For a full copy of the GNU General Public License see the GPL.txt file | |||
*/ | |||
#include "carla_bridge_client.hpp" | |||
#include "carla_bridge_toolkit.hpp" | |||
#include "carla_plugin.hpp" | |||
#include "CarlaBridgeClient.hpp" | |||
#include "CarlaBridgeToolkit.hpp" | |||
#include "CarlaPlugin.hpp" | |||
CARLA_BRIDGE_START_NAMESPACE | |||
@@ -26,14 +26,14 @@ static char* qargv[0] = {}; | |||
// ------------------------------------------------------------------------- | |||
class CarlaBridgeToolkitPlugin : public CarlaBridgeToolkit, | |||
public CarlaBackend::CarlaPluginGUI::Callback | |||
class CarlaBridgeToolkitPlugin : public CarlaBridgeToolkit/*, | |||
public CarlaBackend::CarlaPluginGUI::Callback*/ | |||
{ | |||
public: | |||
CarlaBridgeToolkitPlugin(CarlaBridgeClient* const client, const char* const uiTitle) | |||
: CarlaBridgeToolkit(client, uiTitle) | |||
{ | |||
qDebug("CarlaBridgeToolkitPlugin::CarlaBridgeToolkitPlugin(%p, \"%s\")", client, uiTitle); | |||
carla_debug("CarlaBridgeToolkitPlugin::CarlaBridgeToolkitPlugin(%p, \"%s\")", client, uiTitle); | |||
app = nullptr; | |||
gui = nullptr; | |||
@@ -45,14 +45,14 @@ public: | |||
~CarlaBridgeToolkitPlugin() | |||
{ | |||
qDebug("CarlaBridgeToolkitPlugin::~CarlaBridgeToolkitPlugin()"); | |||
carla_debug("CarlaBridgeToolkitPlugin::~CarlaBridgeToolkitPlugin()"); | |||
CARLA_ASSERT(! app); | |||
CARLA_ASSERT(! gui); | |||
} | |||
void init() | |||
{ | |||
qDebug("CarlaBridgeToolkitPlugin::init()"); | |||
carla_debug("CarlaBridgeToolkitPlugin::init()"); | |||
CARLA_ASSERT(! app); | |||
CARLA_ASSERT(! gui); | |||
@@ -63,7 +63,7 @@ public: | |||
void exec(const bool showGui) | |||
{ | |||
qDebug("CarlaBridgeToolkitPlugin::exec(%s)", bool2str(showGui)); | |||
carla_debug("CarlaBridgeToolkitPlugin::exec(%s)", bool2str(showGui)); | |||
CARLA_ASSERT(app); | |||
CARLA_ASSERT(gui); | |||
CARLA_ASSERT(client); | |||
@@ -87,7 +87,7 @@ public: | |||
void quit() | |||
{ | |||
qDebug("CarlaBridgeToolkitPlugin::quit()"); | |||
carla_debug("CarlaBridgeToolkitPlugin::quit()"); | |||
CARLA_ASSERT(app); | |||
if (gui) | |||
@@ -110,7 +110,7 @@ public: | |||
void show() | |||
{ | |||
qDebug("CarlaBridgeToolkitPlugin::show()"); | |||
carla_debug("CarlaBridgeToolkitPlugin::show()"); | |||
CARLA_ASSERT(gui); | |||
if (gui && m_uiShow) | |||
@@ -119,7 +119,7 @@ public: | |||
void hide() | |||
{ | |||
qDebug("CarlaBridgeToolkitPlugin::hide()"); | |||
carla_debug("CarlaBridgeToolkitPlugin::hide()"); | |||
CARLA_ASSERT(gui); | |||
if (gui && m_uiShow) | |||
@@ -128,21 +128,19 @@ public: | |||
void resize(const int width, const int height) | |||
{ | |||
qDebug("CarlaBridgeToolkitPlugin::resize(%i, %i)", width, height); | |||
carla_debug("CarlaBridgeToolkitPlugin::resize(%i, %i)", width, height); | |||
CARLA_ASSERT(gui); | |||
if (gui) | |||
gui->setNewSize(width, height); | |||
} | |||
protected: | |||
QApplication* app; | |||
CarlaBackend::CarlaPluginGUI* gui; | |||
void guiClosedCallback(); | |||
private: | |||
bool m_uiQuit; | |||
QApplication* fApp; | |||
bool fQuit; | |||
//CarlaBackend::CarlaPluginGUI* gui; | |||
//void guiClosedCallback(); | |||
}; | |||
// ------------------------------------------------------------------------- | |||
@@ -12,16 +12,14 @@ VERSION = 0.5.0 | |||
# ----------------------------------------------------------- | |||
SOURCES = \ | |||
# ../CarlaBridgeClient.cpp \ | |||
../CarlaBridgeOsc.cpp | |||
# ../CarlaBridgeToolkit.cpp \ | |||
# ../CarlaBridgePlugin.cpp | |||
../CarlaBridgeClient.cpp \ | |||
../CarlaBridgeOsc.cpp \ | |||
../CarlaBridgePlugin.cpp | |||
HEADERS = \ | |||
../CarlaBridge.hpp \ | |||
../CarlaBridgeClient.hpp \ | |||
../CarlaBridgeOsc.hpp \ | |||
../CarlaBridgeToolkit.hpp | |||
../CarlaBridgeOsc.hpp | |||
# ----------------------------------------------------------- | |||
@@ -54,12 +52,12 @@ SOURCES += \ | |||
# common | |||
HEADERS += \ | |||
../../CarlaBackend.hpp \ | |||
../../CarlaEngine.hpp \ | |||
../../CarlaNative.h \ | |||
../../CarlaNative.hpp \ | |||
../../CarlaPlugin.hpp \ | |||
../../CarlaStandalone.hpp | |||
../../backend/CarlaBackend.hpp \ | |||
../../backend/CarlaEngine.hpp \ | |||
../../backend/CarlaNative.h \ | |||
../../backend/CarlaNative.hpp \ | |||
../../backend/CarlaPlugin.hpp \ | |||
../../backend/CarlaStandalone.hpp | |||
# engine | |||
HEADERS += \ | |||