summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opierec/device.cpp
Unidiff
Diffstat (limited to 'noncore/multimedia/opierec/device.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opierec/device.cpp59
1 files changed, 41 insertions, 18 deletions
diff --git a/noncore/multimedia/opierec/device.cpp b/noncore/multimedia/opierec/device.cpp
index 11071d8..ce49e96 100644
--- a/noncore/multimedia/opierec/device.cpp
+++ b/noncore/multimedia/opierec/device.cpp
@@ -6,3 +6,3 @@
6#include <qpe/qcopenvelope_qws.h> 6#include <qpe/qcopenvelope_qws.h>
7#include <qpe/custom.h> 7
8 8
@@ -28,3 +28,3 @@ Device::Device( QObject * parent, const char * dsp, const char * mixr, bool reco
28 mixstr = (char *)mixr; 28 mixstr = (char *)mixr;
29 29
30 devForm=-1; 30 devForm=-1;
@@ -40,3 +40,5 @@ Device::Device( QObject * parent, const char * dsp, const char * mixr, bool reco
40// flags = O_RDONLY; 40// flags = O_RDONLY;
41 selectMicInput(); 41
42// selectMicInput();
43
42 } 44 }
@@ -96,2 +98,3 @@ void Device::changedOutVolume(int vol) {
96 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false; 98 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false;
99 qWarning("changing output vol %d", vol);
97 } 100 }
@@ -110,2 +113,3 @@ void Device::changedInVolume(int vol ) {
110 QCopEnvelope( "QPE/System", "micChange(bool)" ) << false; 113 QCopEnvelope( "QPE/System", "micChange(bool)" ) << false;
114 qWarning("changing input volume %d", vol);
111 } 115 }
@@ -115,3 +119,3 @@ void Device::changedInVolume(int vol ) {
115bool Device::selectMicInput() { 119bool Device::selectMicInput() {
116/* 120
117 int md=0; 121 int md=0;
@@ -128,3 +132,3 @@ bool Device::selectMicInput() {
128 ::close(md); 132 ::close(md);
129*/ 133
130 return true; 134 return true;
@@ -147,3 +151,4 @@ exit(1);
147 */ 151 */
148 if (( sd = ::open( dspstr, flags)) == -1) { 152qDebug("Opening %s",dspstr);
153 if (( sd = ::open( dspstr, flags)) == -1) {
149 perror("open(\"/dev/dsp\")"); 154 perror("open(\"/dev/dsp\")");
@@ -151,3 +156,3 @@ exit(1);
151 +(QString)strerror(errno); 156 +(QString)strerror(errno);
152 qDebug(errorMsg); 157 qDebug("XXXXXXXXXXXXXXXXXXXXXXX "+errorMsg);
153 return -1; 158 return -1;
@@ -155,6 +160,9 @@ exit(1);
155 160
161qDebug("Opening mixer");
156 int mixerHandle=0; 162 int mixerHandle=0;
157 /* Set the input dsp device and its input gain the weird Zaurus way */ 163 if (( mixerHandle = open("/dev/mixer",O_RDWR))<0) {
158 if (( mixerHandle = open("/dev/mixer1",O_RDWR))<0) { 164 perror("open(\"/dev/mixer\")");
159 perror("open(\"/dev/mixer1\")"); 165 QString errorMsg="Could not open audio device\n /dev/dsp\n"
166 +(QString)strerror(errno);
167 qDebug("XXXXXXXXXXXXXXXXXXXXXX "+errorMsg);
160 } 168 }
@@ -201,3 +209,3 @@ exit(1);
201// qDebug("<<<<<<<<<<<<<>>>>>>>>>>>>"+s); 209// qDebug("<<<<<<<<<<<<<>>>>>>>>>>>>"+s);
202 210
203// f2.close(); 211// f2.close();
@@ -205,4 +213,4 @@ exit(1);
205::close(mixerHandle ); 213::close(mixerHandle );
206 qDebug("open device %s", dspstr); 214// qDebug("open device %s", dspstr);
207 qDebug("success! %d",sd); 215// qDebug("success! %d",sd);
208 return sd; 216 return sd;
@@ -210,3 +218,3 @@ exit(1);
210 218
211bool Device::closeDevice( bool b) { 219bool Device::closeDevice( bool) {
212// if(b) {//close now 220// if(b) {//close now
@@ -224,3 +232,3 @@ bool Device::closeDevice( bool b) {
224 // sd=0; 232 // sd=0;
225 qDebug("closed dsp"); 233// qDebug("closed dsp");
226 return true; 234 return true;
@@ -292,3 +300,3 @@ int Device::getDeviceBits() {
292 int dBits=0; 300 int dBits=0;
293#if !defined(OPIE_NO_SOUND_PCM_READ_BITS) // zaurus doesnt have this 301#ifndef QT_QWS_EBX // zaurus doesnt have this
294 if (ioctl( sd, SOUND_PCM_READ_BITS, &dBits) == -1) { 302 if (ioctl( sd, SOUND_PCM_READ_BITS, &dBits) == -1) {
@@ -310,7 +318,8 @@ int Device::getDeviceFragSize() {
310 int frag_size; 318 int frag_size;
311 319
312 if (ioctl( sd, SNDCTL_DSP_GETBLKSIZE, &frag_size) == -1) { 320 if (ioctl( sd, SNDCTL_DSP_GETBLKSIZE, &frag_size) == -1) {
313 qDebug("no fragsize"); 321 qDebug("no fragsize");
314 } else 322 } else {
315 qDebug("driver says frag size is %d", frag_size); 323 qDebug("driver says frag size is %d", frag_size);
324 }
316 return frag_size; 325 return frag_size;
@@ -335 +344,15 @@ bool Device::reset() {
335} 344}
345
346int Device::devRead(int soundDescriptor, short *buf, int size) {
347 int number = 0;
348 number = ::read( soundDescriptor, (char *)buf, size);
349 return number;
350}
351
352int Device::devWrite(int soundDescriptor, short * buf, int size) {
353 int bytesWritten = 0;
354 bytesWritten = ::write( soundDescriptor, buf, size);
355 return bytesWritten;
356}
357
358