summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2006-05-23 19:54:52 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2006-05-23 19:54:52 +0000
commit2fba6d0925307abd11be9d8f7a8d2722a2b6ccbd (patch)
tree485eed909963636b010d5f1e24527a6a4b377a42 /libs
parenta222c19737fa2d3fce3971350c1a18906635e29a (diff)
breakout control protocol code into LGPL library; fix panner buttons even more than nick did, plus some other bits and pieces
git-svn-id: svn://localhost/trunk/ardour2@522 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/SConscript8
-rw-r--r--libs/ardour/ardour/basic_ui.h43
-rw-r--r--libs/ardour/ardour/osc.h3
-rw-r--r--libs/ardour/ardour/session.h3
-rw-r--r--libs/ardour/control_protocol_manager.cc35
-rw-r--r--libs/ardour/session_process.cc12
-rw-r--r--libs/surfaces/control_protocol/SConscript54
-rw-r--r--libs/surfaces/control_protocol/basic_ui.cc (renamed from libs/ardour/basic_ui.cc)85
-rw-r--r--libs/surfaces/control_protocol/basic_ui.h98
-rw-r--r--libs/surfaces/control_protocol/control_protocol.cc (renamed from libs/ardour/control_protocol.cc)30
-rw-r--r--libs/surfaces/control_protocol/control_protocol.h (renamed from libs/ardour/ardour/control_protocol.h)26
-rw-r--r--libs/surfaces/generic_midi/SConscript15
-rw-r--r--libs/surfaces/generic_midi/generic_midi_control_protocol.h3
-rw-r--r--libs/surfaces/generic_midi/interface.cc9
-rw-r--r--libs/surfaces/tranzport/SConscript7
-rw-r--r--libs/surfaces/tranzport/interface.cc9
-rw-r--r--libs/surfaces/tranzport/tranzport_control_protocol.cc43
-rw-r--r--libs/surfaces/tranzport/tranzport_control_protocol.h22
18 files changed, 382 insertions, 123 deletions
diff --git a/libs/ardour/SConscript b/libs/ardour/SConscript
index 9393f7f74c..cb5c810b3c 100644
--- a/libs/ardour/SConscript
+++ b/libs/ardour/SConscript
@@ -20,6 +20,12 @@ ardour.Append(CXXFLAGS="-DLIBSIGC_DISABLE_DEPRECATED")
ardour.Append(PACKAGE = domain)
ardour.Append(POTFILE = domain + '.pot')
+#
+# explicitly reference the control protocol LGPL library for includes
+#
+
+ardour.Append(CPPPATH = '#libs/surfaces/control_protocol')
+
ardour_files=Split("""
audio_library.cc
audio_playlist.cc
@@ -30,10 +36,8 @@ audioregion.cc
auditioner.cc
automation.cc
automation_event.cc
-basic_ui.cc
configuration.cc
connection.cc
-control_protocol.cc
control_protocol_manager.cc
crossfade.cc
curve.cc
diff --git a/libs/ardour/ardour/basic_ui.h b/libs/ardour/ardour/basic_ui.h
deleted file mode 100644
index a6ab536893..0000000000
--- a/libs/ardour/ardour/basic_ui.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef __ardour_basic_ui_h__
-#define __ardour_basic_ui_h__
-
-namespace ARDOUR {
- class Session;
-}
-
-class BasicUI {
- public:
- BasicUI (ARDOUR::Session&);
- virtual ~BasicUI ();
-
- void add_marker ();
-
- /* transport control */
-
- void loop_toggle ();
- void goto_start ();
- void goto_end ();
- void rewind ();
- void ffwd ();
- void transport_stop ();
- void transport_play ();
- void set_transport_speed (float speed);
- float get_transport_speed (float speed);
-
- void save_state ();
- void prev_marker ();
- void next_marker ();
- void undo ();
- void redo ();
- void toggle_punch_in ();
- void toggle_punch_out ();
-
- void rec_enable_toggle ();
- void toggle_all_rec_enables ();
-
- protected:
- BasicUI ();
- ARDOUR::Session* session;
-};
-
-#endif /* __ardour_basic_ui_h__ */
diff --git a/libs/ardour/ardour/osc.h b/libs/ardour/ardour/osc.h
index 66c28eb8a5..69ec76eac6 100644
--- a/libs/ardour/ardour/osc.h
+++ b/libs/ardour/ardour/osc.h
@@ -31,7 +31,8 @@
#include <sigc++/sigc++.h>
#include <ardour/types.h>
-#include <ardour/basic_ui.h>
+
+#include "basic_ui.h"
namespace ARDOUR {
class Session;
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 57f01bf690..0d968fcff1 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -360,6 +360,9 @@ class Session : public sigc::trackable, public Stateful
void request_diskstream_speed (DiskStream&, float speed);
void request_input_change_handling ();
+ bool locate_pending() const { return static_cast<bool>(post_transport_work&PostTransportLocate); }
+ bool transport_locked () const;
+
int wipe ();
int wipe_diskstream (DiskStream *);
diff --git a/libs/ardour/control_protocol_manager.cc b/libs/ardour/control_protocol_manager.cc
index 123bc5cdb8..ca1eefc3fe 100644
--- a/libs/ardour/control_protocol_manager.cc
+++ b/libs/ardour/control_protocol_manager.cc
@@ -4,10 +4,14 @@
#include <pbd/error.h>
#include <pbd/pathscanner.h>
+#include "control_protocol.h"
+
#include <ardour/session.h>
-#include <ardour/control_protocol.h>
#include <ardour/control_protocol_manager.h>
+
+
+
using namespace ARDOUR;
using namespace PBD;
using namespace std;
@@ -168,18 +172,23 @@ ControlProtocolManager::control_protocol_discover (string path)
if ((descriptor = get_descriptor (path)) != 0) {
- ControlProtocolInfo* info = new ControlProtocolInfo ();
-
- info->descriptor = descriptor;
- info->name = descriptor->name;
- info->path = path;
- info->protocol = 0;
- info->requested = false;
- info->mandatory = descriptor->mandatory;
-
- control_protocol_info.push_back (info);
-
- cerr << "discovered control surface protocol \"" << info->name << '"' << endl;
+ ControlProtocolInfo* cpi = new ControlProtocolInfo ();
+
+ if (!descriptor->probe (descriptor)) {
+ info << string_compose (_("Control protocol %1 not usable"), descriptor->name) << endmsg;
+ } else {
+
+ cpi->descriptor = descriptor;
+ cpi->name = descriptor->name;
+ cpi->path = path;
+ cpi->protocol = 0;
+ cpi->requested = false;
+ cpi->mandatory = descriptor->mandatory;
+
+ control_protocol_info.push_back (cpi);
+
+ info << string_compose(_("Control surface protocol discovered: \"%1\""), cpi->name) << endmsg;
+ }
dlclose (descriptor->module);
}
diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc
index 5bcd595ecc..3280a5f4bb 100644
--- a/libs/ardour/session_process.cc
+++ b/libs/ardour/session_process.cc
@@ -422,6 +422,18 @@ Session::reset_slave_state ()
}
bool
+Session::transport_locked () const
+{
+ Slave* sl = _slave;
+
+ if (!locate_pending() && ((_slave_type == None) || (sl && sl->ok() && sl->locked()))) {
+ return true;
+ }
+
+ return false;
+}
+
+bool
Session::follow_slave (jack_nframes_t nframes, jack_nframes_t offset)
{
float slave_speed;
diff --git a/libs/surfaces/control_protocol/SConscript b/libs/surfaces/control_protocol/SConscript
new file mode 100644
index 0000000000..e3927fa7ac
--- /dev/null
+++ b/libs/surfaces/control_protocol/SConscript
@@ -0,0 +1,54 @@
+# -*- python -*-
+
+import os
+import os.path
+import glob
+
+Import('env final_prefix install_prefix final_config_prefix libraries i18n')
+
+cp = env.Copy()
+
+#
+# this defines the version number of libardour_cp
+#
+
+domain = 'ardour_cp'
+
+cp.Append(DOMAIN = domain, MAJOR = 1, MINOR = 0, MICRO = 0)
+cp.Append(CXXFLAGS = "-DPACKAGE=\\\"" + domain + "\\\"")
+cp.Append(CXXFLAGS="-DLIBSIGC_DISABLE_DEPRECATED")
+cp.Append(PACKAGE = domain)
+cp.Append(POTFILE = domain + '.pot')
+
+cp_files=Split("""
+basic_ui.cc
+control_protocol.cc
+""")
+
+cp.Append(CCFLAGS="-D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE")
+cp.Append(CXXFLAGS="-DDATA_DIR=\\\""+final_prefix+"/share\\\"")
+cp.Append(CXXFLAGS="-DCONFIG_DIR=\\\""+final_config_prefix+"\\\"")
+cp.Append(CXXFLAGS="-DLOCALEDIR=\\\""+final_prefix+"/share/locale\\\"")
+
+cp.Merge ([
+ libraries['ardour'],
+ libraries['sigc2'],
+ libraries['pbd3'],
+ libraries['midi++2'],
+ libraries['xml'],
+ libraries['usb']
+ ])
+
+libardour_cp = cp.SharedLibrary('ardour_cp', cp_files)
+
+Default(libardour_cp)
+
+if env['NLS']:
+ i18n (cp, cp_files, env)
+
+env.Alias('install', env.Install(os.path.join(install_prefix, 'lib/ardour2/surfaces'), libardour_cp))
+
+env.Alias('tarball', env.Distribute (env['DISTTREE'],
+ [ 'SConscript', 'i18n.h', 'gettext.h' ] +
+ cp_files +
+ glob.glob('po/*.po') + glob.glob('*.h')))
diff --git a/libs/ardour/basic_ui.cc b/libs/surfaces/control_protocol/basic_ui.cc
index c9b3fdefac..4519eb2781 100644
--- a/libs/ardour/basic_ui.cc
+++ b/libs/surfaces/control_protocol/basic_ui.cc
@@ -1,10 +1,11 @@
/*
Copyright (C) 2006 Paul Davis
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This program is free software; you can redistribute it
+ and/or modify it under the terms of the GNU Lesser
+ General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your
+ option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -18,10 +19,10 @@
$Id$
*/
-#include <ardour/basic_ui.h>
#include <ardour/session.h>
#include <ardour/location.h>
+#include "basic_ui.h"
#include "i18n.h"
using namespace ARDOUR;
@@ -92,7 +93,7 @@ BasicUI::transport_stop ()
}
void
-BasicUI::transport_play ()
+BasicUI::transport_play (bool from_last_start)
{
bool rolling = session->transport_rolling ();
@@ -104,7 +105,7 @@ BasicUI::transport_play ()
session->request_play_range (false);
}
- if (rolling) {
+ if (from_last_start && rolling) {
session->request_locate (session->last_transport_start(), true);
}
@@ -167,6 +168,12 @@ BasicUI::set_transport_speed (float speed)
session->request_transport_speed (speed);
}
+float
+BasicUI::get_transport_speed ()
+{
+ return session->transport_speed ();
+}
+
void
BasicUI::undo ()
{
@@ -200,3 +207,67 @@ BasicUI::toggle_punch_out ()
{
session->set_punch_out (!session->get_punch_out());
}
+
+bool
+BasicUI::get_record_enabled ()
+{
+ return session->get_record_enabled();
+}
+
+void
+BasicUI::set_record_enable (bool yn)
+{
+ if (yn) {
+ session->maybe_enable_record ();
+ } else {
+ session->disable_record (false, true);
+ }
+}
+
+jack_nframes_t
+BasicUI::transport_frame ()
+{
+ return session->transport_frame();
+}
+
+void
+BasicUI::locate (jack_nframes_t where, bool roll_after_locate)
+{
+ session->request_locate (where, roll_after_locate);
+}
+
+bool
+BasicUI::locating ()
+{
+ return session->locate_pending();
+}
+
+bool
+BasicUI::locked ()
+{
+ return session->transport_locked ();
+}
+
+jack_nframes_t
+BasicUI::smpte_frames_per_hour ()
+{
+ return session->smpte_frames_per_hour ();
+}
+
+void
+BasicUI::smpte_time (jack_nframes_t where, SMPTE_t& smpte)
+{
+ session->smpte_time (where, *((SMPTE_Time *) &smpte));
+}
+
+void
+BasicUI::smpte_to_sample (SMPTE_t& smpte, jack_nframes_t& sample, bool use_offset, bool use_subframes) const
+{
+ session->smpte_to_sample (*((SMPTE_Time*)&smpte), sample, use_offset, use_subframes);
+}
+
+void
+BasicUI::sample_to_smpte (jack_nframes_t sample, SMPTE_t& smpte, bool use_offset, bool use_subframes) const
+{
+ session->sample_to_smpte (sample, *((SMPTE_Time*)&smpte), use_offset, use_subframes);
+}
diff --git a/libs/surfaces/control_protocol/basic_ui.h b/libs/surfaces/control_protocol/basic_ui.h
new file mode 100644
index 0000000000..2db19685b1
--- /dev/null
+++ b/libs/surfaces/control_protocol/basic_ui.h
@@ -0,0 +1,98 @@
+/*
+ Copyright (C) 2006 Paul Davis
+
+ This program is free software; you can redistribute it
+ and/or modify it under the terms of the GNU Lesser
+ General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your
+ option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ $Id$
+*/
+
+#ifndef __ardour_basic_ui_h__
+#define __ardour_basic_ui_h__
+
+#include <jack/types.h>
+
+namespace ARDOUR {
+ class Session;
+}
+
+class BasicUI {
+ public:
+ BasicUI (ARDOUR::Session&);
+ virtual ~BasicUI ();
+
+ void add_marker ();
+
+ /* transport control */
+
+ void loop_toggle ();
+ void goto_start ();
+ void goto_end ();
+ void rewind ();
+ void ffwd ();
+ void transport_stop ();
+ void transport_play (bool jump_back = true);
+ void set_transport_speed (float speed);
+ float get_transport_speed ();
+
+ jack_nframes_t transport_frame ();
+ void locate (jack_nframes_t frame, bool play = false);
+ bool locating ();
+ bool locked ();
+
+ void save_state ();
+ void prev_marker ();
+ void next_marker ();
+ void undo ();
+ void redo ();
+ void toggle_punch_in ();
+ void toggle_punch_out ();
+
+ void set_record_enable (bool yn);
+ bool get_record_enabled ();
+
+ void rec_enable_toggle ();
+ void toggle_all_rec_enables ();
+
+ jack_nframes_t smpte_frames_per_hour ();
+
+ struct SMPTE_t {
+ bool negative;
+ uint32_t hours;
+ uint32_t minutes;
+ uint32_t seconds;
+ uint32_t frames;
+ uint32_t subframes; // mostly not used
+
+ SMPTE_t () {
+ negative = false;
+ hours = 0;
+ minutes = 0;
+ seconds = 0;
+ frames = 0;
+ subframes = 0;
+ }
+ };
+
+ void smpte_time (jack_nframes_t where, SMPTE_t&);
+ void smpte_to_sample (SMPTE_t& smpte, jack_nframes_t& sample, bool use_offset, bool use_subframes) const;
+ void sample_to_smpte (jack_nframes_t sample, SMPTE_t& smpte, bool use_offset, bool use_subframes) const;
+
+ protected:
+ BasicUI ();
+ ARDOUR::Session* session;
+};
+
+#endif /* __ardour_basic_ui_h__ */
diff --git a/libs/ardour/control_protocol.cc b/libs/surfaces/control_protocol/control_protocol.cc
index 1c85df72e5..6407c64385 100644
--- a/libs/ardour/control_protocol.cc
+++ b/libs/surfaces/control_protocol/control_protocol.cc
@@ -1,10 +1,11 @@
/*
Copyright (C) 2006 Paul Davis
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This program is free software; you can redistribute it
+ and/or modify it under the terms of the GNU Lesser
+ General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your
+ option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -18,11 +19,12 @@
$Id$
*/
-#include <ardour/control_protocol.h>
#include <ardour/session.h>
#include <ardour/route.h>
#include <ardour/audio_track.h>
+#include "control_protocol.h"
+
using namespace ARDOUR;
using namespace std;
@@ -135,6 +137,24 @@ ControlProtocol::set_route_table (uint32_t table_index, ARDOUR::Route*)
{
}
+bool
+ControlProtocol::set_route_table (uint32_t table_index, uint32_t remote_control_id)
+{
+ if (table_index >= route_table.size()) {
+ return false;
+ }
+
+ Route* r = session->route_by_remote_id (remote_control_id);
+
+ if (!r) {
+ return false;
+ }
+
+ route_table[table_index] = r;
+
+ return true;
+}
+
void
ControlProtocol::route_set_rec_enable (uint32_t table_index, bool yn)
{
diff --git a/libs/ardour/ardour/control_protocol.h b/libs/surfaces/control_protocol/control_protocol.h
index 38c6261af5..720188c666 100644
--- a/libs/ardour/ardour/control_protocol.h
+++ b/libs/surfaces/control_protocol/control_protocol.h
@@ -1,3 +1,24 @@
+/*
+ Copyright (C) 2006 Paul Davis
+
+ This program is free software; you can redistribute it
+ and/or modify it under the terms of the GNU Lesser
+ General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your
+ option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ $Id$
+*/
+
#ifndef ardour_control_protocols_h
#define ardour_control_protocols_h
@@ -6,7 +27,7 @@
#include <list>
#include <sigc++/sigc++.h>
-#include <ardour/basic_ui.h>
+#include "basic_ui.h"
namespace ARDOUR {
@@ -25,7 +46,6 @@ class ControlProtocol : public sigc::trackable, public BasicUI {
sigc::signal<void> ActiveChanged;
-
/* signals that a control protocol can emit and other (presumably graphical)
user interfaces can respond to
*/
@@ -54,6 +74,7 @@ class ControlProtocol : public sigc::trackable, public BasicUI {
void set_route_table_size (uint32_t size);
void set_route_table (uint32_t table_index, ARDOUR::Route*);
+ bool set_route_table (uint32_t table_index, uint32_t remote_control_id);
void route_set_rec_enable (uint32_t table_index, bool yn);
bool route_get_rec_enable (uint32_t table_index);
@@ -88,6 +109,7 @@ extern "C" {
void* ptr; /* protocol can store a value here */
void* module; /* not for public access */
int mandatory; /* if non-zero, always load and do not make optional */
+ bool (*probe)(ControlProtocolDescriptor*);
ControlProtocol* (*initialize)(ControlProtocolDescriptor*,Session*);
void (*destroy)(ControlProtocolDescriptor*,ControlProtocol*);
diff --git a/libs/surfaces/generic_midi/SConscript b/libs/surfaces/generic_midi/SConscript
index b97a568dc6..9edb76327a 100644
--- a/libs/surfaces/generic_midi/SConscript
+++ b/libs/surfaces/generic_midi/SConscript
@@ -31,13 +31,14 @@ genericmidi.Append(CXXFLAGS="-DCONFIG_DIR=\\\""+final_config_prefix+"\\\"")
genericmidi.Append(CXXFLAGS="-DLOCALEDIR=\\\""+final_prefix+"/share/locale\\\"")
genericmidi.Merge ([
- libraries['ardour'],
- libraries['midi++2'],
- libraries['pbd3'],
- libraries['sigc2'],
- libraries['usb'],
- libraries['xml']
- ])
+ libraries['ardour'],
+ libraries['ardour_cp'],
+ libraries['midi++2'],
+ libraries['pbd3'],
+ libraries['sigc2'],
+ libraries['usb'],
+ libraries['xml']
+ ])
libardour_genericmidi = genericmidi.SharedLibrary('ardour_genericmidi', genericmidi_files)
diff --git a/libs/surfaces/generic_midi/generic_midi_control_protocol.h b/libs/surfaces/generic_midi/generic_midi_control_protocol.h
index ec789815f1..77a4dca805 100644
--- a/libs/surfaces/generic_midi/generic_midi_control_protocol.h
+++ b/libs/surfaces/generic_midi/generic_midi_control_protocol.h
@@ -1,7 +1,7 @@
#ifndef ardour_generic_midi_control_protocol_h
#define ardour_generic_midi_control_protocol_h
-#include <ardour/control_protocol.h>
+#include "control_protocol.h"
namespace MIDI {
class Port;
@@ -15,6 +15,7 @@ class GenericMidiControlProtocol : public ControlProtocol {
virtual ~GenericMidiControlProtocol();
int set_active (bool yn);
+ static bool probe() { return true; }
void set_port (MIDI::Port*);
MIDI::Port* port () const { return _port; }
diff --git a/libs/surfaces/generic_midi/interface.cc b/libs/surfaces/generic_midi/interface.cc
index 4dc7e236ca..625ac65273 100644
--- a/libs/surfaces/generic_midi/interface.cc
+++ b/libs/surfaces/generic_midi/interface.cc
@@ -1,4 +1,4 @@
-#include <ardour/control_protocol.h>
+#include "control_protocol.h"
#include "generic_midi_control_protocol.h"
@@ -23,12 +23,19 @@ delete_generic_midi_protocol (ControlProtocolDescriptor* descriptor, ControlProt
delete cp;
}
+bool
+probe_generic_midi_protocol (ControlProtocolDescriptor* descriptor)
+{
+ return GenericMidiControlProtocol::probe ();
+}
+
static ControlProtocolDescriptor generic_midi_descriptor = {
name : "Generic MIDI",
id : "uri://ardour.org/surfaces/generic_midi:0",
ptr : 0,
module : 0,
mandatory : 0,
+ probe : probe_generic_midi_protocol,
initialize : new_generic_midi_protocol,
destroy : delete_generic_midi_protocol
};
diff --git a/libs/surfaces/tranzport/SConscript b/libs/surfaces/tranzport/SConscript
index 8c92831215..98ecf09d41 100644
--- a/libs/surfaces/tranzport/SConscript
+++ b/libs/surfaces/tranzport/SConscript
@@ -32,12 +32,13 @@ tranzport.Append(CXXFLAGS="-DLOCALEDIR=\\\""+final_prefix+"/share/locale\\\"")
tranzport.Merge ([
libraries['ardour'],
+ libraries['ardour_cp'],
libraries['sigc2'],
libraries['pbd3'],
libraries['midi++2'],
- libraries['xml'],
- libraries['usb']
- ])
+ libraries['xml'],
+ libraries['usb']
+ ])
libardour_tranzport = tranzport.SharedLibrary('ardour_tranzport', tranzport_files)
diff --git a/libs/surfaces/tranzport/interface.cc b/libs/surfaces/tranzport/interface.cc
index bcefd100c3..20f38dce08 100644
--- a/libs/surfaces/tranzport/interface.cc
+++ b/libs/surfaces/tranzport/interface.cc
@@ -1,4 +1,4 @@
-#include <ardour/control_protocol.h>
+#include "control_protocol.h"
#include "tranzport_control_protocol.h"
@@ -24,12 +24,19 @@ delete_tranzport_protocol (ControlProtocolDescriptor* descriptor, ControlProtoco
delete cp;
}
+bool
+probe_tranzport_protocol (ControlProtocolDescriptor* descriptor)
+{
+ return TranzportControlProtocol::probe();
+}
+
static ControlProtocolDescriptor tranzport_descriptor = {
name : "Tranzport",
id : "uri://ardour.org/surfaces/tranzport:0",
ptr : 0,
module : 0,
mandatory : 0,
+ probe : probe_tranzport_protocol,
initialize : new_tranzport_protocol,
destroy : delete_tranzport_protocol
};
diff --git a/libs/surfaces/tranzport/tranzport_control_protocol.cc b/libs/surfaces/tranzport/tranzport_control_protocol.cc
index 5a4c4fc385..61c10440ff 100644
--- a/libs/surfaces/tranzport/tranzport_control_protocol.cc
+++ b/libs/surfaces/tranzport/tranzport_control_protocol.cc
@@ -66,9 +66,7 @@ slider_position_to_gain (double pos)
TranzportControlProtocol::TranzportControlProtocol (Session& s)
- : ControlProtocol (s, X_("Tranzport")),
- AbstractUI<TranzportRequest> (X_("Tranzport"), false)
-
+ : ControlProtocol (s, X_("Tranzport"))
{
/* tranzport controls one track at a time */
@@ -106,6 +104,28 @@ TranzportControlProtocol::~TranzportControlProtocol ()
set_active (false);
}
+bool
+TranzportControlProtocol::probe ()
+{
+ struct usb_bus *bus;
+ struct usb_device *dev;
+
+ usb_init();
+ usb_find_busses();
+ usb_find_devices();
+
+ for (bus = usb_busses; bus; bus = bus->next) {
+
+ for(dev = bus->devices; dev; dev = dev->next) {
+ if (dev->descriptor.idVendor == VENDORID && dev->descriptor.idProduct == PRODUCTID) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
int
TranzportControlProtocol::set_active (bool yn)
{
@@ -559,7 +579,7 @@ TranzportControlProtocol::monitor_work ()
if ((err = pthread_setschedparam (pthread_self(), SCHED_FIFO, &rtparam)) != 0) {
// do we care? not particularly.
- info << string_compose (_("%1: thread not running with realtime scheduling (%2)"), BaseUI::name(), strerror (errno)) << endmsg;
+ info << string_compose (_("%1: thread not running with realtime scheduling (%2)"), name(), strerror (errno)) << endmsg;
}
pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, 0);
@@ -1554,18 +1574,3 @@ TranzportControlProtocol::print (int row, int col, const char *text)
}
}
-bool
-TranzportControlProtocol::caller_is_ui_thread ()
-{
- return (pthread_self() == thread);
-}
-
-void
-TranzportControlProtocol::do_request (TranzportRequest* req)
-{
- if (req->type == SetCurrentTrack) {
- route_table[0] = req->track;
- }
-
- return;
-}
diff --git a/libs/surfaces/tranzport/tranzport_control_protocol.h b/libs/surfaces/tranzport/tranzport_control_protocol.h
index b24a94577a..0311140f8c 100644
--- a/libs/surfaces/tranzport/tranzport_control_protocol.h
+++ b/libs/surfaces/tranzport/tranzport_control_protocol.h
@@ -7,24 +7,12 @@
#include <pbd/lockmonitor.h>
#include <pthread.h>
#include <usb.h>
-#include <ardour/control_protocol.h>
-#include <ardour/types.h>
-#include <pbd/abstract_ui.h>
+#include <ardour/types.h>
-extern BaseUI::RequestType LEDChange;
-extern BaseUI::RequestType Print;
-extern BaseUI::RequestType SetCurrentTrack;
+#include "control_protocol.h"
-struct TranzportRequest : public BaseUI::BaseRequestObject {
- int led;
- int row;
- int col;
- char* text;
- ARDOUR::Route* track;
-};
-
-class TranzportControlProtocol : public ARDOUR::ControlProtocol, public AbstractUI<TranzportRequest>
+class TranzportControlProtocol : public ARDOUR::ControlProtocol
{
public:
TranzportControlProtocol (ARDOUR::Session&);
@@ -32,7 +20,7 @@ class TranzportControlProtocol : public ARDOUR::ControlProtocol, public Abstract
int set_active (bool yn);
- bool caller_is_ui_thread();
+ static bool probe ();
private:
static const int VENDORID = 0x165b;
@@ -107,8 +95,6 @@ class TranzportControlProtocol : public ARDOUR::ControlProtocol, public Abstract
DisplayMode display_mode;
ARDOUR::gain_t gain_fraction;
- void do_request (TranzportRequest*);
-
PBD::Lock update_lock;
char current_screen[2][20];
char pending_screen[2][20];