Lomse library. API documentation
0.30.0
|
AScore represents a full music score, that is, an object comprising all of the music for all of the players and their instruments, typically laid out in a specific order. In lomse, an score is, basically, a collection instruments (AInstrument objects) and some information common to all them, such as score titles.
In a full score, related instruments are usually grouped by sharing barlines and having some visual clues, such as a brace or bracket, and a group name. In lomse, a group of instruments is represented by an AInstrGroup object, and the AScore object is also responsible for managing the collection of all defined instrument groups.
See The structure of a music score.
Public Member Functions | |
ImoScore * | internal_object () const |
void | end_of_changes () |
Instruments management. Access to information | |
AInstrument | instrument_at (int iInstr) const |
int | num_instruments () const |
Instruments management. Add/delete instruments | |
AInstrument | append_new_instrument () |
void | delete_instrument (ImoId instrId) |
void | delete_instrument (AInstrument &instr) |
Instruments management. Reordering instruments | |
void | move_up_instrument (ImoId instrId) |
void | move_up_instrument (AInstrument &instr) |
void | move_down_instrument (ImoId instrId) |
void | move_down_instrument (AInstrument &instr) |
Groups management. Access to information | |
int | num_instruments_groups () const |
AInstrGroup | instruments_group_at (int iGroup) const |
Groups management. Create/remove groups | |
AInstrGroup | group_instruments (int iFirstInstr, int iLastInstr) |
bool | delete_instruments_group_at (int iGroup) |
bool | delete_instruments_group (const AInstrGroup &group) |
void | delete_all_instruments_groups () |
Algorithms | |
MeasureLocator | locator_for (TimeUnits timepos, int iInstr) |
TimeUnits | timepos_for (int iMeasure, int iBeat, int iInstr) |
TimeUnits | timepos_for (const MeasureLocator &ml) |
Public Member Functions inherited from AObject | |
AObject () | |
bool | is_valid () const |
ImoObj * | internal_object () const |
ImoId | object_id () const |
const std::string & | object_name () const |
ADocument | owner_document () const |
ADynamic | downcast_to_dynamic () const |
AInstrument | downcast_to_instrument () const |
AInstrGroup | downcast_to_instr_group () const |
ALink | downcast_to_link () const |
AList | downcast_to_list () const |
AParagraph | downcast_to_paragraph () const |
AScore | downcast_to_score () const |
ATextItem | downcast_to_text_item () const |
bool | is_anonymous_block () const |
bool | is_button () const |
bool | is_content () const |
bool | is_control () const |
bool | is_dynamic () const |
bool | is_heading () const |
bool | is_image () const |
bool | is_inline_wrapper () const |
bool | is_instrument () const |
bool | is_instr_group () const |
bool | is_link () const |
bool | is_list () const |
bool | is_list_item () const |
bool | is_midi_info () const |
bool | is_multicolumn () const |
bool | is_music_data () const |
bool | is_paragraph () const |
bool | is_score () const |
bool | is_sound_info () const |
bool | is_table () const |
bool | is_table_cell () const |
bool | is_table_body () const |
bool | is_table_head () const |
bool | is_table_row () const |
bool | is_text_item () const |
Public Member Functions inherited from ISiblings | |
AObject | previous_sibling () const |
AObject | next_sibling () const |
AInstrument append_new_instrument | ( | ) |
Appends a new empty instrument to the score, instantiated with default values:
Returns the created instrument.
void delete_all_instruments_groups | ( | ) |
Deletes all instruments groups defined in the score, if any.
void delete_instrument | ( | ImoId | instrId | ) |
Removes the specified instrument form the score and deletes it.
Instrument groups in the score are not affected, as they are not tied to specific instruments but to instruments positions. That is, a group joining instruments two to five will always join the instruments occupying those positions, whatever they are there after a delete instrument operation. A remove operation will not affect existing groups unless the group contained the last instrument in the score, as that instrument position will no longer exist after deleting an instrument. In that case, the group will have one less instrument or will be deleted if only containing one instrument.
instrId | The ID of the instrument to delete. |
void delete_instrument | ( | AInstrument & | instr | ) |
Removes the specified instrument form the score and deletes it.
Instrument groups in the score are not affected, as they are not tied to specific instruments but to instruments positions. That is, a group joining instruments two to five will always join the instruments occupying those positions, whatever they are there after a delete instrument operation. A remove operation will not affect existing groups unless the group contained the last instrument in the score, as that instrument position will no longer exist after deleting an instrument. In that case, the group will have one less instrument or will be deleted if only containing one instrument.
instr | A reference to the instrument to delete. |
bool delete_instruments_group | ( | const AInstrGroup & | group | ) |
Deletes the instruments group group. Returns false if any error.
group | The group to delete. |
bool delete_instruments_group_at | ( | int | iGroup | ) |
Deletes the instruments group at position iGroup. Returns false if error (invalid value for param iGroup).
iGroup | Position (0..num.groups-1) of group to delete. Please, notice that groups are ordered as they are created: first created one has index 0. |
void end_of_changes | ( | ) |
When you finish modifying the content of an score it is necessary to inform lomse for updating all internal structures associated to the score. For this it is mandatory to invoke this method. Alternatively, you can invoke ADocument::end_of_changes(), that will invoke this method on all scores.
AInstrGroup group_instruments | ( | int | iFirstInstr, |
int | iLastInstr | ||
) |
Creates a group whose first instrument will be instrument at position iFirstInstr and the last in the group will be instrument at position iLastInstr.
iFirstInstr | Position (0..n-1) of first instrument to include in the group. |
iLastInstr | Position (0..n-1) of last instrument to include in the group. Notice that iFirstInstr must be lower than iLastInstr. Otherwise this method will do nothing and will return an invalid AInstrGroup. |
The created group will not have any symbol (k_group_symbol_none), the instruments will have their barlines joined (k_joined_barlines), and the group will have neither name nor abbreviation. After the group is created, you can change all these default settings.
AInstrument instrument_at | ( | int | iInstr | ) | const |
Returns the requested instrument.
iInstr | Is the index to the requested instrument (0 ... num_instruments - 1). |
AInstrGroup instruments_group_at | ( | int | iGroup | ) | const |
Returns the requested instruments group.
iGroup | Is the index to the requested instruments group (0 ... num.groups - 1). |
ImoScore * internal_object | ( | ) | const |
Transitional, to facilitate migration to the new public API. Notice that this method will be removed in future so, please, if you need to use this method open an issue at https://github.com/lenmus/lomse/issues explaining the need, so that the public API could be fixed and your app. would not be affected in future when this method is removed.
MeasureLocator locator_for | ( | TimeUnits | timepos, |
int | iInstr | ||
) |
Returns a measure locator for the specified instrument and timepos.
timepos | |
iInstr | Number of the instrument (0..m) to which the measures refer to. Take into account that for polymetric music (music in which not all instruments have the same time signature), the measure number is not an absolute value, common to all the score instruments, but it is relative to an instrument. For normal scores, just providing measure number and location will do the job. |
void move_down_instrument | ( | ImoId | instrId | ) |
Changes the order of the instruments in the score by moving the referenced instrument after the one immediately below it.
instrId | The ID of the instrument to move down. |
Trying to move down the last instrument is a valid operation but nothing will be changed.
Instrument groups in the score are not affected, as they are not tied to specific instruments but to instruments positions. That is, a group joining instruments two to five will always join the instruments occupying those positions, whatever they are there after a move operation.
void move_down_instrument | ( | AInstrument & | instr | ) |
Changes the order of the instruments in the score by moving the referenced instrument after the one immediately below it.
instr | A reference to the instrument to move down. |
Trying to move down the last instrument is a valid operation but nothing will be changed.
Instrument groups in the score are not affected, as they are not tied to specific instruments but to instruments positions. That is, a group joining instruments two to five will always join the instruments occupying those positions, whatever they are there after a move operation.
void move_up_instrument | ( | ImoId | instrId | ) |
Changes the order of the instruments in the score by moving the referenced instrument before the one immediately above it.
instrId | The ID of the instrument to move up. |
Trying to move up the first instrument is a valid operation but nothing will be changed.
Instrument groups in the score are not affected, as they are not tied to specific instruments but to instruments positions. That is, a group joining instruments two to five will always join the instruments occupying those positions, whatever they are there after a move operation.
void move_up_instrument | ( | AInstrument & | instr | ) |
Changes the order of the instruments in the score by moving the referenced instrument before the one immediately above it.
instr | A reference to the instrument to move up. |
Trying to move up the first instrument is a valid operation but nothing will be changed.
Instrument groups in the score are not affected, as they are not tied to specific instruments but to instruments positions. That is, a group joining instruments two to five will always join the instruments occupying those positions, whatever they are there after a move operation.
int num_instruments | ( | ) | const |
Returns the number of instruments that this score contains.
int num_instruments_groups | ( | ) | const |
Returns the number of instrument groups that this score contains.
TimeUnits timepos_for | ( | int | iMeasure, |
int | iBeat, | ||
int | iInstr | ||
) |
Returns the time position for the specified measure and beat.
iMeasure | Measure number (0..n) in instrument iInstr. |
iBeat | Beat number (0..m) relative to the measure. |
iInstr | Number of the instrument (0..m) to which the measures refer to. Take into account that for polymetric music (music in which not all instruments have the same time signature), the measure number is not an absolute value, common to all the score instruments, but it is relative to an instrument. For normal scores, just providing measure number and location will do the job. |
TimeUnits timepos_for | ( | const MeasureLocator & | ml | ) |
Returns the time position for the specified measure locator.
ml | The measure locator to convert. |