summaryrefslogtreecommitdiff
path: root/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp
Unidiff
Diffstat (limited to 'noncore/multimedia/tonleiter/tonleiterdatahelper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/tonleiter/tonleiterdatahelper.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp b/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp
index d904a71..285d2c1 100644
--- a/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp
+++ b/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp
@@ -13,49 +13,49 @@ int Note::getOctaveOfNote(int note)
13QString Note::getNameOfNote(int note) 13QString Note::getNameOfNote(int note)
14{ 14{
15 int octave=getOctaveOfNote(note); 15 int octave=getOctaveOfNote(note);
16 return notenames[note-12*octave]; 16 return notenames[note-12*octave];
17} 17}
18//**************************************************************************** 18//****************************************************************************
19int Note::getNoteFromName(QString name,int octave) 19int Note::getNoteFromName(QString name,int octave)
20{ 20{
21 int notevalue=0; 21 int notevalue=0;
22 for(int a=0;a<12;a++) 22 for(int a=0;a<12;a++)
23 { 23 {
24 if(name==notenames[a]) 24 if(name==notenames[a])
25 { 25 {
26 notevalue=a; 26 notevalue=a;
27 break; 27 break;
28 } 28 }
29 } 29 }
30 return notevalue+12*octave; 30 return notevalue+12*octave;
31} 31}
32//**************************************************************************** 32//****************************************************************************
33int Note::octaveOfBaseNote(int base,int note) 33int Note::octaveOfBaseNote(int base,int note)
34{ 34{
35 int normnote = (note>=base) ? note-base : (12-base)+note; 35 int normnote = (note>=base) ? note-base : (12-base)+note;
36 int octave=getOctaveOfNote(normnote); 36 int octave=getOctaveOfNote(normnote);
37 //qDebug("note %d of %d base is norm %d -> ocatve %d",note,base,normnote,octave); 37 //odebug << "note " << note << " of " << base << " base is norm " << normnote << " -> ocatve " << octave << "" << oendl;
38 return octave; 38 return octave;
39} 39}
40//**************************************************************************** 40//****************************************************************************
41//**************************************************************************** 41//****************************************************************************
42Instrument::Instrument() 42Instrument::Instrument()
43{ 43{
44 name="UNDEFINED"; 44 name="UNDEFINED";
45 frets=0; 45 frets=0;
46} 46}
47//**************************************************************************** 47//****************************************************************************
48Instrument::Instrument(QString name,int frets,QValueList<int> strings) 48Instrument::Instrument(QString name,int frets,QValueList<int> strings)
49:name(name),frets(frets),strings(strings) 49:name(name),frets(frets),strings(strings)
50{ 50{
51} 51}
52//**************************************************************************** 52//****************************************************************************
53Instrument::~Instrument() 53Instrument::~Instrument()
54{ 54{
55} 55}
56//**************************************************************************** 56//****************************************************************************
57int Instrument::noOfStrings() 57int Instrument::noOfStrings()
58{ 58{
59 return (int)strings.count(); 59 return (int)strings.count();
60} 60}
61//**************************************************************************** 61//****************************************************************************
@@ -110,35 +110,35 @@ int Scale::noOfHaltones()
110 return (int)halftones.count(); 110 return (int)halftones.count();
111} 111}
112//**************************************************************************** 112//****************************************************************************
113int Scale::getHalfTone(int id) 113int Scale::getHalfTone(int id)
114{ 114{
115 if(id>=0 && id<noOfHaltones()) 115 if(id>=0 && id<noOfHaltones())
116 return halftones[id]; 116 return halftones[id];
117 else 117 else
118 return 0; 118 return 0;
119} 119}
120//**************************************************************************** 120//****************************************************************************
121QString Scale::scaleName() 121QString Scale::scaleName()
122{ 122{
123 return name; 123 return name;
124} 124}
125//**************************************************************************** 125//****************************************************************************
126bool Scale::noteInScale(int base,int note) 126bool Scale::noteInScale(int base,int note)
127{ 127{
128 int octave=Note::getOctaveOfNote(note); 128 int octave=Note::getOctaveOfNote(note);
129 note-=12*octave; 129 note-=12*octave;
130 int normnote = (note>=base) ? note-base : (12-base)+note; 130 int normnote = (note>=base) ? note-base : (12-base)+note;
131 131
132 if(halftones.contains(normnote)>0) 132 if(halftones.contains(normnote)>0)
133 { 133 {
134 //qDebug("OK : base : %d, note %d -> norm %d",base,note,normnote); 134 //odebug << "OK : base : " << base << ", note " << note << " -> norm " << normnote << "" << oendl;
135 return true; 135 return true;
136 } 136 }
137 else 137 else
138 { 138 {
139 //qDebug("BAD : base : %d, note %d -> norm %d",base,note,normnote); 139 //odebug << "BAD : base : " << base << ", note " << note << " -> norm " << normnote << "" << oendl;
140 return false; 140 return false;
141 } 141 }
142} 142}
143//**************************************************************************** 143//****************************************************************************
144//**************************************************************************** 144//****************************************************************************