YSE sound engine  1.0
cross platform sound engine
 All Classes Namespaces Functions Pages
note.hpp
1 /*
2  ==============================================================================
3 
4  note.h
5  Created: 4 Apr 2014 10:22:39am
6  Author: yvan vander sanden
7 
8  ==============================================================================
9 */
10 
11 #ifndef NOTE_H_INCLUDED
12 #define NOTE_H_INCLUDED
13 
14 #include "../headers/types.hpp"
15 #include "../headers/defines.hpp"
16 
17 namespace YSE {
18 
19  namespace MUSIC {
20 
21  class API note {
22  private:
23  Flt pitch;
24  Flt volume;
25  public:
26  note(Flt pitch = 60.f, Flt volume = 1.f);
27  note(const note & object);
28 
29  note & set (Flt pitch, Flt volume = 1.f);
30  note & setPitch (Flt value);
31  note & setVolume(Flt value);
32 
33  Flt getPitch ();
34  Flt getVolume();
35 
36  // these operators work on pitch only,
37  // volume is never changed
38  note & operator+=(const note& object);
39  note & operator-=(const note& object);
40  note & operator*=(const note& object);
41  note & operator/=(const note& object);
42 
43  note & operator+=(Flt pitch);
44  note & operator-=(Flt pitch);
45  note & operator*=(Flt pitch);
46  note & operator/=(Flt pitch);
47 
48  Bool operator==(const note& object);
49  Bool operator!=(const note& object);
50  Bool operator<(const note& object);
51  Bool operator>(const note& object);
52  Bool operator<=(const note& object);
53  Bool operator>=(const note& object);
54 
55  Bool operator==(Flt pitch);
56  Bool operator!=(Flt pitch);
57  Bool operator<(Flt pitch);
58  Bool operator>(Flt pitch);
59  Bool operator<=(Flt pitch);
60  Bool operator>=(Flt pitch);
61 
62  friend note operator+(const note &n, Flt pitch);
63  friend note operator-(const note &n, Flt pitch);
64  friend note operator*(const note &n, Flt pitch);
65  friend note operator/(const note &n, Flt pitch);
66 
67  friend note operator+(Flt pitch, const note &n);
68  friend note operator-(Flt pitch, const note &n);
69  friend note operator*(Flt pitch, const note &n);
70  friend note operator/(Flt pitch, const note &n);
71 
72  friend note operator+(const note &n1, const note &n2);
73  friend note operator-(const note &n1, const note &n2);
74  friend note operator*(const note &n1, const note &n2);
75  friend note operator/(const note &n1, const note &n2);
76  };
77 
78  }
79 
80 }
81 
82 
83 
84 
85 #endif // NOTE_H_INCLUDED