|
|
The Part class represents a placement of a Phrase in a Track. It holds a reference to the Phrase and the realtime parameters that affect how the Phrase sounds as it is played.
A Part can only exist in one Track at once.
Each Part has a start and end time, which it manages. Before you insert a Part in a Track ensure that you have set the appropriate times with setStart() and setEnd() or with the consolidated setStartEnd().
The Part has a DisplayParameters object associated with it which may be used by an application to redraw the Part on screen (this use is optional). If you do use it, the Part DisplayParams should superceed any Phrase DisplayParams.
Use the following command classes to manipute this object in a undo/redo environment.
See also: MidiEvent, Phrase, PhraseEdit
Part ()
| Part |
Creates a Part that uses no Phrase. Set the Phrase with the setPhrase method.
The start and end points are set to a default. Set them with setStart and setEnd.
Part (Clock start, Clock end)
| Part |
Creates a Part that uses no Phrase and the given start and end points.
Part (const Part &p)
| Part |
~Part ()
| ~Part |
[virtual]
Part & operator= (const Part &)
| operator= |
Reimplemented from Playable.
MidiFilter * filter ()
| filter |
MidiFilter that affects how MidiEvents are produced by this Part.
Returns: The Part's MidiFilter object
MidiParams * params ()
| params |
The Part parameters that affects how MidiEvents are produced by this Part.
Returns: The Part's MidiParams object
DisplayParams * displayParams ()
| displayParams |
The display parameters.
Returns: The Part's DisplayParams object
Phrase * phrase ()
| phrase |
[const]
Returns the Phrase this Part uses (or 0 if there is no current Phrase).
Returns: The Part's Phrase
See also: setPhrase
void setPhrase (Phrase *p)
| setPhrase |
Sets the Phrase this Part uses.
The Phrase must be contained in the correct PhraseList for this operation to work. If the Phrase subequently is removed from a PhraseList the Part's Phrase pointer is reset.
You may specify a value of 0 for "use no Phrase".
Throws: PartError
See also: phrase
Track * parent ()
| parent |
[const]
Returns a pointer to the parent Track that this Part has been inserted into. If this Part has not been inserted in a Track, this method returns zero.
Returns: Track this Part is inserted in
Clock start ()
| start |
[const]
Returns the start time of this Part.
This is meerly held for the convenience of the parent and is not used by the Part itself. In particular, it does not alter the relative times of the MidiEvents produced through the Playable interface: they remain relative to time zero.
Returns: Part's start time
See also: end, setStart
void setStart (Clock c)
| setStart |
Sets the start time of this Part.
If the Part is inserted in a Track then the end time cannot be changed to before the start time.
Note that if the Part is in a Track and the change would cause an exception to be thrown by the Track's insert method then that exception will propagate from this method. However you can be assured that if this happens the Part will be left with times set as they were when you called the method.
Parameters:
c | New start time |
Throws: PartError, TrackError
See also: start, setStartEnd
Clock end ()
| end |
[const]
Returns the end time of this Part.
This is meerly held for the convenience of the parent and is not used by the Part itself.
Returns: Part's end time
See also: start, setEnd
void setEnd (Clock c)
| setEnd |
Sets the end time of this Part.
If the Part is inserted in a Track then the end time cannot be changed to before the start time.
Note that if the Part is in a Track and the change would cause an exception to be thrown by the Track's insert method then that exception will propagate from this method. However you can be assured that if this happens the Part will be left with times set as they were when you called the method.
Parameters:
c | New end time |
Throws: PartError, TrackError
See also: end, setStartEnd
void setStartEnd (Clock start, Clock end)
| setStartEnd |
Sets the start and end times of this Part.
You may wish to use this when the Part is inserted in a Track and you want to move the Part in such a way that calling setStart or setEnd first would throw an exception.
Note that if the Part is in a Track and the change would cause an exception to be thrown by the Track's insert method then that exception will propagate from this method. However you can be assured that if this happens the Part will be left with times set as they were when you called the method.
Parameters:
start | New start time |
end | New end time |
Throws: PartError, TrackError
See also: setStart, setEnd
Clock repeat ()
| repeat |
[const]
Returns the repeat time of this Part.
A repeat time of zero means no repeat.
Returns: Repeat time value
See also: setRepeat
void setRepeat (Clock r)
| setRepeat |
Sets the repeat time of this Part.
Parameters:
r | New repeat time value |
See also: repeat
void Notifier_Deleted (Phrase *phrase)
| Notifier_Deleted |
[virtual]
Reimplemented from Listener for internal purposes..
void Phrase_Reparented (Phrase *)
| Phrase_Reparented |
[virtual]
PlayableIterator * iterator (Clock index)
| iterator |
[virtual]
Reimplemented from Playable for internal purposes..
Clock lastClock ()
| lastClock |
[const virtual]
Reimplemented from Playable for internal purposes..
void save (std::ostream &o, int i)
| save |
[const virtual]
Reimplemented from Serializable for internal purposes..
void load (std::istream &in, SerializableLoadInfo &info)
| load |
[virtual]
Reimplemented from Serializable for internal purposes..
void MidiFilter_Altered (MidiFilter *, int what)
| MidiFilter_Altered |
[virtual]
void MidiParams_Altered (MidiParams *, int what)
| MidiParams_Altered |
[virtual]
void DisplayParams_Altered (DisplayParams *)
| DisplayParams_Altered |
[virtual]
friend class Track | Track |