summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opierec/device.cpp
Unidiff
Diffstat (limited to 'noncore/multimedia/opierec/device.cpp') (more/less context) (show 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
@@ -55,44 +55,47 @@ Device::Device( QObject * parent, bool record )
55// dspstr = dsp; 55// dspstr = dsp;
56 devForm = -1; 56 devForm = -1;
57 devCh = -1; 57 devCh = -1;
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();
68 } 69 }
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;
75 } 77 }
76 return true; 78 return true;
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 );
87 return -1; 89 return -1;
88 } 90 }
89 91
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
96int Device::getInVolume() { 99int Device::getInVolume() {
97 unsigned int volume = 0; 100 unsigned int volume = 0;
98 Config cfg("qpe"); 101 Config cfg("qpe");
@@ -147,12 +150,13 @@ bool Device::selectMicInput() {
147 ::close(md); 150 ::close(md);
148 151
149 return true; 152 return true;
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}
156 160
157bool Device::setDeviceFormat( int form) { 161bool Device::setDeviceFormat( int form) {
158 qDebug( "set device res %d: %d ",form, sd ); 162 qDebug( "set device res %d: %d ",form, sd );