OSC: Add setup to GUI
[ardour.git] / libs / surfaces / osc / osc.h
1 /*
2  * Copyright (C) 2006-2009 Paul Davis
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */
19
20 #ifndef ardour_osc_h
21 #define ardour_osc_h
22
23 #include <string>
24 #include <vector>
25 #include <bitset>
26
27 #include <sys/time.h>
28 #include <pthread.h>
29
30 #include <boost/shared_ptr.hpp>
31
32 #include <lo/lo.h>
33
34 #include <glibmm/main.h>
35
36 #define ABSTRACT_UI_EXPORTS
37 #include "pbd/abstract_ui.h"
38
39 #include "ardour/types.h"
40 #include "control_protocol/control_protocol.h"
41
42 #include "pbd/i18n.h"
43
44 class OSCControllable;
45 class OSCRouteObserver;
46 class OSCGlobalObserver;
47 class OSCSelectObserver;
48
49 namespace ARDOUR {
50 class Session;
51 class Route;
52 }
53
54 /* this is mostly a placeholder because I suspect that at some
55    point we will want to add more members to accomodate
56    certain types of requests to the OSC UI
57 */
58
59 namespace ArdourSurface {
60
61 struct OSCUIRequest : public BaseUI::BaseRequestObject {
62   public:
63         OSCUIRequest () {}
64         ~OSCUIRequest() {}
65 };
66
67 class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
68 {
69   public:
70         OSC (ARDOUR::Session&, uint32_t port);
71         virtual ~OSC();
72
73         static OSC* instance() { return _instance; }
74
75         XMLNode& get_state ();
76         int set_state (const XMLNode&, int version);
77
78         bool has_editor () const { return true; }
79         void* get_gui () const;
80         void  tear_down_gui ();
81
82         int set_active (bool yn);
83         bool get_active () const;
84         int set_feedback (bool yn);
85         bool get_feedback () const;
86
87
88         int start ();
89         int stop ();
90
91         static void* request_factory (uint32_t);
92
93         enum OSCDebugMode {
94                 Off,
95                 Unhandled,
96                 All
97         };
98
99         typedef std::vector<boost::shared_ptr<ARDOUR::Stripable> > Sorted;
100         Sorted get_sorted_stripables(std::bitset<32> types);
101
102 // keep a surface's global setup by remote server url
103         struct OSCSurface {
104         public:
105                 std::string remote_url;         // the url these setting belong to
106                 uint32_t bank;                          // current bank
107                 uint32_t bank_size;                     // size of banks for this surface
108                 std::bitset<32> strip_types;// what strip types are a part of this bank
109                 uint32_t nstrips;                       // how many strips are there for strip_types
110                 std::bitset<32> feedback;       // What is fed back? strips/meters/timecode/bar_beat/global
111                 int gainmode;                           // what kind of faders do we have Gain db or position 0 to 1?
112                 uint32_t expand;                        // Used by /select/select
113                 bool expand_enable;                     // use expand instead of select
114                 OSCSelectObserver* sel_obs;     // So we can sync select feedback with selected channel
115                 Sorted strips;                          // list of stripables for this surface
116         };
117                 /*
118                  * feedback bits:
119                  * [0] - Strips - buttons
120                  * [1] - Strips - variables (pots/faders)
121                  * [2] - Strips - Send SSID as path extension
122                  * [3] - Send heart beat to surface
123                  * [4] - Send feedback for master/global buttons/variables
124                  * [5] - Send Bar and Beat
125                  * [6] - Send Time code
126                  * [7] - Send metering as dB or positional depending on gainmode
127                  * [8] - Send metering as 16 bits (led strip)
128                  * [9] - Send signal present (signal greater than -20dB)
129                  * [10] - Send Playhead position as samples
130                  * [11] - Send Playhead position as minutes seconds
131                  * [12] - Send Playhead position like primary/secondary GUI clocks
132                  * [13] - Send well known feedback (for /select/command
133                  */
134
135
136 // storage for  each surface's settings
137         typedef std::vector<OSCSurface> Surface;
138         Surface _surface;
139
140         std::string get_server_url ();
141         void set_debug_mode (OSCDebugMode m) { _debugmode = m; }
142         OSCDebugMode get_debug_mode () { return _debugmode; }
143         int get_portmode() { return address_only; }
144         void set_portmode (int pm) { address_only = pm; }
145         int get_banksize () { return default_banksize; }
146         void set_banksize (int bs) {default_banksize = bs; }
147         int get_gainmode() { return default_gainmode; }
148         void set_gainmode (int gm) { default_gainmode = gm; }
149         int get_defaultstrip() { return default_strip; }
150         void set_defaultstrip (int st) { default_strip = st; }
151         int get_defaultfeedback() { return default_feedback; }
152         void set_defaultfeedback (int fb) { default_feedback = fb; }
153         void clear_devices ();
154         std::string get_remote_port () { return remote_port; }
155         void set_remote_port (std::string pt) { remote_port = pt; }
156
157   protected:
158         void thread_init ();
159         void do_request (OSCUIRequest*);
160
161         GSource* local_server;
162         GSource* remote_server;
163
164         bool osc_input_handler (Glib::IOCondition, lo_server);
165
166   private:
167         uint32_t _port;
168         volatile bool _ok;
169         volatile bool _shutdown;
170         lo_server _osc_server;
171         lo_server _osc_unix_server;
172         std::string _osc_unix_socket_path;
173         std::string _osc_url_file;
174         bool _send_route_changes;
175         OSCDebugMode _debugmode;
176         bool address_only;
177         std::string remote_port;
178         uint32_t default_banksize;
179         uint32_t default_strip;
180         uint32_t default_feedback;
181         uint32_t default_gainmode;
182         bool tick;
183         bool bank_dirty;
184         bool global_init;
185         boost::shared_ptr<ARDOUR::Stripable> _select;   // which stripable out of /surface/stripables is gui selected
186
187         void register_callbacks ();
188
189         void route_added (ARDOUR::RouteList&);
190
191         // Handlers for "Application Hook" signals
192         void session_loaded (ARDOUR::Session&);
193         void session_exported (std::string, std::string);
194
195         // end "Application Hook" handles
196
197         std::string get_unix_server_url ();
198         lo_address get_address (lo_message msg);
199         OSCSurface * get_surface (lo_address addr);
200         uint32_t get_sid (boost::shared_ptr<ARDOUR::Stripable> strip, lo_address addr);
201         boost::shared_ptr<ARDOUR::Stripable> get_strip (uint32_t ssid, lo_address addr);
202         void global_feedback (std::bitset<32> feedback, lo_address addr, uint32_t gainmode);
203
204         void send_current_value (const char* path, lo_arg** argv, int argc, lo_message msg);
205         void current_value_query (const char* path, size_t len, lo_arg **argv, int argc, lo_message msg);
206
207         int current_value (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data);
208
209         int catchall (const char *path, const char *types, lo_arg **argv, int argc, void *data);
210         static int _catchall (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data);
211
212         void routes_list (lo_message msg);
213         void transport_frame (lo_message msg);
214         void transport_speed (lo_message msg);
215         void record_enabled (lo_message msg);
216
217 #define OSC_DEBUG \
218         if (_debugmode == All) { \
219                 debugmsg (dgettext(PACKAGE, "OSC"), path, types, argv, argc); \
220         }
221
222 #define PATH_CALLBACK_MSG(name)                                 \
223         static int _ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { \
224                 return static_cast<OSC*>(user_data)->cb_ ## name (path, types, argv, argc, data); \
225         } \
226         int cb_ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data) { \
227                 OSC_DEBUG;              \
228                 if (argc > 0 && !strcmp (types, "f") && argv[0]->f != 1.0) { return 0; } \
229                 name (data);            \
230                 return 0;               \
231         }
232
233         PATH_CALLBACK_MSG(routes_list);
234         PATH_CALLBACK_MSG(transport_frame);
235         PATH_CALLBACK_MSG(transport_speed);
236         PATH_CALLBACK_MSG(record_enabled);
237         PATH_CALLBACK_MSG(refresh_surface);
238         PATH_CALLBACK_MSG(bank_up);
239         PATH_CALLBACK_MSG(bank_down);
240
241 #define PATH_CALLBACK(name) \
242         static int _ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { \
243                 return static_cast<OSC*>(user_data)->cb_ ## name (path, types, argv, argc, data); \
244         } \
245         int cb_ ## name (const char *path, const char *types, lo_arg ** argv, int argc, void *) { \
246                 OSC_DEBUG;              \
247                 if (argc > 0 && !strcmp (types, "f") && argv[0]->f != 1.0) { return 0; } \
248                 name (); \
249                 return 0; \
250         }
251
252         PATH_CALLBACK(add_marker);
253         PATH_CALLBACK(loop_toggle);
254         PATH_CALLBACK(goto_start);
255         PATH_CALLBACK(goto_end);
256         PATH_CALLBACK(rewind);
257         PATH_CALLBACK(ffwd);
258         PATH_CALLBACK(transport_stop);
259         PATH_CALLBACK(transport_play);
260         PATH_CALLBACK(save_state);
261         PATH_CALLBACK(prev_marker);
262         PATH_CALLBACK(next_marker);
263         PATH_CALLBACK(undo);
264         PATH_CALLBACK(redo);
265         PATH_CALLBACK(toggle_punch_in);
266         PATH_CALLBACK(toggle_punch_out);
267         PATH_CALLBACK(rec_enable_toggle);
268         PATH_CALLBACK(toggle_all_rec_enables);
269         PATH_CALLBACK(all_tracks_rec_in);
270         PATH_CALLBACK(all_tracks_rec_out);
271         PATH_CALLBACK(cancel_all_solos);
272         PATH_CALLBACK(remove_marker_at_playhead);
273         PATH_CALLBACK(mark_in);
274         PATH_CALLBACK(mark_out);
275         PATH_CALLBACK(toggle_click);
276         PATH_CALLBACK(midi_panic);
277         PATH_CALLBACK(toggle_roll);
278         PATH_CALLBACK(stop_forget);
279         PATH_CALLBACK(set_punch_range);
280         PATH_CALLBACK(set_loop_range);
281         PATH_CALLBACK(set_session_range);
282         PATH_CALLBACK(toggle_monitor_mute);
283         PATH_CALLBACK(toggle_monitor_dim);
284         PATH_CALLBACK(toggle_monitor_mono);
285         PATH_CALLBACK(quick_snapshot_stay);
286         PATH_CALLBACK(quick_snapshot_switch);
287         PATH_CALLBACK(fit_1_track);
288         PATH_CALLBACK(fit_2_tracks);
289         PATH_CALLBACK(fit_4_tracks);
290         PATH_CALLBACK(fit_8_tracks);
291         PATH_CALLBACK(fit_16_tracks);
292         PATH_CALLBACK(fit_32_tracks);
293         PATH_CALLBACK(fit_all_tracks);
294         PATH_CALLBACK(zoom_100_ms);
295         PATH_CALLBACK(zoom_1_sec);
296         PATH_CALLBACK(zoom_10_sec);
297         PATH_CALLBACK(zoom_1_min);
298         PATH_CALLBACK(zoom_5_min);
299         PATH_CALLBACK(zoom_10_min);
300         PATH_CALLBACK(zoom_to_session);
301         PATH_CALLBACK(temporal_zoom_in);
302         PATH_CALLBACK(temporal_zoom_out);
303         PATH_CALLBACK(scroll_up_1_track);
304         PATH_CALLBACK(scroll_dn_1_track);
305         PATH_CALLBACK(scroll_up_1_page);
306         PATH_CALLBACK(scroll_dn_1_page);
307
308 #define PATH_CALLBACK1(name,type,optional)                                      \
309         static int _ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { \
310                 return static_cast<OSC*>(user_data)->cb_ ## name (path, types, argv, argc, data); \
311         } \
312         int cb_ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *) { \
313                 OSC_DEBUG;              \
314                 if (argc > 0) {                                         \
315                         name (optional argv[0]->type);          \
316                 }                                                       \
317                 return 0;                                               \
318         }
319
320         PATH_CALLBACK1(set_transport_speed,f,);
321         PATH_CALLBACK1(access_action,s,&);
322
323         PATH_CALLBACK1(jump_by_bars,f,);
324         PATH_CALLBACK1(jump_by_seconds,f,);
325         PATH_CALLBACK1(master_set_gain,f,);
326         PATH_CALLBACK1(master_set_fader,f,);
327         PATH_CALLBACK1(master_set_trim,f,);
328         PATH_CALLBACK1(master_set_mute,i,);
329         PATH_CALLBACK1(monitor_set_gain,f,);
330         PATH_CALLBACK1(monitor_set_fader,f,);
331
332 #define PATH_CALLBACK1_MSG(name,arg1type)                       \
333         static int _ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { \
334                 return static_cast<OSC*>(user_data)->cb_ ## name (path, types, argv, argc, data); \
335         } \
336         int cb_ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data) { \
337                 OSC_DEBUG;              \
338                 if (argc > 0) {                                         \
339                         name (argv[0]->arg1type, data); \
340                 }                                                       \
341                 return 0;                                               \
342         }
343
344         // pan position needs message info to send feedback
345         PATH_CALLBACK1_MSG(master_set_pan_stereo_position,f);
346
347         PATH_CALLBACK1_MSG(set_surface_bank_size,i);
348         PATH_CALLBACK1_MSG(set_surface_strip_types,i);
349         PATH_CALLBACK1_MSG(set_surface_feedback,i);
350         PATH_CALLBACK1_MSG(set_surface_gainmode,i);
351         PATH_CALLBACK1_MSG(sel_recenable,i);
352         PATH_CALLBACK1_MSG(sel_recsafe,i);
353         PATH_CALLBACK1_MSG(sel_mute,i);
354         PATH_CALLBACK1_MSG(sel_solo,i);
355         PATH_CALLBACK1_MSG(sel_solo_iso,i);
356         PATH_CALLBACK1_MSG(sel_solo_safe,i);
357         PATH_CALLBACK1_MSG(sel_monitor_input,i);
358         PATH_CALLBACK1_MSG(sel_monitor_disk,i);
359         PATH_CALLBACK1_MSG(sel_phase,i);
360         PATH_CALLBACK1_MSG(sel_gain,f);
361         PATH_CALLBACK1_MSG(sel_fader,f);
362         PATH_CALLBACK1_MSG(sel_trim,f);
363         PATH_CALLBACK1_MSG(sel_pan_position,f);
364         PATH_CALLBACK1_MSG(sel_pan_width,f);
365         PATH_CALLBACK1_MSG(sel_pan_elevation,f);
366         PATH_CALLBACK1_MSG(sel_pan_frontback,f);
367         PATH_CALLBACK1_MSG(sel_pan_lfe,f);
368         PATH_CALLBACK1_MSG(sel_comp_enable,f);
369         PATH_CALLBACK1_MSG(sel_comp_threshold,f);
370         PATH_CALLBACK1_MSG(sel_comp_speed,f);
371         PATH_CALLBACK1_MSG(sel_comp_mode,f);
372         PATH_CALLBACK1_MSG(sel_comp_makeup,f);
373         PATH_CALLBACK1_MSG(sel_eq_enable,f);
374         PATH_CALLBACK1_MSG(sel_eq_hpf,f);
375         PATH_CALLBACK1_MSG(sel_expand,i);
376
377 #define PATH_CALLBACK2(name,arg1type,arg2type)                  \
378         static int _ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { \
379                 return static_cast<OSC*>(user_data)->cb_ ## name (path, types, argv, argc, data); \
380         } \
381         int cb_ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *) { \
382                 OSC_DEBUG;              \
383                 if (argc > 1) {                                         \
384                         name (argv[0]->arg1type, argv[1]->arg2type); \
385                 }                                                       \
386                 return 0;                                               \
387         }
388
389 #define PATH_CALLBACK2_MSG(name,arg1type,arg2type)                      \
390         static int _ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { \
391                 return static_cast<OSC*>(user_data)->cb_ ## name (path, types, argv, argc, data); \
392         } \
393         int cb_ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data) { \
394                 OSC_DEBUG;              \
395                 if (argc > 1) {                                         \
396                         name (argv[0]->arg1type, argv[1]->arg2type, data); \
397                 }                                                       \
398                 return 0;                                               \
399         }
400
401 #define PATH_CALLBACK3(name,arg1type,arg2type,arg3type)                \
402         static int _ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { \
403                return static_cast<OSC*>(user_data)->cb_ ## name (path, types, argv, argc, data); \
404         } \
405         int cb_ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data) { \
406                 OSC_DEBUG;              \
407                 if (argc > 1) {                                                \
408                  name (argv[0]->arg1type, argv[1]->arg2type,argv[2]->arg3type, data); \
409                 }                                                      \
410                return 0;                                               \
411        }
412
413 #define PATH_CALLBACK4(name,arg1type,arg2type,arg3type,arg4type)               \
414         static int _ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { \
415                return static_cast<OSC*>(user_data)->cb_ ## name (path, types, argv, argc, data); \
416         } \
417         int cb_ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data) { \
418                 OSC_DEBUG;              \
419                 if (argc > 1) {                                                \
420                  name (argv[0]->arg1type, argv[1]->arg2type,argv[2]->arg3type,argv[3]->arg4type, data); \
421                 }                                                      \
422                return 0;                                               \
423        }
424
425         PATH_CALLBACK2_MSG(sel_sendgain,i,f);
426         PATH_CALLBACK2_MSG(sel_sendfader,i,f);
427         PATH_CALLBACK2_MSG(sel_sendenable,i,f);
428         PATH_CALLBACK2_MSG(sel_eq_gain,i,f);
429         PATH_CALLBACK2_MSG(sel_eq_freq,i,f);
430         PATH_CALLBACK2_MSG(sel_eq_q,i,f);
431         PATH_CALLBACK2_MSG(sel_eq_shape,i,f);
432
433         PATH_CALLBACK4(set_surface,i,i,i,i);
434         PATH_CALLBACK2(locate,i,i);
435         PATH_CALLBACK2(loop_location,i,i);
436         PATH_CALLBACK2_MSG(route_mute,i,i);
437         PATH_CALLBACK2_MSG(route_solo,i,i);
438         PATH_CALLBACK2_MSG(route_solo_iso,i,i);
439         PATH_CALLBACK2_MSG(route_solo_safe,i,i);
440         PATH_CALLBACK2_MSG(route_recenable,i,i);
441         PATH_CALLBACK2_MSG(route_recsafe,i,i);
442         PATH_CALLBACK2_MSG(route_monitor_input,i,i);
443         PATH_CALLBACK2_MSG(route_monitor_disk,i,i);
444         PATH_CALLBACK2_MSG(strip_phase,i,i);
445         PATH_CALLBACK2_MSG(strip_expand,i,i);
446         PATH_CALLBACK2_MSG(strip_gui_select,i,i);
447         PATH_CALLBACK2_MSG(route_set_gain_dB,i,f);
448         PATH_CALLBACK2_MSG(route_set_gain_fader,i,f);
449         PATH_CALLBACK2_MSG(route_set_trim_dB,i,f);
450         PATH_CALLBACK2_MSG(route_set_pan_stereo_position,i,f);
451         PATH_CALLBACK2_MSG(route_set_pan_stereo_width,i,f);
452         PATH_CALLBACK3(route_set_send_gain_dB,i,i,f);
453         PATH_CALLBACK3(route_set_send_fader,i,i,f);
454         PATH_CALLBACK3(route_set_send_enable,i,i,f);
455         PATH_CALLBACK4(route_plugin_parameter,i,i,i,f);
456         PATH_CALLBACK3(route_plugin_parameter_print,i,i,i);
457
458         int route_mute (int rid, int yn, lo_message msg);
459         int route_solo (int rid, int yn, lo_message msg);
460         int route_solo_iso (int rid, int yn, lo_message msg);
461         int route_solo_safe (int rid, int yn, lo_message msg);
462         int route_recenable (int rid, int yn, lo_message msg);
463         int route_recsafe (int ssid, int yn, lo_message msg);
464         int route_monitor_input (int rid, int yn, lo_message msg);
465         int route_monitor_disk (int rid, int yn, lo_message msg);
466         int strip_phase (int rid, int yn, lo_message msg);
467         int strip_expand (int rid, int yn, lo_message msg);
468         int _strip_select (boost::shared_ptr<ARDOUR::Stripable> s, lo_address addr);
469         int strip_gui_select (int rid, int yn, lo_message msg);
470         int route_set_gain_abs (int rid, float level, lo_message msg);
471         int route_set_gain_dB (int rid, float dB, lo_message msg);
472         int route_set_gain_fader (int rid, float pos, lo_message msg);
473         int route_set_trim_abs (int rid, float level, lo_message msg);
474         int route_set_trim_dB (int rid, float dB, lo_message msg);
475         int route_set_pan_stereo_position (int rid, float left_right_fraction, lo_message msg);
476         int route_set_pan_stereo_width (int rid, float percent, lo_message msg);
477         int route_set_send_gain_dB (int rid, int sid, float val, lo_message msg);
478         int route_set_send_fader (int rid, int sid, float val, lo_message msg);
479         int route_set_send_enable (int rid, int sid, float val, lo_message msg);
480         int route_plugin_parameter (int rid, int piid,int par, float val, lo_message msg);
481         int route_plugin_parameter_print (int rid, int piid,int par, lo_message msg);
482
483         //banking functions
484         int set_bank (uint32_t bank_start, lo_message msg);
485         int _set_bank (uint32_t bank_start, lo_address addr);
486         int bank_up (lo_message msg);
487         int bank_down (lo_message msg);
488         int set_surface (uint32_t b_size, uint32_t strips, uint32_t fb, uint32_t gmode, lo_message msg);
489         int set_surface_bank_size (uint32_t bs, lo_message msg);
490         int set_surface_strip_types (uint32_t st, lo_message msg);
491         int set_surface_feedback (uint32_t fb, lo_message msg);
492         int set_surface_gainmode (uint32_t gm, lo_message msg);
493         int refresh_surface (lo_message msg);
494
495         int master_set_gain (float dB);
496         int master_set_fader (float position);
497         int master_set_trim (float dB);
498         int master_set_pan_stereo_position (float position, lo_message msg);
499         int master_set_mute (uint32_t state);
500         int monitor_set_gain (float dB);
501         int monitor_set_fader (float position);
502         int sel_recenable (uint32_t state, lo_message msg);
503         int sel_recsafe (uint32_t state, lo_message msg);
504         int sel_mute (uint32_t state, lo_message msg);
505         int sel_solo (uint32_t state, lo_message msg);
506         int sel_solo_iso (uint32_t state, lo_message msg);
507         int sel_solo_safe (uint32_t state, lo_message msg);
508         int sel_monitor_input (uint32_t state, lo_message msg);
509         int sel_monitor_disk (uint32_t state, lo_message msg);
510         int sel_phase (uint32_t state, lo_message msg);
511         int sel_gain (float state, lo_message msg);
512         int sel_fader (float state, lo_message msg);
513         int sel_trim (float val, lo_message msg);
514         int sel_pan_position (float val, lo_message msg);
515         int sel_pan_width (float val, lo_message msg);
516         int sel_sendgain (int id, float dB, lo_message msg);
517         int sel_sendfader (int id, float pos, lo_message msg);
518         int sel_sendenable (int id, float pos, lo_message msg);
519         int sel_expand (uint32_t state, lo_message msg);
520         int sel_pan_elevation (float val, lo_message msg);
521         int sel_pan_frontback (float val, lo_message msg);
522         int sel_pan_lfe (float val, lo_message msg);
523         int sel_comp_enable (float val, lo_message msg);
524         int sel_comp_threshold (float val, lo_message msg);
525         int sel_comp_speed (float val, lo_message msg);
526         int sel_comp_mode (float val, lo_message msg);
527         int sel_comp_makeup (float val, lo_message msg);
528         int sel_eq_enable (float val, lo_message msg);
529         int sel_eq_hpf (float val, lo_message msg);
530         int sel_eq_gain (int id, float val, lo_message msg);
531         int sel_eq_freq (int id, float val, lo_message msg);
532         int sel_eq_q (int id, float val, lo_message msg);
533         int sel_eq_shape (int id, float val, lo_message msg);
534
535         void listen_to_route (boost::shared_ptr<ARDOUR::Stripable>, lo_address);
536         void end_listen (boost::shared_ptr<ARDOUR::Stripable>, lo_address);
537         void drop_route (boost::weak_ptr<ARDOUR::Stripable>);
538         void route_lost (boost::weak_ptr<ARDOUR::Stripable>);
539         void gui_selection_changed (void);
540
541         void route_name_changed (const PBD::PropertyChange&, boost::weak_ptr<ARDOUR::Route> r, lo_address addr);
542         void recalcbanks ();
543         void _recalcbanks ();
544         void notify_routes_added (ARDOUR::RouteList &);
545         void notify_vca_added (ARDOUR::VCAList &);
546
547         void update_clock ();
548         int cancel_all_solos ();
549         bool periodic (void);
550         sigc::connection periodic_connection;
551         PBD::ScopedConnectionList session_connections;
552
553         int route_send_fail (std::string path, uint32_t ssid, float val, lo_address addr);
554         int sel_send_fail (std::string path, uint32_t id, float val, lo_address addr);
555         int sel_fail (std::string path, float val, lo_address addr);
556
557         typedef std::list<OSCRouteObserver*> RouteObservers;
558
559         RouteObservers route_observers;
560
561         typedef std::list<OSCGlobalObserver*> GlobalObservers;
562         GlobalObservers global_observers;
563
564         void debugmsg (const char *prefix, const char *path, const char* types, lo_arg **argv, int argc);
565
566         static OSC* _instance;
567
568         mutable void *gui;
569         void build_gui ();
570 };
571
572 } // namespace
573
574 #endif // ardour_osc_h