Browse Source

Show and use OSC UDP address

tags/1.9.4
falkTX 11 years ago
parent
commit
69b709edf2
6 changed files with 81 additions and 20 deletions
  1. +37
    -8
      resources/ui/carla_about.ui
  2. +7
    -2
      source/backend/CarlaStandalone.hpp
  3. +16
    -2
      source/backend/standalone/CarlaStandalone.cpp
  4. +10
    -4
      source/carla_backend.py
  5. +4
    -3
      source/carla_control.py
  6. +7
    -1
      source/carla_shared.py

+ 37
- 8
resources/ui/carla_about.ui View File

@@ -255,7 +255,7 @@
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="text"> <property name="text">
<string>Host URL:</string>
<string>Host URLs:</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -263,13 +263,16 @@
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QLineEdit" name="le_osc_url">
<widget class="QLineEdit" name="le_osc_url_tcp">
<property name="frame">
<bool>false</bool>
</property>
<property name="readOnly"> <property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0">
<item row="3" column="0">
<widget class="QLabel" name="label_7"> <widget class="QLabel" name="label_7">
<property name="text"> <property name="text">
<string>Valid commands:</string> <string>Valid commands:</string>
@@ -279,7 +282,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1">
<item row="3" column="1">
<widget class="QLabel" name="l_osc_cmds"> <widget class="QLabel" name="l_osc_cmds">
<property name="font"> <property name="font">
<font> <font>
@@ -294,7 +297,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0">
<item row="4" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>Example:</string> <string>Example:</string>
@@ -304,7 +307,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1">
<item row="4" column="1">
<widget class="QLabel" name="l_example"> <widget class="QLabel" name="l_example">
<property name="font"> <property name="font">
<font> <font>
@@ -316,7 +319,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1">
<item row="5" column="1">
<widget class="QLabel" name="l_example_help"> <widget class="QLabel" name="l_example_help">
<property name="text"> <property name="text">
<string>TextLabel</string> <string>TextLabel</string>
@@ -326,7 +329,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0" colspan="2">
<item row="6" column="0" colspan="2">
<spacer name="verticalSpacer_2"> <spacer name="verticalSpacer_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@@ -339,6 +342,32 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="1" column="1">
<widget class="QLineEdit" name="le_osc_url_udp">
<property name="frame">
<bool>false</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>


+ 7
- 2
source/backend/CarlaStandalone.hpp View File

@@ -680,9 +680,14 @@ CARLA_EXPORT double carla_get_sample_rate();
CARLA_EXPORT const char* carla_get_last_error(); CARLA_EXPORT const char* carla_get_last_error();


/*! /*!
* Get the current engine OSC URL.
* Get the current engine OSC URL (TCP).
*/ */
CARLA_EXPORT const char* carla_get_host_osc_url();
CARLA_EXPORT const char* carla_get_host_osc_url_tcp();

/*!
* Get the current engine OSC URL (UDP).
*/
CARLA_EXPORT const char* carla_get_host_osc_url_udp();


