#include <sequenceplayer.h>
Public Member Functions | |
SequencePlayer (SequenceService &service) | |
bool | init (utility::ErrorState &errorState) override |
bool | save (const std::string &name, utility::ErrorState &errorState) |
bool | load (const std::string &name, utility::ErrorState &errorState) |
bool | loadBinary (const std::vector< nap::uint8 > &buffer, utility::ErrorState &errorState) |
void | setIsPlaying (bool isPlaying) |
void | setIsPaused (bool isPaused) |
void | setIsLooping (bool isLooping) |
void | setPlayerTime (double time) |
void | setPlaybackSpeed (float speed) |
double | getPlayerTime () const |
double | getDuration () const |
bool | getIsPlaying () const |
bool | getIsLooping () const |
bool | getIsPaused () const |
float | getPlaybackSpeed () const |
void | stop () override |
bool | start (utility::ErrorState &errorState) override |
const Sequence & | getSequenceConst () const |
const std::string & | getSequenceFilename () const |
![]() | |
Resource () | |
![]() | |
Object () | |
virtual | ~Object () |
virtual void | onDestroy () |
Object (Object &)=delete | |
Object & | operator= (const Object &)=delete |
Object (Object &&)=delete | |
Object & | operator= (Object &&)=delete |
Public Attributes | |
Signal< SequencePlayer &, float > | playbackSpeedChanged |
Signal< SequencePlayer &, double > | playerTimeChanged |
Signal< SequencePlayer &, bool > | playStateChanged |
Signal< SequencePlayer &, bool > | pauseStateChanged |
Signal< SequencePlayer & > | preTick |
Signal< SequencePlayer & > | postTick |
Signal< SequencePlayer &, std::string > | sequenceLoaded |
Signal< SequencePlayer & > | edited |
std::string | mSequenceFileName |
Property: 'Default Sequence' linked default Sequence file. More... | |
bool | mCreateEmptySequenceOnLoadFail = true |
Property: 'Create Sequence on Failure' when true, the init will successes upon failure of loading default sequence and create an empty sequence. More... | |
std::vector< ResourcePtr< SequencePlayerOutput > > | mOutputs |
Property: 'Outputs' linked outputs. More... | |
ResourcePtr< SequencePlayerClock > | mClock |
Property: 'Clock' Controls timing of playback. More... | |
![]() | |
std::string | mID |
Property: 'mID' unique name of the object. Used as an identifier by the system. More... | |
Protected Attributes | |
Signal< std::function< void(const std::string &, std::unique_ptr< SequencePlayerAdapter >)> & > | adaptersCreated |
SequenceService & | mService |
Additional Inherited Members | |
![]() | |
static bool | isIDProperty (rtti::Instance &object, const rtti::Property &property) |
The sequence player is responsible for loading / playing and saving a sequence The player dispatches a thread which reads the sequence. Actions for each track of the sequence are handle by SequencePlayerAdapters A Sequence can only be edited by a derived class from SequenceController and SequenceEditor Sequence Player owns all Sequence objects
SequencePlayer | ( | SequenceService & | service | ) |
Constructor used by factory
double getDuration | ( | ) | const |
bool getIsLooping | ( | ) | const |
bool getIsPaused | ( | ) | const |
bool getIsPlaying | ( | ) | const |
float getPlaybackSpeed | ( | ) | const |
double getPlayerTime | ( | ) | const |
const Sequence& getSequenceConst | ( | ) | const |
returns a const reference to the current sequence, not thread-safe. Only call this from the main thread
const std::string& getSequenceFilename | ( | ) | const |
|
overridevirtual |
Evaluates the data of the player. It loads the linked default sequence. Upon failure of loading show, it can create a new default ( empty ) sequence
errorState | contains information about eventual failure |
Reimplemented from Object.
bool load | ( | const std::string & | name, |
utility::ErrorState & | errorState | ||
) |
Load a sequence
name | of the sequence |
errorState | contains error upon failure |
bool loadBinary | ( | const std::vector< nap::uint8 > & | buffer, |
utility::ErrorState & | errorState | ||
) |
Load a sequence serialized as a binary blob
buffer | reference to binary data |
errorState | contains error upon failure |
bool save | ( | const std::string & | name, |
utility::ErrorState & | errorState | ||
) |
Saves current sequence to disk
name | of the sequence |
errorState | contains error upon failure |
void setIsLooping | ( | bool | isLooping | ) |
Start from beginning when player reaches end of sequence
isLooping | loop |
void setIsPaused | ( | bool | isPaused | ) |
Pauses the player. Note that if we are still playing, adapters will still get called but time will not advance ( when paused )
isPaused | paused |
void setIsPlaying | ( | bool | isPlaying | ) |
Play or stop the player. Note that player can still be paused, so adapters will be called but time will not advance
isPlaying | true is start playing |
void setPlaybackSpeed | ( | float | speed | ) |
sets playback speed ( 1.0 is normal speed )
speed | speed |
void setPlayerTime | ( | double | time | ) |
sets player time manually
time | the new time |
|
overridevirtual |
starts player thread, called after successfully initialization This starts the actual player thread
Reimplemented from Device.
|
overridevirtual |
called before deconstruction. This stops the actual player thread. To stop the player but NOT the player thread call setIsPlaying( false )
Reimplemented from Device.
|
protected |
adptersCreated Signal is triggered from main thread, after creating adapters This is useful for creating your own custom outputs & adapters for custom tracks if necessary You should do so only when writing your own player extended on SequencePlayer It passes a reference to a lambda function that you can call to add an adapter to mAdapters member of SequencePlayer
Signal<SequencePlayer&> edited |
ResourcePtr<SequencePlayerClock> mClock |
Property: 'Clock' Controls timing of playback.
bool mCreateEmptySequenceOnLoadFail = true |
Property: 'Create Sequence on Failure' when true, the init will successes upon failure of loading default sequence and create an empty sequence.
std::vector<ResourcePtr<SequencePlayerOutput> > mOutputs |
Property: 'Outputs' linked outputs.
|
protected |
Signal<SequencePlayer&, bool> pauseStateChanged |
Signal<SequencePlayer&, float> playbackSpeedChanged |
Signal<SequencePlayer&, double> playerTimeChanged |
Signal<SequencePlayer&, bool> playStateChanged |
Signal<SequencePlayer&> postTick |
postTick Signal is triggered on player thread, after updating the adapters
Signal<SequencePlayer&> preTick |
Signal<SequencePlayer&, std::string> sequenceLoaded |