Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
diatonicpitch.h
Go to the documentation of this file.
1 
8 #ifndef DIATONICPITCH_H_
9 #define DIATONICPITCH_H_
10 
11 #include "core/interval.h"
12 #include <QString>
13 
15 public:
16  enum CANoteName {
17  Undefined = -1,
18  C = 0,
19  D = 1,
20  E = 2,
21  F = 3,
22  G = 4,
23  A = 5,
24  B = 6
25  };
26 
28  CADiatonicPitch( const QString& pitch );
29  CADiatonicPitch( const int& noteName, const int& accs=0 );
30 
32  inline bool operator!=(CADiatonicPitch p) { return !operator==(p); }
33 
34  bool operator==(int noteName);
35  inline bool operator!=(int p) { return !operator==(p); }
36 
39  return operator+( CAInterval( i.quality(), i.quantity()*(-1) ) );
40  }
41 
42  inline const int noteName() { return _noteName; }
43  inline const int accs() { return _accs; }
44 
45  inline void setNoteName( const int noteName ) { _noteName = noteName; }
46  inline void setAccs( const int accs ) { _accs = accs; }
47 
48  static const QString diatonicPitchToString( CADiatonicPitch p );
49  static CADiatonicPitch diatonicPitchFromString( const QString s );
50 
51 private:
52  int _noteName; // 0-sub-contra C, 1-D, 2-E etc.
53  int _accs; // 0-neutral, 1-sharp, -1-flat etc.
54 };
55 #endif /* DIATONICPITCH_H_ */