/*! /*!
* Send NSM announce message. * Send NSM announce message.


+ 16
- 2
source/backend/standalone/CarlaStandalone.cpp View File

@@ -2085,9 +2085,9 @@ const char* carla_get_last_error()
return standalone.lastError; return standalone.lastError;
} }


const char* carla_get_host_osc_url()
const char* carla_get_host_osc_url_tcp()
{ {
carla_debug("carla_get_host_osc_url()");
carla_debug("carla_get_host_osc_url_tcp()");
CARLA_ASSERT(standalone.engine != nullptr); CARLA_ASSERT(standalone.engine != nullptr);


if (standalone.engine == nullptr) if (standalone.engine == nullptr)
@@ -2099,6 +2099,20 @@ const char* carla_get_host_osc_url()
return standalone.engine->getOscServerPathTCP(); return standalone.engine->getOscServerPathTCP();
} }


const char* carla_get_host_osc_url_udp()
{
carla_debug("carla_get_host_osc_url_udp()");
CARLA_ASSERT(standalone.engine != nullptr);

if (standalone.engine == nullptr)
{
standalone.lastError = "Engine is not started";
return nullptr;
}

return standalone.engine->getOscServerPathUDP();
}

// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------


#define NSM_API_VERSION_MAJOR 1 #define NSM_API_VERSION_MAJOR 1


+ 10
- 4
source/carla_backend.py View File

@@ -630,8 +630,11 @@ class Host(object):
self.lib.carla_get_last_error.argtypes = None self.lib.carla_get_last_error.argtypes = None
self.lib.carla_get_last_error.restype = c_char_p self.lib.carla_get_last_error.restype = c_char_p


self.lib.carla_get_host_osc_url.argtypes = None
self.lib.carla_get_host_osc_url.restype = c_char_p
self.lib.carla_get_host_osc_url_tcp.argtypes = None
self.lib.carla_get_host_osc_url_tcp.restype = c_char_p

self.lib.carla_get_host_osc_url_udp.argtypes = None
self.lib.carla_get_host_osc_url_udp.restype = c_char_p


self.lib.carla_nsm_announce.argtypes = [c_char_p, c_char_p, c_int] self.lib.carla_nsm_announce.argtypes = [c_char_p, c_char_p, c_int]
self.lib.carla_nsm_announce.restype = None self.lib.carla_nsm_announce.restype = None
@@ -880,8 +883,11 @@ class Host(object):
def get_last_error(self): def get_last_error(self):
return self.lib.carla_get_last_error() return self.lib.carla_get_last_error()


def get_host_osc_url(self):
return self.lib.carla_get_host_osc_url()
def get_host_osc_url_tcp(self):
return self.lib.carla_get_host_osc_url_tcp()

def get_host_osc_url_udp(self):
return self.lib.carla_get_host_osc_url_udp()


def get_buffer_size(self): def get_buffer_size(self):
return self.lib.carla_get_buffer_size() return self.lib.carla_get_buffer_size()


+ 4
- 3
source/carla_control.py View File

@@ -24,6 +24,7 @@ from PyQt4.QtGui import QApplication, QInputDialog, QMainWindow
from liblo import make_method, Address, ServerError, ServerThread from liblo import make_method, Address, ServerError, ServerThread
from liblo import send as lo_send from liblo import send as lo_send
from liblo import TCP as LO_TCP from liblo import TCP as LO_TCP
from liblo import UDP as LO_UDP


# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Imports (Custom) # Imports (Custom)
@@ -480,8 +481,8 @@ class Host(object):
# OSC Control server # OSC Control server


class ControlServer(ServerThread): class ControlServer(ServerThread):
def __init__(self, parent):
ServerThread.__init__(self, 8087, LO_TCP)
def __init__(self, parent, mode):
ServerThread.__init__(self, 8087, mode)


self.fParent = parent self.fParent = parent


@@ -730,7 +731,7 @@ class CarlaControlW(QMainWindow):
print("Connecting to \"%s\" as '%s'..." % (self.lo_address, lo_targetName)) print("Connecting to \"%s\" as '%s'..." % (self.lo_address, lo_targetName))


try: try:
self.lo_server = ControlServer(self)
self.lo_server = ControlServer(self, LO_UDP if self.lo_address.startswith("osc.udp") else LO_TCP)
except: # ServerError, err: except: # ServerError, err:
print("Connecting error!") print("Connecting error!")
#print str(err) #print str(err)


+ 7
- 1
source/carla_shared.py View File

@@ -829,7 +829,13 @@ class CarlaAboutW(QDialog):


else: else:
self.ui.l_extended.setText(cString(Carla.host.get_extended_license_text())) self.ui.l_extended.setText(cString(Carla.host.get_extended_license_text()))
self.ui.le_osc_url.setText(cString(Carla.host.get_host_osc_url()) if Carla.host.is_engine_running() else self.tr("(Engine not running)"))

if Carla.host.is_engine_running():
self.ui.le_osc_url_tcp.setText(cString(Carla.host.get_host_osc_url_tcp()))
self.ui.le_osc_url_udp.setText(cString(Carla.host.get_host_osc_url_udp()))
else:
self.ui.le_osc_url_tcp.setText(self.tr("(Engine not running)"))
self.ui.le_osc_url_udp.setText(self.tr("(Engine not running)"))


self.ui.l_osc_cmds.setText("" self.ui.l_osc_cmds.setText(""
" /set_active <i-value>\n" " /set_active <i-value>\n"


Loading…
Cancel
Save