Diffstat (limited to 'noncore/multimedia/tonleiter/tonleiterdatahelper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/tonleiter/tonleiterdatahelper.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp b/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp index 5714cea..156dba5 100644 --- a/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp +++ b/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp | |||
@@ -1,14 +1,16 @@ | |||
1 | #include "tonleiterdatahelper.h" | 1 | #include "tonleiterdatahelper.h" |
2 | 2 | ||
3 | #include <math.h> | ||
4 | |||
3 | using namespace Data; | 5 | using namespace Data; |
4 | 6 | ||
5 | int Note::getOctaveOfNote(int note) | 7 | int Note::getOctaveOfNote(int note) |
6 | { | 8 | { |
7 | int remain=note%12; | 9 | int remain=note%12; |
8 | return (note-remain)/12; | 10 | return (note-remain)/12; |
9 | } | 11 | } |
10 | //**************************************************************************** | 12 | //**************************************************************************** |
11 | QString Note::getNameOfNote(int note) | 13 | QString Note::getNameOfNote(int note) |
12 | { | 14 | { |
13 | int octave=getOctaveOfNote(note); | 15 | int octave=getOctaveOfNote(note); |
14 | return notenames[note-12*octave]; | 16 | return notenames[note-12*octave]; |
@@ -67,25 +69,25 @@ QString Instrument::instName() | |||
67 | return name; | 69 | return name; |
68 | } | 70 | } |
69 | //**************************************************************************** | 71 | //**************************************************************************** |
70 | int Instrument::string(int id) | 72 | int Instrument::string(int id) |
71 | { | 73 | { |
72 | return strings[id]; | 74 | return strings[id]; |
73 | } | 75 | } |
74 | //**************************************************************************** | 76 | //**************************************************************************** |
75 | int Instrument::noOfOctaves() | 77 | int Instrument::noOfOctaves() |
76 | { | 78 | { |
77 | int lowest=strings[0]; | 79 | int lowest=strings[0]; |
78 | int highest=strings[strings.count()-1]+frets; | 80 | int highest=strings[strings.count()-1]+frets; |
79 | return (int)((highest-lowest)/12.0); | 81 | return (int) ceil((highest-lowest)/12.0); |
80 | } | 82 | } |
81 | //**************************************************************************** | 83 | //**************************************************************************** |
82 | //**************************************************************************** | 84 | //**************************************************************************** |
83 | Scale::Scale() | 85 | Scale::Scale() |
84 | { | 86 | { |
85 | name="UNDEFINED"; | 87 | name="UNDEFINED"; |
86 | } | 88 | } |
87 | //**************************************************************************** | 89 | //**************************************************************************** |
88 | Scale::Scale(QString name,QValueList<int> halftones) | 90 | Scale::Scale(QString name,QValueList<int> halftones) |
89 | :name(name),halftones(halftones) | 91 | :name(name),halftones(halftones) |
90 | { | 92 | { |
91 | } | 93 | } |