Diffstat (limited to 'noncore/multimedia/tonleiter/tonleiterdatahelper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/tonleiter/tonleiterdatahelper.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp b/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp index 156dba5..d904a71 100644 --- a/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp +++ b/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp | |||
@@ -67,27 +67,36 @@ int Instrument::noOfFrets() | |||
67 | QString Instrument::instName() | 67 | QString Instrument::instName() |
68 | { | 68 | { |
69 | return name; | 69 | return name; |
70 | } | 70 | } |
71 | //**************************************************************************** | 71 | //**************************************************************************** |
72 | int Instrument::string(int id) | 72 | int Instrument::string(int id) |
73 | { | 73 | { |
74 | return strings[id]; | 74 | return strings[id]; |
75 | } | 75 | } |
76 | //**************************************************************************** | 76 | //**************************************************************************** |
77 | int Instrument::noOfOctaves() | 77 | int Instrument::noOfOctaves() |
78 | { | 78 | { |
79 | int lowest=strings[0]; | 79 | return (int) ceil((highestNote()-lowestNote())/12.0); |
80 | int highest=strings[strings.count()-1]+frets; | 80 | } |
81 | return (int) ceil((highest-lowest)/12.0); | 81 | //**************************************************************************** |
82 | int Instrument::lowestNote() | ||
83 | { | ||
84 | return strings[0]; | ||
85 | |||
86 | } | ||
87 | //**************************************************************************** | ||
88 | int Instrument::highestNote() | ||
89 | { | ||
90 | return strings[strings.count()-1]+frets; | ||
82 | } | 91 | } |
83 | //**************************************************************************** | 92 | //**************************************************************************** |
84 | //**************************************************************************** | 93 | //**************************************************************************** |
85 | Scale::Scale() | 94 | Scale::Scale() |
86 | { | 95 | { |
87 | name="UNDEFINED"; | 96 | name="UNDEFINED"; |
88 | } | 97 | } |
89 | //**************************************************************************** | 98 | //**************************************************************************** |
90 | Scale::Scale(QString name,QValueList<int> halftones) | 99 | Scale::Scale(QString name,QValueList<int> halftones) |
91 | :name(name),halftones(halftones) | 100 | :name(name),halftones(halftones) |
92 | { | 101 | { |
93 | } | 102 | } |