#pragma once #include "spit_object.hpp" #include namespace spit { class SPlayer { //----- PlayObject used in PlaySequences: PlaySPITStart, PlaySPITObject,..., PlaySPITEnd ------ public: enum PTypes { // diescrete player: This player is used to transmit single discrete values. PTYPE_DISCRETE = 0x00, // continous player: This player plays SPIT objects sometime during the project. PTYPE_CONTINOUS = 0x01, // continous main player: time value can be used like a timecode.
The time value is the position in server's project.
A server should use only one main player. PTYPE_MAIN = 0x02, }; enum VFlags { // Set the given value directly VFLAG_DIRECT = 0x00, // Increase the existing value by the given value.
This is usefull e.g. when instead of a fader a endless wheel is used*/ VFLAG_INCREASE = 0x01, // Decrease the existing value by the given value.
This is usefull e.g. when instead of a fader a endless wheel is used*/ VFLAG_DECREASE = 0x02, }; class PlayType { public: PlayType(SPlayer *spitPlayer, string spitObjectID); PlayType(const PlayType &orig); string getSPITTypeID() const { return mSpitTypeID; } void startPlaySequence(); bool getIsNew() const { return mIsNew; } void setIsNew(bool isNew) { mIsNew = isNew; } bool getIsPlayed() const { return mIsPlayed; } void setIsPlayed(bool p_IsFound) { mIsPlayed = p_IsFound; } string getPlayerID() const { return mPlayerID; } string getPlayerName() const { return mPlayerName; } bool getPlayerIsRunning() const { return mPlayerRuns; } void setPlayerIsRunning(bool playerRuns) { mPlayerRuns = playerRuns; } void setValue(double value) { mValue = value; } void addValue(double value, double valueFactor) { mValue += (value * valueFactor); } double getValue() const { return mValue; } private: string mPlayerID; string mPlayerName; bool mPlayerRuns; string mSpitTypeID; bool mIsPlayed; bool mIsNew; double mValue; }; //----- SPlayer ------ public: // list the SPITPlayers static unordered_map> sSpitPlayers; // all actual played objects static SPlayer &getSPITPlayer(string pPlayerID); // if a player does not exist creates a new one static void clearPlayers() { sSpitPlayers.clear(); } SPlayer(string pPlayerID); virtual ~SPlayer(); void startPlaySequence(); // called by SPIT_Client::parsePlaySPITStart PlayType *addTypePlaying(string spitTypeID); // called by SPIT_Client::parsePlaySPITStart void endPlaySequence(); // called by SPIT_Client::parsePlaySPITEnd string getID() { return mId; } unordered_map> &getPlaySPITTypes() { return mPlaySPITTypes; } void setIsRunning(bool isRunning) { mIsRunning = isRunning; } void setName(string name) { mName = name; } void setType(char type) { mType = type; } void setTime(uint64_t frames) { mTimeFrames = frames; } bool getIsRunning() const { return mIsRunning; } string getName() const { return mName; } char getType() const { return mType; } uint64_t getTime() const { return mTimeFrames; } private: string mId; string mName; char mType; unordered_map> mPlaySPITTypes; bool mIsRunning; uint64_t mTimeFrames; }; } // namespace spit