65 lines
1.6 KiB
C++
65 lines
1.6 KiB
C++
#ifndef COREOGRAPHY_COREOGRAPHER_HPP
|
|
#define COREOGRAPHY_COREOGRAPHER_HPP
|
|
|
|
#include "esp_timer.h"
|
|
#include "../steppers.hpp"
|
|
#include "interpolation.hpp"
|
|
|
|
class Coreographer{
|
|
int64_t last_tick;
|
|
protected:
|
|
int64_t get_last_tick();
|
|
int64_t get_current_tick();
|
|
int64_t update_last_tick();
|
|
int64_t since_last_tick(bool=true);
|
|
Coreographer();
|
|
int minl=0;
|
|
int maxl=0;
|
|
int minr=1;
|
|
int maxr=1;
|
|
public:
|
|
virtual ~Coreographer() = default;
|
|
virtual void setup_stepper(SmartStepper* l_stepper, SmartStepper* r_stepper, int rhythm) = 0;
|
|
void set_boundaries(int, int, int, int);
|
|
};
|
|
|
|
class CoreographerHoldingPosition: public Coreographer{
|
|
float target_l;
|
|
float target_r;
|
|
public:
|
|
CoreographerHoldingPosition(float, float);
|
|
void setup_stepper(SmartStepper*, SmartStepper*, int);
|
|
};
|
|
|
|
class CoreographerHoldingAbsolutePosition: public Coreographer{
|
|
int target_l;
|
|
int target_r;
|
|
public:
|
|
CoreographerHoldingAbsolutePosition(int, int);
|
|
void setup_stepper(SmartStepper*, SmartStepper*, int);
|
|
};
|
|
|
|
class TimelineElement;
|
|
bool tecmp(const std::unique_ptr<TimelineElement>&, const std::unique_ptr<TimelineElement>&);
|
|
|
|
class TimelineElement {
|
|
public:
|
|
float l;
|
|
float r;
|
|
float t;
|
|
std::unique_ptr<Interpolation> i;
|
|
TimelineElement(float, float, float, Interpolation*);
|
|
};
|
|
|
|
class TimelineCoreographer: public Coreographer{
|
|
int bpm_divider;
|
|
double normalized_position = 0;
|
|
std::vector<std::unique_ptr<TimelineElement>> elements;
|
|
public:
|
|
TimelineCoreographer(std::string);
|
|
void setup_stepper(SmartStepper*, SmartStepper*, int);
|
|
};
|
|
|
|
|
|
#endif
|