-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 | |||
@@ -5,32 +5,33 @@ | |||
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; |
@@ -53,60 +54,64 @@ gs::gs() | |||
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); |
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,27 +1,26 @@ | |||
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; |
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 | |||