This object is the in-memory representation of a song, as a collection of notes over time. More...
#include <MusicSheet.h>
Public Member Functions | |
MusicSheet () | |
Constructor. More... | |
MusicSheet (const MusicSheet &rhs) | |
Constructor. More... | |
~MusicSheet () | |
Destructor. More... | |
MusicSheet & | operator= (const MusicSheet &rhs) |
Assignment operator. More... | |
virtual void | SetToDefaultState () |
Clears our state to the state of a just-constructed MusicSheet object. More... | |
virtual status_t | SetFromArchive (const ConstMessageRef &archive) |
Replaces this sheet's current contents with the contents from (archive) More... | |
virtual status_t | SaveToArchive (const MessageRef &archive) const |
Saves this sheet's current contents into (archive) More... | |
status_t | UpdateFromArchive (const ConstMessageRef &archive) |
Incrementally updates this sheet's contents, based on the information in the Message. More... | |
void | SetSongFilePath (const String &songFilePath) |
Set the user-visible file-path string for this piece of music. More... | |
const String & | GetSongFilePath () const |
Returns the current user-visible file-path string for this piece of music. More... | |
const OrderedKeysHashtable < uint32, uint64 > & | GetChordsTable () const |
Read-only access to our current table of chords. More... | |
uint64 | GetChordAtIndex (uint32 whichChord, bool useLoopingLogic) const |
Convenience method – returns the chord at the specified chord-index, or 0 if there are no notes at that index. More... | |
status_t | PutChord (uint32 whichChord, uint64 chordValue) |
Places the specified chord into our chords-set. More... | |
void | RemoveChord (uint32 whichChord) |
Convenience method; removes the given chord from the chords-set, if it exists. More... | |
void | InsertChordAt (uint32 whichChord) |
Inserts space for a new chord at the given index. More... | |
void | DeleteChordAt (uint32 whichChord) |
Deletes the chord at the given index (if any). More... | |
uint32 | GetSongLengthInChords (bool useLoopingLogic) const |
Returns the length of this song, in chords (i.e. More... | |
uint64 | GetAllUsedNotesChord () const |
Returns a bit-chord that describes the full set of all the notes that are currently used anywhere in this song. More... | |
virtual uint32 | GetCurrentChecksum () const |
Returns the checksum of this object (which is updated whenever this object's contents change) More... | |
virtual uint32 | CalculateChecksum () const |
Calculates our current checksum from scratch (expensive!) More... | |
virtual ConstMessageRef | SeniorUpdate (const ConstMessageRef &seniorDoMsg) |
Updates our state as specified in the (seniorDoMsg). More... | |
virtual status_t | JuniorUpdate (const ConstMessageRef &juniorDoMsg) |
Updates our state as specified in the (juniorDoMsg). More... | |
virtual String | ToString () const |
Returns a string representation of this object, for debugging purposes. More... | |
ZGDatabasePeerSession * | GetDatabasePeerSession () |
Returns a pointer to the ZGDatabasePeerSession object that created us, or NULL if this object was not created by a ZGDatabasePeerSession. More... | |
const ZGDatabasePeerSession * | GetDatabasePeerSession () const |
As above, but returns a const/read-only pointer. More... | |
Protected Member Functions | |
ChoirSession * | GetChoirSession () |
Returns a pointer to the ChoirSession object that created this object. More... | |
const ChoirSession * | GetChoirSession () const |
Returns a read-only pointer to the ChoirSession object that created this object. More... | |
ConstMessageRef | SendFullStateToGUI (bool allowReviewTrigger) |
Saves the state of this object into a Message and sends that Message to the GUI thread. More... | |
void | SendMessageToGUI (const ConstMessageRef &msg, bool allowReviewTrigger) |
Sends the specified Message to the GUI thread. More... | |
void | SetReviewResults (uint64 allNotesUsedChord) |
Convenience method; calls SetReviewResults(allNotesUsedChord) on our ChoirSession object. More... | |
const IDatabaseObject * | GetDatabaseObject (uint32 whichDatabase) const |
Returns a read-only pointer to the specified IDatabaseObject held by our ZGDatabasePeerSession, or NULL if we don't have a ZGDatabasePeerSession or if the specified database doesn't exist. More... | |
bool | IsPeerOnline (const ZGPeerID &pid) const |
Returns true iff the peer with the specified ID is currently on line. More... | |
const Hashtable< ZGPeerID, ConstMessageRef > & | GetOnlinePeers () const |
Returns a table of the currently online peers (and their attributes), or an empty table if we have no ZGDatabasePeerSession. More... | |
virtual uint64 | GetNetworkTime64 () const |
Returns the current network time, or 0 if we have no ZGDatabasePeerSession. More... | |
virtual uint64 | GetRunTime64ForNetworkTime64 (uint64 networkTime64TimeStamp) const |
Returns the local time corresponding to a given network time, or 0 if we have no ZGDatabasePeerSession. More... | |
virtual uint64 | GetNetworkTime64ForRunTime64 (uint64 runTime64TimeStamp) const |
Returns the network time corresponding to a given local time, or 0 if we have no ZGDatabasePeerSession. More... | |
virtual int64 | GetToNetworkTimeOffset () const |
Returns the number of microseconds that should be added to a GetRunTime64() value to turn it into a GetNetworkTime64() value, or subtracted to do the inverse operation. More... | |
This object is the in-memory representation of a song, as a collection of notes over time.
Definition at line 9 of file MusicSheet.h.
MusicSheet | ( | ) |
Constructor.
MusicSheet | ( | const MusicSheet & | rhs | ) |
Constructor.
~MusicSheet | ( | ) |
Destructor.
|
virtual |
Calculates our current checksum from scratch (expensive!)
Implements IDatabaseObject.
void DeleteChordAt | ( | uint32 | whichChord | ) |
Deletes the chord at the given index (if any).
Any other chords after that index are moved one column to the left.
|
inline |
Returns a bit-chord that describes the full set of all the notes that are currently used anywhere in this song.
Definition at line 71 of file MusicSheet.h.
|
protectedinherited |
Returns a pointer to the ChoirSession object that created this object.
|
protectedinherited |
Returns a read-only pointer to the ChoirSession object that created this object.
|
inline |
Convenience method – returns the chord at the specified chord-index, or 0 if there are no notes at that index.
Definition at line 46 of file MusicSheet.h.
References MusicSheet::GetSongLengthInChords().
|
inline |
Read-only access to our current table of chords.
Definition at line 43 of file MusicSheet.h.
|
inlinevirtual |
Returns the checksum of this object (which is updated whenever this object's contents change)
Implements IDatabaseObject.
Definition at line 74 of file MusicSheet.h.
|
protectedinherited |
Returns a read-only pointer to the specified IDatabaseObject held by our ZGDatabasePeerSession, or NULL if we don't have a ZGDatabasePeerSession or if the specified database doesn't exist.
whichDatabase | index of the database object we want to access |
|
inlineinherited |
Returns a pointer to the ZGDatabasePeerSession object that created us, or NULL if this object was not created by a ZGDatabasePeerSession.
(Note that this pointer is not set until after our constructor returns, this method will always return NULL if called from a constructor)
Definition at line 85 of file IDatabaseObject.h.
|
inlineinherited |
As above, but returns a const/read-only pointer.
Definition at line 88 of file IDatabaseObject.h.
|
protectedvirtualinherited |
Returns the current network time, or 0 if we have no ZGDatabasePeerSession.
Implements INetworkTimeProvider.
|
protectedvirtualinherited |
Returns the network time corresponding to a given local time, or 0 if we have no ZGDatabasePeerSession.
runTime64TimeStamp | a local-clock time, in microseconds |
Implements INetworkTimeProvider.
|
protectedinherited |
Returns a table of the currently online peers (and their attributes), or an empty table if we have no ZGDatabasePeerSession.
|
protectedvirtualinherited |
Returns the local time corresponding to a given network time, or 0 if we have no ZGDatabasePeerSession.
networkTime64TimeStamp | a network-clock time, in microseconds |
Implements INetworkTimeProvider.
|
inline |
Returns the current user-visible file-path string for this piece of music.
Definition at line 40 of file MusicSheet.h.
|
inline |
Returns the length of this song, in chords (i.e.
the largest key in the chords Hashtable, plus one)
Definition at line 68 of file MusicSheet.h.
Referenced by MusicSheet::GetChordAtIndex().
|
protectedvirtualinherited |
Returns the number of microseconds that should be added to a GetRunTime64() value to turn it into a GetNetworkTime64() value, or subtracted to do the inverse operation.
Note that this value will vary from one moment to the next!
Implements INetworkTimeProvider.
void InsertChordAt | ( | uint32 | whichChord | ) |
Inserts space for a new chord at the given index.
Any other chords at or after that indexed are moved one column to the right.
|
protectedinherited |
Returns true iff the peer with the specified ID is currently on line.
pid | The ID of the peer we are interested in. If we have no ZGDatabasePeerSession then this will always return false. |
|
virtual |
Updates our state as specified in the (juniorDoMsg).
Will only be called on the instance running on the senior peer.
juniorDoMsg | A Message containing instructions for how to update our state on a junior peer. |
Implements IDatabaseObject.
MusicSheet& operator= | ( | const MusicSheet & | rhs | ) |
Assignment operator.
status_t PutChord | ( | uint32 | whichChord, |
uint64 | chordValue | ||
) |
Places the specified chord into our chords-set.
whichChord | The temporal index of the chord to set. |
chordValue | the notes to be present in the chord (0x00==silence, 0x01==lowest note, etc) |
Referenced by MusicSheet::RemoveChord().
|
inline |
Convenience method; removes the given chord from the chords-set, if it exists.
This is equivalent to calling PutChord(whichChord, 0);
whichChord | The temporal index of the chord to remove (0=first, 1=second, etc) |
Definition at line 59 of file MusicSheet.h.
References MusicSheet::PutChord().
|
virtual |
Saves this sheet's current contents into (archive)
Implements IDatabaseObject.
|
protectedinherited |
Saves the state of this object into a Message and sends that Message to the GUI thread.
allowReviewTrigger | if true, this method may also trigger a review of the current bell-assignments to see if they need updating. |
|
protectedinherited |
Sends the specified Message to the GUI thread.
msg | The Message to send to the GUI thread. |
allowReviewTrigger | if true, this method may also trigger a review of the current bell-assignments to see if they need updating. |
|
virtual |
Updates our state as specified in the (seniorDoMsg).
Will only be called on the instance running on the senior peer.
seniorDoMsg | A Message containing instructions for how to update our state on the senior peer. |
Implements IDatabaseObject.
|
virtual |
Replaces this sheet's current contents with the contents from (archive)
Implements IDatabaseObject.
|
protectedinherited |
Convenience method; calls SetReviewResults(allNotesUsedChord) on our ChoirSession object.
allNotesUsedChord | a bit-chord of CHOIR_NOTE_* values indicating which notes are present in our current song. |
void SetSongFilePath | ( | const String & | songFilePath | ) |
Set the user-visible file-path string for this piece of music.
|
virtual |
Clears our state to the state of a just-constructed MusicSheet object.
Implements IDatabaseObject.
|
virtual |
Returns a string representation of this object, for debugging purposes.
Implements IDatabaseObject.
status_t UpdateFromArchive | ( | const ConstMessageRef & | archive | ) |
Incrementally updates this sheet's contents, based on the information in the Message.