substantial overhaul of MCU code - no more separate thread, just connect to signals...
[ardour.git] / libs / surfaces / mackie / mackie_port.h
index 2ad5cf61548e10056ae389567525c3e260419f72..292fc2ac13866862c557468d1baede77e1ee3103 100644 (file)
 #ifndef mackie_port_h
 #define mackie_port_h
 
-#include "surface_port.h"
-
 #include <midi++/types.h>
-#include <sigc++/signal.h>
-#include <sigc++/connection.h>
-
 #include <glibmm/thread.h>
 
+#include "pbd/signals.h"
+
+#include "surface_port.h"
 #include "midi_byte_array.h"
 #include "types.h"
 
@@ -55,12 +53,12 @@ public:
        virtual const MidiByteArray & sysex_hdr() const;
 
        /// Handle device initialisation
-       void handle_midi_sysex( MIDI::Parser &, MIDI::byte *, size_t );
+       void handle_midi_sysex( MIDI::Parser &, MIDI::byte *, size_t count );
 
        /// Handle all control messags
-       void handle_midi_any( MIDI::Parser &, MIDI::byte *, size_t );
+       void handle_midi_any( MIDI::Parser &, MIDI::byte *, size_t count );
        
-       Control & lookup_control( const MidiByteArray & bytes );
+       Control & lookup_control( MIDI::byte *, size_t count );
        
        /// return the number of strips associated with this port
        virtual int strips() const;
@@ -71,6 +69,10 @@ public:
        
        emulation_t emulation() const { return _emulation; }
        
+       /// Connect the any signal from the parser to handle_midi_any
+       /// unless it's already connected
+       void connect_any();
+       
 protected:
        /**
                The initialisation sequence is fairly complex. First a lock is acquired
@@ -105,11 +107,15 @@ protected:
        */
        void probe_emulation( const MidiByteArray & bytes );
 
+       /// Handle timeout events set for controls that don't emit
+       /// an off event
+       bool handle_control_timeout_event ( Control * );
+
 private:
        MackieControlProtocol & _mcp;
        port_type_t _port_type;
-       sigc::connection _any;
-       sigc::connection _sysex;
+       PBD::ScopedConnection any_connection;
+       PBD::ScopedConnection sysex_connection;
        emulation_t _emulation;
 
        bool _initialising;