add basic support for HUI heartbeat, only used for HUI devices
This commit is contained in:
parent
4ef45aacc1
commit
6bf0d4f627
|
@ -428,6 +428,13 @@ MackieControlProtocol::set_active (bool yn)
|
|||
redisplay_connection = redisplay_timeout->connect (sigc::mem_fun (*this, &MackieControlProtocol::redisplay));
|
||||
redisplay_timeout->attach (main_loop()->get_context());
|
||||
|
||||
if (_device_info.device_type() == DeviceInfo::HUI) {
|
||||
Glib::RefPtr<Glib::TimeoutSource> hui_timeout = Glib::TimeoutSource::create (1000); // milliseconds
|
||||
hui_connection = hui_timeout->connect (sigc::mem_fun (*this, &MackieControlProtocol::hui_heartbeat));
|
||||
hui_timeout->attach (main_loop()->get_context());
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
BaseUI::quit ();
|
||||
|
@ -442,6 +449,18 @@ MackieControlProtocol::set_active (bool yn)
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool
|
||||
MackieControlProtocol::hui_heartbeat ()
|
||||
{
|
||||
Glib::Threads::Mutex::Lock lm (surfaces_lock);
|
||||
|
||||
for (Surfaces::iterator s = surfaces.begin(); s != surfaces.end(); ++s) {
|
||||
(*s)->hui_heartbeat ();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
MackieControlProtocol::periodic ()
|
||||
{
|
||||
|
|
|
@ -282,6 +282,7 @@ class MackieControlProtocol
|
|||
Mackie::DeviceProfile _device_profile;
|
||||
sigc::connection periodic_connection;
|
||||
sigc::connection redisplay_connection;
|
||||
sigc::connection hui_connection;
|
||||
uint32_t _current_initial_bank;
|
||||
PBD::ScopedConnectionList audio_engine_connections;
|
||||
PBD::ScopedConnectionList session_connections;
|
||||
|
@ -324,6 +325,7 @@ class MackieControlProtocol
|
|||
int create_surfaces ();
|
||||
bool periodic();
|
||||
bool redisplay();
|
||||
bool hui_heartbeat ();
|
||||
void build_gui ();
|
||||
bool midi_input_handler (Glib::IOCondition ioc, MIDI::Port* port);
|
||||
void clear_ports ();
|
||||
|
|
|
@ -440,8 +440,12 @@ Surface::handle_midi_note_on_message (MIDI::Parser &, MIDI::EventTwoBytes* ev)
|
|||
|
||||
if (_mcp.device_info().no_handshake()) {
|
||||
turn_it_on ();
|
||||
}
|
||||
}
|
||||
|
||||
if (_mcp.device_info().device_type() == DeviceInfo::HUI && ev->note_number == 0 && ev->velocity == 127) {
|
||||
turn_it_on ();
|
||||
}
|
||||
|
||||
/* fader touch sense is given by "buttons" 0xe..0xe7 and 0xe8 for the
|
||||
* master.
|
||||
*/
|
||||
|
@ -1087,3 +1091,14 @@ Surface::set_touch_sensitivity (int sensitivity)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Surface::hui_heartbeat ()
|
||||
{
|
||||
if (!_port) {
|
||||
return;
|
||||
}
|
||||
|
||||
MidiByteArray msg (3, MIDI::on, 0x0, 0x0);
|
||||
_port->write (msg);
|
||||
}
|
||||
|
|
|
@ -87,7 +87,8 @@ public:
|
|||
|
||||
void periodic (uint64_t now_usecs);
|
||||
void redisplay ();
|
||||
|
||||
void hui_heartbeat ();
|
||||
|
||||
void handle_midi_pitchbend_message (MIDI::Parser&, MIDI::pitchbend_t, uint32_t channel_id);
|
||||
void handle_midi_controller_message (MIDI::Parser&, MIDI::EventTwoBytes*);
|
||||
void handle_midi_note_on_message (MIDI::Parser&, MIDI::EventTwoBytes*);
|
||||
|
|
Loading…
Reference in New Issue
Block a user