]> git.tdb.fi Git - libs/demoscene.git/blobdiff - source/sequencer.cpp
Move the Action class out of Sequencer
[libs/demoscene.git] / source / sequencer.cpp
index 4acad43b2891bc9bf813bf481e75277fa0a4bf71..d9d35614dbf4ed9fd897b60e5c5df67ee68d5f11 100644 (file)
@@ -1,5 +1,6 @@
 #include <cmath>
 #include <msp/core/algorithm.h>
+#include "action.h"
 #include "sequencer.h"
 
 using namespace std;
@@ -125,40 +126,3 @@ void Sequencer::update_next_event()
                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);
-}