2006-04-04 03:26:08 +00:00
|
|
|
#ifndef ardour_generic_midi_control_protocol_h
|
|
|
|
|
#define ardour_generic_midi_control_protocol_h
|
|
|
|
|
|
2006-07-10 20:01:47 +00:00
|
|
|
#include <set>
|
2006-07-07 23:51:30 +00:00
|
|
|
#include <glibmm/thread.h>
|
|
|
|
|
#include <ardour/types.h>
|
|
|
|
|
|
2006-06-15 21:54:26 +00:00
|
|
|
#include <control_protocol/control_protocol.h>
|
2006-04-04 03:26:08 +00:00
|
|
|
|
|
|
|
|
namespace MIDI {
|
|
|
|
|
class Port;
|
|
|
|
|
}
|
|
|
|
|
|
2006-07-07 23:51:30 +00:00
|
|
|
namespace PBD {
|
|
|
|
|
class Controllable;
|
|
|
|
|
}
|
|
|
|
|
|
2006-04-04 03:26:08 +00:00
|
|
|
namespace ARDOUR {
|
2006-07-07 23:51:30 +00:00
|
|
|
class Session;
|
|
|
|
|
}
|
2006-04-04 03:26:08 +00:00
|
|
|
|
2006-07-07 23:51:30 +00:00
|
|
|
class MIDIControllable;
|
|
|
|
|
|
|
|
|
|
class GenericMidiControlProtocol : public ARDOUR::ControlProtocol {
|
2006-04-04 03:26:08 +00:00
|
|
|
public:
|
2006-07-07 23:51:30 +00:00
|
|
|
GenericMidiControlProtocol (ARDOUR::Session&);
|
2006-04-04 03:26:08 +00:00
|
|
|
virtual ~GenericMidiControlProtocol();
|
|
|
|
|
|
2006-04-24 22:45:19 +00:00
|
|
|
int set_active (bool yn);
|
2006-05-23 19:54:52 +00:00
|
|
|
static bool probe() { return true; }
|
2006-04-04 03:26:08 +00:00
|
|
|
|
|
|
|
|
MIDI::Port* port () const { return _port; }
|
2006-07-07 23:51:30 +00:00
|
|
|
void set_feedback_interval (ARDOUR::microseconds_t);
|
2006-04-04 03:26:08 +00:00
|
|
|
|
2006-10-09 15:50:44 +00:00
|
|
|
int set_feedback (bool yn);
|
|
|
|
|
bool get_feedback () const;
|
|
|
|
|
|
2006-07-10 20:01:47 +00:00
|
|
|
XMLNode& get_state ();
|
|
|
|
|
int set_state (const XMLNode&);
|
|
|
|
|
|
2006-04-04 03:26:08 +00:00
|
|
|
private:
|
|
|
|
|
MIDI::Port* _port;
|
2006-07-07 23:51:30 +00:00
|
|
|
ARDOUR::microseconds_t _feedback_interval;
|
|
|
|
|
ARDOUR::microseconds_t last_feedback_time;
|
2006-04-10 03:54:00 +00:00
|
|
|
|
2006-10-09 15:50:44 +00:00
|
|
|
bool do_feedback;
|
2006-07-07 23:51:30 +00:00
|
|
|
void _send_feedback ();
|
|
|
|
|
void send_feedback ();
|
2006-04-04 03:26:08 +00:00
|
|
|
|
2006-07-10 20:01:47 +00:00
|
|
|
typedef std::set<MIDIControllable*> MIDIControllables;
|
2006-07-07 23:51:30 +00:00
|
|
|
MIDIControllables controllables;
|
|
|
|
|
MIDIControllables pending_controllables;
|
|
|
|
|
Glib::Mutex controllables_lock;
|
|
|
|
|
Glib::Mutex pending_lock;
|
|
|
|
|
|
|
|
|
|
bool start_learning (PBD::Controllable*);
|
|
|
|
|
void stop_learning (PBD::Controllable*);
|
|
|
|
|
|
|
|
|
|
void learning_stopped (MIDIControllable*);
|
|
|
|
|
};
|
2006-04-04 03:26:08 +00:00
|
|
|
|
2006-07-07 23:51:30 +00:00
|
|
|
#endif /* ardour_generic_midi_control_protocol_h */
|