summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opierec/device.cpp
Unidiff
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 )
58 devRate = -1; 58 devRate = -1;
59 59
60 if( !record){ //playing 60 if( !record){ //playing
61 owarn << "setting up DSP for playing" << oendl; 61 owarn << "New Sound device DSP for playing" << oendl;
62 flags = O_WRONLY; 62 flags = O_RDWR;
63// flags = O_WRONLY;
63 } else { //recording 64 } else { //recording
64 owarn << "setting up DSP for recording" << oendl; 65 owarn << "New Sound device DSP for recording" << oendl;
65 flags = O_RDWR; 66 flags = O_RDWR;
66// flags = O_RDONLY; 67// flags = O_RDONLY;
67 selectMicInput(); 68 selectMicInput();
@@ -69,6 +70,7 @@ Device::Device( QObject * parent, bool record )
69} 70}
70 71
71bool Device::openDsp() { 72bool Device::openDsp() {
73 qWarning("Device::openDsp()");
72 if( openDevice( flags) == -1) { 74 if( openDevice( flags) == -1) {
73 perror("<<<<<<<<<<<<<<ioctl(\"Open device\")"); 75 perror("<<<<<<<<<<<<<<ioctl(\"Open device\")");
74 return false; 76 return false;
@@ -77,10 +79,10 @@ bool Device::openDsp() {
77} 79}
78 80
79int Device::openDevice( int flags) { 81int Device::openDevice( int flags) {
80 owarn << "Opening"<< dspstr; 82 owarn << "Opening sound device:"<< DSPSTROUT << oendl;
81 83
82 if (( sd = ::open( DSPSTROUT, flags)) == -1) { 84 if (( sd = ::open( DSPSTROUT, O_RDWR)) == -1) {
83 perror("open(\"/dev/dsp\")"); 85 perror("open(\"/dev/dsp\")\n");
84 QString errorMsg="Could not open audio device\n /dev/dsp\n" 86 QString errorMsg="Could not open audio device\n /dev/dsp\n"
85 +(QString)strerror(errno); 87 +(QString)strerror(errno);
86 qDebug( "XXXXXXXXXXXXXXXXXXXXXXX "+errorMsg ); 88 qDebug( "XXXXXXXXXXXXXXXXXXXXXXX "+errorMsg );
@@ -90,6 +92,7 @@ int Device::openDevice( int flags) {
90 if(ioctl(sd,SNDCTL_DSP_RESET,0)<0){ 92 if(ioctl(sd,SNDCTL_DSP_RESET,0)<0){
91 perror("ioctl RESET"); 93 perror("ioctl RESET");
92 } 94 }
95 qWarning("opened!");
93 return sd; 96 return sd;
94} 97}
95 98
@@ -150,6 +153,7 @@ bool Device::selectMicInput() {
150} 153}
151 154
152bool Device::closeDevice( bool) { 155bool Device::closeDevice( bool) {
156 if(sd)
153 ::close( sd); //close sound device 157 ::close( sd); //close sound device
154 return true; 158 return true;
155} 159}