#include <cmath>
#include <msp/core/algorithm.h>
+#include "action.h"
#include "sequencer.h"
using namespace std;
if(i->end_beat>beat)
next_event = min(next_event, i->end_beat);
}
-
-
-Sequencer::InterpolationAction::InterpolationAction(bool h):
- hermite(h),
- start_beat(0),
- duration(0)
-{ }
-
-void Sequencer::InterpolationAction::start(float b, float d)
-{
- start_beat = b;
- duration = d;
- interpolate(0.0f, 0.0f);
-}
-
-void Sequencer::InterpolationAction::tick(float b, float d)
-{
- if(duration)
- {
- float t = (b-start_beat)/duration;
- float dt = d/duration;
- if(hermite)
- {
- dt = t-dt;
- t = (3-2*t)*t*t;
- dt = t-(3-2*dt)*dt*dt;
- }
- interpolate(t, dt);
- }
- else
- interpolate(1.0f, 1.0f);
-}
-
-void Sequencer::InterpolationAction::end(float)
-{
- interpolate(1.0f, 0.0f);
-}