Index: gtk2_ardour/editing.h =================================================================== --- gtk2_ardour/editing.h (revision 1640) +++ gtk2_ardour/editing.h (working copy) @@ -15,6 +15,17 @@ #define DISPLAYCONTROL(a) /*empty*/ #define IMPORTMODE(a) /*empty*/ +// compile time switch +#define OSC_CANVAS + +#ifdef OSC_CANVAS +# include +# define OSC_CANVAS_HOST Config->get_osc_notify_host() +# define OSC_CANVAS_PORT Config->get_osc_notify_port() +# define OSC_CANVAS_CMDC Config->get_osc_notify_cmd_canvas() +# define OSC_CANVAS_TX Config->get_osc_notify_mode() +#endif + namespace Editing { // SNAPTYPE Index: gtk2_ardour/editor_canvas.cc =================================================================== --- gtk2_ardour/editor_canvas.cc (revision 1640) +++ gtk2_ardour/editor_canvas.cc (working copy) @@ -724,5 +724,13 @@ update_fixed_rulers (); tempo_map_changed (Change (0), !_dragging_hscrollbar); +#ifdef OSC_CANVAS + if (OSC_CANVAS_TX) { + //printf("DEBUG: hscroll! %lu %lu\n",(unsigned long) leftmost_frame,(unsigned long) rightmost_frame); + lo_address a= lo_address_new (OSC_CANVAS_HOST, OSC_CANVAS_PORT); + lo_send(a, OSC_CANVAS_CMDC, "ii", (unsigned long) leftmost_frame, (unsigned long) rightmost_frame); + lo_address_free(a); + } +#endif } Index: gtk2_ardour/editor.cc =================================================================== --- gtk2_ardour/editor.cc (revision 1640) +++ gtk2_ardour/editor.cc (working copy) @@ -3669,6 +3669,16 @@ } } +#ifdef OSC_CANVAS + if (OSC_CANVAS_TX) { + nframes_t leftmost_frame = (nframes_t) floor (horizontal_adjustment.get_value() * frames_per_unit); + nframes_t rightmost_frame = leftmost_frame + current_page_frames (); + //printf("DEBUG: zoom: %lu %lu\n",(unsigned long) my_leftmost_frame,(unsigned long) my_rightmost_frame); + lo_address a= lo_address_new (OSC_CANVAS_HOST, OSC_CANVAS_PORT); + lo_send(a, OSC_CANVAS_CMDC, "ii", (unsigned long) leftmost_frame, (unsigned long) rightmost_frame); + lo_address_free(a); + } +#endif return 0; } Index: gtk2_ardour/ardour_ui.h =================================================================== --- gtk2_ardour/ardour_ui.h (revision 1640) +++ gtk2_ardour/ardour_ui.h (working copy) @@ -657,6 +657,7 @@ void toggle_send_mtc (); void toggle_use_osc (); + void toggle_osc_notify_mode (); void set_input_auto_connect (ARDOUR::AutoConnectOption); void set_output_auto_connect (ARDOUR::AutoConnectOption); Index: gtk2_ardour/ardour.menus =================================================================== --- gtk2_ardour/ardour.menus (revision 1640) +++ gtk2_ardour/ardour.menus (working copy) @@ -343,6 +343,7 @@ + Index: gtk2_ardour/ardour_ui_ed.cc =================================================================== --- gtk2_ardour/ardour_ui_ed.cc (revision 1640) +++ gtk2_ardour/ardour_ui_ed.cc (working copy) @@ -396,6 +396,7 @@ act = ActionManager::register_toggle_action (option_actions, X_("UseMIDIcontrol"), _("Use MIDI control"), mem_fun (*this, &ARDOUR_UI::toggle_use_midi_control)); ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_toggle_action (option_actions, X_("SendOSC"), _("Send OSC"), mem_fun (*this, &ARDOUR_UI::toggle_osc_notify_mode)); act = ActionManager::register_toggle_action (option_actions, X_("UseOSC"), _("Use OSC"), mem_fun (*this, &ARDOUR_UI::toggle_use_osc)); #ifndef HAVE_LIBLO act->set_sensitive (false); Index: gtk2_ardour/ardour_ui_options.cc =================================================================== --- gtk2_ardour/ardour_ui_options.cc (revision 1640) +++ gtk2_ardour/ardour_ui_options.cc (working copy) @@ -64,6 +64,12 @@ } void +ARDOUR_UI::toggle_osc_notify_mode () +{ + ActionManager::toggle_config_state ("options", "SendOSC", &Configuration::set_osc_notify_mode, &Configuration::get_osc_notify_mode); +} + +void ARDOUR_UI::toggle_use_osc () { ActionManager::toggle_config_state ("options", "UseOSC", &Configuration::set_use_osc, &Configuration::get_use_osc); @@ -851,6 +857,11 @@ ActionManager::map_some_state ("options", "SendMMC", &Configuration::get_send_mmc); + } else if (PARAM_IS ("osc-notify-mode")) { + + // TODO: realloc static OSC address here + ActionManager::map_some_state ("options", "SendOSC", &Configuration::get_osc_notify_mode); + } else if (PARAM_IS ("use-osc")) { #ifdef HAVE_LIBLO Index: libs/ardour/ardour/configuration_vars.h =================================================================== --- libs/ardour/ardour/configuration_vars.h (revision 1640) +++ libs/ardour/ardour/configuration_vars.h (working copy) @@ -40,6 +40,13 @@ CONFIG_VARIABLE (uint32_t, osc_port, "osc-port", 3819) CONFIG_VARIABLE (bool, use_osc, "use-osc", false) +/* OSC - notify */ + +CONFIG_VARIABLE (bool, osc_notify_mode, "osc-notify-mode", false) +CONFIG_VARIABLE (char*, osc_notify_port, "osc-notify-port", "5280") +CONFIG_VARIABLE (char*, osc_notify_host, "osc-notify-host", "localhost") +CONFIG_VARIABLE (char*, osc_notify_cmd_canvas, "osc-notify-cmd-canvas", "/ardour2/info/canvas") + /* crossfades */ CONFIG_VARIABLE (CrossfadeModel, xfade_model, "xfade-model", FullCrossfade)