cruft removal from faderport code
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 25 Nov 2015 18:36:52 +0000 (13:36 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 25 Nov 2015 18:37:00 +0000 (13:37 -0500)
libs/surfaces/faderport/faderport.cc
libs/surfaces/faderport/faderport.h
libs/surfaces/faderport/gui.cc

index e99978f359ccd848fe4b36b40d78652cc3df4853..8bf93572e39c6235771c428844e57c0995df110b 100644 (file)
@@ -62,8 +62,6 @@ using namespace std;
 FaderPort::FaderPort (Session& s)
        : ControlProtocol (s, _("Faderport"))
        , AbstractUI<FaderPortRequest> ("faderport")
-       , _motorised (true)
-       , _threshold (10)
        , gui (0)
        , connection_state (ConnectionState (0))
        , _device_active (false)
@@ -86,19 +84,8 @@ FaderPort::FaderPort (Session& s)
                throw failed_constructor();
        }
 
-       do_feedback = false;
-       _feedback_interval = 10 * 1000; // microseconds
-       last_feedback_time = 0;
-       native_counter = 0;
-
-       _current_bank = 0;
-       _bank_size = 0;
-
        TrackSelectionChanged.connect (selection_connection, MISSING_INVALIDATOR, boost::bind (&FaderPort::gui_track_selection_changed, this, _1), this);
 
-       Session::SendFeedback.connect_same_thread (*this, boost::bind (&FaderPort::send_feedback, this));
-       //Session::SendFeedback.connect (*this, MISSING_INVALIDATOR, boost::bind (&FaderPort::send_feedback, this), this);;
-
        /* Catch port connections and disconnections */
        ARDOUR::AudioEngine::instance()->PortConnectedOrDisconnected.connect (port_connection, MISSING_INVALIDATOR, boost::bind (&FaderPort::connection_handler, this, _1, _2, _3, _4, _5), this);
 
@@ -471,33 +458,6 @@ FaderPort::connect_session_signals()
        session->TransportStateChange.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::notify_transport_state_changed, this), this);
 }
 
-void
-FaderPort::set_feedback_interval (microseconds_t ms)
-{
-       _feedback_interval = ms;
-}
-
-void
-FaderPort::send_feedback ()
-{
-       /* This is executed in RT "process" context", so no blocking calls
-        */
-
-       if (!do_feedback) {
-               return;
-       }
-
-       microseconds_t now = get_microseconds ();
-
-       if (last_feedback_time != 0) {
-               if ((now - last_feedback_time) < _feedback_interval) {
-                       return;
-               }
-       }
-
-       last_feedback_time = now;
-}
-
 bool
 FaderPort::midi_input_handler (Glib::IOCondition ioc, boost::shared_ptr<ARDOUR::AsyncMIDIPort> port)
 {
@@ -569,60 +529,6 @@ FaderPort::set_state (const XMLNode& node, int version)
        return 0;
 }
 
