OSC: Add /strip/fader/touch
[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 "ardour/send.h"
41 #include "control_protocol/control_protocol.h"
42
43 #include "pbd/i18n.h"
44
45 class OSCControllable;
46 class OSCRouteObserver;
47 class OSCGlobalObserver;
48 class OSCSelectObserver;
49 class OSCCueObserver;
50
51 namespace ARDOUR {
52 class Session;
53 class Route;
54 }
55
56 /* this is mostly a placeholder because I suspect that at some
57    point we will want to add more members to accomodate
58    certain types of requests to the OSC UI
59 */
60
61 namespace ArdourSurface {
62
63 struct OSCUIRequest : public BaseUI::BaseRequestObject {
64   public:
65         OSCUIRequest () {}
66         ~OSCUIRequest() {}
67 };
68
69 class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
70 {
71   public:
72         OSC (ARDOUR::Session&, uint32_t port);
73         virtual ~OSC();
74
75         static OSC* instance() { return _instance; }
76
77         XMLNode& get_state ();
78         int set_state (const XMLNode&, int version);
79
80         void stripable_selection_changed () {}
81
82         bool has_editor () const { return true; }
83         void* get_gui () const;
84         void  tear_down_gui ();
85
86         int set_active (bool yn);
87         bool get_active () const;
88
89         int start ();
90         int stop ();
91
92         static void* request_factory (uint32_t);
93
94         enum OSCDebugMode {
95                 Off,
96                 Unhandled,
97                 All
98         };
99
100         enum JogMode {
101                 JOG,
102                 NUDGE,
103                 SCRUB,
104                 SHUTTLE,
105                 MARKER,
106                 SCROLL,
107                 TRACK,
108                 BANK
109         };
110
111         typedef std::vector<boost::shared_ptr<ARDOUR::Stripable> > Sorted;
112         Sorted get_sorted_stripables(std::bitset<32> types, bool cue);
113
114 // keep a surface's global setup by remote server url
115         struct OSCSurface {
116         public:
117                 std::string remote_url;         // the url these setting belong to
118                 bool no_clear;                          // don't send osc clear messages on strip change
119                 JogMode jogmode;                        // current jogmode
120                 uint32_t bank;                          // current bank
121                 uint32_t bank_size;                     // size of banks for this surface
122                 std::bitset<32> strip_types;// what strip types are a part of this bank
123                 uint32_t nstrips;                       // how many strips are there for strip_types
124                 std::bitset<32> feedback;       // What is fed back? strips/meters/timecode/bar_beat/global
125                 int gainmode;                           // what kind of faders do we have Gain db or position 0 to 1?
126                 uint32_t expand;                        // Used by /select/select
127                 bool expand_enable;                     // use expand instead of select
128                 OSCSelectObserver* sel_obs;     // So we can sync select feedback with selected channel
129                 Sorted strips;                          // list of stripables for this surface
130                 bool cue;                                       // is this a cue surface
131                 uint32_t aux;                           // aux index for this cue surface
132                 Sorted sends;                           // list of sends for cue aux
133         };
134                 /*
135                  * feedback bits:
136                  * [0] - Strips - buttons
137                  * [1] - Strips - variables (pots/faders)
138                  * [2] - Strips - Send SSID as path extension
139                  * [3] - Send heart beat to surface
140                  * [4] - Send feedback for master/global buttons/variables
141                  * [5] - Send Bar and Beat
142                  * [6] - Send Time code
143                  * [7] - Send metering as dB or positional depending on gainmode
144                  * [8] - Send metering as 16 bits (led strip)
145                  * [9] - Send signal present (signal greater than -20dB)
146                  * [10] - Send Playhead position as samples
147                  * [11] - Send Playhead position as minutes seconds
148                  * [12] - Send Playhead position like primary/secondary GUI clocks
149                  * [13] - Send well known feedback (for /select/command
150                  */
151
152
153 // storage for  each surface's settings
154         typedef std::vector<OSCSurface> Surface;
155         Surface _surface;
156
157         std::string get_server_url ();
158         void set_debug_mode (OSCDebugMode m) { _debugmode = m; }
159         OSCDebugMode get_debug_mode () { return _debugmode; }
160         int get_portmode() { return address_only; }
161         void set_portmode (int pm) { address_only = pm; }
162         int get_banksize () { return default_banksize; }
163         void set_banksize (int bs) {default_banksize = bs; }
164         int get_gainmode() { return default_gainmode; }
165         void set_gainmode (int gm) { default_gainmode = gm; }
166         int get_defaultstrip() { return default_strip; }
167         void set_defaultstrip (int st) { default_strip = st; }
168         int get_defaultfeedback() { return default_feedback; }
169         void set_defaultfeedback (int fb) { default_feedback = fb; }
170         void clear_devices ();
171         void gui_changed ();
172         std::string get_remote_port () { return remote_port; }
173         void set_remote_port (std::string pt) { remote_port = pt; }
174
175   protected:
176         void thread_init ();
177         void do_request (OSCUIRequest*);
178
179         GSource* local_server;
180         GSource* remote_server;
181
182         bool osc_input_handler (Glib::IOCondition, lo_server);
183
184   private:
185         uint32_t _port;
186         volatile bool _ok;
187         volatile bool _shutdown;
188         lo_server _osc_server;
189         lo_server _osc_unix_server;
190         std::string _osc_unix_socket_path;
191         std::string _osc_url_file;
192         OSCDebugMode _debugmode;
193         bool address_only;
194         std::string remote_port;
195         uint32_t default_banksize;
196         uint32_t default_strip;
197         uint32_t default_feedback;
198         uint32_t default_gainmode;
199         bool tick;
200         bool bank_dirty;
201         float scrub_speed;              // Current scrub speed
202         double scrub_place;             // place of play head at latest jog/scrub wheel tick
203         int64_t scrub_time;             // when did the wheel move last?
204         bool global_init;
205         boost::shared_ptr<ARDOUR::Stripable> _select;   // which stripable out of /surface/stripables is gui selected
206
207         void register_callbacks ();
208
209         void route_added (ARDOUR::RouteList&);
210
211         // Handlers for "Application Hook" signals
212         void session_loaded (ARDOUR::Session&);
213         void session_exported (std::string, std::string);
214
215         // end "Application Hook" handles
216
217         std::string get_unix_server_url ();
218         lo_address get_address (lo_message msg);
219         OSCSurface * get_surface (lo_address addr);
220         int check_surface (lo_message msg);
221         uint32_t get_sid (boost::shared_ptr<ARDOUR::Stripable> strip, lo_address addr);
222         boost::shared_ptr<ARDOUR::Stripable> get_strip (uint32_t ssid, lo_address addr);
223         void global_feedback (std::bitset<32> feedback, lo_address addr, uint32_t gainmode);
224
225         void send_current_value (const char* path, lo_arg** argv, int argc, lo_message msg);
226         void current_value_query (const char* path, size_t len, lo_arg **argv, int argc, lo_message msg);
227
228         int current_value (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data);
229
230         int catchall (const char *path, const char *types, lo_arg **argv, int argc, void *data);
231         static int _catchall (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data);
232
233         int set_automation (const char *path, lo_arg **argv, int argc, lo_message msg);
234         int touch_detect (const char *path, lo_arg **argv, int argc, lo_message msg);
235
236         int route_get_sends (lo_message msg);
237         int route_get_receives(lo_message msg);
238         void routes_list (lo_message msg);
239         void transport_frame (lo_message msg);
240         void transport_speed (lo_message msg);
241         void record_enabled (lo_message msg);
242
243         // cue
244         Sorted cue_get_sorted_stripables(boost::shared_ptr<ARDOUR::Stripable> aux, uint32_t id, lo_message msg);
245         int cue_parse (const char *path, const char* types, lo_arg **argv, int argc, lo_message msg);
246         int cue_set (uint32_t aux, lo_message msg);
247         int _cue_set (uint32_t aux, lo_address addr);
248         int cue_next (lo_message msg);
249         int cue_previous (lo_message msg);
250         int cue_send_fader (uint32_t id, float position, lo_message msg);
251         int cue_send_enable (uint32_t id, float state, lo_message msg);
252         int cue_aux_fader (float position, lo_message msg);
253         int cue_aux_mute (float state, lo_message msg);
254         void cue_set_aux (uint32_t aux, lo_message msg);
255         int cue_float_message (std::string, float value, lo_address addr);
256         int text_message (std::string path, std::string val, lo_address addr);
257         boost::shared_ptr<ARDOUR::Send> cue_get_send (uint32_t id, lo_address addr);
258         // end cue
259
260 #define OSC_DEBUG \
261         if (_debugmode == All) { \
262                 debugmsg (dgettext(PACKAGE, "OSC"), path, types, argv, argc); \
263         }
264
265 #define PATH_CALLBACK_MSG(name) \
266         static int _ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { \
267                 return static_cast<OSC*>(user_data)->cb_ ## name (path, types, argv, argc, data); \
268         } \
269         int cb_ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data) { \
270                 OSC_DEBUG; \
271                 if (argc > 0 && !strcmp (types, "f") && argv[0]->f != 1.0) { return 0; } \
272                 name (data); \
273                 return 0; \
274         }
275
276         PATH_CALLBACK_MSG(route_get_sends);
277         PATH_CALLBACK_MSG(route_get_receives);
278         PATH_CALLBACK_MSG(routes_list);
279         PATH_CALLBACK_MSG(transport_frame);
280         PATH_CALLBACK_MSG(transport_speed);
281         PATH_CALLBACK_MSG(record_enabled);
282         PATH_CALLBACK_MSG(refresh_surface);
283         PATH_CALLBACK_MSG(bank_up);
284         PATH_CALLBACK_MSG(bank_down);
285
286 #define PATH_CALLBACK(name) \
287         static int _ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { \
288                 return static_cast<OSC*>(user_data)->cb_ ## name (path, types, argv, argc, data); \
289         } \
290         int cb_ ## name (const char *path, const char *types, lo_arg ** argv, int argc, void *data) { \
291                 OSC_DEBUG; \
292                 check_surface (data); \
293                 if (argc > 0 && !strcmp (types, "f") && argv[0]->f != 1.0) { return 0; } \
294                 name (); \
295                 return 0; \
296         }
297
298         PATH_CALLBACK(add_marker);
299         PATH_CALLBACK(loop_toggle);
300         PATH_CALLBACK(goto_start);
301         PATH_CALLBACK(goto_end);
302         PATH_CALLBACK(rewind);
303         PATH_CALLBACK(ffwd);
304         PATH_CALLBACK(transport_stop);
305         PATH_CALLBACK(transport_play);
306         PATH_CALLBACK(save_state);
307         PATH_CALLBACK(prev_marker);
308         PATH_CALLBACK(next_marker);
309         PATH_CALLBACK(undo);
310         PATH_CALLBACK(redo);
311         PATH_CALLBACK(toggle_punch_in);
312         PATH_CALLBACK(toggle_punch_out);
313         PATH_CALLBACK(rec_enable_toggle);
314         PATH_CALLBACK(toggle_all_rec_enables);
315         PATH_CALLBACK(all_tracks_rec_in);
316         PATH_CALLBACK(all_tracks_rec_out);
317         PATH_CALLBACK(cancel_all_solos);
318         PATH_CALLBACK(remove_marker_at_playhead);
319         PATH_CALLBACK(mark_in);
320         PATH_CALLBACK(mark_out);
321         PATH_CALLBACK(toggle_click);
322         PATH_CALLBACK(midi_panic);
323         PATH_CALLBACK(toggle_roll);
324         PATH_CALLBACK(stop_forget);
325         PATH_CALLBACK(set_punch_range);
326         PATH_CALLBACK(set_loop_range);
327         PATH_CALLBACK(set_session_range);
328         PATH_CALLBACK(toggle_monitor_mute);
329         PATH_CALLBACK(toggle_monitor_dim);
330         PATH_CALLBACK(toggle_monitor_mono);
331         PATH_CALLBACK(quick_snapshot_stay);
332         PATH_CALLBACK(quick_snapshot_switch);
333         PATH_CALLBACK(fit_1_track);
334         PATH_CALLBACK(fit_2_tracks);
335         PATH_CALLBACK(fit_4_tracks);
336         PATH_CALLBACK(fit_8_tracks);
337         PATH_CALLBACK(fit_16_tracks);
338         PATH_CALLBACK(fit_32_tracks);
339         PATH_CALLBACK(fit_all_tracks);
340         PATH_CALLBACK(zoom_100_ms);
341         PATH_CALLBACK(zoom_1_sec);
342         PATH_CALLBACK(zoom_10_sec);
343         PATH_CALLBACK(zoom_1_min);
344         PATH_CALLBACK(zoom_5_min);
345         PATH_CALLBACK(zoom_10_min);
346         PATH_CALLBACK(zoom_to_session);
347         PATH_CALLBACK(temporal_zoom_in);
348         PATH_CALLBACK(temporal_zoom_out);
349         PATH_CALLBACK(scroll_up_1_track);
350         PATH_CALLBACK(scroll_dn_1_track);
351         PATH_CALLBACK(scroll_up_1_page);
352         PATH_CALLBACK(scroll_dn_1_page);
353
354 #define PATH_CALLBACK1(name,type,optional) \
355         static int _ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { \
356                 return static_cast<OSC*>(user_data)->cb_ ## name (path, types, argv, argc, data); \
357         } \
358         int cb_ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data) { \
359                 OSC_DEBUG; \
360                 check_surface (data); \
361                 if (argc > 0) { \
362                         name (optional argv[0]->type); \
363                 } \
364                 return 0; \
365         }
366
367         PATH_CALLBACK1(set_transport_speed,f,);
368         PATH_CALLBACK1(access_action,s,&);
369
370         PATH_CALLBACK1(jump_by_bars,f,);
371         PATH_CALLBACK1(jump_by_seconds,f,);
372         PATH_CALLBACK1(master_set_gain,f,);
373         PATH_CALLBACK1(master_set_fader,f,);
374         PATH_CALLBACK1(master_set_trim,f,);
375         PATH_CALLBACK1(master_set_mute,i,);
376         PATH_CALLBACK1(monitor_set_gain,f,);
377         PATH_CALLBACK1(monitor_set_fader,f,);
378         PATH_CALLBACK1(monitor_set_mute,i,);
379         PATH_CALLBACK1(monitor_set_dim,i,);
380         PATH_CALLBACK1(monitor_set_mono,i,);
381
382 #define PATH_CALLBACK1_MSG(name,arg1type) \
383         static int _ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { \
384                 return static_cast<OSC*>(user_data)->cb_ ## name (path, types, argv, argc, data); \
385         } \
386         int cb_ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data) { \
387                 OSC_DEBUG; \
388                 if (argc > 0) { \
389                         name (argv[0]->arg1type, data); \
390                 } \
391                 return 0; \
392         }
393
394         // pan position needs message info to send feedback
395         PATH_CALLBACK1_MSG(master_set_pan_stereo_position,f);
396
397         PATH_CALLBACK1_MSG(scrub,f);
398         PATH_CALLBACK1_MSG(jog,f);
399         PATH_CALLBACK1_MSG(jog_mode,f);
400         PATH_CALLBACK1_MSG(set_surface_bank_size,i);
401         PATH_CALLBACK1_MSG(set_surface_strip_types,i);
402         PATH_CALLBACK1_MSG(set_surface_feedback,i);
403         PATH_CALLBACK1_MSG(set_surface_gainmode,i);
404         PATH_CALLBACK1_MSG(sel_recenable,i);
405         PATH_CALLBACK1_MSG(sel_recsafe,i);
406         PATH_CALLBACK1_MSG(sel_mute,i);
407         PATH_CALLBACK1_MSG(sel_solo,i);
408         PATH_CALLBACK1_MSG(sel_solo_iso,i);
409         PATH_CALLBACK1_MSG(sel_solo_safe,i);
410         PATH_CALLBACK1_MSG(sel_monitor_input,i);
411         PATH_CALLBACK1_MSG(sel_monitor_disk,i);
412         PATH_CALLBACK1_MSG(sel_phase,i);
413         PATH_CALLBACK1_MSG(sel_gain,f);
414         PATH_CALLBACK1_MSG(sel_fader,f);
415         PATH_CALLBACK1_MSG(sel_trim,f);
416         PATH_CALLBACK1_MSG(sel_pan_position,f);
417         PATH_CALLBACK1_MSG(sel_pan_width,f);
418         PATH_CALLBACK1_MSG(sel_pan_elevation,f);
419         PATH_CALLBACK1_MSG(sel_pan_frontback,f);
420         PATH_CALLBACK1_MSG(sel_pan_lfe,f);
421         PATH_CALLBACK1_MSG(sel_comp_enable,f);
422         PATH_CALLBACK1_MSG(sel_comp_threshold,f);
423         PATH_CALLBACK1_MSG(sel_comp_speed,f);
424         PATH_CALLBACK1_MSG(sel_comp_mode,f);
425         PATH_CALLBACK1_MSG(sel_comp_makeup,f);
426         PATH_CALLBACK1_MSG(sel_eq_enable,f);
427         PATH_CALLBACK1_MSG(sel_eq_hpf,f);
428         PATH_CALLBACK1_MSG(sel_expand,i);
429
430 #define PATH_CALLBACK2(name,arg1type,arg2type) \
431         static int _ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { \
432                 return static_cast<OSC*>(user_data)->cb_ ## name (path, types, argv, argc, data); \
433         } \
434         int cb_ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data) { \
435                 OSC_DEBUG; \
436                 check_surface (data); \
437                 if (argc > 1) { \
438                         name (argv[0]->arg1type, argv[1]->arg2type); \
439                 } \
440                 return 0; \
441         }
442
443 #define PATH_CALLBACK2_MSG(name,arg1type,arg2type) \
444         static int _ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { \
445                 return static_cast<OSC*>(user_data)->cb_ ## name (path, types, argv, argc, data); \
446         } \
447         int cb_ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data) { \
448                 OSC_DEBUG; \
449                 if (argc > 1) { \
450                         name (argv[0]->arg1type, argv[1]->arg2type, data); \
451                 } \
452                 return 0; \
453         }
454
455 #define PATH_CALLBACK2_MSG_s(name,arg1type,arg2type) \
456         static int _ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { \
457                 return static_cast<OSC*>(user_data)->cb_ ## name (path, types, argv, argc, data); \
458         } \
459         int cb_ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data) { \
460                 OSC_DEBUG; \
461                 if (argc > 1) { \
462                         name (argv[0]->arg1type, &argv[1]->arg2type, data); \
463                 } \
464                 return 0; \
465         }
466
467 #define PATH_CALLBACK3(name,arg1type,arg2type,arg3type) \
468         static int _ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { \
469                 return static_cast<OSC*>(user_data)->cb_ ## name (path, types, argv, argc, data); \
470         } \
471         int cb_ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data) { \
472                 OSC_DEBUG; \
473                 if (argc > 1) { \
474                         name (argv[0]->arg1type, argv[1]->arg2type,argv[2]->arg3type, data); \
475                 } \
476                 return 0; \
477         }
478
479 #define PATH_CALLBACK4(name,arg1type,arg2type,arg3type,arg4type) \
480         static int _ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { \
481                 return static_cast<OSC*>(user_data)->cb_ ## name (path, types, argv, argc, data); \
482         } \
483         int cb_ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data) { \
484                 OSC_DEBUG; \
485                 if (argc > 1) { \
486                         name (argv[0]->arg1type, argv[1]->arg2type,argv[2]->arg3type,argv[3]->arg4type, data); \
487                 } \
488                 return 0; \
489         }
490
491         PATH_CALLBACK2_MSG(sel_sendgain,i,f);
492         PATH_CALLBACK2_MSG(sel_sendfader,i,f);
493         PATH_CALLBACK2_MSG(sel_sendenable,i,f);
494         PATH_CALLBACK2_MSG(sel_eq_gain,i,f);
495         PATH_CALLBACK2_MSG(sel_eq_freq,i,f);
496         PATH_CALLBACK2_MSG(sel_eq_q,i,f);
497         PATH_CALLBACK2_MSG(sel_eq_shape,i,f);
498
499         PATH_CALLBACK4(set_surface,i,i,i,i);
500         PATH_CALLBACK2(locate,i,i);
501         PATH_CALLBACK2(loop_location,i,i);
502         PATH_CALLBACK2_MSG_s(route_rename,i,s);
503         PATH_CALLBACK2_MSG(route_mute,i,i);
504         PATH_CALLBACK2_MSG(route_solo,i,i);
505         PATH_CALLBACK2_MSG(route_solo_iso,i,i);
506         PATH_CALLBACK2_MSG(route_solo_safe,i,i);
507         PATH_CALLBACK2_MSG(route_recenable,i,i);
508         PATH_CALLBACK2_MSG(route_recsafe,i,i);
509         PATH_CALLBACK2_MSG(route_monitor_input,i,i);
510         PATH_CALLBACK2_MSG(route_monitor_disk,i,i);
511         PATH_CALLBACK2_MSG(strip_phase,i,i);
512         PATH_CALLBACK2_MSG(strip_expand,i,i);
513         PATH_CALLBACK2_MSG(strip_gui_select,i,i);
514         PATH_CALLBACK2_MSG(route_set_gain_dB,i,f);
515         PATH_CALLBACK2_MSG(route_set_gain_fader,i,f);
516         PATH_CALLBACK2_MSG(route_set_trim_dB,i,f);
517         PATH_CALLBACK2_MSG(route_set_pan_stereo_position,i,f);
518         PATH_CALLBACK2_MSG(route_set_pan_stereo_width,i,f);
519         PATH_CALLBACK3(route_set_send_gain_dB,i,i,f);
520         PATH_CALLBACK3(route_set_send_fader,i,i,f);
521         PATH_CALLBACK3(route_set_send_enable,i,i,f);
522         PATH_CALLBACK4(route_plugin_parameter,i,i,i,f);
523         PATH_CALLBACK3(route_plugin_parameter_print,i,i,i);
524         PATH_CALLBACK2_MSG(route_plugin_activate,i,i);
525         PATH_CALLBACK2_MSG(route_plugin_deactivate,i,i);
526         PATH_CALLBACK1_MSG(route_plugin_list,i);
527         PATH_CALLBACK2_MSG(route_plugin_descriptor,i,i);
528         PATH_CALLBACK2_MSG(route_plugin_reset,i,i);
529
530         int route_rename (int rid, char *s, lo_message msg);
531         int route_mute (int rid, int yn, lo_message msg);
532         int route_solo (int rid, int yn, lo_message msg);
533         int route_solo_iso (int rid, int yn, lo_message msg);
534         int route_solo_safe (int rid, int yn, lo_message msg);
535         int route_recenable (int rid, int yn, lo_message msg);
536         int route_recsafe (int ssid, int yn, lo_message msg);
537         int route_monitor_input (int rid, int yn, lo_message msg);
538         int route_monitor_disk (int rid, int yn, lo_message msg);
539         int strip_phase (int rid, int yn, lo_message msg);
540         int strip_expand (int rid, int yn, lo_message msg);
541         int _strip_select (boost::shared_ptr<ARDOUR::Stripable> s, lo_address addr);
542         int strip_gui_select (int rid, int yn, lo_message msg);
543         int route_set_gain_abs (int rid, float level, lo_message msg);
544         int route_set_gain_dB (int rid, float dB, lo_message msg);
545         int route_set_gain_fader (int rid, float pos, lo_message msg);
546         int route_set_trim_abs (int rid, float level, lo_message msg);
547         int route_set_trim_dB (int rid, float dB, lo_message msg);
548         int route_set_pan_stereo_position (int rid, float left_right_fraction, lo_message msg);
549         int route_set_pan_stereo_width (int rid, float percent, lo_message msg);
550         int route_set_send_gain_dB (int rid, int sid, float val, lo_message msg);
551         int route_set_send_fader (int rid, int sid, float val, lo_message msg);
552         int route_set_send_enable (int rid, int sid, float val, lo_message msg);
553         int route_plugin_parameter (int rid, int piid,int par, float val, lo_message msg);
554         int route_plugin_parameter_print (int rid, int piid,int par, lo_message msg);
555         int route_plugin_activate (int rid, int piid, lo_message msg);
556         int route_plugin_deactivate (int rid, int piid, lo_message msg);
557         int route_plugin_list(int ssid, lo_message msg);
558         int route_plugin_descriptor(int ssid, int piid, lo_message msg);
559         int route_plugin_reset(int ssid, int piid, lo_message msg);
560
561         //banking functions
562         int set_bank (uint32_t bank_start, lo_message msg);
563         int _set_bank (uint32_t bank_start, lo_address addr);
564         int bank_up (lo_message msg);
565         int bank_down (lo_message msg);
566         int set_surface (uint32_t b_size, uint32_t strips, uint32_t fb, uint32_t gmode, lo_message msg);
567         int set_surface_bank_size (uint32_t bs, lo_message msg);
568         int set_surface_strip_types (uint32_t st, lo_message msg);
569         int set_surface_feedback (uint32_t fb, lo_message msg);
570         int set_surface_gainmode (uint32_t gm, lo_message msg);
571         int refresh_surface (lo_message msg);
572
573         int scrub (float delta, lo_message msg);
574         int jog (float delta, lo_message msg);
575         int jog_mode (float mode, lo_message msg);
576         int master_set_gain (float dB);
577         int master_set_fader (float position);
578         int master_set_trim (float dB);
579         int master_set_pan_stereo_position (float position, lo_message msg);
580         int master_set_mute (uint32_t state);
581         int monitor_set_gain (float dB);
582         int monitor_set_fader (float position);
583         int monitor_set_mute (uint32_t state);
584         int monitor_set_dim (uint32_t state);
585         int monitor_set_mono (uint32_t state);
586         int sel_recenable (uint32_t state, lo_message msg);
587         int sel_recsafe (uint32_t state, lo_message msg);
588         int sel_mute (uint32_t state, lo_message msg);
589         int sel_solo (uint32_t state, lo_message msg);
590         int sel_solo_iso (uint32_t state, lo_message msg);
591         int sel_solo_safe (uint32_t state, lo_message msg);
592         int sel_monitor_input (uint32_t state, lo_message msg);
593         int sel_monitor_disk (uint32_t state, lo_message msg);
594         int sel_phase (uint32_t state, lo_message msg);
595         int sel_gain (float state, lo_message msg);
596         int sel_fader (float state, lo_message msg);
597         int sel_trim (float val, lo_message msg);
598         int sel_pan_position (float val, lo_message msg);
599         int sel_pan_width (float val, lo_message msg);
600         int sel_sendgain (int id, float dB, lo_message msg);
601         int sel_sendfader (int id, float pos, lo_message msg);
602         int sel_sendenable (int id, float pos, lo_message msg);
603         int sel_expand (uint32_t state, lo_message msg);
604         int sel_pan_elevation (float val, lo_message msg);
605         int sel_pan_frontback (float val, lo_message msg);
606         int sel_pan_lfe (float val, lo_message msg);
607         int sel_comp_enable (float val, lo_message msg);
608         int sel_comp_threshold (float val, lo_message msg);
609         int sel_comp_speed (float val, lo_message msg);
610         int sel_comp_mode (float val, lo_message msg);
611         int sel_comp_makeup (float val, lo_message msg);
612         int sel_eq_enable (float val, lo_message msg);
613         int sel_eq_hpf (float val, lo_message msg);
614         int sel_eq_gain (int id, float val, lo_message msg);
615         int sel_eq_freq (int id, float val, lo_message msg);
616         int sel_eq_q (int id, float val, lo_message msg);
617         int sel_eq_shape (int id, float val, lo_message msg);
618
619         void listen_to_route (boost::shared_ptr<ARDOUR::Stripable>, lo_address);
620         void end_listen (boost::shared_ptr<ARDOUR::Stripable>, lo_address);
621         void drop_route (boost::weak_ptr<ARDOUR::Stripable>);
622         void route_lost (boost::weak_ptr<ARDOUR::Stripable>);
623         void gui_selection_changed (void);
624
625         void route_name_changed (const PBD::PropertyChange&, boost::weak_ptr<ARDOUR::Route> r, lo_address addr);
626         void recalcbanks ();
627         void _recalcbanks ();
628         void notify_routes_added (ARDOUR::RouteList &);
629         void notify_vca_added (ARDOUR::VCAList &);
630
631         int cancel_all_solos ();
632         bool periodic (void);
633         sigc::connection periodic_connection;
634         PBD::ScopedConnectionList session_connections;
635         PBD::ScopedConnectionList cueobserver_connections;
636
637         int route_send_fail (std::string path, uint32_t ssid, float val, lo_address addr);
638         int sel_send_fail (std::string path, uint32_t id, float val, lo_address addr);
639         int sel_fail (std::string path, float val, lo_address addr);
640
641         typedef std::list<OSCRouteObserver*> RouteObservers;
642
643         RouteObservers route_observers;
644
645         typedef std::list<OSCGlobalObserver*> GlobalObservers;
646         GlobalObservers global_observers;
647
648         typedef std::list<OSCCueObserver*> CueObservers;
649         CueObservers cue_observers;
650
651         void debugmsg (const char *prefix, const char *path, const char* types, lo_arg **argv, int argc);
652
653         static OSC* _instance;
654
655         mutable void *gui;
656         void build_gui ();
657 };
658
659 } // namespace
660
661 #endif // ardour_osc_h