author | llornkcor <llornkcor> | 2003-12-25 21:52:44 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-12-25 21:52:44 (UTC) |
commit | f2805565b0d7edd2e72445f6d56e43eadcdac72d (patch) (side-by-side diff) | |
tree | b9a74aec0c5616ae1976198c1f83945b697ed3d2 /noncore/multimedia/opierec/device.cpp | |
parent | 34a7e0451c95e8a19735610553dba064b68823d9 (diff) | |
download | opie-f2805565b0d7edd2e72445f6d56e43eadcdac72d.zip opie-f2805565b0d7edd2e72445f6d56e43eadcdac72d.tar.gz opie-f2805565b0d7edd2e72445f6d56e43eadcdac72d.tar.bz2 |
uhhh.. helps to commit to correct branch
Diffstat (limited to 'noncore/multimedia/opierec/device.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opierec/device.cpp | 59 |
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 @@ #include <qpe/qcopenvelope_qws.h> -#include <qpe/custom.h> + @@ -28,3 +28,3 @@ Device::Device( QObject * parent, const char * dsp, const char * mixr, bool reco mixstr = (char *)mixr; - + devForm=-1; @@ -40,3 +40,5 @@ Device::Device( QObject * parent, const char * dsp, const char * mixr, bool reco // flags = O_RDONLY; - selectMicInput(); + +// selectMicInput(); + } @@ -96,2 +98,3 @@ void Device::changedOutVolume(int vol) { QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false; + qWarning("changing output vol %d", vol); } @@ -110,2 +113,3 @@ void Device::changedInVolume(int vol ) { QCopEnvelope( "QPE/System", "micChange(bool)" ) << false; + qWarning("changing input volume %d", vol); } @@ -115,3 +119,3 @@ void Device::changedInVolume(int vol ) { bool Device::selectMicInput() { -/* + int md=0; @@ -128,3 +132,3 @@ bool Device::selectMicInput() { ::close(md); -*/ + return true; @@ -147,3 +151,4 @@ exit(1); */ - if (( sd = ::open( dspstr, flags)) == -1) { +qDebug("Opening %s",dspstr); + if (( sd = ::open( dspstr, flags)) == -1) { perror("open(\"/dev/dsp\")"); @@ -151,3 +156,3 @@ exit(1); +(QString)strerror(errno); - qDebug(errorMsg); + qDebug("XXXXXXXXXXXXXXXXXXXXXXX "+errorMsg); return -1; @@ -155,6 +160,9 @@ exit(1); +qDebug("Opening mixer"); int mixerHandle=0; - /* Set the input dsp device and its input gain the weird Zaurus way */ - if (( mixerHandle = open("/dev/mixer1",O_RDWR))<0) { - perror("open(\"/dev/mixer1\")"); + if (( mixerHandle = open("/dev/mixer",O_RDWR))<0) { + perror("open(\"/dev/mixer\")"); + QString errorMsg="Could not open audio device\n /dev/dsp\n" + +(QString)strerror(errno); + qDebug("XXXXXXXXXXXXXXXXXXXXXX "+errorMsg); } @@ -201,3 +209,3 @@ exit(1); // qDebug("<<<<<<<<<<<<<>>>>>>>>>>>>"+s); - + // f2.close(); @@ -205,4 +213,4 @@ exit(1); ::close(mixerHandle ); - qDebug("open device %s", dspstr); - qDebug("success! %d",sd); +// qDebug("open device %s", dspstr); +// qDebug("success! %d",sd); return sd; @@ -210,3 +218,3 @@ exit(1); -bool Device::closeDevice( bool b) { +bool Device::closeDevice( bool) { // if(b) {//close now @@ -224,3 +232,3 @@ bool Device::closeDevice( bool b) { // sd=0; - qDebug("closed dsp"); +// qDebug("closed dsp"); return true; @@ -292,3 +300,3 @@ int Device::getDeviceBits() { int dBits=0; -#if !defined(OPIE_NO_SOUND_PCM_READ_BITS) // zaurus doesnt have this +#ifndef QT_QWS_EBX // zaurus doesnt have this if (ioctl( sd, SOUND_PCM_READ_BITS, &dBits) == -1) { @@ -310,7 +318,8 @@ int Device::getDeviceFragSize() { int frag_size; - + if (ioctl( sd, SNDCTL_DSP_GETBLKSIZE, &frag_size) == -1) { qDebug("no fragsize"); - } else + } else { qDebug("driver says frag size is %d", frag_size); + } return frag_size; @@ -335 +344,15 @@ bool Device::reset() { } + +int Device::devRead(int soundDescriptor, short *buf, int size) { + int number = 0; + number = ::read( soundDescriptor, (char *)buf, size); + return number; +} + +int Device::devWrite(int soundDescriptor, short * buf, int size) { + int bytesWritten = 0; + bytesWritten = ::write( soundDescriptor, buf, size); + return bytesWritten; +} + + |