-int
-FaderPort::set_feedback (bool yn)
-{
-       do_feedback = yn;
-       last_feedback_time = 0;
-       return 0;
-}
-
-bool
-FaderPort::get_feedback () const
-{
-       return do_feedback;
-}
-
-void
-FaderPort::set_current_bank (uint32_t b)
-{
-       _current_bank = b;
-//     reset_controllables ();
-}
-
-void
-FaderPort::next_bank ()
-{
-       _current_bank++;
-//     reset_controllables ();
-}
-
-void
-FaderPort::prev_bank()
-{
-       if (_current_bank) {
-               _current_bank--;
-//             reset_controllables ();
-       }
-}
-
-void
-FaderPort::set_motorised (bool m)
-{
-       _motorised = m;
-}
-
-void
-FaderPort::set_threshold (int t)
-{
-       _threshold = t;
-}
-
-void
-FaderPort::reset_controllables ()
-{
-}
-
 bool
 FaderPort::connection_handler (boost::weak_ptr<ARDOUR::Port>, std::string name1, boost::weak_ptr<ARDOUR::Port>, std::string name2, bool yn)
 {
index b88fb305b61c759f89945cf34af37b98616efb0c..471c0ab4d88a58046147d96edf63a48eafe757ba 100644 (file)
@@ -79,19 +79,11 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq
 
        int set_active (bool yn);
 
-       /* It would be nice to send a device query message here to see if
-        * faderport is out there. But the probe() API doesn't provide
-        * a set of ports to be checked, so there's really no nice
-        * way to do this. We would have to fall back on the PortManager
-        * and get a list of all physical ports. Could be done ....
+       /* we probe for a device when our ports are connected. Before that,
+          there's no way to know if the device exists or not.
         */
        static bool probe() { return true; }
 
-       void set_feedback_interval (ARDOUR::microseconds_t);
-
-       int set_feedback (bool yn);
-       bool get_feedback () const;
-
        XMLNode& get_state ();
        int set_state (const XMLNode&, int version);
 
@@ -99,25 +91,10 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq
        void* get_gui () const;
        void  tear_down_gui ();
 
-       void set_current_bank (uint32_t);
-       void next_bank ();
-       void prev_bank ();
-
-       void reset_controllables ();
-
-       void set_motorised (bool);
-
-       bool motorised () const {
-               return _motorised;
-       }
-
-       void set_threshold (int);
-
-       int threshold () const {
-               return _threshold;
-       }
-
-       bool device_active() const { return _device_active; }
+       /* Note: because the FaderPort speaks an inherently duplex protocol,
+          we do not implement get/set_feedback() since this aspect of
+          support for the protocol is not optional.
+       */
 
        void do_request (FaderPortRequest*);
        int stop ();
@@ -129,28 +106,10 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq
        boost::shared_ptr<ARDOUR::AsyncMIDIPort> _input_port;
        boost::shared_ptr<ARDOUR::AsyncMIDIPort> _output_port;
 
-       ARDOUR::microseconds_t _feedback_interval;
-       ARDOUR::microseconds_t last_feedback_time;
-       int native_counter;
-
-       bool  do_feedback;
-       void  send_feedback ();
-
        PBD::ScopedConnectionList midi_connections;
 
        bool midi_input_handler (Glib::IOCondition ioc, boost::shared_ptr<ARDOUR::AsyncMIDIPort> port);
 
-       std::string _current_binding;
-       uint32_t _bank_size;
-       uint32_t _current_bank;
-       /** true if this surface is motorised.  If it is, we assume
-           that the surface's controls are never out of sync with
-           Ardour's state, so we don't have to take steps to avoid
-           values jumping around when things are not in sync.
-       */
-       bool _motorised;
-       int _threshold;
-
        mutable void *gui;
        void build_gui ();
 
index c32c855304bf846d330501e23a172d330044662c..b5c9e2c0e6d54ac0dde717775db2d4786966cbb7 100644 (file)
@@ -46,16 +46,6 @@ public:
 private:
        FaderPort& cp;
        Gtk::ComboBoxText map_combo;
-       Gtk::Adjustment bank_adjustment;
-       Gtk::SpinButton bank_spinner;
-       Gtk::CheckButton motorised_button;
-       Gtk::Adjustment threshold_adjustment;
-       Gtk::SpinButton threshold_spinner;
-
-       void binding_changed ();
-       void bank_changed ();
-       void motorised_changed ();
-       void threshold_changed ();
 };
 
 }
@@ -101,11 +91,6 @@ FaderPort::build_gui ()
 
 GMCPGUI::GMCPGUI (FaderPort& p)
        : cp (p)
-       , bank_adjustment (1, 1, 100, 1, 10)
-       , bank_spinner (bank_adjustment)
-       , motorised_button ("Motorised")
-       , threshold_adjustment (p.threshold(), 1, 127, 1, 10)
-       , threshold_spinner (threshold_adjustment)
 {
 }
 
@@ -113,26 +98,3 @@ GMCPGUI::~GMCPGUI ()
 {
 }
 
-void
-GMCPGUI::bank_changed ()
-{
-//     int new_bank = bank_adjustment.get_value() - 1;
-//     cp.set_current_bank (new_bank);
-}
-
-void
-GMCPGUI::binding_changed ()
-{
-}
-
-void
-GMCPGUI::motorised_changed ()
-{
-//     cp.set_motorised (motorised_button.get_active ());
-}
-
-void
-GMCPGUI::threshold_changed ()
-{
-//     cp.set_threshold (threshold_adjustment.get_value());
-}