summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2004-08-06 19:03:36 (UTC)
committer llornkcor <llornkcor>2004-08-06 19:03:36 (UTC)
commit5e10278e748608766245ff9f59a54d1ae8ff6f7e (patch) (side-by-side diff)
treeca01e05ff77f7b80209deba47c93be48d20d8df2
parent75675815cb051e14bf8ad50c4069338bfa83eed1 (diff)
downloadopie-5e10278e748608766245ff9f59a54d1ae8ff6f7e.zip
opie-5e10278e748608766245ff9f59a54d1ae8ff6f7e.tar.gz
opie-5e10278e748608766245ff9f59a54d1ae8ff6f7e.tar.bz2
no warnings
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opierec/device.cpp190
1 files changed, 95 insertions, 95 deletions
diff --git a/noncore/multimedia/opierec/device.cpp b/noncore/multimedia/opierec/device.cpp
index db2d63f..683f0a5 100644
--- a/noncore/multimedia/opierec/device.cpp
+++ b/noncore/multimedia/opierec/device.cpp
@@ -4,7 +4,4 @@
-/* OPIE */
-#include <opie2/odebug.h>
#include <qpe/config.h>
#include <qpe/qcopenvelope_qws.h>
-using namespace Opie::Core;
@@ -34,6 +31,6 @@ Device::Device( QObject * parent, const char * dsp, const char * mixr, bool reco
if( !record){ //playing
- odebug << "setting up DSP for playing" << oendl;
+ qDebug( "setting up DSP for playing" );
flags = O_WRONLY;
} else { //recording
- odebug << "setting up DSP for recording" << oendl;
+ qDebug( "setting up DSP for recording" );
flags = O_RDWR;
@@ -54,2 +51,85 @@ bool Device::openDsp() {
+int Device::openDevice( int flags) {
+/* pid_t pid;
+ int status;
+ int pipefd[2];
+ char message[20];
+ if (pipe(pipefd) == -1){
+ perror ("Error creating pipe");
+exit(1);
+ }
+ switch (pid = fork()) {
+ case -1:
+ perror("The fork failed!");
+ break;
+ case 0: {
+ */
+qDebug( "Opening %s",dspstr);
+ if (( sd = ::open( dspstr, flags)) == -1) {
+ perror("open(\"/dev/dsp\")");
+ QString errorMsg="Could not open audio device\n /dev/dsp\n"
+ +(QString)strerror(errno);
+ qDebug( "XXXXXXXXXXXXXXXXXXXXXXX "+errorMsg );
+ return -1;
+ }
+
+qDebug( "Opening mixer" );
+ 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);
+ qDebug( "XXXXXXXXXXXXXXXXXXXXXX "+errorMsg );
+ }
+
+ if(ioctl(sd,SNDCTL_DSP_RESET,0)<0){
+ perror("ioctl RESET");
+ }
+// sprintf(message, "%d", sd);
+
+/* QFile f1("/pid");
+ f1.open(IO_WriteOnly );
+ f1.writeBlock(message, strlen(message));
+ f1.close();
+ */
+ /* close(pipefd[0]);
+ write(pipefd[1], message, sizeof(message));
+ close(pipefd[1]);
+ // qDebug( "" + soundDevice->sd );
+ _exit(0);
+ }
+ default:
+ // pid greater than zero is parent getting the child's pid
+ printf("Child's pid is %d\n",pid);
+ QString s;
+ close(pipefd[1]);
+ read(pipefd[0], message, sizeof(message));
+ s = message;
+ close(pipefd[0]);
+
+// while(wait(NULL)!=pid)
+ // ;
+ printf("child %ld terminated normally, return status is zero\n", (long) pid);
+ */
+ // filePara.sd=(long) pid;
+ /* QFile f2("/pid");
+ f2.open(IO_ReadOnly);
+ QTextStream t(&f2);
+ // for(int f=0; f < t.atEnd() ;f++) {
+ s = t.readLine();
+ // }
+ */
+// bool ok;
+// sd = s.toInt(&ok, 10);
+// qDebug( "<<<<<<<<<<<<<>>>>>>>>>>>>"+s );
+
+// f2.close();
+// }
+::close(mixerHandle );
+// qDebug( "open device " + dspstr );
+// qDebug( "success! " + sd );
+ return sd;
+}
+
+
int Device::getOutVolume( ) {
@@ -98,3 +178,3 @@ void Device::changedOutVolume(int vol) {
QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false;
- owarn << "changing output vol " << vol << "" << oendl;
+ qDebug("changing output vol %d" ,vol );
}
@@ -113,3 +193,3 @@ void Device::changedInVolume(int vol ) {
QCopEnvelope( "QPE/System", "micChange(bool)" ) << false;
- owarn << "changing input volume " << vol << "" << oendl;
+ qDebug("changing input volume %d",vol);
}
@@ -136,84 +216,2 @@ bool Device::selectMicInput() {
-int Device::openDevice( int flags) {
-/* pid_t pid;
- int status;
- int pipefd[2];
- char message[20];
- if (pipe(pipefd) == -1){
- perror ("Error creating pipe");
-exit(1);
- }
- switch (pid = fork()) {
- case -1:
- perror("The fork failed!");
- break;
- case 0: {
- */
-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;
- return -1;
- }
-
-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;
- }
-
- if(ioctl(sd,SNDCTL_DSP_RESET,0)<0){
- perror("ioctl RESET");
- }
-// sprintf(message, "%d", sd);
-
-/* QFile f1("/pid");
- f1.open(IO_WriteOnly );
- f1.writeBlock(message, strlen(message));
- f1.close();
- */
- /* close(pipefd[0]);
- write(pipefd[1], message, sizeof(message));
- close(pipefd[1]);
- // odebug << "" << soundDevice->sd << "" << oendl;
- _exit(0);
- }
- default:
- // pid greater than zero is parent getting the child's pid
- printf("Child's pid is %d\n",pid);
- QString s;
- close(pipefd[1]);
- read(pipefd[0], message, sizeof(message));
- s = message;
- close(pipefd[0]);
-
-// while(wait(NULL)!=pid)
- // ;
- printf("child %ld terminated normally, return status is zero\n", (long) pid);
- */
- // filePara.sd=(long) pid;
- /* QFile f2("/pid");
- f2.open(IO_ReadOnly);
- QTextStream t(&f2);
- // for(int f=0; f < t.atEnd() ;f++) {
- s = t.readLine();
- // }
- */
-// bool ok;
-// sd = s.toInt(&ok, 10);
-// odebug << "<<<<<<<<<<<<<>>>>>>>>>>>>"+s << oendl;
-
-// f2.close();
-// }
-::close(mixerHandle );
-// odebug << "open device " << dspstr << "" << oendl;
-// odebug << "success! " << sd << "" << oendl;
- return sd;
-}
-
bool Device::closeDevice( bool) {
@@ -232,3 +230,3 @@ bool Device::closeDevice( bool) {
// sd=0;
-// odebug << "closed dsp" << oendl;
+// qDebug( "closed dsp" );
return true;
@@ -237,3 +235,3 @@ bool Device::closeDevice( bool) {
bool Device::setDeviceFormat( int form) {
- odebug << "set device res " << form << " " << sd << "" << oendl;
+ qDebug( "set device res %d: %d ",form, sd );
if (ioctl( sd, SNDCTL_DSP_SETFMT, &form)==-1) { //set format
@@ -247,3 +245,3 @@ bool Device::setDeviceFormat( int form) {
bool Device::setDeviceChannels( int ch) {
- odebug << "set channels " << ch << " " << sd << "" << oendl;
+ qDebug( "set channels %d: %d",ch ,sd);
if (ioctl( sd, SNDCTL_DSP_CHANNELS, &ch)==-1) {
@@ -257,3 +255,3 @@ bool Device::setDeviceChannels( int ch) {
bool Device::setDeviceRate( int rate) {
- odebug << "set rate " << rate << " " << sd << "" << oendl;
+ qDebug( "set rate %d: %d",rate,sd);
if (ioctl( sd, SNDCTL_DSP_SPEED, &rate) == -1) {
@@ -320,5 +318,5 @@ int Device::getDeviceFragSize() {
if (ioctl( sd, SNDCTL_DSP_GETBLKSIZE, &frag_size) == -1) {
- odebug << "no fragsize" << oendl;
+ qDebug( "no fragsize" );
} else {
- odebug << "driver says frag size is " << frag_size << "" << oendl;
+ qDebug( "driver says frag size is %d",frag_size);
}
@@ -346,2 +344,3 @@ bool Device::reset() {
int Device::devRead(int soundDescriptor, short *buf, int size) {
+ Q_UNUSED(soundDescriptor);
int number = 0;
@@ -352,2 +351,3 @@ int Device::devRead(int soundDescriptor, short *buf, int size) {
int Device::devWrite(int soundDescriptor, short * buf, int size) {
+ Q_UNUSED(soundDescriptor);
int bytesWritten = 0;