summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opierec/device.cpp
authorllornkcor <llornkcor>2005-03-12 01:54:52 (UTC)
committer llornkcor <llornkcor>2005-03-12 01:54:52 (UTC)
commit84af289057291a49a52a60b390bc5320c02b5a55 (patch) (side-by-side diff)
tree523f2d36240efd4f500bfbc35996771bebd7360d /noncore/multimedia/opierec/device.cpp
parent6b67c3b2685b2d3f1bc7a787216aa769d4ea257a (diff)
downloadopie-84af289057291a49a52a60b390bc5320c02b5a55.zip
opie-84af289057291a49a52a60b390bc5320c02b5a55.tar.gz
opie-84af289057291a49a52a60b390bc5320c02b5a55.tar.bz2
fix irregularity with adpcm and bits
Diffstat (limited to 'noncore/multimedia/opierec/device.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opierec/device.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/noncore/multimedia/opierec/device.cpp b/noncore/multimedia/opierec/device.cpp
index e7e0f4b..a76665e 100644
--- a/noncore/multimedia/opierec/device.cpp
+++ b/noncore/multimedia/opierec/device.cpp
@@ -58,10 +58,11 @@ Device::Device( QObject * parent, bool record )
devRate = -1;
if( !record){ //playing
- owarn << "setting up DSP for playing" << oendl;
- flags = O_WRONLY;
+ owarn << "New Sound device DSP for playing" << oendl;
+ flags = O_RDWR;
+// flags = O_WRONLY;
} else { //recording
- owarn << "setting up DSP for recording" << oendl;
+ owarn << "New Sound device DSP for recording" << oendl;
flags = O_RDWR;
// flags = O_RDONLY;
selectMicInput();
@@ -69,6 +70,7 @@ Device::Device( QObject * parent, bool record )
}
bool Device::openDsp() {
+ qWarning("Device::openDsp()");
if( openDevice( flags) == -1) {
perror("<<<<<<<<<<<<<<ioctl(\"Open device\")");
return false;
@@ -77,10 +79,10 @@ bool Device::openDsp() {
}
int Device::openDevice( int flags) {
- owarn << "Opening"<< dspstr;
+ owarn << "Opening sound device:"<< DSPSTROUT << oendl;
- if (( sd = ::open( DSPSTROUT, flags)) == -1) {
- perror("open(\"/dev/dsp\")");
+ if (( sd = ::open( DSPSTROUT, O_RDWR)) == -1) {
+ perror("open(\"/dev/dsp\")\n");
QString errorMsg="Could not open audio device\n /dev/dsp\n"
+(QString)strerror(errno);
qDebug( "XXXXXXXXXXXXXXXXXXXXXXX "+errorMsg );
@@ -90,6 +92,7 @@ int Device::openDevice( int flags) {
if(ioctl(sd,SNDCTL_DSP_RESET,0)<0){
perror("ioctl RESET");
}
+ qWarning("opened!");
return sd;
}
@@ -150,6 +153,7 @@ bool Device::selectMicInput() {
}
bool Device::closeDevice( bool) {
+ if(sd)
::close( sd); //close sound device
return true;
}