Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
muselementfactory.h
Go to the documentation of this file.
1 
10 #ifndef MUSELEMENTFACTORY_H_
11 #define MUSELEMENTFACTORY_H_
12 #include "core/barline.h"
13 
14 #include "core/staff.h"
15 #include "core/muselement.h"
16 #include "core/clef.h"
17 #include "core/keysignature.h"
18 #include "core/timesignature.h"
19 #include "core/voice.h"
20 #include "core/rest.h"
21 #include "core/slur.h"
22 #include "core/functionmark.h"
23 #include "core/lyricscontext.h"
24 #include "core/syllable.h"
25 #include "core/mark.h"
26 #include "core/articulation.h"
27 #include "core/fermata.h"
28 #include "core/tempo.h"
29 #include "core/ritardando.h"
30 #include "core/crescendo.h"
31 #include "core/repeatmark.h"
32 #include "core/fingering.h"
33 #include "core/playablelength.h"
34 #include "core/diatonickey.h"
35 
36 class CAMusElement;
37 
39 public:
42 
44 
45  void removeMusElem( bool bReallyRemove = false );
46 
47  void configureMusElem( CAMusElement &roMusElement );
48 
49  inline CAMusElement *musElement() { return mpoMusElement; };
50  inline void setMusElement( CAMusElement *elt ) { mpoMusElement = elt; }
51 
53  inline void emptyMusElem() { mpoMusElement = mpoEmpty; }
54 
55  bool configureClef( CAStaff *staff,
56  CAMusElement *right );
57 
58  bool configureKeySignature( CAStaff *staff,
59  CAMusElement *right );
60 
61  bool configureTimeSignature( CAStaff *staff,
62  CAMusElement *right );
63 
64  bool configureBarline( CAStaff *staff,
65  CAMusElement *right );
66 
67  bool configureRest( CAVoice *voice,
68  CAMusElement *right );
69 
70 
71  bool configureNote( int pitch,
72  CAVoice *voice,
73  CAMusElement *right,
74  bool addToChord
75  );
76 
77  static void placeAutoBar( CAPlayable* elt );
78 
79  bool configureTuplet( QList<CAPlayable*> listOfNotes );
80 
81  bool configureSlur( CAStaff *staff,
82  CANote *noteStart, CANote *noteEnd );
83 
84  bool configureMark( CAMusElement *elt );
85 
87  int timeStart, int timeLength );
88 
91 
93 
96 
97  void addPlayableDotted( int add, CAPlayableLength curLength );
98 
100 
102  { _eNoteStemDirection = eDir; }
103 
104  inline int noteAccs() { return _iNoteAccs; };
105 
106  inline void setNoteAccs( int iNoteAccs )
107  { _iNoteAccs = iNoteAccs; };
108 
109  inline void addNoteAccs( int iAdd )
110  { if (_iNoteAccs+iAdd < 3) _iNoteAccs+= iAdd; };
111 
112  inline void subNoteAccs( int iSub )
113  { if (_iNoteAccs-iSub > -3) _iNoteAccs-= iSub; };
114 
116  inline void setDiatonicKeyNumberOfAccs(int accs) { _diatonicKeyNumberOfAccs = accs; }
119 
120  inline int noteExtraAccs() { return _iNoteExtraAccs; };
121 
122  inline void setNoteExtraAccs( int iNoteExtraAccs )
123  { _iNoteExtraAccs = iNoteExtraAccs; };
124 
125  inline void addNoteExtraAccs( int iAdd )
126  { _iNoteExtraAccs += iAdd; };
127 
128  inline void subNoteExtraAccs( int iSub )
129  { _iNoteExtraAccs -= iSub; };
130 
132 
133  inline void setRestType(CARest::CARestType eType)
134  { _eRestType = eType; }
135 
136  inline int timeSigBeats() { return _iTimeSigBeats; }
137  inline void setTimeSigBeats( int iTimeSigBeats )
138  { _iTimeSigBeats = iTimeSigBeats; };
139 
140  inline int timeSigBeat() { return _iTimeSigBeat; }
141  inline void setTimeSigBeat( int iTimeSigBeat )
142  { _iTimeSigBeat = iTimeSigBeat; };
143 
145  inline void setClef( CAClef::CAPredefinedClefType eClefType )
146  { _eClef = eClefType; };
147 
148  inline int clefOffset() { return _iClefOffset; } // readable offset interval, not internal offset
149  inline void setClefOffset( int offset )
150  { _iClefOffset= offset; };
151 
154  { _eBarlineType = type; }
155 
156  inline int tupletNumber() { return _tupletNumber; }
157  inline void setTupletNumber( int number ) { _tupletNumber = number; }
158 
159  inline int tupletActualNumber() { return _tupletActualNumber; }
160  inline void setTupletActualNumber( int actualNumber ) { _tupletActualNumber = actualNumber; }
161 
163  inline void setSlurType( CASlur::CASlurType type ) { _eSlurType = type; }
164 
166  inline void setSlurStyle( CASlur::CASlurStyle style ) { _slurStyle = style; }
167 
168  inline CAMark::CAMarkType markType() { return _markType; }
169  inline void setMarkType( CAMark::CAMarkType t ) { _markType = t; }
170 
173 
176 
179 
182 
183  inline bool isFMFunctionMinor() { return _fmFunctionMinor; }
184  inline void setFMFunctionMinor( bool m ) { _fmFunctionMinor = m; }
185 
186  inline bool isFMTonicDegreeMinor() { return _fmTonicDegreeMinor; }
187  inline void setFMTonicDegreeMinor( bool m ) { _fmTonicDegreeMinor = m; }
188 
189  inline bool isFMChordAreaMinor() { return _fmChordAreaMinor; }
190  inline void setFMChordAreaMinor( bool m ) { _fmChordAreaMinor = m; }
191 
192  inline bool isFMEllipse() { return _fmEllipse; }
193  inline void setFMEllipse( bool e ) { _fmEllipse = e; }
194 
195  inline const QString dynamicText() { return _dynamicText; }
196  inline void setDynamicText( const QString t ) { _dynamicText = t; }
197 
198  inline const int dynamicVolume() { return _dynamicVolume; }
199  inline void setDynamicVolume( const int vol ) { _dynamicVolume = vol; }
200 
201  inline const int instrument() { return _instrument; }
202  inline void setInstrument( const int instrument ) { _instrument = instrument; }
203 
205  inline void setFermataType( const CAFermata::CAFermataType type ) { _fermataType = type; }
206 
207  inline const int tempoBpm() { return _tempoBpm; }
208  inline void setTempoBpm( const int tempoBpm ) { _tempoBpm = tempoBpm; }
209 
210  inline CAPlayableLength& tempoBeat() { return _tempoBeat; }
211  inline void setTempoBeat( CAPlayableLength& length ) { _tempoBeat = length; }
212 
215 
216  inline const int crescendoFinalVolume() { return _crescendoFinalVolume; }
217  inline void setCrescendoFinalVolume( const int v ) { _crescendoFinalVolume = v; }
218 
221 
224 
225  inline const int repeatMarkVoltaNumber() { return _repeatMarkVoltaNumber; }
226  inline void setRepeatMarkVoltaNumber( const int n ) { _repeatMarkVoltaNumber = n; }
227 
230 
231  inline const bool isFingeringOriginal() { return _fingeringOriginal; }
232  inline void setFingeringOriginal( const int o ) { _fingeringOriginal = o; }
233 private:
234  CAMusElement *mpoMusElement; // Newly created music element itself
235  CAMusElement *mpoEmpty; // An empty (dummy) element.
236 
238  // Element creation parameters //
241 
242  // Staff music elements
243  CAPlayableLength _playableLength; // Length of note/rest to be added
244  CANote::CAStemDirection _eNoteStemDirection; // Note stem direction to be inserted
245  CASlur::CASlurType _eSlurType; // Slur type to be placed
246  int _tupletNumber; // Tuplet number of notes
247  int _tupletActualNumber; // Tuplet actual number of notes
248  int _iPlayableDotted; // Number of dots to be inserted for the note/rest
249  int _iNoteExtraAccs; // Extra note accidentals for new notes which user adds/removes with +/- keys
250  int _iNoteAccs; // Note accidentals at specific coordinates updated regularily when in insert mode
251  CARest::CARestType _eRestType; // Hidden/Normal rest
252  int _diatonicKeyNumberOfAccs; // Key signature number of accidentals
253  CADiatonicKey::CAGender _diatonicKeyGender; // Major/Minor gender of the key signature
254  int _iTimeSigBeats; // Time signature number of beats to be inserted
255  int _iTimeSigBeat; // Time signature beat to be inserted
256  CAClef::CAPredefinedClefType _eClef; // Type of the clef to be inserted
257  int _iClefOffset; // Interval offset for the clef
258  CABarline::CABarlineType _eBarlineType; // Type of the barline
259  CAMark::CAMarkType _markType; // Type of the mark
260  CAArticulation::CAArticulationType _articulationType; // Type of the articulation mark
261  CASlur::CASlurStyle _slurStyle; // Style of the slur (solid, dotted)
262 
263  // Function Mark
265  CAFunctionMark::CAFunctionType _fmChordArea; // Chord area of the function
266  CAFunctionMark::CAFunctionType _fmTonicDegree; // Tonic degree of the function
271 
272  // Marks
273  QString _dynamicText;
286 };
287 #endif // MUSELEMENTFACTORY_H_
CAFunctionMark::CAFunctionType _fmTonicDegree
Definition: muselementfactory.h:266
void setFMFunction(CAFunctionMark::CAFunctionType f)
Definition: muselementfactory.h:175
bool isFMFunctionMinor()
Definition: muselementfactory.h:183
void setNoteStemDirection(CANote::CAStemDirection eDir)
Definition: muselementfactory.h:101
bool _fmEllipse
Definition: muselementfactory.h:270
CASlur::CASlurType slurType()
Definition: muselementfactory.h:162
CAMusElement * musElement()
Definition: muselementfactory.h:49
void setFMTonicDegree(CAFunctionMark::CAFunctionType td)
Definition: muselementfactory.h:181
CAFingering::CAFingerNumber _fingeringFinger
Definition: muselementfactory.h:284
int _diatonicKeyNumberOfAccs
Definition: muselementfactory.h:252
CAPlayableLength & playableLength()
Definition: muselementfactory.h:92
int _tempoBpm
Definition: muselementfactory.h:278
const CACrescendo::CACrescendoType crescendoType()
Definition: muselementfactory.h:219
CAFermataType
Definition: fermata.h:18
void cloneMusElem()
Definition: muselementfactory.h:52
CASlurType
Definition: slur.h:33
void setTupletNumber(int number)
Definition: muselementfactory.h:157
CAStemDirection
Direction of the note&#39;s stem.
Definition: note.h:20
void setDynamicVolume(const int vol)
Definition: muselementfactory.h:199
void setCrescendoType(const CACrescendo::CACrescendoType t)
Definition: muselementfactory.h:220
int _iTimeSigBeats
Definition: muselementfactory.h:254
void setNoteExtraAccs(int iNoteExtraAccs)
Definition: muselementfactory.h:122
bool configureKeySignature(CAStaff *staff, CAMusElement *right)
Definition: muselementfactory.cpp:156
void setDynamicText(const QString t)
Definition: muselementfactory.h:196
void setRitardandoType(CARitardando::CARitardandoType t)
Definition: muselementfactory.h:214
CASlur::CASlurType _eSlurType
Definition: muselementfactory.h:245
int timeSigBeats()
Definition: muselementfactory.h:136
bool configureMark(CAMusElement *elt)
Definition: muselementfactory.cpp:315
const int instrument()
Definition: muselementfactory.h:201
CADiatonicKey::CAGender diatonicKeyGender()
Definition: muselementfactory.h:117
CARepeatMarkType
Definition: repeatmark.h:17
void setRepeatMarkType(const CARepeatMark::CARepeatMarkType t)
Definition: muselementfactory.h:223
void emptyMusElem()
Definition: muselementfactory.h:53
void configureMusElem(CAMusElement &roMusElement)
CARest::CARestType restType()
Definition: muselementfactory.h:131
CARepeatMark::CARepeatMarkType _repeatMarkType
Definition: muselementfactory.h:282
bool isFMTonicDegreeMinor()
Definition: muselementfactory.h:186
int _fingeringOriginal
Definition: muselementfactory.h:285
Class which represents a voice in the staff.
Definition: voice.h:22
int tupletNumber()
Definition: muselementfactory.h:156
int _tupletNumber
Definition: muselementfactory.h:246
CARestType
Definition: rest.h:17
void setClefOffset(int offset)
Definition: muselementfactory.h:149
CAArticulation::CAArticulationType articulationType()
Definition: muselementfactory.h:171
void setFermataType(const CAFermata::CAFermataType type)
Definition: muselementfactory.h:205
CAFunctionMark::CAFunctionType fmChordArea()
Definition: muselementfactory.h:177
bool configureNote(int pitch, CAVoice *voice, CAMusElement *right, bool addToChord)
Definition: muselementfactory.cpp:211
CAFunctionMark::CAFunctionType _fmFunction
Definition: muselementfactory.h:264
void setTimeSigBeat(int iTimeSigBeat)
Definition: muselementfactory.h:141
void setClef(CAClef::CAPredefinedClefType eClefType)
Definition: muselementfactory.h:145
CAMusElement::CAMusElementType musElementType()
Definition: muselementfactory.h:89
int noteAccs()
Definition: muselementfactory.h:104
CAMusElementFactory()
Definition: muselementfactory.cpp:56
bool _fmChordAreaMinor
Definition: muselementfactory.h:268
CAFunctionMark::CAFunctionType fmTonicDegree()
Definition: muselementfactory.h:180
Represents a note in the score.
Definition: note.h:18
const QString dynamicText()
Definition: muselementfactory.h:195
bool configureBarline(CAStaff *staff, CAMusElement *right)
Definition: muselementfactory.cpp:192
void setRestType(CARest::CARestType eType)
Definition: muselementfactory.h:133
void setSlurStyle(CASlur::CASlurStyle style)
Definition: muselementfactory.h:166
void subNoteExtraAccs(int iSub)
Definition: muselementfactory.h:128
CAPredefinedClefType
Definition: clef.h:20
void addPlayableDotted(int add, CAPlayableLength curLength)
Definition: muselementfactory.cpp:121
CAMusElement::CAMusElementType _musElementType
Definition: muselementfactory.h:240
void setMusElement(CAMusElement *elt)
Definition: muselementfactory.h:50
CANote::CAStemDirection noteStemDirection()
Definition: muselementfactory.h:99
void removeMusElem(bool bReallyRemove=false)
Definition: muselementfactory.cpp:114
void setCrescendoFinalVolume(const int v)
Definition: muselementfactory.h:217
bool isFMEllipse()
Definition: muselementfactory.h:192
void subNoteAccs(int iSub)
Definition: muselementfactory.h:112
const bool isFingeringOriginal()
Definition: muselementfactory.h:231
Musical length of notes and rests.
Definition: playablelength.h:16
CAMarkType
Definition: mark.h:17
void addNoteExtraAccs(int iAdd)
Definition: muselementfactory.h:125
CAMusElementType
Definition: muselement.h:22
void addNoteAccs(int iAdd)
Definition: muselementfactory.h:109
const int repeatMarkVoltaNumber()
Definition: muselementfactory.h:225
const int dynamicVolume()
Definition: muselementfactory.h:198
const CARitardando::CARitardandoType ritardandoType()
Definition: muselementfactory.h:213
static void placeAutoBar(CAPlayable *elt)
Definition: muselementfactory.cpp:477
const CAFingering::CAFingerNumber fingeringFinger()
Definition: muselementfactory.h:228
Context for function marks.
Definition: functionmarkcontext.h:19
CAFunctionType
Definition: functionmark.h:20
void setPlayableLength(CAPlayableLength &playableLength)
Definition: muselementfactory.h:94
void setFMFunctionMinor(bool m)
Definition: muselementfactory.h:184
void setArticulationType(CAArticulation::CAArticulationType t)
Definition: muselementfactory.h:172
CAFunctionMark::CAFunctionType fmFunction()
Definition: muselementfactory.h:174
int _dynamicVolume
Definition: muselementfactory.h:274
CABarline::CABarlineType barlineType()
Definition: muselementfactory.h:152
void setTempoBeat(CAPlayableLength &length)
Definition: muselementfactory.h:211
CADiatonicKey::CAGender _diatonicKeyGender
Definition: muselementfactory.h:253
int noteExtraAccs()
Definition: muselementfactory.h:120
CAArticulationType
Definition: articulation.h:16
int _tupletActualNumber
Definition: muselementfactory.h:247
int _iPlayableDotted
Definition: muselementfactory.h:248
int _iNoteAccs
Definition: muselementfactory.h:250
int _iNoteExtraAccs
Definition: muselementfactory.h:249
CAClef::CAPredefinedClefType clef()
Definition: muselementfactory.h:144
void setTimeSigBeats(int iTimeSigBeats)
Definition: muselementfactory.h:137
bool configureClef(CAStaff *staff, CAMusElement *right)
Definition: muselementfactory.cpp:140
CAPlayableLength & tempoBeat()
Definition: muselementfactory.h:210
CASlurStyle
Definition: slur.h:27
An abstract class which represents every music element in the score.
Definition: muselement.h:20
CAMark::CAMarkType _markType
Definition: muselementfactory.h:259
void setTupletActualNumber(int actualNumber)
Definition: muselementfactory.h:160
CAMusElement * mpoMusElement
Definition: muselementfactory.h:234
void setFMEllipse(bool e)
Definition: muselementfactory.h:193
CARitardando::CARitardandoType _ritardandoType
Definition: muselementfactory.h:279
CASlur::CASlurStyle slurStyle()
Definition: muselementfactory.h:165
CAMusElement * mpoEmpty
Definition: muselementfactory.h:235
CASlur::CASlurStyle _slurStyle
Definition: muselementfactory.h:261
void setFingeringOriginal(const int o)
Definition: muselementfactory.h:232
bool isFMChordAreaMinor()
Definition: muselementfactory.h:189
void setFMChordArea(CAFunctionMark::CAFunctionType c)
Definition: muselementfactory.h:178
Playable instances of music elements.
Definition: playable.h:18
bool configureRest(CAVoice *voice, CAMusElement *right)
Definition: muselementfactory.cpp:424
bool _fmFunctionMinor
Definition: muselementfactory.h:267
CAMusElement * createMusElem()
void setDiatonicKeyNumberOfAccs(int accs)
Definition: muselementfactory.h:116
bool configureSlur(CAStaff *staff, CANote *noteStart, CANote *noteEnd)
Definition: muselementfactory.cpp:279
CABarlineType
Definition: barline.h:19
CABarline::CABarlineType _eBarlineType
Definition: muselementfactory.h:258
bool configureTimeSignature(CAStaff *staff, CAMusElement *right)
Definition: muselementfactory.cpp:174
CAPlayableLength _tempoBeat
Definition: muselementfactory.h:277
CAArticulation::CAArticulationType _articulationType
Definition: muselementfactory.h:260
Represents a staff in the sheet.
Definition: staff.h:24
CAFermata::CAFermataType _fermataType
Definition: muselementfactory.h:276
const CARepeatMark::CARepeatMarkType repeatMarkType()
Definition: muselementfactory.h:222
CANote::CAStemDirection _eNoteStemDirection
Definition: muselementfactory.h:244
void setRepeatMarkVoltaNumber(const int n)
Definition: muselementfactory.h:226
bool configureFunctionMark(CAFunctionMarkContext *fmc, int timeStart, int timeLength)
Definition: muselementfactory.cpp:448
CACrescendo::CACrescendoType _crescendoType
Definition: muselementfactory.h:281
CACrescendoType
Definition: crescendo.h:17
CAPlayableLength _playableLength
Definition: muselementfactory.h:243
void setBarlineType(CABarline::CABarlineType type)
Definition: muselementfactory.h:153
CAClef::CAPredefinedClefType _eClef
Definition: muselementfactory.h:256
bool _fmTonicDegreeMinor
Definition: muselementfactory.h:269
const int crescendoFinalVolume()
Definition: muselementfactory.h:216
void setMarkType(CAMark::CAMarkType t)
Definition: muselementfactory.h:169
void setNoteAccs(int iNoteAccs)
Definition: muselementfactory.h:106
void setMusElementType(CAMusElement::CAMusElementType eMEType)
Definition: muselementfactory.h:90
void setDiatonicKeyGender(CADiatonicKey::CAGender g)
Definition: muselementfactory.h:118
int _repeatMarkVoltaNumber
Definition: muselementfactory.h:283
int _crescendoFinalVolume
Definition: muselementfactory.h:280
int _iTimeSigBeat
Definition: muselementfactory.h:255
void setFingeringFinger(const CAFingering::CAFingerNumber f)
Definition: muselementfactory.h:229
QString _dynamicText
Definition: muselementfactory.h:273
int clefOffset()
Definition: muselementfactory.h:148
CAFunctionMark::CAFunctionType _fmChordArea
Definition: muselementfactory.h:265
int diatonicKeyNumberOfAccs()
Definition: muselementfactory.h:115
CAMark::CAMarkType markType()
Definition: muselementfactory.h:168
CARest::CARestType _eRestType
Definition: muselementfactory.h:251
virtual CAMusElement * clone(CAContext *context=0)=0
CAFingerNumber
Definition: fingering.h:18
void setTempoBpm(const int tempoBpm)
Definition: muselementfactory.h:208
creation, removal, configuration of music elements
Definition: muselementfactory.h:38
void setFMChordAreaMinor(bool m)
Definition: muselementfactory.h:190
const CAFermata::CAFermataType fermataType()
Definition: muselementfactory.h:204
CARitardandoType
Definition: ritardando.h:17
const int tempoBpm()
Definition: muselementfactory.h:207
int _instrument
Definition: muselementfactory.h:275
~CAMusElementFactory()
Definition: muselementfactory.cpp:105
void setFMTonicDegreeMinor(bool m)
Definition: muselementfactory.h:187
bool configureTuplet(QList< CAPlayable * > listOfNotes)
Definition: muselementfactory.cpp:468
int _iClefOffset
Definition: muselementfactory.h:257
void setInstrument(const int instrument)
Definition: muselementfactory.h:202
CAGender
Definition: diatonickey.h:17
int timeSigBeat()
Definition: muselementfactory.h:140
void setSlurType(CASlur::CASlurType type)
Definition: muselementfactory.h:163
int tupletActualNumber()
Definition: muselementfactory.h:159