summaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-08-19 20:09:49 +0000
committerDavid Robillard <d@drobilla.net>2008-08-19 20:09:49 +0000
commit174bd3e0314785a1a885877a9efe7a7eef31e0fa (patch)
tree8368487dfb6e98de7cca2300ad0157868e29aaf4 /src/libs
parente16206982d074e62956de00eeef611478f01c430 (diff)
downloadingen-174bd3e0314785a1a885877a9efe7a7eef31e0fa.tar.gz
ingen-174bd3e0314785a1a885877a9efe7a7eef31e0fa.tar.bz2
ingen-174bd3e0314785a1a885877a9efe7a7eef31e0fa.zip
Slightly more reliable OSC comms. Still not really up to the task of receiving massive patches...
git-svn-id: http://svn.drobilla.net/lad/ingen@1448 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/engine/OSCClientSender.cpp18
-rw-r--r--src/libs/engine/ObjectSender.cpp6
-rw-r--r--src/libs/gui/App.cpp13
-rw-r--r--src/libs/gui/App.hpp2
-rw-r--r--src/libs/gui/ConnectWindow.cpp13
-rw-r--r--src/libs/shared/OSCSender.cpp17
6 files changed, 32 insertions, 37 deletions
diff --git a/src/libs/engine/OSCClientSender.cpp b/src/libs/engine/OSCClientSender.cpp
index 0f05e1ed..dca2e0ed 100644
--- a/src/libs/engine/OSCClientSender.cpp
+++ b/src/libs/engine/OSCClientSender.cpp
@@ -304,28 +304,12 @@ OSCClientSender::new_plugin(const std::string& uri,
const std::string& symbol,
const std::string& name)
{
- // FIXME: size? liblo doesn't export this.
- // Don't want to exceed max UDP packet size (1500 bytes)
- static const size_t MAX_BUNDLE_SIZE = 1500 - 32*5;
-
lo_message m = lo_message_new();
lo_message_add_string(m, uri.c_str());
lo_message_add_string(m, type_uri.c_str());
lo_message_add_string(m, symbol.c_str());
lo_message_add_string(m, name.c_str());
-
- if (_transfer) {
-
- if (lo_bundle_length(_transfer) + lo_message_length(m, "/ingen/plugin")
- > MAX_BUNDLE_SIZE) {
- lo_send_bundle(_address, _transfer);
- _transfer = lo_bundle_new(LO_TT_IMMEDIATE);
- }
- lo_bundle_add_message(_transfer, "/ingen/plugin", m);
-
- } else {
- lo_send_message(_address, "/ingen/plugin", m);
- }
+ send_message("/ingen/plugin", m);
}
diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp
index bcab46a8..688cea8e 100644
--- a/src/libs/engine/ObjectSender.cpp
+++ b/src/libs/engine/ObjectSender.cpp
@@ -52,24 +52,22 @@ ObjectSender::send_patch(ClientInterface* client, const PatchImpl* patch, bool r
// Send nodes
for (List<NodeImpl*>::const_iterator j = patch->nodes().begin();
j != patch->nodes().end(); ++j) {
-
const NodeImpl* const node = (*j);
send_node(client, node, true);
}
// Send ports
for (uint32_t i=0; i < patch->num_ports(); ++i) {
-
PortImpl* const port = patch->port_impl(i);
send_port(client, port);
-
}
// Send connections
+ client->transfer_begin();
for (PatchImpl::Connections::const_iterator j = patch->connections().begin();
j != patch->connections().end(); ++j)
client->connect((*j)->src_port_path(), (*j)->dst_port_path());
-
+ client->transfer_end();
}
}
diff --git a/src/libs/gui/App.cpp b/src/libs/gui/App.cpp
index 64a89f8a..54547114 100644
--- a/src/libs/gui/App.cpp
+++ b/src/libs/gui/App.cpp
@@ -333,6 +333,17 @@ App::event_save_session_as()
#endif
+void
+App::register_callbacks()
+{
+ Glib::signal_timeout().connect(
+ sigc::mem_fun(App::instance(), &App::gtk_main_iteration), 25, G_PRIORITY_DEFAULT);
+
+ Glib::signal_timeout().connect(
+ sigc::mem_fun(App::instance(), &App::animate), 50, G_PRIORITY_DEFAULT);
+}
+
+
bool
App::gtk_main_iteration()
{
@@ -347,8 +358,6 @@ App::gtk_main_iteration()
_enable_signal = true;
}
- animate();
-
return true;
}
diff --git a/src/libs/gui/App.hpp b/src/libs/gui/App.hpp
index 8d16a1c4..a693b729 100644
--- a/src/libs/gui/App.hpp
+++ b/src/libs/gui/App.hpp
@@ -91,7 +91,9 @@ public:
void detach();
+ void register_callbacks();
bool gtk_main_iteration();
+
void show_about();
void quit();
diff --git a/src/libs/gui/ConnectWindow.cpp b/src/libs/gui/ConnectWindow.cpp
index eb095af5..3037ee88 100644
--- a/src/libs/gui/ConnectWindow.cpp
+++ b/src/libs/gui/ConnectWindow.cpp
@@ -171,9 +171,7 @@ ConnectWindow::connect(bool existing)
client = SharedPtr<HTTPClientReceiver>(new HTTPClientReceiver(world, uri, tsci));
App::instance().attach(tsci, client);
-
- Glib::signal_timeout().connect(
- sigc::mem_fun(App::instance(), &App::gtk_main_iteration), 40, G_PRIORITY_DEFAULT);
+ App::instance().register_callbacks();
Glib::signal_timeout().connect(
sigc::mem_fun(this, &ConnectWindow::gtk_callback), 40);
@@ -192,10 +190,9 @@ ConnectWindow::connect(bool existing)
// FIXME: static args
SharedPtr<ThreadedSigClientInterface> tsci(new ThreadedSigClientInterface(1024));
SharedPtr<OSCClientReceiver> client(new OSCClientReceiver(16181, tsci));
+
App::instance().attach(tsci, client);
-
- Glib::signal_timeout().connect(
- sigc::mem_fun(App::instance(), &App::gtk_main_iteration), 40, G_PRIORITY_DEFAULT);
+ App::instance().register_callbacks();
Glib::signal_timeout().connect(
sigc::mem_fun(this, &ConnectWindow::gtk_callback), 40);
@@ -220,9 +217,7 @@ ConnectWindow::connect(bool existing)
world->local_engine->activate(1); // FIXME: parallelism
App::instance().attach(client);
-
- Glib::signal_timeout().connect(
- sigc::mem_fun(App::instance(), &App::gtk_main_iteration), 40, G_PRIORITY_DEFAULT);
+ App::instance().register_callbacks();
Glib::signal_timeout().connect(
sigc::mem_fun(this, &ConnectWindow::gtk_callback), 10);
diff --git a/src/libs/shared/OSCSender.cpp b/src/libs/shared/OSCSender.cpp
index 3936cf96..f0cd76f2 100644
--- a/src/libs/shared/OSCSender.cpp
+++ b/src/libs/shared/OSCSender.cpp
@@ -18,6 +18,7 @@
#include "OSCSender.hpp"
#include <cassert>
#include <iostream>
+#include <unistd.h>
using namespace std;
@@ -37,7 +38,9 @@ void
OSCSender::bundle_begin()
{
assert(!_transfer);
- _transfer = lo_bundle_new(LO_TT_IMMEDIATE);
+ lo_timetag t;
+ lo_timetag_now(&t);
+ _transfer = lo_bundle_new(t);
_send_state = SendingBundle;
}
@@ -53,7 +56,9 @@ void
OSCSender::transfer_begin()
{
assert(!_transfer);
- _transfer = lo_bundle_new(LO_TT_IMMEDIATE);
+ lo_timetag t;
+ lo_timetag_now(&t);
+ _transfer = lo_bundle_new(t);
_send_state = SendingTransfer;
}
@@ -99,13 +104,15 @@ OSCSender::send_message(const char* path, lo_message msg)
if (!_enabled)
return;
-
+
if (_transfer) {
+ lo_timetag t;
if (lo_bundle_length(_transfer) + lo_message_length(msg, path) > MAX_BUNDLE_SIZE) {
- if (_send_state == SendingBundle)
+ //if (_send_state == SendingBundle)
cerr << "WARNING: Maximum bundle size reached, bundle split" << endl;
lo_send_bundle(_address, _transfer);
- _transfer = lo_bundle_new(LO_TT_IMMEDIATE);
+ lo_timetag_now(&t);
+ _transfer = lo_bundle_new(t);
}
lo_bundle_add_message(_transfer, path, msg);