author | schurig <schurig> | 2004-09-10 12:34:40 (UTC) |
---|---|---|
committer | schurig <schurig> | 2004-09-10 12:34:40 (UTC) |
commit | 85928a3781d9a91b58ea414c0d7982459cc21920 (patch) (unidiff) | |
tree | 10aeedf3a79fe2372c55bda730b6913b5562231b | |
parent | 9d0ccc1c5ca687bc017b2b515a9d3a47e98ce521 (diff) | |
download | opie-85928a3781d9a91b58ea414c0d7982459cc21920.zip opie-85928a3781d9a91b58ea414c0d7982459cc21920.tar.gz opie-85928a3781d9a91b58ea414c0d7982459cc21920.tar.bz2 |
support for DEVFS
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 4 | ||||
-rw-r--r-- | noncore/multimedia/opierec/device.cpp | 16 | ||||
-rw-r--r-- | noncore/multimedia/opierec/qtrec.cpp | 7 |
3 files changed, 27 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 7b4bfd9..e6afbd8 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -272,25 +272,29 @@ void MediaPlayer::timerEvent( QTimerEvent * ) { | |||
272 | for ( unsigned int i = 0; i < 10; i++ ) { | 272 | for ( unsigned int i = 0; i < 10; i++ ) { |
273 | if ( v > i ) { | 273 | if ( v > i ) { |
274 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | 274 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); |
275 | } else { | 275 | } else { |
276 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | 276 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); |
277 | } | 277 | } |
278 | } | 278 | } |
279 | } | 279 | } |
280 | } | 280 | } |
281 | 281 | ||
282 | 282 | ||
283 | void MediaPlayer::blank( bool b ) { | 283 | void MediaPlayer::blank( bool b ) { |
284 | #ifdef QT_QWS_DEVFS | ||
285 | fd=open("/dev/fb/0",O_RDWR); | ||
286 | #else | ||
284 | fd=open("/dev/fb0",O_RDWR); | 287 | fd=open("/dev/fb0",O_RDWR); |
288 | #endif | ||
285 | #ifdef QT_QWS_SL5XXX | 289 | #ifdef QT_QWS_SL5XXX |
286 | fl= open( "/dev/fl", O_RDWR ); | 290 | fl= open( "/dev/fl", O_RDWR ); |
287 | #endif | 291 | #endif |
288 | if (fd != -1) { | 292 | if (fd != -1) { |
289 | if ( b ) { | 293 | if ( b ) { |
290 | odebug << "do blanking" << oendl; | 294 | odebug << "do blanking" << oendl; |
291 | #ifdef QT_QWS_SL5XXX | 295 | #ifdef QT_QWS_SL5XXX |
292 | ioctl( fd, FBIOBLANK, 1 ); | 296 | ioctl( fd, FBIOBLANK, 1 ); |
293 | if(fl !=-1) { | 297 | if(fl !=-1) { |
294 | ioctl( fl, 2 ); | 298 | ioctl( fl, 2 ); |
295 | ::close(fl); | 299 | ::close(fl); |
296 | } | 300 | } |
diff --git a/noncore/multimedia/opierec/device.cpp b/noncore/multimedia/opierec/device.cpp index 683f0a5..cb47b77 100644 --- a/noncore/multimedia/opierec/device.cpp +++ b/noncore/multimedia/opierec/device.cpp | |||
@@ -66,25 +66,29 @@ exit(1); | |||
66 | */ | 66 | */ |
67 | qDebug( "Opening %s",dspstr); | 67 | qDebug( "Opening %s",dspstr); |
68 | if (( sd = ::open( dspstr, flags)) == -1) { | 68 | if (( sd = ::open( dspstr, flags)) == -1) { |
69 | perror("open(\"/dev/dsp\")"); | 69 | perror("open(\"/dev/dsp\")"); |
70 | QString errorMsg="Could not open audio device\n /dev/dsp\n" | 70 | QString errorMsg="Could not open audio device\n /dev/dsp\n" |
71 | +(QString)strerror(errno); | 71 | +(QString)strerror(errno); |
72 | qDebug( "XXXXXXXXXXXXXXXXXXXXXXX "+errorMsg ); | 72 | qDebug( "XXXXXXXXXXXXXXXXXXXXXXX "+errorMsg ); |
73 | return -1; | 73 | return -1; |
74 | } | 74 | } |
75 | 75 | ||
76 | qDebug( "Opening mixer" ); | 76 | qDebug( "Opening mixer" ); |
77 | int mixerHandle=0; | 77 | int mixerHandle=0; |
78 | #ifdef QT_QWS_DEVFS | ||
79 | if (( mixerHandle = open("/dev/sound/mixer",O_RDWR))<0) { | ||
80 | #else | ||
78 | if (( mixerHandle = open("/dev/mixer",O_RDWR))<0) { | 81 | if (( mixerHandle = open("/dev/mixer",O_RDWR))<0) { |
82 | #endif | ||
79 | perror("open(\"/dev/mixer\")"); | 83 | perror("open(\"/dev/mixer\")"); |
80 | QString errorMsg="Could not open audio device\n /dev/dsp\n" | 84 | QString errorMsg="Could not open audio device\n /dev/dsp\n" |
81 | +(QString)strerror(errno); | 85 | +(QString)strerror(errno); |
82 | qDebug( "XXXXXXXXXXXXXXXXXXXXXX "+errorMsg ); | 86 | qDebug( "XXXXXXXXXXXXXXXXXXXXXX "+errorMsg ); |
83 | } | 87 | } |
84 | 88 | ||
85 | if(ioctl(sd,SNDCTL_DSP_RESET,0)<0){ | 89 | if(ioctl(sd,SNDCTL_DSP_RESET,0)<0){ |
86 | perror("ioctl RESET"); | 90 | perror("ioctl RESET"); |
87 | } | 91 | } |
88 | // sprintf(message, "%d", sd); | 92 | // sprintf(message, "%d", sd); |
89 | 93 | ||
90 | /* QFile f1("/pid"); | 94 | /* QFile f1("/pid"); |
@@ -159,57 +163,69 @@ int Device::getInVolume() { | |||
159 | } else | 163 | } else |
160 | perror("open(\"/dev/mixer\")"); | 164 | perror("open(\"/dev/mixer\")"); |
161 | printf("<<<<<<<<<<<<<<input volume %d\n", volume ); | 165 | printf("<<<<<<<<<<<<<<input volume %d\n", volume ); |
162 | Config cfg("qpe"); | 166 | Config cfg("qpe"); |
163 | cfg.setGroup("Volume"); | 167 | cfg.setGroup("Volume"); |
164 | 168 | ||
165 | return cfg.readNumEntry("Mic"); | 169 | return cfg.readNumEntry("Mic"); |
166 | } | 170 | } |
167 | 171 | ||
168 | void Device::changedOutVolume(int vol) { | 172 | void Device::changedOutVolume(int vol) { |
169 | int level = (vol << 8) + vol; | 173 | int level = (vol << 8) + vol; |
170 | int fd = 0; | 174 | int fd = 0; |
175 | #ifdef QT_QWS_DEVFS | ||
176 | if ((fd = open("/dev/sound/mixer", O_RDWR))>=0) { | ||
177 | #else | ||
171 | if ((fd = open("/dev/mixer", O_RDWR))>=0) { | 178 | if ((fd = open("/dev/mixer", O_RDWR))>=0) { |
179 | #endif | ||
172 | if(ioctl(fd, MIXER_WRITE(SOUND_MIXER_VOLUME), &level) == -1) | 180 | if(ioctl(fd, MIXER_WRITE(SOUND_MIXER_VOLUME), &level) == -1) |
173 | perror("ioctl(\"MIXER_IN_WRITE\")"); | 181 | perror("ioctl(\"MIXER_IN_WRITE\")"); |
174 | 182 | ||
175 | Config cfg("qpe"); | 183 | Config cfg("qpe"); |
176 | cfg.setGroup("Volume"); | 184 | cfg.setGroup("Volume"); |
177 | cfg.writeEntry("VolumePercent", QString::number( vol )); | 185 | cfg.writeEntry("VolumePercent", QString::number( vol )); |
178 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false; | 186 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false; |
179 | qDebug("changing output vol %d" ,vol ); | 187 | qDebug("changing output vol %d" ,vol ); |
180 | } | 188 | } |
181 | ::close(fd); | 189 | ::close(fd); |
182 | } | 190 | } |
183 | 191 | ||
184 | void Device::changedInVolume(int vol ) { | 192 | void Device::changedInVolume(int vol ) { |
185 | int level = (vol << 8) + vol; | 193 | int level = (vol << 8) + vol; |
186 | int fd = 0; | 194 | int fd = 0; |
195 | #ifdef QT_QWS_DEVFS | ||
196 | if ((fd = open("/dev/sound/mixer", O_RDWR))>=0) { | ||
197 | #else | ||
187 | if ((fd = open("/dev/mixer", O_RDWR))>=0) { | 198 | if ((fd = open("/dev/mixer", O_RDWR))>=0) { |
199 | #endif | ||
188 | if(ioctl(fd, MIXER_WRITE(SOUND_MIXER_MIC), &level) == -1) | 200 | if(ioctl(fd, MIXER_WRITE(SOUND_MIXER_MIC), &level) == -1) |
189 | perror("ioctl(\"MIXER_IN_WRITE\")"); | 201 | perror("ioctl(\"MIXER_IN_WRITE\")"); |
190 | Config cfg("qpe"); | 202 | Config cfg("qpe"); |
191 | cfg.setGroup("Volume"); | 203 | cfg.setGroup("Volume"); |
192 | cfg.writeEntry("Mic", QString::number(vol )); | 204 | cfg.writeEntry("Mic", QString::number(vol )); |
193 | QCopEnvelope( "QPE/System", "micChange(bool)" ) << false; | 205 | QCopEnvelope( "QPE/System", "micChange(bool)" ) << false; |
194 | qDebug("changing input volume %d",vol); | 206 | qDebug("changing input volume %d",vol); |
195 | } | 207 | } |
196 | ::close(fd); | 208 | ::close(fd); |
197 | } | 209 | } |
198 | 210 | ||
199 | bool Device::selectMicInput() { | 211 | bool Device::selectMicInput() { |
200 | 212 | ||
201 | int md=0; | 213 | int md=0; |
202 | int info=MIXER_WRITE(SOUND_MIXER_MIC); | 214 | int info=MIXER_WRITE(SOUND_MIXER_MIC); |
215 | #ifdef QT_QWS_DEVFS | ||
216 | md = ::open( "/dev/sound/mixer", O_RDWR ); | ||
217 | #else | ||
203 | md = ::open( "/dev/mixer", O_RDWR ); | 218 | md = ::open( "/dev/mixer", O_RDWR ); |
219 | #endif | ||
204 | if ( md == -1) | 220 | if ( md == -1) |
205 | perror("open(\"/dev/mixer\")"); | 221 | perror("open(\"/dev/mixer\")"); |
206 | else { | 222 | else { |
207 | if( ioctl( md, SOUND_MIXER_WRITE_RECSRC, &info) == -1) | 223 | if( ioctl( md, SOUND_MIXER_WRITE_RECSRC, &info) == -1) |
208 | perror("ioctl(\"SOUND_MIXER_WRITE_RECSRC\")"); | 224 | perror("ioctl(\"SOUND_MIXER_WRITE_RECSRC\")"); |
209 | ::close(md); | 225 | ::close(md); |
210 | return false; | 226 | return false; |
211 | } | 227 | } |
212 | ::close(md); | 228 | ::close(md); |
213 | 229 | ||
214 | return true; | 230 | return true; |
215 | } | 231 | } |
diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp index 1141faa..c237726 100644 --- a/noncore/multimedia/opierec/qtrec.cpp +++ b/noncore/multimedia/opierec/qtrec.cpp | |||
@@ -70,28 +70,35 @@ static int deviceBitRates[] = { 8, 16, -1 }; | |||
70 | #define DSPSTRMIXEROUT "/dev/mixer" | 70 | #define DSPSTRMIXEROUT "/dev/mixer" |
71 | 71 | ||
72 | #ifdef SHARP | 72 | #ifdef SHARP |
73 | #define DSPSTRIN "/dev/dsp1" | 73 | #define DSPSTRIN "/dev/dsp1" |
74 | #define DSPSTRMIXERIN "/dev/mixer1" | 74 | #define DSPSTRMIXERIN "/dev/mixer1" |
75 | #else | 75 | #else |
76 | #define DSPSTRIN "/dev/dsp" | 76 | #define DSPSTRIN "/dev/dsp" |
77 | #define DSPSTRMIXERIN "/dev/mixer" | 77 | #define DSPSTRMIXERIN "/dev/mixer" |
78 | #endif | 78 | #endif |
79 | 79 | ||
80 | #else | 80 | #else |
81 | 81 | ||
82 | #ifdef QT_QWS_DEVFS | ||
83 | #define DSPSTROUT "/dev/sound/dsp" | ||
84 | #define DSPSTRIN "/dev/sound/dsp" | ||
85 | #define DSPSTRMIXERIN "/dev/sound/mixer" | ||
86 | #define DSPSTRMIXEROUT "/dev/sound/mixer" | ||
87 | #else | ||
82 | #define DSPSTROUT "/dev/dsp" | 88 | #define DSPSTROUT "/dev/dsp" |
83 | #define DSPSTRIN "/dev/dsp" | 89 | #define DSPSTRIN "/dev/dsp" |
84 | #define DSPSTRMIXERIN "/dev/mixer" | 90 | #define DSPSTRMIXERIN "/dev/mixer" |
85 | #define DSPSTRMIXEROUT "/dev/mixer" | 91 | #define DSPSTRMIXEROUT "/dev/mixer" |
92 | #endif | ||
86 | 93 | ||
87 | #endif | 94 | #endif |
88 | 95 | ||
89 | //#define ZAURUS 0 | 96 | //#define ZAURUS 0 |
90 | struct adpcm_state encoder_state; | 97 | struct adpcm_state encoder_state; |
91 | struct adpcm_state decoder_state; | 98 | struct adpcm_state decoder_state; |
92 | 99 | ||
93 | typedef struct { | 100 | typedef struct { |
94 | int sampleRate; | 101 | int sampleRate; |
95 | /* int fragSize; */ | 102 | /* int fragSize; */ |
96 | /* int blockSize; */ | 103 | /* int blockSize; */ |
97 | int resolution; //bitrate | 104 | int resolution; //bitrate |