summaryrefslogtreecommitdiff
authorzecke <zecke>2003-10-07 13:02:55 (UTC)
committer zecke <zecke>2003-10-07 13:02:55 (UTC)
commit75f35445e9f3ec2f730f779d67f4189296bd9c5e (patch) (side-by-side diff)
tree58d137879aefe506af087f5a75e29f60b5aaae0a
parentd72a9cfe61cbc0910373e4604220021ebbcedaeb (diff)
downloadopie-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
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opierec/device.cpp4
1 files changed, 2 insertions, 2 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,71 +1,71 @@
// device.cpp
#include "device.h"
#include <qpe/config.h>
#include <qpe/qcopenvelope_qws.h>
-
+#include <qpe/custom.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/soundcard.h>
#include <unistd.h>
#include<sys/wait.h>
// #include <sys/stat.h>
// #include <sys/time.h>
// #include <sys/types.h>
#include <unistd.h>
#include <errno.h>
//extern QtRec *qperec;
Device::Device( QObject * parent, const char * dsp, const char * mixr, bool record )
: QObject( parent)
{
dspstr = (char *)dsp;
mixstr = (char *)mixr;
devForm=-1;
devCh=-1;
devRate=-1;
if( !record){ //playing
qDebug("setting up DSP for playing");
flags = O_WRONLY;
} else { //recording
qDebug("setting up DSP for recording");
flags = O_RDWR;
// flags = O_RDONLY;
selectMicInput();
}
}
bool Device::openDsp() {
if( openDevice( flags) == -1) {
perror("<<<<<<<<<<<<<<ioctl(\"Open device\")");
return false;
}
return true;
}
int Device::getOutVolume( ) {
unsigned int volume;
int mixerHandle = open( mixstr, O_RDWR );
if ( mixerHandle >= 0 ) {
if(ioctl( mixerHandle, MIXER_READ(SOUND_MIXER_VOLUME), &volume )==-1)
perror("<<<<<<<<<<<<<<ioctl(\"MIXER_READ\")");
::close( mixerHandle );
} else
perror("open(\"/dev/mixer\")");
printf("<<<<<<<<<<<<<<<<<<<<output volume %d\n",volume);
Config cfg("qpe");
cfg.setGroup("Volume");
return cfg.readNumEntry("VolumePercent");
}
int Device::getInVolume() {
unsigned int volume=0;
@@ -229,107 +229,107 @@ bool Device::closeDevice( bool b) {
bool Device::setDeviceFormat( int form) {
qDebug("set device res %d %d", form, sd);
if (ioctl( sd, SNDCTL_DSP_SETFMT, &form)==-1) { //set format
perror("ioctl(\"SNDCTL_DSP_SETFMT\")");
return false;
}
devRes=form;
return true;
}
bool Device::setDeviceChannels( int ch) {
qDebug("set channels %d %d", ch, sd);
if (ioctl( sd, SNDCTL_DSP_CHANNELS, &ch)==-1) {
perror("ioctl(\"SNDCTL_DSP_CHANNELS\")");
return false;
}
devCh=ch;
return true;
}
bool Device::setDeviceRate( int rate) {
qDebug("set rate %d %d", rate, sd);
if (ioctl( sd, SNDCTL_DSP_SPEED, &rate) == -1) {
perror("ioctl(\"SNDCTL_DSP_SPEED\")");
return false;
}
devRate=rate;
return true;
}
int Device::getRes() {
return devRes;
}
int Device::getFormat() {
return devForm;
}
int Device::getRate() {
return devRate;
}
int Device::getChannels() {
return devCh;
}
int Device::getDeviceFormat() {
return 0;
}
int Device::getDeviceRate() {
int dRate=0;
if (ioctl( sd, SOUND_PCM_READ_RATE, &dRate) == -1) {
perror("ioctl(\"SNDCTL_PCM_READ_RATE\")");
}
return dRate;
}
int Device::getDeviceBits() {
int dBits=0;
-#ifndef QT_QWS_EBX // zaurus doesnt have this
+#if !defined(OPIE_NO_SOUND_PCM_READ_BITS) // zaurus doesnt have this
if (ioctl( sd, SOUND_PCM_READ_BITS, &dBits) == -1) {
perror("ioctl(\"SNDCTL_PCM_READ_BITS\")");
}
#endif
return dBits;
}
int Device::getDeviceChannels() {
int dCh=0;
if (ioctl( sd, SOUND_PCM_READ_CHANNELS, &dCh) == -1) {
perror("ioctl(\"SNDCTL_PCM_READ_CHANNELS\")");
}
return dCh;
}
int Device::getDeviceFragSize() {
int frag_size;
if (ioctl( sd, SNDCTL_DSP_GETBLKSIZE, &frag_size) == -1) {
qDebug("no fragsize");
} else
qDebug("driver says frag size is %d", frag_size);
return frag_size;
}
bool Device::setFragSize(int frag) {
if (ioctl(sd, SNDCTL_DSP_SETFRAGMENT, &frag)) {
perror("ioctl(\"SNDCTL_DSP_SETFRAGMENT\")");
return false;
}
return true;
}
bool Device::reset() {
closeDevice(true);
openDsp();
if (ioctl( sd, SNDCTL_DSP_RESET, 0) == -1) {
perror("ioctl(\"SNDCTL_DSP_RESET\")");
return false;
}
return true;
}