GUIDOLib  1.7.7
Guido Engine Internal Documentation
ARNote.h
1 #ifndef ARNote_H
2 #define ARNote_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 #include <string>
17 
18 #include "ARAlter.h"
19 #include "ARNoteName.h"
20 #include "ARMusicalEvent.h"
21 #include "GuidoDefs.h"
22 
23 
24 class ARTrill;
25 class ARCluster;
26 class ARTremolo;
27 
30 class ARNote : public ARMusicalEvent
31 {
32  public:
33  ARNote( const TYPE_DURATION & durationOfNote );
34  ARNote( const TYPE_TIMEPOSITION & relativeTimePositionOfNote, const TYPE_DURATION & durationOfNote );
35  ARNote( const std::string& name, int accidentals, int octave, int numerator, int denominator, int intensity );
36  ARNote( const ARNote & arnote, bool istied=false );
37  virtual ~ARNote();
38 
39  virtual void operator=(const ARNote* note);
40 
41  virtual ARNote* Clone(bool istied = false ) const;
42  virtual int CompareNameOctavePitch( const ARNote & nt );
43  virtual void setDuration( const TYPE_DURATION & newdur );
44  virtual bool CanBeMerged( const ARMusicalEvent * ev2 );
45 
46  virtual ARMusicalObject * Copy() const;
47 
48  virtual void print(std::ostream & os) const;
49  virtual const char* getParamsStr() const { return ""; };
50  virtual const char* getTagName() const { return "ARNote"; };
51  virtual std::string getGMNName() const;
52 
53  virtual void browse(TimeUnwrap& mapper) const;
54 
55  void addFlat();
56  void addSharp();
57 
58  const ARNoteName & getName() const { return fName; }
59  int getOctave() const { return fOctave; }
60  int getPitch() const { return fPitch; }
61  int getOctava() const { return fOctava; }
62 
63  void setOctava(int octava) { fOctava = octava; }
64  void setPitch( int newpitch );
65  void setOctave( int newOctave ) { fOctave = newOctave;}
66  void offsetpitch( int steps );
67 
68  int getAccidentals() const { return fAccidentals; }
69  float getDetune() const { return fAlter ? fAlter->getDetune() : 0; }
70  const ARAlter * getAlter() const { return fAlter; }
71  float getPitchShift() const { return getDetune() + fAccidentals; }
72  const ARTrill* getOrnament() const { return fOrnament;}
73  ARCluster * getARCluster() { return fCluster;}
74  const ARCluster* getARCluster() const { return fCluster;}
75 
76  bool isLonelyInCluster() const { return fIsLonelyInCluster; }
77  bool doesClusterHaveToBeDrawn() const { return fClusterHaveToBeDrawn; }
78  void enableSubElements(bool enabled) { fSubElementsHaveToBeDrawn = enabled; }
79  bool haveSubElementsToBeDrawn() const { return fSubElementsHaveToBeDrawn; }
80  const ARTremolo* getTremolo() { return fTremolo; }
81  NVstring getAppearance() const { return fNoteAppearance; }
82  int getMidiPitch() const;
83 
84  void setTremolo(const ARTremolo* trem) { fTremolo = trem; }
85  void setIsLonelyInCluster() { fIsLonelyInCluster = true; }
86  void setAlter( const ARAlter * alter ) { fAlter = alter; }
87  void setOrnament(const ARTrill *newOrnament, bool trillOwner=true);
88  void setAccidentals( int theAccidentals );
89  ARCluster* setCluster(ARCluster *inCluster, bool inClusterHaveToBeDrawn = false,
90  bool inHaveToBeCreated = false);
91 
92  static int detune2Quarters(float detune);
93 
94  // Used when dispNote param is set on \tuplet-tag to force note appearance
95  void forceNoteAppearance(NVstring noteAppearance);
96 
97  /**** Function to avoid dynamic_cast ****/
98  virtual ARNote* isARNote() { return this; }
99  virtual const ARNote* isARNote() const { return this; }
100  virtual bool isEmptyNote() const { return getName() == "empty"; }
101  bool isAuto() const { return fAuto; }
102  void setAuto(bool val) { fAuto = val; }
103 
104 
105  private:
106  ARNoteName fName;
107 
108  int fPitch;
109  int fOctave;
110  int fAccidentals;
111  int fIntensity;
112  const ARTrill *fOrnament;
113  ARCluster *fCluster;
114  bool fOwnCluster;
115  bool fIsLonelyInCluster;
116  bool fClusterHaveToBeDrawn;
117  bool fSubElementsHaveToBeDrawn;
118  bool fAuto; // a flag to discriminate notes created by the auto stuff (e.g. due to barlines)
119  const ARTremolo * fTremolo = 0;
120  const ARAlter * fAlter = 0;
121 
122  bool fTrillOwner = false;
123  NVstring fNoteAppearance;
124  int fOctava; // for octava signs
125 };
126 
127 #endif
ARNote::haveSubElementsToBeDrawn
bool haveSubElementsToBeDrawn() const
Definition: ARNote.h:79
ARNote::addFlat
void addFlat()
ARNote::getAccidentals
int getAccidentals() const
Definition: ARNote.h:68
ARNote::getAlter
const ARAlter * getAlter() const
Definition: ARNote.h:70
ARNote::Copy
virtual ARMusicalObject * Copy() const
ARNote::isAuto
bool isAuto() const
Definition: ARNote.h:101
ARNote::detune2Quarters
static int detune2Quarters(float detune)
ARTrill
not yet documented
Definition: ARTrill.h:115
ARNote::getParamsStr
virtual const char * getParamsStr() const
Definition: ARNote.h:49
ARMusicalEvent
Class for musical events (events have an own duration tags not)
Definition: ARMusicalEvent.h:26
ARNote::~ARNote
virtual ~ARNote()
ARNote::setOrnament
void setOrnament(const ARTrill *newOrnament, bool trillOwner=true)
ARNote::getMidiPitch
int getMidiPitch() const
ARNote::getOctave
int getOctave() const
Definition: ARNote.h:59
ARNote::setAccidentals
void setAccidentals(int theAccidentals)
Fraction
Numerator and denominator.
Definition: Fraction.h:23
ARNote::print
virtual void print(std::ostream &os) const
ARNote::CompareNameOctavePitch
virtual int CompareNameOctavePitch(const ARNote &nt)
ARNote::getPitchShift
float getPitchShift() const
Definition: ARNote.h:71
ARNote::Clone
virtual ARNote * Clone(bool istied=false) const
ARNote::getGMNName
virtual std::string getGMNName() const
ARNote::CanBeMerged
virtual bool CanBeMerged(const ARMusicalEvent *ev2)
ARNote::getARCluster
const ARCluster * getARCluster() const
Definition: ARNote.h:74
ARAlter
The Alter tag.
Definition: ARAlter.h:48
ARTremolo
not yet documented
Definition: ARTremolo.h:51
ARNote::getTagName
virtual const char * getTagName() const
Definition: ARNote.h:50
ARNote::setCluster
ARCluster * setCluster(ARCluster *inCluster, bool inClusterHaveToBeDrawn=false, bool inHaveToBeCreated=false)
ARNote::forceNoteAppearance
void forceNoteAppearance(NVstring noteAppearance)
ARNote::getTremolo
const ARTremolo * getTremolo()
Definition: ARNote.h:80
ARNote::setTremolo
void setTremolo(const ARTremolo *trem)
Definition: ARNote.h:84
ARNote::doesClusterHaveToBeDrawn
bool doesClusterHaveToBeDrawn() const
Definition: ARNote.h:77
ARNote::getDetune
float getDetune() const
Definition: ARNote.h:69
ARNote::setOctava
void setOctava(int octava)
Definition: ARNote.h:63
ARNote::operator=
virtual void operator=(const ARNote *note)
ARNote::isLonelyInCluster
bool isLonelyInCluster() const
Definition: ARNote.h:76
ARNote::setAlter
void setAlter(const ARAlter *alter)
Definition: ARNote.h:86
ARNote::getARCluster
ARCluster * getARCluster()
Definition: ARNote.h:73
ARNote::setAuto
void setAuto(bool val)
Definition: ARNote.h:102
ARNote::setPitch
void setPitch(int newpitch)
ARNote::getPitch
int getPitch() const
Definition: ARNote.h:60
ARNote::getAppearance
NVstring getAppearance() const
Definition: ARNote.h:81
ARNote::isARNote
virtual ARNote * isARNote()
Definition: ARNote.h:98
ARNote::setOctave
void setOctave(int newOctave)
Definition: ARNote.h:65
ARNote::ARNote
ARNote(const TYPE_DURATION &durationOfNote)
ARNote::enableSubElements
void enableSubElements(bool enabled)
Definition: ARNote.h:78
ARNote::browse
virtual void browse(TimeUnwrap &mapper) const
NVstring
Definition: nvstring.h:21
ARNoteName
Definition: ARNoteName.h:28
ARAlter::getDetune
virtual float getDetune() const
ARNote::setIsLonelyInCluster
void setIsLonelyInCluster()
Definition: ARNote.h:85
ARNote::getName
const ARNoteName & getName() const
Definition: ARNote.h:58
ARNote
Representation of a GUIDO note.
Definition: ARNote.h:30
ARNote::isEmptyNote
virtual bool isEmptyNote() const
Definition: ARNote.h:100
ARCluster
not yet documented
Definition: ARCluster.h:47
ARNote::setDuration
virtual void setDuration(const TYPE_DURATION &newdur)
ARMusicalObject
The base class for all AR objects. It contains all musical information : duration and time position.
Definition: ARMusicalObject.h:33
ARNote::offsetpitch
void offsetpitch(int steps)
ARNote::addSharp
void addSharp()
ARNote::getOctava
int getOctava() const
Definition: ARNote.h:61
ARNote::isARNote
virtual const ARNote * isARNote() const
Definition: ARNote.h:99
ARNote::getOrnament
const ARTrill * getOrnament() const
Definition: ARNote.h:72
TimeUnwrap
Definition: TimeUnwrap.h:29

Guido Project Copyright © 2019 Grame-CNCM