author | zecke <zecke> | 2003-10-07 13:02:55 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-10-07 13:02:55 (UTC) |
commit | 75f35445e9f3ec2f730f779d67f4189296bd9c5e (patch) (unidiff) | |
tree | 58d137879aefe506af087f5a75e29f60b5aaae0a | |
parent | d72a9cfe61cbc0910373e4604220021ebbcedaeb (diff) | |
download | opie-75f35445e9f3ec2f730f779d67f4189296bd9c5e.zip opie-75f35445e9f3ec2f730f779d67f4189296bd9c5e.tar.gz opie-75f35445e9f3ec2f730f779d67f4189296bd9c5e.tar.bz2 |
instead of testing for QWS_EBX we now define OPIE_NO_SOUND_PCM_READ_BITS.
If your platform does not have that ioctl define it
-rw-r--r-- | noncore/multimedia/opierec/device.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/noncore/multimedia/opierec/device.cpp b/noncore/multimedia/opierec/device.cpp index f9a80c5..11071d8 100644 --- a/noncore/multimedia/opierec/device.cpp +++ b/noncore/multimedia/opierec/device.cpp | |||
@@ -1,15 +1,15 @@ | |||
1 | // device.cpp | 1 | // device.cpp |
2 | 2 | ||
3 | #include "device.h" | 3 | #include "device.h" |
4 | 4 | ||
5 | #include <qpe/config.h> | 5 | #include <qpe/config.h> |
6 | #include <qpe/qcopenvelope_qws.h> | 6 | #include <qpe/qcopenvelope_qws.h> |
7 | 7 | #include <qpe/custom.h> | |
8 | 8 | ||
9 | #include <fcntl.h> | 9 | #include <fcntl.h> |
10 | #include <stdio.h> | 10 | #include <stdio.h> |
11 | #include <stdlib.h> | 11 | #include <stdlib.h> |
12 | #include <sys/ioctl.h> | 12 | #include <sys/ioctl.h> |
13 | #include <sys/soundcard.h> | 13 | #include <sys/soundcard.h> |
14 | #include <unistd.h> | 14 | #include <unistd.h> |
15 | #include<sys/wait.h> | 15 | #include<sys/wait.h> |
@@ -21,17 +21,17 @@ | |||
21 | 21 | ||
22 | //extern QtRec *qperec; | 22 | //extern QtRec *qperec; |
23 | 23 | ||
24 | Device::Device( QObject * parent, const char * dsp, const char * mixr, bool record ) | 24 | Device::Device( QObject * parent, const char * dsp, const char * mixr, bool record ) |
25 | : QObject( parent) | 25 | : QObject( parent) |
26 | { | 26 | { |
27 | dspstr = (char *)dsp; | 27 | dspstr = (char *)dsp; |
28 | mixstr = (char *)mixr; | 28 | mixstr = (char *)mixr; |
29 | 29 | ||
30 | devForm=-1; | 30 | devForm=-1; |
31 | devCh=-1; | 31 | devCh=-1; |
32 | devRate=-1; | 32 | devRate=-1; |
33 | 33 | ||
34 | if( !record){ //playing | 34 | if( !record){ //playing |
35 | qDebug("setting up DSP for playing"); | 35 | qDebug("setting up DSP for playing"); |
36 | flags = O_WRONLY; | 36 | flags = O_WRONLY; |
37 | } else { //recording | 37 | } else { //recording |
@@ -139,17 +139,17 @@ int Device::openDevice( int flags) { | |||
139 | perror ("Error creating pipe"); | 139 | perror ("Error creating pipe"); |
140 | exit(1); | 140 | exit(1); |
141 | } | 141 | } |
142 | switch (pid = fork()) { | 142 | switch (pid = fork()) { |
143 | case -1: | 143 | case -1: |
144 | perror("The fork failed!"); | 144 | perror("The fork failed!"); |
145 | break; | 145 | break; |
146 | case 0: { | 146 | case 0: { |
147 | */ | 147 | */ |
148 | if (( sd = ::open( dspstr, flags)) == -1) { | 148 | if (( sd = ::open( dspstr, flags)) == -1) { |
149 | perror("open(\"/dev/dsp\")"); | 149 | perror("open(\"/dev/dsp\")"); |
150 | QString errorMsg="Could not open audio device\n /dev/dsp\n" | 150 | QString errorMsg="Could not open audio device\n /dev/dsp\n" |
151 | +(QString)strerror(errno); | 151 | +(QString)strerror(errno); |
152 | qDebug(errorMsg); | 152 | qDebug(errorMsg); |
153 | return -1; | 153 | return -1; |
154 | } | 154 | } |
155 | 155 | ||
@@ -171,40 +171,40 @@ exit(1); | |||
171 | */ | 171 | */ |
172 | /* close(pipefd[0]); | 172 | /* close(pipefd[0]); |
173 | write(pipefd[1], message, sizeof(message)); | 173 | write(pipefd[1], message, sizeof(message)); |
174 | close(pipefd[1]); | 174 | close(pipefd[1]); |
175 | // qDebug("%d",soundDevice->sd ); | 175 | // qDebug("%d",soundDevice->sd ); |
176 | _exit(0); | 176 | _exit(0); |
177 | } | 177 | } |
178 | default: | 178 | default: |
179 | // pid greater than zero is parent getting the child's pid | 179 | // pid greater than zero is parent getting the child's pid |
180 | printf("Child's pid is %d\n",pid); | 180 | printf("Child's pid is %d\n",pid); |
181 | QString s; | 181 | QString s; |
182 | close(pipefd[1]); | 182 | close(pipefd[1]); |
183 | read(pipefd[0], message, sizeof(message)); | 183 | read(pipefd[0], message, sizeof(message)); |
184 | s = message; | 184 | s = message; |
185 | close(pipefd[0]); | 185 | close(pipefd[0]); |
186 | 186 | ||
187 | // while(wait(NULL)!=pid) | 187 | // while(wait(NULL)!=pid) |
188 | // ; | 188 | // ; |
189 | printf("child %ld terminated normally, return status is zero\n", (long) pid); | 189 | printf("child %ld terminated normally, return status is zero\n", (long) pid); |
190 | */ | 190 | */ |
191 | // filePara.sd=(long) pid; | 191 | // filePara.sd=(long) pid; |
192 | /* QFile f2("/pid"); | 192 | /* QFile f2("/pid"); |
193 | f2.open(IO_ReadOnly); | 193 | f2.open(IO_ReadOnly); |
194 | QTextStream t(&f2); | 194 | QTextStream t(&f2); |
195 | // for(int f=0; f < t.atEnd() ;f++) { | 195 | // for(int f=0; f < t.atEnd() ;f++) { |
196 | s = t.readLine(); | 196 | s = t.readLine(); |
197 | // } | 197 | // } |
198 | */ | 198 | */ |
199 | // bool ok; | 199 | // bool ok; |
200 | // sd = s.toInt(&ok, 10); | 200 | // sd = s.toInt(&ok, 10); |
201 | // qDebug("<<<<<<<<<<<<<>>>>>>>>>>>>"+s); | 201 | // qDebug("<<<<<<<<<<<<<>>>>>>>>>>>>"+s); |
202 | 202 | ||
203 | // f2.close(); | 203 | // f2.close(); |
204 | // } | 204 | // } |
205 | ::close(mixerHandle ); | 205 | ::close(mixerHandle ); |
206 | qDebug("open device %s", dspstr); | 206 | qDebug("open device %s", dspstr); |
207 | qDebug("success! %d",sd); | 207 | qDebug("success! %d",sd); |
208 | return sd; | 208 | return sd; |
209 | } | 209 | } |
210 | 210 | ||
@@ -285,17 +285,17 @@ int Device::getDeviceRate() { | |||
285 | perror("ioctl(\"SNDCTL_PCM_READ_RATE\")"); | 285 | perror("ioctl(\"SNDCTL_PCM_READ_RATE\")"); |
286 | } | 286 | } |
287 | return dRate; | 287 | return dRate; |
288 | 288 | ||
289 | } | 289 | } |
290 | 290 | ||
291 | int Device::getDeviceBits() { | 291 | int Device::getDeviceBits() { |
292 | int dBits=0; | 292 | int dBits=0; |
293 | #ifndef QT_QWS_EBX // zaurus doesnt have this | 293 | #if !defined(OPIE_NO_SOUND_PCM_READ_BITS) // zaurus doesnt have this |
294 | if (ioctl( sd, SOUND_PCM_READ_BITS, &dBits) == -1) { | 294 | if (ioctl( sd, SOUND_PCM_READ_BITS, &dBits) == -1) { |
295 | perror("ioctl(\"SNDCTL_PCM_READ_BITS\")"); | 295 | perror("ioctl(\"SNDCTL_PCM_READ_BITS\")"); |
296 | } | 296 | } |
297 | #endif | 297 | #endif |
298 | return dBits; | 298 | return dBits; |
299 | } | 299 | } |
300 | 300 | ||
301 | int Device::getDeviceChannels() { | 301 | int Device::getDeviceChannels() { |
@@ -303,17 +303,17 @@ int Device::getDeviceChannels() { | |||
303 | if (ioctl( sd, SOUND_PCM_READ_CHANNELS, &dCh) == -1) { | 303 | if (ioctl( sd, SOUND_PCM_READ_CHANNELS, &dCh) == -1) { |
304 | perror("ioctl(\"SNDCTL_PCM_READ_CHANNELS\")"); | 304 | perror("ioctl(\"SNDCTL_PCM_READ_CHANNELS\")"); |
305 | } | 305 | } |
306 | return dCh; | 306 | return dCh; |
307 | } | 307 | } |
308 | 308 | ||
309 | int Device::getDeviceFragSize() { | 309 | int Device::getDeviceFragSize() { |
310 | int frag_size; | 310 | int frag_size; |
311 | 311 | ||
312 | if (ioctl( sd, SNDCTL_DSP_GETBLKSIZE, &frag_size) == -1) { | 312 | if (ioctl( sd, SNDCTL_DSP_GETBLKSIZE, &frag_size) == -1) { |
313 | qDebug("no fragsize"); | 313 | qDebug("no fragsize"); |
314 | } else | 314 | } else |
315 | qDebug("driver says frag size is %d", frag_size); | 315 | qDebug("driver says frag size is %d", frag_size); |
316 | return frag_size; | 316 | return frag_size; |
317 | } | 317 | } |
318 | 318 | ||
319 | bool Device::setFragSize(int frag) { | 319 | bool Device::setFragSize(int frag) { |