summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-01-20 15:51:03 (UTC)
committer mickeyl <mickeyl>2004-01-20 15:51:03 (UTC)
commit996826e77a8f96ada424814716178e65caba9287 (patch) (unidiff)
tree09c60dcc4437dba1838c086b7eeb5480800716d5
parent557eb6a25f2cfc6e350c1731ead4df0e07861f25 (diff)
downloadopie-996826e77a8f96ada424814716178e65caba9287.zip
opie-996826e77a8f96ada424814716178e65caba9287.tar.gz
opie-996826e77a8f96ada424814716178e65caba9287.tar.bz2
package the guitar sample
fix reading from share/powerchord/
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/powerchord/gs.cpp17
-rw-r--r--noncore/multimedia/powerchord/gs.h1
-rw-r--r--noncore/multimedia/powerchord/opie-powerchord.control8
-rw-r--r--share/powerchord/acguitar.rawbin0 -> 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
@@ -18,6 +18,7 @@
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
23gs::gs() 24gs::gs()
@@ -66,15 +67,19 @@ gs::gs()
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);
@@ -82,7 +87,7 @@ gs::gs()
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
@@ -90,10 +95,10 @@ gs::gs()
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
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
@@ -8,7 +8,6 @@
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
13class gs : public QObject { 12class gs : public QObject {
14 13
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 @@
1Files: bin/powerchord apps/Applications/powerchord.desktop pics/powerchord sounds/powerchord 1Files: bin/powerchord apps/Applications/powerchord.desktop pics/powerchord share/powerchord
2Priority: optional 2Priority: optional
3Section: qpe/applications 3Section: Applications
4Maintainer: Camilo Mesias <camilo@mesias.co.uk> 4Maintainer: Camilo Mesias <camilo@mesias.co.uk>
5Architecture: arm 5Architecture: arm
6Version: 0.0.7 6Version: 0.0.8
7Depends: qpe-base ($QPE_VERSION) 7Depends: task-opie-minimal
8Description: Guitar Chord generator application 8Description: Guitar Chord generator application
9Allows naming of chords using base note and key. Fretboard diagrams are 9Allows naming of chords using base note and key. Fretboard diagrams are
10produced illustrating ways to play the chord. 10produced 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