2013-11-24 16:10:48 +01:00
|
|
|
#pragma once
|
|
|
|
|
2013-11-30 17:41:38 +01:00
|
|
|
// Json includes
|
|
|
|
#include <json/value.h>
|
|
|
|
|
|
|
|
// Hyperion includes
|
2013-11-24 16:10:48 +01:00
|
|
|
#include <hyperion/Hyperion.h>
|
|
|
|
|
2013-11-26 21:38:24 +01:00
|
|
|
// pre-declarioation
|
|
|
|
class Effect;
|
2013-11-29 23:22:49 +01:00
|
|
|
typedef struct _ts PyThreadState;
|
2013-11-26 21:38:24 +01:00
|
|
|
|
2013-11-24 16:10:48 +01:00
|
|
|
class EffectEngine : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2013-11-30 12:42:08 +01:00
|
|
|
EffectEngine(Hyperion * hyperion, const Json::Value & jsonEffectConfig);
|
2013-11-24 16:10:48 +01:00
|
|
|
virtual ~EffectEngine();
|
|
|
|
|
|
|
|
std::list<std::string> getEffects() const;
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
/// Run the specified effect on the given priority channel and optionally specify a timeout
|
|
|
|
int runEffect(const std::string &effectName, int priority, int timeout = -1);
|
|
|
|
|
|
|
|
/// Clear any effect running on the provided channel
|
|
|
|
void channelCleared(int priority);
|
|
|
|
|
|
|
|
/// Clear all effects
|
|
|
|
void allChannelsCleared();
|
|
|
|
|
2013-11-30 00:28:04 +01:00
|
|
|
public:
|
|
|
|
struct EffectDefinition
|
|
|
|
{
|
|
|
|
std::string script;
|
2013-11-30 17:41:38 +01:00
|
|
|
Json::Value args;
|
2013-11-30 00:28:04 +01:00
|
|
|
};
|
|
|
|
|
2013-11-26 21:38:24 +01:00
|
|
|
private slots:
|
|
|
|
void effectFinished(Effect * effect);
|
|
|
|
|
2013-11-24 16:10:48 +01:00
|
|
|
private:
|
|
|
|
Hyperion * _hyperion;
|
|
|
|
|
2013-11-30 00:28:04 +01:00
|
|
|
std::map<std::string, EffectDefinition> _availableEffects;
|
2013-11-26 21:38:24 +01:00
|
|
|
|
|
|
|
std::list<Effect *> _activeEffects;
|
2013-11-29 23:22:49 +01:00
|
|
|
|
|
|
|
PyThreadState * _mainThreadState;
|
2013-11-24 16:10:48 +01:00
|
|
|
};
|