author | mickeyl <mickeyl> | 2004-04-04 13:54:40 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-04-04 13:54:40 (UTC) |
commit | 16cf79e90b5217f8d4bfce2a0fa817ae4b73db36 (patch) (unidiff) | |
tree | 0701eae15aa606a0211a2fccfde0eafdac69357c /noncore/multimedia/opierec/device.cpp | |
parent | 8d2d2664e5f544b8292806e617deb7a0e4170dc0 (diff) | |
download | opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.zip opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.gz opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.bz2 |
convert to Opie Debugging Framework
Diffstat (limited to 'noncore/multimedia/opierec/device.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opierec/device.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/noncore/multimedia/opierec/device.cpp b/noncore/multimedia/opierec/device.cpp index ce49e96..5319d97 100644 --- a/noncore/multimedia/opierec/device.cpp +++ b/noncore/multimedia/opierec/device.cpp | |||
@@ -2,20 +2,20 @@ | |||
2 | 2 | ||
3 | #include "device.h" | 3 | #include "device.h" |
4 | 4 | ||
5 | /* OPIE */ | ||
6 | #include <opie2/odebug.h> | ||
5 | #include <qpe/config.h> | 7 | #include <qpe/config.h> |
6 | #include <qpe/qcopenvelope_qws.h> | 8 | #include <qpe/qcopenvelope_qws.h> |
9 | using namespace Opie::Core; | ||
7 | 10 | ||
8 | 11 | /* STD */ | |
9 | #include <fcntl.h> | 12 | #include <fcntl.h> |
10 | #include <stdio.h> | 13 | #include <stdio.h> |
11 | #include <stdlib.h> | 14 | #include <stdlib.h> |
12 | #include <sys/ioctl.h> | 15 | #include <sys/ioctl.h> |
13 | #include <sys/soundcard.h> | 16 | #include <sys/soundcard.h> |
14 | #include <unistd.h> | 17 | #include <unistd.h> |
15 | #include<sys/wait.h> | 18 | #include <sys/wait.h> |
16 | // #include <sys/stat.h> | ||
17 | // #include <sys/time.h> | ||
18 | // #include <sys/types.h> | ||
19 | #include <unistd.h> | 19 | #include <unistd.h> |
20 | #include <errno.h> | 20 | #include <errno.h> |
21 | 21 | ||
@@ -32,10 +32,10 @@ Device::Device( QObject * parent, const char * dsp, const char * mixr, bool reco | |||
32 | devRate=-1; | 32 | devRate=-1; |
33 | 33 | ||
34 | if( !record){ //playing | 34 | if( !record){ //playing |
35 | qDebug("setting up DSP for playing"); | 35 | odebug << "setting up DSP for playing" << oendl; |
36 | flags = O_WRONLY; | 36 | flags = O_WRONLY; |
37 | } else { //recording | 37 | } else { //recording |
38 | qDebug("setting up DSP for recording"); | 38 | odebug << "setting up DSP for recording" << oendl; |
39 | flags = O_RDWR; | 39 | flags = O_RDWR; |
40 | // flags = O_RDONLY; | 40 | // flags = O_RDONLY; |
41 | 41 | ||
@@ -96,7 +96,7 @@ void Device::changedOutVolume(int vol) { | |||
96 | cfg.setGroup("Volume"); | 96 | cfg.setGroup("Volume"); |
97 | cfg.writeEntry("VolumePercent", QString::number( vol )); | 97 | cfg.writeEntry("VolumePercent", QString::number( vol )); |
98 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false; | 98 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false; |
99 | qWarning("changing output vol %d", vol); | 99 | owarn << "changing output vol " << vol << "" << oendl; |
100 | } | 100 | } |
101 | ::close(fd); | 101 | ::close(fd); |
102 | } | 102 | } |
@@ -111,7 +111,7 @@ void Device::changedInVolume(int vol ) { | |||
111 | cfg.setGroup("Volume"); | 111 | cfg.setGroup("Volume"); |
112 | cfg.writeEntry("Mic", QString::number(vol )); | 112 | cfg.writeEntry("Mic", QString::number(vol )); |
113 | QCopEnvelope( "QPE/System", "micChange(bool)" ) << false; | 113 | QCopEnvelope( "QPE/System", "micChange(bool)" ) << false; |
114 | qWarning("changing input volume %d", vol); | 114 | owarn << "changing input volume " << vol << "" << oendl; |
115 | } | 115 | } |
116 | ::close(fd); | 116 | ::close(fd); |
117 | } | 117 | } |
@@ -149,22 +149,22 @@ exit(1); | |||
149 | break; | 149 | break; |
150 | case 0: { | 150 | case 0: { |
151 | */ | 151 | */ |
152 | qDebug("Opening %s",dspstr); | 152 | odebug << "Opening " << dspstr << "" << oendl; |
153 | if (( sd = ::open( dspstr, flags)) == -1) { | 153 | if (( sd = ::open( dspstr, flags)) == -1) { |
154 | perror("open(\"/dev/dsp\")"); | 154 | perror("open(\"/dev/dsp\")"); |
155 | QString errorMsg="Could not open audio device\n /dev/dsp\n" | 155 | QString errorMsg="Could not open audio device\n /dev/dsp\n" |
156 | +(QString)strerror(errno); | 156 | +(QString)strerror(errno); |
157 | qDebug("XXXXXXXXXXXXXXXXXXXXXXX "+errorMsg); | 157 | odebug << "XXXXXXXXXXXXXXXXXXXXXXX "+errorMsg << oendl; |
158 | return -1; | 158 | return -1; |
159 | } | 159 | } |
160 | 160 | ||
161 | qDebug("Opening mixer"); | 161 | odebug << "Opening mixer" << oendl; |
162 | int mixerHandle=0; | 162 | int mixerHandle=0; |
163 | if (( mixerHandle = open("/dev/mixer",O_RDWR))<0) { | 163 | if (( mixerHandle = open("/dev/mixer",O_RDWR))<0) { |
164 | perror("open(\"/dev/mixer\")"); | 164 | perror("open(\"/dev/mixer\")"); |
165 | QString errorMsg="Could not open audio device\n /dev/dsp\n" | 165 | QString errorMsg="Could not open audio device\n /dev/dsp\n" |
166 | +(QString)strerror(errno); | 166 | +(QString)strerror(errno); |
167 | qDebug("XXXXXXXXXXXXXXXXXXXXXX "+errorMsg); | 167 | odebug << "XXXXXXXXXXXXXXXXXXXXXX "+errorMsg << oendl; |
168 | } | 168 | } |
169 | 169 | ||
170 | if(ioctl(sd,SNDCTL_DSP_RESET,0)<0){ | 170 | if(ioctl(sd,SNDCTL_DSP_RESET,0)<0){ |
@@ -180,7 +180,7 @@ qDebug("Opening mixer"); | |||
180 | /* close(pipefd[0]); | 180 | /* close(pipefd[0]); |
181 | write(pipefd[1], message, sizeof(message)); | 181 | write(pipefd[1], message, sizeof(message)); |
182 | close(pipefd[1]); | 182 | close(pipefd[1]); |
183 | // qDebug("%d",soundDevice->sd ); | 183 | // odebug << "" << soundDevice->sd << "" << oendl; |
184 | _exit(0); | 184 | _exit(0); |
185 | } | 185 | } |
186 | default: | 186 | default: |
@@ -206,13 +206,13 @@ qDebug("Opening mixer"); | |||
206 | */ | 206 | */ |
207 | // bool ok; | 207 | // bool ok; |
208 | // sd = s.toInt(&ok, 10); | 208 | // sd = s.toInt(&ok, 10); |
209 | // qDebug("<<<<<<<<<<<<<>>>>>>>>>>>>"+s); | 209 | // odebug << "<<<<<<<<<<<<<>>>>>>>>>>>>"+s << oendl; |
210 | 210 | ||
211 | // f2.close(); | 211 | // f2.close(); |
212 | // } | 212 | // } |
213 | ::close(mixerHandle ); | 213 | ::close(mixerHandle ); |
214 | // qDebug("open device %s", dspstr); | 214 | // odebug << "open device " << dspstr << "" << oendl; |
215 | // qDebug("success! %d",sd); | 215 | // odebug << "success! " << sd << "" << oendl; |
216 | return sd; | 216 | return sd; |
217 | } | 217 | } |
218 | 218 | ||
@@ -230,12 +230,12 @@ bool Device::closeDevice( bool) { | |||
230 | ::close( sd); //close sound device | 230 | ::close( sd); //close sound device |
231 | // sdfd=0; | 231 | // sdfd=0; |
232 | // sd=0; | 232 | // sd=0; |
233 | // qDebug("closed dsp"); | 233 | // odebug << "closed dsp" << oendl; |
234 | return true; | 234 | return true; |
235 | } | 235 | } |
236 | 236 | ||
237 | bool Device::setDeviceFormat( int form) { | 237 | bool Device::setDeviceFormat( int form) { |
238 | qDebug("set device res %d %d", form, sd); | 238 | odebug << "set device res " << form << " " << sd << "" << oendl; |
239 | if (ioctl( sd, SNDCTL_DSP_SETFMT, &form)==-1) { //set format | 239 | if (ioctl( sd, SNDCTL_DSP_SETFMT, &form)==-1) { //set format |
240 | perror("ioctl(\"SNDCTL_DSP_SETFMT\")"); | 240 | perror("ioctl(\"SNDCTL_DSP_SETFMT\")"); |
241 | return false; | 241 | return false; |
@@ -245,7 +245,7 @@ bool Device::setDeviceFormat( int form) { | |||
245 | } | 245 | } |
246 | 246 | ||
247 | bool Device::setDeviceChannels( int ch) { | 247 | bool Device::setDeviceChannels( int ch) { |
248 | qDebug("set channels %d %d", ch, sd); | 248 | odebug << "set channels " << ch << " " << sd << "" << oendl; |
249 | if (ioctl( sd, SNDCTL_DSP_CHANNELS, &ch)==-1) { | 249 | if (ioctl( sd, SNDCTL_DSP_CHANNELS, &ch)==-1) { |
250 | perror("ioctl(\"SNDCTL_DSP_CHANNELS\")"); | 250 | perror("ioctl(\"SNDCTL_DSP_CHANNELS\")"); |
251 | return false; | 251 | return false; |
@@ -255,7 +255,7 @@ bool Device::setDeviceChannels( int ch) { | |||
255 | } | 255 | } |
256 | 256 | ||
257 | bool Device::setDeviceRate( int rate) { | 257 | bool Device::setDeviceRate( int rate) { |
258 | qDebug("set rate %d %d", rate, sd); | 258 | odebug << "set rate " << rate << " " << sd << "" << oendl; |
259 | if (ioctl( sd, SNDCTL_DSP_SPEED, &rate) == -1) { | 259 | if (ioctl( sd, SNDCTL_DSP_SPEED, &rate) == -1) { |
260 | perror("ioctl(\"SNDCTL_DSP_SPEED\")"); | 260 | perror("ioctl(\"SNDCTL_DSP_SPEED\")"); |
261 | return false; | 261 | return false; |
@@ -318,9 +318,9 @@ int Device::getDeviceFragSize() { | |||
318 | int frag_size; | 318 | int frag_size; |
319 | 319 | ||
320 | if (ioctl( sd, SNDCTL_DSP_GETBLKSIZE, &frag_size) == -1) { | 320 | if (ioctl( sd, SNDCTL_DSP_GETBLKSIZE, &frag_size) == -1) { |
321 | qDebug("no fragsize"); | 321 | odebug << "no fragsize" << oendl; |
322 | } else { | 322 | } else { |
323 | qDebug("driver says frag size is %d", frag_size); | 323 | odebug << "driver says frag size is " << frag_size << "" << oendl; |
324 | } | 324 | } |
325 | return frag_size; | 325 | return frag_size; |
326 | } | 326 | } |