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