author | mickeyl <mickeyl> | 2004-01-20 15:51:03 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-01-20 15:51:03 (UTC) |
commit | 996826e77a8f96ada424814716178e65caba9287 (patch) (unidiff) | |
tree | 09c60dcc4437dba1838c086b7eeb5480800716d5 | |
parent | 557eb6a25f2cfc6e350c1731ead4df0e07861f25 (diff) | |
download | opie-996826e77a8f96ada424814716178e65caba9287.zip opie-996826e77a8f96ada424814716178e65caba9287.tar.gz opie-996826e77a8f96ada424814716178e65caba9287.tar.bz2 |
package the guitar sample
fix reading from share/powerchord/
-rw-r--r-- | noncore/multimedia/powerchord/gs.cpp | 17 | ||||
-rw-r--r-- | noncore/multimedia/powerchord/gs.h | 1 | ||||
-rw-r--r-- | noncore/multimedia/powerchord/opie-powerchord.control | 8 | ||||
-rw-r--r-- | share/powerchord/acguitar.raw | bin | 0 -> 50000 bytes |
4 files changed, 15 insertions, 11 deletions
diff --git a/noncore/multimedia/powerchord/gs.cpp b/noncore/multimedia/powerchord/gs.cpp index a3e85c9..fdcfb74 100644 --- a/noncore/multimedia/powerchord/gs.cpp +++ b/noncore/multimedia/powerchord/gs.cpp | |||
@@ -1,288 +1,293 @@ | |||
1 | 1 | ||
2 | //#include <FL/Fl.H> | 2 | //#include <FL/Fl.H> |
3 | //#include <FL/Fl_Widget.H> | 3 | //#include <FL/Fl_Widget.H> |
4 | //#include <FL/fl_draw.H> | 4 | //#include <FL/fl_draw.H> |
5 | #include <stdio.h> | 5 | #include <stdio.h> |
6 | //#include <qpixmap.h> | 6 | //#include <qpixmap.h> |
7 | #include "gs.h" | 7 | #include "gs.h" |
8 | 8 | ||
9 | #include <sys/ioctl.h> | 9 | #include <sys/ioctl.h> |
10 | #include <unistd.h> | 10 | #include <unistd.h> |
11 | #include <fcntl.h> | 11 | #include <fcntl.h> |
12 | #include <sys/soundcard.h> | 12 | #include <sys/soundcard.h> |
13 | 13 | ||
14 | #include <errno.h> | 14 | #include <errno.h> |
15 | #include <string.h> | 15 | #include <string.h> |
16 | 16 | ||
17 | #include <stdlib.h> | 17 | #include <stdlib.h> |
18 | 18 | ||
19 | //#include <qpainter.h> | 19 | //#include <qpainter.h> |
20 | #include <qmessagebox.h> | 20 | #include <qmessagebox.h> |
21 | #include <qstring.h> | ||
21 | 22 | ||
22 | 23 | ||
23 | gs::gs() | 24 | gs::gs() |
24 | { | 25 | { |
25 | 26 | ||
26 | finger[0] = OPEN; | 27 | finger[0] = OPEN; |
27 | finger[1] = OPEN; | 28 | finger[1] = OPEN; |
28 | finger[2] = OPEN; | 29 | finger[2] = OPEN; |
29 | finger[3] = OPEN; | 30 | finger[3] = OPEN; |
30 | finger[4] = OPEN; | 31 | finger[4] = OPEN; |
31 | finger[5] = OPEN; | 32 | finger[5] = OPEN; |
32 | 33 | ||
33 | tuning[0] = 0; | 34 | tuning[0] = 0; |
34 | tuning[1] = 0; | 35 | tuning[1] = 0; |
35 | tuning[2] = 0; | 36 | tuning[2] = 0; |
36 | tuning[3] = 0; | 37 | tuning[3] = 0; |
37 | tuning[4] = 0; | 38 | tuning[4] = 0; |
38 | tuning[5] = 0; | 39 | tuning[5] = 0; |
39 | 40 | ||
40 | initial_fret = 0; | 41 | initial_fret = 0; |
41 | 42 | ||
42 | audio_fd = -1; | 43 | audio_fd = -1; |
43 | 44 | ||
44 | pb_rate0 = 0; | 45 | pb_rate0 = 0; |
45 | pb_rate1 = 0; | 46 | pb_rate1 = 0; |
46 | pb_rate2 = 0; | 47 | pb_rate2 = 0; |
47 | pb_rate3 = 0; | 48 | pb_rate3 = 0; |
48 | pb_rate4 = 0; | 49 | pb_rate4 = 0; |
49 | pb_rate5 = 0; | 50 | pb_rate5 = 0; |
50 | pb_rate6 = 0; | 51 | pb_rate6 = 0; |
51 | 52 | ||
52 | pb_oct0 = 0; | 53 | pb_oct0 = 0; |
53 | pb_oct1 = 0; | 54 | pb_oct1 = 0; |
54 | pb_oct2 = 0; | 55 | pb_oct2 = 0; |
55 | pb_oct3 = 0; | 56 | pb_oct3 = 0; |
56 | pb_oct4 = 0; | 57 | pb_oct4 = 0; |
57 | pb_oct5 = 0; | 58 | pb_oct5 = 0; |
58 | pb_oct6 = 0; | 59 | pb_oct6 = 0; |
59 | 60 | ||
60 | // initialise reverb buffer | 61 | // initialise reverb buffer |
61 | reverb = (signed short *)malloc(1024 * sizeof(signed short)); | 62 | reverb = (signed short *)malloc(1024 * sizeof(signed short)); |
62 | 63 | ||
63 | for (reverb_ptr=0;reverb_ptr<1024;reverb_ptr++){ | 64 | for (reverb_ptr=0;reverb_ptr<1024;reverb_ptr++){ |
64 | reverb[reverb_ptr] = 0; | 65 | reverb[reverb_ptr] = 0; |
65 | } | 66 | } |
66 | reverb_ptr = 0; | 67 | reverb_ptr = 0; |
67 | reverb_max = 1024; | 68 | reverb_max = 1024; |
68 | 69 | ||
69 | // load sampled 'E' string | 70 | // load sampled 'E' string |
70 | int samplen = 25000; | 71 | int samplen = 25000; |
71 | 72 | ||
72 | signed short *dsp_buf = (signed short *)malloc(samplen * sizeof(signed short)); | 73 | signed short *dsp_buf = (signed short *)malloc(samplen * sizeof(signed short)); |
73 | signed short *dsp_buf_ptr = dsp_buf; | 74 | signed short *dsp_buf_ptr = dsp_buf; |
74 | 75 | ||
75 | int raw_fd; | 76 | int raw_fd; |
76 | raw_fd = open(ACGUITAR_PATH_S, O_RDONLY); | 77 | |
77 | 78 | QString path = getenv( "OPIEDIR" ); | |
79 | path.append( "/share/powerchord/acguitar.raw" ); | ||
80 | |||
81 | raw_fd = open( (const char*) path, O_RDONLY); | ||
82 | |||
78 | if (raw_fd < 0){ | 83 | if (raw_fd < 0){ |
79 | fprintf(stderr, "Failed to open raw file (%s)\n", strerror(errno)); | 84 | fprintf(stderr, "Failed to open raw file (%s)\n", strerror(errno)); |
80 | exit(-1); | 85 | exit(-1); |
81 | } | 86 | } |
82 | 87 | ||
83 | int totread = 0; | 88 | int totread = 0; |
84 | int i; | 89 | int i; |
85 | 90 | ||
86 | while (totread < samplen*2){ | 91 | while (totread < samplen*2){ |
87 | int want = samplen*2 - totread; | 92 | int want = samplen*2 - totread; |
88 | 93 | ||
89 | int numread = read(raw_fd, dsp_buf_ptr, want); | 94 | int numread = read(raw_fd, dsp_buf_ptr, want); |
90 | fprintf(stderr, "read %d bytes\n", numread); | 95 | fprintf(stderr, "read %d bytes\n", numread); |
91 | totread += numread; | 96 | totread += numread; |
92 | dsp_buf_ptr += numread/2; | 97 | dsp_buf_ptr += numread/2; |
93 | 98 | ||
94 | if (numread == 0){ | 99 | if (numread == 0){ |
95 | fprintf(stderr, "failed to read bytes\n"); | 100 | fprintf(stderr, "failed to read bytes\n"); |
96 | exit(-1); | 101 | exit(-1); |
97 | } | 102 | } |
98 | } | 103 | } |
99 | 104 | ||
100 | close(raw_fd); | 105 | close(raw_fd); |
101 | 106 | ||
102 | // scale down a bit for mixing | 107 | // scale down a bit for mixing |
103 | for (i=0;i<samplen;i++){ | 108 | for (i=0;i<samplen;i++){ |
104 | dsp_buf[i] /= 6; | 109 | dsp_buf[i] /= 6; |
105 | } | 110 | } |
106 | 111 | ||
107 | set_tonebank(0, dsp_buf, samplen); | 112 | set_tonebank(0, dsp_buf, samplen); |
108 | set_tonebank(1, dsp_buf, samplen); | 113 | set_tonebank(1, dsp_buf, samplen); |
109 | set_tonebank(2, dsp_buf, samplen); | 114 | set_tonebank(2, dsp_buf, samplen); |
110 | set_tonebank(3, dsp_buf, samplen); | 115 | set_tonebank(3, dsp_buf, samplen); |
111 | set_tonebank(4, dsp_buf, samplen); | 116 | set_tonebank(4, dsp_buf, samplen); |
112 | set_tonebank(5, dsp_buf, samplen); | 117 | set_tonebank(5, dsp_buf, samplen); |
113 | set_tonebank(6, dsp_buf, samplen); | 118 | set_tonebank(6, dsp_buf, samplen); |
114 | 119 | ||
115 | } | 120 | } |
116 | 121 | ||
117 | void gs::set_tonebank(int tb, signed short *buf, int length) | 122 | void gs::set_tonebank(int tb, signed short *buf, int length) |
118 | { | 123 | { |
119 | switch(tb){ | 124 | switch(tb){ |
120 | case 0: | 125 | case 0: |
121 | tonebank0 = buf; | 126 | tonebank0 = buf; |
122 | tonebank_length0 = length; | 127 | tonebank_length0 = length; |
123 | break; | 128 | break; |
124 | case 1: | 129 | case 1: |
125 | tonebank1 = buf; | 130 | tonebank1 = buf; |
126 | tonebank_length1 = length; | 131 | tonebank_length1 = length; |
127 | break; | 132 | break; |
128 | case 2: | 133 | case 2: |
129 | tonebank2 = buf; | 134 | tonebank2 = buf; |
130 | tonebank_length2 = length; | 135 | tonebank_length2 = length; |
131 | break; | 136 | break; |
132 | case 3: | 137 | case 3: |
133 | tonebank3 = buf; | 138 | tonebank3 = buf; |
134 | tonebank_length3 = length; | 139 | tonebank_length3 = length; |
135 | break; | 140 | break; |
136 | case 4: | 141 | case 4: |
137 | tonebank4 = buf; | 142 | tonebank4 = buf; |
138 | tonebank_length4 = length; | 143 | tonebank_length4 = length; |
139 | break; | 144 | break; |
140 | case 5: | 145 | case 5: |
141 | tonebank5 = buf; | 146 | tonebank5 = buf; |
142 | tonebank_length5 = length; | 147 | tonebank_length5 = length; |
143 | break; | 148 | break; |
144 | case 6: | 149 | case 6: |
145 | tonebank6 = buf; | 150 | tonebank6 = buf; |
146 | tonebank_length6 = length; | 151 | tonebank_length6 = length; |
147 | break; | 152 | break; |
148 | 153 | ||
149 | } | 154 | } |
150 | } | 155 | } |
151 | 156 | ||
152 | 157 | ||
153 | void gs::Finger(int f, int position){ | 158 | void gs::Finger(int f, int position){ |
154 | if (f < 0 || f > 5){ | 159 | if (f < 0 || f > 5){ |
155 | fprintf(stderr, "Error - finger2 value was %d\n", f); | 160 | fprintf(stderr, "Error - finger2 value was %d\n", f); |
156 | return; | 161 | return; |
157 | } | 162 | } |
158 | 163 | ||
159 | finger[f] = position; | 164 | finger[f] = position; |
160 | } | 165 | } |
161 | 166 | ||
162 | void gs::Tuning(int t[6]){ | 167 | void gs::Tuning(int t[6]){ |
163 | for (int i=0;i<6;i++){ | 168 | for (int i=0;i<6;i++){ |
164 | tuning[i] = t[i]; | 169 | tuning[i] = t[i]; |
165 | } | 170 | } |
166 | } | 171 | } |
167 | 172 | ||
168 | // length in ps (seconds x 10^-9) of the period of a note. | 173 | // 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 | 174 | // we use these as ratios in a breshenham-like algorithm to |
170 | // scale a deep note to a higher pitch | 175 | // scale a deep note to a higher pitch |
171 | // They are derived from f(A) = 440Hz and multiply each successive | 176 | // 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 | 177 | // 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, | 178 | // 12 semitones you have a note exactly 2x the frequency of the initial one, |
174 | // - an octave higher in other words.) | 179 | // - an octave higher in other words.) |
175 | 180 | ||
176 | int gs::note_periods[12] = { | 181 | int gs::note_periods[12] = { |
177 | 90703, | 182 | 90703, |
178 | 85612, | 183 | 85612, |
179 | 80802, | 184 | 80802, |
180 | 76272, | 185 | 76272, |
181 | 71991, | 186 | 71991, |
182 | 67950, | 187 | 67950, |
183 | 64137, | 188 | 64137, |
184 | 60537, | 189 | 60537, |
185 | 57139, | 190 | 57139, |
186 | 53932, | 191 | 53932, |
187 | 50905, | 192 | 50905, |
188 | 48048 | 193 | 48048 |
189 | }; | 194 | }; |
190 | 195 | ||
191 | int gs::octave_step[6] = { | 196 | int gs::octave_step[6] = { |
192 | 1, | 197 | 1, |
193 | 2, | 198 | 2, |
194 | 4, | 199 | 4, |
195 | 8, | 200 | 8, |
196 | 16, | 201 | 16, |
197 | 32 | 202 | 32 |
198 | }; | 203 | }; |
199 | 204 | ||
200 | int gs::Play(){ | 205 | int gs::Play(){ |
201 | int format; | 206 | int format; |
202 | int channels; | 207 | int channels; |
203 | int speed; | 208 | int speed; |
204 | 209 | ||
205 | frames = 0; | 210 | frames = 0; |
206 | 211 | ||
207 | if (audio_fd == -1){ | 212 | if (audio_fd == -1){ |
208 | if ( (audio_fd = open("/dev/dsp", O_WRONLY, 0) ) == -1){ | 213 | if ( (audio_fd = open("/dev/dsp", O_WRONLY, 0) ) == -1){ |
209 | audio_fd = -1; | 214 | audio_fd = -1; |
210 | return 1; | 215 | return 1; |
211 | } | 216 | } |
212 | 217 | ||
213 | format = AFMT_S16_NE; | 218 | format = AFMT_S16_NE; |
214 | 219 | ||
215 | if (ioctl(audio_fd, SNDCTL_DSP_SETFMT, &format) == -1){ | 220 | if (ioctl(audio_fd, SNDCTL_DSP_SETFMT, &format) == -1){ |
216 | fprintf(stderr, "Error SNDCTL DSP SETFMT, %s\n", strerror(errno)); | 221 | fprintf(stderr, "Error SNDCTL DSP SETFMT, %s\n", strerror(errno)); |
217 | exit(0); | 222 | exit(0); |
218 | } | 223 | } |
219 | 224 | ||
220 | channels = 1; | 225 | channels = 1; |
221 | 226 | ||
222 | if (ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &channels) == -1){ | 227 | if (ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &channels) == -1){ |
223 | fprintf(stderr, "Error SNDCTL DSP CHANNELS, %s\n", strerror(errno)); | 228 | fprintf(stderr, "Error SNDCTL DSP CHANNELS, %s\n", strerror(errno)); |
224 | exit(0); | 229 | exit(0); |
225 | } | 230 | } |
226 | 231 | ||
227 | speed = 11025; | 232 | speed = 11025; |
228 | 233 | ||
229 | if (ioctl(audio_fd, SNDCTL_DSP_SPEED, &speed) == -1){ | 234 | if (ioctl(audio_fd, SNDCTL_DSP_SPEED, &speed) == -1){ |
230 | fprintf(stderr, "Error SNDCTL DSP SPEED, %s\n", strerror(errno)); | 235 | fprintf(stderr, "Error SNDCTL DSP SPEED, %s\n", strerror(errno)); |
231 | exit(0); | 236 | exit(0); |
232 | } | 237 | } |
233 | 238 | ||
234 | // buffering q's | 239 | // buffering q's |
235 | //audio_buf_info info; | 240 | //audio_buf_info info; |
236 | //if (ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &info) == -1){ | 241 | //if (ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &info) == -1){ |
237 | // fprintf(stderr, "Error SNDCTL DSP GETOSPACE, %s\n", strerror(errno)); | 242 | // fprintf(stderr, "Error SNDCTL DSP GETOSPACE, %s\n", strerror(errno)); |
238 | // exit(0); | 243 | // exit(0); |
239 | //} | 244 | //} |
240 | //fprintf(stderr, "fragments %d\nfragstotal %d\nfragsize %d\nbytes %d\n", info.fragments, info.fragstotal, info.fragsize, info.bytes); | 245 | //fprintf(stderr, "fragments %d\nfragstotal %d\nfragsize %d\nbytes %d\n", info.fragments, info.fragstotal, info.fragsize, info.bytes); |
241 | 246 | ||
242 | 247 | ||
243 | 248 | ||
244 | // audio math. | 249 | // audio math. |
245 | // A4 = 440Hz | 250 | // A4 = 440Hz |
246 | // +1 octave = 2x freq | 251 | // +1 octave = 2x freq |
247 | // -1 octave = /2 freq. | 252 | // -1 octave = /2 freq. |
248 | // +1 semitone = *= 12 root 2; | 253 | // +1 semitone = *= 12 root 2; |
249 | // ie. * 1.059463094 | 254 | // ie. * 1.059463094 |
250 | 255 | ||
251 | // tones, approx Hz, samples at 11025 | 256 | // tones, approx Hz, samples at 11025 |
252 | // A4 440 25 | 257 | // A4 440 25 |
253 | // A#4 466 24 | 258 | // A#4 466 24 |
254 | // B4 494 22 | 259 | // B4 494 22 |
255 | // C4 523 21 | 260 | // C4 523 21 |
256 | // C#4 554 20 | 261 | // C#4 554 20 |
257 | // D4 587 19 | 262 | // D4 587 19 |
258 | // D#4 622 18 | 263 | // D#4 622 18 |
259 | // E4 659 17 | 264 | // E4 659 17 |
260 | // F4 698 16 | 265 | // F4 698 16 |
261 | // F#4 740 15 | 266 | // F#4 740 15 |
262 | // G4 784 14 | 267 | // G4 784 14 |
263 | // G#4 831 13 | 268 | // G#4 831 13 |
264 | 269 | ||
265 | 270 | ||
266 | } | 271 | } |
267 | else{ | 272 | else{ |
268 | fprintf(stderr, "Already playing\n"); | 273 | fprintf(stderr, "Already playing\n"); |
269 | } | 274 | } |
270 | 275 | ||
271 | return 0; | 276 | return 0; |
272 | } | 277 | } |
273 | 278 | ||
274 | void gs::note_start(int chan, int note, int octave) | 279 | void gs::note_start(int chan, int note, int octave) |
275 | { | 280 | { |
276 | switch (chan){ | 281 | switch (chan){ |
277 | 282 | ||
278 | case 0: | 283 | case 0: |
279 | pb_rate0 = note_periods[note]; | 284 | pb_rate0 = note_periods[note]; |
280 | pb_oct0 = octave_step[octave]; | 285 | pb_oct0 = octave_step[octave]; |
281 | pb_ratio0 = 0; | 286 | pb_ratio0 = 0; |
282 | pb_rsc0 = 0; | 287 | pb_rsc0 = 0; |
283 | break; | 288 | break; |
284 | case 1: | 289 | case 1: |
285 | pb_rate1 = note_periods[note]; | 290 | pb_rate1 = note_periods[note]; |
286 | pb_oct1 = octave_step[octave]; | 291 | pb_oct1 = octave_step[octave]; |
287 | pb_ratio1 = 0; | 292 | pb_ratio1 = 0; |
288 | pb_rsc1 = 0; | 293 | pb_rsc1 = 0; |
diff --git a/noncore/multimedia/powerchord/gs.h b/noncore/multimedia/powerchord/gs.h index 3e4c04d..f2b309f 100644 --- a/noncore/multimedia/powerchord/gs.h +++ b/noncore/multimedia/powerchord/gs.h | |||
@@ -1,124 +1,123 @@ | |||
1 | 1 | ||
2 | #ifndef __GS_H | 2 | #ifndef __GS_H |
3 | #define __GS_H | 3 | #define __GS_H |
4 | 4 | ||
5 | #include <qobject.h> | 5 | #include <qobject.h> |
6 | // sound includes | 6 | // sound includes |
7 | #include <sys/soundcard.h> | 7 | #include <sys/soundcard.h> |
8 | 8 | ||
9 | #define BUFSIZE 256 | 9 | #define BUFSIZE 256 |
10 | #define NUMCHANS 7 | 10 | #define NUMCHANS 7 |
11 | #define ACGUITAR_PATH_S "/usr/local/projects/opie-head/noncore/multimedia/powerchord/acguitar.raw" | ||
12 | 11 | ||
13 | class gs : public QObject { | 12 | class gs : public QObject { |
14 | 13 | ||
15 | Q_OBJECT | 14 | Q_OBJECT |
16 | 15 | ||
17 | public: | 16 | public: |
18 | gs(); | 17 | gs(); |
19 | ~gs(); | 18 | ~gs(); |
20 | 19 | ||
21 | private: | 20 | private: |
22 | 21 | ||
23 | int initial_fret; | 22 | int initial_fret; |
24 | int finger[6]; | 23 | int finger[6]; |
25 | int tuning[6]; | 24 | int tuning[6]; |
26 | 25 | ||
27 | signed short *reverb; | 26 | signed short *reverb; |
28 | int reverb_ptr; | 27 | int reverb_ptr; |
29 | int reverb_max; | 28 | int reverb_max; |
30 | 29 | ||
31 | int audio_fd; | 30 | int audio_fd; |
32 | signed short audio_buf[BUFSIZE]; | 31 | signed short audio_buf[BUFSIZE]; |
33 | static int note_periods[12]; | 32 | static int note_periods[12]; |
34 | static int octave_step[6]; | 33 | static int octave_step[6]; |
35 | int frames; | 34 | int frames; |
36 | 35 | ||
37 | 36 | ||
38 | // 7 channel synth | 37 | // 7 channel synth |
39 | signed short *tonebank0; // source of waveform | 38 | signed short *tonebank0; // source of waveform |
40 | signed short *tonebank1; | 39 | signed short *tonebank1; |
41 | signed short *tonebank2; | 40 | signed short *tonebank2; |
42 | signed short *tonebank3; | 41 | signed short *tonebank3; |
43 | signed short *tonebank4; | 42 | signed short *tonebank4; |
44 | signed short *tonebank5; | 43 | signed short *tonebank5; |
45 | signed short *tonebank6; | 44 | signed short *tonebank6; |
46 | int tonebank_length0; | 45 | int tonebank_length0; |
47 | int tonebank_length1; | 46 | int tonebank_length1; |
48 | int tonebank_length2; | 47 | int tonebank_length2; |
49 | int tonebank_length3; | 48 | int tonebank_length3; |
50 | int tonebank_length4; | 49 | int tonebank_length4; |
51 | int tonebank_length5; | 50 | int tonebank_length5; |
52 | int tonebank_length6; | 51 | int tonebank_length6; |
53 | int pb_rate0; // playback rate or 0 | 52 | int pb_rate0; // playback rate or 0 |
54 | int pb_rate1; | 53 | int pb_rate1; |
55 | int pb_rate2; | 54 | int pb_rate2; |
56 | int pb_rate3; | 55 | int pb_rate3; |
57 | int pb_rate4; | 56 | int pb_rate4; |
58 | int pb_rate5; | 57 | int pb_rate5; |
59 | int pb_rate6; | 58 | int pb_rate6; |
60 | int pb_ratio0; // accumulator for ratio | 59 | int pb_ratio0; // accumulator for ratio |
61 | int pb_ratio1; | 60 | int pb_ratio1; |
62 | int pb_ratio2; | 61 | int pb_ratio2; |
63 | int pb_ratio3; | 62 | int pb_ratio3; |
64 | int pb_ratio4; | 63 | int pb_ratio4; |
65 | int pb_ratio5; | 64 | int pb_ratio5; |
66 | int pb_ratio6; | 65 | int pb_ratio6; |
67 | int pb_rsc0; // pointer to current position | 66 | int pb_rsc0; // pointer to current position |
68 | int pb_rsc1; | 67 | int pb_rsc1; |
69 | int pb_rsc2; | 68 | int pb_rsc2; |
70 | int pb_rsc3; | 69 | int pb_rsc3; |
71 | int pb_rsc4; | 70 | int pb_rsc4; |
72 | int pb_rsc5; | 71 | int pb_rsc5; |
73 | int pb_rsc6; | 72 | int pb_rsc6; |
74 | int pb_oct0; // octave | 73 | int pb_oct0; // octave |
75 | int pb_oct1; | 74 | int pb_oct1; |
76 | int pb_oct2; | 75 | int pb_oct2; |
77 | int pb_oct3; | 76 | int pb_oct3; |
78 | int pb_oct4; | 77 | int pb_oct4; |
79 | int pb_oct5; | 78 | int pb_oct5; |
80 | int pb_oct6; | 79 | int pb_oct6; |
81 | 80 | ||
82 | void set_tonebank(int bank, signed short *buffer, int length); | 81 | void set_tonebank(int bank, signed short *buffer, int length); |
83 | protected: | 82 | protected: |
84 | 83 | ||
85 | public: | 84 | public: |
86 | static const int MUTED=7; | 85 | static const int MUTED=7; |
87 | static const int OPEN=0; | 86 | static const int OPEN=0; |
88 | 87 | ||
89 | // accessors | 88 | // accessors |
90 | int Frames(){return frames;}; | 89 | int Frames(){return frames;}; |
91 | int Finger(int finger); | 90 | int Finger(int finger); |
92 | int Fret(){return initial_fret;}; | 91 | int Fret(){return initial_fret;}; |
93 | int Playing(){ | 92 | int Playing(){ |
94 | if (pb_rate0 == 0 && | 93 | if (pb_rate0 == 0 && |
95 | pb_rate1 == 0 && | 94 | pb_rate1 == 0 && |
96 | pb_rate2 == 0 && | 95 | pb_rate2 == 0 && |
97 | pb_rate3 == 0 && | 96 | pb_rate3 == 0 && |
98 | pb_rate4 == 0 && | 97 | pb_rate4 == 0 && |
99 | pb_rate5 == 0 && | 98 | pb_rate5 == 0 && |
100 | pb_rate6 == 0) return 0; | 99 | pb_rate6 == 0) return 0; |
101 | return 1; | 100 | return 1; |
102 | }; | 101 | }; |
103 | 102 | ||
104 | public : | 103 | public : |
105 | // mutators | 104 | // mutators |
106 | void Reverb(int size){reverb_max = 64 * size;}; | 105 | void Reverb(int size){reverb_max = 64 * size;}; |
107 | void Finger(int finger, int position); | 106 | void Finger(int finger, int position); |
108 | void Fret(int position){initial_fret = position;}; | 107 | void Fret(int position){initial_fret = position;}; |
109 | void Tuning(int t[6]); | 108 | void Tuning(int t[6]); |
110 | void note_start(int chan, int note, int octave); | 109 | void note_start(int chan, int note, int octave); |
111 | 110 | ||
112 | // methods | 111 | // methods |
113 | int Play(); | 112 | int Play(); |
114 | void fill_buffer(); | 113 | void fill_buffer(); |
115 | void write_buffer(); | 114 | void write_buffer(); |
116 | void Stop(); | 115 | void Stop(); |
117 | }; | 116 | }; |
118 | 117 | ||
119 | #endif | 118 | #endif |
120 | 119 | ||
121 | 120 | ||
122 | 121 | ||
123 | 122 | ||
124 | 123 | ||
diff --git a/noncore/multimedia/powerchord/opie-powerchord.control b/noncore/multimedia/powerchord/opie-powerchord.control index 7f45999..d295031 100644 --- a/noncore/multimedia/powerchord/opie-powerchord.control +++ b/noncore/multimedia/powerchord/opie-powerchord.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Files: bin/powerchord apps/Applications/powerchord.desktop pics/powerchord sounds/powerchord | 1 | Files: bin/powerchord apps/Applications/powerchord.desktop pics/powerchord share/powerchord |
2 | Priority: optional | 2 | Priority: optional |
3 | Section: qpe/applications | 3 | Section: Applications |
4 | Maintainer: Camilo Mesias <camilo@mesias.co.uk> | 4 | Maintainer: Camilo Mesias <camilo@mesias.co.uk> |
5 | Architecture: arm | 5 | Architecture: arm |
6 | Version: 0.0.7 | 6 | Version: 0.0.8 |
7 | Depends: qpe-base ($QPE_VERSION) | 7 | Depends: task-opie-minimal |
8 | Description: Guitar Chord generator application | 8 | Description: Guitar Chord generator application |
9 | Allows naming of chords using base note and key. Fretboard diagrams are | 9 | Allows naming of chords using base note and key. Fretboard diagrams are |
10 | produced illustrating ways to play the chord. | 10 | produced illustrating ways to play the chord. |
diff --git a/share/powerchord/acguitar.raw b/share/powerchord/acguitar.raw new file mode 100644 index 0000000..1452147 --- a/dev/null +++ b/share/powerchord/acguitar.raw | |||
Binary files differ | |||