summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opierec/device.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/noncore/multimedia/opierec/device.cpp b/noncore/multimedia/opierec/device.cpp
index 5319d97..db2d63f 100644
--- a/noncore/multimedia/opierec/device.cpp
+++ b/noncore/multimedia/opierec/device.cpp
@@ -25,18 +25,18 @@ Device::Device( QObject * parent, const char * dsp, const char * mixr, bool reco
: QObject( parent)
{
dspstr = (char *)dsp;
mixstr = (char *)mixr;
-
+
devForm=-1;
devCh=-1;
devRate=-1;
if( !record){ //playing
- odebug << "setting up DSP for playing" << oendl;
+ odebug << "setting up DSP for playing" << oendl;
flags = O_WRONLY;
} else { //recording
- odebug << "setting up DSP for recording" << oendl;
+ odebug << "setting up DSP for recording" << oendl;
flags = O_RDWR;
// flags = O_RDONLY;
// selectMicInput();
@@ -95,9 +95,9 @@ void Device::changedOutVolume(int vol) {
Config cfg("qpe");
cfg.setGroup("Volume");
cfg.writeEntry("VolumePercent", QString::number( vol ));
QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false;
- owarn << "changing output vol " << vol << "" << oendl;
+ owarn << "changing output vol " << vol << "" << oendl;
}
::close(fd);
}
@@ -110,9 +110,9 @@ void Device::changedInVolume(int vol ) {
Config cfg("qpe");
cfg.setGroup("Volume");
cfg.writeEntry("Mic", QString::number(vol ));
QCopEnvelope( "QPE/System", "micChange(bool)" ) << false;
- owarn << "changing input volume " << vol << "" << oendl;
+ owarn << "changing input volume " << vol << "" << oendl;
}
::close(fd);
}
@@ -148,24 +148,24 @@ exit(1);
perror("The fork failed!");
break;
case 0: {
*/
-odebug << "Opening " << dspstr << "" << oendl;
+odebug << "Opening " << dspstr << "" << oendl;
if (( sd = ::open( dspstr, flags)) == -1) {
perror("open(\"/dev/dsp\")");
QString errorMsg="Could not open audio device\n /dev/dsp\n"
+(QString)strerror(errno);
- odebug << "XXXXXXXXXXXXXXXXXXXXXXX "+errorMsg << oendl;
+ odebug << "XXXXXXXXXXXXXXXXXXXXXXX "+errorMsg << oendl;
return -1;
}
-odebug << "Opening mixer" << oendl;
+odebug << "Opening mixer" << oendl;
int mixerHandle=0;
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);
- odebug << "XXXXXXXXXXXXXXXXXXXXXX "+errorMsg << oendl;
+ odebug << "XXXXXXXXXXXXXXXXXXXXXX "+errorMsg << oendl;
}
if(ioctl(sd,SNDCTL_DSP_RESET,0)<0){
perror("ioctl RESET");
@@ -179,9 +179,9 @@ odebug << "Opening mixer" << oendl;
*/
/* close(pipefd[0]);
write(pipefd[1], message, sizeof(message));
close(pipefd[1]);
- // odebug << "" << soundDevice->sd << "" << oendl;
+ // odebug << "" << soundDevice->sd << "" << oendl;
_exit(0);
}
default:
// pid greater than zero is parent getting the child's pid
@@ -205,15 +205,15 @@ odebug << "Opening mixer" << oendl;
// }
*/
// bool ok;
// sd = s.toInt(&ok, 10);
-// odebug << "<<<<<<<<<<<<<>>>>>>>>>>>>"+s << oendl;
-
+// odebug << "<<<<<<<<<<<<<>>>>>>>>>>>>"+s << oendl;
+
// f2.close();
// }
::close(mixerHandle );
-// odebug << "open device " << dspstr << "" << oendl;
-// odebug << "success! " << sd << "" << oendl;
+// odebug << "open device " << dspstr << "" << oendl;
+// odebug << "success! " << sd << "" << oendl;
return sd;
}
bool Device::closeDevice( bool) {
@@ -229,14 +229,14 @@ bool Device::closeDevice( bool) {
::close( sd); //close sound device
// sdfd=0;
// sd=0;
-// odebug << "closed dsp" << oendl;
+// odebug << "closed dsp" << oendl;
return true;
}
bool Device::setDeviceFormat( int form) {
- odebug << "set device res " << form << " " << sd << "" << oendl;
+ odebug << "set device res " << form << " " << sd << "" << oendl;
if (ioctl( sd, SNDCTL_DSP_SETFMT, &form)==-1) { //set format
perror("ioctl(\"SNDCTL_DSP_SETFMT\")");
return false;
}
@@ -244,9 +244,9 @@ bool Device::setDeviceFormat( int form) {
return true;
}
bool Device::setDeviceChannels( int ch) {
- odebug << "set channels " << ch << " " << sd << "" << oendl;
+ odebug << "set channels " << ch << " " << sd << "" << oendl;
if (ioctl( sd, SNDCTL_DSP_CHANNELS, &ch)==-1) {
perror("ioctl(\"SNDCTL_DSP_CHANNELS\")");
return false;
}
@@ -254,9 +254,9 @@ bool Device::setDeviceChannels( int ch) {
return true;
}
bool Device::setDeviceRate( int rate) {
- odebug << "set rate " << rate << " " << sd << "" << oendl;
+ odebug << "set rate " << rate << " " << sd << "" << oendl;
if (ioctl( sd, SNDCTL_DSP_SPEED, &rate) == -1) {
perror("ioctl(\"SNDCTL_DSP_SPEED\")");
return false;
}
@@ -315,13 +315,13 @@ int Device::getDeviceChannels() {
}
int Device::getDeviceFragSize() {
int frag_size;
-
+
if (ioctl( sd, SNDCTL_DSP_GETBLKSIZE, &frag_size) == -1) {
- odebug << "no fragsize" << oendl;
+ odebug << "no fragsize" << oendl;
} else {
- odebug << "driver says frag size is " << frag_size << "" << oendl;
+ odebug << "driver says frag size is " << frag_size << "" << oendl;
}
return frag_size;
}
@@ -344,15 +344,15 @@ bool Device::reset() {
}
int Device::devRead(int soundDescriptor, short *buf, int size) {
int number = 0;
- number = ::read( soundDescriptor, (char *)buf, size);
+ number = ::read( sd /*soundDescriptor*/, (char *)buf, size);
return number;
}
int Device::devWrite(int soundDescriptor, short * buf, int size) {
int bytesWritten = 0;
- bytesWritten = ::write( soundDescriptor, buf, size);
+ bytesWritten = ::write( sd /*soundDescriptor*/, buf, size);
return bytesWritten;
}