This makes it clearer what kind of interpolation is used and allows
adding other types in the future.
#include "action.h"
-InterpolationAction::InterpolationAction(bool h):
- hermite(h),
+InterpolationAction::InterpolationAction(Mode m):
+ mode(m),
start_beat(0),
duration(0)
{ }
{
float t = (b-start_beat)/duration;
float dt = d/duration;
- if(hermite)
+ if(mode==HERMITE)
{
dt = t-dt;
t = (3-2*t)*t*t;
class InterpolationAction: public Action
{
protected:
- bool hermite;
+ enum Mode
+ {
+ LINEAR,
+ HERMITE
+ };
+
+ Mode mode;
float start_beat;
float duration;
- InterpolationAction(bool = false);
+ InterpolationAction(Mode = LINEAR);
public:
virtual void start(float, float);
using namespace Msp;
ColorFadeAction::ColorFadeAction(const GL::Color &c):
- InterpolationAction(true),
+ InterpolationAction(HERMITE),
end_color(c)
{ }