#pragma once\r
\r
#include <functional>\r
+#include <vector>\r
\r
namespace caspar { namespace core {\r
\r
+/**\r
+ * A tweener can be used for creating any kind of (image position, image fade\r
+ * in/out, audio volume etc) transition, by invoking it for each temporal\r
+ * timepoint when a tweened value is needed.\r
+ *\r
+ * For video the temporal resolution will usually be each frame or field (for\r
+ * interlaced material).\r
+ *\r
+ * For audio the smoothest transitions will be generated by using the samplerate\r
+ * as temporal resolution, but using the video frame/field rate is probably fine\r
+ * most of the times and much less time consuming.\r
+ */\r
class tweener\r
{\r
public:\r
+ /**\r
+ * Constructor.\r
+ *\r
+ * @param name The name of the tween function to use.\r
+ */\r
tweener(const std::wstring& name = L"linear");\r
tweener(const wchar_t* name);\r
+\r
+ /**\r
+ * @return The possible tween function names. Some of them may also support\r
+ * additional parameters appended to the name.\r
+ */\r
+ static const std::vector<std::wstring>& names();\r
+\r
+ /**\r
+ * Calculate a tweened value given a timepoint within the total duration\r
+ * and the starting value and the destination delta value.\r
+ *\r
+ * Usually b, c and d remains constant during a transition, while t changes\r
+ * for each temporal tweened value.\r
+ * \r
+ * @param t The timepoint within the total duration (0 <= n <= d).\r
+ * @param b The starting value.\r
+ * @param c The destination value delta from the starting value\r
+ * (absolute destination value - b).\r
+ * @param d The total duration (when t = d, the destination value should\r
+ * have been reached).\r
+ *\r
+ * @return The tweened value for the given timepoint. Can sometimes be less\r
+ * than b or greater than b + c for some tweener functions.\r
+ */\r
double operator()(double t, double b , double c, double d) const;\r
private:\r
std::function<double(double, double, double, double)> func_;\r