moved OSC into libardour
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 18 May 2006 16:44:07 +0000 (16:44 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 18 May 2006 16:44:07 +0000 (16:44 +0000)
git-svn-id: svn://localhost/trunk/ardour2@510 d708f5d6-7413-0410-9779-e7cbd77b26cf

SConstruct
libs/ardour/SConscript
libs/ardour/ardour/ardour.h
libs/ardour/ardour/basic_ui.h
libs/ardour/ardour/configuration_vars.h
libs/ardour/basic_ui.cc
libs/ardour/control_protocol.cc
libs/ardour/globals.cc
libs/ardour/session.cc
libs/surfaces/generic_midi/generic_midi_control_protocol.cc
libs/surfaces/tranzport/tranzport_control_protocol.cc

index f8093e4f6f8d531ee73bc64b75ae646768a61023..19decf99b8ff5ac64f6c1fccebd823052c4503ef 100644 (file)
@@ -390,9 +390,6 @@ libraries['pango'].ParseConfig ('pkg-config --cflags --libs pango')
 libraries['libgnomecanvas2'] = LibraryInfo()
 libraries['libgnomecanvas2'].ParseConfig ('pkg-config --cflags --libs libgnomecanvas-2.0')
 
-libraries['glade2'] = LibraryInfo()
-libraries['glade2'].ParseConfig ('pkg-config --cflags --libs libglade-2.0')
-
 #libraries['flowcanvas'] = LibraryInfo(LIBS='flowcanvas', LIBPATH='#/libs/flowcanvas', CPPPATH='#libs/flowcanvas')
 
 libraries['ardour'] = LibraryInfo (LIBS='ardour', LIBPATH='#libs/ardour', CPPPATH='#libs/ardour')
@@ -424,10 +421,9 @@ libraries['usb'] = conf.Finish ()
 libraries['lo'] = LibraryInfo ()
 
 conf = Configure (libraries['lo'])
-if conf.CheckLib ('lo', 'lo_server_new'):
-    have_liblo = True
-else:
-    have_liblo = False
+if conf.CheckLib ('lo', 'lo_server_new') == False:
+    print "liblo does not appear to be installed."
+    exit (0)
     
 libraries['lo'] = conf.Finish ()
 
@@ -486,8 +482,9 @@ if env['SYSLIBS']:
     libraries['pangomm'].ParseConfig ('pkg-config --cflags --libs pangomm-1.4')
     libraries['libgnomecanvasmm'] = LibraryInfo()
     libraries['libgnomecanvasmm'].ParseConfig ('pkg-config --cflags --libs libgnomecanvasmm-2.6')
-    libraries['libglademm'] = LibraryInfo()
-    libraries['libglademm'].ParseConfig ('pkg-config --cflags --libs libglademm-2.4')
+
+#    libraries['libglademm'] = LibraryInfo()
+#    libraries['libglademm'].ParseConfig ('pkg-config --cflags --libs libglademm-2.4')
 
 #    libraries['flowcanvas'] = LibraryInfo(LIBS='flowcanvas', LIBPATH='#/libs/flowcanvas', CPPPATH='#libs/flowcanvas')
     libraries['soundtouch'] = LibraryInfo()
@@ -535,9 +532,9 @@ else:
     libraries['soundtouch'] = LibraryInfo(LIBS='soundtouch',
                                           LIBPATH='#libs/soundtouch',
                                           CPPPATH=['#libs', '#libs/soundtouch'])
-    libraries['libglademm'] = LibraryInfo(LIBS='libglademm',
-                                          LIBPATH='#libs/libglademm',
-                                          CPPPATH='#libs/libglademm')
+#    libraries['libglademm'] = LibraryInfo(LIBS='libglademm',
+#                                          LIBPATH='#libs/libglademm',
+#                                          CPPPATH='#libs/libglademm')
 
     coredirs = [
         'libs/soundtouch',
@@ -558,7 +555,6 @@ else:
        'libs/gtkmm2/atk',
        'libs/gtkmm2/gdk',
        'libs/gtkmm2/gtk',
-    'libs/libglademm',
        'libs/libgnomecanvasmm',
 #      'libs/flowcanvas',
     'libs/gtkmm2ext',
@@ -571,8 +567,6 @@ if env['SURFACES']:
     surface_subdirs += [ 'libs/surfaces/generic_midi' ]
     if have_libusb:
         surface_subdirs += [ 'libs/surfaces/tranzport' ]
-    if have_liblo:
-        surface_subdirs += [ 'libs/surfaces/osc' ]        
     
 opts.Save('scache.conf', env)
 Help(opts.GenerateHelpText(env))
@@ -850,9 +844,9 @@ for subdir in coredirs:
     SConscript (subdir + '/SConscript')
 
 for sublistdir in [subdirs, gtk_subdirs, surface_subdirs]:
-       for subdir in sublistdir:
-               SConscript (subdir + '/SConscript')
-
+    for subdir in sublistdir:
+        SConscript (subdir + '/SConscript')
+            
 # cleanup
 env.Clean ('scrub', [ 'scache.conf', '.sconf_temp', '.sconsign.dblite', 'config.log'])
 
index 9bbd9bc2702b2e1b2461420491b69618b88d8161..9393f7f74ceb2d6d717d3fdc1e1ab04b8f48bf0d 100644 (file)
@@ -54,6 +54,7 @@ ladspa_plugin.cc
 location.cc
 mtc_slave.cc
 named_selection.cc
+osc.cc
 panner.cc
 pcm_utils.cc
 playlist.cc
@@ -184,7 +185,7 @@ ardour.Merge ([
             libraries['pbd3'],
             libraries['soundtouch'],
             libraries['midi++2'],
-            libraries['xslt'],
+            libraries['lo'],
             ])
 
 
index 28c5f07fce4419166fed504d0f63e4e8f43036ac..3308266f2f49bba9635fe1d8dfd43466287979c9 100644 (file)
@@ -42,6 +42,9 @@ namespace MIDI {
 namespace ARDOUR {
 
        class AudioEngine;
+       class OSC;
+
+       extern OSC* osc;
 
        static const jack_nframes_t max_frames = JACK_MAX_FRAMES;
 
index a2395f8f591ced3011da2d6d7332318f592efb4c..a6ab53689384afd347a5fe4db04fa4778813dd55 100644 (file)
@@ -36,7 +36,8 @@ class BasicUI {
        void toggle_all_rec_enables ();
 
   protected:
-       ARDOUR::Session& session;
+       BasicUI ();
+       ARDOUR::Session* session;
 };
 
 #endif /* __ardour_basic_ui_h__ */
index d54264c1c01075767765d127c377d746feaf8220..9a45fd3c7cf12d5719b84409223cf3e025a85f60 100644 (file)
@@ -39,6 +39,8 @@ CONFIG_VARIABLE(uint32_t, destructive_xfade_msecs,  "destructive-xfade-msecs", 2
 CONFIG_VARIABLE(SampleFormat, native_file_data_format,  "native-file-data-format", ARDOUR::FormatFloat)
 CONFIG_VARIABLE(HeaderFormat, native_file_header_format,  "native-file-header-format", ARDOUR::WAVE)
 CONFIG_VARIABLE(bool, use_tranzport,  "use-tranzport", false)
+CONFIG_VARIABLE(uint32_t, osc_port, "osc-port", 3819)
+CONFIG_VARIABLE(bool, use_osc, "use-osc", true)
 
 /* these variables have custom set() methods */
 
index 02e45ac84ab0ec71203c08311f238adfcc34c883..c9b3fdefac5104cad8dff0e27ce4e772c63fa14d 100644 (file)
 using namespace ARDOUR;
 
 BasicUI::BasicUI (Session& s)
-       : session (s)
+       : session (&s)
+{
+}
+
+BasicUI::BasicUI ()
+       : session (0)
 {
 }
 
@@ -39,12 +44,12 @@ BasicUI::~BasicUI ()
 void
 BasicUI::loop_toggle () 
 {
-       if (session.get_auto_loop()) {
-               session.request_auto_loop (false);
+       if (session->get_auto_loop()) {
+               session->request_auto_loop (false);
        } else {
-               session.request_auto_loop (true);
-               if (!session.transport_rolling()) {
-                       session.request_transport_speed (1.0);
+               session->request_auto_loop (true);
+               if (!session->transport_rolling()) {
+                       session->request_transport_speed (1.0);
                }
        }
 }
@@ -52,146 +57,146 @@ BasicUI::loop_toggle ()
 void
 BasicUI::goto_start ()
 {
-       session.goto_start ();
+       session->goto_start ();
 }
 
 void
 BasicUI::goto_end ()
 {
-       session.goto_end ();
+       session->goto_end ();
 }
 
 void       
 BasicUI::add_marker ()
 {
-       jack_nframes_t when = session.audible_frame();
-       session.locations()->add (new Location (when, when, _("unnamed"), Location::IsMark));
+       jack_nframes_t when = session->audible_frame();
+       session->locations()->add (new Location (when, when, _("unnamed"), Location::IsMark));
 }
 
 void
 BasicUI::rewind ()
 {
-       session.request_transport_speed (-2.0f);
+       session->request_transport_speed (-2.0f);
 }
 
 void
 BasicUI::ffwd ()
 {
-       session.request_transport_speed (2.0f);
+       session->request_transport_speed (2.0f);
 }
 
 void
 BasicUI::transport_stop ()
 {
-       session.request_transport_speed (0.0);
+       session->request_transport_speed (0.0);
 }
 
 void
 BasicUI::transport_play ()
 {
-       bool rolling = session.transport_rolling ();
+       bool rolling = session->transport_rolling ();
 
-       if (session.get_auto_loop()) {
-               session.request_auto_loop (false);
+       if (session->get_auto_loop()) {
+               session->request_auto_loop (false);
        } 
 
-       if (session.get_play_range ()) {
-               session.request_play_range (false);
+       if (session->get_play_range ()) {
+               session->request_play_range (false);
        }
        
        if (rolling) {
-               session.request_locate (session.last_transport_start(), true);
+               session->request_locate (session->last_transport_start(), true);
 
        }
 
-       session.request_transport_speed (1.0f);
+       session->request_transport_speed (1.0f);
 }
 
 void
 BasicUI::rec_enable_toggle ()
 {
-       switch (session.record_status()) {
+       switch (session->record_status()) {
        case Session::Disabled:
-               if (session.ntracks() == 0) {
+               if (session->ntracks() == 0) {
                        // string txt = _("Please create 1 or more track\nbefore trying to record.\nCheck the Session menu.");
                        // MessageDialog msg (*editor, txt);
                        // msg.run ();
                        return;
                }
-               session.maybe_enable_record ();
+               session->maybe_enable_record ();
                break;
        case Session::Recording:
        case Session::Enabled:
-               session.disable_record (true);
+               session->disable_record (true);
        }
 }
 
 void
 BasicUI::save_state ()
 {
-       session.save_state ("");
+       session->save_state ("");
 }
 
 void
 BasicUI::prev_marker ()
 {
-       Location *location = session.locations()->first_location_before (session.transport_frame());
+       Location *location = session->locations()->first_location_before (session->transport_frame());
        
        if (location) {
-               session.request_locate (location->start(), session.transport_rolling());
+               session->request_locate (location->start(), session->transport_rolling());
        } else {
-               session.goto_start ();
+               session->goto_start ();
        }
 }
 
 void
 BasicUI::next_marker ()
 {
-       Location *location = session.locations()->first_location_after (session.transport_frame());
+       Location *location = session->locations()->first_location_after (session->transport_frame());
 
        if (location) {
-               session.request_locate (location->start(), session.transport_rolling());
+               session->request_locate (location->start(), session->transport_rolling());
        } else {
-               session.request_locate (session.current_end_frame());
+               session->request_locate (session->current_end_frame());
        }
 }
 
 void
 BasicUI::set_transport_speed (float speed)
 {
-       session.request_transport_speed (speed);
+       session->request_transport_speed (speed);
 }
 
 void
 BasicUI::undo ()
 {
-       session.undo (1);
+       session->undo (1);
 }
 
 void
 BasicUI::redo ()
 {
-       session.redo (1);
+       session->redo (1);
 }
 
 void
 BasicUI::toggle_all_rec_enables ()
 {
-       if (session.get_record_enabled()) {
-               session.record_disenable_all ();
+       if (session->get_record_enabled()) {
+               session->record_disenable_all ();
        } else {
-               session.record_enable_all ();
+               session->record_enable_all ();
        }
 }
 
 void
 BasicUI::toggle_punch_in ()
 {
-       session.set_punch_in (!session.get_punch_in());
+       session->set_punch_in (!session->get_punch_in());
 }
 
 void
 BasicUI::toggle_punch_out ()
 {
-       session.set_punch_out (!session.get_punch_out());
+       session->set_punch_out (!session->get_punch_out());
 }
index 222ecbf2796b85ca609703404c2e6f39b7d14fb8..2d906033ad18d6235a3f58ba999cf6e2da60e794 100644 (file)
@@ -46,7 +46,7 @@ ControlProtocol::~ControlProtocol ()
 void
 ControlProtocol::next_track (uint32_t initial_id)
 {
-       uint32_t limit = session.nroutes();
+       uint32_t limit = session->nroutes();
        Route* cr = route_table[0];
        uint32_t id;
 
@@ -63,7 +63,7 @@ ControlProtocol::next_track (uint32_t initial_id)
        }
 
        while (id < limit) {
-               if ((cr = session.route_by_remote_id (id)) != 0) {
+               if ((cr = session->route_by_remote_id (id)) != 0) {
                        break;
                }
                id++;
@@ -72,7 +72,7 @@ ControlProtocol::next_track (uint32_t initial_id)
        if (id == limit) {
                id = 0;
                while (id != initial_id) {
-                       if ((cr = session.route_by_remote_id (id)) != 0) {
+                       if ((cr = session->route_by_remote_id (id)) != 0) {
                                break;
                        }
                        id++;
@@ -85,7 +85,7 @@ ControlProtocol::next_track (uint32_t initial_id)
 void
 ControlProtocol::prev_track (uint32_t initial_id)
 {
-       uint32_t limit = session.nroutes() - 1;
+       uint32_t limit = session->nroutes() - 1;
        Route* cr = route_table[0];
        uint32_t id;
 
@@ -96,13 +96,13 @@ ControlProtocol::prev_track (uint32_t initial_id)
        }
 
        if (id == 0) {
-               id = session.nroutes() - 1;
+               id = session->nroutes() - 1;
        } else {
                id--;
        }
 
        while (id >= 0) {
-               if ((cr = session.route_by_remote_id (id)) != 0) {
+               if ((cr = session->route_by_remote_id (id)) != 0) {
                        break;
                }
                id--;
@@ -111,7 +111,7 @@ ControlProtocol::prev_track (uint32_t initial_id)
        if (id < 0) {
                id = limit;
                while (id > initial_id) {
-                       if ((cr = session.route_by_remote_id (id)) != 0) {
+                       if ((cr = session->route_by_remote_id (id)) != 0) {
                                break;
                        }
                        id--;
index a6f9d6b2e5923ce9db0b60686e8fe86b905b9d89..eb46943a43fb90f121185e59ab299e03d9055b08 100644 (file)
@@ -47,6 +47,7 @@
 #include <ardour/utils.h>
 #include <ardour/session.h>
 #include <ardour/control_protocol_manager.h>
+#include <ardour/osc.h>
 
 #include <ardour/mix.h>
 
@@ -58,6 +59,7 @@
 
 ARDOUR::Configuration* ARDOUR::Config = 0;
 ARDOUR::AudioLibrary* ARDOUR::Library = 0;
+ARDOUR::OSC* ARDOUR::osc = 0;
 
 using namespace ARDOUR;
 using namespace std;
@@ -72,6 +74,22 @@ Change ARDOUR::PositionChanged = ARDOUR::new_change ();
 Change ARDOUR::NameChanged = ARDOUR::new_change ();
 Change ARDOUR::BoundsChanged = Change (0); // see init(), below
 
+static int
+setup_osc ()
+{
+       /* no real cost to creating this object, and it avoids
+          conditionals anywhere that uses it 
+       */
+       
+       osc = new OSC (Config->get_osc_port());
+       
+       if (Config->get_use_osc ()) {
+               return osc->start ();
+       } else {
+               return 0;
+       }
+}
+
 static int 
 setup_midi ()
 {
@@ -180,6 +198,10 @@ ARDOUR::init (AudioEngine& engine, bool use_vst, bool try_optimization, void (*s
                return -1;
        }
 
+       if (setup_osc ()) {
+               return -1;
+       }
+
 #ifdef VST_SUPPORT
        if (Config->get_use_vst() && fst_init (sighandler)) {
                return -1;
index 125e0387f3844a078cade8502b54c05b627b492a..4a0d119afaceb8091979705af08f6ccf39b1186c 100644 (file)
@@ -64,7 +64,7 @@
 #include <ardour/crossfade.h>
 #include <ardour/playlist.h>
 #include <ardour/click.h>
-#include <ardour/timestamps.h>
+#include <ardour/osc.h>
 
 #include "i18n.h"
 
@@ -794,6 +794,10 @@ Session::when_engine_running ()
 
        _engine.set_session (this);
 
+       /* and to OSC */
+
+       osc->set_session (*this);
+
        _state_of_the_state = Clean;
 
        DirtyChanged (); /* EMIT SIGNAL */
index 86f8934c05b4718b76747ff18f93eec6340ff191..95b9d223931d0f3fc1a25589081922efea6b1556 100644 (file)
@@ -31,7 +31,7 @@ GenericMidiControlProtocol::set_active (bool yn)
 void
 GenericMidiControlProtocol::port_change ()
 {
-       _port = session.midi_port ();
+       _port = session->midi_port ();
 }
 
 void
index 7857744b1773bf317c829501b91d3a7a8bd89f97..5a4c4fc385ce4c4c86da18e76a7cf015e7dac4f1 100644 (file)
@@ -297,14 +297,14 @@ TranzportControlProtocol::show_meter ()
 void
 TranzportControlProtocol::show_transport_time ()
 {
-       jack_nframes_t where = session.transport_frame();
+       jack_nframes_t where = session->transport_frame();
        
        if (where != last_where) {
 
                char buf[5];
                SMPTE_Time smpte;
 
-               session.smpte_time (where, smpte);
+               session->smpte_time (where, smpte);
                
                if (smpte.negative) {
                        sprintf (buf, "-%02ld:", smpte.hours);
@@ -698,25 +698,25 @@ TranzportControlProtocol::update_state ()
 
        /* global */
 
-       if (session.get_auto_loop()) {
+       if (session->get_auto_loop()) {
                pending_lights[LightLoop] = true;
        } else {
                pending_lights[LightLoop] = false;
        }
 
-       if (session.get_punch_in() || session.get_punch_out()) {
+       if (session->get_punch_in() || session->get_punch_out()) {
                pending_lights[LightPunch] = true;
        } else {
                pending_lights[LightPunch] = false;
        }
 
-       if (session.get_record_enabled()) {
+       if (session->get_record_enabled()) {
                pending_lights[LightRecord] = true;
        } else {
                pending_lights[LightRecord] = false;
        }
 
-       if (session.soloing ()) {
+       if (session->soloing ()) {
                pending_lights[LightAnysolo] = true;
        } else {
                pending_lights[LightAnysolo] = false;
@@ -1037,7 +1037,7 @@ TranzportControlProtocol::button_event_tracksolo_press (bool shifted)
        }
 
        if (shifted) {
-               session.set_all_solo (!session.soloing());
+               session->set_all_solo (!session->soloing());
        } else {
                route_set_soloed (0, !route_get_soloed (0));
        }
@@ -1357,16 +1357,16 @@ void
 TranzportControlProtocol::shuttle ()
 {
        if (_datawheel < WheelDirectionThreshold) {
-               if (session.transport_speed() < 0) {
-                       session.request_transport_speed (1.0);
+               if (session->transport_speed() < 0) {
+                       session->request_transport_speed (1.0);
                } else {
-                       session.request_transport_speed (session.transport_speed() + 0.1);
+                       session->request_transport_speed (session->transport_speed() + 0.1);
                }
        } else {
-               if (session.transport_speed() > 0) {
-                       session.request_transport_speed (-1.0);
+               if (session->transport_speed() > 0) {
+                       session->request_transport_speed (-1.0);
                } else {
-                       session.request_transport_speed (session.transport_speed() - 0.1);
+                       session->request_transport_speed (session->transport_speed() - 0.1);
                }
        }
 }