tweak search path for export profiles
[ardour.git] / libs / surfaces / generic_midi / midicontrollable.h
index b6f7da5639a2e27b3ead47436a08755fadd533f8..2e70e98a751e461c68a7b886accf86e21df2fd3d 100644 (file)
 
 #include "ardour/types.h"
 
-namespace MIDI {
-
-class Channel;
-class Port;
-class Parser;
+namespace PBD {
+       class ControllableDescriptor;
+}
 
+namespace MIDI {
+       class Channel;
+       class Port;
+       class Parser;
 }
 
 class MIDIControllable : public PBD::Stateful
 {
   public:
-       MIDIControllable (MIDI::Port&, PBD::Controllable&, bool bistate = false);
-       MIDIControllable (MIDI::Port&, const std::string& uri, bool bistate = false);
+       MIDIControllable (MIDI::Port&, PBD::Controllable&, bool momentary);
+       MIDIControllable (MIDI::Port&, bool momentary = false);
        virtual ~MIDIControllable ();
 
+       int init (const std::string&);
+
        void rediscover_controllable ();
+       bool bank_relative() const { return _bank_relative; }
+       uint32_t rid() const { return _rid; }
+       std::string what() const { return _what; }
 
-       bool ok() const { return !_current_uri.empty(); }
-       
        void send_feedback ();
        MIDI::byte* write_feedback (MIDI::byte* buf, int32_t& bufsize, bool force = false);
        
@@ -64,11 +69,15 @@ class MIDIControllable : public PBD::Stateful
        float control_to_midi(float val);
        float midi_to_control(float val);
 
+       bool learned() const { return _learned; }
+
        MIDI::Port& get_port() const { return _port; }
        PBD::Controllable* get_controllable() const { return controllable; }
        void set_controllable (PBD::Controllable*);
        const std::string& current_uri() const { return _current_uri; }
 
+       PBD::ControllableDescriptor& descriptor() const { return *_descriptor; }
+
        std::string control_description() const { return _control_description; }
 
        XMLNode& get_state (void);
@@ -81,11 +90,14 @@ class MIDIControllable : public PBD::Stateful
        
   private:
        PBD::Controllable* controllable;
+       PBD::ControllableDescriptor* _descriptor;
        std::string        _current_uri;
        MIDI::Port&     _port;
        bool             setting;
        MIDI::byte       last_value;
-       bool             bistate;
+       bool            _momentary;
+       bool            _is_gain_controller;
+       bool            _learned;
        int              midi_msg_id;      /* controller ID or note number */
        PBD::ScopedConnection midi_sense_connection[2];
        PBD::ScopedConnection midi_learn_connection;
@@ -94,8 +106,9 @@ class MIDIControllable : public PBD::Stateful
        MIDI::channel_t  control_channel;
        std::string     _control_description;
        bool             feedback;
-
-       void init ();
+       uint32_t        _rid;
+       std::string     _what;
+       bool            _bank_relative;
        
        void midi_receiver (MIDI::Parser &p, MIDI::byte *, size_t);
        void midi_sense_note (MIDI::Parser &, MIDI::EventTwoBytes *, bool is_on);