summaryrefslogtreecommitdiff
path: root/noncore/multimedia/powerchord
Unidiff
Diffstat (limited to 'noncore/multimedia/powerchord') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/powerchord/README117
-rw-r--r--noncore/multimedia/powerchord/TODO4
-rw-r--r--noncore/multimedia/powerchord/chordengine.cpp297
-rw-r--r--noncore/multimedia/powerchord/chordengine.h124
-rw-r--r--noncore/multimedia/powerchord/config.in7
-rw-r--r--noncore/multimedia/powerchord/fretboard.cpp234
-rw-r--r--noncore/multimedia/powerchord/fretboard.h101
-rw-r--r--noncore/multimedia/powerchord/gs.cpp460
-rw-r--r--noncore/multimedia/powerchord/gs.h124
-rw-r--r--noncore/multimedia/powerchord/gt.cpp39
-rw-r--r--noncore/multimedia/powerchord/gt.h54
-rw-r--r--noncore/multimedia/powerchord/main.cpp12
-rw-r--r--noncore/multimedia/powerchord/opie-powerchord.control10
-rw-r--r--noncore/multimedia/powerchord/powerchord.cpp28
-rw-r--r--noncore/multimedia/powerchord/powerchord.h17
-rw-r--r--noncore/multimedia/powerchord/powerchord.ui55
-rw-r--r--noncore/multimedia/powerchord/powerchordbase.cpp592
-rw-r--r--noncore/multimedia/powerchord/powerchordbase.h113
-rw-r--r--noncore/multimedia/powerchord/powerchordbase.ui1663
-rw-r--r--noncore/multimedia/powerchord/vumeter.cpp105
-rw-r--r--noncore/multimedia/powerchord/vumeter.h59
21 files changed, 4215 insertions, 0 deletions
diff --git a/noncore/multimedia/powerchord/README b/noncore/multimedia/powerchord/README
new file mode 100644
index 0000000..b617f73
--- a/dev/null
+++ b/noncore/multimedia/powerchord/README
@@ -0,0 +1,117 @@
1This tarball is a collection of the sources of Powerchord as a work in progress. It is provided to fulfil the conditions of the GPL.
2
3-Cam 15 Apr 2002 camilo@mesias.co.uk
4
5
6These files are the ones I used to make the release 0.0.7 of Powerchord.
7
8Originally I had intended to release under the GPL, then under pressure of time I wanted to release as closed-source freeware, to be relicensed at a later date. For simplicity though, I have opted to provide this crude tarball and release from the start under the GPL.
9
10Some of the source files do not contain the proper copyright notice yet.
11
12// Copyright (c) 2001 Camilo Mesias
13// camilo@mesias.co.uk
14//
15// This program is free software; you can redistribute it and/or
16// modify it under the terms of the GNU General Public License
17// as published by the Free Software Foundation; either version 2
18// of the License, or (at your option) any later version.
19//
20// This program is distributed in the hope that it will be useful,
21// but WITHOUT ANY WARRANTY; without even the implied warranty of
22// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23// GNU General Public License for more details.
24//
25// You should have received a copy of the GNU General Public License
26// along with this program; if not, write to the Free Software
27// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28
29The make system is not foolproof.
30
31Under pressure of time I abandoned using designer and carefully hacked code into auto-generated files. I plan to go back to designer and learn how to insert these bits of code in a way that is in harmony with the original Trolltech example make files.
32
33Credits.
34This is all my own work, with the exception that some of it is derived from the Trolltech example code. The chord algorithm was originally written in Javascript by Jim Cranwell and is used with his permission. Some of the code dates back to the original version of Powerchord that I wrote for the Agenda VR3. That was my first Agenda app and was in turn related to the code for the Agenda Power Meter application. Some of the original Agenda (fltk) include directives remain in the code, commented out... The name derives from the use of the Agenda Power application as a starting point. Power + Chord = Powerchord. Credit to a number of web resources on computing music, especially the first one I read that talked about the 12th root of 2! Credit finally to 4Front Technologies, their document 'Open Sound System - A Programmers' Guide' was most useful. This is my first use of OSS.
35
36Here is a breakdown of the essential parts of this archive:
37
38README
39TODO
40Makefile
41
42MANUAL.html -- webpage stuff
43index.html
44display.png
45tuning.png
46
47powerchord.control -- control file for .ipk
48powerchord.desktop -- Qtopia desktop file
49powerchord.pro -- input for tmake
50powerchord.ui -- input for Designer
51powerchordbase.ui -- input for Designer
52
53Powerchord.png -- icon
54
55RCS -- some files under RCS
56
57acguitar.raw -- assorted audio files
58long.acguitar.raw
59
60amp_but.png -- assorted image files
61audio.png
62blank_but.png
63chordshow.png
64image0.xpm
65image1.png
66image2.png
67image3.png
68image4.png
69image5.png
70image6.png
71image_open.png
72mic-closed.png
73mic-open.png
74mic-open.xpm
75wood.png
76wood_s.png
77x.png
78z1.png
79z2.png
80stringfing_s.png
81transport-blank.png
82transport-fwd.png
83transport-play.png
84transport-rec.png
85transport-rev.png
86powerchord-pics
87
88chordengine.cpp -- code to make chords
89chordengine.h
90
91fretboard.cpp -- widget to display fret board
92fretboard.h
93
94gs.cpp -- guitar synth (audio) code
95gs.h
96
97gt.cpp -- guitar tuner (audio) code - not finished
98gt.h
99
100powerchord.cpp -- framework code - like main
101powerchord.h
102
103powerchordbase.cpp -- main GUI code hacked from the designer generated one
104powerchordbase.h
105
106vumeter.cpp -- vu-meter lookalike widget for tuner
107vumeter.h
108
109install.sh -- instructions to build the .ipk and install it
110
111main.cpp -- token main()
112
113moc_fretboard.cpp -- generated files, do not touch!
114moc_powerchord.cpp
115moc_powerchordbase.cpp
116moc_vumeter.cpp
117
diff --git a/noncore/multimedia/powerchord/TODO b/noncore/multimedia/powerchord/TODO
new file mode 100644
index 0000000..9eb5906
--- a/dev/null
+++ b/noncore/multimedia/powerchord/TODO
@@ -0,0 +1,4 @@
1save chords
2replay saved chords
3help
4check out submission
diff --git a/noncore/multimedia/powerchord/chordengine.cpp b/noncore/multimedia/powerchord/chordengine.cpp
new file mode 100644
index 0000000..d8c3c4e
--- a/dev/null
+++ b/noncore/multimedia/powerchord/chordengine.cpp
@@ -0,0 +1,297 @@
1//
2// ChordEngine class to calculate chords
3//
4
5// Copyright (c) 2001 Camilo Mesias
6// camilo@mesias.co.uk
7//
8// derived from JavaScript code by Jim Cranwell, used with permission
9//
10// This program is free software; you can redistribute it and/or
11// modify it under the terms of the GNU General Public License
12// as published by the Free Software Foundation; either version 2
13// of the License, or (at your option) any later version.
14//
15// This program is distributed in the hope that it will be useful,
16// but WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with this program; if not, write to the Free Software
22// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
24
25#include <stdio.h>
26
27#include <string.h>
28
29#include "chordengine.h"
30
31ChordEngine::ChordEngine(){
32
33 string[0] = OPEN;
34 string[1] = OPEN;
35 string[2] = OPEN;
36 string[3] = OPEN;
37 string[4] = OPEN;
38 string[5] = OPEN;
39
40 base_note = 0;
41 chord_type = 0;
42 fret_pos = OPEN;
43 span_size = 1;
44 variation = 7;
45 tuning = 0;
46
47 js_tunit(tuning);
48 js_whatchord(chord_type);
49 js_vboy(variation);
50
51 label_text[0] = 0;
52}
53
54int ChordEngine::finger(int f){
55 return string[f];
56}
57#define BREAK (401)
58void ChordEngine::calculate(){
59
60 sprintf(label_text, "%s %s %s%s",
61 notes[base_note],
62 (chord_type)?keys[chord_type]:"",
63 (fret_pos==OPEN)?"":"fret-",
64 (fret_pos)?frets[fret_pos]:"");
65
66 string[0] =
67 string[1] =
68 string[2] =
69 string[3] =
70 string[4] =
71 string[5] = MUTED;
72
73 for (int in=0;in<6;in++){
74 notename[in]=0;
75 }
76
77 js_tunit(tuning);
78 // js_MMM[0] = 4;
79 //js_MMM[1] = 9;
80 //js_MMM[2] = 2;
81 //js_MMM[3] = 7;
82 //js_MMM[4] = 11;
83 //js_MMM[5] = 4;
84
85 int js_D = base_note;
86
87 int js_Q = span_size;
88
89 js_Q += 2;
90
91 int js_V = variation;
92
93 int js_FR = fret_pos;
94
95 int js_G = 0;
96
97 int js_A = 0;
98
99 if (js_FR){
100 js_G = 8;
101 }
102
103 js_L = 1;
104 js_Y = 1;
105 js_Z = 1;
106
107 js_vboy(variation);
108
109 js_Y += js_Q;
110 int js_K = 0;
111 int js_W = js_D - js_Z;
112 int js_H = -js_Z;
113 int js_N[6] = {0, 0, 0, 0, 0, 0};
114 int js_TCK[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
115 int js_E = 0;
116 int js_X = 0;
117
118 for (int j=0; j<41; j++){
119 js_A = 0;
120 for (int b=0; b<7; b++){
121 if (js_N[b] == 1){
122 js_A++;
123 }
124 if ((js_A==6)||(j>39)){
125 for (int i=0; i<12; i++){
126 if (js_TCK[i] != js_T[i]){
127 memset((void *)js_N, 0, 6*sizeof(int));
128 memset((void *)js_TCK, 0, 12*sizeof(int));
129 js_V++;
130 js_X++;
131 if (js_V>23){
132 js_V = 0;
133 }
134 js_vboy(js_V);
135 j = 0;
136 i = BREAK;
137 b = BREAK;
138 if (js_X > 23){
139 js_N[0] = js_N[1] = js_N[2] = js_N[3] = js_N[4] = js_N[5] = 1;
140 j = BREAK;
141 }
142 }
143 }
144 }
145 }
146 int js_S = 0;
147 js_W = (js_W + js_Z)%12;
148 js_H = (js_H + js_Z)%12;
149
150 while (js_S < js_Y){
151 js_S++;
152 if (js_E > js_Q){
153 js_E = 0;
154 js_K = (js_K + js_L)%6;
155 }
156 if (js_E<0){
157 js_E = js_Q;
158 js_K = (js_K + js_L)%6;
159 }
160 if (js_T[js_H] == 0){
161 for (int c=0;c<13;c++){
162 js_W = (js_W+js_Z)%12;
163 js_H = (js_H+js_Z)%12;
164 if (js_T[js_H] == 1){
165 c=BREAK;
166 }
167 }
168 }
169 if (js_N[js_K] == 1){
170 for(int b=0; b<7; b++){
171 js_K = (js_K+js_L)%6;
172 if(js_N[js_K] == 0){
173 b = BREAK;
174 }
175 if(b==6){
176 js_S = BREAK;
177 }
178 }
179 }
180
181 // js_K is the index of the string
182 // js_MMM is the base note played by that string in the current tuning
183 // js_FR is the fret position
184 // js_E
185 // js_F represents the note made by this string here
186 // js_N[] records if we have found a finger position for this string
187 // js_W - represents the note we want????
188
189 int js_F = (js_MMM[js_K]+js_E+js_FR)%12;
190
191 if ((js_W==js_F)&&(js_N[js_K]==0)){
192
193 int js_EG = js_E+js_G;
194
195 string[js_K] = js_EG;
196 notename[js_K] = notes[js_W];
197
198 js_N[js_K] = 1;
199 js_TCK[js_H] = 1;
200 js_S = BREAK;
201 }
202 js_E += js_VM;
203
204 }
205
206 }
207
208}
209
210
211const int ChordEngine::alt_tunings[][6] = {
212 {4, 9,2,7,11,4},
213 {4,11,4,8,11,4},
214 {4, 9,4,9, 1,4},
215 {4, 9,2,6,11,4},
216 {4, 9,2,7, 0,5},
217 {2, 9,2,7, 9,2},
218 {2, 7,0,7, 0,2},
219 {2, 9,2,6, 9,2},
220 {2, 9,2,7,11,4},
221 {2, 7,2,7,11,2},
222 {2, 9,2,9, 0,2},
223 {0, 7,0,7, 9,4},
224 {5, 9,2,7,11,4},
225 {7,10,2,7,10,2},
226};
227
228void ChordEngine::js_tunit(int t){
229 int max=0;
230 int octave=0;
231 for (int i=0;i<6;i++){
232 js_MMM[i] = ChordEngine::alt_tunings[t][i];
233 if (js_MMM[i] < max){
234 octave += 12;
235 }
236 max = js_MMM[i];
237 note_indices[i] = octave + js_MMM[i];
238 }
239}
240
241const int ChordEngine::chordbases[][12] = {
242 {1,0,0,0,1,0,0,1,0,0,0,0}, // maj
243 {1,0,0,1,0,0,0,1,0,0,0,0}, // min
244 {1,0,0,0,1,0,0,1,0,0,1,0}, // 7th
245 {1,0,0,1,0,0,0,1,0,0,1,0}, // m7
246 {1,0,0,0,1,0,0,1,0,0,0,1}, // maj7
247 {1,0,0,0,1,0,0,1,0,1,0,0}, // 6th
248 {1,0,0,1,0,0,0,1,0,1,0,0}, // m6th
249 {1,0,0,0,1,0,0,0,1,0,0,0}, // aug
250 {1,0,0,1,0,0,1,0,0,1,0,0}, // dim
251 {1,0,0,0,0,1,0,1,0,0,0,0}, // sus4
252 {1,0,0,0,0,1,0,1,0,0,1,0}, // 7sus4
253 {1,0,1,0,1,0,0,1,0,0,1,0}, // 9th
254 {1,0,1,0,1,0,0,1,0,0,0,0}, // add9
255 {1,0,1,1,0,0,0,1,0,0,1,0}, // m9th
256 {1,1,0,0,1,0,0,1,0,0,0,1}, // maj9
257 {1,0,1,0,0,0,0,1,0,0,0,0}, // sus2
258 {1,0,1,0,0,0,0,1,0,0,1,0}, // 7sus2
259 {1,0,1,0,0,1,0,1,0,0,1,0}, // 11th
260 {1,0,1,1,0,1,0,1,0,0,1,0}, // m11th
261 {1,0,0,0,1,0,0,1,0,1,1,0}, // 13th
262 {1,0,0,1,0,0,0,1,0,1,1,0}, // m13th
263 {1,0,0,1,0,0,0,1,0,1,0,1}, // maj13
264 {1,0,1,0,1,0,0,1,0,1,0,0}, // 6/9
265 {1,0,0,0,1,0,1,0,0,0,0,0}, // flat5
266 {1,0,0,1,1,0,0,0,0,0,1,0}, // 7#9
267 {1,0,0,1,0,0,1,0,0,0,1,0}, // Ø7
268 {1,0,0,0,0,0,0,1,0,0,0,0}, // 5
269};
270
271void ChordEngine::js_whatchord(int c){
272 for (int i=0;i<12;i++){
273 js_T[i] = ChordEngine::chordbases[c][i];
274 }
275}
276
277void ChordEngine::js_vboy(int v){
278 js_L = ((v/3)%2)?5:1;
279 js_Y = ((v/6)%2)?45:4;
280 js_Z = (v%3 == 0)?1:(v%3 == 1)?7:11;
281 js_VM = ((v/12)%2)?-1:1;
282}
283
284const char* ChordEngine::notes[] = {"C", "C#", "D", "Eb", "E", "F", "F#", "G", "G#", "A", "Bb", "B", 0};
285
286const char* ChordEngine::keys[] = {"maj", "min", "7th", "m7", "maj7", "6th", "m6th", "aug", "dim", "sus4", "7sus4", "9th", "add9", "m9th", "maj9", "sus2", "7sus2", "11th", "m11th", "13th", "m13th", "maj13", "6|9", "flat5", "7#9", "Ø7", "5", 0};
287
288const char* ChordEngine::frets[] = {"open", "1st", "2nd", "3rd", "4th", "5th", "6th", "7th", "8th", "9th", "10th", "11th", "12th", "13th", "14th", "15th", "16th", 0};
289
290const char* ChordEngine::variations[] = {"V1", "V2", "V3", "V4", "V5", "V6", "V7", "V8", "V9", "V10", "V11", "V12", "V13", "V14", "V15", "V16", "V17", "V18", "V19", "V20", "V21", "V22", "V23", 0};
291
292const char* ChordEngine::tunings[] = {"EADGBE", "EBEG#BE", "EAEAC#E", "EADF#BE", "EADGCF", "DADGAD", "DGCGCD", "DADF#AD", "DADGBE", "DGDGBD", "DADACD", "CGCGAE", "FADGBE", "Gminor",0};
293
294
295
296
297
diff --git a/noncore/multimedia/powerchord/chordengine.h b/noncore/multimedia/powerchord/chordengine.h
new file mode 100644
index 0000000..44b7388
--- a/dev/null
+++ b/noncore/multimedia/powerchord/chordengine.h
@@ -0,0 +1,124 @@
1//
2// ChordEngine class to calculate chords
3//
4
5// Copyright (c) 2001 Camilo Mesias
6// camilo@mesias.co.uk
7//
8// derived from JavaScript code by Jim Cranwell, used with permission
9//
10// This program is free software; you can redistribute it and/or
11// modify it under the terms of the GNU General Public License
12// as published by the Free Software Foundation; either version 2
13// of the License, or (at your option) any later version.
14//
15// This program is distributed in the hope that it will be useful,
16// but WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with this program; if not, write to the Free Software
22// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
24
25#ifndef __CHORDENGINE_H
26#define __CHORDENGINE_H
27
28#include <stdio.h>
29
30class ChordEngine;
31
32class ChordEngine {
33
34 private:
35 //saved state
36
37 int base_note;
38 int chord_type;
39 int fret_pos;
40 int span_size;
41 int variation;
42 int tuning;
43
44 int string[6];
45 const char *notename[6];
46
47 // unfathomable stuff ported from javascript: js_prefix
48 // may ask Jim Cranwell if he'd like to comment on it
49 int js_MMM[6];
50 int note_indices[6];
51
52 void js_tunit(int t);
53
54 int js_T[12];
55
56 void js_whatchord(int c);
57
58 int js_L, js_Y, js_Z, js_VM;
59
60 void js_vboy(int v);
61
62 // stuff I put in
63 char label_text[20];
64 static const int chordbases[][12];
65 static const int alt_tunings[][6];
66
67 public:
68 static const char* notes[];
69 static const char* keys[];
70 static const char* frets[];
71 static const char* variations[];
72 static const char* tunings[];
73
74
75 static const int OPEN = 0;
76 static const int MUTED = 7;
77
78 ChordEngine();
79
80 // accessors
81 const char *name(int f){return notename[f];};
82 int noteindex(int f){
83 if (string[f] == MUTED){
84 return -1;
85 }else{
86 return note_indices[f] + string[f];
87 }
88 };
89
90 void base(int b){base_note = b;};
91 int base(){return base_note;};
92
93 void chord(int c){chord_type = c; js_whatchord(c);};
94 int chord(){return chord_type;};
95
96 void fret(int f){fret_pos = f;};
97 int fret(){return fret_pos;};
98
99 void span(int s){span_size = s;};
100 int span(){return span_size;};
101
102 void vary(int v){variation = v; js_vboy(v);};
103 int vary(){return variation;};
104
105 void tune(int t){tuning = t; js_tunit(t);};
106 int tune(){return tuning;};
107
108 // methods
109 void calculate();
110
111 const char *label(){return label_text;};
112
113 int finger(int string); // returns fret position or MUTED
114
115};
116
117#endif
118
119
120
121
122
123
124
diff --git a/noncore/multimedia/powerchord/config.in b/noncore/multimedia/powerchord/config.in
new file mode 100644
index 0000000..c41844c
--- a/dev/null
+++ b/noncore/multimedia/powerchord/config.in
@@ -0,0 +1,7 @@
1 config POWERCHORD
2 boolean "opie-powerchord (guitar chord generator and tuning)"
3 default "n"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && LIBOPIE2CORE
5 comment "opie-powerchord needs a libqpe, libopie and libopie2core"
6 depends !(( LIBQPE || LIBQPE-X11 ) && LIBOPIE && LIBOPIE2CORE)
7
diff --git a/noncore/multimedia/powerchord/fretboard.cpp b/noncore/multimedia/powerchord/fretboard.cpp
new file mode 100644
index 0000000..0687d00
--- a/dev/null
+++ b/noncore/multimedia/powerchord/fretboard.cpp
@@ -0,0 +1,234 @@
1//
2// FretBoard class to display interface for chord finder application
3//
4
5// Copyright (c) 2001 Camilo Mesias
6// camilo@mesias.co.uk
7//
8// This program is free software; you can redistribute it and/or
9// modify it under the terms of the GNU General Public License
10// as published by the Free Software Foundation; either version 2
11// of the License, or (at your option) any later version.
12//
13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17//
18// You should have received a copy of the GNU General Public License
19// along with this program; if not, write to the Free Software
20// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21
22//#include <FL/Fl.H>
23//#include <FL/Fl_Widget.H>
24//#include <FL/fl_draw.H>
25#include <stdio.h>
26#include <qpixmap.h>
27#include <qpe/resource.h>
28#include "fretboard.h"
29#include <qpainter.h>
30
31void FretBoard::refresh(){
32 ce.calculate();
33
34 emit nameChanged(QString(ce.label()));
35
36 for (int i=0;i<6;i++){
37 Finger(i, ce.finger(i));
38 // yuk
39 switch (i) {
40 case 0:
41 emit s1nameChanged(QString(ce.name(i)));
42 break;
43 case 1:
44 emit s2nameChanged(QString(ce.name(i)));
45 break;
46 case 2:
47 emit s3nameChanged(QString(ce.name(i)));
48 break;
49 case 3:
50 emit s4nameChanged(QString(ce.name(i)));
51 break;
52 case 4:
53 emit s5nameChanged(QString(ce.name(i)));
54 break;
55 case 5:
56 emit s6nameChanged(QString(ce.name(i)));
57 break;
58 }
59 }
60
61 update();
62}
63
64FretBoard::FretBoard(QWidget *parent, const char *name )
65 : QWidget( parent, name ), ce()
66{
67
68 ce.base(9);
69 ce.chord(0);
70 ce.fret(0);
71 ce.span(1);
72 ce.vary(7);
73 ce.tune(0);
74 refresh();
75
76 // setPalette( QPalette( QColor( 250, 250, 200) ) );
77
78 stringtop_pix = Resource::loadPixmap( "powerchord/stringtop_s");
79 string_pix = Resource::loadPixmap( "powerchord/string_s");
80 finger_pix = Resource::loadPixmap( "powerchord/justfing_s");
81 mute_pix = Resource::loadPixmap( "powerchord/muted_s");
82
83 // box(FL_NO_BOX);
84
85 // finger[0] = OPEN;
86 // finger[1] = OPEN;
87 // finger[2] = OPEN;
88 // finger[3] = OPEN;
89 // finger[4] = OPEN;
90 // finger[5] = OPEN;
91
92 initial_fret = 0;
93
94 // label(FL_NORMAL_LABEL, "Chord");
95}
96
97// int FretBoard::Finger(int f){
98// if (f < 0 || f > 5){
99// fprintf(stderr, "Error - finger value was %d\n", f);
100// return 0;
101// }
102// return finger[f];
103// }
104
105void FretBoard::Finger(int f, int position){
106 if (f < 0 || f > 5){
107 fprintf(stderr, "Error - finger2 value was %d\n", f);
108 return;
109 }
110
111 finger[f] = position;
112}
113
114// void FretBoard::draw(void) {
115// draw_box();
116// draw_label();
117// }
118
119// void FretBoard::draw_label(void) {
120// align(FL_ALIGN_CENTER | FL_ALIGN_TOP | FL_ALIGN_WRAP);
121
122// this->Fl_Widget::draw_label();
123// }
124
125
126//void FretBoard::draw_box(void) {
127
128void FretBoard::paintEvent(QPaintEvent *){
129
130 // fl_color(FL_WHITE);
131
132 // Fl_Widget::draw_box();
133
134 // fl_color(FL_BLACK);
135
136 QPainter p( this );
137
138 p.setBrush(black);
139 p.translate(0, 0);
140
141 // draw each string
142 for (int f=0; f<=5; f++){
143 // draw a string starting from the highest visible fret
144 for (int pp=0; pp<=6; pp++){
145 int this_fret = initial_fret + pp;
146 int cx = /* x() + */ 28*f;
147 int cy = /* y() + */ pp*30;
148
149 //fl_color(FL_WHITE);
150 // fl_rectf(cx, cy, 24, 24);
151 // p.setBrush(white);
152 // p.setPen(NoPen);
153
154 // p.drawRect( QRect(cx, cy, 24, 24) );
155// fl_color(FL_BLACK);
156 // p.setBrush(black);
157
158 // p.setPen(black);
159
160 // draw the string unless at top
161 if (this_fret!=0){
162 //fl_line(cx+12, cy, cx+12, cy+23);
163 //p.drawLine(cx+12, cy, cx+12, cy+23);
164 }
165
166 // draw mutes if at top
167 if (pp == 0 &&
168 finger[f] == MUTED){
169 p.drawPixmap(cx,cy,mute_pix);
170 //fl_line(cx+4, cy+19, cx+19, cy+4);
171 //p.drawLine(cx+4, cy+19, cx+19, cy+4);
172 //fl_line(cx+5, cy+19, cx+20, cy+4);
173 //p.drawLine(cx+5, cy+19, cx+20, cy+4);
174 //fl_line(cx+4, cy+4, cx+19, cy+19);
175 //p.drawLine(cx+4, cy+4, cx+19, cy+19);
176 //fl_line(cx+5, cy+4, cx+20, cy+19);
177 //p.drawLine(cx+5, cy+4, cx+20, cy+19);
178 }
179
180 if (this_fret==0){
181 // above, blank
182 }else if(this_fret==1){
183 // top
184 p.drawPixmap(cx,cy,stringtop_pix);
185 }else{
186 // normal
187 p.drawPixmap(cx,cy,string_pix);
188 }
189
190 // frets at bottom
191 // thick line if at top
192 // int x0 = (f==0)?(cx+12):cx;
193 // int x1 = (f==5)?(cx+12):(cx+23);
194 // for (int offset=23; offset>((this_fret==0)?20:22); offset--){
195 //fl_line(x0, cy+offset, x1, cy+offset);
196 //p.drawLine(x0, cy+offset, x1, cy+offset);
197 // }
198
199 // finger if at that position
200 if ((initial_fret==0 && pp == finger[f]) ||
201 (initial_fret!=0 && pp == finger[f]-8)){
202 p.drawPixmap(cx,cy,finger_pix);
203
204 // fl_color(FL_WHITE);
205 // p.setBrush(white);
206 // p.setPen(NoPen);
207
208 // fl_rectf(cx+4, cy+4, 16, 16);
209 //p.drawRect( QRect(cx+4, cy+4, 16, 16));
210// fl_color(FL_BLACK);
211 //p.setPen(black);
212 // fl_line(cx+4, cy+11, cx+7, cy+16);
213 //p.drawLine(cx+4, cy+11, cx+7, cy+16);
214 // fl_line(cx+7, cy+16, cx+12, cy+19);
215 //p.drawLine(cx+7, cy+16, cx+12, cy+19);
216 // fl_line(cx+12, cy+19, cx+16, cy+16);
217 //p.drawLine(cx+12, cy+19, cx+16, cy+16);
218 // fl_line(cx+16, cy+16, cx+19, cy+12);
219 //p.drawLine(cx+16, cy+16, cx+19, cy+12);
220 // fl_line(cx+19, cy+12, cx+16, cy+7);
221 //p.drawLine(cx+19, cy+12, cx+16, cy+7);
222 // fl_line(cx+16, cy+7, cx+12, cy+4);
223 //p.drawLine(cx+16, cy+7, cx+12, cy+4);
224 // fl_line(cx+11, cy+4, cx+7, cy+7);
225 //p.drawLine(cx+11, cy+4, cx+7, cy+7);
226 // fl_line(cx+7, cy+7, cx+4, cy+11);
227 //p.drawLine(cx+7, cy+7, cx+4, cy+11);
228 }
229 }
230 }
231 p.end();
232}
233
234
diff --git a/noncore/multimedia/powerchord/fretboard.h b/noncore/multimedia/powerchord/fretboard.h
new file mode 100644
index 0000000..d316df3
--- a/dev/null
+++ b/noncore/multimedia/powerchord/fretboard.h
@@ -0,0 +1,101 @@
1//
2// FretBoard class to display interface for chord finder application
3//
4
5// Copyright (c) 2001 Camilo Mesias
6// camilo@mesias.co.uk
7//
8// This program is free software; you can redistribute it and/or
9// modify it under the terms of the GNU General Public License
10// as published by the Free Software Foundation; either version 2
11// of the License, or (at your option) any later version.
12//
13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17//
18// You should have received a copy of the GNU General Public License
19// along with this program; if not, write to the Free Software
20// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21
22#ifndef __FRETBOARD_H
23#define __FRETBOARD_H
24
25//#include <FL/Fl.H>
26//#include <FL/Fl_Widget.H>
27
28#include <qwidget.h>
29#include <qpixmap.h>
30#include <qstring.h>
31
32#include "chordengine.h"
33
34class FretBoard : public QWidget {
35
36 Q_OBJECT
37
38 private:
39
40 // refresh display based on chord engine
41 void refresh();
42
43 // image stuff
44 QPixmap stringtop_pix;
45 QPixmap string_pix;
46 QPixmap finger_pix;
47 QPixmap mute_pix;
48
49 //saved state of the fretboard
50
51 int initial_fret;
52 int finger[6];
53
54 protected:
55 // void draw_box();
56 // void draw_label();
57 void paintEvent(QPaintEvent *);
58
59 public:
60 // encapsulated chord engine class
61 ChordEngine ce;
62
63 static const int MUTED=7;
64 static const int OPEN=0;
65
66 // void draw();
67 FretBoard(QWidget *parent=0, const char *name=0);
68
69 // not used yet
70 // int Finger(int finger);
71 // int Fret(){return initial_fret;};
72
73 // slots
74 public slots:
75 void Finger(int finger, int position);
76
77 void Fret(int position){
78 initial_fret = position;
79 ce.fret(position);
80 refresh();
81 };
82 void Base(int b){ce.base(b);refresh();};
83 void Chord(int b){ce.chord(b);refresh();};
84 void Span(int b){ce.span(b);refresh();};
85 void Vary(int b){ce.vary(b);refresh();};
86 void Tune(int b){ce.tune(b);refresh();};
87
88 signals:
89 void nameChanged(const QString &);
90 void s1nameChanged(const QString &);
91 void s2nameChanged(const QString &);
92 void s3nameChanged(const QString &);
93 void s4nameChanged(const QString &);
94 void s5nameChanged(const QString &);
95 void s6nameChanged(const QString &);
96
97};
98
99#endif
100
101
diff --git a/noncore/multimedia/powerchord/gs.cpp b/noncore/multimedia/powerchord/gs.cpp
new file mode 100644
index 0000000..a3e85c9
--- a/dev/null
+++ b/noncore/multimedia/powerchord/gs.cpp
@@ -0,0 +1,460 @@
1
2//#include <FL/Fl.H>
3//#include <FL/Fl_Widget.H>
4//#include <FL/fl_draw.H>
5#include <stdio.h>
6//#include <qpixmap.h>
7#include "gs.h"
8
9#include <sys/ioctl.h>
10#include <unistd.h>
11#include <fcntl.h>
12#include <sys/soundcard.h>
13
14#include <errno.h>
15#include <string.h>
16
17#include <stdlib.h>
18
19//#include <qpainter.h>
20#include <qmessagebox.h>
21
22
23gs::gs()
24{
25
26 finger[0] = OPEN;
27 finger[1] = OPEN;
28 finger[2] = OPEN;
29 finger[3] = OPEN;
30 finger[4] = OPEN;
31 finger[5] = OPEN;
32
33 tuning[0] = 0;
34 tuning[1] = 0;
35 tuning[2] = 0;
36 tuning[3] = 0;
37 tuning[4] = 0;
38 tuning[5] = 0;
39
40 initial_fret = 0;
41
42 audio_fd = -1;
43
44 pb_rate0 = 0;
45 pb_rate1 = 0;
46 pb_rate2 = 0;
47 pb_rate3 = 0;
48 pb_rate4 = 0;
49 pb_rate5 = 0;
50 pb_rate6 = 0;
51
52 pb_oct0 = 0;
53 pb_oct1 = 0;
54 pb_oct2 = 0;
55 pb_oct3 = 0;
56 pb_oct4 = 0;
57 pb_oct5 = 0;
58 pb_oct6 = 0;
59
60 // initialise reverb buffer
61 reverb = (signed short *)malloc(1024 * sizeof(signed short));
62
63 for (reverb_ptr=0;reverb_ptr<1024;reverb_ptr++){
64 reverb[reverb_ptr] = 0;
65 }
66 reverb_ptr = 0;
67 reverb_max = 1024;
68
69 // load sampled 'E' string
70 int samplen = 25000;
71
72 signed short *dsp_buf = (signed short *)malloc(samplen * sizeof(signed short));
73 signed short *dsp_buf_ptr = dsp_buf;
74
75 int raw_fd;
76 raw_fd = open(ACGUITAR_PATH_S, O_RDONLY);
77
78 if (raw_fd < 0){
79 fprintf(stderr, "Failed to open raw file (%s)\n", strerror(errno));
80 exit(-1);
81 }
82
83 int totread = 0;
84 int i;
85
86 while (totread < samplen*2){
87 int want = samplen*2 - totread;
88
89 int numread = read(raw_fd, dsp_buf_ptr, want);
90 fprintf(stderr, "read %d bytes\n", numread);
91 totread += numread;
92 dsp_buf_ptr += numread/2;
93
94 if (numread == 0){
95 fprintf(stderr, "failed to read bytes\n");
96 exit(-1);
97 }
98 }
99
100 close(raw_fd);
101
102 // scale down a bit for mixing
103 for (i=0;i<samplen;i++){
104 dsp_buf[i] /= 6;
105 }
106
107 set_tonebank(0, dsp_buf, samplen);
108 set_tonebank(1, dsp_buf, samplen);
109 set_tonebank(2, dsp_buf, samplen);
110 set_tonebank(3, dsp_buf, samplen);
111 set_tonebank(4, dsp_buf, samplen);
112 set_tonebank(5, dsp_buf, samplen);
113 set_tonebank(6, dsp_buf, samplen);
114
115}
116
117void gs::set_tonebank(int tb, signed short *buf, int length)
118{
119 switch(tb){
120 case 0:
121 tonebank0 = buf;
122 tonebank_length0 = length;
123 break;
124 case 1:
125 tonebank1 = buf;
126 tonebank_length1 = length;
127 break;
128 case 2:
129 tonebank2 = buf;
130 tonebank_length2 = length;
131 break;
132 case 3:
133 tonebank3 = buf;
134 tonebank_length3 = length;
135 break;
136 case 4:
137 tonebank4 = buf;
138 tonebank_length4 = length;
139 break;
140 case 5:
141 tonebank5 = buf;
142 tonebank_length5 = length;
143 break;
144 case 6:
145 tonebank6 = buf;
146 tonebank_length6 = length;
147 break;
148
149 }
150}
151
152
153void gs::Finger(int f, int position){
154 if (f < 0 || f > 5){
155 fprintf(stderr, "Error - finger2 value was %d\n", f);
156 return;
157 }
158
159 finger[f] = position;
160}
161
162void gs::Tuning(int t[6]){
163 for (int i=0;i<6;i++){
164 tuning[i] = t[i];
165 }
166}
167
168// length in ps (seconds x 10^-9) of the period of a note.
169// we use these as ratios in a breshenham-like algorithm to
170// scale a deep note to a higher pitch
171// They are derived from f(A) = 440Hz and multiply each successive
172// semitone by the 12th root of 2 (such that after 12 multiplications for
173// 12 semitones you have a note exactly 2x the frequency of the initial one,
174// - an octave higher in other words.)
175
176int gs::note_periods[12] = {
17790703,
17885612,
17980802,
18076272,
18171991,
18267950,
18364137,
18460537,
18557139,
18653932,
18750905,
18848048
189};
190
191int gs::octave_step[6] = {
192 1,
193 2,
194 4,
195 8,
196 16,
197 32
198};
199
200int gs::Play(){
201 int format;
202 int channels;
203 int speed;
204
205 frames = 0;
206
207 if (audio_fd == -1){
208 if ( (audio_fd = open("/dev/dsp", O_WRONLY, 0) ) == -1){
209 audio_fd = -1;
210 return 1;
211 }
212
213 format = AFMT_S16_NE;
214
215 if (ioctl(audio_fd, SNDCTL_DSP_SETFMT, &format) == -1){
216 fprintf(stderr, "Error SNDCTL DSP SETFMT, %s\n", strerror(errno));
217 exit(0);
218 }
219
220 channels = 1;
221
222 if (ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &channels) == -1){
223 fprintf(stderr, "Error SNDCTL DSP CHANNELS, %s\n", strerror(errno));
224 exit(0);
225 }
226
227 speed = 11025;
228
229 if (ioctl(audio_fd, SNDCTL_DSP_SPEED, &speed) == -1){
230 fprintf(stderr, "Error SNDCTL DSP SPEED, %s\n", strerror(errno));
231 exit(0);
232 }
233
234 // buffering q's
235 //audio_buf_info info;
236 //if (ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &info) == -1){
237 // fprintf(stderr, "Error SNDCTL DSP GETOSPACE, %s\n", strerror(errno));
238 // exit(0);
239 //}
240 //fprintf(stderr, "fragments %d\nfragstotal %d\nfragsize %d\nbytes %d\n", info.fragments, info.fragstotal, info.fragsize, info.bytes);
241
242
243
244// audio math.
245// A4 = 440Hz
246// +1 octave = 2x freq
247// -1 octave = /2 freq.
248// +1 semitone = *= 12 root 2;
249// ie. * 1.059463094
250
251// tones, approx Hz, samples at 11025
252// A4 440 25
253// A#4 466 24
254// B4 494 22
255// C4 523 21
256// C#4 554 20
257// D4 587 19
258// D#4 622 18
259// E4 659 17
260// F4 698 16
261// F#4 740 15
262// G4 784 14
263// G#4 831 13
264
265
266 }
267 else{
268 fprintf(stderr, "Already playing\n");
269 }
270
271 return 0;
272}
273
274void gs::note_start(int chan, int note, int octave)
275{
276 switch (chan){
277
278 case 0:
279 pb_rate0 = note_periods[note];
280 pb_oct0 = octave_step[octave];
281 pb_ratio0 = 0;
282 pb_rsc0 = 0;
283 break;
284 case 1:
285 pb_rate1 = note_periods[note];
286 pb_oct1 = octave_step[octave];
287 pb_ratio1 = 0;
288 pb_rsc1 = 0;
289 break;
290 case 2:
291 pb_rate2 = note_periods[note];
292 pb_oct2 = octave_step[octave];
293 pb_ratio2 = 0;
294 pb_rsc2 = 0;
295 break;
296 case 3:
297 pb_rate3 = note_periods[note];
298 pb_oct3 = octave_step[octave];
299 pb_ratio3 = 0;
300 pb_rsc3 = 0;
301 break;
302 case 4:
303 pb_rate4 = note_periods[note];
304 pb_oct4 = octave_step[octave];
305 pb_ratio4 = 0;
306 pb_rsc4 = 0;
307 break;
308 case 5:
309 pb_rate5 = note_periods[note];
310 pb_oct5 = octave_step[octave];
311 pb_ratio5 = 0;
312 pb_rsc5 = 0;
313 break;
314 case 6:
315 pb_rate6 = note_periods[note];
316 pb_oct6 = octave_step[octave];
317 pb_ratio6 = 0;
318 pb_rsc6 = 0;
319 break;
320 default:
321 fprintf(stderr, "Bad channel\n");
322 exit(-1);
323 }
324
325
326}
327
328void gs::write_buffer(){
329 int num_read;
330 num_read = write(audio_fd, (void *)audio_buf, BUFSIZE*2);
331 // fprintf(stderr, "Wrote %d bytes\n", num_read);
332}
333
334void gs::fill_buffer()
335{
336 frames ++;
337
338 int i;
339
340 for (i=0;i<BUFSIZE;i++){
341
342 audio_buf[i] = 0;
343
344 if (pb_rate0){
345 audio_buf[i] += tonebank0[pb_rsc0];
346 pb_rsc0 += pb_oct0;
347 pb_ratio0 += 90703;
348 pb_ratio0 -= pb_rate0;
349 if (pb_ratio0 >= pb_rate0){
350 pb_rsc0 += pb_oct0;
351 pb_ratio0 -= pb_rate0;
352
353 }
354 if (pb_rsc0 >= tonebank_length0) pb_rate0 = 0;
355 }
356
357 if (pb_rate1){
358 audio_buf[i] += tonebank1[pb_rsc1];
359 pb_rsc1 += pb_oct1;
360 pb_ratio1 += 90703;
361 pb_ratio1 -= pb_rate1;
362 if (pb_ratio1 >= pb_rate1){
363 pb_rsc1 += pb_oct1;
364 pb_ratio1 -= pb_rate1;
365
366 }
367 if (pb_rsc1 >= tonebank_length1) pb_rate1 = 0;
368 }
369
370 if (pb_rate2){
371 audio_buf[i] += tonebank2[pb_rsc2];
372 pb_rsc2 += pb_oct2;
373 pb_ratio2 += 90703;
374 pb_ratio2 -= pb_rate2;
375 if (pb_ratio2 >= pb_rate2){
376 pb_rsc2 += pb_oct2;
377 pb_ratio2 -= pb_rate2;
378
379 }
380 if (pb_rsc2 >= tonebank_length2) pb_rate2 = 0;
381 }
382
383 if (pb_rate3){
384 audio_buf[i] += tonebank3[pb_rsc3];
385 pb_rsc3 += pb_oct3;
386 pb_ratio3 += 90703;
387 pb_ratio3 -= pb_rate3;
388 if (pb_ratio3 >= pb_rate3){
389 pb_rsc3 += pb_oct3;
390 pb_ratio3 -= pb_rate3;
391
392 }
393 if (pb_rsc3 >= tonebank_length3) pb_rate3 = 0;
394 }
395
396 if (pb_rate4){
397 audio_buf[i] += tonebank4[pb_rsc4];
398 pb_rsc4 += pb_oct4;
399 pb_ratio4 += 90703;
400 pb_ratio4 -= pb_rate4;
401 if (pb_ratio4 >= pb_rate4){
402 pb_rsc4 += pb_oct4;
403 pb_ratio4 -= pb_rate4;
404
405 }
406 if (pb_rsc4 >= tonebank_length4) pb_rate4 = 0;
407 }
408
409 if (pb_rate5){
410 audio_buf[i] += tonebank5[pb_rsc5];
411 pb_rsc5 += pb_oct5;
412 pb_ratio5 += 90703;
413 pb_ratio5 -= pb_rate5;
414 if (pb_ratio5 >= pb_rate5){
415 pb_rsc5 += pb_oct5;
416 pb_ratio5 -= pb_rate5;
417
418 }
419 if (pb_rsc5 >= tonebank_length5) pb_rate5 = 0;
420 }
421
422 if (pb_rate6){
423 audio_buf[i] += tonebank6[pb_rsc6];
424 pb_rsc6 += pb_oct6;
425 pb_ratio6 += 90703;
426 pb_ratio6 -= pb_rate6;
427 if (pb_ratio6 >= pb_rate6){
428 pb_rsc6 += pb_oct6;
429 pb_ratio6 -= pb_rate6;
430
431 }
432 if (pb_rsc6 >= tonebank_length6) pb_rate6 = 0;
433 }
434
435 // do reverb
436 signed short rtmp = reverb[reverb_ptr];
437 reverb[reverb_ptr] /= 2;
438 reverb[reverb_ptr] += audio_buf[i]/4;
439 audio_buf[i] += rtmp;
440 reverb_ptr++;
441 if (reverb_ptr >= reverb_max) reverb_ptr = 0;
442 }
443}
444
445
446void gs::Stop(){
447 if (audio_fd == -1){
448 fprintf(stderr, "Already stopped\n");
449 }
450 else{
451 //ioctl(audio_fd, SNDCTL_DSP_RESET, 0);
452
453 close(audio_fd);
454 audio_fd = -1;
455 }
456
457}
458
459gs::~gs()
460{}
diff --git a/noncore/multimedia/powerchord/gs.h b/noncore/multimedia/powerchord/gs.h
new file mode 100644
index 0000000..3e4c04d
--- a/dev/null
+++ b/noncore/multimedia/powerchord/gs.h
@@ -0,0 +1,124 @@
1
2#ifndef __GS_H
3#define __GS_H
4
5#include <qobject.h>
6// sound includes
7#include <sys/soundcard.h>
8
9#define BUFSIZE 256
10#define NUMCHANS 7
11#define ACGUITAR_PATH_S "/usr/local/projects/opie-head/noncore/multimedia/powerchord/acguitar.raw"
12
13class gs : public QObject {
14
15 Q_OBJECT
16
17 public:
18 gs();
19 ~gs();
20
21 private:
22
23 int initial_fret;
24 int finger[6];
25 int tuning[6];
26
27 signed short *reverb;
28 int reverb_ptr;
29 int reverb_max;
30
31 int audio_fd;
32 signed short audio_buf[BUFSIZE];
33 static int note_periods[12];
34 static int octave_step[6];
35 int frames;
36
37
38 // 7 channel synth
39 signed short *tonebank0; // source of waveform
40 signed short *tonebank1;
41 signed short *tonebank2;
42 signed short *tonebank3;
43 signed short *tonebank4;
44 signed short *tonebank5;
45 signed short *tonebank6;
46 int tonebank_length0;
47 int tonebank_length1;
48 int tonebank_length2;
49 int tonebank_length3;
50 int tonebank_length4;
51 int tonebank_length5;
52 int tonebank_length6;
53 int pb_rate0; // playback rate or 0
54 int pb_rate1;
55 int pb_rate2;
56 int pb_rate3;
57 int pb_rate4;
58 int pb_rate5;
59 int pb_rate6;
60 int pb_ratio0; // accumulator for ratio
61 int pb_ratio1;
62 int pb_ratio2;
63 int pb_ratio3;
64 int pb_ratio4;
65 int pb_ratio5;
66 int pb_ratio6;
67 int pb_rsc0; // pointer to current position
68 int pb_rsc1;
69 int pb_rsc2;
70 int pb_rsc3;
71 int pb_rsc4;
72 int pb_rsc5;
73 int pb_rsc6;
74 int pb_oct0; // octave
75 int pb_oct1;
76 int pb_oct2;
77 int pb_oct3;
78 int pb_oct4;
79 int pb_oct5;
80 int pb_oct6;
81
82 void set_tonebank(int bank, signed short *buffer, int length);
83 protected:
84
85 public:
86 static const int MUTED=7;
87 static const int OPEN=0;
88
89 // accessors
90 int Frames(){return frames;};
91 int Finger(int finger);
92 int Fret(){return initial_fret;};
93 int Playing(){
94 if (pb_rate0 == 0 &&
95 pb_rate1 == 0 &&
96 pb_rate2 == 0 &&
97 pb_rate3 == 0 &&
98 pb_rate4 == 0 &&
99 pb_rate5 == 0 &&
100 pb_rate6 == 0) return 0;
101 return 1;
102 };
103
104 public :
105 // mutators
106 void Reverb(int size){reverb_max = 64 * size;};
107 void Finger(int finger, int position);
108 void Fret(int position){initial_fret = position;};
109 void Tuning(int t[6]);
110 void note_start(int chan, int note, int octave);
111
112 // methods
113 int Play();
114 void fill_buffer();
115 void write_buffer();
116 void Stop();
117};
118
119#endif
120
121
122
123
124
diff --git a/noncore/multimedia/powerchord/gt.cpp b/noncore/multimedia/powerchord/gt.cpp
new file mode 100644
index 0000000..0db5f0f
--- a/dev/null
+++ b/noncore/multimedia/powerchord/gt.cpp
@@ -0,0 +1,39 @@
1
2//#include <FL/Fl.H>
3//#include <FL/Fl_Widget.H>
4//#include <FL/fl_draw.H>
5#include <stdio.h>
6//#include <qpixmap.h>
7#include "gt.h"
8
9#include <sys/ioctl.h>
10#include <unistd.h>
11#include <fcntl.h>
12#include <sys/soundcard.h>
13
14#include <errno.h>
15#include <string.h>
16
17#include <stdlib.h>
18
19gt::gt()
20{
21
22 audio_fd = -1;
23
24}
25
26void gt::Stop(){
27}
28
29void gt::Listen(){
30}
31
32void gt::read_buffer(){
33}
34
35void gt::process_buffer(){
36}
37
38gt::~gt()
39{}
diff --git a/noncore/multimedia/powerchord/gt.h b/noncore/multimedia/powerchord/gt.h
new file mode 100644
index 0000000..53c9f08
--- a/dev/null
+++ b/noncore/multimedia/powerchord/gt.h
@@ -0,0 +1,54 @@
1
2#ifndef __GT_H
3#define __GT_H
4
5#include <qobject.h>
6// sound includes
7#include <sys/soundcard.h>
8
9#define BUFSIZE 256
10#define NUMCHANS 7
11
12class gt : public QObject {
13
14 Q_OBJECT
15
16 public:
17 gt();
18 ~gt();
19
20 private:
21
22 int audio_fd;
23 signed short audio_buf[BUFSIZE];
24
25 int note;
26 int tune;
27
28 short min;
29 short max;
30 int phase;
31
32 protected:
33
34 public:
35
36 // accessors
37 int Tuning(){return tune;};
38 int Note(){return note;};
39 int Listening(){return (audio_fd == -1);};
40
41 public slots :
42 // methods
43 void Listen();
44 void process_buffer();
45 void read_buffer();
46 void Stop();
47};
48
49#endif
50
51
52
53
54
diff --git a/noncore/multimedia/powerchord/main.cpp b/noncore/multimedia/powerchord/main.cpp
new file mode 100644
index 0000000..7fca87c
--- a/dev/null
+++ b/noncore/multimedia/powerchord/main.cpp
@@ -0,0 +1,12 @@
1#include "powerchord.h"
2#include <qpe/qpeapplication.h>
3
4int main( int argc, char ** argv )
5{
6 QPEApplication a( argc, argv );
7
8 PowerchordBase p;
9 a.showMainWidget( &p );
10
11 return a.exec();
12}
diff --git a/noncore/multimedia/powerchord/opie-powerchord.control b/noncore/multimedia/powerchord/opie-powerchord.control
new file mode 100644
index 0000000..7f45999
--- a/dev/null
+++ b/noncore/multimedia/powerchord/opie-powerchord.control
@@ -0,0 +1,10 @@
1Files: bin/powerchord apps/Applications/powerchord.desktop pics/powerchord sounds/powerchord
2Priority: optional
3Section: qpe/applications
4Maintainer: Camilo Mesias <camilo@mesias.co.uk>
5Architecture: arm
6Version: 0.0.7
7Depends: qpe-base ($QPE_VERSION)
8Description: Guitar Chord generator application
9Allows naming of chords using base note and key. Fretboard diagrams are
10produced illustrating ways to play the chord.
diff --git a/noncore/multimedia/powerchord/powerchord.cpp b/noncore/multimedia/powerchord/powerchord.cpp
new file mode 100644
index 0000000..79a26ea
--- a/dev/null
+++ b/noncore/multimedia/powerchord/powerchord.cpp
@@ -0,0 +1,28 @@
1#include "powerchord.h"
2#include <qpushbutton.h>
3
4/*
5 * Constructs a Example which is a child of 'parent', with the
6 * name 'name' and widget flags set to 'f'
7 */
8Powerchord::Powerchord( QWidget* parent, const char* name, WFlags fl )
9 : PowerchordBase( parent, name, fl )
10{
11// connect(quit, SIGNAL(clicked), this, SLOT(goodBye()));
12}
13
14/*
15 * Destroys the object and frees any allocated resources
16 */
17Powerchord::~Powerchord()
18{
19 // no need to delete child widgets, Qt does it all for us
20}
21
22/*
23 * A simple slot... not very interesting.
24 */
25void Powerchord::goodBye()
26{
27 close();
28}
diff --git a/noncore/multimedia/powerchord/powerchord.h b/noncore/multimedia/powerchord/powerchord.h
new file mode 100644
index 0000000..0793fd2
--- a/dev/null
+++ b/noncore/multimedia/powerchord/powerchord.h
@@ -0,0 +1,17 @@
1#ifndef POWERCHORD_H
2#define POWERCHORD_H
3#include "powerchordbase.h"
4
5class Powerchord : public PowerchordBase
6{
7 Q_OBJECT
8
9public:
10 Powerchord( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
11 ~Powerchord();
12
13private slots:
14 void goodBye();
15};
16
17#endif // POWERCHORD_H
diff --git a/noncore/multimedia/powerchord/powerchord.ui b/noncore/multimedia/powerchord/powerchord.ui
new file mode 100644
index 0000000..d70001a
--- a/dev/null
+++ b/noncore/multimedia/powerchord/powerchord.ui
@@ -0,0 +1,55 @@
1<!DOCTYPE UI><UI>
2<class>Powerchord</class>
3<widget>
4 <class>QWidget</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>Form1</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>196</width>
15 <height>245</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Form1</string>
21 </property>
22 <vbox>
23 <property stdset="1">
24 <name>margin</name>
25 <number>11</number>
26 </property>
27 <property stdset="1">
28 <name>spacing</name>
29 <number>6</number>
30 </property>
31 <widget>
32 <class>QLabel</class>
33 <property stdset="1">
34 <name>name</name>
35 <cstring>TextLabel1</cstring>
36 </property>
37 <property stdset="1">
38 <name>text</name>
39 <string>&lt;p&gt;This is just an &lt;i&gt;example&lt;/i&gt;. It doesn't do anything interesting at all.</string>
40 </property>
41 </widget>
42 <widget>
43 <class>QPushButton</class>
44 <property stdset="1">
45 <name>name</name>
46 <cstring>quit</cstring>
47 </property>
48 <property stdset="1">
49 <name>text</name>
50 <string>Quit</string>
51 </property>
52 </widget>
53 </vbox>
54</widget>
55</UI>
diff --git a/noncore/multimedia/powerchord/powerchordbase.cpp b/noncore/multimedia/powerchord/powerchordbase.cpp
new file mode 100644
index 0000000..0b97984
--- a/dev/null
+++ b/noncore/multimedia/powerchord/powerchordbase.cpp
@@ -0,0 +1,592 @@
1/****************************************************************************
2** Form implementation generated from reading ui file 'powerchordbase.ui'
3**
4** Created: Sun Jan 13 23:05:11 2002
5** by: The User Interface Compiler (uic)
6**
7** WARNING! All changes made in this file will be lost!
8****************************************************************************/
9#include "powerchordbase.h"
10
11#include "fretboard.h"
12#include "vumeter.h"
13#include "gs.h"
14#include <qcombobox.h>
15#include <qframe.h>
16#include <qlabel.h>
17#include <qlistbox.h>
18#include <qpushbutton.h>
19#include <qspinbox.h>
20#include <qtabwidget.h>
21#include <qlayout.h>
22#include <qvariant.h>
23#include <qtooltip.h>
24#include <qwhatsthis.h>
25#include <qimage.h>
26#include <qpixmap.h>
27#include <qbitmap.h>
28#include <qpe/resource.h>
29
30
31/*
32 * Constructs a PowerchordBase which is a child of 'parent', with the
33 * name 'name' and widget flags set to 'f'
34 */
35PowerchordBase::PowerchordBase( QWidget* parent, const char* name, WFlags fl )
36 : QWidget( parent, name, fl )
37{
38 simulation_timer = 0;
39 audio_timer = 0;
40
41 // setPalette( QPalette( QColor( 232, 227, 215) ) );
42
43 // QPixmap image0(QString("/opt/Qtopia/pics/powerchord/image0"));
44 QPixmap image1 = Resource::loadPixmap( "powerchord/image1");
45 QPixmap image2 = Resource::loadPixmap( "powerchord/image2");
46 QPixmap image3 = Resource::loadPixmap( "powerchord/image3");
47 QPixmap image4 = Resource::loadPixmap( "powerchord/image4");
48 QPixmap image5 = Resource::loadPixmap( "powerchord/image5");
49 image6 = Resource::loadPixmap( "powerchord/image6");
50 image_open = Resource::loadPixmap( "powerchord/image_open");
51
52 // image0.setMask(image0.createHeuristicMask());
53 image1.setMask(image1.createHeuristicMask());
54 // image2.setMask(image2.createHeuristicMask());
55 // image3.setMask(image3.createHeuristicMask());
56 // image4.setMask(image4.createHeuristicMask());
57 // image5.setMask(image5.createHeuristicMask());
58 // image6->setMask(image6->createHeuristicMask());
59 // image_open->setMask(image_open->createHeuristicMask());
60
61 if ( !name )
62 setName( "PowerchordBase" );
63 resize( 240, 284 );
64 setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, sizePolicy().hasHeightForWidth() ) );
65 setMinimumSize( QSize( 240, 284 ) );
66 setMaximumSize( QSize( 240, 284 ) );
67 setCaption( tr( "Powerchord" ) );
68
69 tabs = new QTabWidget( this, "tabs" );
70 tabs->setEnabled( TRUE );
71 tabs->setGeometry( QRect( 0, 0, 240, 286 ) );
72 tabs->setTabPosition( QTabWidget::Bottom );
73
74 tab = new QWidget( tabs, "tab" );
75
76 chordkey = new QComboBox( FALSE, tab, "chordkey" );
77 chordkey->insertItem( tr( "maj" ) );
78 chordkey->insertItem( tr( "min" ) );
79 chordkey->insertItem( tr( "7th" ) );
80 chordkey->insertItem( tr( "m7" ) );
81 chordkey->insertItem( tr( "maj7" ) );
82 chordkey->insertItem( tr( "6th" ) );
83 chordkey->insertItem( tr( "m6th" ) );
84 chordkey->insertItem( tr( "aug" ) );
85 chordkey->insertItem( tr( "dim" ) );
86 chordkey->insertItem( tr( "sus4" ) );
87 chordkey->insertItem( tr( "7sus4" ) );
88 chordkey->insertItem( tr( "9th" ) );
89 chordkey->insertItem( tr( "add9" ) );
90 chordkey->insertItem( tr( "m9th" ) );
91 chordkey->insertItem( tr( "maj9" ) );
92 chordkey->insertItem( tr( "sus2" ) );
93 chordkey->insertItem( tr( "7sus2" ) );
94 chordkey->insertItem( tr( "11th" ) );
95 chordkey->insertItem( tr( "m11th" ) );
96 chordkey->insertItem( tr( "13th" ) );
97 chordkey->insertItem( tr( "m13th" ) );
98 chordkey->insertItem( tr( "maj13" ) );
99 chordkey->insertItem( tr( "6/9" ) );
100 chordkey->insertItem( tr( "flat5" ) );
101 chordkey->insertItem( tr( "7#9" ) );
102 chordkey->insertItem( tr( QString::fromUtf8( "ø7" ) ) );
103 chordkey->insertItem( tr( "5" ) );
104 chordkey->setGeometry( QRect( 40, 0, 51, 21 ) );
105
106 chordfret = new QComboBox( FALSE, tab, "chordfret" );
107 chordfret->insertItem( tr( "open" ) );
108 chordfret->insertItem( tr( "1st" ) );
109 chordfret->insertItem( tr( "2nd" ) );
110 chordfret->insertItem( tr( "3rd" ) );
111 chordfret->insertItem( tr( "4th" ) );
112 chordfret->insertItem( tr( "5th" ) );
113 chordfret->insertItem( tr( "6th" ) );
114 chordfret->insertItem( tr( "7th" ) );
115 chordfret->insertItem( tr( "8th" ) );
116 chordfret->insertItem( tr( "9th" ) );
117 chordfret->insertItem( tr( "10th" ) );
118 chordfret->insertItem( tr( "11th" ) );
119 chordfret->insertItem( tr( "12th" ) );
120 chordfret->insertItem( tr( "13th" ) );
121 chordfret->insertItem( tr( "14th" ) );
122 chordfret->insertItem( tr( "15th" ) );
123 chordfret->insertItem( tr( "16th" ) );
124 chordfret->setGeometry( QRect( 90, 0, 55, 21 ) ); //cxm less 5 width
125
126 chordnote = new QComboBox( FALSE, tab, "chordnote" );
127 chordnote->insertItem( tr( "C" ) );
128 chordnote->insertItem( tr( "C#" ) );
129 chordnote->insertItem( tr( "D" ) );
130 chordnote->insertItem( tr( "Eb" ) );
131 chordnote->insertItem( tr( "E" ) );
132 chordnote->insertItem( tr( "F" ) );
133 chordnote->insertItem( tr( "F#" ) );
134 chordnote->insertItem( tr( "G" ) );
135 chordnote->insertItem( tr( "G#" ) );
136 chordnote->insertItem( tr( "A" ) );
137 chordnote->insertItem( tr( "Bb" ) );
138 chordnote->insertItem( tr( "B" ) );
139 chordnote->setGeometry( QRect( 0, 0, 40, 21 ) );
140 chordnote->setCurrentItem( 9 );
141
142 QWidget* privateLayoutWidget = new QWidget( tab, "Layout1" );
143 privateLayoutWidget->setGeometry( QRect( 5, 232, 160, 20 ) );
144 Layout1 = new QHBoxLayout( privateLayoutWidget );
145 Layout1->setSpacing( 6 );
146 Layout1->setMargin( 0 );
147
148 s1_1 = new QLabel( privateLayoutWidget, "s1_1" );
149 s1_1->setText( tr( "E" ) );
150 s1_1->setAlignment( int( QLabel::AlignCenter ) );
151 Layout1->addWidget( s1_1 );
152
153 s1_2 = new QLabel( privateLayoutWidget, "s1_2" );
154 s1_2->setText( tr( "A" ) );
155 s1_2->setAlignment( int( QLabel::AlignCenter ) );
156 Layout1->addWidget( s1_2 );
157
158 s1_3 = new QLabel( privateLayoutWidget, "s1_3" );
159 s1_3->setText( tr( "E" ) );
160 s1_3->setAlignment( int( QLabel::AlignCenter ) );
161 Layout1->addWidget( s1_3 );
162
163 s1_4 = new QLabel( privateLayoutWidget, "s1_4" );
164 s1_4->setText( tr( "A" ) );
165 s1_4->setAlignment( int( QLabel::AlignCenter ) );
166 Layout1->addWidget( s1_4 );
167
168 s1_5 = new QLabel( privateLayoutWidget, "s1_5" );
169 s1_5->setText( tr( "C#" ) );
170 s1_5->setAlignment( int( QLabel::AlignCenter ) );
171 Layout1->addWidget( s1_5 );
172
173 s1_6 = new QLabel( privateLayoutWidget, "s1_6" );
174 s1_6->setText( tr( "E" ) );
175 s1_6->setAlignment( int( QLabel::AlignCenter ) );
176 Layout1->addWidget( s1_6 );
177
178 // sound_label = new QLabel( tab, "sound_label" );
179 // sound_label->setGeometry( QRect( 185, 160, 32, 17 ) );
180 // sound_label->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, sound_label->sizePolicy().hasHeightForWidth() ) );
181 // sound_label->setPixmap( image0 );
182 // sound_label->pixmap()->setMask(*image0.mask());
183 // sound_label->setScaledContents( TRUE );
184 // sound_label->setBackgroundMode( QWidget::PaletteButton );
185 // sound_label->setBackgroundColor(this->backgroundColor());
186 // sound_label->setPalette( QPalette( QColor( 232, 227, 215) ) );
187
188
189 Frame6 = new QFrame( tab, "Frame6" );
190 Frame6->setGeometry( QRect( 170, 145, 66, 10 ) );
191 Frame6->setFrameShape( QFrame::HLine );
192 Frame6->setFrameShadow( QFrame::Raised );
193
194 chordshow_label = new QLabel( tab, "chordshow_label" );
195 chordshow_label->setGeometry( QRect( 185, 60, 32, 17 ) );
196 // chordshow_label->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, chordshow_label->sizePolicy().hasHeightForWidth() ) );
197 chordshow_label->setFrameShape( QLabel::NoFrame );
198 chordshow_label->setPixmap( image1 );
199 chordshow_label->setScaledContents( TRUE );
200 // chordshow_label->setBackgroundMode( QWidget::PaletteButton );
201
202 transport_rec = new QPushButton( tab, "transport_rec" );
203 transport_rec->setGeometry( QRect( 170, 80, 30, 30 ) );
204 transport_rec->setText( tr( "" ) );
205 transport_rec->setPixmap( image2 );
206
207 play_sound = new QPushButton( tab, "play_sound" );
208 play_sound->setGeometry( QRect( 170, 180, 60, 55 ) );
209 play_sound->setText( tr( "" ) );
210 play_sound->setPixmap( image3 );
211
212 Frame6_2 = new QFrame( tab, "Frame6_2" );
213 Frame6_2->setGeometry( QRect( 170, 45, 66, 10 ) );
214 Frame6_2->setFrameShape( QFrame::HLine );
215 Frame6_2->setFrameShadow( QFrame::Raised );
216
217 transport_play = new QPushButton( tab, "transport_play" );
218 transport_play->setEnabled( FALSE );
219 transport_play->setGeometry( QRect( 200, 80, 30, 30 ) );
220 transport_play->setText( tr( "" ) );
221 transport_play->setPixmap( image3 );
222
223 transport_rew = new QPushButton( tab, "transport_rew" );
224 transport_rew->setEnabled( FALSE );
225 transport_rew->setGeometry( QRect( 170, 110, 30, 30 ) );
226 transport_rew->setText( tr( "" ) );
227 transport_rew->setPixmap( image4 );
228
229 transport_fwd = new QPushButton( tab, "transport_fwd" );
230 transport_fwd->setEnabled( FALSE );
231 transport_fwd->setGeometry( QRect( 200, 110, 30, 30 ) );
232 transport_fwd->setText( tr( "" ) );
233 transport_fwd->setPixmap( image5 );
234
235 chordname = new QLabel( tab, "chordname" );
236 chordname->setGeometry( QRect( 146, 0, 90, 20 ) ); //cxm moved l 5
237 chordname->setText( tr( "A" ) );
238 chordname->setAlignment( int( QLabel::AlignCenter ) );
239 QToolTip::add( chordname, tr( "" ) );
240
241 synth = new gs();
242 tuner = new gt();
243 frets = new FretBoard( tab, "frets" );
244 frets->setGeometry( QRect( 0, 20, 168, 210 ) );
245 tabs->insertTab( tab, tr( "Guitar" ) );
246
247 tab_2 = new QWidget( tabs, "tab_2" );
248
249 optlab2 = new QLabel( tab_2, "optlab2" );
250 optlab2->setGeometry( QRect( 9, 58, 120, 41 ) );
251 optlab2->setText( tr( "Alternative tunings are possible" ) );
252 optlab2->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter | QLabel::AlignLeft ) );
253
254 span = new QComboBox( FALSE, tab_2, "span" );
255 span->insertItem( tr( "2" ) );
256 span->insertItem( tr( "3" ) );
257 span->insertItem( tr( "4" ) );
258 span->insertItem( tr( "5" ) );
259 span->insertItem( tr( "6" ) );
260 span->setGeometry( QRect( 180, 20, 50, 21 ) );
261 span->setCurrentItem( 1 );
262
263 TextLabel1 = new QLabel( tab_2, "TextLabel1" );
264 TextLabel1->setGeometry( QRect( 3, 109, 226, 140 ) );
265 TextLabel1->setText( tr( QString::fromUtf8( "©2002 Camilo Mesias\n"
266"camilo@mesias.co.uk\n"
267"Version 0.0.7 beta" ) ) );
268 TextLabel1->setAlignment( int( QLabel::AlignBottom | QLabel::AlignLeft ) );
269
270 tuning = new QComboBox( FALSE, tab_2, "tuning" );
271 tuning->insertItem( tr( "EADGBE" ) );
272 tuning->insertItem( tr( "EBEG#BE" ) );
273 tuning->insertItem( tr( "EAEAC#E" ) );
274 tuning->insertItem( tr( "EADF#BE" ) );
275 tuning->insertItem( tr( "EADGCF" ) );
276 tuning->insertItem( tr( "DADGAD" ) );
277 tuning->insertItem( tr( "DGCGCD" ) );
278 tuning->insertItem( tr( "DADF#AD" ) );
279 tuning->insertItem( tr( "DADGBE" ) );
280 tuning->insertItem( tr( "DGDGBD" ) );
281 tuning->insertItem( tr( "DADACD" ) );
282 tuning->insertItem( tr( "CGCGAE" ) );
283 tuning->insertItem( tr( "FADGBE" ) );
284 tuning->insertItem( tr( "G minor" ) );
285 tuning->setGeometry( QRect( 140, 70, 91, 21 ) );
286
287 optlab1 = new QLabel( tab_2, "optlab1" );
288 optlab1->setGeometry( QRect( 8, 8, 160, 40 ) );
289 optlab1->setText( tr( "Span: the greatest number of frets over which you want chords to be generated" ) );
290 optlab1->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter | QLabel::AlignLeft ) );
291 tabs->insertTab( tab_2, tr( "Options" ) );
292
293 Tuner = new QWidget( tabs, "Tuner" );
294
295 Frame4 = new QFrame( Tuner, "Frame4" );
296 Frame4->setGeometry( QRect( 0, 0, 230, 126 ) );
297 Frame4->setFrameShape( QFrame::Box );
298 Frame4->setFrameShadow( QFrame::Raised );
299
300 vu = new VUMeter( Frame4, "vu" );
301 vu->setGeometry( QRect( 5, 5, 220, 115 ) );
302
303 tuner_note = new QComboBox( FALSE, Tuner, "tuner_note" );
304 tuner_note->insertItem( tr( "auto" ) );
305 tuner_note->insertItem( tr( "E" ) );
306 tuner_note->insertItem( tr( "D" ) );
307 tuner_note->insertItem( tr( "G" ) );
308 tuner_note->insertItem( tr( "A" ) );
309 tuner_note->insertItem( tr( "B" ) );
310 tuner_note->insertItem( tr( "C" ) );
311 tuner_note->insertItem( tr( "F" ) );
312 tuner_note->setGeometry( QRect( 5, 160, 90, 20 ) );
313
314 Frame8 = new QFrame( Tuner, "Frame8" );
315 Frame8->setGeometry( QRect( -2, 188, 231, 10 ) );
316 Frame8->setFrameShape( QFrame::HLine );
317 Frame8->setFrameShadow( QFrame::Raised );
318
319 tuner_start = new QPushButton( Tuner, "tuner_start" );
320 tuner_start->setGeometry( QRect( 100, 155, 91, 30 ) );
321 tuner_start->setText( tr( "Start" ) );
322
323 tuner_lab1 = new QLabel( Tuner, "tuner_lab1" );
324 tuner_lab1->setGeometry( QRect( 10, 130, 100, 21 ) );
325 tuner_lab1->setText( tr( "Tuner operation" ) );
326
327 tuner_lab2 = new QLabel( Tuner, "tuner_lab2" );
328 tuner_lab2->setGeometry( QRect( 10, 200, 100, 16 ) );
329 tuner_lab2->setText( tr( "Pitch calibration" ) );
330
331 tuner_calib_note = new QComboBox( FALSE, Tuner, "tuner_calib_note" );
332 tuner_calib_note->insertItem( tr( "A" ) );
333 tuner_calib_note->insertItem( tr( "C" ) );
334 tuner_calib_note->setGeometry( QRect( 5, 225, 90, 21 ) );
335
336 tuner_calib_freq = new QSpinBox( Tuner, "tuner_calib_freq" );
337 tuner_calib_freq->setGeometry( QRect( 105, 225, 71, 21 ) );
338 tuner_calib_freq->setSuffix( tr( "Hz" ) );
339 tuner_calib_freq->setWrapping( TRUE );
340 tuner_calib_freq->setMaxValue( 500 );
341 tuner_calib_freq->setMinValue( 300 );
342 tuner_calib_freq->setValue( 440 );
343
344 tuner_lab3 = new QLabel( Tuner, "tuner_lab3" );
345 tuner_lab3->setGeometry( QRect( 185, 225, 40, 21 ) );
346 tuner_lab3->setText( tr( "Pitch" ) );
347
348 tuner_pic1 = new QLabel( Tuner, "tuner_pic1" );
349 tuner_pic1->setGeometry( QRect( 195, 155, 31, 31 ) );
350 tuner_pic1->setFrameShape( QLabel::NoFrame );
351 tuner_pic1->setPixmap( image6 );
352 tuner_pic1->setScaledContents( TRUE );
353 tabs->insertTab( Tuner, tr( "Tuner" ) );
354
355 tab_3 = new QWidget( tabs, "tab_3" );
356
357 chordlistlab1 = new QLabel( tab_3, "chordlistlab1" );
358 chordlistlab1->setGeometry( QRect( 5, 5, 216, 16 ) );
359 chordlistlab1->setText( tr( "Chord list" ) );
360
361 chordlist = new QListBox( tab_3, "chordlist" );
362 chordlist->setGeometry( QRect( 5, 25, 220, 200 ) );
363
364 list_remove_btn = new QPushButton( tab_3, "list_remove_btn" );
365 list_remove_btn->setGeometry( QRect( 150, 230, 71, 25 ) );
366 list_remove_btn->setText( tr( "Remove" ) );
367 tabs->insertTab( tab_3, tr( "Chords" ) );
368
369 // hope this does what it's supposed to!!
370 // setPalette( QPalette( QColor( 232, 227, 215) ) );
371
372 // signals and slots connections
373
374 //cxm
375 connect( tuning, SIGNAL( activated(int) ), frets, SLOT( Tune(int) ) );
376 connect( span, SIGNAL( activated(int) ), frets, SLOT( Span(int) ) );
377 connect( transport_rec, SIGNAL( clicked() ), this, SLOT( transport_rec_cb() ));
378 connect( play_sound, SIGNAL( clicked() ), this, SLOT( play_chord_cb() ));
379 connect( tuner_start, SIGNAL( clicked() ), this, SLOT( tuner_start_cb() ));
380 connect( tuner_note, SIGNAL( textChanged(const QString&) ), vu, SLOT( AnnotL(const QString&) ));
381 connect( this, SIGNAL( frequency_change(int) ), vu, SLOT( Value(int) ));
382
383 connect( chordnote, SIGNAL( activated(int) ), frets, SLOT( Base(int) ) );
384 connect( chordkey, SIGNAL( activated(int) ), frets, SLOT( Chord(int) ) );
385 connect( chordfret, SIGNAL( activated(int) ), frets, SLOT( Fret(int) ) );
386 connect( list_remove_btn, SIGNAL( clicked() ), this, SLOT( list_remove_cb() ) );
387 connect( frets, SIGNAL( s1nameChanged(const QString &) ), s1_1, SLOT( setText(const QString&) ) );
388 connect( frets, SIGNAL( s2nameChanged(const QString &) ), s1_2, SLOT( setText(const QString&) ) );
389 connect( frets, SIGNAL( s3nameChanged(const QString &) ), s1_3, SLOT( setText(const QString&) ) );
390 connect( frets, SIGNAL( s4nameChanged(const QString &) ), s1_4, SLOT( setText(const QString&) ) );
391 connect( frets, SIGNAL( s5nameChanged(const QString &) ), s1_5, SLOT( setText(const QString&) ) );
392 connect( frets, SIGNAL( s6nameChanged(const QString &) ), s1_6, SLOT( setText(const QString&) ) );
393 connect( frets, SIGNAL( nameChanged(const QString &) ), chordname, SLOT( setText(const QString&) ) );
394}
395
396
397static int known=0;
398#include <qmessagebox.h>
399void PowerchordBase::transport_rec_cb(){
400 chordlist->insertItem(chordname->text(),-1);
401 if (!known){
402 QMessageBox::information(this, "Powerchord", "This chord has been saved\ninto the list of chords,\nfor later playback.");
403 known = 1;
404 }
405}
406void PowerchordBase::list_remove_cb(){
407 if (chordlist->count() > 0){
408 chordlist->removeItem(0);
409 }
410}
411void PowerchordBase::play_chord_cb(){
412 // QMessageBox::information(this, "Coming soon!", "This button plays\nthe chord by synthesizing\nthe sound of the notes.");
413
414
415 if (audio_timer){
416 audio_timer->stop();
417 // set pixmap?
418 synth->Stop();
419 delete(audio_timer);
420 audio_timer = 0;
421 }else{
422 // get notes from chord engine
423
424 int note;
425 int base;
426 int octave;
427 note = frets->ce.noteindex(0);
428 if (note >= 0){
429 //fprintf(stderr, "Note was %d\n", note);
430 base = note % 12;
431 octave = note / 12;
432 synth->note_start(0, base, octave);
433 }else{
434 // subtle bug here - replay second note if 1st one muted
435 note = frets->ce.noteindex(1);
436 base = note % 12;
437 octave = note / 12;
438 synth->note_start(1, base, octave);
439
440 }
441
442 // init synth
443 if (synth->Play()){
444 // error
445 QMessageBox::information(this, "Powerchord", "Unable to open device for sound playback - check that no other application is using it.");
446 return;
447 }
448 synth->fill_buffer();
449
450 // start timer
451 audio_timer = new QTimer();
452 connect(audio_timer, SIGNAL( timeout() ), this, SLOT( audio_cb() ));
453 // set pixmap on player?
454 audio_timer->start(19); // 19 msec (fudge factor!!)
455 }
456}
457
458
459
460void PowerchordBase::audio_cb(){
461 // play the next bit of audio until quiet
462
463 // strum timing
464#define INTERVAL 2
465
466 if ((synth->Frames() % INTERVAL) == 0){
467 int string = synth->Frames() / INTERVAL;
468 if (string <= 5){
469 int note;
470 int base;
471 int octave;
472 note = frets->ce.noteindex(string);
473 // check not muted...
474 if (note > 0){
475 base = note % 12;
476 octave = note / 12;
477 synth->note_start(string, base, octave);
478 }
479 }
480 }
481
482 if (synth->Playing()){
483 synth->write_buffer();
484 synth->fill_buffer();
485 }else{
486 audio_timer->stop();
487 // set pixmap?
488 synth->Stop();
489 delete(audio_timer);
490 audio_timer = 0;
491 }
492}
493
494// the real tuner
495// void PowerchordBase::tuner_start_cb(){
496
497// if (tuner->Listening()){
498// simulation_timer->stop();
499// tuner->Stop();
500// tuner_pic1->setPixmap( *image6 );
501
502// }else{
503// tuner_pic1->setPixmap( *image_open );
504
505// if (!simulation_timer){
506// simulation_timer = new QTimer();
507
508
509// connect(simulation_timer, SIGNAL( timeout() ), this, SLOT( tuner_cb() ));
510// }
511
512// simulation_timer->start(50);
513// tuner->Listen();
514
515// }
516// }
517
518void PowerchordBase::tuner_cb(){
519 if (tuner->Listening()){
520 tuner->read_buffer();
521 tuner->process_buffer();
522
523 // update gui
524 // do something with the note: tuner->Note()
525 emit frequency_change(tuner->Tuning());
526
527 }else{
528 simulation_timer->stop();
529 tuner->Stop();
530 tuner_pic1->setPixmap( image6 );
531 }
532}
533
534
535void PowerchordBase::tuner_start_cb(){
536 if (0 == QMessageBox::information(this, "Powerchord", "Using the microphone,\nthe note's frequency\nis analysed. This\nis a simulation.", "OK", "Cancel", 0, 1)){
537 if (simulation_timer){
538 simulation_timer->stop();
539 }else{
540 simulation_timer = new QTimer();
541 connect(simulation_timer, SIGNAL( timeout() ), this, SLOT( tuner_simulation_cb() ));
542
543 }
544 simulation_x = -45;
545 simulation_v = 0;
546 simulation_iter = 0;
547
548 tuner_pic1->setPixmap( image_open );
549 simulation_timer->start(100);
550 }
551}
552
553#include <stdio.h>
554
555void PowerchordBase::tuner_simulation_cb(){
556 if (simulation_x < -10 || simulation_x > 10){
557 simulation_v = (simulation_v/2)-(simulation_x/5);
558 }
559
560 simulation_x += simulation_v;
561 simulation_iter++;
562
563 if (simulation_x > 50){
564 simulation_x = 50;
565 }
566
567 if (simulation_x < -50){
568 simulation_x = -50;
569 }
570
571 if (simulation_iter > 50){
572 simulation_timer->stop();
573 emit frequency_change(0);
574 tuner_pic1->setPixmap( image6 );
575 }else{
576 emit frequency_change(simulation_x);
577 }
578}
579
580/*
581 * Destroys the object and frees any allocated resources
582 */
583PowerchordBase::~PowerchordBase()
584{
585 // no need to delete child widgets, Qt does it all for us
586}
587
588void PowerchordBase::change_handler()
589{
590 qWarning( "PowerchordBase::change_handler(): Not implemented yet!" );
591}
592
diff --git a/noncore/multimedia/powerchord/powerchordbase.h b/noncore/multimedia/powerchord/powerchordbase.h
new file mode 100644
index 0000000..9ff1f44
--- a/dev/null
+++ b/noncore/multimedia/powerchord/powerchordbase.h
@@ -0,0 +1,113 @@
1/****************************************************************************
2** Form interface generated from reading ui file 'powerchordbase.ui'
3**
4** Created: Sun Jan 13 23:04:45 2002
5** by: The User Interface Compiler (uic)
6**
7** WARNING! All changes made in this file will be lost!
8****************************************************************************/
9#ifndef POWERCHORDBASE_H
10#define POWERCHORDBASE_H
11
12#include <qvariant.h>
13#include <qwidget.h>
14#include <qpixmap.h>
15
16#include "gs.h"
17#include "gt.h"
18
19class QVBoxLayout;
20class QHBoxLayout;
21class QGridLayout;
22class FretBoard;
23class QComboBox;
24class QFrame;
25class QLabel;
26class QListBox;
27class QListBoxItem;
28class QPushButton;
29class QSpinBox;
30class QTabWidget;
31class VUMeter;
32
33class PowerchordBase : public QWidget
34{
35 Q_OBJECT
36
37public:
38 PowerchordBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
39 ~PowerchordBase();
40
41 QTabWidget* tabs;
42 QWidget* tab;
43 QComboBox* chordkey;
44 QComboBox* chordfret;
45 QComboBox* chordnote;
46 QLabel* s1_1;
47 QLabel* s1_2;
48 QLabel* s1_3;
49 QLabel* s1_4;
50 QLabel* s1_5;
51 QLabel* s1_6;
52 QLabel* sound_label;
53 QFrame* Frame6;
54 QLabel* chordshow_label;
55 QPushButton* transport_rec;
56 QPushButton* play_sound;
57 QFrame* Frame6_2;
58 QPushButton* transport_play;
59 QPushButton* transport_rew;
60 QPushButton* transport_fwd;
61 QLabel* chordname;
62 FretBoard* frets;
63 gs* synth;
64 gt* tuner;
65 QWidget* tab_2;
66 QLabel* optlab2;
67 QComboBox* span;
68 QLabel* TextLabel1;
69 QComboBox* tuning;
70 QLabel* optlab1;
71 QWidget* Tuner;
72 QFrame* Frame4;
73 VUMeter* vu;
74 QComboBox* tuner_note;
75 QFrame* Frame8;
76 QPushButton* tuner_start;
77 QLabel* tuner_lab1;
78 QLabel* tuner_lab2;
79 QComboBox* tuner_calib_note;
80 QSpinBox* tuner_calib_freq;
81 QLabel* tuner_lab3;
82 QLabel* tuner_pic1;
83 QWidget* tab_3;
84 QLabel* chordlistlab1;
85 QListBox* chordlist;
86 QPushButton* list_remove_btn;
87
88public slots:
89 virtual void change_handler();
90
91 void transport_rec_cb();
92 void list_remove_cb();
93 void play_chord_cb();
94 void tuner_start_cb();
95 void tuner_simulation_cb();
96 void tuner_cb();
97 void audio_cb();
98
99 signals:
100 void frequency_change(int);
101
102protected:
103 QPixmap image_open;
104 QPixmap image6;
105 QTimer *simulation_timer;
106 QTimer *audio_timer;
107 int simulation_iter;
108 int simulation_v;
109 int simulation_x;
110 QHBoxLayout* Layout1;
111};
112
113#endif // POWERCHORDBASE_H
diff --git a/noncore/multimedia/powerchord/powerchordbase.ui b/noncore/multimedia/powerchord/powerchordbase.ui
new file mode 100644
index 0000000..01dae81
--- a/dev/null
+++ b/noncore/multimedia/powerchord/powerchordbase.ui
@@ -0,0 +1,1663 @@
1<!DOCTYPE UI><UI>
2<class>PowerchordBase</class>
3<widget>
4 <class>QWidget</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>PowerchordBase</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>240</width>
15 <height>284</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>sizePolicy</name>
20 <sizepolicy>
21 <hsizetype>5</hsizetype>
22 <vsizetype>5</vsizetype>
23 </sizepolicy>
24 </property>
25 <property stdset="1">
26 <name>minimumSize</name>
27 <size>
28 <width>240</width>
29 <height>284</height>
30 </size>
31 </property>
32 <property stdset="1">
33 <name>maximumSize</name>
34 <size>
35 <width>240</width>
36 <height>284</height>
37 </size>
38 </property>
39 <property stdset="1">
40 <name>caption</name>
41 <string>Powerchord</string>
42 </property>
43 <widget>
44 <class>QTabWidget</class>
45 <property stdset="1">
46 <name>name</name>
47 <cstring>tabs</cstring>
48 </property>
49 <property stdset="1">
50 <name>enabled</name>
51 <bool>true</bool>
52 </property>
53 <property stdset="1">
54 <name>geometry</name>
55 <rect>
56 <x>0</x>
57 <y>0</y>
58 <width>240</width>
59 <height>286</height>
60 </rect>
61 </property>
62 <property stdset="1">
63 <name>tabPosition</name>
64 <enum>Bottom</enum>
65 </property>
66 <widget>
67 <class>QWidget</class>
68 <property stdset="1">
69 <name>name</name>
70 <cstring>tab</cstring>
71 </property>
72 <attribute>
73 <name>title</name>
74 <string>Guitar</string>
75 </attribute>
76 <widget>
77 <class>QComboBox</class>
78 <item>
79 <property>
80 <name>text</name>
81 <string>maj</string>
82 </property>
83 </item>
84 <item>
85 <property>
86 <name>text</name>
87 <string>min</string>
88 </property>
89 </item>
90 <item>
91 <property>
92 <name>text</name>
93 <string>7th</string>
94 </property>
95 </item>
96 <item>
97 <property>
98 <name>text</name>
99 <string>m7</string>
100 </property>
101 </item>
102 <item>
103 <property>
104 <name>text</name>
105 <string>maj7</string>
106 </property>
107 </item>
108 <item>
109 <property>
110 <name>text</name>
111 <string>6th</string>
112 </property>
113 </item>
114 <item>
115 <property>
116 <name>text</name>
117 <string>m6th</string>
118 </property>
119 </item>
120 <item>
121 <property>
122 <name>text</name>
123 <string>aug</string>
124 </property>
125 </item>
126 <item>
127 <property>
128 <name>text</name>
129 <string>dim</string>
130 </property>
131 </item>
132 <item>
133 <property>
134 <name>text</name>
135 <string>sus4</string>
136 </property>
137 </item>
138 <item>
139 <property>
140 <name>text</name>
141 <string>7sus4</string>
142 </property>
143 </item>
144 <item>
145 <property>
146 <name>text</name>
147 <string>9th</string>
148 </property>
149 </item>
150 <item>
151 <property>
152 <name>text</name>
153 <string>add9</string>
154 </property>
155 </item>
156 <item>
157 <property>
158 <name>text</name>
159 <string>m9th</string>
160 </property>
161 </item>
162 <item>
163 <property>
164 <name>text</name>
165 <string>maj9</string>
166 </property>
167 </item>
168 <item>
169 <property>
170 <name>text</name>
171 <string>sus2</string>
172 </property>
173 </item>
174 <item>
175 <property>
176 <name>text</name>
177 <string>7sus2</string>
178 </property>
179 </item>
180 <item>
181 <property>
182 <name>text</name>
183 <string>11th</string>
184 </property>
185 </item>
186 <item>
187 <property>
188 <name>text</name>
189 <string>m11th</string>
190 </property>
191 </item>
192 <item>
193 <property>
194 <name>text</name>
195 <string>13th</string>
196 </property>
197 </item>
198 <item>
199 <property>
200 <name>text</name>
201 <string>m13th</string>
202 </property>
203 </item>
204 <item>
205 <property>
206 <name>text</name>
207 <string>maj13</string>
208 </property>
209 </item>
210 <item>
211 <property>
212 <name>text</name>
213 <string>6/9</string>
214 </property>
215 </item>
216 <item>
217 <property>
218 <name>text</name>
219 <string>flat5</string>
220 </property>
221 </item>
222 <item>
223 <property>
224 <name>text</name>
225 <string>7#9</string>
226 </property>
227 </item>
228 <item>
229 <property>
230 <name>text</name>
231 <string>ø7</string>
232 </property>
233 </item>
234 <item>
235 <property>
236 <name>text</name>
237 <string>5</string>
238 </property>
239 </item>
240 <property stdset="1">
241 <name>name</name>
242 <cstring>chordkey</cstring>
243 </property>
244 <property stdset="1">
245 <name>geometry</name>
246 <rect>
247 <x>40</x>
248 <y>0</y>
249 <width>51</width>
250 <height>21</height>
251 </rect>
252 </property>
253 </widget>
254 <widget>
255 <class>QComboBox</class>
256 <item>
257 <property>
258 <name>text</name>
259 <string>open</string>
260 </property>
261 </item>
262 <item>
263 <property>
264 <name>text</name>
265 <string>1st</string>
266 </property>
267 </item>
268 <item>
269 <property>
270 <name>text</name>
271 <string>2nd</string>
272 </property>
273 </item>
274 <item>
275 <property>
276 <name>text</name>
277 <string>3rd</string>
278 </property>
279 </item>
280 <item>
281 <property>
282 <name>text</name>
283 <string>4th</string>
284 </property>
285 </item>
286 <item>
287 <property>
288 <name>text</name>
289 <string>5th</string>
290 </property>
291 </item>
292 <item>
293 <property>
294 <name>text</name>
295 <string>6th</string>
296 </property>
297 </item>
298 <item>
299 <property>
300 <name>text</name>
301 <string>7th</string>
302 </property>
303 </item>
304 <item>
305 <property>
306 <name>text</name>
307 <string>8th</string>
308 </property>
309 </item>
310 <item>
311 <property>
312 <name>text</name>
313 <string>9th</string>
314 </property>
315 </item>
316 <item>
317 <property>
318 <name>text</name>
319 <string>10th</string>
320 </property>
321 </item>
322 <item>
323 <property>
324 <name>text</name>
325 <string>11th</string>
326 </property>
327 </item>
328 <item>
329 <property>
330 <name>text</name>
331 <string>12th</string>
332 </property>
333 </item>
334 <item>
335 <property>
336 <name>text</name>
337 <string>13th</string>
338 </property>
339 </item>
340 <item>
341 <property>
342 <name>text</name>
343 <string>14th</string>
344 </property>
345 </item>
346 <item>
347 <property>
348 <name>text</name>
349 <string>15th</string>
350 </property>
351 </item>
352 <item>
353 <property>
354 <name>text</name>
355 <string>16th</string>
356 </property>
357 </item>
358 <property stdset="1">
359 <name>name</name>
360 <cstring>chordfret</cstring>
361 </property>
362 <property stdset="1">
363 <name>geometry</name>
364 <rect>
365 <x>90</x>
366 <y>0</y>
367 <width>60</width>
368 <height>21</height>
369 </rect>
370 </property>
371 </widget>
372 <widget>
373 <class>QComboBox</class>
374 <item>
375 <property>
376 <name>text</name>
377 <string>C</string>
378 </property>
379 </item>
380 <item>
381 <property>
382 <name>text</name>
383 <string>C#</string>
384 </property>
385 </item>
386 <item>
387 <property>
388 <name>text</name>
389 <string>D</string>
390 </property>
391 </item>
392 <item>
393 <property>
394 <name>text</name>
395 <string>Eb</string>
396 </property>
397 </item>
398 <item>
399 <property>
400 <name>text</name>
401 <string>E</string>
402 </property>
403 </item>
404 <item>
405 <property>
406 <name>text</name>
407 <string>F</string>
408 </property>
409 </item>
410 <item>
411 <property>
412 <name>text</name>
413 <string>F#</string>
414 </property>
415 </item>
416 <item>
417 <property>
418 <name>text</name>
419 <string>G</string>
420 </property>
421 </item>
422 <item>
423 <property>
424 <name>text</name>
425 <string>G#</string>
426 </property>
427 </item>
428 <item>
429 <property>
430 <name>text</name>
431 <string>A</string>
432 </property>
433 </item>
434 <item>
435 <property>
436 <name>text</name>
437 <string>Bb</string>
438 </property>
439 </item>
440 <item>
441 <property>
442 <name>text</name>
443 <string>B</string>
444 </property>
445 </item>
446 <property stdset="1">
447 <name>name</name>
448 <cstring>chordnote</cstring>
449 </property>
450 <property stdset="1">
451 <name>geometry</name>
452 <rect>
453 <x>0</x>
454 <y>0</y>
455 <width>40</width>
456 <height>21</height>
457 </rect>
458 </property>
459 <property stdset="1">
460 <name>currentItem</name>
461 <number>9</number>
462 </property>
463 </widget>
464 <widget>
465 <class>QLayoutWidget</class>
466 <property stdset="1">
467 <name>name</name>
468 <cstring>Layout1</cstring>
469 </property>
470 <property stdset="1">
471 <name>geometry</name>
472 <rect>
473 <x>5</x>
474 <y>232</y>
475 <width>160</width>
476 <height>20</height>
477 </rect>
478 </property>
479 <hbox>
480 <property stdset="1">
481 <name>margin</name>
482 <number>0</number>
483 </property>
484 <property stdset="1">
485 <name>spacing</name>
486 <number>6</number>
487 </property>
488 <widget>
489 <class>QLabel</class>
490 <property stdset="1">
491 <name>name</name>
492 <cstring>s1_1</cstring>
493 </property>
494 <property stdset="1">
495 <name>text</name>
496 <string>E</string>
497 </property>
498 <property stdset="1">
499 <name>alignment</name>
500 <set>AlignCenter</set>
501 </property>
502 <property>
503 <name>hAlign</name>
504 </property>
505 </widget>
506 <widget>
507 <class>QLabel</class>
508 <property stdset="1">
509 <name>name</name>
510 <cstring>s1_2</cstring>
511 </property>
512 <property stdset="1">
513 <name>text</name>
514 <string>A</string>
515 </property>
516 <property stdset="1">
517 <name>alignment</name>
518 <set>AlignCenter</set>
519 </property>
520 <property>
521 <name>hAlign</name>
522 </property>
523 </widget>
524 <widget>
525 <class>QLabel</class>
526 <property stdset="1">
527 <name>name</name>
528 <cstring>s1_3</cstring>
529 </property>
530 <property stdset="1">
531 <name>text</name>
532 <string>E</string>
533 </property>
534 <property stdset="1">
535 <name>alignment</name>
536 <set>AlignCenter</set>
537 </property>
538 <property>
539 <name>hAlign</name>
540 </property>
541 </widget>
542 <widget>
543 <class>QLabel</class>
544 <property stdset="1">
545 <name>name</name>
546 <cstring>s1_4</cstring>
547 </property>
548 <property stdset="1">
549 <name>text</name>
550 <string>A</string>
551 </property>
552 <property stdset="1">
553 <name>alignment</name>
554 <set>AlignCenter</set>
555 </property>
556 <property>
557 <name>hAlign</name>
558 </property>
559 </widget>
560 <widget>
561 <class>QLabel</class>
562 <property stdset="1">
563 <name>name</name>
564 <cstring>s1_5</cstring>
565 </property>
566 <property stdset="1">
567 <name>text</name>
568 <string>C#</string>
569 </property>
570 <property stdset="1">
571 <name>alignment</name>
572 <set>AlignCenter</set>
573 </property>
574 <property>
575 <name>hAlign</name>
576 </property>
577 </widget>
578 <widget>
579 <class>QLabel</class>
580 <property stdset="1">
581 <name>name</name>
582 <cstring>s1_6</cstring>
583 </property>
584 <property stdset="1">
585 <name>text</name>
586 <string>E</string>
587 </property>
588 <property stdset="1">
589 <name>alignment</name>
590 <set>AlignCenter</set>
591 </property>
592 <property>
593 <name>hAlign</name>
594 </property>
595 </widget>
596 </hbox>
597 </widget>
598 <widget>
599 <class>QLabel</class>
600 <property stdset="1">
601 <name>name</name>
602 <cstring>sound_label</cstring>
603 </property>
604 <property stdset="1">
605 <name>geometry</name>
606 <rect>
607 <x>185</x>
608 <y>160</y>
609 <width>32</width>
610 <height>17</height>
611 </rect>
612 </property>
613 <property stdset="1">
614 <name>sizePolicy</name>
615 <sizepolicy>
616 <hsizetype>0</hsizetype>
617 <vsizetype>0</vsizetype>
618 </sizepolicy>
619 </property>
620 <property stdset="1">
621 <name>pixmap</name>
622 <pixmap>image0</pixmap>
623 </property>
624 <property stdset="1">
625 <name>scaledContents</name>
626 <bool>true</bool>
627 </property>
628 </widget>
629 <widget>
630 <class>QFrame</class>
631 <property stdset="1">
632 <name>name</name>
633 <cstring>Frame6</cstring>
634 </property>
635 <property stdset="1">
636 <name>geometry</name>
637 <rect>
638 <x>170</x>
639 <y>145</y>
640 <width>66</width>
641 <height>10</height>
642 </rect>
643 </property>
644 <property stdset="1">
645 <name>frameShape</name>
646 <enum>HLine</enum>
647 </property>
648 <property stdset="1">
649 <name>frameShadow</name>
650 <enum>Raised</enum>
651 </property>
652 </widget>
653 <widget>
654 <class>QLabel</class>
655 <property stdset="1">
656 <name>name</name>
657 <cstring>chordshow_label</cstring>
658 </property>
659 <property stdset="1">
660 <name>geometry</name>
661 <rect>
662 <x>185</x>
663 <y>60</y>
664 <width>32</width>
665 <height>17</height>
666 </rect>
667 </property>
668 <property stdset="1">
669 <name>sizePolicy</name>
670 <sizepolicy>
671 <hsizetype>0</hsizetype>
672 <vsizetype>0</vsizetype>
673 </sizepolicy>
674 </property>
675 <property stdset="1">
676 <name>pixmap</name>
677 <pixmap>image1</pixmap>
678 </property>
679 <property stdset="1">
680 <name>scaledContents</name>
681 <bool>true</bool>
682 </property>
683 </widget>
684 <widget>
685 <class>QPushButton</class>
686 <property stdset="1">
687 <name>name</name>
688 <cstring>transport_rec</cstring>
689 </property>
690 <property stdset="1">
691 <name>geometry</name>
692 <rect>
693 <x>170</x>
694 <y>80</y>
695 <width>30</width>
696 <height>30</height>
697 </rect>
698 </property>
699 <property stdset="1">
700 <name>text</name>
701 <string></string>
702 </property>
703 <property stdset="1">
704 <name>pixmap</name>
705 <pixmap>image2</pixmap>
706 </property>
707 </widget>
708 <widget>
709 <class>QPushButton</class>
710 <property stdset="1">
711 <name>name</name>
712 <cstring>play_sound</cstring>
713 </property>
714 <property stdset="1">
715 <name>geometry</name>
716 <rect>
717 <x>170</x>
718 <y>180</y>
719 <width>60</width>
720 <height>55</height>
721 </rect>
722 </property>
723 <property stdset="1">
724 <name>text</name>
725 <string></string>
726 </property>
727 <property stdset="1">
728 <name>pixmap</name>
729 <pixmap>image3</pixmap>
730 </property>
731 </widget>
732 <widget>
733 <class>QFrame</class>
734 <property stdset="1">
735 <name>name</name>
736 <cstring>Frame6_2</cstring>
737 </property>
738 <property stdset="1">
739 <name>geometry</name>
740 <rect>
741 <x>170</x>
742 <y>45</y>
743 <width>66</width>
744 <height>10</height>
745 </rect>
746 </property>
747 <property stdset="1">
748 <name>frameShape</name>
749 <enum>HLine</enum>
750 </property>
751 <property stdset="1">
752 <name>frameShadow</name>
753 <enum>Raised</enum>
754 </property>
755 </widget>
756 <widget>
757 <class>QPushButton</class>
758 <property stdset="1">
759 <name>name</name>
760 <cstring>transport_play</cstring>
761 </property>
762 <property stdset="1">
763 <name>enabled</name>
764 <bool>false</bool>
765 </property>
766 <property stdset="1">
767 <name>geometry</name>
768 <rect>
769 <x>200</x>
770 <y>80</y>
771 <width>30</width>
772 <height>30</height>
773 </rect>
774 </property>
775 <property stdset="1">
776 <name>text</name>
777 <string></string>
778 </property>
779 <property stdset="1">
780 <name>pixmap</name>
781 <pixmap>image3</pixmap>
782 </property>
783 </widget>
784 <widget>
785 <class>QPushButton</class>
786 <property stdset="1">
787 <name>name</name>
788 <cstring>transport_rew</cstring>
789 </property>
790 <property stdset="1">
791 <name>enabled</name>
792 <bool>false</bool>
793 </property>
794 <property stdset="1">
795 <name>geometry</name>
796 <rect>
797 <x>170</x>
798 <y>110</y>
799 <width>30</width>
800 <height>30</height>
801 </rect>
802 </property>
803 <property stdset="1">
804 <name>text</name>
805 <string></string>
806 </property>
807 <property stdset="1">
808 <name>pixmap</name>
809 <pixmap>image4</pixmap>
810 </property>
811 </widget>
812 <widget>
813 <class>QPushButton</class>
814 <property stdset="1">
815 <name>name</name>
816 <cstring>transport_fwd</cstring>
817 </property>
818 <property stdset="1">
819 <name>enabled</name>
820 <bool>false</bool>
821 </property>
822 <property stdset="1">
823 <name>geometry</name>
824 <rect>
825 <x>200</x>
826 <y>110</y>
827 <width>30</width>
828 <height>30</height>
829 </rect>
830 </property>
831 <property stdset="1">
832 <name>text</name>
833 <string></string>
834 </property>
835 <property stdset="1">
836 <name>pixmap</name>
837 <pixmap>image5</pixmap>
838 </property>
839 </widget>
840 <widget>
841 <class>QLabel</class>
842 <property stdset="1">
843 <name>name</name>
844 <cstring>chordname</cstring>
845 </property>
846 <property stdset="1">
847 <name>geometry</name>
848 <rect>
849 <x>151</x>
850 <y>0</y>
851 <width>85</width>
852 <height>20</height>
853 </rect>
854 </property>
855 <property stdset="1">
856 <name>text</name>
857 <string>A</string>
858 </property>
859 <property stdset="1">
860 <name>alignment</name>
861 <set>AlignCenter</set>
862 </property>
863 <property>
864 <name>hAlign</name>
865 </property>
866 <property>
867 <name>toolTip</name>
868 <string></string>
869 </property>
870 </widget>
871 <widget>
872 <class>FretBoard</class>
873 <property stdset="1">
874 <name>name</name>
875 <cstring>frets</cstring>
876 </property>
877 <property stdset="1">
878 <name>geometry</name>
879 <rect>
880 <x>0</x>
881 <y>20</y>
882 <width>168</width>
883 <height>210</height>
884 </rect>
885 </property>
886 </widget>
887 </widget>
888 <widget>
889 <class>QWidget</class>
890 <property stdset="1">
891 <name>name</name>
892 <cstring>tab</cstring>
893 </property>
894 <attribute>
895 <name>title</name>
896 <string>Options</string>
897 </attribute>
898 <widget>
899 <class>QLabel</class>
900 <property stdset="1">
901 <name>name</name>
902 <cstring>optlab2</cstring>
903 </property>
904 <property stdset="1">
905 <name>geometry</name>
906 <rect>
907 <x>9</x>
908 <y>58</y>
909 <width>120</width>
910 <height>41</height>
911 </rect>
912 </property>
913 <property stdset="1">
914 <name>text</name>
915 <string>Alternative tunings are possible</string>
916 </property>
917 <property stdset="1">
918 <name>alignment</name>
919 <set>WordBreak|AlignVCenter|AlignLeft</set>
920 </property>
921 <property>
922 <name>wordwrap</name>
923 </property>
924 </widget>
925 <widget>
926 <class>QComboBox</class>
927 <item>
928 <property>
929 <name>text</name>
930 <string>2</string>
931 </property>
932 </item>
933 <item>
934 <property>
935 <name>text</name>
936 <string>3</string>
937 </property>
938 </item>
939 <item>
940 <property>
941 <name>text</name>
942 <string>4</string>
943 </property>
944 </item>
945 <item>
946 <property>
947 <name>text</name>
948 <string>5</string>
949 </property>
950 </item>
951 <item>
952 <property>
953 <name>text</name>
954 <string>6</string>
955 </property>
956 </item>
957 <property stdset="1">
958 <name>name</name>
959 <cstring>span</cstring>
960 </property>
961 <property stdset="1">
962 <name>geometry</name>
963 <rect>
964 <x>180</x>
965 <y>20</y>
966 <width>50</width>
967 <height>21</height>
968 </rect>
969 </property>
970 <property stdset="1">
971 <name>currentItem</name>
972 <number>1</number>
973 </property>
974 </widget>
975 <widget>
976 <class>QLabel</class>
977 <property stdset="1">
978 <name>name</name>
979 <cstring>TextLabel1</cstring>
980 </property>
981 <property stdset="1">
982 <name>geometry</name>
983 <rect>
984 <x>3</x>
985 <y>109</y>
986 <width>226</width>
987 <height>140</height>
988 </rect>
989 </property>
990 <property stdset="1">
991 <name>text</name>
992 <string>©2002 Camilo Mesias
993camilo@mesias.co.uk
994Version 0.0 beta</string>
995 </property>
996 <property stdset="1">
997 <name>alignment</name>
998 <set>AlignBottom|AlignLeft</set>
999 </property>
1000 <property>
1001 <name>vAlign</name>
1002 </property>
1003 </widget>
1004 <widget>
1005 <class>QComboBox</class>
1006 <item>
1007 <property>
1008 <name>text</name>
1009 <string>EADGBE</string>
1010 </property>
1011 </item>
1012 <item>
1013 <property>
1014 <name>text</name>
1015 <string>EBEG#BE</string>
1016 </property>
1017 </item>
1018 <item>
1019 <property>
1020 <name>text</name>
1021 <string>EAEAC#E</string>
1022 </property>
1023 </item>
1024 <item>
1025 <property>
1026 <name>text</name>
1027 <string>EADF#BE</string>
1028 </property>
1029 </item>
1030 <item>
1031 <property>
1032 <name>text</name>
1033 <string>EADGCF</string>
1034 </property>
1035 </item>
1036 <item>
1037 <property>
1038 <name>text</name>
1039 <string>DADGAD</string>
1040 </property>
1041 </item>
1042 <item>
1043 <property>
1044 <name>text</name>
1045 <string>DGCGCD</string>
1046 </property>
1047 </item>
1048 <item>
1049 <property>
1050 <name>text</name>
1051 <string>DADF#AD</string>
1052 </property>
1053 </item>
1054 <item>
1055 <property>
1056 <name>text</name>
1057 <string>DADGBE</string>
1058 </property>
1059 </item>
1060 <item>
1061 <property>
1062 <name>text</name>
1063 <string>DGDGBD</string>
1064 </property>
1065 </item>
1066 <item>
1067 <property>
1068 <name>text</name>
1069 <string>DADACD</string>
1070 </property>
1071 </item>
1072 <item>
1073 <property>
1074 <name>text</name>
1075 <string>CGCGAE</string>
1076 </property>
1077 </item>
1078 <item>
1079 <property>
1080 <name>text</name>
1081 <string>FADGBE</string>
1082 </property>
1083 </item>
1084 <item>
1085 <property>
1086 <name>text</name>
1087 <string>G minor</string>
1088 </property>
1089 </item>
1090 <property stdset="1">
1091 <name>name</name>
1092 <cstring>tuning</cstring>
1093 </property>
1094 <property stdset="1">
1095 <name>geometry</name>
1096 <rect>
1097 <x>140</x>
1098 <y>70</y>
1099 <width>91</width>
1100 <height>21</height>
1101 </rect>
1102 </property>
1103 </widget>
1104 <widget>
1105 <class>QLabel</class>
1106 <property stdset="1">
1107 <name>name</name>
1108 <cstring>optlab1</cstring>
1109 </property>
1110 <property stdset="1">
1111 <name>geometry</name>
1112 <rect>
1113 <x>8</x>
1114 <y>8</y>
1115 <width>160</width>
1116 <height>40</height>
1117 </rect>
1118 </property>
1119 <property stdset="1">
1120 <name>text</name>
1121 <string>Span: the greatest number of frets over which you want chords to be generated</string>
1122 </property>
1123 <property stdset="1">
1124 <name>alignment</name>
1125 <set>WordBreak|AlignVCenter|AlignLeft</set>
1126 </property>
1127 <property>
1128 <name>wordwrap</name>
1129 </property>
1130 </widget>
1131 </widget>
1132 <widget>
1133 <class>QWidget</class>
1134 <property stdset="1">
1135 <name>name</name>
1136 <cstring>Tuner</cstring>
1137 </property>
1138 <attribute>
1139 <name>title</name>
1140 <string>Tuner</string>
1141 </attribute>
1142 <widget>
1143 <class>QFrame</class>
1144 <property stdset="1">
1145 <name>name</name>
1146 <cstring>Frame4</cstring>
1147 </property>
1148 <property stdset="1">
1149 <name>geometry</name>
1150 <rect>
1151 <x>0</x>
1152 <y>0</y>
1153 <width>230</width>
1154 <height>126</height>
1155 </rect>
1156 </property>
1157 <property stdset="1">
1158 <name>frameShape</name>
1159 <enum>Box</enum>
1160 </property>
1161 <property stdset="1">
1162 <name>frameShadow</name>
1163 <enum>Raised</enum>
1164 </property>
1165 <widget>
1166 <class>VUMeter</class>
1167 <property stdset="1">
1168 <name>name</name>
1169 <cstring>vu</cstring>
1170 </property>
1171 <property stdset="1">
1172 <name>geometry</name>
1173 <rect>
1174 <x>5</x>
1175 <y>5</y>
1176 <width>220</width>
1177 <height>115</height>
1178 </rect>
1179 </property>
1180 </widget>
1181 </widget>
1182 <widget>
1183 <class>QComboBox</class>
1184 <item>
1185 <property>
1186 <name>text</name>
1187 <string>auto</string>
1188 </property>
1189 </item>
1190 <item>
1191 <property>
1192 <name>text</name>
1193 <string>E</string>
1194 </property>
1195 </item>
1196 <item>
1197 <property>
1198 <name>text</name>
1199 <string>D</string>
1200 </property>
1201 </item>
1202 <item>
1203 <property>
1204 <name>text</name>
1205 <string>G</string>
1206 </property>
1207 </item>
1208 <item>
1209 <property>
1210 <name>text</name>
1211 <string>A</string>
1212 </property>
1213 </item>
1214 <item>
1215 <property>
1216 <name>text</name>
1217 <string>B</string>
1218 </property>
1219 </item>
1220 <item>
1221 <property>
1222 <name>text</name>
1223 <string>C</string>
1224 </property>
1225 </item>
1226 <item>
1227 <property>
1228 <name>text</name>
1229 <string>F</string>
1230 </property>
1231 </item>
1232 <property stdset="1">
1233 <name>name</name>
1234 <cstring>tuner_note</cstring>
1235 </property>
1236 <property stdset="1">
1237 <name>geometry</name>
1238 <rect>
1239 <x>5</x>
1240 <y>160</y>
1241 <width>90</width>
1242 <height>20</height>
1243 </rect>
1244 </property>
1245 </widget>
1246 <widget>
1247 <class>QFrame</class>
1248 <property stdset="1">
1249 <name>name</name>
1250 <cstring>Frame8</cstring>
1251 </property>
1252 <property stdset="1">
1253 <name>geometry</name>
1254 <rect>
1255 <x>-2</x>
1256 <y>188</y>
1257 <width>231</width>
1258 <height>10</height>
1259 </rect>
1260 </property>
1261 <property stdset="1">
1262 <name>frameShape</name>
1263 <enum>HLine</enum>
1264 </property>
1265 <property stdset="1">
1266 <name>frameShadow</name>
1267 <enum>Raised</enum>
1268 </property>
1269 </widget>
1270 <widget>
1271 <class>QPushButton</class>
1272 <property stdset="1">
1273 <name>name</name>
1274 <cstring>tuner_start</cstring>
1275 </property>
1276 <property stdset="1">
1277 <name>geometry</name>
1278 <rect>
1279 <x>100</x>
1280 <y>155</y>
1281 <width>91</width>
1282 <height>30</height>
1283 </rect>
1284 </property>
1285 <property stdset="1">
1286 <name>text</name>
1287 <string>Start</string>
1288 </property>
1289 </widget>
1290 <widget>
1291 <class>QLabel</class>
1292 <property stdset="1">
1293 <name>name</name>
1294 <cstring>tuner_lab1</cstring>
1295 </property>
1296 <property stdset="1">
1297 <name>geometry</name>
1298 <rect>
1299 <x>10</x>
1300 <y>130</y>
1301 <width>100</width>
1302 <height>21</height>
1303 </rect>
1304 </property>
1305 <property stdset="1">
1306 <name>text</name>
1307 <string>Tuner operation</string>
1308 </property>
1309 </widget>
1310 <widget>
1311 <class>QLabel</class>
1312 <property stdset="1">
1313 <name>name</name>
1314 <cstring>tuner_lab2</cstring>
1315 </property>
1316 <property stdset="1">
1317 <name>geometry</name>
1318 <rect>
1319 <x>10</x>
1320 <y>200</y>
1321 <width>100</width>
1322 <height>16</height>
1323 </rect>
1324 </property>
1325 <property stdset="1">
1326 <name>text</name>
1327 <string>Pitch calibration</string>
1328 </property>
1329 </widget>
1330 <widget>
1331 <class>QComboBox</class>
1332 <item>
1333 <property>
1334 <name>text</name>
1335 <string>A</string>
1336 </property>
1337 </item>
1338 <item>
1339 <property>
1340 <name>text</name>
1341 <string>C</string>
1342 </property>
1343 </item>
1344 <property stdset="1">
1345 <name>name</name>
1346 <cstring>tuner_calib_note</cstring>
1347 </property>
1348 <property stdset="1">
1349 <name>geometry</name>
1350 <rect>
1351 <x>5</x>
1352 <y>225</y>
1353 <width>90</width>
1354 <height>21</height>
1355 </rect>
1356 </property>
1357 </widget>
1358 <widget>
1359 <class>QSpinBox</class>
1360 <property stdset="1">
1361 <name>name</name>
1362 <cstring>tuner_calib_freq</cstring>
1363 </property>
1364 <property stdset="1">
1365 <name>geometry</name>
1366 <rect>
1367 <x>105</x>
1368 <y>225</y>
1369 <width>71</width>
1370 <height>21</height>
1371 </rect>
1372 </property>
1373 <property stdset="1">
1374 <name>suffix</name>
1375 <string>Hz</string>
1376 </property>
1377 <property stdset="1">
1378 <name>wrapping</name>
1379 <bool>true</bool>
1380 </property>
1381 <property stdset="1">
1382 <name>maxValue</name>
1383 <number>500</number>
1384 </property>
1385 <property stdset="1">
1386 <name>minValue</name>
1387 <number>300</number>
1388 </property>
1389 <property stdset="1">
1390 <name>value</name>
1391 <number>440</number>
1392 </property>
1393 </widget>
1394 <widget>
1395 <class>QLabel</class>
1396 <property stdset="1">
1397 <name>name</name>
1398 <cstring>tuner_lab3</cstring>
1399 </property>
1400 <property stdset="1">
1401 <name>geometry</name>
1402 <rect>
1403 <x>185</x>
1404 <y>225</y>
1405 <width>40</width>
1406 <height>21</height>
1407 </rect>
1408 </property>
1409 <property stdset="1">
1410 <name>text</name>
1411 <string>Pitch</string>
1412 </property>
1413 </widget>
1414 <widget>
1415 <class>QLabel</class>
1416 <property stdset="1">
1417 <name>name</name>
1418 <cstring>tuner_pic1</cstring>
1419 </property>
1420 <property stdset="1">
1421 <name>geometry</name>
1422 <rect>
1423 <x>195</x>
1424 <y>155</y>
1425 <width>31</width>
1426 <height>31</height>
1427 </rect>
1428 </property>
1429 <property stdset="1">
1430 <name>frameShape</name>
1431 <enum>NoFrame</enum>
1432 </property>
1433 <property stdset="1">
1434 <name>pixmap</name>
1435 <pixmap>image6</pixmap>
1436 </property>
1437 <property stdset="1">
1438 <name>scaledContents</name>
1439 <bool>true</bool>
1440 </property>
1441 </widget>
1442 </widget>
1443 <widget>
1444 <class>QWidget</class>
1445 <property stdset="1">
1446 <name>name</name>
1447 <cstring>tab</cstring>
1448 </property>
1449 <attribute>
1450 <name>title</name>
1451 <string>Chords</string>
1452 </attribute>
1453 <widget>
1454 <class>QLabel</class>
1455 <property stdset="1">
1456 <name>name</name>
1457 <cstring>chordlistlab1</cstring>
1458 </property>
1459 <property stdset="1">
1460 <name>geometry</name>
1461 <rect>
1462 <x>5</x>
1463 <y>5</y>
1464 <width>216</width>
1465 <height>16</height>
1466 </rect>
1467 </property>
1468 <property stdset="1">
1469 <name>text</name>
1470 <string>Chord list</string>
1471 </property>
1472 </widget>
1473 <widget>
1474 <class>QListBox</class>
1475 <property stdset="1">
1476 <name>name</name>
1477 <cstring>chordlist</cstring>
1478 </property>
1479 <property stdset="1">
1480 <name>geometry</name>
1481 <rect>
1482 <x>5</x>
1483 <y>25</y>
1484 <width>220</width>
1485 <height>200</height>
1486 </rect>
1487 </property>
1488 </widget>
1489 <widget>
1490 <class>QPushButton</class>
1491 <property stdset="1">
1492 <name>name</name>
1493 <cstring>list_remove_btn</cstring>
1494 </property>
1495 <property stdset="1">
1496 <name>geometry</name>
1497 <rect>
1498 <x>150</x>
1499 <y>230</y>
1500 <width>71</width>
1501 <height>25</height>
1502 </rect>
1503 </property>
1504 <property stdset="1">
1505 <name>text</name>
1506 <string>Remove</string>
1507 </property>
1508 </widget>
1509 </widget>
1510 </widget>
1511</widget>
1512<customwidgets>
1513 <customwidget>
1514 <class>FretBoard</class>
1515 <header location="global">/src/ZAURUS/powerchord/fretboard.h</header>
1516 <sizehint>
1517 <width>-1</width>
1518 <height>-1</height>
1519 </sizehint>
1520 <container>0</container>
1521 <sizepolicy>
1522 <hordata>5</hordata>
1523 <verdata>5</verdata>
1524 </sizepolicy>
1525 <pixmap>image7</pixmap>
1526 <signal>Finger(int finger)</signal>
1527 <signal>s1nameChanged(const QString &amp;)</signal>
1528 <signal>s2nameChanged(const QString &amp;)</signal>
1529 <signal>s3nameChanged(const QString &amp;)</signal>
1530 <signal>s4nameChanged(const QString &amp;)</signal>
1531 <signal>s5nameChanged(const QString &amp;)</signal>
1532 <signal>s6nameChanged(const QString &amp;)</signal>
1533 <signal>nameChanged(const QString &amp;)</signal>
1534 <slot access="public">Finger()</slot>
1535 <slot access="public">Base(int)</slot>
1536 <slot access="public">Chord(int)</slot>
1537 <slot access="public">Fret(int)</slot>
1538 <slot access="public">Span(int)</slot>
1539 <slot access="public">Tune(int)</slot>
1540 <slot access="public">Vary(int)</slot>
1541 </customwidget>
1542 <customwidget>
1543 <class>VUMeter</class>
1544 <header location="global">/src/ZAURUS/powerchord/vumeter.h</header>
1545 <sizehint>
1546 <width>-1</width>
1547 <height>-1</height>
1548 </sizehint>
1549 <container>0</container>
1550 <sizepolicy>
1551 <hordata>5</hordata>
1552 <verdata>5</verdata>
1553 </sizepolicy>
1554 <pixmap>image7</pixmap>
1555 <slot access="public">Value(int)</slot>
1556 <slot access="public">AnnotL(QString)</slot>
1557 <slot access="public">AnnotR(QString)</slot>
1558 </customwidget>
1559</customwidgets>
1560<images>
1561 <image>
1562 <name>image0</name>
1563 <data format="XPM.GZ" length="1305">789c8dd25b6f9b301407f0f77c0a14dea28906b003d6b4875e935e92e6b1d2b407df0894109a4068d369df7d9c636725692acd48e8fcf0df06db9c0d9ca7f9d4199cf5aa9ad7997464ca37ce406d8b62f7f3d78fdfbd7e18387ee410e2f8fd6fbdbee7486756ae34d4aa53f34efdd0a965a776dbda1d62035e5b12436d1927097007f463b880153018c2053c47b2200e18b0b094864b60e88724c46fde20594bec5d594ac32b20f1c990603845724208072e2c63c3374b697803a40191340066867468b845724a2986134b66d800470155230caf0d47be6169490d9f91bc258ebdb46486ef96cab0064661e44721708614118d04505832c33b4b65f8088cc348c5387662d81e0232478a98c5187e0132122b46801786cc371c2325634c02a7404eb8cfb1f7152939e5d87b6fc90de740414420307c8b54622414fe84fbe61eb47f8f31c36d7345a7b9dc93b29351ea64a63b4f1bd1babd7d9a079eca7d0623fa30a33d8521ccd869f471469bb136630999649166cf39be6b1f3ac8682116cb62b9caca17a15d753aa3d79baa2eb74d53bf224f66de8addfba2384fea8baf33e9a6babcaaae9b3aff32239ad5727d5314a5181f7d8ff7b1ae3c4bd3346beac9edd1babcfd44edda274dd294f5ddfdf1feb4e705f503eee1349f3d8ee79ff619cefde4797918f1feebfff9f3bdf7170eba56b0</data>
1564 </image>
1565 <image>
1566 <name>image1</name>
1567 <data format="XPM.GZ" length="746">789c8d92cf0ac2300cc6ef7b8ab0dc864caba003f111148f8278485b871e54f0cf41c4777749a3769b8a8141bfe4c79774693783c57c0a5937399de9bc75e0367484cc5f76bbeb7235b925e9a00f660443306927497370303becd77cc6ea8c3d0996566551962c1d4b531019a97a96fd1ead4dc192589612621b07d6835311a3598aa3c5842c7ff5a833ead3f06a30ea23356bff6102f59351ea23639f4ce8f79dd1464f467e95dce8ddcb3619e73147efb0c5bce7a9ca1e2bd06134b322914f057986e27bd519290ba87ba01744910f8686f4da5963173c6e1e06d76c7ba77af7cf8f87dfc67d9c3c003050bd05</data>
1568 </image>
1569 <image>
1570 <name>image2</name>
1571 <data format="XPM.GZ" length="524">789c7d90cb0ac2301045f7fd8ad0ec8aa48da808e227282e057191c9a30fa882d68588ff6e264deab89166a6e7a6873c5a16ec78d8b1a2ccee831a5acd74a36eac308fbe7f9ecedb5796cb15c33167329f653930cdf6d78b45ae091bc21d6145981316843561eb999ba5ac6485d1c5b818633bc535c626449ba2e042d10afb03f8e03bf82e40070f306203ee59470fc058675d8d34798d6d2d167cbd60453379d1f2f5f55cf22cf1d27acd7faf4eeb75e47cc9a3e71bcd0e80de237c00bc75f2f08fe0947f474ffc3ef97b937d00c5a693bc</data>
1572 </image>
1573 <image>
1574 <name>image3</name>
1575 <data format="XPM.GZ" length="430">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022530543251d2ea544856405bffcbc54105b1989ad87c44e46622701d9ca06600056a6ac97888cc1462625013970980c569704040895c950752080a90e04202a91d5c1d4a2aa83988bae0e0430d541c550d4619a87ee3e980b91d5c17c825087e95fe49081a8d343854ab5d65c00c02d7422</data>
1576 </image>
1577 <image>
1578 <name>image4</name>
1579 <data format="XPM.GZ" length="442">789c6d903d0a02311085fb9c6248ba4566b5b1118fa0580a6231792b68a182ae858877773291dd2c64924c5e3e5e263f6d43fbdd869ad63d7be92f209ce5414df7ba5edf87e3fae3fc6249da35f999f39140dbfbed94b4143a149a0bdd155a6b53985b982db094c34ac6a80b418c9a199df9a28640590c8ccc2431184bd3e04366c0e84366c0e8436618996012d9576152d9cb9533a47217aedcd9dec1c6f4d5832ffd88b2f42b7f1f4f9bffaedc0f5a767fcf</data>
1580 </image>
1581 <image>
1582 <name>image5</name>
1583 <data format="XPM.GZ" length="442">789c6d8fc10ac2300c86ef7d8ad2de8a647af1223e82e251100f692ae8610a3a0f22bebb49bab90cecb6fe7ffe7d5b9326f9fd6ee353e31e1d7617f274c6bb4fe5d9b6afc371fd7661b1f47cf316662ef07bbfbd5d4fe2d1f8683c185f8ccfece35c976211d03efacb4c5c2064921d8b723913979145c852390909440ca7a14a1c3909ab188eab5e0cf75b969b64f8e75b989c61ce1d7a31fd71a4adc3d81fc9c4b9cedd733a67546a9817a657f8acdc17f87f7bda</data>
1584 </image>
1585 <image>
1586 <name>image6</name>
1587 <data format="XPM.GZ" length="1760">789c9593dd739a4010c0dffd2b1879733a1710509c4e1fa2e683f8111f3bd3e903701048505130c464fabf97ddbd9343d34e7be8b83fdcfdb177c75df5b4efab85d6bbea14a55fa6a11626fe5eebf1c37a7dfcf1f3db47a76b995afdb16dcdec7ee974a75aa82db79b08e28512df2971a5c49e122f9578aec4a912174a3c5162a6c4511deb060ec031a06ddab68d1d1e107dc3355cc09dc090704d5827fb80994097f019d0f1a58a030eada139b4004b810ee11131300d13db7825b45c6b049813d6c901e00da06b0d46037cd03be0c8365d13bb7a2374460efe1b0206b619f6d11c23722b24f383446a7246681b84d780a1d337a8768fc825de0ab4fba8da0a7409ef01b9d30f095f245a680e1023a9d205da84ab1362ad0f180d243e113a86d3077c448c069c56720318c7d1201a0026843070ebff3efe3f45f7e5f587143df083e6fb494a63689b9a14511bf28847b170b553a8ee29e27831c52353c8c112cae070477a648aa849a445dcd19b1472b0c69236f3922975450243589e5f9a59510ae6273c5b2734365b70a4e4a6147c6a9233c62318bb3dd417e2beb040ef493d8f12320ed8c7ab986763a95bcdab0a2c3bece12d13abd5f4c2a4e5888eb45ce35aa8bd30d1cb3b38f605e3e7165d588a181cd769ed1b8bbd5767c4f26ca293635ac7156bcf08d796dfdc521fd369c9b33bb14f8ac567937bfc2da63ce7995789dd57f7a8c0357ee0252fc798c12ef608af191832e6cdabd3eeb7df97c05f8063e92d17e4b8785f74df9b531fd5e5fb226af447e8a4be32710edaaf3755ade2bcf6ccf493a37548d433d438ce8fda27a7e8fcc07a9767f1df8efdafaf9ddf36a4a563</data>
1588 </image>
1589 <image>
1590 <name>image7</name>
1591 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
1592 </image>
1593</images>
1594<connections>
1595 <connection>
1596 <sender>chordnote</sender>
1597 <signal>activated(int)</signal>
1598 <receiver>frets</receiver>
1599 <slot>Base(int)</slot>
1600 </connection>
1601 <connection>
1602 <sender>chordkey</sender>
1603 <signal>activated(int)</signal>
1604 <receiver>frets</receiver>
1605 <slot>Chord(int)</slot>
1606 </connection>
1607 <connection>
1608 <sender>chordfret</sender>
1609 <signal>activated(int)</signal>
1610 <receiver>frets</receiver>
1611 <slot>Fret(int)</slot>
1612 </connection>
1613 <connection>
1614 <sender>list_remove_btn</sender>
1615 <signal>clicked()</signal>
1616 <receiver>chordlist</receiver>
1617 <slot>clearSelection()</slot>
1618 </connection>
1619 <connection>
1620 <sender>frets</sender>
1621 <signal>s1nameChanged(const QString &amp;)</signal>
1622 <receiver>s1_1</receiver>
1623 <slot>setText(const QString&amp;)</slot>
1624 </connection>
1625 <connection>
1626 <sender>frets</sender>
1627 <signal>s2nameChanged(const QString &amp;)</signal>
1628 <receiver>s1_2</receiver>
1629 <slot>setText(const QString&amp;)</slot>
1630 </connection>
1631 <connection>
1632 <sender>frets</sender>
1633 <signal>s3nameChanged(const QString &amp;)</signal>
1634 <receiver>s1_3</receiver>
1635 <slot>setText(const QString&amp;)</slot>
1636 </connection>
1637 <connection>
1638 <sender>frets</sender>
1639 <signal>s4nameChanged(const QString &amp;)</signal>
1640 <receiver>s1_4</receiver>
1641 <slot>setText(const QString&amp;)</slot>
1642 </connection>
1643 <connection>
1644 <sender>frets</sender>
1645 <signal>s5nameChanged(const QString &amp;)</signal>
1646 <receiver>s1_5</receiver>
1647 <slot>setText(const QString&amp;)</slot>
1648 </connection>
1649 <connection>
1650 <sender>frets</sender>
1651 <signal>s6nameChanged(const QString &amp;)</signal>
1652 <receiver>s1_6</receiver>
1653 <slot>setText(const QString&amp;)</slot>
1654 </connection>
1655 <connection>
1656 <sender>frets</sender>
1657 <signal>nameChanged(const QString &amp;)</signal>
1658 <receiver>chordname</receiver>
1659 <slot>setText(const QString&amp;)</slot>
1660 </connection>
1661 <slot access="public">change_handler()</slot>
1662</connections>
1663</UI>
diff --git a/noncore/multimedia/powerchord/vumeter.cpp b/noncore/multimedia/powerchord/vumeter.cpp
new file mode 100644
index 0000000..0c17435
--- a/dev/null
+++ b/noncore/multimedia/powerchord/vumeter.cpp
@@ -0,0 +1,105 @@
1//
2// VUMeter class
3//
4
5// Copyright (c) 2001 Camilo Mesias
6// camilo@mesias.co.uk
7//
8// This program is free software; you can redistribute it and/or
9// modify it under the terms of the GNU General Public License
10// as published by the Free Software Foundation; either version 2
11// of the License, or (at your option) any later version.
12//
13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17//
18// You should have received a copy of the GNU General Public License
19// along with this program; if not, write to the Free Software
20// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21
22#include <stdio.h>
23#include "vumeter.h"
24#include <qpainter.h>
25
26#include <math.h>
27
28VUMeter::VUMeter(QWidget *parent, const char *name )
29 : QWidget( parent, name ), Lannot("A"), Rannot("440 Hz")
30{
31 // setPalette( QPalette( QColor( 250, 250, 200) ) );
32
33 vuvalue = 0;
34
35 pix = 0;
36
37
38}
39
40VUMeter::~VUMeter()
41{
42 delete(pix);
43}
44
45void VUMeter::paintEvent(QPaintEvent *){
46
47 vupdate();
48}
49
50void VUMeter::bupdate(){
51
52 if (!pix){
53 pix = new QPixmap(rect().size());
54 }
55 // redraw whole background to buffer
56
57 pix->fill(this, 0, 0);
58
59 QPainter p( pix );
60
61 p.setBrush(white);
62 p.setPen(NoPen);
63
64 p.drawRect( QRect(0, 0, width(), height()) );
65
66 p.translate(width()/2, 0);
67
68 p.setBrush(black);
69 p.setPen(black);
70
71 // for (int i=-50;i<50;i+=4){
72 // p.drawLine((vuvalue), height()-10, vuvalue*2, 25);
73 // }
74
75 p.drawText(-100,15,Lannot);
76 p.drawText(65,15,Rannot);
77
78 p.drawText(-100, height()-25, QString("-"));
79 p.drawText(85, height()-25, QString("+"));
80 p.drawText(-2, 20, QString("0"));
81 p.end();
82
83}
84
85void VUMeter::vupdate(){
86
87 if (!pix){
88 bupdate();
89 }
90
91 // redraw line only
92
93 QPixmap tmp_pix(rect().size());
94
95 QPainter p( &tmp_pix );
96 p.drawPixmap(QPoint(0,0), *pix);
97
98 p.translate(width()/2, 0);
99 p.drawLine((vuvalue), height()-10, vuvalue*2, 25);
100 p.end();
101 bitBlt(this, rect().topLeft(), &tmp_pix);
102}
103
104
105
diff --git a/noncore/multimedia/powerchord/vumeter.h b/noncore/multimedia/powerchord/vumeter.h
new file mode 100644
index 0000000..d708435
--- a/dev/null
+++ b/noncore/multimedia/powerchord/vumeter.h
@@ -0,0 +1,59 @@
1//
2// VUMeter class
3//
4
5// Copyright (c) 2001 Camilo Mesias
6// camilo@mesias.co.uk
7//
8// This program is free software; you can redistribute it and/or
9// modify it under the terms of the GNU General Public License
10// as published by the Free Software Foundation; either version 2
11// of the License, or (at your option) any later version.
12//
13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17//
18// You should have received a copy of the GNU General Public License
19// along with this program; if not, write to the Free Software
20// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21
22#ifndef __VUMETER_H
23#define __VUMETER_H
24
25#include <qwidget.h>
26#include <qstring.h>
27#include <qpixmap.h>
28
29class VUMeter : public QWidget {
30
31 Q_OBJECT
32
33 private:
34 int vuvalue;
35 QString Lannot;
36 QString Rannot;
37
38 QPixmap *pix;
39
40 protected:
41 void paintEvent(QPaintEvent *);
42 void bupdate();
43 void vupdate();
44
45 public:
46 VUMeter(QWidget *parent=0, const char *name=0);
47 ~VUMeter();
48
49 // slots
50 public slots:
51 void Value(int x){vuvalue = x; vupdate(); };
52 void AnnotL(const QString &s){Lannot = s; bupdate(); };
53 void AnnotR(const QString &s){Rannot = s; bupdate(); };
54};
55
56#endif
57
58
59