diff --git a/source/bridges-ui/CarlaBridgeUI.cpp b/source/bridges-ui/CarlaBridgeUI.cpp index 6dcf21315..8b33e61b8 100644 --- a/source/bridges-ui/CarlaBridgeUI.cpp +++ b/source/bridges-ui/CarlaBridgeUI.cpp @@ -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 diff --git a/source/bridges-ui/CarlaBridgeUI.hpp b/source/bridges-ui/CarlaBridgeUI.hpp index ca5dcba04..9ebb20e3a 100644 --- a/source/bridges-ui/CarlaBridgeUI.hpp +++ b/source/bridges-ui/CarlaBridgeUI.hpp @@ -164,106 +164,3 @@ protected: CARLA_BRIDGE_END_NAMESPACE #endif // CARLA_BRIDGE_UI_HPP_INCLUDED - -// ----------------------------------------------------------------------- - -#if 0 - // --------------------------------------------------------------------- - // ui initialization - - virtual bool uiInit(const char*, const char* const, const char* const); - virtual void uiIdle() {} - virtual void uiClose(); - - // --------------------------------------------------------------------- - // ui toolkit - - void toolkitShow(); - void toolkitHide(); - void toolkitResize(const int width, const int height); - void toolkitExec(const bool showGui); - void toolkitQuit(); - - // --------------------------------------------------------------------- - // osc stuff - - void oscInit(const char* const url); - bool oscIdle(const bool onlyOnce = false) const; - void oscClose(); - - bool isOscControlRegistered() const noexcept; - void sendOscUpdate() const; - - // --------------------------------------------------------------------- - -protected: - void sendOscConfigure(const char* const key, const char* const value) const; - void sendOscControl(const int32_t index, const float value) const; - void sendOscProgram(const uint32_t index) const; - void sendOscMidiProgram(const uint32_t index) const; - void sendOscMidi(const uint8_t midiBuf[4]) const; - void sendOscExiting() const; - -#ifdef BRIDGE_LV2 - void sendOscLv2AtomTransfer(const uint32_t portIndex, const char* const atomBuf) const; - void sendOscLv2UridMap(const uint32_t urid, const char* const uri) const; -#endif - - // --------------------------------------------------------------------- - - void* getContainerId(); - void* getContainerId2(); - - // --------------------------------------------------------------------- - - const char* uiLibError(); - - template - Func uiLibSymbol(const char* const symbol) - { - CARLA_SAFE_ASSERT_RETURN(fUI.lib != nullptr, nullptr); - carla_debug("CarlaBridgeUI::uiLibSymbol(\"%s\")", symbol); - - return lib_symbol(fUI.lib, symbol); - } -#endif - -#if 0 - struct UI { - CarlaBridgeToolkit* const toolkit; - CarlaString filename; - lib_t lib; - bool quit; - - UI(CarlaBridgeToolkit* const toolkit_) - : toolkit(toolkit_), - filename(), - lib(nullptr), - quit(false) - { - CARLA_ASSERT(toolkit != nullptr); - } - - ~UI() - { - delete toolkit; - } - - void init() - { - toolkit->init(); - quit = false; - } - - void close() - { - quit = true; - toolkit->quit(); - } - -#ifdef CARLA_PROPER_CPP11_SUPPORT - UI() = delete; - CARLA_DECLARE_NON_COPY_STRUCT(UI) -#endif - } fUI; -#endif