|
|
|
@@ -325,220 +325,3 @@ CARLA_BRIDGE_END_NAMESPACE |
|
|
|
#include "CarlaPipeUtils.cpp" |
|
|
|
|
|
|
|
// --------------------------------------------------------------------- |
|
|
|
|
|
|
|
#if 0 |
|
|
|
// --------------------------------------------------------------------- |
|
|
|
// ui initialization |
|
|
|
|
|
|
|
bool CarlaBridgeUI::uiInit(const char*, const char* const, const char* const) |
|
|
|
{ |
|
|
|
carla_debug("CarlaBridgeUI::uiInit()"); |
|
|
|
|
|
|
|
fUI.init(); |
|
|
|
|
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
void CarlaBridgeUI::uiClose() |
|
|
|
{ |
|
|
|
carla_debug("CarlaBridgeUI::uiClose()"); |
|
|
|
|
|
|
|
if (isOscControlRegistered() && ! fUI.quit) |
|
|
|
sendOscExiting(); |
|
|
|
|
|
|
|
fUI.close(); |
|
|
|
} |
|
|
|
|
|
|
|
// --------------------------------------------------------------------- |
|
|
|
// ui toolkit |
|
|
|
|
|
|
|
void CarlaBridgeUI::toolkitShow() |
|
|
|
{ |
|
|
|
CARLA_SAFE_ASSERT_RETURN(fUI.toolkit != nullptr,); |
|
|
|
carla_debug("CarlaBridgeUI::toolkitShow()"); |
|
|
|
|
|
|
|
fUI.toolkit->show(); |
|
|
|
} |
|
|
|
|
|
|
|
void CarlaBridgeUI::toolkitHide() |
|
|
|
{ |
|
|
|
CARLA_SAFE_ASSERT_RETURN(fUI.toolkit != nullptr,); |
|
|
|
carla_debug("CarlaBridgeUI::toolkitHide()"); |
|
|
|
|
|
|
|
fUI.toolkit->hide(); |
|
|
|
} |
|
|
|
|
|
|
|
void CarlaBridgeUI::toolkitResize(const int width, const int height) |
|
|
|
{ |
|
|
|
CARLA_SAFE_ASSERT_RETURN(fUI.toolkit != nullptr,); |
|
|
|
carla_debug("CarlaBridgeUI::toolkitResize(%i, %i)", width, height); |
|
|
|
|
|
|
|
fUI.toolkit->resize(width, height); |
|
|
|
} |
|
|
|
|
|
|
|
void CarlaBridgeUI::toolkitExec(const bool showGui) |
|
|
|
{ |
|
|
|
CARLA_SAFE_ASSERT_RETURN(fUI.toolkit != nullptr,); |
|
|
|
carla_debug("CarlaBridgeUI::toolkitExec(%s)", bool2str(showGui)); |
|
|
|
|
|
|
|
fUI.toolkit->exec(showGui); |
|
|
|
} |
|
|
|
|
|
|
|
void CarlaBridgeUI::toolkitQuit() |
|
|
|
{ |
|
|
|
carla_debug("CarlaBridgeUI::toolkitQuit()"); |
|
|
|
|
|
|
|
fUI.quit = true; |
|
|
|
} |
|
|
|
|
|
|
|
// --------------------------------------------------------------------- |
|
|
|
// osc stuff |
|
|
|
|
|
|
|
void CarlaBridgeUI::oscInit(const char* const url) |
|
|
|
{ |
|
|
|
carla_debug("CarlaBridgeUI::oscInit(\"%s\")", url); |
|
|
|
|
|
|
|
fOsc.init(url); |
|
|
|
} |
|
|
|
|
|
|
|
bool CarlaBridgeUI::oscIdle(const bool onlyOnce) const |
|
|
|
{ |
|
|
|
if (onlyOnce) |
|
|
|
fOsc.idleOnce(); |
|
|
|
else |
|
|
|
fOsc.idle(); |
|
|
|
|
|
|
|
return ! fUI.quit; |
|
|
|
} |
|
|
|
|
|
|
|
void CarlaBridgeUI::oscClose() |
|
|
|
{ |
|
|
|
carla_debug("CarlaBridgeUI::oscClose()"); |
|
|
|
|
|
|
|
fOsc.close(); |
|
|
|
} |
|
|
|
|
|
|
|
bool CarlaBridgeUI::isOscControlRegistered() const noexcept |
|
|
|
{ |
|
|
|
return fOsc.isControlRegistered(); |
|
|
|
} |
|
|
|
|
|
|
|
void CarlaBridgeUI::sendOscUpdate() const |
|
|
|
{ |
|
|
|
carla_debug("CarlaBridgeUI::sendOscUpdate()"); |
|
|
|
|
|
|
|
if (fOscData.target != nullptr) |
|
|
|
osc_send_update(fOscData, fOsc.getServerPath()); |
|
|
|
} |
|
|
|
|
|
|
|
// --------------------------------------------------------------------- |
|
|
|
|
|
|
|
void CarlaBridgeUI::sendOscConfigure(const char* const key, const char* const value) const |
|
|
|
{ |
|
|
|
carla_debug("CarlaBridgeUI::sendOscConfigure(\"%s\", \"%s\")", key, value); |
|
|
|
|
|
|
|
if (fOscData.target != nullptr) |
|
|
|
osc_send_configure(fOscData, key, value); |
|
|
|
} |
|
|
|
|
|
|
|
void CarlaBridgeUI::sendOscControl(const int32_t index, const float value) const |
|
|
|
{ |
|
|
|
carla_debug("CarlaBridgeUI::sendOscControl(%i, %f)", index, value); |
|
|
|
|
|
|
|
if (fOscData.target != nullptr) |
|
|
|
osc_send_control(fOscData, index, value); |
|
|
|
} |
|
|
|
|
|
|
|
void CarlaBridgeUI::sendOscProgram(const uint32_t index) const |
|
|
|
{ |
|
|
|
carla_debug("CarlaBridgeUI::sendOscProgram(%i)", index); |
|
|
|
|
|
|
|
if (fOscData.target != nullptr) |
|
|
|
osc_send_program(fOscData, index); |
|
|
|
} |
|
|
|
|
|
|
|
void CarlaBridgeUI::sendOscMidiProgram(const uint32_t index) const |
|
|
|
{ |
|
|
|
carla_debug("CarlaBridgeUI::sendOscMidiProgram(%i)", index); |
|
|
|
|
|
|
|
if (fOscData.target != nullptr) |
|
|
|
osc_send_midi_program(fOscData, index); |
|
|
|
} |
|
|
|
|
|
|
|
void CarlaBridgeUI::sendOscMidi(const uint8_t midiBuf[4]) const |
|
|
|
{ |
|
|
|
carla_debug("CarlaBridgeUI::sendOscMidi(%p)", midiBuf); |
|
|
|
|
|
|
|
if (fOscData.target != nullptr) |
|
|
|
osc_send_midi(fOscData, midiBuf); |
|
|
|
} |
|
|
|
|
|
|
|
void CarlaBridgeUI::sendOscExiting() const |
|
|
|
{ |
|
|
|
carla_debug("CarlaBridgeUI::sendOscExiting()"); |
|
|
|
|
|
|
|
if (fOscData.target != nullptr) |
|
|
|
osc_send_exiting(fOscData); |
|
|
|
} |
|
|
|
|
|
|
|
#ifdef BRIDGE_LV2 |
|
|
|
void CarlaBridgeUI::sendOscLv2AtomTransfer(const uint32_t portIndex, const char* const atomBuf) const |
|
|
|
{ |
|
|
|
carla_debug("CarlaBridgeUI::sendOscLv2TransferAtom(%i, \"%s\")", portIndex, atomBuf); |
|
|
|
|
|
|
|
if (fOscData.target != nullptr) |
|
|
|
osc_send_lv2_atom_transfer(fOscData, portIndex, atomBuf); |
|
|
|
} |
|
|
|
|
|
|
|
void CarlaBridgeUI::sendOscLv2UridMap(const uint32_t urid, const char* const uri) const |
|
|
|
{ |
|
|
|
carla_debug("CarlaBridgeUI::sendOscLv2UridMap(%i, \"%s\")", urid, uri); |
|
|
|
|
|
|
|
if (fOscData.target != nullptr) |
|
|
|
osc_send_lv2_urid_map(fOscData, urid, uri); |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
// --------------------------------------------------------------------- |
|
|
|
|
|
|
|
void* CarlaBridgeUI::getContainerId() |
|
|
|
{ |
|
|
|
carla_debug("CarlaBridgeUI::getContainerId()"); |
|
|
|
return fUI.toolkit->getContainerId(); |
|
|
|
} |
|
|
|
|
|
|
|
void* CarlaBridgeUI::getContainerId2() |
|
|
|
{ |
|
|
|
carla_debug("CarlaBridgeUI::getContainerId2()"); |
|
|
|
return fUI.toolkit->getContainerId2(); |
|
|
|
} |
|
|
|
|
|
|
|
bool CarlaBridgeUI::uiLibOpen(const char* const filename) |
|
|
|
{ |
|
|
|
CARLA_ASSERT(fUI.lib == nullptr); |
|
|
|
CARLA_ASSERT(filename != nullptr); |
|
|
|
carla_debug("CarlaBridgeUI::uiLibOpen(\"%s\")", filename); |
|
|
|
|
|
|
|
fUI.lib = lib_open(filename); |
|
|
|
fUI.filename = filename; |
|
|
|
|
|
|
|
return (fUI.lib != nullptr); |
|
|
|
} |
|
|
|
|
|
|
|
bool CarlaBridgeUI::uiLibClose() |
|
|
|
{ |
|
|
|
CARLA_SAFE_ASSERT_RETURN(fUI.lib != nullptr, false); |
|
|
|
carla_debug("CarlaBridgeUI::uiLibClose()"); |
|
|
|
|
|
|
|
const bool closed = lib_close(fUI.lib); |
|
|
|
fUI.lib = nullptr; |
|
|
|
return closed; |
|
|
|
} |
|
|
|
|
|
|
|
const char* CarlaBridgeUI::uiLibError() |
|
|
|
{ |
|
|
|
carla_debug("CarlaBridgeUI::uiLibError()"); |
|
|
|
|
|
|
|
return lib_error(fUI.filename); |
|
|
|
} |
|
|
|
#endif |