summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2008-04-17 05:58:43 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2008-04-17 05:58:43 +0000
commit803b502bf176c417a70498a98173fb09691a80b7 (patch)
tree0678e953e5739758b86988c4340cbc3406927a7c
parent9aeccd52c83bf020df490f64e8716ff8ddd2ee76 (diff)
AccessAction() OSC patch from Ryan Scott
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3258 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/editor.cc19
-rw-r--r--gtk2_ardour/editor.h1
-rw-r--r--libs/ardour/ardour/osc.h21
-rw-r--r--libs/ardour/ardour/session.h1
-rw-r--r--libs/ardour/osc.cc20
-rw-r--r--libs/ardour/session.cc2
-rw-r--r--libs/ardour/session_export.cc2
-rw-r--r--libs/surfaces/control_protocol/basic_ui.cc13
-rw-r--r--libs/surfaces/control_protocol/control_protocol/basic_ui.h2
9 files changed, 74 insertions, 7 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index c8f7e3e5ba..27a4c8ff7d 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -80,6 +80,7 @@
#include "gui_thread.h"
#include "sfdb_ui.h"
#include "rhythm_ferret.h"
+#include "actions.h"
#ifdef FFT_ANALYSIS
#include "analysis_window.h"
@@ -791,6 +792,7 @@ Editor::Editor ()
ControlProtocol::ZoomIn.connect (bind (mem_fun (*this, &Editor::temporal_zoom_step), false));
ControlProtocol::ZoomOut.connect (bind (mem_fun (*this, &Editor::temporal_zoom_step), true));
ControlProtocol::ScrollTimeline.connect (mem_fun (*this, &Editor::control_scroll));
+ BasicUI::AccessAction.connect (mem_fun (*this, &Editor::access_action));
Config->ParameterChanged.connect (mem_fun (*this, &Editor::parameter_changed));
Route::SyncOrderKeys.connect (mem_fun (*this, &Editor::sync_order_keys));
@@ -1022,6 +1024,23 @@ Editor::deferred_control_scroll (nframes_t target)
}
void
+Editor::access_action (std::string action_group, std::string action_item)
+{
+ if (!session) {
+ return;
+ }
+
+ cout<< "OSC: Recieved: "<< action_item << endl;
+
+ RefPtr<Action> act;
+ act = ActionManager::get_action( action_group.c_str(), action_item.c_str() );
+
+ if( act )
+ act->activate();
+
+}
+
+void
Editor::on_realize ()
{
Window::on_realize ();
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index ae3b7decdb..ed5f7a38b0 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -772,6 +772,7 @@ class Editor : public PublicEditor
Gtk::HBox edit_controls_hbox;
void control_scroll (float);
+ void access_action (std::string,std::string);
bool deferred_control_scroll (nframes_t);
sigc::connection control_scroll_connection;
diff --git a/libs/ardour/ardour/osc.h b/libs/ardour/ardour/osc.h
index 3f1ce03445..d7c2f4bd85 100644
--- a/libs/ardour/ardour/osc.h
+++ b/libs/ardour/ardour/osc.h
@@ -54,12 +54,13 @@ class OSC : public BasicUI, public sigc::trackable
lo_server _osc_server;
lo_server _osc_unix_server;
std::string _osc_unix_socket_path;
- std::string _osc_url_file;
+ std::string _osc_url_file;
pthread_t _osc_thread;
int _request_pipe[2];
static void * _osc_receiver(void * arg);
void osc_receiver();
+ void send(); // This should accept an OSC payload
bool init_osc_thread ();
void terminate_osc_thread ();
@@ -69,6 +70,11 @@ class OSC : public BasicUI, public sigc::trackable
void session_going_away ();
+ // Handlers for "Application Hook" signals
+ void session_loaded( ARDOUR::Session& );
+ void session_exported( std::string, std::string );
+ // end "Application Hook" handles
+
std::string get_server_url ();
std::string get_unix_server_url ();
@@ -101,18 +107,19 @@ class OSC : public BasicUI, public sigc::trackable
PATH_CALLBACK(rec_enable_toggle);
PATH_CALLBACK(toggle_all_rec_enables);
-#define PATH_CALLBACK1(name,type) \
+#define PATH_CALLBACK1(name,type,optional) \
static int _ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { \
return static_cast<OSC*>(user_data)->cb_ ## name (path, types, argv, argc, data); \
} \
int cb_ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data) { \
- if (argc > 0) { \
- name (argv[0]->type); \
- }\
- return 0; \
+ if (argc > 0) { \
+ name (optional argv[0]->type); \
+ } \
+ return 0; \
}
- PATH_CALLBACK1(set_transport_speed,f);
+ PATH_CALLBACK1(set_transport_speed,f,);
+ PATH_CALLBACK1(access_action,s,&);
};
}
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index ea9ab014a8..ea89ab84ec 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -603,6 +603,7 @@ class Session : public PBD::StatefulDestructible
int start_audio_export (ARDOUR::AudioExportSpecification&);
int stop_audio_export (ARDOUR::AudioExportSpecification&);
void finalize_audio_export ();
+ static sigc::signal<void, std::string, std::string> Exported;
void add_source (boost::shared_ptr<Source>);
void remove_source (boost::weak_ptr<Source>);
diff --git a/libs/ardour/osc.cc b/libs/ardour/osc.cc
index e2ad9a2951..ea3c2f4d4c 100644
--- a/libs/ardour/osc.cc
+++ b/libs/ardour/osc.cc
@@ -176,6 +176,7 @@ OSC::register_callbacks()
#define REGISTER_CALLBACK(serv,path,types, function) lo_server_add_method (serv, path, types, OSC::_ ## function, this)
REGISTER_CALLBACK (serv, "/ardour/add_marker", "", add_marker);
+ REGISTER_CALLBACK (serv, "/ardour/access_action", "s", access_action);
REGISTER_CALLBACK (serv, "/ardour/loop_toggle", "", loop_toggle);
REGISTER_CALLBACK (serv, "/ardour/goto_start", "", goto_start);
REGISTER_CALLBACK (serv, "/ardour/goto_end", "", goto_end);
@@ -401,6 +402,10 @@ OSC::set_session (Session& s)
{
session = &s;
session->GoingAway.connect (mem_fun (*this, &OSC::session_going_away));
+
+ // "Application Hooks"
+ session_loaded( s );
+ session->Exported.connect( mem_fun( *this, &OSC::session_exported ) );
}
void
@@ -409,6 +414,21 @@ OSC::session_going_away ()
session = 0;
}
+// "Application Hook" Handlers //
+void
+OSC::session_loaded( Session& s ) {
+ lo_address listener = lo_address_new( NULL, "7770" );
+ lo_send( listener, "/session/loaded", "ss", s.path().c_str(), s.name().c_str() );
+}
+
+void
+OSC::session_exported( std::string path, std::string name ) {
+ lo_address listener = lo_address_new( NULL, "7770" );
+ lo_send( listener, "/session/exported", "ss", path.c_str(), name.c_str() );
+}
+
+// end "Application Hook" Handlers //
+
/* path callbacks */
int
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 56291e941e..5b8d2f8506 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -118,6 +118,8 @@ sigc::signal<void> Session::AutoBindingOn;
sigc::signal<void> Session::AutoBindingOff;
+sigc::signal<void, std::string, std::string> Session::Exported;
+
int
Session::find_session (string str, string& path, string& snapshot, bool& isnew)
{
diff --git a/libs/ardour/session_export.cc b/libs/ardour/session_export.cc
index e7a3b3b40f..33c9e0062d 100644
--- a/libs/ardour/session_export.cc
+++ b/libs/ardour/session_export.cc
@@ -454,6 +454,8 @@ Session::stop_audio_export (AudioExportSpecification& spec)
spec.freewheel_connection.disconnect ();
spec.clear (); /* resets running/stop etc */
+ Exported( spec.path, name() );
+
return 0;
}
diff --git a/libs/surfaces/control_protocol/basic_ui.cc b/libs/surfaces/control_protocol/basic_ui.cc
index 2f5a4efada..7c032524f9 100644
--- a/libs/surfaces/control_protocol/basic_ui.cc
+++ b/libs/surfaces/control_protocol/basic_ui.cc
@@ -29,6 +29,8 @@
using namespace ARDOUR;
+sigc::signal<void,std::string,std::string> BasicUI::AccessAction;
+
BasicUI::BasicUI (Session& s)
: session (&s)
{
@@ -50,6 +52,17 @@ BasicUI::register_thread (std::string name)
PBD::ThreadCreated (pthread_self(), name);
}
+
+void
+BasicUI::access_action ( std::string action_path )
+{
+ int split_at = action_path.find( "/" );
+ std::string group = action_path.substr( 0, split_at );
+ std::string item = action_path.substr( split_at + 1 );
+
+ AccessAction( group, item );
+}
+
void
BasicUI::loop_toggle ()
{
diff --git a/libs/surfaces/control_protocol/control_protocol/basic_ui.h b/libs/surfaces/control_protocol/control_protocol/basic_ui.h
index 7bc6b25c32..c8b5a2a0b6 100644
--- a/libs/surfaces/control_protocol/control_protocol/basic_ui.h
+++ b/libs/surfaces/control_protocol/control_protocol/basic_ui.h
@@ -42,6 +42,8 @@ class BasicUI {
/* transport control */
void loop_toggle ();
+ void access_action ( std::string action_path );
+ static sigc::signal<void,std::string,std::string> AccessAction;
void goto_start ();
void goto_end ();
void rewind ();