GUIDOLib  1.7.7
Guido Engine Internal Documentation
GRVoiceManager.h
1 #ifndef GRVoiceManager_H
2 #define GRVoiceManager_H
3 
4 /*
5  GUIDO Library
6  Copyright (C) 2002 Holger Hoos, Juergen Kilian, Kai Renz
7  Copyright (C) 2002-2017 Grame
8 
9  This Source Code Form is subject to the terms of the Mozilla Public
10  License, v. 2.0. If a copy of the MPL was not distributed with this
11  file, You can obtain one at http://mozilla.org/MPL/2.0/.
12 
13  Grame Research Laboratory, 11, cours de Verdun Gensoul 69002 Lyon - France
14  research@grame.fr
15 
16 */
17 
18 // #include "ARTStem.h"
19 // #include "GRTag.h"
20 #include "GRBeam.h"
21 #include "GRPossibleBreakState.h"
22 
23 template <class T> class KF_IPointerList;
24 
25 class ARTStem;
26 class ARTHead;
27 class ARDotFormat;
28 class ARNoteFormat;
29 class ARRestFormat;
30 class ARMusicalVoice;
31 class ARPositionTag;
32 class ARMusicalTag;
33 class ARMusicalEvent;
34 
35 class GRBeam;
36 class GRChordTag;
37 class GRCluster;
38 class GREvent;
39 class GRGlissando;
40 class GRGlobalLocation;
41 class GRGlobalStem;
42 class GRGrace;
43 class GRIntens;
44 class GRMusic;
45 class GRNotationElement;
46 class GRRange;
47 class GRSingleNote;
48 class GRStaff;
49 class GRStaffManager;
50 class GRTag;
52 class GRTrill;
53 class GRVoice;
54 class NEPointerList;
55 
57 
61 {
62  friend class GRStaffManager;
63  friend class GRPossibleBreakState;
64 
65 public:
66  GRVoiceManager(GRMusic* music, GRStaffManager * p_staffmgr, const ARMusicalVoice * p_voice, int p_voicenum);
67  virtual ~GRVoiceManager();
68 
69  float pbreakval;
70 
71  void ReadBeginTags(const TYPE_TIMEPOSITION & tp);
72  void setGRStaff(GRStaff * newstaff);
73  void closeOpenTags();
74  float GetBreakScore(const TYPE_TIMEPOSITION & tp);
75  GRVoice * getGRVoice();
76 
79  NEWSYSTEM = -3,
80  NEWPAGE = -4,
81  PBREAK = -5,
82  MODEERROR = -6,
84  DONE = 0,
87 
88 
89  void checkCenterRest (GRStaff * grstaff, float lastpos, float newpos);
90  void removeAssociations (const NEPointerList & nl);
91  GRStaff * getCurStaff() const;
92  virtual void addGRTag (GRTag * grtag, int head=1);
95 
96  // virtual void ManageVoice(int n);
97 
98 // virtual void EndManageVoice( const TYPE_TIMEPOSITION & tp);
99  virtual void BeginManageVoice();
100 
101  int Iterate (TYPE_TIMEPOSITION & tp, int filltagmode);
102  int DoBreak (const TYPE_TIMEPOSITION & tp, int system_or_page);
103  int getStaffNum () const { return staffnum; }
104  const ARMusicalVoiceState * getVoiceState() const { return fVoiceState; }
105  const ARMusicalVoice* getARVoice() const { return arVoice; }
106  static void resetCurrentNotesTP() { fCurrentNotesTP.clear(); }
107 
108 protected:
109  void beginOpenTags();
110 
112  int voicenum;
114 
118 
119 // virtual void addStartPTags();
120 
123 
127 
136 
137  static bool & getCurStaffDraw(int index);
138 
140  int staffnum;
141 
142  GREvent *CreateNote (const TYPE_TIMEPOSITION & tp, ARMusicalObject * arObject);
143  GREvent *CreateTab (const TYPE_TIMEPOSITION & tp, ARMusicalObject * arObject);
144  GREvent *CreateEmpty (const TYPE_TIMEPOSITION & tp, ARMusicalObject * arObject);
145  GREvent *CreateRest (const TYPE_TIMEPOSITION & tp, ARMusicalObject * arObject);
146  GREvent *CreateGraceNote (const TYPE_TIMEPOSITION & tp, ARMusicalObject * arObject, const TYPE_DURATION & dur);
147 
148  virtual void checkStartPTags(GuidoPos tstpos);
149  virtual void checkEndPTags(GuidoPos tstpos);
150 
151  GRTagPointerList * getGRTags() { return fGRTags; }
152  GRTagPointerList * nlinegrtags; // remembered for the nline-state ...
153 
154  GRNotationElement * parseTag(ARMusicalObject * arOfCompleteObject);
155  void parsePositionTag (ARPositionTag * apt);
156  bool parseStateTag (const ARMusicalTag * mtag);
157  bool checkRepeatBeginNext();
158 
160 
161  // - for clusters
163 
164 private:
165  // this is needed for determining the elements that are centered in a bar like whole-note-rests
166  GRMusic* fMusic;
167  GREvent * fLastnonzeroevent;
168  GRTagARNotationElement* fLastbar;
169  GROctava* fLastOctava;
170  ARMusicalVoiceState * fVoiceState;
171  GRTagPointerList * fGRTags;
172  GRTrill* fCurrentTrill = 0;
173 
174 
175  GRSingleNote * CreateSingleNote (const TYPE_TIMEPOSITION & tp, ARMusicalObject * arObject, float size=0, bool isGrace=false);
176  void AddRegularEvent (GREvent * ev);
177  void organizeGlissando(GRTag * g);
178  void organizeBeaming(GRBeam * grb);
179  void checkFillBar (GRTagARNotationElement* bar);
180  void addAssociations (GREvent* ev, bool setnext=true);
181  int endIteration ();
182  void checkCluster(GREvent *ev);
183  void checkHiddenNotes(const std::vector<GRSingleNote *>& notes);
184 
185  int IterateEvent (ARMusicalEvent * arev, TYPE_TIMEPOSITION &timepos);
186  int IterateNoDurEvent (ARMusicalObject * obj, const TYPE_TIMEPOSITION& timepos);
187  int IterateTag (ARMusicalObject * obj);
188  int IterateChord (const TYPE_TIMEPOSITION& timepos);
189  TYPE_DURATION findDuration (const ARMusicalVoiceState * state, const ARMusicalEvent* ev) const;
190  void doAssociate(GRSingleNote * grnote);
191 
192  std::vector<GRBeam *> fCurbeam;
193  std::vector<GRBeam *> fBeams;
194  typedef std::vector<std::pair<GRRange*, GRSingleNote*> > TSharedArticulationsList;
195  TSharedArticulationsList fSharedArticulations;
196  void handleSharedArticulations(const TSharedArticulationsList& list);
197  void setTrillNext (GRNotationElement* ev);
198 
199  static std::vector<GRSingleNote *> fCurrentNotesTP; // current notes at a given time position (shared)
200 };
201 
202 #endif
ARMusicalVoice
The class for GUIDO sequence, list of timepositions of events of a stream.
Definition: ARMusicalVoice.h:76
GRVoiceManager::rememberLastNLinePosition
void rememberLastNLinePosition(const TYPE_TIMEPOSITION &tp)
GRSingleNote
Graphical representation of a note event.
Definition: GRSingleNote.h:38
GRVoiceManager::arVoice
const ARMusicalVoice * arVoice
Definition: GRVoiceManager.h:129
ARRestFormat
not yet documented
Definition: ARRestFormat.h:42
ARTHead
not yet documented
Definition: ARTHead.h:77
GRVoiceManager::BeginManageVoice
virtual void BeginManageVoice()
GRVoiceManager::getStaffNum
int getStaffNum() const
Definition: GRVoiceManager.h:103
GRVoiceManager::mCurCluster
GRCluster * mCurCluster
Definition: GRVoiceManager.h:125
GRVoiceManager::checkRepeatBeginNext
bool checkRepeatBeginNext()
ARMusicalEvent
Class for musical events (events have an own duration tags not)
Definition: ARMusicalEvent.h:26
GRVoiceManager::curheadstate
const ARTHead * curheadstate
Definition: GRVoiceManager.h:134
GRVoiceManager::checkEndPTags
virtual void checkEndPTags(GuidoPos tstpos)
GRStaffManager
This class manages the staffs of a system.
Definition: GRStaffManager.h:160
GRVoiceManager::addGRTag
virtual void addGRTag(GRTag *grtag, int head=1)
Fraction
Numerator and denominator.
Definition: Fraction.h:23
GRNotationElement
parent class for all notation elements.
Definition: GRNotationElement.h:54
GRMusic
Graphical representation of the music. It handles a list of voices and a list of pages.
Definition: GRMusic.h:41
GREvent
Graphical representation for an event (= has duration).
Definition: GREvent.h:61
GRVoiceManager::CreateRest
GREvent * CreateRest(const TYPE_TIMEPOSITION &tp, ARMusicalObject *arObject)
GRVoiceManager::curdotformat
const ARDotFormat * curdotformat
Definition: GRVoiceManager.h:131
GRVoiceManager::curev
const ARMusicalEvent * curev
Definition: GRVoiceManager.h:128
GRVoiceManager::CreateNote
GREvent * CreateNote(const TYPE_TIMEPOSITION &tp, ARMusicalObject *arObject)
GRVoiceManager::getARVoice
const ARMusicalVoice * getARVoice() const
Definition: GRVoiceManager.h:105
GRVoiceManager::mCurGrStaff
GRStaff * mCurGrStaff
Definition: GRVoiceManager.h:121
GRVoiceManager
not yet documented
Definition: GRVoiceManager.h:60
GRVoiceManager::staffnum
int staffnum
Definition: GRVoiceManager.h:140
GRVoiceManager::CURTPBIGGER_ZEROFOLLOWS
Definition: GRVoiceManager.h:77
GRVoiceManager::lastev
GREvent * lastev
Definition: GRVoiceManager.h:113
GRVoiceManager::closeOpenTags
void closeOpenTags()
GRVoiceManager::parseStateTag
bool parseStateTag(const ARMusicalTag *mtag)
GRVoiceManager::ReadBeginTags
void ReadBeginTags(const TYPE_TIMEPOSITION &tp)
GRVoiceManager::mCurGrace
GRGrace * mCurGrace
Definition: GRVoiceManager.h:124
GRVoiceManager::setPossibleNLinePosition
void setPossibleNLinePosition(const TYPE_TIMEPOSITION &tp)
GRVoiceManager::GRVoiceManager
GRVoiceManager(GRMusic *music, GRStaffManager *p_staffmgr, const ARMusicalVoice *p_voice, int p_voicenum)
GRStaff
A GRStaff represents a single line of music.
Definition: GRStaff.h:181
GRGrace
not yet documented
Definition: GRGrace.h:26
ARTStem
not yet documented
Definition: ARTStem.h:80
GRVoiceManager::CreateEmpty
GREvent * CreateEmpty(const TYPE_TIMEPOSITION &tp, ARMusicalObject *arObject)
ARDotFormat
not yet documented
Definition: ARDotFormat.h:40
GRVoiceManager::CreateTab
GREvent * CreateTab(const TYPE_TIMEPOSITION &tp, ARMusicalObject *arObject)
GRVoiceManager::DONE_EVFOLLOWS
Definition: GRVoiceManager.h:86
KF_IPointerList
Definition: ARMusicalVoiceState.h:33
GRRange
Placeholder for range-tags that directly place articulation marks for notes/events ....
Definition: GRRange.h:29
GRVoiceManager::getGRTags
GRTagPointerList * getGRTags()
Definition: GRVoiceManager.h:151
GRVoiceManager::parsePositionTag
void parsePositionTag(ARPositionTag *apt)
GRVoiceManager::getCurStaffDraw
static bool & getCurStaffDraw(int index)
GRVoiceManager::~GRVoiceManager
virtual ~GRVoiceManager()
GRVoiceManager::getGRVoice
GRVoice * getGRVoice()
GRVoiceManager::getCurStaff
GRStaff * getCurStaff() const
ARNoteFormat
not yet documented
Definition: ARNoteFormat.h:51
GRVoiceManager::checkStartPTags
virtual void checkStartPTags(GuidoPos tstpos)
GRVoiceManager::NEWSYSTEM
Definition: GRVoiceManager.h:79
GRGlobalLocation
not yet documented
Definition: GRGlobalLocation.h:30
GRVoice
Graphical representation of a voice.
Definition: GRVoice.h:49
GRVoiceManager::DoBreak
int DoBreak(const TYPE_TIMEPOSITION &tp, int system_or_page)
GRVoiceManager::currestformat
const ARRestFormat * currestformat
Definition: GRVoiceManager.h:132
GRVoiceManager::curglobalstem
GRGlobalStem * curglobalstem
Definition: GRVoiceManager.h:116
GRVoiceManager::DONE_ZEROFOLLOWS
Definition: GRVoiceManager.h:85
GRVoiceManager::mCurrentClusterNoteNumber
int mCurrentClusterNoteNumber
Definition: GRVoiceManager.h:162
GRVoiceManager::curchordtag
GRChordTag * curchordtag
Definition: GRVoiceManager.h:115
GRPossibleBreakState::tp
TYPE_TIMEPOSITION tp
Definition: GRPossibleBreakState.h:129
GRChordTag
The Chord Tag.
Definition: GRChordTag.h:29
GRVoiceManager::grvoice
GRVoice * grvoice
Definition: GRVoiceManager.h:111
GRVoiceManager::Iterate
int Iterate(TYPE_TIMEPOSITION &tp, int filltagmode)
GRVoiceManager::mCurGlissando
GRGlissando * mCurGlissando
Definition: GRVoiceManager.h:126
GRVoiceManager::ENDOFVOICE
Definition: GRVoiceManager.h:83
GRVoiceManager::curnoteformat
const ARNoteFormat * curnoteformat
Definition: GRVoiceManager.h:130
GRVoiceManager::checkCenterRest
void checkCenterRest(GRStaff *grstaff, float lastpos, float newpos)
GRTagARNotationElement
GRTagARNotationElement.
Definition: GRTagARNotationElement.h:26
GRVoiceManager::parseTag
GRNotationElement * parseTag(ARMusicalObject *arOfCompleteObject)
GRVoiceManager::pbreakval
float pbreakval
Definition: GRVoiceManager.h:69
ARMusicalTag
The base class for all musical tag classes.
Definition: ARMusicalTag.h:34
GRVoiceManager::voicenum
int voicenum
Definition: GRVoiceManager.h:112
ARMusicalVoiceState
This class manage the state of a voice. Here additional information for voices will be stored (i....
Definition: ARMusicalVoiceState.h:39
GRVoiceManager::mStaffMgr
GRStaffManager * mStaffMgr
Definition: GRVoiceManager.h:122
GRVoiceManager::DONE
Definition: GRVoiceManager.h:84
GRIntens
not yet documented
Definition: GRIntens.h:28
GRBeam
The Beam notation element.
Definition: GRBeam.h:79
GRVoiceManager::CURTPBIGGER_EVFOLLOWS
Definition: GRVoiceManager.h:78
GRTag
The GRTag class is the base class for all GUIDO tags.
Definition: GRTag.h:37
GRVoiceManager::nlinegrtags
GRTagPointerList * nlinegrtags
Definition: GRVoiceManager.h:152
GRVoiceManager::getVoiceState
const ARMusicalVoiceState * getVoiceState() const
Definition: GRVoiceManager.h:104
GRGlobalStem
Shared stem.
Definition: GRGlobalStem.h:36
GRVoiceManager::MODEERROR
Definition: GRVoiceManager.h:82
ARPositionTag
The base class for all range tags.
Definition: ARPositionTag.h:26
GRVoiceManager::toadd
GRTagPointerList * toadd
Definition: GRVoiceManager.h:159
GRVoiceManager::beginOpenTags
void beginOpenTags()
GRVoiceManager::NEWPAGE
Definition: GRVoiceManager.h:80
GRCluster
Graphical representation of a cluster.
Definition: GRCluster.h:29
GRVoiceManager::CreateGraceNote
GREvent * CreateGraceNote(const TYPE_TIMEPOSITION &tp, ARMusicalObject *arObject, const TYPE_DURATION &dur)
GRVoiceManager::curstemstate
const ARTStem * curstemstate
Definition: GRVoiceManager.h:133
ARMusicalObject
The base class for all AR objects. It contains all musical information : duration and time position.
Definition: ARMusicalObject.h:33
GRVoiceManager::curgloballocation
GRGlobalLocation * curgloballocation
Definition: GRVoiceManager.h:117
GRVoiceManager::setGRStaff
void setGRStaff(GRStaff *newstaff)
GRVoiceManager::removeAssociations
void removeAssociations(const NEPointerList &nl)
GRGlissando
Definition: GRGlissando.h:30
NEPointerList
Definition: NEPointerList.h:34
GRVoiceManager::curIntens
GRIntens * curIntens
Definition: GRVoiceManager.h:135
GRVoiceManager::PBREAK
Definition: GRVoiceManager.h:81
GRTrill
GRTrill tag.
Definition: GRTrill.h:32
GRVoiceManager::resetCurrentNotesTP
static void resetCurrentNotesTP()
Definition: GRVoiceManager.h:106
GROctava
not yet documented
Definition: GROctava.h:33
GRVoiceManager::GetBreakScore
float GetBreakScore(const TYPE_TIMEPOSITION &tp)
GRPossibleBreakState
GRPossibleBreakState saves the states of all structures that are important, if it is decided by the B...
Definition: GRPossibleBreakState.h:35
GRVoiceManager::curtp
TYPE_TIMEPOSITION curtp
Definition: GRVoiceManager.h:139

Guido Project Copyright © 2019 Grame-CNCM