Changeset 1447


Ignore:
Timestamp:
08/19/08 11:51:06 (6 years ago)
Author:
drobilla
Message:

Preliminary connecting via HTTP in Gtk client.
Better handling of overflowed client event receive buffer.
Store fixes, complain only once about orphans, don't request an orphan parent over and over.

Location:
ingen/src
Files:
4 added
35 edited

Legend:

Unmodified
Added
Removed
  • ingen/src/common/interface/ClientInterface.hpp

    r1444 r1447  
    4343    virtual void response_ok(int32_t id) = 0; 
    4444    virtual void response_error(int32_t id, const std::string& msg) = 0; 
     45 
     46    virtual bool enabled() const = 0; 
    4547     
    4648    virtual void enable() = 0; 
  • ingen/src/common/interface/EngineInterface.hpp

    r1443 r1447  
    3939public: 
    4040    virtual ~EngineInterface() {} 
     41 
     42    virtual std::string uri() const = 0; 
    4143     
    4244    // Responses 
  • ingen/src/libs/client/ClientStore.cpp

    r1443 r1447  
    7373    if (!_handle_orphans) 
    7474        return; 
    75     cerr << "WARNING: Node " << node->path() << " received, but plugin " 
    76         << node->plugin_uri() << " unknown." << endl; 
    7775 
    7876    Raul::Table<string, list<SharedPtr<NodeModel> > >::iterator spawn 
    7977        = _plugin_orphans.find(node->plugin_uri()); 
    8078 
    81     _engine->request_plugin(node->plugin_uri()); 
    82  
    8379    if (spawn != _plugin_orphans.end()) { 
    8480        spawn->second.push_back(node); 
    8581    } else { 
     82        cerr << "WARNING: Orphans of plugin " << node->plugin_uri() << " received" << endl; 
     83        _engine->request_plugin(node->plugin_uri()); 
    8684        list<SharedPtr<NodeModel> > l; 
    8785        l.push_back(node); 
     
    109107                i != spawn.end(); ++i) { 
    110108            (*i)->_plugin = plugin; 
    111             add_object(*i); 
     109            //add_object(*i); 
    112110        } 
    113111    } 
     
    249247    iterator existing = find(object->path()); 
    250248    if (existing != end()) { 
    251         cout << "WARNING: Object " << object->path() << " already exists in store" << endl; 
    252249        PtrCast<ObjectModel>(existing->second)->set(object); 
    253250    } else { 
     
    445442        SharedPtr<NodeModel> n(new NodeModel(plugin_uri, path)); 
    446443        add_plugin_orphan(n); 
     444        add_object(n); 
    447445    } else { 
    448446        SharedPtr<NodeModel> n(new NodeModel(plug, path)); 
  • ingen/src/libs/client/Makefile.am

    r1409 r1447  
    1616    @RAUL_CFLAGS@ \ 
    1717    @REDLANDMM_CFLAGS@ \ 
    18     @SLV2_CFLAGS@ 
     18    @SLV2_CFLAGS@ \ 
     19    @SOUP_CFLAGS@ 
    1920 
    2021libingen_client_la_LIBADD = \ 
     
    2627    @RAUL_LIBS@ \ 
    2728    @REDLANDMM_LIBS@ \ 
    28     @SLV2_LIBS@ 
     29    @SLV2_LIBS@ \ 
     30    @SOUP_LIBS@ 
    2931 
    3032libingen_client_la_SOURCES = \ 
    3133    $(top_srcdir)/ingen/src/common/interface/ClientInterface.hpp \ 
    3234    $(top_srcdir)/ingen/src/common/interface/EngineInterface.hpp \ 
     35    ClientStore.cpp \ 
     36    ClientStore.hpp \ 
    3337    ConnectionModel.hpp \ 
    3438    DeprecatedLoader.cpp \ 
    3539    DeprecatedLoader.hpp \ 
     40    HTTPClientReceiver.cpp \ 
     41    HTTPClientReceiver.hpp \ 
     42    HTTPEngineSender.cpp \ 
     43    HTTPEngineSender.hpp \ 
    3644    NodeModel.cpp \ 
    3745    NodeModel.hpp \ 
     
    4654    PluginModel.cpp \ 
    4755    PluginModel.hpp \ 
     56    PluginUI.cpp \ 
    4857    PluginUI.hpp \ 
    49     PluginUI.cpp \ 
    5058    PortModel.cpp \ 
    5159    PortModel.hpp \ 
    5260    SigClientInterface.hpp \ 
    53     ClientStore.cpp \ 
    54     ClientStore.hpp \ 
    5561    ThreadedSigClientInterface.cpp \ 
    5662    ThreadedSigClientInterface.hpp \ 
  • ingen/src/libs/client/NodeModel.cpp

    r1416 r1447  
    7070{ 
    7171    // FIXME: slow 
    72     for (PortModelList::iterator i = _ports.begin(); i != _ports.end(); ++i) { 
     72    for (Ports::iterator i = _ports.begin(); i != _ports.end(); ++i) { 
    7373        if ((*i) == port) { 
    7474            _ports.erase(i); 
     
    8484{ 
    8585    // FIXME: slow 
    86     for (PortModelList::iterator i = _ports.begin(); i != _ports.end(); ++i) { 
     86    for (Ports::iterator i = _ports.begin(); i != _ports.end(); ++i) { 
    8787        if ((*i)->path() == port_path) { 
    8888            _ports.erase(i); 
     
    142142    assert(pm->parent().get() == this); 
    143143 
    144     PortModelList::iterator existing = find(_ports.begin(), _ports.end(), pm); 
     144    Ports::iterator existing = find(_ports.begin(), _ports.end(), pm); 
    145145     
    146146    // Store should have handled this by merging the two 
     
    156156{ 
    157157    assert(port_name.find("/") == string::npos); 
    158     for (PortModelList::const_iterator i = _ports.begin(); i != _ports.end(); ++i) 
     158    for (Ports::const_iterator i = _ports.begin(); i != _ports.end(); ++i) 
    159159        if ((*i)->path().name() == port_name) 
    160160            return (*i); 
     
    212212{ 
    213213    SharedPtr<NodeModel> node = PtrCast<NodeModel>(model); 
    214     if (node) 
     214    if (node) { 
     215        _plugin_uri = node->_plugin_uri; 
    215216        _plugin = node->_plugin; 
     217    } 
    216218 
    217219    ObjectModel::set(model); 
  • ingen/src/libs/client/NodeModel.hpp

    r1416 r1447  
    5151    NodeModel(const NodeModel& copy); 
    5252    virtual ~NodeModel(); 
     53     
     54    typedef vector<SharedPtr<PortModel> > Ports; 
    5355 
    5456    SharedPtr<PortModel> get_port(const string& port_name) const; 
     
    5961    const Shared::Plugin* plugin()     const { return _plugin.get(); } 
    6062    uint32_t              num_ports()  const { return _ports.size(); } 
    61     const PortModelList&  ports()      const { return _ports; } 
     63    const Ports&          ports()      const { return _ports; } 
    6264     
    6365    void port_value_range(SharedPtr<PortModel> port, float& min, float& max); 
     
    8587    virtual void clear(); 
    8688     
    87     PortModelList          _ports;      ///< List of ports (not a Table to preserve order) 
     89    Ports                  _ports;      ///< Vector of ports (not a Table to preserve order) 
    8890    string                 _plugin_uri; ///< Plugin URI (if PluginModel is unknown) 
    8991    SharedPtr<PluginModel> _plugin;     ///< The plugin this node is an instance of 
     
    9496 
    9597 
    96 typedef Table<string, SharedPtr<NodeModel> > NodeModelMap; 
    97  
    98  
    9998} // namespace Client 
    10099} // namespace Ingen 
  • ingen/src/libs/client/OSCClientReceiver.hpp

    r1445 r1447  
    2626 
    2727namespace Ingen { 
    28  
    29 /** Client library */ 
    3028namespace Client { 
    3129 
    32 //class NodeModel; 
    33  
    34 /* Some boilerplate killing macros... */ 
     30/** Arguments to a liblo handler */ 
    3531#define LO_HANDLER_ARGS const char* path, const char* types, lo_arg** argv, int argc, lo_message msg 
    3632 
    37 /* Defines a static handler to be passed to lo_add_method, which is a trivial 
    38  * wrapper around a non-static method that does the real work.  Makes a whoole 
    39  * lot of ugly boiler plate go away */ 
     33/** Define a static handler to be passed to lo_add_method, which is a trivial 
     34 * wrapper around a non-static method that does the real work. */ 
    4035#define LO_HANDLER(name) \ 
    4136int _##name##_cb (LO_HANDLER_ARGS);\ 
     
    6257    OSCClientReceiver(int listen_port, SharedPtr<Shared::ClientInterface> target); 
    6358    ~OSCClientReceiver(); 
     59 
     60    std::string uri() const { return lo_server_thread_get_url(_st); } 
    6461 
    6562    void start(bool dump_osc); 
     
    106103 
    107104} // namespace Client 
    108  
    109105} // namespace Ingen 
    110106 
  • ingen/src/libs/client/OSCEngineSender.hpp

    r1441 r1447  
    4545    ~OSCEngineSender(); 
    4646     
    47     string engine_url() { return _engine_url; } 
     47    std::string uri() const { return _engine_url; } 
    4848     
    4949    inline int32_t next_id() 
     
    149149 
    150150protected: 
    151     string    _engine_url; 
    152     int        _client_port; 
    153     int32_t    _id; 
     151    const string _engine_url; 
     152    int          _client_port; 
     153    int32_t      _id; 
    154154}; 
    155155 
  • ingen/src/libs/client/ObjectModel.cpp

    r1418 r1447  
    120120 */ 
    121121void 
    122 ObjectModel::set(SharedPtr<ObjectModel> model) 
     122ObjectModel::set(SharedPtr<ObjectModel> o) 
    123123{ 
    124     assert(_path == model->path()); 
     124    assert(_path == o->path()); 
     125    if (o->_parent) 
     126        _parent = o->_parent; 
    125127 
    126     for (Variables::const_iterator other = model->variables().begin(); 
    127             other != model->variables().end(); ++other) { 
    128          
    129         Variables::const_iterator mine = _variables.find(other->first); 
    130          
    131         if (mine != _variables.end()) { 
    132             cerr << "WARNING:  " << _path << "Client/Server data mismatch: " << other->first << endl; 
    133         } 
    134  
    135         _variables[other->first] = other->second; 
    136         signal_variable.emit(other->first, other->second); 
     128    for (Variables::const_iterator v = o->variables().begin(); v != o->variables().end(); ++v) { 
     129        Variables::const_iterator mine = _variables.find(v->first); 
     130        if (mine != _variables.end()) 
     131            cerr << "WARNING:  " << _path << "Client/Server variable mismatch: " << v->first << endl; 
     132        _variables[v->first] = v->second; 
     133        signal_variable.emit(v->first, v->second); 
     134    } 
     135     
     136    for (Properties::const_iterator v = o->properties().begin(); v != o->properties().end(); ++v) { 
     137        Properties::const_iterator mine = _properties.find(v->first); 
     138        if (mine != _properties.end()) 
     139            cerr << "WARNING:  " << _path << "Client/Server property mismatch: " << v->first << endl; 
     140        _properties[v->first] = v->second; 
     141        signal_variable.emit(v->first, v->second); 
    137142    } 
    138143} 
  • ingen/src/libs/client/PortModel.cpp

    r1389 r1447  
    5252    SharedPtr<PortModel> port = PtrCast<PortModel>(model); 
    5353    if (port) { 
     54        _index = port->_index; 
     55        _type = port->_type; 
     56        _direction = port->_direction; 
    5457        _current_val = port->_current_val; 
     58        _connections = port->_connections; 
    5559        signal_value_changed.emit(_current_val); 
    5660    } 
  • ingen/src/libs/client/PortModel.hpp

    r1418 r1447  
    106106}; 
    107107 
    108 typedef vector<SharedPtr<PortModel> > PortModelList; 
    109  
    110108 
    111109} // namespace Client 
  • ingen/src/libs/client/SigClientInterface.hpp

    r1445 r1447  
    4242public: 
    4343    SigClientInterface() : _enabled(true) {} 
     44     
     45    bool enabled() const { return _enabled; } 
    4446 
    4547    std::string uri() const { return "(internal)"; } 
  • ingen/src/libs/client/ThreadedSigClientInterface.cpp

    r613 r1447  
    1818#include "ThreadedSigClientInterface.hpp" 
    1919#include <iostream> 
    20 using std::cerr; using std::endl; 
     20 
     21using namespace std; 
    2122 
    2223namespace Ingen { 
     
    2930ThreadedSigClientInterface::push_sig(Closure ev) 
    3031{ 
     32    _attached = true; 
    3133    if (!_enabled) 
    3234        return; 
    3335 
    3436    bool success = false; 
    35     bool first   = true; 
    36      
    37     // (Very) slow busy-wait if the queue is full 
    38     // FIXME: Make this wait on a signal from process_sigs iff this happens 
    3937    while (!success) { 
    40         //printf("push %zu\n", _sigs.fill()); 
    4138        success = _sigs.push(ev); 
    4239        if (!success) { 
    43             if (first) { 
    44                 cerr << "[ThreadedSigClientInterface] WARNING:  (Client) event queue full.  Waiting to try again..." << endl; 
    45                 first = false; 
    46             } 
    47             usleep(200000); // 100 milliseconds (2* rate process_sigs is called) 
     40            cerr << "WARNING: Client event queue full.  Waiting..." << endl; 
     41            _mutex.lock(); 
     42            _cond.wait(_mutex); 
     43            _mutex.unlock(); 
     44            cerr << "Queue drained, continuing" << endl; 
    4845        } 
    4946    } 
     
    5956ThreadedSigClientInterface::emit_signals() 
    6057{ 
    61     // Process a maximum of queue-size events, to prevent locking the GTK 
     58    // Process a limited number of events, to prevent locking the GTK 
    6259    // thread indefinitely while processing continually arriving events 
    63     const size_t limit = _sigs.capacity(); 
     60 
    6461    size_t num_processed = 0; 
    65     while (!_sigs.empty() && num_processed++ < limit) { 
    66         //printf("emit %zu\n", _sigs.fill()); 
     62    while (!_sigs.empty() && num_processed++ < (_sigs.capacity() * 3 / 4)) { 
    6763        Closure& ev = _sigs.front(); 
    68         _sigs.pop(); 
    6964        ev(); 
    7065        ev.disconnect(); 
     66        _sigs.pop(); 
    7167    } 
     68 
     69    _mutex.lock(); 
     70    _cond.broadcast(); 
     71    _mutex.unlock(); 
    7272 
    7373    return true; 
  • ingen/src/libs/client/ThreadedSigClientInterface.hpp

    r1443 r1447  
    2222#include <string> 
    2323#include <sigc++/sigc++.h> 
     24#include <glibmm/thread.h> 
    2425#include "interface/ClientInterface.hpp" 
    2526#include "SigClientInterface.hpp" 
     27#include <raul/Atom.hpp> 
    2628#include <raul/SRSWQueue.hpp> 
    27 #include <raul/Atom.hpp> 
     29 
    2830using std::string; 
    2931 
     
    6668    , program_add_slot(signal_program_add.make_slot()) 
    6769    , program_remove_slot(signal_program_remove.make_slot()) 
    68     {} 
     70    { 
     71    } 
    6972 
    7073    virtual std::string uri() const { return "(internal)"; } 
    7174 
    7275    virtual void subscribe(Shared::EngineInterface* engine) { throw; } 
     76 
     77    bool enabled() const { return _attached; } 
    7378 
    7479    void bundle_begin() 
     
    144149    void push_sig(Closure ev); 
    145150     
     151    Glib::Mutex _mutex; 
     152    Glib::Cond  _cond; 
     153 
    146154    Raul::SRSWQueue<Closure> _sigs; 
     155    bool                     _attached; 
    147156 
    148157    sigc::slot<void>                                     bundle_begin_slot;  
  • ingen/src/libs/client/client.cpp

    r613 r1447  
    1616 */ 
    1717 
     18#include <iostream> 
    1819#include "client.hpp" 
    1920#include "OSCEngineSender.hpp" 
     21#include "HTTPEngineSender.hpp" 
     22 
     23using namespace std; 
    2024 
    2125namespace Ingen { 
     
    2428 
    2529SharedPtr<Ingen::Shared::EngineInterface> 
    26 new_osc_interface(const std::string& url) 
     30new_remote_interface(const std::string& url) 
    2731{ 
    28     OSCEngineSender* oes = new OSCEngineSender(url); 
    29     oes->attach(rand(), true); 
    30     return SharedPtr<Shared::EngineInterface>(oes); 
     32    const string scheme = url.substr(0, url.find(":")); 
     33    cout << "SCHEME: " << scheme << endl; 
     34    if (scheme == "osc.udp" || scheme == "osc.tcp") { 
     35        OSCEngineSender* oes = new OSCEngineSender(url); 
     36        oes->attach(rand(), true); 
     37        return SharedPtr<Shared::EngineInterface>(oes); 
     38    } else if (scheme == "http") { 
     39        HTTPEngineSender* hes = new HTTPEngineSender(url); 
     40        hes->attach(rand(), true); 
     41        return SharedPtr<Shared::EngineInterface>(hes); 
     42    } else { 
     43        cerr << "WARNING: Unknown URI scheme '" << scheme << "'" << endl; 
     44        return SharedPtr<Shared::EngineInterface>(); 
     45    } 
    3146} 
     47 
    3248 
    3349} // namespace Client 
  • ingen/src/libs/client/client.hpp

    r613 r1447  
    3131extern "C" { 
    3232 
    33     SharedPtr<Shared::EngineInterface> new_osc_interface(const std::string& url); 
     33    SharedPtr<Shared::EngineInterface> new_remote_interface(const std::string& url); 
    3434    SharedPtr<Shared::EngineInterface> new_queued_interface(SharedPtr<Ingen::Engine> engine); 
    3535 
  • ingen/src/libs/engine/OSCClientSender.hpp

    r1443 r1447  
    4949    { lo_address_free(_address); } 
    5050     
     51    bool enabled() const { return _enabled; } 
     52 
    5153    void enable()  { _enabled = true; } 
    5254    void disable() { _enabled = false; } 
  • ingen/src/libs/engine/OSCEngineReceiver.cpp

    r1441 r1447  
    7171 
    7272    // For debugging, print all incoming OSC messages 
    73     lo_server_add_method(_server, NULL, NULL, generic_cb, NULL); 
     73    //lo_server_add_method(_server, NULL, NULL, generic_cb, NULL); 
    7474 
    7575    // Set response address for this message. 
  • ingen/src/libs/engine/QueuedEngineInterface.hpp

    r1441 r1447  
    6363    virtual ~QueuedEngineInterface() {} 
    6464     
     65    std::string uri() const { return "ingen:internal"; } 
     66     
    6567    void set_next_response_id(int32_t id); 
    6668 
     
    6870    virtual void register_client(ClientInterface* client); 
    6971    virtual void unregister_client(const string& uri); 
    70      
    7172 
    7273    // Engine commands 
  • ingen/src/libs/gui/ConnectWindow.cpp

    r1445 r1447  
    3030#include "engine/QueuedEngineInterface.hpp" 
    3131#include "client/OSCClientReceiver.hpp" 
     32#include "client/HTTPClientReceiver.hpp" 
    3233#include "client/OSCEngineSender.hpp" 
    3334#include "client/ThreadedSigClientInterface.hpp" 
     
    144145ConnectWindow::connect(bool existing) 
    145146{ 
    146     assert(!_attached); 
     147    if (_attached) 
     148        _attached = false; 
     149 
    147150    assert(!App::instance().client()); 
    148151 
     
    154157    if (_mode == CONNECT_REMOTE) { 
    155158        if (!existing) { 
    156             const string url = (_widgets_loaded ? _url_entry->get_text() : "osc.udp://localhost:16180"); 
     159            const string url = (_widgets_loaded ? (string)_url_entry->get_text() : world->engine->uri()); 
    157160            world->engine = SharedPtr<EngineInterface>(new OSCEngineSender(url)); 
    158161        } 
    159  
    160         // FIXME: static args 
     162     
    161163        SharedPtr<ThreadedSigClientInterface> tsci(new ThreadedSigClientInterface(1024)); 
    162         SharedPtr<OSCClientReceiver> client(new OSCClientReceiver(16181, tsci)); 
     164        SharedPtr<Raul::Deletable> client; 
     165         
     166        const string& uri = world->engine->uri(); 
     167        const string& scheme = uri.substr(0, uri.find(":")); 
     168        if (scheme == "osc.udp" || scheme == "osc.tcp") 
     169            client = SharedPtr<OSCClientReceiver>(new OSCClientReceiver(16181, tsci)); // FIXME: port 
     170        else if (scheme == "http") 
     171            client = SharedPtr<HTTPClientReceiver>(new HTTPClientReceiver(world, uri, tsci)); 
     172         
    163173        App::instance().attach(tsci, client); 
    164          
     174 
    165175        Glib::signal_timeout().connect( 
    166176            sigc::mem_fun(App::instance(), &App::gtk_main_iteration), 40, G_PRIORITY_DEFAULT); 
     
    378388 
    379389        App::instance().client()->signal_response_ok.connect( 
    380                 sigc::mem_fun(this, &ConnectWindow::response_ok_received)); 
     390                sigc::mem_fun(this, &ConnectWindow::on_response)); 
    381391         
    382392        _ping_id = abs(rand()) / 2 * 2; // avoid -1 
     
    392402 
    393403    } else if (_connect_stage == 1) { 
    394         if (_attached) { 
     404        if (_attached || App::instance().client()->enabled()) { 
    395405            App::instance().engine()->activate(); 
    396406            ++_connect_stage; 
  • ingen/src/libs/gui/ConnectWindow.hpp

    r1405 r1447  
    5454    void set_connected_to(SharedPtr<Shared::EngineInterface> engine); 
    5555    void start(Ingen::Shared::World* world); 
    56     void response_ok_received(int32_t id) { if (id == _ping_id) _attached = true; } 
     56    void on_response(int32_t id) { _attached = true; } 
    5757 
    5858private: 
  • ingen/src/libs/gui/ControlPanel.cpp

    r1412 r1447  
    7070    } 
    7171 
    72     for (PortModelList::const_iterator i = node->ports().begin(); i != node->ports().end(); ++i) { 
     72    for (NodeModel::Ports::const_iterator i = node->ports().begin(); i != node->ports().end(); ++i) { 
    7373        add_port(*i); 
    7474    } 
  • ingen/src/libs/gui/Makefile.am

    r1399 r1447  
    2424    @REDLANDMM_CFLAGS@ \ 
    2525    @RAUL_CFLAGS@ \ 
    26     @SLV2_CFLAGS@ 
     26    @SLV2_CFLAGS@ \ 
     27    @SOUP_CFLAGS@ 
    2728     
    2829 
     
    4142    @REDLANDMM_LIBS@ \ 
    4243    @RAUL_LIBS@ \ 
    43     @SLV2_LIBS@ 
     44    @SLV2_LIBS@ \ 
     45    @SOUP_LIBS@ 
    4446 
    4547libingen_gui_la_SOURCES = \ 
  • ingen/src/libs/gui/NodeControlWindow.cpp

    r1379 r1447  
    115115NodeControlWindow::on_show() 
    116116{ 
    117     for (PortModelList::const_iterator i = _node->ports().begin(); 
     117    for (NodeModel::Ports::const_iterator i = _node->ports().begin(); 
    118118            i != _node->ports().end(); ++i) 
    119119        if ((*i)->type().is_control() && (*i)->is_input()) 
  • ingen/src/libs/gui/NodeMenu.cpp

    r1378 r1447  
    142142{ 
    143143    const NodeModel* const nm = (NodeModel*)_object.get(); 
    144     for (PortModelList::const_iterator i = nm->ports().begin(); i != nm->ports().end(); ++i) 
     144    for (NodeModel::Ports::const_iterator i = nm->ports().begin(); i != nm->ports().end(); ++i) 
    145145        if ((*i)->is_input() && (*i)->type().is_control()) 
    146146            return true; 
  • ingen/src/libs/gui/NodeModule.cpp

    r1441 r1447  
    9191        ret->set_variable(m->first, m->second); 
    9292 
    93     for (PortModelList::const_iterator p = node->ports().begin(); p != node->ports().end(); ++p) { 
     93    for (NodeModel::Ports::const_iterator p = node->ports().begin(); p != node->ports().end(); ++p) { 
    9494        ret->add_port(*p, false); 
    9595    } 
     
    152152            _gui_widget->show_all(); 
    153153 
    154             for (PortModelList::const_iterator p = _node->ports().begin(); 
     154            for (NodeModel::Ports::const_iterator p = _node->ports().begin(); 
    155155                    p != _node->ports().end(); ++p) 
    156156                if ((*p)->type().is_control() && (*p)->is_output()) 
     
    163163        _plugin_ui.reset(); 
    164164 
    165         for (PortModelList::const_iterator p = _node->ports().begin(); p != _node->ports().end(); ++p) 
     165        for (NodeModel::Ports::const_iterator p = _node->ports().begin(); p != _node->ports().end(); ++p) 
    166166            if ((*p)->type().is_control() && (*p)->is_output()) 
    167167                App::instance().engine()->set_property((*p)->path(), "ingen:broadcast", false); 
     
    263263{ 
    264264    uint32_t index=0; 
    265     for (PortModelList::const_iterator p = _node->ports().begin(); p != _node->ports().end(); ++p) { 
     265    for (NodeModel::Ports::const_iterator p = _node->ports().begin(); p != _node->ports().end(); ++p) { 
    266266        if ((*p)->type().is_control()) 
    267267            value_changed(index, (*p)->value()); 
  • ingen/src/libs/gui/NodePropertiesWindow.cpp

    r840 r1447  
    5454 
    5555    const PluginModel* pm = dynamic_cast<const PluginModel*>(node_model->plugin()); 
    56     assert(pm); 
    57      
    5856    if (pm) { 
    5957        _plugin_type_label->set_text(pm->type_uri()); 
  • ingen/src/libs/gui/PatchCanvas.cpp

    r1438 r1447  
    270270 
    271271    // Create pseudo modules for ports (ports on this canvas, not on our module) 
    272     for (PortModelList::const_iterator i = _patch->ports().begin(); 
     272    for (NodeModel::Ports::const_iterator i = _patch->ports().begin(); 
    273273            i != _patch->ports().end(); ++i) { 
    274274        add_port(*i); 
     
    591591     
    592592    ClashAvoider avoider(*App::instance().store().get(), _patch->path(), clipboard, &clipboard); 
    593     parser->parse_string(App::instance().world(), &avoider, str, "/", 
    594             boost::optional<Glib::ustring>(), (Glib::ustring)_patch->path()); 
     593    parser->parse_string(App::instance().world(), &avoider, str, "/", _patch->path()); 
    595594     
    596595    for (Store::iterator i = clipboard.begin(); i != clipboard.end(); ++i) { 
  • ingen/src/libs/gui/PatchTreeWindow.cpp

    r1410 r1447  
    9090        if (pm->path() == "/") { 
    9191            SharedPtr<OSCEngineSender> osc_sender = PtrCast<OSCEngineSender>(App::instance().engine()); 
    92             string root_name = osc_sender ? osc_sender->engine_url() : "Internal"; 
     92            string root_name = osc_sender ? osc_sender->uri() : "Internal"; 
    9393            // Hack off trailing '/' if it's there (ugly) 
    9494            //if (root_name.substr(root_name.length()-1,1) == "/") 
  • ingen/src/libs/gui/PatchWindow.cpp

    r1418 r1447  
    211211    _menu_view_control_window->property_sensitive() = false; 
    212212 
    213     for (PortModelList::const_iterator p = patch->ports().begin(); 
     213    for (NodeModel::Ports::const_iterator p = patch->ports().begin(); 
    214214            p != patch->ports().end(); ++p) { 
    215215        if ((*p)->type().is_control() && (*p)->is_input()) { 
     
    258258        bool found_control = false; 
    259259 
    260         for (PortModelList::const_iterator i = _patch->ports().begin(); i != _patch->ports().end(); ++i) { 
     260        for (NodeModel::Ports::const_iterator i = _patch->ports().begin(); i != _patch->ports().end(); ++i) { 
    261261            if ((*i)->type().is_control() && (*i)->is_input()) { 
    262262                found_control = true; 
  • ingen/src/libs/serialisation/Parser.cpp

    r1437 r1447  
    6464        const Glib::ustring&                    document_uri, 
    6565        Glib::ustring                           object_uri, 
    66         boost::optional<Glib::ustring>          engine_base, 
     66        Glib::ustring                           engine_base, 
    6767        boost::optional<Raul::Symbol>           symbol, 
    6868        boost::optional<GraphObject::Variables> data) 
     
    7575        cout << "Parsing " << object_uri << " from " << document_uri << endl; 
    7676 
    77     return parse(world, target, model, document_uri, object_uri, engine_base, symbol, data);; 
     77    return parse(world, target, model, document_uri, engine_base, object_uri, symbol, data);; 
    7878} 
    7979 
     
    8585        const Glib::ustring&                    str, 
    8686        const Glib::ustring&                    base_uri, 
     87        Glib::ustring                           engine_base, 
    8788        boost::optional<Glib::ustring>          object_uri, 
    88         boost::optional<Glib::ustring>          engine_base, 
    8989        boost::optional<Raul::Symbol>           symbol, 
    9090        boost::optional<GraphObject::Variables> data) 
     
    9797        cout << "Parsing all objects found in string (base " << base_uri << ")" << endl; 
    9898 
    99     bool ret = parse(world, target, model, base_uri, object_uri, engine_base, symbol, data); 
     99    bool ret = parse(world, target, model, base_uri, engine_base, object_uri, symbol, data); 
    100100    if (ret) { 
    101101        const Glib::ustring subject = Glib::ustring("<") + base_uri + Glib::ustring(">"); 
    102         parse_connections(world, target, model, base_uri, subject, (engine_base ? (string)engine_base.get() : "/")); 
     102        parse_connections(world, target, model, base_uri, subject, 
     103                Path((engine_base == "") ? "/" : engine_base)); 
    103104    } 
    104105 
     
    113114        Redland::Model&                         model, 
    114115        Glib::ustring                           base_uri, 
     116        Glib::ustring                           engine_base, 
    115117        boost::optional<Glib::ustring>          object_uri, 
    116         boost::optional<Glib::ustring>          engine_base, 
    117118        boost::optional<Raul::Symbol>           symbol, 
    118119        boost::optional<GraphObject::Variables> data) 
     
    120121    const Redland::Node::Type res = Redland::Node::RESOURCE; 
    121122    Glib::ustring query_str; 
     123    if (object_uri && object_uri.get()[0] == '/') 
     124        object_uri = object_uri.get().substr(1); 
     125 
    122126    if (object_uri) 
    123127        query_str = Glib::ustring("SELECT DISTINCT ?class WHERE { <") + object_uri.get() + "> a ?class . }"; 
     
    133137    const Redland::Node out_port_class(*world->rdf_world, res, NS_INGEN "OutputPort"); 
    134138     
    135     const Redland::Node subject_uri(*world->rdf_world, res, 
    136             (object_uri ? object_uri.get() : "http://example.org")); 
     139    string subject_str = ((object_uri && object_uri.get() != "") ? object_uri.get() : base_uri); 
     140    if (subject_str[0] == '/') 
     141        subject_str = subject_str.substr(1); 
     142    if (subject_str == "") 
     143        subject_str = base_uri; 
     144     
     145    const Redland::Node subject_uri(*world->rdf_world, res, subject_str); 
    137146 
    138147    bool ret = false; 
     
    142151        const Redland::Node rdf_class = (*i)["class"]; 
    143152        if (!object_uri) { 
    144             std::string path_str = "/" + uri_relative_to_base(base_uri, subject.to_c_string()); 
     153            std::string path_str = uri_relative_to_base(base_uri, subject.to_c_string()); 
     154            if (path_str[0] != '/') 
     155                path_str = string("/").append(path_str); 
    145156            if (Path(path_str).parent() != "/") 
    146157                continue; 
     
    151162            Raul::Path path("/"); 
    152163            if (base_uri != subject.to_c_string()) { 
    153                 string path_str = string("/") + (string)uri_relative_to_base( 
    154                         base_uri, subject.to_c_string()); 
     164                string path_str = (string)uri_relative_to_base(base_uri, subject.to_c_string()); 
     165                if (path_str[0] != '/') 
     166                    path_str = string("/").append(path_str); 
    155167                if (Path::is_valid(path_str)) { 
    156168                    path = path_str; 
    157169                } else { 
    158                     cerr << "[Parser] ERROR: Invalid path " << path << endl; 
     170                    cerr << "[Parser] ERROR: Invalid path '" << path << "'" << endl; 
    159171                    continue; 
    160172                } 
     
    165177 
    166178            if (rdf_class == patch_class) { 
    167                 ret = parse_patch(world, target, model, base_uri, subject.to_c_string(), 
    168                         engine_base.get(), data); 
     179                ret = parse_patch(world, target, model, base_uri, engine_base, 
     180                        subject.to_c_string(), data); 
    169181                if (ret) 
    170182                    target->set_variable(path, "ingen:document", Atom(base_uri.c_str())); 
     
    194206        Redland::Model&                         model, 
    195207        const Glib::ustring&                    base_uri, 
     208        Glib::ustring                           engine_base, 
    196209        const Glib::ustring&                    object_uri, 
    197         Glib::ustring                           engine_base, 
    198210        boost::optional<GraphObject::Variables> data=boost::optional<GraphObject::Variables>()) 
    199211{ 
     
    223235        if (results.size() == 0) { 
    224236            cerr << "[Parser] ERROR: No polyphony found!" << endl; 
     237            cerr << "Query was:" << endl << query.string() << endl; 
    225238            return false; 
    226239        } 
     
    238251    else if (engine_base[engine_base.length()-1] == '/') 
    239252        patch_path = Path(engine_base + symbol); 
     253    else if (Path::is_valid(engine_base)) 
     254        patch_path = (Path)engine_base; 
    240255    else 
    241         patch_path = (Path)engine_base; 
    242  
    243     if (patch_path != "/") 
     256        cerr << "WARNING: Illegal engine base path '" << engine_base << "', loading patch to root" << endl;  
     257 
     258    //if (patch_path != "/") 
    244259        target->new_patch(patch_path, patch_poly); 
    245260 
  • ingen/src/libs/serialisation/Parser.hpp

    r1430 r1447  
    4545            Shared::CommonInterface*                target, 
    4646            const Glib::ustring&                    document_uri, 
     47            Glib::ustring                           engine_base, 
    4748            Glib::ustring                           object_uri, 
    48             boost::optional<Glib::ustring>          engine_base=boost::optional<Glib::ustring>(), 
    4949            boost::optional<Raul::Symbol>           symbol=boost::optional<Raul::Symbol>(), 
    5050            boost::optional<GraphObject::Variables> data=boost::optional<GraphObject::Variables>()); 
     
    5555            const Glib::ustring&                    str, 
    5656            const Glib::ustring&                    base_uri, 
     57            Glib::ustring                           engine_base, 
    5758            boost::optional<Glib::ustring>          object_uri=boost::optional<Glib::ustring>(), 
    58             boost::optional<Glib::ustring>          engine_base=boost::optional<Glib::ustring>(), 
    5959            boost::optional<Raul::Symbol>           symbol=boost::optional<Raul::Symbol>(), 
    6060            boost::optional<GraphObject::Variables> data=boost::optional<GraphObject::Variables>()); 
     
    6969            Redland::Model&                         model, 
    7070            Glib::ustring                           base_uri, 
     71            Glib::ustring                           engine_base, 
    7172            boost::optional<Glib::ustring>          object_uri=boost::optional<Glib::ustring>(), 
    72             boost::optional<Glib::ustring>          engine_base=boost::optional<Glib::ustring>(), 
    7373            boost::optional<Raul::Symbol>           symbol=boost::optional<Raul::Symbol>(), 
    7474            boost::optional<GraphObject::Variables> data=boost::optional<GraphObject::Variables>()); 
     
    7979            Redland::Model&                         model, 
    8080            const Glib::ustring&                    base_uri, 
     81            Glib::ustring                           engine_base, 
    8182            const Glib::ustring&                    object_uri, 
    82             Glib::ustring                           engine_base, 
    8383            boost::optional<GraphObject::Variables> data); 
    8484     
  • ingen/src/libs/shared/OSCSender.cpp

    r1417 r1447  
    9595{ 
    9696    // FIXME: size?  liblo doesn't export this. 
    97     // Don't want to exceed max UDP packet size (1500 bytes?) 
    98     static const size_t MAX_BUNDLE_SIZE = 1500 - 32*5; 
     97    // Don't want to exceed max UDP packet size (good default value?) 
     98    static const size_t MAX_BUNDLE_SIZE = 1024; 
    9999 
    100100    if (!_enabled) 
  • ingen/src/libs/shared/OSCSender.hpp

    r1417 r1447  
    2828public: 
    2929    OSCSender(); 
    30     ~OSCSender(); 
     30    virtual ~OSCSender() {} 
    3131 
    3232    lo_address address() const { return _address; } 
  • ingen/src/progs/ingen/main.cpp

    r1437 r1447  
    134134    } 
    135135                 
    136     /* If we don't have a local engine interface (for GUI), use OSC */ 
     136    /* If we don't have a local engine interface (for GUI), use network */ 
    137137    if (client_module && ! engine_interface) { 
    138         SharedPtr<Shared::EngineInterface> (*new_osc_interface)(const std::string&) = NULL; 
    139  
    140         if (client_module->get_symbol("new_osc_interface", (void*&)new_osc_interface)) { 
    141             engine_interface = new_osc_interface(args.connect_arg); 
    142         } else { 
    143             cerr << "Unable to find symbol 'new_osc_interface' in " 
     138        SharedPtr<Shared::EngineInterface> (*new_remote_interface)(const std::string&) = NULL; 
     139 
     140        if (client_module->get_symbol("new_remote_interface", (void*&)new_remote_interface)) { 
     141            engine_interface = new_remote_interface(args.connect_arg); 
     142        } else { 
     143            cerr << "Unable to find symbol 'new_remote_interface' in " 
    144144                    "ingen_client module, aborting." << endl; 
    145145            return -1; 
     
    158158    if (args.load_given && engine_interface) { 
    159159         
    160         boost::optional<Glib::ustring> engine_base; 
     160        Glib::ustring engine_base = "/"; 
    161161        if (args.path_given) 
    162162            engine_base = string(args.path_arg) + "/"; 
     
    186186 
    187187            engine_interface->load_plugins(); 
    188             parser->parse_document(world, engine_interface.get(), uri, uri, engine_base); 
     188            parser->parse_document(world, engine_interface.get(), uri, engine_base, uri); 
    189189 
    190190        } else { 
Note: See TracChangeset for help on using the changeset viewer.