1
// RCS-ID: $Id: algorithms.txt,v 1.6 2006/02/23 19:15:19 cecilios Exp $
2
//--------------------------------------------------------------------------------------
3
// LenMus Phonascus: The teacher of music
4
// Copyright (c) 2002-2006 Cecilio Salmeron
6
// This program is free software; you can redistribute it and/or modify it under the
7
// terms of the GNU General Public License as published by the Free Software Foundation;
8
// either version 2 of the License, or (at your option) any later version.
10
// This program is distributed in the hope that it will be useful, but WITHOUT ANY
11
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12
// PARTICULAR PURPOSE. See the GNU General Public License for more details.
14
// You should have received a copy of the GNU General Public License along with this
15
// program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street,
16
// Fifth Floor, Boston, MA 02110-1301, USA.
18
// For any comment, suggestion or feature request, please contact the manager of
19
// the project at cecilios@users.sourceforge.net
21
//-------------------------------------------------------------------------------------
22
/*! @page algorithms Notes on algorithms
25
@section xml_measure_atributes Problem of XML Measure attributes
26
<!-- ============================================================================ -->
28
- Problem with TimeSignatures and KeySignatures in XML: Clef and signatures are
29
treated as attributes of the measure, not as objects. Therefore, ordering (clef, tonal
30
key, time signature) is not important for XML and there are examples in wich this
31
information is encoded in reversed orders (i.e. time signature, clef). This causes
32
problems as LenMus expects that this objects are defined in the right order.
34
- This is an example of divergence between internal representation and representation
35
for a particular purpose (graphical model) that comes in support for the Guido
36
approach of two steps generation: internal model --> graphical and sound models.
38
- For now, a by pass solution must be found:
39
- Time to deal with contexts?
40
- Re-ordering in lmTimeposTable?
41
- Re-ordering at XML parser objects creation?
44
@section algorithm_stems_in_beamed_groups Computation of stems for a beamed group
45
<!-- ============================================================================ -->
46
Things to take into account:
47
- The notes of a group can be in different staves (i.e. piano grand staff).
48
- In agroup stems can go in both directions.
49
- For chords, only base note is in the beamed group. Beam computation can not
50
take place until all the notes that form the chord has been added
51
- There can be rests inside the group, therefore rests also have beaming information.
52
That's why beaming information is defined in %lmNoteRest object and both
53
constructors, Note and Rest, require beaming information.
57
As the notes/rest are being defined their x,y base position (the point near to the
58
notehead) is computed. The y base position is exact but the x position is just a
59
preliminary provisional value. The stem height is a standard fixed value.
60
When the score is going to been rendered, in measurement phase, the exact x base position
61
of notes and rests is computed, but it is only at the end of mesuarement phase when this
62
information is valid, because as space justification might alter the x position
63
previously computed in each Note object.
65
Nevertheless, during the measurement phase, when in a Note object is detected that
66
the note is the first one of a beamed group, the beam object is invoked (method
67
ComputeStems) to do certain computations:
68
- Fix stems direction. If one note has is stem direction forced (by a tie with a previous
69
note, or by the user) this forces all the group stems to this direction.
70
- Do a rough computation of stems heigh. This is necessary to set the Y position for
71
rests inside the beamed group.
72
In this computation, stems' length is not changed.
74
Final trimming of stems' length is delayed to MakeUp phase because it is not
75
posible to adjust lenghts until the x position of the notes is finally established, and
76
this takes place AFTER the measurement phase, once the lines are justified.
77
In MakeUp phase, the stems' lenght are computed by the Beam object by invoking method
78
TrimStems from the first note of the beam.
82
@section algorithm_ties Computation of ties
83
<!-- ============================================================================ -->
84
Things to take into account:
85
- The tied notes can be in different systems. This forces to draw two ties: one
86
from the first note to the end of the first system and a second tie from the
87
begining of the second system to tied note.
88
- If any of the notes is dragged, the ties must move accordingly.
92
At Make up phase, in each Note object:
93
- If the note is the end of a tie, compute tie end point and store it in the
94
Tie object (method StoreEndPoint is invoked just to store the computed
95
data). Additional information is stored:
96
- To compute the start of the extra tie arch in case the tie must be splitted,
97
also paper x left margin is stored.
98
- To determine if tie must be spplited due to system change, also paper
101
- If the note is the start of a tie, compute tie start point and store it in the
102
Tie object (method SetStartPoint is invoked just to store the computed
103
data). Also, tie position is determined by note stem direction.
104
Additional information is stored:
105
- Tie position (under or over the noteheads) is determined by the start note
107
- To compute the end of the extra tie arch in case the tie must be splitted,
108
also paper x right margin is stored.
109
- To determine if tie must be spplited due to system change, also paper
112
All this must be done at make up because notes's x position is not fixed until the
113
end of the measurement phase, after the line justification process.
115
When Tie method StoreEndPoint is invoked, it is computed if the tie
116
has to be splitted by comparing the y paper base pos of the start and end notes. If
117
it is not the same, it implies that the notes are in different systems and, therefore,
118
the tie must be splitted.
b'\\ No newline at end of file'