author | llornkcor <llornkcor> | 2005-03-12 01:54:52 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2005-03-12 01:54:52 (UTC) |
commit | 84af289057291a49a52a60b390bc5320c02b5a55 (patch) (unidiff) | |
tree | 523f2d36240efd4f500bfbc35996771bebd7360d /noncore/multimedia/opierec/device.cpp | |
parent | 6b67c3b2685b2d3f1bc7a787216aa769d4ea257a (diff) | |
download | opie-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) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opierec/device.cpp | 16 |
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 | ||
71 | bool Device::openDsp() { | 72 | bool 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 | ||
79 | int Device::openDevice( int flags) { | 81 | int 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 | ||
96 | int Device::getInVolume() { | 99 | int 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 | ||
152 | bool Device::closeDevice( bool) { | 155 | bool 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 | ||
157 | bool Device::setDeviceFormat( int form) { | 161 | bool Device::setDeviceFormat( int form) { |
158 | qDebug( "set device res %d: %d ",form, sd ); | 162 | qDebug( "set device res %d: %d ",form, sd ); |