author | mickeyl <mickeyl> | 2004-01-20 13:07:31 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-01-20 13:07:31 (UTC) |
commit | d388324e7b91bdd95553c3849d77cddd5bd0bfc4 (patch) (unidiff) | |
tree | ef660ffd25aa8cabbfa58e6c3b170e7c82511bc6 /noncore/multimedia/powerchord/gs.h | |
parent | 105007cca23072ee42a1f36625979966eb8a4854 (diff) | |
download | opie-d388324e7b91bdd95553c3849d77cddd5bd0bfc4.zip opie-d388324e7b91bdd95553c3849d77cddd5bd0bfc4.tar.gz opie-d388324e7b91bdd95553c3849d77cddd5bd0bfc4.tar.bz2 |
initial import of powerchord courtesy Camilo Mesias <mailto:camilo@mesias.co.uk>
modified some bits to be compatible with the opie build system
packaging not complete yet
i hope camilo will maintain this here...
Diffstat (limited to 'noncore/multimedia/powerchord/gs.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/powerchord/gs.h | 124 |
1 files changed, 124 insertions, 0 deletions
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 | |||
13 | class 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 | |||