-rw-r--r-- | noncore/multimedia/tonleiter/tonleiterdatahelper.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp b/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp index 6b8a5bd..c52e0da 100644 --- a/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp +++ b/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp | |||
@@ -78,52 +78,50 @@ int Instrument::noOfOctaves() | |||
78 | } | 78 | } |
79 | //**************************************************************************** | 79 | //**************************************************************************** |
80 | //**************************************************************************** | 80 | //**************************************************************************** |
81 | Scale::Scale() | 81 | Scale::Scale() |
82 | { | 82 | { |
83 | name="UNDEFINED"; | 83 | name="UNDEFINED"; |
84 | } | 84 | } |
85 | //**************************************************************************** | 85 | //**************************************************************************** |
86 | Scale::Scale(QString name,QValueList<int> halftones) | 86 | Scale::Scale(QString name,QValueList<int> halftones) |
87 | :name(name),halftones(halftones) | 87 | :name(name),halftones(halftones) |
88 | { | 88 | { |
89 | } | 89 | } |
90 | //**************************************************************************** | 90 | //**************************************************************************** |
91 | Scale::~Scale() | 91 | Scale::~Scale() |
92 | { | 92 | { |
93 | } | 93 | } |
94 | //**************************************************************************** | 94 | //**************************************************************************** |
95 | int Scale::noOfHaltones() | 95 | int Scale::noOfHaltones() |
96 | { | 96 | { |
97 | return (int)halftones.count(); | 97 | return (int)halftones.count(); |
98 | } | 98 | } |
99 | //**************************************************************************** | 99 | //**************************************************************************** |
100 | int Scale::getHalfTone(int id) | 100 | int Scale::getHalfTone(int id) |
101 | { | 101 | { |
102 | if(id>=0 && noOfHaltones()<id) | 102 | if(id>=0 && id<noOfHaltones()) |
103 | { | ||
104 | return halftones[id]; | 103 | return halftones[id]; |
105 | } | ||
106 | else | 104 | else |
107 | return 0; | 105 | return 0; |
108 | } | 106 | } |
109 | //**************************************************************************** | 107 | //**************************************************************************** |
110 | QString Scale::scaleName() | 108 | QString Scale::scaleName() |
111 | { | 109 | { |
112 | return name; | 110 | return name; |
113 | } | 111 | } |
114 | //**************************************************************************** | 112 | //**************************************************************************** |
115 | bool Scale::noteInScale(int base,int note) | 113 | bool Scale::noteInScale(int base,int note) |
116 | { | 114 | { |
117 | int octave=Note::getOctaveOfNote(note); | 115 | int octave=Note::getOctaveOfNote(note); |
118 | note-=12*octave; | 116 | note-=12*octave; |
119 | int normnote = (note>=base) ? note-base : (12-base)+note; | 117 | int normnote = (note>=base) ? note-base : (12-base)+note; |
120 | 118 | ||
121 | if(halftones.contains(normnote)>0) | 119 | if(halftones.contains(normnote)>0) |
122 | { | 120 | { |
123 | //qDebug("OK : base : %d, note %d -> norm %d",base,note,normnote); | 121 | //qDebug("OK : base : %d, note %d -> norm %d",base,note,normnote); |
124 | return true; | 122 | return true; |
125 | } | 123 | } |
126 | else | 124 | else |
127 | { | 125 | { |
128 | //qDebug("BAD : base : %d, note %d -> norm %d",base,note,normnote); | 126 | //qDebug("BAD : base : %d, note %d -> norm %d",base,note,normnote); |
129 | return false; | 127 | return false; |