1 #ifndef PlaybackState_h
2 #define PlaybackState_h
25 virtual status_t
SaveToArchive(
const MessageRef & archive)
const;
37 virtual ConstMessageRef
SeniorUpdate(
const ConstMessageRef & seniorDoMsg);
43 virtual status_t
JuniorUpdate(
const ConstMessageRef & juniorDoMsg);
62 void SetMicrosPerChord(uint64 microsPerChord, uint64 optNetworkNow = MUSCLE_TIME_NEVER);
68 bool IsPaused()
const {
return (_pausedIndex != MUSCLE_NO_LIMIT);}
90 void SeekTo(uint64 networkNow, uint32 whichChord);
108 void SetToDefaultStateAux();
109 MessageRef SeniorAdjustPlaybackState(uint32 whatCode,
const uint64 * optNewMicrosPerChord,
const uint32 * optSeekTo,
bool * optSetLoop);
111 uint64 _networkStartTimeMicros;
112 uint64 _microsPerChord;
virtual status_t JuniorUpdate(const ConstMessageRef &juniorDoMsg)
Updates our state as specified in the (juniorDoMsg).
~PlaybackState()
Destructor.
void SetMicrosPerChord(uint64 microsPerChord, uint64 optNetworkNow=MUSCLE_TIME_NEVER)
Sets the number of microseconds to be allotted to each chord in the MusicSheet.
A slight specialization of the IDatabaseObject class, just so I can add some application-specific hel...
uint64 GetNetworkTimeToPlayChord(uint32 chordIndex) const
Convenience method: Given a chord index, returns the network-time at which that chord should be playe...
bool IsLoop() const
Returns true iff we should loop playback indefinitely (false means we should play only once) ...
uint32 GetChordIndexForNetworkTimeStamp(uint64 networkTimeStamp, uint32 optLoopLengthChords) const
Convenience method: Given a network time stamp, returns the chord-index that corresponds to that time...
This object holds the state of how the currently-in-memory Music sheet should be performed over time...
uint32 GetPausedIndex() const
If we're paused, returns the index of the chord that the playhead is currently paused at (or MUSCLE_N...
void SetPausedIndex(bool pausedIndex)
Sets returns the index of the chord that the playhead is currently paused at (or MUSCLE_NO_LIMIT if w...
PlaybackState()
Constructor.
void SetNetworkStartTimeMicros(uint64 networkStartTimeMicros)
Sets the time corresponding to the triggering of playback of the first note in the MusicSheet (or MUS...
virtual uint32 GetCurrentChecksum() const
Just calls CalculateChecksum(), since this database is very small and thus CalculateChecksum() is sti...
void StartPlayback(uint64 networkNow)
Convenience method – starts playback at the current seek position, if we're not already playing...
void SeekTo(uint64 networkNow, uint32 whichChord)
Convenience method – seeks the current playback position to the specified chord. ...
virtual uint32 CalculateChecksum() const
Calculates and returns a checksum for this object.
virtual String ToString() const
Returns a string representation of this object, for debugging purposes.
virtual status_t SetFromArchive(const ConstMessageRef &archive)
Replaces this sheet's current contents with the contents from (archive)
virtual status_t SaveToArchive(const MessageRef &archive) const
Saves this sheet's current contents into (archive)
uint64 GetMicrosPerChord() const
Returns the number of microseconds to be allotted to each chord in the MusicSheet.
virtual ConstMessageRef SeniorUpdate(const ConstMessageRef &seniorDoMsg)
Updates our state as specified in the (seniorDoMsg).
The choir namespace contains the code specific to the ZGChoir demonstration application.
uint64 GetNetworkStartTimeMicros() const
Returns the time corresponding to the triggering of playback of the first note in the MusicSheet (or ...
int64 GetPlaybackPositionForNetworkTimeMicroseconds(uint64 networkTimestamp) const
Convenience method: Given a network-timestamp, returns the corresponding offset from the top of the s...
virtual void SetToDefaultState()
Sets this object to its just-constructed state.
bool IsPaused() const
Convenience method – returns true iff we are currently paused.
void SetLoop(bool loop)
Set true if the music playback should loop; false if it should play through just once.
void PausePlayback(uint64 networkNow)
Convenience method – pauses playback at the current seek position, if we're not already paused...