Das BlinkenSendButtons
[ardour.git] / libs / ardour / ardour / slave.h
index 07d7a4cf6af261acfe43a83be27141cdf562a133..43418c576d1a03331b418919ae123c4ba1f7b336 100644 (file)
@@ -25,9 +25,9 @@
 #include <jack/jack.h>
 
 #include <sigc++/signal.h>
-#include <ardour/ardour.h>
-#include <midi++/parser.h>
-#include <midi++/types.h>
+#include "ardour/ardour.h"
+#include "midi++/parser.h"
+#include "midi++/types.h"
 
 namespace MIDI {
        class Port;
@@ -105,7 +105,7 @@ class Slave {
         * @param position - The transport position requested
         * @return - The return value is currently ignored (see Session::follow_slave)
         */
-       virtual bool speed_and_position (float& speed, nframes_t& position) = 0;
+       virtual bool speed_and_position (double& speed, nframes_t& position) = 0;
        
        /**
         * reports to ARDOUR whether the Slave is currently synced to its external 
@@ -174,7 +174,7 @@ class MTC_Slave : public Slave, public sigc::trackable {
        ~MTC_Slave ();
 
        void rebind (MIDI::Port&);
-       bool speed_and_position (float&, nframes_t&);
+       bool speed_and_position (double&, nframes_t&);
 
        bool locked() const;
        bool ok() const;
@@ -194,12 +194,12 @@ class MTC_Slave : public Slave, public sigc::trackable {
        nframes_t   last_inbound_frame;      /* when we got it; audio clocked */
        MIDI::byte  last_mtc_fps_byte;
 
-       float       mtc_speed;
+       double      mtc_speed;
        nframes_t   first_mtc_frame;
        nframes_t   first_mtc_time;
 
        static const int32_t accumulator_size = 128;
-       float   accumulator[accumulator_size];
+       double   accumulator[accumulator_size];
        int32_t accumulator_index;
        bool    have_first_accumulated_speed;
 
@@ -216,7 +216,7 @@ class MIDIClock_Slave : public Slave, public sigc::trackable {
        ~MIDIClock_Slave ();
 
        void rebind (MIDI::Port&);
-       bool speed_and_position (float&, nframes_t&);
+       bool speed_and_position (double&, nframes_t&);
 
        bool locked() const;
        bool ok() const;
@@ -240,9 +240,13 @@ class MIDIClock_Slave : public Slave, public sigc::trackable {
        /// the timestamp of the first MIDI clock message
        nframes_t   first_timestamp;
        
-       /// the time stamp and transport position of the last inbound MIDI clock message
+       /// the time stamp and should-be transport position of the last inbound MIDI clock message
        nframes_t   last_timestamp;
-       double      last_position;
+       double      should_be_position;
+       
+       /// the number of midi clock messages received (zero-based)
+       /// since start
+       long midi_clock_count;
        
        //the delay locked loop (DLL), see www.kokkinizita.net/papers/usingdll.pdf
        
@@ -266,10 +270,12 @@ class MIDIClock_Slave : public Slave, public sigc::trackable {
        
        void reset ();
        void start (MIDI::Parser& parser, nframes_t timestamp);
+       void contineu (MIDI::Parser& parser, nframes_t timestamp);
        void stop (MIDI::Parser& parser, nframes_t timestamp);
+       void position (MIDI::Parser& parser, MIDI::byte* message, size_t size);
        // we can't use continue because it is a C++ keyword
-       void contineu (MIDI::Parser& parser, nframes_t timestamp);
        void calculate_one_ppqn_in_frames_at(nframes_t time);
+       nframes_t calculate_song_position(uint16_t song_position_in_sixteenth_notes);
        void calculate_filter_coefficients();
        void update_midi_clock (MIDI::Parser& parser, nframes_t timestamp);
        void read_current (SafeTime *) const;
@@ -289,7 +295,7 @@ class ADAT_Slave : public Slave
        ADAT_Slave () {}
        ~ADAT_Slave () {}
 
-       bool speed_and_position (float& speed, nframes_t& pos) {
+       bool speed_and_position (double& speed, nframes_t& pos) {
                speed = 0;
                pos = 0;
                return false;
@@ -307,7 +313,7 @@ class JACK_Slave : public Slave
        JACK_Slave (jack_client_t*);
        ~JACK_Slave ();
 
-       bool speed_and_position (float& speed, nframes_t& pos);
+       bool speed_and_position (double& speed, nframes_t& pos);
 
        bool starting() const { return _starting; }
        bool locked() const;
@@ -319,7 +325,7 @@ class JACK_Slave : public Slave
 
   private:
        jack_client_t* jack;
-       float speed;
+       double speed;
        bool _starting;
 };