X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fardour%2Fpi_controller.h;h=a118fd739f2d722382d4dc945908b036b6d358e8;hb=2a6dcddcc513fa3ebc1aad4b2e5fede62277aba5;hp=f992e6a18c1924297c8a6b65c15c008d7e197f02;hpb=c17b4a30a51f891a8f6dd080969532c5562f493e;p=ardour.git diff --git a/libs/ardour/ardour/pi_controller.h b/libs/ardour/ardour/pi_controller.h index f992e6a18c..a118fd739f 100644 --- a/libs/ardour/ardour/pi_controller.h +++ b/libs/ardour/ardour/pi_controller.h @@ -19,6 +19,8 @@ #ifndef __libardour_pi_controller__ #define __libardour_pi_controller__ +#include "ardour/types.h" + class PIController { public: @@ -31,7 +33,7 @@ class PIController { out_of_bounds (); } - double get_ratio (int fill_level); + double get_ratio (int fill_level, int period_size); void out_of_bounds(); public: @@ -48,6 +50,35 @@ class PIController { int smooth_size; double smooth_offset; double current_resample_factor; + bool fir_empty; }; +#define ESTIMATOR_SIZE 16 + +class PIChaser { + public: + PIChaser(); + ~PIChaser(); + + double get_ratio( framepos_t chasetime_measured, framepos_t chasetime, framepos_t slavetime_measured, framepos_t slavetime, bool in_control, int period_size ); + void reset(); + framepos_t want_locate() { return want_locate_val; } + + private: + PIController *pic; + framepos_t realtime_stamps[ESTIMATOR_SIZE]; + framepos_t chasetime_stamps[ESTIMATOR_SIZE]; + int array_index; + framepos_t want_locate_val; + + void feed_estimator( framepos_t realtime, framepos_t chasetime ); + double get_estimate(); + + double speed; + + double speed_threshold; + framepos_t pos_threshold; +}; + + #endif /* __libardour_pi_controller__ */