GUIDOLib  1.7.7
Guido Engine Internal Documentation
ARKey.h
1 #ifndef ARKey_H
2 #define ARKey_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 "GuidoDefs.h"
19 
20 #include "ARMTParameter.h"
21 
22 /*@mkdoc
23 
24 @group:Clef Key Meter
25 
26 @tagname:\key
27 @tagalias:
28 @tagtype:P
29 @tagnotation:key signatures
30 @tagdesc
31 The **\key** tag displays a key signature specified as tonality or as a number of sharps or flats. It supports also arbitrary keys and micro-tonality.
32 @tagend
33 
34 
35 @params:
36 @param:key:string\|integer:F, C, G, D, A, E, B, H or a signed integer<br />a free key string:*none*:false
37 @param:hideNaturals:string:a boolean value to prevent naturals on key change:false:true
38 @param:free:string:a free key string:*none*:true
39 @paramdesc
40 - when specified with a signed integer, positive values are for sharps and negative values for flat
41 - F is equivalent to -1
42 - C, G, D, A, E are respectively equivalent to 0, 1, 2, 3 and 4
43 - B and H are equivalent to 5
44 - a **free key** string is an arbitrary list of notes with accidentals separated by spaces. When not indicated, an accidental takes the previous value, Accidentals support micro-tonality using signed floating point numbers inside brackets. Example: "g#d&" denotes a key signature with a 'g' sharp and a 'd' flat; "f[0.5]c" denotes a key with a quarter tone sharp on 'f' and 'c'.
45 
46 See the [Key](@EXAMPLES/clefkeymeter/) example.
47 @paramend
48 
49 */
50 
51 
54 class ARKey : public ARMTParameter
55 {
56  void getKeyArray (std::string inString);
57  bool getOctave (const char*& ptr, int& oct) const;
58 
59  public:
60  ARKey(const TYPE_TIMEPOSITION & timeposition);
61  ARKey(int p_keynumber);
62  ARKey();
63  ARKey(const ARKey & key);
64  virtual ~ARKey() {}
65 
66  virtual bool operator==(const ARKey & k) const;
67 
68  virtual bool IsStateTag() const { return true; }
69  virtual int getOrder() const { return kKeyOrder; }
70  virtual const char* getParamsStr() const { return kARKeyParams; };
71  virtual const char* getTagName() const { return "ARKey"; };
72  virtual std::string getGMNName() const { return "\\key"; };
73 
74  virtual void setTagParameters (const TagParameterMap& params);
75 
76  int getKeyNumber() const { return fKeyNumber; }
77  void setKeyNumber(int newnumber) { fKeyNumber = newnumber; }
78  bool hideAutoNaturals() const { return fHideAutoNaturals; }
80  bool freeKey() const { return fIsFree; }
81 
82  virtual void getOctArray(int *) const;
83  virtual void getFreeKeyArray(float *) const;
84  ARMusicalObject *isARKey() { return this; }
85 
86  static float getAccidental (const char*& ptr);
87  static int getNote (const char*& ptr);
88 
89  protected:
92  bool fIsFree; // True if accidental free specified
93  bool fHideAutoNaturalsSet = false;
94  int fKeyNumber; // >0 = nr of #, < 0 = nr of &
95  float fAccarray [NUMNOTES];
96  int fOctarray [NUMNOTES];
97 
98  private:
99  void init();
100  void name2KeyNum (std::string name);
101  void getFreeKeyArray (const std::string& inString);
102 };
103 
104 #endif
105 
ARKey::setTagParameters
virtual void setTagParameters(const TagParameterMap &params)
ARKey::fIsFree
bool fIsFree
Definition: ARKey.h:92
Fraction
Numerator and denominator.
Definition: Fraction.h:23
ARKey::isARKey
ARMusicalObject * isARKey()
Definition: ARKey.h:84
ARKey
Key signature.
Definition: ARKey.h:54
ARKey::getTagName
virtual const char * getTagName() const
Definition: ARKey.h:71
ARKey::fOctarray
int fOctarray[NUMNOTES]
Definition: ARKey.h:96
ARMTParameter
not yet documented
Definition: ARMTParameter.h:24
ARKey::fKeyNumber
int fKeyNumber
Definition: ARKey.h:94
ARKey::getFreeKeyArray
virtual void getFreeKeyArray(float *) const
ARKey::isHideAutoNaturalsSet
bool isHideAutoNaturalsSet() const
Definition: ARKey.h:79
ARKey::fAccarray
float fAccarray[NUMNOTES]
Definition: ARKey.h:95
ARKey::~ARKey
virtual ~ARKey()
Definition: ARKey.h:64
ARKey::getOctArray
virtual void getOctArray(int *) const
ARKey::getOrder
virtual int getOrder() const
Definition: ARKey.h:69
ARKey::freeKey
bool freeKey() const
Definition: ARKey.h:80
ARKey::fHideAutoNaturalsSet
bool fHideAutoNaturalsSet
Definition: ARKey.h:93
ARKey::hideAutoNaturals
bool hideAutoNaturals() const
Definition: ARKey.h:78
ARKey::setKeyNumber
void setKeyNumber(int newnumber)
Definition: ARKey.h:77
ARKey::getNote
static int getNote(const char *&ptr)
ARMusicalTag::kKeyOrder
Definition: ARMusicalTag.h:40
ARKey::getAccidental
static float getAccidental(const char *&ptr)
ARKey::getParamsStr
virtual const char * getParamsStr() const
Definition: ARKey.h:70
ARKey::fHideAutoNaturals
bool fHideAutoNaturals
if true -> don't show auto generated naturals at key signature changes
Definition: ARKey.h:91
ARKey::ARKey
ARKey()
ARKey::getKeyNumber
int getKeyNumber() const
Definition: ARKey.h:76
ARKey::IsStateTag
virtual bool IsStateTag() const
Definition: ARKey.h:68
ARKey::operator==
virtual bool operator==(const ARKey &k) const
TagParameterMap
A list of tag parameters represented as a map.
Definition: TagParameterMap.h:31
ARKey::getGMNName
virtual std::string getGMNName() const
Definition: ARKey.h:72
ARMusicalObject
The base class for all AR objects. It contains all musical information : duration and time position.
Definition: ARMusicalObject.h:33

Guido Project Copyright © 2019 Grame-CNCM