From d049b582e1db60ee0f6fd02a40202145488c7288 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 2 Feb 2013 02:16:23 +0000 Subject: Add option to enable/disable canvas animation (fix/avoid #879). git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5016 a436a847-0d15-0410-975c-d299462d15a1 --- src/Configuration.cpp | 6 +- src/World.cpp | 5 +- src/client/ClientStore.cpp | 5 + src/gui/GraphBox.cpp | 12 + src/gui/GraphBox.hpp | 2 + src/gui/PropertiesWindow.cpp | 3 +- src/gui/ingen_gui.ui | 2500 ++++++++++++++++++----------------- src/server/Broadcaster.cpp | 18 + src/server/Broadcaster.hpp | 21 +- src/server/Context.cpp | 6 + src/server/Context.hpp | 8 + src/server/DuplexPort.cpp | 5 +- src/server/InputPort.cpp | 12 +- src/server/OutputPort.cpp | 5 +- src/server/PortImpl.cpp | 37 +- src/server/PortImpl.hpp | 18 +- src/server/events/Delta.cpp | 12 +- src/server/internals/Controller.cpp | 2 +- src/server/internals/Trigger.cpp | 2 +- 19 files changed, 1429 insertions(+), 1250 deletions(-) diff --git a/src/Configuration.cpp b/src/Configuration.cpp index 2776d560..25f3355c 100644 --- a/src/Configuration.cpp +++ b/src/Configuration.cpp @@ -38,9 +38,9 @@ Configuration::Configuration(Forge& forge) , _desc( "Ingen is a flexible modular system that be used in various ways.\n" "The engine can run as a stand-alone server controlled via network protocol,\n" -"or internal to another process (e.g. the GUI). The GUI, or other\n" -"clients, can communicate with the engine via any supported protocol, or host the\n" -"engine in the same process. Many clients can connect to an engine at once.\n\n" +"or internal to another process (e.g. the GUI). The GUI, or other clients,\n" +"can communicate with the engine via any supported protocol, or run in the\n" +"same process. Many clients can connect to an engine at once.\n\n" "Examples:\n" " ingen -e # Run an engine, listen for connections\n" " ingen -g # Run a GUI, connect to running engine\n" diff --git a/src/World.cpp b/src/World.cpp index 218da83c..27e056b6 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -40,7 +40,10 @@ class EngineBase; class Interface; class Store; -namespace Serialisation { class Parser; class Serialiser; } +namespace Serialisation { +class Parser; +class Serialiser; +} /** Load a dynamic module from the default path. * diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index 8c48ab72..4e4dd7d8 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -323,6 +323,11 @@ ClientStore::delta(const Raul::URI& uri, std::cerr << "}" << endl; #endif + if (uri == Raul::URI("ingen:/clients/this")) { + // Client property, which we don't store (yet?) + return; + } + if (!Node::uri_is_path(uri)) { _log.error(Raul::fmt("Delta for unknown subject <%1%>\n") % uri.c_str()); diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp index 84116196..c280ba64 100644 --- a/src/gui/GraphBox.cpp +++ b/src/gui/GraphBox.cpp @@ -87,6 +87,7 @@ GraphBox::GraphBox(BaseObjectType* cobject, xml->get_widget("graph_view_engine_window_menuitem", _menu_view_engine_window); xml->get_widget("graph_properties_menuitem", _menu_view_graph_properties); xml->get_widget("graph_fullscreen_menuitem", _menu_fullscreen); + xml->get_widget("graph_animate_canvas_menuitem", _menu_animate_canvas); xml->get_widget("graph_human_names_menuitem", _menu_human_names); xml->get_widget("graph_show_port_names_menuitem", _menu_show_port_names); xml->get_widget("graph_zoom_in_menuitem", _menu_zoom_in); @@ -124,6 +125,8 @@ GraphBox::GraphBox(BaseObjectType* cobject, sigc::mem_fun(this, &GraphBox::event_quit)); _menu_fullscreen->signal_activate().connect( sigc::mem_fun(this, &GraphBox::event_fullscreen_toggled)); + _menu_animate_canvas->signal_activate().connect( + sigc::mem_fun(this, &GraphBox::event_animate_canvas_toggled)); _menu_human_names->signal_activate().connect( sigc::mem_fun(this, &GraphBox::event_human_names_toggled)); _menu_show_doc_pane->signal_activate().connect( @@ -692,6 +695,15 @@ GraphBox::event_status_bar_toggled() _status_bar->hide(); } +void +GraphBox::event_animate_canvas_toggled() +{ + _app->interface()->set_property( + Raul::URI("ingen:/clients/this"), + _app->uris().ingen_broadcast, + _app->forge().make((bool)_menu_animate_canvas->get_active())); +} + void GraphBox::event_human_names_toggled() { diff --git a/src/gui/GraphBox.hpp b/src/gui/GraphBox.hpp index 663a3c14..0b44ba99 100644 --- a/src/gui/GraphBox.hpp +++ b/src/gui/GraphBox.hpp @@ -114,6 +114,7 @@ private: void event_fullscreen_toggled(); void event_doc_pane_toggled(); void event_status_bar_toggled(); + void event_animate_canvas_toggled(); void event_human_names_toggled(); void event_port_names_toggled(); void event_zoom_in(); @@ -144,6 +145,7 @@ private: Gtk::MenuItem* _menu_select_all; Gtk::MenuItem* _menu_close; Gtk::MenuItem* _menu_quit; + Gtk::CheckMenuItem* _menu_animate_canvas; Gtk::CheckMenuItem* _menu_human_names; Gtk::CheckMenuItem* _menu_show_port_names; Gtk::CheckMenuItem* _menu_show_doc_pane; diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp index 0f21a4fb..50fb0903 100644 --- a/src/gui/PropertiesWindow.cpp +++ b/src/gui/PropertiesWindow.cpp @@ -301,7 +301,8 @@ PropertiesWindow::on_show() } void -PropertiesWindow::property_changed(const Raul::URI& predicate, const Raul::Atom& value) +PropertiesWindow::property_changed(const Raul::URI& predicate, + const Raul::Atom& value) { Records::iterator r = _records.find(predicate); if (r == _records.end()) { diff --git a/src/gui/ingen_gui.ui b/src/gui/ingen_gui.ui index 8d999d57..5fb523bf 100644 --- a/src/gui/ingen_gui.ui +++ b/src/gui/ingen_gui.ui @@ -1,6 +1,7 @@ + False True @@ -25,10 +26,10 @@ Contributors: Thorsten Wilms True - + False - + False @@ -46,9 +47,9 @@ Contributors: False + False True False - False _Edit True True @@ -63,9 +64,9 @@ Contributors: _Input + False True False - False True False @@ -73,9 +74,9 @@ Contributors: False + False True False - False _Audio True @@ -83,9 +84,9 @@ Contributors: + False True False - False C_V True @@ -93,9 +94,9 @@ Contributors: + False True False - False _Control True @@ -103,9 +104,9 @@ Contributors: + False True False - False _Event True @@ -118,9 +119,9 @@ Contributors: _Output + False True False - False True False @@ -128,9 +129,9 @@ Contributors: False + False True False - False _Audio True @@ -138,9 +139,9 @@ Contributors: + False True False - False C_V True @@ -148,9 +149,9 @@ Contributors: + False True False - False _Control True @@ -158,9 +159,9 @@ Contributors: + False True False - False _Event True @@ -173,9 +174,9 @@ Contributors: _Find Plugin... + False True False - False True False @@ -184,9 +185,9 @@ Contributors: _Load Graph... + False True False - False True False @@ -195,9 +196,9 @@ Contributors: _New Graph... + False True False - False True False @@ -212,9 +213,9 @@ Contributors: P_roperties... + False True False - False True False @@ -245,18 +246,22 @@ Contributors: GTK_FILL - + True True + False + False + True + True 1 2 - + @@ -272,7 +277,7 @@ Contributors: 1 2 GTK_FILL - + @@ -285,7 +290,7 @@ Contributors: 1 2 GTK_FILL - + @@ -304,10 +309,10 @@ Contributors: gtk-save + False True True False - False True @@ -319,10 +324,10 @@ Contributors: gtk-cancel + False True True False - False True @@ -334,10 +339,10 @@ Contributors: gtk-ok + False True True False - False True @@ -363,23 +368,23 @@ Contributors: False dialog - + True False 6 - + True False end gtk-quit + False True True True False - False True @@ -391,12 +396,12 @@ Contributors: gtk-disconnect + False True False True True False - False True @@ -408,12 +413,12 @@ Contributors: gtk-connect + False True True True True False - False True @@ -525,6 +530,10 @@ Contributors: True False True + False + False + True + True 1 True @@ -555,6 +564,10 @@ Contributors: True 28 unix:///tmp/ingen.sock + False + False + True + True True @@ -574,25 +587,25 @@ Contributors: _Connect to running server at: + False True True False - False True True GTK_FILL - + _Launch and connect to server on port: + False True True False - False True True connect_server_radiobutton @@ -601,17 +614,17 @@ Contributors: 1 2 GTK_FILL - + Use _internal engine + False True False True False - False True True connect_server_radiobutton @@ -620,7 +633,7 @@ Contributors: 2 3 GTK_FILL - + @@ -635,7 +648,7 @@ Contributors: 2 3 GTK_FILL - + @@ -665,10 +678,10 @@ Contributors: D_eactivate + False True True True - False True @@ -680,10 +693,10 @@ Contributors: _Activate + False True True True - False True @@ -715,501 +728,836 @@ Contributors: connect_connect_button - + + 320 + 340 False - Load Graph - Ingen - center-on-parent - dialog - - - False - 24 - - + 8 + Graphs - Ingen + + + True + True + 3 + in + + True - False - end - - - gtk-cancel - True - True - True - False - False - True - - - False - False - 0 - - - - - gtk-open - True - True - True - True - False - False - True - - - False - False - 1 - - + True + True - - False - True - end - 0 - + + + + + False + Ingen + 776 + 480 + + + True + False - + True False - 0 - 0 - + + False True False - 3 - 3 - 12 - 12 - - - True - False - 0 - Polyphony: - True - - - 1 - 2 - GTK_FILL - - - - - - Load from _File - True - True - False - True - False - True - True - load_graph_poly_voices_radio - - - 2 - 3 - 1 - 2 - GTK_FILL - - - - - - True - False - 0 - Ports: - True - - - 2 - 3 - GTK_FILL - - - - - _Insert new ports - True - True - False - True - False - True - True - load_graph_merge_ports_radio - - - 2 - 3 - 2 - 3 - GTK_FILL - - - - - _Merge with existing ports - True - True - False - True - False - True - True - True - - - 1 - 2 - 2 - 3 - GTK_FILL - - - - - True + _File + True + + False - 6 - - _Voices: - True - True - False - True + + _Import... False + True + False True - True - True + False + + - - False - False - 0 - - + True - True - - 1 + False + + + + + gtk-save + False + True + False + True + True + + + + + + + Save _As... + False + True + False + True + False + + + + + + + _Draw... + False + True + False + True + False + + + + + + + True + False + + + + + gtk-close + False + True + False + True + True + + + + + + True + False + + + + + gtk-quit + False + True + False + True + True + - - False - True - 1 - - - 1 - 2 - 1 - 2 - GTK_FILL - GTK_FILL - - - - - True - False - 0 - _Symbol: - True - True - load_graph_symbol_entry - - - GTK_FILL - - - - - - True - True - - True - - - 1 - 3 - GTK_FILL - - - - False - False - 2 - - - - - - load_graph_cancel_button - load_graph_ok_button - - - - False - 8 - Load Plugin - Ingen - center-on-parent - True - dialog - - - True - False - 1 - - - True - True - 2 - - - True - True - 2 - True - True - - - - - True - True - 0 - - - - - True - False - 3 - 3 - 12 - + + False True False - 1 - Node _Symbol: - True + _Edit True - load_plugin_name_entry - - - 2 - 3 - GTK_FILL - - - - - - True - False - - - 1 - 2 - 1 - 2 - GTK_FILL - GTK_FILL - - - - - True - False - - - 1 - 2 - GTK_FILL - GTK_FILL - - - - - True - False - - - 2 - 3 - 1 - 2 - GTK_FILL - GTK_FILL - - - - - True - False - - - True - True - - - True - True - 0 - - - - - _Polyphonic - True - True - False - False - True - True - True - - - False - False - 8 - 1 - + + + False + + + True + False + + + + + gtk-cut + False + True + False + False + True + True + + + + + + gtk-copy + False + True + False + True + True + + + + + + + gtk-paste + False + True + False + False + True + True + + + + + + + gtk-delete + False + True + False + True + True + + + + + + + gtk-select-all + False + True + False + True + True + + + + + + + True + False + + + + + Arrange + False + True + False + True + False + + + + + + True + False + + + + + C_ontrols... + False + True + False + True + False + + + + + + + gtk-properties + False + True + False + True + True + + + + + + + + + + + False + True + False + _View + True + + + False + + + False + True + False + Update control ports as values change. + _Animate Canvas + True + + + + + + False + True + False + + + + + False + True + False + _Human names + True + True + + + + + + False + True + False + Port _Names + True + True + + + + + + False + True + False + _Documentation Pane + True + + + + + + False + True + False + _Status Bar + True + True + + + + + + True + False + + + + + gtk-zoom-in + False + True + False + True + True + + + + + + gtk-zoom-out + False + True + False + True + True + + + + + + gtk-zoom-100 + False + True + False + True + True + + + + + + True + False + + + + + gtk-fullscreen + False + True + False + True + True + + + + + + + + + + + False + True + False + _Windows + True + + + + False + + + _Engine + False + True + False + True + False + + + + + + + _Graph Tree + False + True + False + True + False + + + + + + + _Messages + False + True + False + True + False + + + + + + + + + + + False + True + False + _Help + True + + + + False + + + Right-click the canvas to add objects + False + True + False + True + False + + + + + True + False + + + + + gtk-about + False + True + False + True + True + + + + + + + + + + False + False + 0 + + + + + True + False + + + True + False + + - 1 - 2 - 2 - 3 - GTK_FILL - 6 + True + False - + + False + in + + + + + + False + True + + + + + True + True + 1 + + + + + True + False + 2 + + + False + True + 2 + + + + + + + False + Load Graph - Ingen + center-on-parent + dialog + + + False + 24 + + + True + False + end + + + gtk-cancel + False True True - True - gtk-clear + True + False + True - 1 - 3 - GTK_FILL + False + False + 0 - + + gtk-open + False True - False + True + True + True + False + True - GTK_FILL - + False + False + 1 + + + False + True + end + 0 + + + + + True + False + 0 + 0 - + True False - 4 + 3 + 3 + 12 + 12 + + + True + False + 0 + Polyphony: + True + + + 1 + 2 + GTK_FILL + + + + + + Load from _File + False + True + True + False + True + True + True + load_graph_poly_voices_radio + + + 2 + 3 + 1 + 2 + GTK_FILL + + + + + + True + False + 0 + Ports: + True + + + 2 + 3 + GTK_FILL + + + + + _Insert new ports + False + True + True + False + True + True + True + load_graph_merge_ports_radio + + + 2 + 3 + 2 + 3 + GTK_FILL + + + + + _Merge with existing ports + False + True + True + False + True + True + True + True + + + 1 + 2 + 2 + 3 + GTK_FILL + + + + + True + False + 6 + + + _Voices: + False + True + True + False + True + True + True + True + + + False + False + 0 + + + + + True + True + + False + False + True + True + 1 + + + False + True + 1 + + + + + 1 + 2 + 1 + 2 + GTK_FILL + GTK_FILL + + - - gtk-close + True - True - True - False - True + False + 0 + _Symbol: + True + True + load_graph_symbol_entry - False - False - 0 + GTK_FILL + - - gtk-add + True True - True - False - True + + True + False + False + True + True - False - False - 1 + 1 + 3 + GTK_FILL - - 2 - 3 - 2 - 3 - GTK_FILL - GTK_FILL - False False - 1 + 2 + + load_graph_cancel_button + load_graph_ok_button + - - 400 - 180 + False 8 - Messages - Ingen + Load Plugin - Ingen + center-on-parent + True + dialog - + True False - 6 + 1 - + True True - in + 2 - + True True - 5 - 5 - False - word - 5 - 5 - False - False + 2 + True + True @@ -1220,873 +1568,579 @@ Contributors: - + True False - 6 - end - - - gtk-clear - True - False - True - True - False - False - True - - - False - False - 0 - - + 3 + 3 + 12 - - gtk-close + True - True - False - False - True + False + 1 + Node _Symbol: + True + True + load_plugin_name_entry - False - False - 1 + 2 + 3 + GTK_FILL + - - - False - True - 1 - - - - - - - 320 - False - 8 - Create Subgraph - Ingen - False - center-on-parent - dialog - - - True - False - - - True - False - 2 - 2 - + True False - 0 - _Symbol: - True - new_subgraph_name_entry + 1 + 2 + 1 + 2 GTK_FILL - GTK_EXPAND - 5 + GTK_FILL - + True False - 0 - _Polyphony: - True - new_subgraph_polyphony_spinbutton 1 2 GTK_FILL - GTK_EXPAND - 5 + GTK_FILL - + True - True - - True - 1 + False - 1 - 2 + 2 + 3 1 2 GTK_FILL - - 4 + GTK_FILL - + True - True - - True + False + + + True + True + False + False + True + True + + + True + True + 0 + + + + + _Polyphonic + False + True + True + False + True + True + True + + + False + False + 8 + 1 + + - 1 - 2 - - 4 - - - - - True - True - 0 - - - - - True - False - True - - - False - False - 1 - - - - - True - False - 4 - end + 1 + 2 + 2 + 3 + GTK_FILL + 6 + + - - gtk-cancel + True True - True - False - True + True + gtk-clear + False + False + True + True - False - False - 0 + 1 + 3 + GTK_FILL - - gtk-ok + True - True - True - True - True - False - True + False - False - False - 1 + GTK_FILL + + + + + + True + False + 4 + + + gtk-close + False + True + True + True + True + + + False + False + 0 + + + + + gtk-add + False + True + True + True + True + + + False + False + 1 + + + + + 2 + 3 + 2 + 3 + GTK_FILL + GTK_FILL - True - True - 2 + False + False + 1 - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - P_olyphonic - True - - - - - True - False - False - _Learn - True - - - - - True - False - False - _Unlearn - True - - - - - Dis_connect - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - True - False - - - - - _Rename... - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - True - False - - - - - gtk-delete - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - True - True - - - - - gtk-properties - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - True - True - - - - - Show GUI... - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - False - - - - - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - Embed GUI - - - - - Randomize - False - False - False - - - - - False - False - Set Minimum - - - - - False - False - Set Maximum - - - - - False - False - Reset Range - - - - - False - False - _Expose - True - - - - - 320 - 340 + + 400 + 180 False 8 - Graphs - Ingen + Messages - Ingen - + True - True - 3 - in + False + 6 - + True True - True + in + + + True + True + 5 + 5 + False + word + 5 + 5 + False + False + + + + True + True + 0 + - - - - - False - Ingen - 776 - 480 - - - True - False - + True False + 6 + end - - True - False + + gtk-clear False - _File - True - - - False - - - _Import... - True - False - False - True - False - - - - - - - True - False - - - - - gtk-save - True - False - False - True - True - - - - - - - Save _As... - True - False - False - True - False - - - - - - - _Draw... - True - False - False - True - False - - - - - - - True - False - - - - - gtk-close - True - False - False - True - True - - - - - - True - False - - - - - gtk-quit - True - False - False - True - True - - - - - + True + False + True + True + False + True + + False + False + 0 + - - True - False + + gtk-close False - _Edit - True - - - False - - - True - False - - - - - gtk-cut - True - False - False - False - True - True - - - - - - gtk-copy - True - False - False - True - True - - - - - - - gtk-paste - True - False - False - False - True - True - - - - - - - gtk-delete - True - False - False - True - True - - - - - - - gtk-select-all - True - False - False - True - True - - - - - - - True - False - - - - - Arrange - True - False - False - True - False - - - - - - True - False - - - - - C_ontrols... - True - False - False - True - False - - - - - - - gtk-properties - True - False - False - True - True - - - - - - + True + True + False + True + + False + False + 1 + + + + False + True + 1 + + + + + + + 320 + False + 8 + Create Subgraph - Ingen + False + center-on-parent + dialog + + + True + False + + + True + False + 2 + 2 - + True False - False - _View + 0 + _Symbol: True - - - False - - - True - False - False - _Human names - True - True - - - - - - True - False - False - Port _Names - True - True - - - - - - True - False - False - _Documentation Pane - True - False - - - - - - True - False - False - _Status Bar - True - True - - - - - - True - False - - - - - gtk-zoom-in - True - False - False - True - True - - - - - - gtk-zoom-out - True - False - False - True - True - - - - - - gtk-zoom-100 - True - False - False - True - True - - - - - - True - False - - - - - gtk-fullscreen - True - False - False - True - True - - - - - - + new_subgraph_name_entry + + GTK_FILL + GTK_EXPAND + 5 + - + True False - False - _Windows + 0 + _Polyphony: True - - - - False - - - _Engine - True - False - False - True - False - - - - - - - _Graph Tree - True - False - False - True - False - - - - - - - _Messages - True - False - False - True - False - - - - - - + new_subgraph_polyphony_spinbutton + + 1 + 2 + GTK_FILL + GTK_EXPAND + 5 + - + True - False - False - _Help - True - - - - False - - - Right-click the canvas to add objects - True - False - False - True - False - - - - - True - False - - - - - gtk-about - True - False - False - True - True - - - - - + True + + True + False + False + True + True + 1 + + + 1 + 2 + 1 + 2 + GTK_FILL + + 4 + + + + + True + True + + True + False + False + True + True + + 1 + 2 + + 4 + + + True + True + 0 + + + + + True + False + True + False False - 0 + 1 - + True False + 4 + end - + + gtk-cancel + False True - False - - - + True + True + True - True - False + False + False + 0 - - False - in - - - + + gtk-ok + False + True + True + True + True + True + True - False - True + False + False + 1 True True - 1 - - - - - True - False - 2 - - - False - True 2 + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + False + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + P_olyphonic + True + + + + + False + True + False + _Learn + True + + + + + False + True + False + _Unlearn + True + + + + + Dis_connect + False + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + False + + + + + _Rename... + False + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + False + + + + + gtk-delete + False + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + True + + + + + gtk-properties + False + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + True + + + + + Show GUI... + False + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + + + False + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Embed GUI + + + + + Randomize + False + False + False + + + + + False + False + Set Minimum + + + + + False + False + Set Maximum + + + + + False + False + Reset Range + + + + + False + False + _Expose + True + + + False gtk-properties + False True False - False True True @@ -2112,11 +2166,11 @@ Contributors: gtk-cancel + False True True True False - False True @@ -2128,12 +2182,12 @@ Contributors: gtk-ok + False True True True True False - False True @@ -2162,6 +2216,10 @@ Contributors: True True + False + False + True + True 1 5 True @@ -2169,13 +2227,17 @@ Contributors: 1 2 - + True True + False + False + True + True 1 5 True @@ -2185,7 +2247,7 @@ Contributors: 2 1 2 - + @@ -2197,7 +2259,7 @@ Contributors: GTK_FILL - + @@ -2211,7 +2273,7 @@ Contributors: 1 2 GTK_FILL - + @@ -2261,6 +2323,15 @@ Contributors: + + + + + + + + + @@ -2330,11 +2401,11 @@ Contributors: gtk-cancel + False True True True True - False True @@ -2346,10 +2417,10 @@ Contributors: gtk-apply + False True True True - False True @@ -2361,12 +2432,12 @@ Contributors: gtk-ok + False True True True True True - False True @@ -2423,6 +2494,10 @@ Contributors: True True + False + False + True + True 1 @@ -2452,6 +2527,10 @@ Contributors: True True + False + False + True + True 1 @@ -2486,11 +2565,11 @@ Contributors: gtk-cancel + False True True True True - False True @@ -2502,12 +2581,12 @@ Contributors: gtk-ok + False True True True True False - False True @@ -2586,10 +2665,10 @@ Contributors: + False True True False - False True @@ -2667,9 +2746,9 @@ Contributors: 1 + False True False - False @@ -2694,9 +2773,9 @@ Contributors: 1 + False True False - False True gtk-execute True @@ -2708,9 +2787,9 @@ Contributors: + False True False - False True @@ -2726,13 +2805,17 @@ Contributors: + False True False - False True True + False + False + True + True 1 True @@ -2753,9 +2836,9 @@ Contributors: + False True False - False gtk-save @@ -2774,9 +2857,9 @@ Contributors: + False True False - False gtk-refresh @@ -2786,9 +2869,9 @@ Contributors: + False True False - False True gtk-zoom-100 @@ -2799,9 +2882,9 @@ Contributors: + False True False - False True gtk-zoom-fit @@ -2827,6 +2910,7 @@ Contributors: True + False True True GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_MOTION_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK | GDK_BUTTON3_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK | GDK_VISIBILITY_NOTIFY_MASK | GDK_PROXIMITY_IN_MASK | GDK_PROXIMITY_OUT_MASK | GDK_SUBSTRUCTURE_MASK | GDK_SCROLL_MASK @@ -2915,6 +2999,10 @@ Contributors: True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 12 + False + False + True + True 4 True @@ -2984,6 +3072,10 @@ Contributors: True False + False + False + True + True True diff --git a/src/server/Broadcaster.cpp b/src/server/Broadcaster.cpp index f3bc96f7..8e53164f 100644 --- a/src/server/Broadcaster.cpp +++ b/src/server/Broadcaster.cpp @@ -26,10 +26,16 @@ namespace Ingen { namespace Server { +Broadcaster::Broadcaster() + : _must_broadcast(false) + , _bundle_depth(0) +{} + Broadcaster::~Broadcaster() { Glib::Mutex::Lock lock(_clients_mutex); _clients.clear(); + _broadcastees.clear(); } /** Register a client to receive messages over the notification band. @@ -51,9 +57,21 @@ Broadcaster::unregister_client(const Raul::URI& uri) { Glib::Mutex::Lock lock(_clients_mutex); const size_t erased = _clients.erase(uri); + _broadcastees.erase(uri); return (erased > 0); } +void +Broadcaster::set_broadcast(const Raul::URI& client, bool broadcast) +{ + if (broadcast) { + _broadcastees.insert(client); + } else { + _broadcastees.erase(client); + } + _must_broadcast.store(!_broadcastees.empty()); +} + /** Looks up the client with the given source @a uri (which is used as the * unique identifier for registered clients). */ diff --git a/src/server/Broadcaster.hpp b/src/server/Broadcaster.hpp index 3162742b..5de5ec8f 100644 --- a/src/server/Broadcaster.hpp +++ b/src/server/Broadcaster.hpp @@ -17,8 +17,10 @@ #ifndef INGEN_ENGINE_CLIENTBROADCASTER_HPP #define INGEN_ENGINE_CLIENTBROADCASTER_HPP +#include #include #include +#include #include #include @@ -41,12 +43,21 @@ namespace Server { class Broadcaster : public Interface { public: - Broadcaster() : _bundle_depth(0) {} + Broadcaster(); ~Broadcaster(); void register_client(const Raul::URI& uri, SPtr client); bool unregister_client(const Raul::URI& uri); + void set_broadcast(const Raul::URI& client, bool broadcast); + + /** Return true iff there are any clients with broadcasting enabled. + * + * This is used in the audio thread to decide whether or not notifications + * should be calculated and emitted. + */ + bool must_broadcast() const { return _must_broadcast; } + /** A handle that represents a transfer of possibly several changes. * * This object going out of scope signifies the transfer is completed. @@ -135,9 +146,11 @@ private: typedef std::map< Raul::URI, SPtr > Clients; - Glib::Mutex _clients_mutex; - Clients _clients; - unsigned _bundle_depth; + Glib::Mutex _clients_mutex; + Clients _clients; + std::set _broadcastees; + std::atomic _must_broadcast; + unsigned _bundle_depth; }; } // namespace Server diff --git a/src/server/Context.cpp b/src/server/Context.cpp index 1be69fe4..2ac2ddc2 100644 --- a/src/server/Context.cpp +++ b/src/server/Context.cpp @@ -54,6 +54,12 @@ Context::Context(Engine& engine, ID id) , _realtime(true) {} +bool +Context::must_notify(const PortImpl* port) const +{ + return port->is_monitored() || _engine.broadcaster()->must_broadcast(); +} + bool Context::notify(LV2_URID key, FrameTime time, diff --git a/src/server/Context.hpp b/src/server/Context.hpp index 028ee126..ea3593b8 100644 --- a/src/server/Context.hpp +++ b/src/server/Context.hpp @@ -53,6 +53,14 @@ public: virtual ~Context() {} + /** Return true iff the given port should broadcast its value. + * + * Whether or not broadcasting is actually done is a per-client property, + * this is for use in the audio thread to quickly determine if the + * necessary calculations need to be done at all. + */ + bool must_notify(const PortImpl* port) const; + /** Send a notification from this run context. * @return false on failure (ring is full) */ diff --git a/src/server/DuplexPort.cpp b/src/server/DuplexPort.cpp index 34c9b590..65152d02 100644 --- a/src/server/DuplexPort.cpp +++ b/src/server/DuplexPort.cpp @@ -100,9 +100,8 @@ DuplexPort::post_process(Context& context) perspective. Mix down input delivered by plugins so output (external perspective) is ready. */ InputPort::pre_process(context); - - if (_broadcast) - broadcast_value(context, false); + } else { + monitor(context); } } diff --git a/src/server/InputPort.cpp b/src/server/InputPort.cpp index 9002dbab..0d1a2d0e 100644 --- a/src/server/InputPort.cpp +++ b/src/server/InputPort.cpp @@ -124,9 +124,6 @@ void InputPort::add_arc(ProcessContext& context, ArcImpl* c) { _arcs.push_front(*c); - if (_type != PortType::CV) { - _broadcast = true; // Broadcast value/activity of connected input - } } /** Remove a arc. Realtime safe. @@ -151,10 +148,6 @@ InputPort::remove_arc(ProcessContext& context, const OutputPort* tail) return NULL; } - if (_arcs.empty()) { - _broadcast = false; // Turn off broadcasting if no longer connected - } - return arc; } @@ -220,8 +213,9 @@ InputPort::pre_process(Context& context) } } - if (_broadcast) - broadcast_value(context, false); + if (!_arcs.empty()) { + monitor(context); + } } void diff --git a/src/server/OutputPort.cpp b/src/server/OutputPort.cpp index 6b7329e5..492e5419 100644 --- a/src/server/OutputPort.cpp +++ b/src/server/OutputPort.cpp @@ -42,8 +42,6 @@ OutputPort::OutputPort(BufferFactory& bufs, add_property(bufs.uris().rdf_type, bufs.uris().lv2_OutputPort); } - _broadcast = true; - setup_buffers(bufs, poly, false); } @@ -73,8 +71,7 @@ OutputPort::post_process(Context& context) update_set_state(context, v); } - if (_broadcast) - broadcast_value(context, false); + monitor(context); } } // namespace Server diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp index ed7a7084..352c8b23 100644 --- a/src/server/PortImpl.cpp +++ b/src/server/PortImpl.cpp @@ -51,12 +51,12 @@ PortImpl::PortImpl(BufferFactory& bufs, , _value(value) , _min(bufs.forge().make(0.0f)) , _max(bufs.forge().make(1.0f)) - , _last_broadcasted_value(value) + , _last_monitor_value(value) , _set_states(new Raul::Array(static_cast(poly))) , _prepared_set_states(NULL) , _buffers(new Raul::Array(static_cast(poly))) , _prepared_buffers(NULL) - , _broadcast(false) + , _monitored(false) , _set_by_user(false) , _is_morph(false) , _is_auto_morph(false) @@ -338,8 +338,12 @@ PortImpl::clear_buffers() } void -PortImpl::broadcast_value(Context& context, bool force) +PortImpl::monitor(Context& context) { + if (!context.must_notify(this)) { + return; + } + Forge& forge = context.engine().world()->forge(); URIs& uris = context.engine().world()->uris(); LV2_URID key = 0; @@ -359,23 +363,34 @@ PortImpl::broadcast_value(Context& context, bool force) case PortType::ATOM: if (_buffer_type == _bufs.uris().atom_Sequence) { LV2_Atom_Sequence* seq = (LV2_Atom_Sequence*)buffer(0)->atom(); - // TODO: Filter events, or only send one activity for blinkenlights - LV2_ATOM_SEQUENCE_FOREACH(seq, ev) { + if (_monitored) { + // Monitoring explictly enabled, send everything + LV2_ATOM_SEQUENCE_FOREACH(seq, ev) { + context.notify(uris.ingen_activity, + context.start() + ev->time.frames, + this, + ev->body.size, + ev->body.type, + LV2_ATOM_BODY(&ev->body)); + } + } else if (seq->atom.size > sizeof(LV2_Atom_Sequence_Body)) { + // Just sending for blinkenlights, send one + const int32_t one = 1; context.notify(uris.ingen_activity, - context.start() + ev->time.frames, + context.start(), this, - ev->body.size, - ev->body.type, - LV2_ATOM_BODY(&ev->body)); + sizeof(int32_t), + (LV2_URID)uris.atom_Bool, + &one); } } break; } - if (val.is_valid() && (force || val != _last_broadcasted_value)) { + if (val.is_valid() && val != _last_monitor_value) { if (context.notify(key, context.start(), this, val.size(), val.type(), val.get_body())) { - _last_broadcasted_value = val; + _last_monitor_value = val; } /* On failure, last_broadcasted_value remains unaffected, so we'll try diff --git a/src/server/PortImpl.hpp b/src/server/PortImpl.hpp index 4aed4458..45918964 100644 --- a/src/server/PortImpl.hpp +++ b/src/server/PortImpl.hpp @@ -145,10 +145,18 @@ public: void set_buffer_size(Context& context, BufferFactory& bufs, size_t size); - void broadcast(bool b) { _broadcast = b; } - bool broadcast() { return _broadcast; } + /** Return true iff this port is explicitly monitored. + * + * This is used for plugin UIs which require monitoring for particular + * ports, even if the Ingen client has not requested broadcasting in + * general (e.g. for canvas animation). + */ + bool is_monitored() const { return _monitored; } + + /** Explicitly turn on monitoring for this port. */ + void enable_monitoring(bool monitored) { _monitored = monitored; } - void broadcast_value(Context& context, bool force=false); + void monitor(Context& context); void raise_set_by_user_flag() { _set_by_user = true; } @@ -199,12 +207,12 @@ protected: Raul::Atom _value; Raul::Atom _min; Raul::Atom _max; - Raul::Atom _last_broadcasted_value; + Raul::Atom _last_monitor_value; Raul::Array* _set_states; Raul::Array* _prepared_set_states; Raul::Array* _buffers; Raul::Array* _prepared_buffers; - bool _broadcast; + bool _monitored; bool _set_by_user; bool _is_morph; bool _is_auto_morph; diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp index 9287f9e5..2b851b16 100644 --- a/src/server/events/Delta.cpp +++ b/src/server/events/Delta.cpp @@ -104,6 +104,7 @@ Delta::pre_process() typedef Properties::const_iterator iterator; const bool is_graph_object = Node::uri_is_path(_subject); + const bool is_client = (_subject == "ingen:/clients/this"); // Take a writer lock while we modify the store Glib::RWLock::WriterLock lock(_engine.store()->lock()); @@ -112,7 +113,7 @@ Delta::pre_process() ? static_cast(_engine.store()->get(Node::uri_to_path(_subject))) : static_cast(_engine.block_factory()->plugin(_subject)); - if (!_object && (!is_graph_object || !_create)) { + if (!_object && !is_client && (!is_graph_object || !_create)) { return Event::pre_process_done(Status::NOT_FOUND, _subject); } @@ -155,7 +156,9 @@ Delta::pre_process() if (port) _old_bindings = _engine.control_bindings()->remove(port); } - _object->remove_property(key, value); + if (_object) { + _object->remove_property(key, value); + } } for (const auto& p : _properties) { @@ -243,6 +246,9 @@ Delta::pre_process() _status = Status::BAD_OBJECT_TYPE; } } + } else if (is_client && key == uris.ingen_broadcast) { + _engine.broadcaster()->set_broadcast( + _request_client->uri(), value.get_bool()); } if (_status != Status::NOT_PREPARED) { @@ -287,7 +293,7 @@ Delta::execute(ProcessContext& context) switch (*t) { case SpecialType::ENABLE_BROADCAST: if (port) { - port->broadcast(value.get_bool()); + port->enable_monitoring(value.get_bool()); } break; case SpecialType::ENABLE: diff --git a/src/server/internals/Controller.cpp b/src/server/internals/Controller.cpp index e65319a0..cad0aac4 100644 --- a/src/server/internals/Controller.cpp +++ b/src/server/internals/Controller.cpp @@ -118,7 +118,7 @@ ControllerNode::control(ProcessContext& context, uint8_t control_num, uint8_t va // FIXME: not thread safe _param_port->set_value(context.engine().world()->forge().make(control_num)); _param_port->set_control_value(context, time, control_num); - _param_port->broadcast_value(context, true); + _param_port->monitor(context); _learning = false; } diff --git a/src/server/internals/Trigger.cpp b/src/server/internals/Trigger.cpp index 41e1800f..c1c00b6b 100644 --- a/src/server/internals/Trigger.cpp +++ b/src/server/internals/Trigger.cpp @@ -133,7 +133,7 @@ TriggerNode::note_on(ProcessContext& context, uint8_t note_num, uint8_t velocity // FIXME: not thread safe _note_port->set_value(context.engine().world()->forge().make((float)note_num)); _note_port->set_control_value(context, time, (float)note_num); - _note_port->broadcast_value(context, true); + _note_port->monitor(context); _learning = false; } -- cgit v1.2.1