--- /dev/null
+#include "action.h"
+
+InterpolationAction::InterpolationAction(bool h):
+ hermite(h),
+ start_beat(0),
+ duration(0)
+{ }
+
+void InterpolationAction::start(float b, float d)
+{
+ start_beat = b;
+ duration = d;
+ interpolate(0.0f, 0.0f);
+}
+
+void 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 InterpolationAction::end(float)
+{
+ interpolate(1.0f, 0.0f);
+}