GUIDOLib  1.7.7
Guido Engine Internal Documentation
ARTempo.h
1 #ifndef ARTempo_H
2 #define ARTempo_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 "ARMTParameter.h"
19 #include "ARFontAble.h"
20 #include "FormatStringParser.h"
21 
22 /*@mkdoc
23 
24 @group:Tempo
25 
26 @tagname:\tempo
27 @tagalias:
28 @tagtype:P
29 @tagnotation:a tempo mark
30 @tagdesc
31 @tagend
32 
33 @params:
34 @param:tempo:string:a tempo string:*none*:false
35 @param:bpm:string::*none*:true
36 @fontparams:
37 @paramdesc
38 - **tempo** is an arbitrary string that may contain a marker for note duration in the form "[n/d]" where 'n' and 'd' are integers.
39 The corresponding mark is decoded as a note duration and replaced with the corresponding note symbol. <br/>Example: "Andante [1/4] = 80"
40 
41 See the [Tempo](@EXAMPLES/tempo/) example. <br />
42 See the [Lutkin](@EXAMPLES/lutkin/) example.
43 @paramend
44 
45 */
46 
72 class ARTempo : /* public ARMTParameter, */ public ARFontAble
73 {
74  public:
75  ARTempo();
76  virtual ~ARTempo() {}
77 
78  virtual const char* getParamsStr() const { return kARTempoParams; };
79  virtual const char* getTagName() const { return "ARTempo"; };
80  virtual std::string getGMNName() const { return "\\tempo"; };
81 
82  virtual void setTagParameters(const TagParameterMap& map);
83 
85  const FormatStringParserResult& getTempoMark() const { return mTempoMark; }
86 
88  bool hasBpmInfos() const { return mHasBpmInfos; }
89 
93  bool isNoteEquiv() const { return mBpmNoteEquiv; }
94 
95 
101  TYPE_DURATION getBpmUnit() const { return mBpmUnit; }
102 
103 
109  TYPE_DURATION getBpmValue() const { return mBpmValue; }
110 
113  float getQpmValue() const;
114 
115  virtual void browse(TimeUnwrap& mapper) const;
116  virtual ARTempo *isARTempo() { return this; }
117 
119  static TYPE_DURATION string2Duration (const char * str);
120 
121  private:
122  void ParseBpm(const char* str );
123 
124  FormatStringParserResult mTempoMark;
125 
126  TYPE_DURATION mBpmUnit; // bpm="mBpmUnit=mBpmValue">
127  TYPE_DURATION mBpmValue;
128  bool mBpmNoteEquiv; // true if bpm value is a note equivalent.
129  bool mHasBpmInfos;
130 };
131 
132 
133 #endif
134 
135 
ARTempo::getTempoMark
const FormatStringParserResult & getTempoMark() const
Gives the tempo information strings vector.
Definition: ARTempo.h:85
ARTempo::getParamsStr
virtual const char * getParamsStr() const
Definition: ARTempo.h:78
Fraction
Numerator and denominator.
Definition: Fraction.h:23
ARTempo::getBpmUnit
TYPE_DURATION getBpmUnit() const
Definition: ARTempo.h:101
ARFontAble
Definition: ARFontAble.h:21
ARTempo::browse
virtual void browse(TimeUnwrap &mapper) const
ARTempo::hasBpmInfos
bool hasBpmInfos() const
Tells if the optional bpm informations have been specified.
Definition: ARTempo.h:88
ARTempo::getQpmValue
float getQpmValue() const
ARTempo::isNoteEquiv
bool isNoteEquiv() const
Definition: ARTempo.h:93
ARTempo::getBpmValue
TYPE_DURATION getBpmValue() const
Definition: ARTempo.h:109
ARTempo::setTagParameters
virtual void setTagParameters(const TagParameterMap &map)
ARTempo::ARTempo
ARTempo()
ARTempo::string2Duration
static TYPE_DURATION string2Duration(const char *str)
Converts a string in the form "a/b" into a duration.
ARTempo::getTagName
virtual const char * getTagName() const
Definition: ARTempo.h:79
ARTempo
The tempo tag parameter.
Definition: ARTempo.h:72
ARTempo::isARTempo
virtual ARTempo * isARTempo()
Definition: ARTempo.h:116
ARTempo::getGMNName
virtual std::string getGMNName() const
Definition: ARTempo.h:80
ARTempo::~ARTempo
virtual ~ARTempo()
Definition: ARTempo.h:76
TagParameterMap
A list of tag parameters represented as a map.
Definition: TagParameterMap.h:31
TimeUnwrap
Definition: TimeUnwrap.h:29

Guido Project Copyright © 2019 Grame-CNCM