author | llornkcor <llornkcor> | 2004-06-28 11:46:26 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-06-28 11:46:26 (UTC) |
commit | 70b610b8e402b0e304238994258664d0e4fbedf6 (patch) (unidiff) | |
tree | d6cdf05355d44ed139ddccd7f2be50ec5a7a8faf | |
parent | 6944350eaea708414b9c0ff26122d7b2d19cd8f5 (diff) | |
download | opie-70b610b8e402b0e304238994258664d0e4fbedf6.zip opie-70b610b8e402b0e304238994258664d0e4fbedf6.tar.gz opie-70b610b8e402b0e304238994258664d0e4fbedf6.tar.bz2 |
whoops
-rw-r--r-- | noncore/multimedia/opierec/qtrec.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp index fb2d819..e3385cd 100644 --- a/noncore/multimedia/opierec/qtrec.cpp +++ b/noncore/multimedia/opierec/qtrec.cpp | |||
@@ -1,1101 +1,1101 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | // qtrec.cpp | 2 | // qtrec.cpp |
3 | Created: Thu Jan 17 11:19:58 2002 | 3 | Created: Thu Jan 17 11:19:58 2002 |
4 | copyright 2002 by L.J. Potter <ljp@llornkcor.com> | 4 | copyright 2002 by L.J. Potter <ljp@llornkcor.com> |
5 | ****************************************************************************/ | 5 | ****************************************************************************/ |
6 | #define DEV_VERSION | 6 | #define DEV_VERSION |
7 | 7 | ||
8 | #include "pixmaps.h" | 8 | #include "pixmaps.h" |
9 | #include "qtrec.h" | 9 | #include "qtrec.h" |
10 | #include "waveform.h" | 10 | #include "waveform.h" |
11 | extern "C" { | 11 | extern "C" { |
12 | #include "adpcm.h" | 12 | #include "adpcm.h" |
13 | } | 13 | } |
14 | 14 | ||
15 | /* OPIE */ | 15 | /* OPIE */ |
16 | #include <opie2/odebug.h> | 16 | #include <opie2/odebug.h> |
17 | #include <qpe/config.h> | 17 | #include <qpe/config.h> |
18 | #include <qpe/qcopenvelope_qws.h> | 18 | #include <qpe/qcopenvelope_qws.h> |
19 | #include <qpe/qpeapplication.h> | 19 | #include <qpe/qpeapplication.h> |
20 | #include <qpe/resource.h> | 20 | #include <qpe/resource.h> |
21 | #include <qpe/storage.h> | 21 | #include <qpe/storage.h> |
22 | using namespace Opie::Core; | 22 | using namespace Opie::Core; |
23 | 23 | ||
24 | /* QT */ | 24 | /* QT */ |
25 | #include <qcheckbox.h> | 25 | #include <qcheckbox.h> |
26 | #include <qcombobox.h> | 26 | #include <qcombobox.h> |
27 | #include <qdir.h> | 27 | #include <qdir.h> |
28 | #include <qgroupbox.h> | 28 | #include <qgroupbox.h> |
29 | #include <qlabel.h> | 29 | #include <qlabel.h> |
30 | #include <qlayout.h> | 30 | #include <qlayout.h> |
31 | #include <qlistview.h> | 31 | #include <qlistview.h> |
32 | #include <qmessagebox.h> | 32 | #include <qmessagebox.h> |
33 | #include <qpopupmenu.h> | 33 | #include <qpopupmenu.h> |
34 | #include <qpushbutton.h> | 34 | #include <qpushbutton.h> |
35 | #include <qslider.h> | 35 | #include <qslider.h> |
36 | #include <qtabwidget.h> | 36 | #include <qtabwidget.h> |
37 | #include <qtimer.h> | 37 | #include <qtimer.h> |
38 | 38 | ||
39 | /* STD */ | 39 | /* STD */ |
40 | #include <errno.h> | 40 | #include <errno.h> |
41 | #include <fcntl.h> | 41 | #include <fcntl.h> |
42 | #include <math.h> | 42 | #include <math.h> |
43 | #include <mntent.h> | 43 | #include <mntent.h> |
44 | #include <stdio.h> | 44 | #include <stdio.h> |
45 | #include <stdlib.h> | 45 | #include <stdlib.h> |
46 | #include <sys/ioctl.h> | 46 | #include <sys/ioctl.h> |
47 | #include <sys/soundcard.h> | 47 | #include <sys/soundcard.h> |
48 | #include <sys/stat.h> | 48 | #include <sys/stat.h> |
49 | #include <sys/time.h> | 49 | #include <sys/time.h> |
50 | #include <sys/types.h> | 50 | #include <sys/types.h> |
51 | #include <sys/vfs.h> | 51 | #include <sys/vfs.h> |
52 | #include <unistd.h> | 52 | #include <unistd.h> |
53 | #include <sys/wait.h> | 53 | #include <sys/wait.h> |
54 | #include <sys/signal.h> | 54 | #include <sys/signal.h> |
55 | #include <pthread.h> | 55 | #include <pthread.h> |
56 | 56 | ||
57 | #ifdef PDAUDIO //ALSA | 57 | #ifdef PDAUDIO //ALSA |
58 | #include <alsa/asoundlib.h> | 58 | #include <alsa/asoundlib.h> |
59 | static int deviceSampleRates[8] = { 32000, 44100, 48000, 88200, 96000, 176400, 192000, -1 }; | 59 | static int deviceSampleRates[8] = { 32000, 44100, 48000, 88200, 96000, 176400, 192000, -1 }; |
60 | static int deviceBitRates[] = { 8, 16, 24, 32, -1 }; | 60 | static int deviceBitRates[] = { 8, 16, 24, 32, -1 }; |
61 | #else //OSS | 61 | #else //OSS |
62 | static int deviceSampleRates[6] = { 11025, 16000, 22050, 32000, 44100, -1 }; | 62 | static int deviceSampleRates[6] = { 11025, 16000, 22050, 32000, 44100, -1 }; |
63 | static int deviceBitRates[] = { 8, 16, -1 }; | 63 | static int deviceBitRates[] = { 8, 16, -1 }; |
64 | #endif | 64 | #endif |
65 | 65 | ||
66 | #if defined(QT_QWS_SL5XXX) | 66 | #if defined(QT_QWS_SL5XXX) |
67 | ///#if defined(QT_QWS_EBX) | 67 | ///#if defined(QT_QWS_EBX) |
68 | 68 | ||
69 | #define DSPSTROUT "/dev/dsp" | 69 | #define DSPSTROUT "/dev/dsp" |
70 | #define DSPSTRIN "/dev/dsp1" | 70 | #define DSPSTRIN "/dev/dsp1" |
71 | #define DSPSTRMIXEROUT "/dev/mixer" | 71 | #define DSPSTRMIXEROUT "/dev/mixer" |
72 | #define DSPSTRMIXERIN "/dev/mixer1" | 72 | #define DSPSTRMIXERIN "/dev/mixer1" |
73 | 73 | ||
74 | #else | 74 | #else |
75 | 75 | ||
76 | #define DSPSTROUT "/dev/dsp1" | 76 | #define DSPSTROUT "/dev/dsp" |
77 | #define DSPSTRIN "/dev/dsp1" | 77 | #define DSPSTRIN "/dev/dsp" |
78 | #define DSPSTRMIXERIN "/dev/mixer" | 78 | #define DSPSTRMIXERIN "/dev/mixer" |
79 | #define DSPSTRMIXEROUT "/dev/mixer" | 79 | #define DSPSTRMIXEROUT "/dev/mixer" |
80 | 80 | ||
81 | #endif | 81 | #endif |
82 | 82 | ||
83 | //#define ZAURUS 0 | 83 | //#define ZAURUS 0 |
84 | struct adpcm_state encoder_state; | 84 | struct adpcm_state encoder_state; |
85 | struct adpcm_state decoder_state; | 85 | struct adpcm_state decoder_state; |
86 | 86 | ||
87 | typedef struct { | 87 | typedef struct { |
88 | int sampleRate; | 88 | int sampleRate; |
89 | /* int fragSize; */ | 89 | /* int fragSize; */ |
90 | /* int blockSize; */ | 90 | /* int blockSize; */ |
91 | int resolution; //bitrate | 91 | int resolution; //bitrate |
92 | int channels; //number of channels | 92 | int channels; //number of channels |
93 | int fd; //file descriptor | 93 | int fd; //file descriptor |
94 | int sd; //sound device descriptor | 94 | int sd; //sound device descriptor |
95 | int numberSamples; //total number of samples | 95 | int numberSamples; //total number of samples |
96 | int SecondsToRecord; // number of seconds that should be recorded | 96 | int SecondsToRecord; // number of seconds that should be recorded |
97 | float numberOfRecordedSeconds; //total number of samples recorded | 97 | float numberOfRecordedSeconds; //total number of samples recorded |
98 | int samplesToRecord; //number of samples to be recorded | 98 | int samplesToRecord; //number of samples to be recorded |
99 | int inVol; //input volume | 99 | int inVol; //input volume |
100 | int outVol; //output volume | 100 | int outVol; //output volume |
101 | int format; //wavfile format PCM.. ADPCM | 101 | int format; //wavfile format PCM.. ADPCM |
102 | const char *fileName; //name of fiel to be played/recorded | 102 | const char *fileName; //name of fiel to be played/recorded |
103 | } fileParameters; | 103 | } fileParameters; |
104 | 104 | ||
105 | fileParameters filePara; | 105 | fileParameters filePara; |
106 | 106 | ||
107 | bool monitoring, recording, playing; | 107 | bool monitoring, recording, playing; |
108 | bool stopped; | 108 | bool stopped; |
109 | QLabel *timeLabel; | 109 | QLabel *timeLabel; |
110 | QSlider *timeSlider; | 110 | QSlider *timeSlider; |
111 | int sd; | 111 | int sd; |
112 | 112 | ||
113 | Waveform* waveform; | 113 | Waveform* waveform; |
114 | Device *soundDevice; | 114 | Device *soundDevice; |
115 | 115 | ||
116 | 116 | ||
117 | #ifdef THREADED | 117 | #ifdef THREADED |
118 | void quickRec() | 118 | void quickRec() |
119 | #else | 119 | #else |
120 | void QtRec::quickRec() | 120 | void QtRec::quickRec() |
121 | #endif | 121 | #endif |
122 | { | 122 | { |
123 | 123 | ||
124 | odebug << ( filePara.numberSamples/filePara.sampleRate * filePara.channels ) << oendl; | 124 | odebug << ( filePara.numberSamples/filePara.sampleRate * filePara.channels ) << oendl; |
125 | odebug << "samples " << filePara.numberSamples << ", rate " << filePara.sampleRate | 125 | odebug << "samples " << filePara.numberSamples << ", rate " << filePara.sampleRate |
126 | << ", channels " << filePara.channels << oendl; | 126 | << ", channels " << filePara.channels << oendl; |
127 | 127 | ||
128 | int total = 0; // Total number of bytes read in so far. | 128 | int total = 0; // Total number of bytes read in so far. |
129 | int bytesWritten, number; | 129 | int bytesWritten, number; |
130 | 130 | ||
131 | bytesWritten = 0; | 131 | bytesWritten = 0; |
132 | number = 0; | 132 | number = 0; |
133 | QString num; | 133 | QString num; |
134 | int level = 0; | 134 | int level = 0; |
135 | int threshold = 0; | 135 | int threshold = 0; |
136 | int bits = filePara.resolution; | 136 | int bits = filePara.resolution; |
137 | odebug << "bits " << bits << "" << oendl; | 137 | odebug << "bits " << bits << "" << oendl; |
138 | 138 | ||
139 | if( filePara.resolution == 16 ) { //AFMT_S16_LE) | 139 | if( filePara.resolution == 16 ) { //AFMT_S16_LE) |
140 | odebug << "AFMT_S16_LE size " << filePara.SecondsToRecord << "" << oendl; | 140 | odebug << "AFMT_S16_LE size " << filePara.SecondsToRecord << "" << oendl; |
141 | odebug << "samples to record " << filePara.samplesToRecord << "" << oendl; | 141 | odebug << "samples to record " << filePara.samplesToRecord << "" << oendl; |
142 | odebug << "" << filePara.sd << "" << oendl; | 142 | odebug << "" << filePara.sd << "" << oendl; |
143 | level = 7; | 143 | level = 7; |
144 | threshold = 0; | 144 | threshold = 0; |
145 | 145 | ||
146 | if( filePara.format == WAVE_FORMAT_DVI_ADPCM) { | 146 | if( filePara.format == WAVE_FORMAT_DVI_ADPCM) { |
147 | odebug << "start recording WAVE_FORMAT_DVI_ADPCM" << oendl; | 147 | odebug << "start recording WAVE_FORMAT_DVI_ADPCM" << oendl; |
148 | // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_DVI_ADPCM >>>>>>>>>>>>>>>>>>>>>> | 148 | // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_DVI_ADPCM >>>>>>>>>>>>>>>>>>>>>> |
149 | char abuf[ BUFSIZE/2 ]; | 149 | char abuf[ BUFSIZE/2 ]; |
150 | short sbuf[ BUFSIZE ]; | 150 | short sbuf[ BUFSIZE ]; |
151 | short sbuf2[ BUFSIZE ]; | 151 | short sbuf2[ BUFSIZE ]; |
152 | memset( abuf, 0, BUFSIZE/2); | 152 | memset( abuf, 0, BUFSIZE/2); |
153 | memset( sbuf, 0, BUFSIZE); | 153 | memset( sbuf, 0, BUFSIZE); |
154 | memset( sbuf2, 0, BUFSIZE); | 154 | memset( sbuf2, 0, BUFSIZE); |
155 | 155 | ||
156 | for(;;) { | 156 | for(;;) { |
157 | if ( stopped) { | 157 | if ( stopped) { |
158 | odebug << "quickRec:: stopped" << oendl; | 158 | odebug << "quickRec:: stopped" << oendl; |
159 | break; | 159 | break; |
160 | } | 160 | } |
161 | 161 | ||
162 | // number=::read( filePara.sd, sbuf, BUFSIZE); | 162 | // number=::read( filePara.sd, sbuf, BUFSIZE); |
163 | number = soundDevice->devRead( filePara.sd, sbuf, BUFSIZE); | 163 | number = soundDevice->devRead( filePara.sd, sbuf, BUFSIZE); |
164 | 164 | ||
165 | if(number <= 0) { | 165 | if(number <= 0) { |
166 | perror("recording error "); | 166 | perror("recording error "); |
167 | odebug << "" << filePara.fileName << " " << number << "" << oendl; | 167 | odebug << "" << filePara.fileName << " " << number << "" << oendl; |
168 | stopped = true; | 168 | stopped = true; |
169 | return; | 169 | return; |
170 | } | 170 | } |
171 | //if(stereo == 2) { | 171 | //if(stereo == 2) { |
172 | // adpcm_coder( sbuf2, abuf, number/2, &encoder_state); | 172 | // adpcm_coder( sbuf2, abuf, number/2, &encoder_state); |
173 | adpcm_coder( sbuf, abuf, number/2, &encoder_state); | 173 | adpcm_coder( sbuf, abuf, number/2, &encoder_state); |
174 | 174 | ||
175 | bytesWritten = ::write( filePara.fd , (short *)abuf, number/4); | 175 | bytesWritten = ::write( filePara.fd , (short *)abuf, number/4); |
176 | 176 | ||
177 | waveform->newSamples( sbuf, number ); | 177 | waveform->newSamples( sbuf, number ); |
178 | 178 | ||
179 | total += bytesWritten; | 179 | total += bytesWritten; |
180 | filePara.numberSamples = total; | 180 | filePara.numberSamples = total; |
181 | timeSlider->setValue( total); | 181 | timeSlider->setValue( total); |
182 | 182 | ||
183 | printf("%d, bytes %d,total %d\r",number, bytesWritten, total); | 183 | printf("%d, bytes %d,total %d\r",number, bytesWritten, total); |
184 | fflush(stdout); | 184 | fflush(stdout); |
185 | 185 | ||
186 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2/ filePara.channels; | 186 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2/ filePara.channels; |
187 | 187 | ||
188 | qApp->processEvents(); | 188 | qApp->processEvents(); |
189 | if( total >= filePara.samplesToRecord) { | 189 | if( total >= filePara.samplesToRecord) { |
190 | stopped = true; | 190 | stopped = true; |
191 | break; | 191 | break; |
192 | } | 192 | } |
193 | } | 193 | } |
194 | } else { | 194 | } else { |
195 | // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_PCM >>>>>>>>>>>>>>>>>>>>>> | 195 | // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_PCM >>>>>>>>>>>>>>>>>>>>>> |
196 | odebug << "start recording WAVE_FORMAT_PCM" << oendl; | 196 | odebug << "start recording WAVE_FORMAT_PCM" << oendl; |
197 | short inbuffer[ BUFSIZE ], outbuffer[ BUFSIZE ]; | 197 | short inbuffer[ BUFSIZE ], outbuffer[ BUFSIZE ]; |
198 | memset( inbuffer, 0, BUFSIZE); | 198 | memset( inbuffer, 0, BUFSIZE); |
199 | memset( outbuffer, 0, BUFSIZE); | 199 | memset( outbuffer, 0, BUFSIZE); |
200 | 200 | ||
201 | for(;;) { | 201 | for(;;) { |
202 | if ( stopped) { | 202 | if ( stopped) { |
203 | odebug << "quickRec:: stopped" << oendl; | 203 | odebug << "quickRec:: stopped" << oendl; |
204 | stopped = true; | 204 | stopped = true; |
205 | break; // stop if playing was set to false | 205 | break; // stop if playing was set to false |
206 | return; | 206 | return; |
207 | } | 207 | } |
208 | 208 | ||
209 | number = soundDevice->devRead( soundDevice->sd /*filePara.sd*/, (short *)inbuffer, BUFSIZE); | 209 | number = soundDevice->devRead( soundDevice->sd /*filePara.sd*/, (short *)inbuffer, BUFSIZE); |
210 | 210 | ||
211 | if( number <= 0) { | 211 | if( number <= 0) { |
212 | perror( "recording error "); | 212 | perror( "recording error "); |
213 | odebug << filePara.fileName << oendl; | 213 | odebug << filePara.fileName << oendl; |
214 | stopped = true; | 214 | stopped = true; |
215 | return; | 215 | return; |
216 | } | 216 | } |
217 | 217 | ||
218 | bytesWritten = ::write( filePara.fd , inbuffer, number); | 218 | bytesWritten = ::write( filePara.fd , inbuffer, number); |
219 | waveform->newSamples( inbuffer, number ); | 219 | waveform->newSamples( inbuffer, number ); |
220 | 220 | ||
221 | if( bytesWritten < 0) { | 221 | if( bytesWritten < 0) { |
222 | perror("File writing error "); | 222 | perror("File writing error "); |
223 | stopped = true; | 223 | stopped = true; |
224 | return; | 224 | return; |
225 | } | 225 | } |
226 | 226 | ||
227 | total += bytesWritten; | 227 | total += bytesWritten; |
228 | 228 | ||
229 | filePara.numberSamples = total; | 229 | filePara.numberSamples = total; |
230 | 230 | ||
231 | if( filePara.SecondsToRecord != 0) | 231 | if( filePara.SecondsToRecord != 0) |
232 | timeSlider->setValue( total); | 232 | timeSlider->setValue( total); |
233 | printf("%d, bytes %d,total %d\r",number, bytesWritten , total); | 233 | printf("%d, bytes %d,total %d\r",number, bytesWritten , total); |
234 | fflush(stdout); | 234 | fflush(stdout); |
235 | 235 | ||
236 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate | 236 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate |
237 | / (float)2/filePara.channels; | 237 | / (float)2/filePara.channels; |
238 | qApp->processEvents(); | 238 | qApp->processEvents(); |
239 | 239 | ||
240 | if( total >= filePara.samplesToRecord) { | 240 | if( total >= filePara.samplesToRecord) { |
241 | stopped = true; | 241 | stopped = true; |
242 | break; | 242 | break; |
243 | } | 243 | } |
244 | } | 244 | } |
245 | } //end main loop | 245 | } //end main loop |
246 | 246 | ||
247 | } else { | 247 | } else { |
248 | // <<<<<<<<<<<<<<<<<<<<<<< format = AFMT_U8; | 248 | // <<<<<<<<<<<<<<<<<<<<<<< format = AFMT_U8; |
249 | unsigned char unsigned_inbuffer[ BUFSIZE ], unsigned_outbuffer[ BUFSIZE ]; | 249 | unsigned char unsigned_inbuffer[ BUFSIZE ], unsigned_outbuffer[ BUFSIZE ]; |
250 | memset( unsigned_inbuffer, 0, BUFSIZE); | 250 | memset( unsigned_inbuffer, 0, BUFSIZE); |
251 | memset( unsigned_outbuffer, 0, BUFSIZE); | 251 | memset( unsigned_outbuffer, 0, BUFSIZE); |
252 | 252 | ||
253 | for(;;) { | 253 | for(;;) { |
254 | if ( stopped) { | 254 | if ( stopped) { |
255 | odebug << "quickRec:: stopped" << oendl; | 255 | odebug << "quickRec:: stopped" << oendl; |
256 | break; // stop if playing was set to false | 256 | break; // stop if playing was set to false |
257 | } | 257 | } |
258 | 258 | ||
259 | number = ::read( soundDevice->sd /*filePara.sd*/ , unsigned_inbuffer, BUFSIZE); | 259 | number = ::read( soundDevice->sd /*filePara.sd*/ , unsigned_inbuffer, BUFSIZE); |
260 | bytesWritten = ::write( filePara.fd , unsigned_inbuffer, number); | 260 | bytesWritten = ::write( filePara.fd , unsigned_inbuffer, number); |
261 | waveform->newSamples( (const short *) unsigned_inbuffer, number ); | 261 | waveform->newSamples( (const short *) unsigned_inbuffer, number ); |
262 | 262 | ||
263 | if(bytesWritten < 0) { | 263 | if(bytesWritten < 0) { |
264 | stopped = true; | 264 | stopped = true; |
265 | QMessageBox::message("Note","<p>There was a problem writing to the file</p>"); | 265 | QMessageBox::message("Note","<p>There was a problem writing to the file</p>"); |
266 | perror("File writing error "); | 266 | perror("File writing error "); |
267 | return; | 267 | return; |
268 | } | 268 | } |
269 | 269 | ||
270 | total += bytesWritten; | 270 | total += bytesWritten; |
271 | filePara.numberSamples = total; | 271 | filePara.numberSamples = total; |
272 | // printf("%d, bytes %d,total %d \r",number, bytesWritten , total); | 272 | // printf("%d, bytes %d,total %d \r",number, bytesWritten , total); |
273 | // fflush(stdout); | 273 | // fflush(stdout); |
274 | if( filePara.SecondsToRecord !=0) | 274 | if( filePara.SecondsToRecord !=0) |
275 | timeSlider->setValue( total); | 275 | timeSlider->setValue( total); |
276 | 276 | ||
277 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate; | 277 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate; |
278 | 278 | ||
279 | qApp->processEvents(); | 279 | qApp->processEvents(); |
280 | if( total >= filePara.samplesToRecord) { | 280 | if( total >= filePara.samplesToRecord) { |
281 | stopped = true; | 281 | stopped = true; |
282 | break; | 282 | break; |
283 | } | 283 | } |
284 | } //end main loop | 284 | } //end main loop |
285 | } | 285 | } |
286 | } /// END quickRec() | 286 | } /// END quickRec() |
287 | 287 | ||
288 | 288 | ||
289 | #ifdef THREADED | 289 | #ifdef THREADED |
290 | void playIt() | 290 | void playIt() |
291 | #else | 291 | #else |
292 | void QtRec::playIt() | 292 | void QtRec::playIt() |
293 | #endif | 293 | #endif |
294 | { | 294 | { |
295 | int bytesWritten = 0; | 295 | int bytesWritten = 0; |
296 | int number = 0; | 296 | int number = 0; |
297 | int total = 0; // Total number of bytes read in so far. | 297 | int total = 0; // Total number of bytes read in so far. |
298 | if( filePara.resolution == 16 ) { //AFMT_S16_LE) { | 298 | if( filePara.resolution == 16 ) { //AFMT_S16_LE) { |
299 | if( filePara.format == WAVE_FORMAT_DVI_ADPCM) { | 299 | if( filePara.format == WAVE_FORMAT_DVI_ADPCM) { |
300 | char abuf[ BUFSIZE / 2 ]; | 300 | char abuf[ BUFSIZE / 2 ]; |
301 | short sbuf[ BUFSIZE ]; | 301 | short sbuf[ BUFSIZE ]; |
302 | short sbuf2[ BUFSIZE * 2 ]; | 302 | short sbuf2[ BUFSIZE * 2 ]; |
303 | memset( abuf, 0, BUFSIZE / 2); | 303 | memset( abuf, 0, BUFSIZE / 2); |
304 | memset( sbuf, 0, BUFSIZE); | 304 | memset( sbuf, 0, BUFSIZE); |
305 | memset( sbuf2, 0, BUFSIZE * 2); | 305 | memset( sbuf2, 0, BUFSIZE * 2); |
306 | // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_DVI_ADPCM >>>>>>>>>>>>>>>>>>>>>> | 306 | // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_DVI_ADPCM >>>>>>>>>>>>>>>>>>>>>> |
307 | for(;;) { // play loop | 307 | for(;;) { // play loop |
308 | if ( stopped) { | 308 | if ( stopped) { |
309 | break; | 309 | break; |
310 | return; | 310 | return; |
311 | }// stop if playing was set to false | 311 | }// stop if playing was set to false |
312 | 312 | ||
313 | number = ::read( filePara.fd, abuf, BUFSIZE / 2); | 313 | number = ::read( filePara.fd, abuf, BUFSIZE / 2); |
314 | adpcm_decoder( abuf, sbuf, number * 2, &decoder_state); | 314 | adpcm_decoder( abuf, sbuf, number * 2, &decoder_state); |
315 | 315 | ||
316 | // for (int i=0;i< number * 2; 2 * i++) { //2*i is left channel | 316 | // for (int i=0;i< number * 2; 2 * i++) { //2*i is left channel |
317 | // sbuf2[i+1]=sbuf2[i]=sbuf[i]; | 317 | // sbuf2[i+1]=sbuf2[i]=sbuf[i]; |
318 | // } | 318 | // } |
319 | bytesWritten = write ( filePara.sd, sbuf, number * 4); | 319 | bytesWritten = write ( filePara.sd, sbuf, number * 4); |
320 | waveform->newSamples( (const short *)sbuf, number *4); | 320 | waveform->newSamples( (const short *)sbuf, number *4); |
321 | // if(filePara.channels==1) | 321 | // if(filePara.channels==1) |
322 | // total += bytesWritten/2; //mono | 322 | // total += bytesWritten/2; //mono |
323 | // else | 323 | // else |
324 | total += bytesWritten; | 324 | total += bytesWritten; |
325 | filePara.numberSamples = total/4; | 325 | filePara.numberSamples = total/4; |
326 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / 2; | 326 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / 2; |
327 | 327 | ||
328 | timeSlider->setValue( total/4); | 328 | timeSlider->setValue( total/4); |
329 | // timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds); | 329 | // timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds); |
330 | // if(filePara.numberOfRecordedSeconds>1) | 330 | // if(filePara.numberOfRecordedSeconds>1) |
331 | // timeLabel->setText( timeString+ tr(" seconds")); | 331 | // timeLabel->setText( timeString+ tr(" seconds")); |
332 | // printf("playing number %d, bytes %d, total %d\n",number, bytesWritten, total/4); | 332 | // printf("playing number %d, bytes %d, total %d\n",number, bytesWritten, total/4); |
333 | // fflush(stdout); | 333 | // fflush(stdout); |
334 | 334 | ||
335 | qApp->processEvents(); | 335 | qApp->processEvents(); |
336 | 336 | ||
337 | if( /*total >= filePara.numberSamples || */ bytesWritten == 0) { | 337 | if( /*total >= filePara.numberSamples || */ bytesWritten == 0) { |
338 | // if( total >= filePara.numberSamples ){//|| secCount > filePara.numberOfRecordedSeconds ) { | 338 | // if( total >= filePara.numberSamples ){//|| secCount > filePara.numberOfRecordedSeconds ) { |
339 | stopped = true; | 339 | stopped = true; |
340 | break; | 340 | break; |
341 | } | 341 | } |
342 | } | 342 | } |
343 | } else { | 343 | } else { |
344 | // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_PCM >>>>>>>>>>>>>>>>>>>>>> | 344 | // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_PCM >>>>>>>>>>>>>>>>>>>>>> |
345 | short inbuffer[ BUFSIZE ], outbuffer[ BUFSIZE ]; | 345 | short inbuffer[ BUFSIZE ], outbuffer[ BUFSIZE ]; |
346 | memset( inbuffer, 0, BUFSIZE); | 346 | memset( inbuffer, 0, BUFSIZE); |
347 | memset( outbuffer, 0, BUFSIZE); | 347 | memset( outbuffer, 0, BUFSIZE); |
348 | 348 | ||
349 | for(;;) { // play loop | 349 | for(;;) { // play loop |
350 | if ( stopped) { | 350 | if ( stopped) { |
351 | break; | 351 | break; |
352 | return; | 352 | return; |
353 | } | 353 | } |
354 | // stop if playing was set to false | 354 | // stop if playing was set to false |
355 | number = ::read( filePara.fd, inbuffer, BUFSIZE); | 355 | number = ::read( filePara.fd, inbuffer, BUFSIZE); |
356 | // for (int i=0;i< number * 2; 2 * i++) { //2*i is left channel | 356 | // for (int i=0;i< number * 2; 2 * i++) { //2*i is left channel |
357 | // // for (int i=0;i< number ; i++) { //2*i is left channel | 357 | // // for (int i=0;i< number ; i++) { //2*i is left channel |
358 | // outbuffer[i+1]= outbuffer[i]=inbuffer[i]; | 358 | // outbuffer[i+1]= outbuffer[i]=inbuffer[i]; |
359 | // } | 359 | // } |
360 | bytesWritten = ::write( filePara.sd, inbuffer, number); | 360 | bytesWritten = ::write( filePara.sd, inbuffer, number); |
361 | waveform->newSamples( inbuffer, number); | 361 | waveform->newSamples( inbuffer, number); |
362 | //-------------->>>> out to device | 362 | //-------------->>>> out to device |
363 | // total+=bytesWritten; | 363 | // total+=bytesWritten; |
364 | // if(filePara.channels==1) | 364 | // if(filePara.channels==1) |
365 | // total += bytesWritten/2; //mono | 365 | // total += bytesWritten/2; //mono |
366 | // else | 366 | // else |
367 | total += bytesWritten; | 367 | total += bytesWritten; |
368 | timeSlider->setValue( total); | 368 | timeSlider->setValue( total); |
369 | 369 | ||
370 | filePara.numberSamples = total; | 370 | filePara.numberSamples = total; |
371 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / (float)2; | 371 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / (float)2; |
372 | 372 | ||
373 | // timeString.sprintf("%.2f",filePara.numberOfRecordedSeconds); | 373 | // timeString.sprintf("%.2f",filePara.numberOfRecordedSeconds); |
374 | // timeLabel->setText( timeString + tr(" seconds")); | 374 | // timeLabel->setText( timeString + tr(" seconds")); |
375 | 375 | ||
376 | qApp->processEvents(); | 376 | qApp->processEvents(); |
377 | 377 | ||
378 | if( /*total >= filePara.numberSamples || */ bytesWritten == 0) { | 378 | if( /*total >= filePara.numberSamples || */ bytesWritten == 0) { |
379 | owarn << "Jane! Stop this crazy thing!" << oendl; | 379 | owarn << "Jane! Stop this crazy thing!" << oendl; |
380 | stopped = true; | 380 | stopped = true; |
381 | // playing = false; | 381 | // playing = false; |
382 | break; | 382 | break; |
383 | } | 383 | } |
384 | } | 384 | } |
385 | // printf("\nplaying number %d, bytes %d, total %d\r",number, bytesWritten, total); | 385 | // printf("\nplaying number %d, bytes %d, total %d\r",number, bytesWritten, total); |
386 | // fflush(stdout); | 386 | // fflush(stdout); |
387 | } //end loop | 387 | } //end loop |
388 | } else { | 388 | } else { |
389 | /////////////////////////////// format = AFMT_U8; | 389 | /////////////////////////////// format = AFMT_U8; |
390 | unsigned char unsigned_inbuffer[ BUFSIZE ]; //, unsigned_outbuffer[BUFSIZE]; | 390 | unsigned char unsigned_inbuffer[ BUFSIZE ]; //, unsigned_outbuffer[BUFSIZE]; |
391 | memset( unsigned_inbuffer, 0, BUFSIZE); | 391 | memset( unsigned_inbuffer, 0, BUFSIZE); |
392 | for(;;) { | 392 | for(;;) { |
393 | // main loop | 393 | // main loop |
394 | if (stopped) { | 394 | if (stopped) { |
395 | break; // stop if playing was set to false | 395 | break; // stop if playing was set to false |
396 | return; | 396 | return; |
397 | } | 397 | } |
398 | number = ::read( filePara.fd, unsigned_inbuffer, BUFSIZE); | 398 | number = ::read( filePara.fd, unsigned_inbuffer, BUFSIZE); |
399 | //data = (val >> 8) ^ 0x80; | 399 | //data = (val >> 8) ^ 0x80; |
400 | // unsigned_outbuffer = (unsigned_inbuffer >> 8) ^ 0x80; | 400 | // unsigned_outbuffer = (unsigned_inbuffer >> 8) ^ 0x80; |
401 | bytesWritten = write ( filePara.sd, unsigned_inbuffer, number); | 401 | bytesWritten = write ( filePara.sd, unsigned_inbuffer, number); |
402 | waveform->newSamples( (const short *)unsigned_inbuffer, bytesWritten ); | 402 | waveform->newSamples( (const short *)unsigned_inbuffer, bytesWritten ); |
403 | total += bytesWritten; | 403 | total += bytesWritten; |
404 | 404 | ||
405 | timeSlider->setValue( total); | 405 | timeSlider->setValue( total); |
406 | filePara.numberSamples = total; | 406 | filePara.numberSamples = total; |
407 | 407 | ||
408 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate; | 408 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate; |
409 | // timeString.sprintf("%.2f",filePara.numberOfRecordedSeconds); | 409 | // timeString.sprintf("%.2f",filePara.numberOfRecordedSeconds); |
410 | // timeLabel->setText( timeString + tr(" seconds")); | 410 | // timeLabel->setText( timeString + tr(" seconds")); |
411 | qApp->processEvents(); | 411 | qApp->processEvents(); |
412 | 412 | ||
413 | if( /*total >= filePara.numberSamples || */ bytesWritten == 0) { | 413 | if( /*total >= filePara.numberSamples || */ bytesWritten == 0) { |
414 | // if( total >= filePara.numberSamples ) { | 414 | // if( total >= filePara.numberSamples ) { |
415 | stopped = true; | 415 | stopped = true; |
416 | break; | 416 | break; |
417 | } | 417 | } |
418 | // printf("Writing number %d, bytes %d, total %d, numberSamples %d\r",number, bytesWritten , total, filePara.numberSamples); | 418 | // printf("Writing number %d, bytes %d, total %d, numberSamples %d\r",number, bytesWritten , total, filePara.numberSamples); |
419 | // fflush(stdout); | 419 | // fflush(stdout); |
420 | } | 420 | } |
421 | } | 421 | } |
422 | } | 422 | } |
423 | 423 | ||
424 | 424 | ||
425 | QtRec::QtRec( QWidget* parent, const char* name, WFlags fl ) | 425 | QtRec::QtRec( QWidget* parent, const char* name, WFlags fl ) |
426 | : QWidget( parent, name, fl ) | 426 | : QWidget( parent, name, fl ) |
427 | { | 427 | { |
428 | if ( !name ) | 428 | if ( !name ) |
429 | setName( "OpieRec" ); | 429 | setName( "OpieRec" ); |
430 | init(); | 430 | init(); |
431 | initConfig(); | 431 | initConfig(); |
432 | initConnections(); | 432 | initConnections(); |
433 | renameBox = 0; | 433 | renameBox = 0; |
434 | 434 | ||
435 | // open sound device to get volumes | 435 | // open sound device to get volumes |
436 | Config hwcfg("OpieRec"); | 436 | Config hwcfg("OpieRec"); |
437 | hwcfg.setGroup("Hardware"); | 437 | hwcfg.setGroup("Hardware"); |
438 | 438 | ||
439 | 439 | ||
440 | soundDevice = new Device( this, | 440 | soundDevice = new Device( this, |
441 | hwcfg.readEntry( "Audio",DSPSTROUT), | 441 | hwcfg.readEntry( "Audio",DSPSTROUT), |
442 | hwcfg.readEntry( "Mixer",DSPSTRMIXEROUT), false); | 442 | hwcfg.readEntry( "Mixer",DSPSTRMIXEROUT), false); |
443 | // soundDevice = new Device( this, hwcfg.readEntry( "Audio","hw:0"), hwcfg.readEntry( "Mixer","hw:0"), false); | 443 | // soundDevice = new Device( this, hwcfg.readEntry( "Audio","hw:0"), hwcfg.readEntry( "Mixer","hw:0"), false); |
444 | 444 | ||
445 | // soundDevice->setDeviceFormat(AFMT_S16_LE); | 445 | // soundDevice->setDeviceFormat(AFMT_S16_LE); |
446 | // soundDevice->setDeviceChannels(1); | 446 | // soundDevice->setDeviceChannels(1); |
447 | // soundDevice->setDeviceRate( 22050); | 447 | // soundDevice->setDeviceRate( 22050); |
448 | 448 | ||
449 | getInVol(); | 449 | getInVol(); |
450 | getOutVol(); | 450 | getOutVol(); |
451 | 451 | ||
452 | soundDevice->closeDevice( true); | 452 | soundDevice->closeDevice( true); |
453 | soundDevice->sd = -1; | 453 | soundDevice->sd = -1; |
454 | soundDevice = 0; | 454 | soundDevice = 0; |
455 | wavFile = 0; | 455 | wavFile = 0; |
456 | 456 | ||
457 | // if( soundDevice) delete soundDevice; | 457 | // if( soundDevice) delete soundDevice; |
458 | 458 | ||
459 | initIconView(); | 459 | initIconView(); |
460 | 460 | ||
461 | if( autoMute) | 461 | if( autoMute) |
462 | doMute( true); | 462 | doMute( true); |
463 | ListView1->setFocus(); | 463 | ListView1->setFocus(); |
464 | playing = false; | 464 | playing = false; |
465 | } | 465 | } |
466 | 466 | ||
467 | QtRec::~QtRec() { | 467 | QtRec::~QtRec() { |
468 | // if( soundDevice) delete soundDevice; | 468 | // if( soundDevice) delete soundDevice; |
469 | 469 | ||
470 | } | 470 | } |
471 | 471 | ||
472 | void QtRec::cleanUp() { | 472 | void QtRec::cleanUp() { |
473 | 473 | ||
474 | if( !stopped) { | 474 | if( !stopped) { |
475 | stopped = true; | 475 | stopped = true; |
476 | endRecording(); | 476 | endRecording(); |
477 | } | 477 | } |
478 | 478 | ||
479 | ListView1->clear(); | 479 | ListView1->clear(); |
480 | 480 | ||
481 | if( autoMute) | 481 | if( autoMute) |
482 | doMute(false); | 482 | doMute(false); |
483 | 483 | ||
484 | // if( wavFile) delete wavFile; | 484 | // if( wavFile) delete wavFile; |
485 | // if(soundDevice) delete soundDevice; | 485 | // if(soundDevice) delete soundDevice; |
486 | } | 486 | } |
487 | 487 | ||
488 | void QtRec::init() { | 488 | void QtRec::init() { |
489 | 489 | ||
490 | needsStereoOut = false; | 490 | needsStereoOut = false; |
491 | QPixmap image3( ( const char** ) image3_data ); | 491 | QPixmap image3( ( const char** ) image3_data ); |
492 | QPixmap image4( ( const char** ) image4_data ); | 492 | QPixmap image4( ( const char** ) image4_data ); |
493 | QPixmap image6( ( const char** ) image6_data ); | 493 | QPixmap image6( ( const char** ) image6_data ); |
494 | 494 | ||
495 | stopped = true; | 495 | stopped = true; |
496 | setCaption( tr( "OpieRecord " ) + QString::number(VERSION) ); | 496 | setCaption( tr( "OpieRecord " ) + QString::number(VERSION) ); |
497 | QGridLayout *layout = new QGridLayout( this ); | 497 | QGridLayout *layout = new QGridLayout( this ); |
498 | layout->setSpacing( 2); | 498 | layout->setSpacing( 2); |
499 | layout->setMargin( 2); | 499 | layout->setMargin( 2); |
500 | 500 | ||
501 | TabWidget = new QTabWidget( this, "TabWidget" ); | 501 | TabWidget = new QTabWidget( this, "TabWidget" ); |
502 | layout->addMultiCellWidget(TabWidget, 0, 7, 0, 8); | 502 | layout->addMultiCellWidget(TabWidget, 0, 7, 0, 8); |
503 | // TabWidget->setTabShape(QTabWidget::Triangular); | 503 | // TabWidget->setTabShape(QTabWidget::Triangular); |
504 | 504 | ||
505 | ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** | 505 | ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** |
506 | tab = new QWidget( TabWidget, "tab" ); | 506 | tab = new QWidget( TabWidget, "tab" ); |
507 | 507 | ||
508 | QGridLayout *layout1 = new QGridLayout( tab); | 508 | QGridLayout *layout1 = new QGridLayout( tab); |
509 | layout1->setSpacing( 2); | 509 | layout1->setSpacing( 2); |
510 | layout1->setMargin( 2); | 510 | layout1->setMargin( 2); |
511 | 511 | ||
512 | timeSlider = new QSlider( 0,100,10,0, QSlider::Horizontal, tab, (const char *) "timeSlider" ); | 512 | timeSlider = new QSlider( 0,100,10,0, QSlider::Horizontal, tab, (const char *) "timeSlider" ); |
513 | layout1->addMultiCellWidget( timeSlider, 1, 1, 0, 3); | 513 | layout1->addMultiCellWidget( timeSlider, 1, 1, 0, 3); |
514 | 514 | ||
515 | // timeLabel = new QLabel( tab, "TimeLabel" ); | 515 | // timeLabel = new QLabel( tab, "TimeLabel" ); |
516 | // layout1->addMultiCellWidget( timeLabel, 0, 0, 0, 3); | 516 | // layout1->addMultiCellWidget( timeLabel, 0, 0, 0, 3); |
517 | 517 | ||
518 | // playLabel2 = new QLabel(tab, "PlayLabel2" ); | 518 | // playLabel2 = new QLabel(tab, "PlayLabel2" ); |
519 | // playLabel2->setText(tr("Play") ); | 519 | // playLabel2->setText(tr("Play") ); |
520 | // playLabel2->setFixedHeight( 18); | 520 | // playLabel2->setFixedHeight( 18); |
521 | // layout1->addMultiCellWidget( playLabel2, 0, 0, 4, 4); | 521 | // layout1->addMultiCellWidget( playLabel2, 0, 0, 4, 4); |
522 | 522 | ||
523 | Stop_PushButton = new QPushButton( tab, "Stop_PushButton" ); | 523 | Stop_PushButton = new QPushButton( tab, "Stop_PushButton" ); |
524 | layout1->addMultiCellWidget( Stop_PushButton, 1, 1, 4, 4); | 524 | layout1->addMultiCellWidget( Stop_PushButton, 1, 1, 4, 4); |
525 | Stop_PushButton->setFixedSize( 22, 22); | 525 | Stop_PushButton->setFixedSize( 22, 22); |
526 | Stop_PushButton->setPixmap( image4 ); | 526 | Stop_PushButton->setPixmap( image4 ); |
527 | 527 | ||
528 | toBeginningButton = new QPushButton( tab, "Beginning_PushButton" ); | 528 | toBeginningButton = new QPushButton( tab, "Beginning_PushButton" ); |
529 | layout1->addMultiCellWidget(toBeginningButton, 1, 1, 5, 5); | 529 | layout1->addMultiCellWidget(toBeginningButton, 1, 1, 5, 5); |
530 | toBeginningButton->setFixedSize( 22, 22); | 530 | toBeginningButton->setFixedSize( 22, 22); |
531 | toBeginningButton->setPixmap( Resource::loadPixmap("fastback") ); | 531 | toBeginningButton->setPixmap( Resource::loadPixmap("fastback") ); |
532 | 532 | ||
533 | toEndButton = new QPushButton( tab, "End_PushButton" ); | 533 | toEndButton = new QPushButton( tab, "End_PushButton" ); |
534 | layout1->addMultiCellWidget( toEndButton, 1, 1, 6, 6); | 534 | layout1->addMultiCellWidget( toEndButton, 1, 1, 6, 6); |
535 | toEndButton->setFixedSize( 22, 22); | 535 | toEndButton->setFixedSize( 22, 22); |
536 | toEndButton->setPixmap( Resource::loadPixmap( "fastforward" ) ); | 536 | toEndButton->setPixmap( Resource::loadPixmap( "fastforward" ) ); |
537 | 537 | ||
538 | // QLabel *recLabel2; | 538 | // QLabel *recLabel2; |
539 | // recLabel2 = new QLabel( tab, "recLabel2" ); | 539 | // recLabel2 = new QLabel( tab, "recLabel2" ); |
540 | // recLabel2->setText(tr("Rec")); | 540 | // recLabel2->setText(tr("Rec")); |
541 | // recLabel2->setFixedHeight( 18); | 541 | // recLabel2->setFixedHeight( 18); |
542 | // layout1->addMultiCellWidget( recLabel2, 0, 0, 7, 7); | 542 | // layout1->addMultiCellWidget( recLabel2, 0, 0, 7, 7); |
543 | 543 | ||
544 | Rec_PushButton = new QPushButton( tab, "Rec_PushButton" ); | 544 | Rec_PushButton = new QPushButton( tab, "Rec_PushButton" ); |
545 | layout1->addMultiCellWidget( Rec_PushButton, 1, 1, 7, 7); | 545 | layout1->addMultiCellWidget( Rec_PushButton, 1, 1, 7, 7); |
546 | Rec_PushButton->setFixedSize( 22, 22); | 546 | Rec_PushButton->setFixedSize( 22, 22); |
547 | Rec_PushButton->setPixmap( image6 ); | 547 | Rec_PushButton->setPixmap( image6 ); |
548 | 548 | ||
549 | t = new QTimer( this ); | 549 | t = new QTimer( this ); |
550 | connect( t, SIGNAL( timeout() ), SLOT( timerBreak() ) ); | 550 | connect( t, SIGNAL( timeout() ), SLOT( timerBreak() ) ); |
551 | 551 | ||
552 | rewindTimer = new QTimer( this ); | 552 | rewindTimer = new QTimer( this ); |
553 | connect( rewindTimer, SIGNAL( timeout() ), | 553 | connect( rewindTimer, SIGNAL( timeout() ), |
554 | this, SLOT( rewindTimerTimeout() ) ); | 554 | this, SLOT( rewindTimerTimeout() ) ); |
555 | 555 | ||
556 | forwardTimer = new QTimer( this ); | 556 | forwardTimer = new QTimer( this ); |
557 | connect( forwardTimer, SIGNAL( timeout() ), | 557 | connect( forwardTimer, SIGNAL( timeout() ), |
558 | this, SLOT( forwardTimerTimeout() ) ); | 558 | this, SLOT( forwardTimerTimeout() ) ); |
559 | 559 | ||
560 | deleteSoundButton = new QPushButton( tab, "deleteSoundButton" ); | 560 | deleteSoundButton = new QPushButton( tab, "deleteSoundButton" ); |
561 | layout1->addMultiCellWidget( deleteSoundButton, 1, 1, 8, 8); | 561 | layout1->addMultiCellWidget( deleteSoundButton, 1, 1, 8, 8); |
562 | deleteSoundButton->setText( tr( "Del" ) ); | 562 | deleteSoundButton->setText( tr( "Del" ) ); |
563 | 563 | ||
564 | ListView1 = new QListView( tab, "IconView1" ); | 564 | ListView1 = new QListView( tab, "IconView1" ); |
565 | layout1->addMultiCellWidget( ListView1, 2, 2, 0, 8); | 565 | layout1->addMultiCellWidget( ListView1, 2, 2, 0, 8); |
566 | 566 | ||
567 | ListView1->addColumn( tr( "Name" ) ); | 567 | ListView1->addColumn( tr( "Name" ) ); |
568 | // ListView1->setColumnWidth( 0, 140); | 568 | // ListView1->setColumnWidth( 0, 140); |
569 | ListView1->setSorting( 1, false); | 569 | ListView1->setSorting( 1, false); |
570 | ListView1->addColumn( tr( "Time" ) ); //in seconds | 570 | ListView1->addColumn( tr( "Time" ) ); //in seconds |
571 | // ListView1->setColumnWidth( 1, -1); | 571 | // ListView1->setColumnWidth( 1, -1); |
572 | // ListView1->addColumn( tr("Location") ); | 572 | // ListView1->addColumn( tr("Location") ); |
573 | // ListView1->setColumnWidth( 2, -1); | 573 | // ListView1->setColumnWidth( 2, -1); |
574 | // ListView1->addColumn( tr("Date") ); | 574 | // ListView1->addColumn( tr("Date") ); |
575 | // ListView1->setColumnWidth( 3, -1); | 575 | // ListView1->setColumnWidth( 3, -1); |
576 | ListView1->setColumnWidthMode(0, QListView::Maximum); | 576 | ListView1->setColumnWidthMode(0, QListView::Maximum); |
577 | // ListView1->setColumnWidthMode(1, QListView::Maximum); | 577 | // ListView1->setColumnWidthMode(1, QListView::Maximum); |
578 | 578 | ||
579 | // ListView1->setColumnWidthMode( 0, QListView::Manual); | 579 | // ListView1->setColumnWidthMode( 0, QListView::Manual); |
580 | ListView1->setColumnAlignment( 1, QListView::AlignCenter); | 580 | ListView1->setColumnAlignment( 1, QListView::AlignCenter); |
581 | // ListView1->setColumnAlignment( 2, QListView::AlignRight); | 581 | // ListView1->setColumnAlignment( 2, QListView::AlignRight); |
582 | // ListView1->setColumnAlignment( 3, QListView::AlignLeft); | 582 | // ListView1->setColumnAlignment( 3, QListView::AlignLeft); |
583 | ListView1->setAllColumnsShowFocus( true ); | 583 | ListView1->setAllColumnsShowFocus( true ); |
584 | QPEApplication::setStylusOperation( ListView1->viewport(), QPEApplication::RightOnHold); | 584 | QPEApplication::setStylusOperation( ListView1->viewport(), QPEApplication::RightOnHold); |
585 | 585 | ||
586 | TabWidget->insertTab( tab, tr( "Files" ) ); | 586 | TabWidget->insertTab( tab, tr( "Files" ) ); |
587 | 587 | ||
588 | ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** | 588 | ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** |
589 | tab_3 = new QWidget( TabWidget, "tab_3" ); | 589 | tab_3 = new QWidget( TabWidget, "tab_3" ); |
590 | QGridLayout *glayout3 = new QGridLayout( tab_3 ); | 590 | QGridLayout *glayout3 = new QGridLayout( tab_3 ); |
591 | glayout3->setSpacing( 2); | 591 | glayout3->setSpacing( 2); |
592 | glayout3->setMargin( 2); | 592 | glayout3->setMargin( 2); |
593 | //////////////////////////////////// | 593 | //////////////////////////////////// |
594 | sampleGroup = new QGroupBox( tab_3, "samplegroup" ); | 594 | sampleGroup = new QGroupBox( tab_3, "samplegroup" ); |
595 | sampleGroup->setTitle( tr( "Sample Rate" ) ); | 595 | sampleGroup->setTitle( tr( "Sample Rate" ) ); |
596 | sampleGroup->setFixedSize( 95,50); | 596 | sampleGroup->setFixedSize( 95,50); |
597 | 597 | ||
598 | sampleRateComboBox = new QComboBox( false, sampleGroup, "SampleRateComboBox" ); | 598 | sampleRateComboBox = new QComboBox( false, sampleGroup, "SampleRateComboBox" ); |
599 | sampleRateComboBox->setGeometry( QRect( 10, 20, 80, 25 ) ); | 599 | sampleRateComboBox->setGeometry( QRect( 10, 20, 80, 25 ) ); |
600 | //#ifndef QT_QWS_EBX | 600 | //#ifndef QT_QWS_EBX |
601 | QString s; | 601 | QString s; |
602 | int z = 0; | 602 | int z = 0; |
603 | while( deviceSampleRates[z] != -1) { | 603 | while( deviceSampleRates[z] != -1) { |
604 | sampleRateComboBox->insertItem( s.setNum( deviceSampleRates[z], 10)); | 604 | sampleRateComboBox->insertItem( s.setNum( deviceSampleRates[z], 10)); |
605 | z++; | 605 | z++; |
606 | } | 606 | } |
607 | 607 | ||
608 | 608 | ||
609 | glayout3->addMultiCellWidget( sampleGroup, 0, 0, 0, 0); | 609 | glayout3->addMultiCellWidget( sampleGroup, 0, 0, 0, 0); |
610 | 610 | ||
611 | sizeGroup= new QGroupBox( tab_3, "sizeGroup" ); | 611 | sizeGroup= new QGroupBox( tab_3, "sizeGroup" ); |
612 | sizeGroup->setTitle( tr( "Limit Size" ) ); | 612 | sizeGroup->setTitle( tr( "Limit Size" ) ); |
613 | sizeGroup->setFixedSize( 80, 50); | 613 | sizeGroup->setFixedSize( 80, 50); |
614 | 614 | ||
615 | sizeLimitCombo = new QComboBox( false, sizeGroup, "sizeLimitCombo" ); | 615 | sizeLimitCombo = new QComboBox( false, sizeGroup, "sizeLimitCombo" ); |
616 | sizeLimitCombo ->setGeometry( QRect( 5, 20, 70, 25 ) ); | 616 | sizeLimitCombo ->setGeometry( QRect( 5, 20, 70, 25 ) ); |
617 | sizeLimitCombo->insertItem(tr("Unlimited")); | 617 | sizeLimitCombo->insertItem(tr("Unlimited")); |
618 | 618 | ||
619 | for(int i=1;i<13; i++) { | 619 | for(int i=1;i<13; i++) { |
620 | sizeLimitCombo->insertItem( QString::number( i * 5)); | 620 | sizeLimitCombo->insertItem( QString::number( i * 5)); |
621 | } | 621 | } |
622 | 622 | ||
623 | 623 | ||
624 | glayout3->addMultiCellWidget( sizeGroup, 0, 0, 1, 1); | 624 | glayout3->addMultiCellWidget( sizeGroup, 0, 0, 1, 1); |
625 | dirGroup = new QGroupBox( tab_3, "dirGroup" ); | 625 | dirGroup = new QGroupBox( tab_3, "dirGroup" ); |
626 | dirGroup->setTitle( tr( "File Directory" ) ); | 626 | dirGroup->setTitle( tr( "File Directory" ) ); |
627 | dirGroup->setFixedSize( 130, 50); | 627 | dirGroup->setFixedSize( 130, 50); |
628 | 628 | ||
629 | directoryComboBox = new QComboBox( false, dirGroup, "dirGroup" ); | 629 | directoryComboBox = new QComboBox( false, dirGroup, "dirGroup" ); |
630 | directoryComboBox->setGeometry( QRect( 10, 15, 115, 25 ) ); | 630 | directoryComboBox->setGeometry( QRect( 10, 15, 115, 25 ) ); |
631 | 631 | ||
632 | glayout3->addMultiCellWidget( dirGroup, 1, 1, 0, 0); | 632 | glayout3->addMultiCellWidget( dirGroup, 1, 1, 0, 0); |
633 | 633 | ||
634 | bitGroup = new QGroupBox( tab_3, "bitGroup" ); | 634 | bitGroup = new QGroupBox( tab_3, "bitGroup" ); |
635 | bitGroup->setTitle( tr( "Bit Depth" ) ); | 635 | bitGroup->setTitle( tr( "Bit Depth" ) ); |
636 | bitGroup->setFixedSize( 65, 50); | 636 | bitGroup->setFixedSize( 65, 50); |
637 | 637 | ||
638 | bitRateComboBox = new QComboBox( false, bitGroup, "BitRateComboBox" ); | 638 | bitRateComboBox = new QComboBox( false, bitGroup, "BitRateComboBox" ); |
639 | 639 | ||
640 | z = 0; | 640 | z = 0; |
641 | while( deviceBitRates[z] != -1) { | 641 | while( deviceBitRates[z] != -1) { |
642 | bitRateComboBox->insertItem( s.setNum( deviceBitRates[z], 10) ); | 642 | bitRateComboBox->insertItem( s.setNum( deviceBitRates[z], 10) ); |
643 | z++; | 643 | z++; |
644 | } | 644 | } |
645 | 645 | ||
646 | bitRateComboBox->setGeometry( QRect( 5, 20, 50, 25 ) ); | 646 | bitRateComboBox->setGeometry( QRect( 5, 20, 50, 25 ) ); |
647 | 647 | ||
648 | glayout3->addMultiCellWidget( bitGroup, 1, 1, 1, 1); | 648 | glayout3->addMultiCellWidget( bitGroup, 1, 1, 1, 1); |
649 | 649 | ||
650 | compressionCheckBox = new QCheckBox ( tr("Wave Compression (smaller files)"), tab_3 ); | 650 | compressionCheckBox = new QCheckBox ( tr("Wave Compression (smaller files)"), tab_3 ); |
651 | 651 | ||
652 | autoMuteCheckBox = new QCheckBox ( tr("Auto Mute"), tab_3 ); | 652 | autoMuteCheckBox = new QCheckBox ( tr("Auto Mute"), tab_3 ); |
653 | stereoCheckBox = new QCheckBox ( tr("Stereo"), tab_3 ); | 653 | stereoCheckBox = new QCheckBox ( tr("Stereo"), tab_3 ); |
654 | 654 | ||
655 | glayout3->addMultiCellWidget( compressionCheckBox, 2, 2, 0, 3); | 655 | glayout3->addMultiCellWidget( compressionCheckBox, 2, 2, 0, 3); |
656 | glayout3->addMultiCellWidget( autoMuteCheckBox, 3, 3, 0, 0); | 656 | glayout3->addMultiCellWidget( autoMuteCheckBox, 3, 3, 0, 0); |
657 | glayout3->addMultiCellWidget( stereoCheckBox, 3, 3, 1, 1); | 657 | glayout3->addMultiCellWidget( stereoCheckBox, 3, 3, 1, 1); |
658 | 658 | ||
659 | tab_5 = new QWidget( TabWidget, "tab_5" ); | 659 | tab_5 = new QWidget( TabWidget, "tab_5" ); |
660 | 660 | ||
661 | QHBoxLayout *Layout19a; | 661 | QHBoxLayout *Layout19a; |
662 | Layout19a = new QHBoxLayout( tab_5); | 662 | Layout19a = new QHBoxLayout( tab_5); |
663 | Layout19a->setSpacing( 2 ); | 663 | Layout19a->setSpacing( 2 ); |
664 | Layout19a->setMargin( 0 ); | 664 | Layout19a->setMargin( 0 ); |
665 | 665 | ||
666 | Layout15 = new QVBoxLayout( this); | 666 | Layout15 = new QVBoxLayout( this); |
667 | Layout15->setSpacing( 2 ); | 667 | Layout15->setSpacing( 2 ); |
668 | Layout15->setMargin( 0 ); | 668 | Layout15->setMargin( 0 ); |
669 | 669 | ||
670 | Layout15b = new QVBoxLayout( this); | 670 | Layout15b = new QVBoxLayout( this); |
671 | Layout15b->setSpacing( 2 ); | 671 | Layout15b->setSpacing( 2 ); |
672 | Layout15b->setMargin( 0 ); | 672 | Layout15b->setMargin( 0 ); |
673 | 673 | ||
674 | TextLabel2 = new QLabel( tab_5, "InputLabel" ); | 674 | TextLabel2 = new QLabel( tab_5, "InputLabel" ); |
675 | TextLabel2->setText( tr( "In")); | 675 | TextLabel2->setText( tr( "In")); |
676 | TextLabel2->setFixedWidth( 35); | 676 | TextLabel2->setFixedWidth( 35); |
677 | Layout15->addWidget( TextLabel2 ); | 677 | Layout15->addWidget( TextLabel2 ); |
678 | 678 | ||
679 | TextLabel3 = new QLabel( tab_5, "OutputLabel" ); | 679 | TextLabel3 = new QLabel( tab_5, "OutputLabel" ); |
680 | TextLabel3->setText( tr( "Out" ) ); | 680 | TextLabel3->setText( tr( "Out" ) ); |
681 | Layout15b->addWidget( TextLabel3 ); | 681 | Layout15b->addWidget( TextLabel3 ); |
682 | 682 | ||
683 | InputSlider = new QSlider( -100, 0, 10, 0, QSlider::Vertical, tab_5, (const char *) "InputSlider" ); | 683 | InputSlider = new QSlider( -100, 0, 10, 0, QSlider::Vertical, tab_5, (const char *) "InputSlider" ); |
684 | InputSlider->setTickmarks( QSlider::Both); | 684 | InputSlider->setTickmarks( QSlider::Both); |
685 | Layout15->addWidget( InputSlider); | 685 | Layout15->addWidget( InputSlider); |
686 | 686 | ||
687 | OutputSlider = new QSlider( -100,0,10,0, QSlider::Vertical,tab_5,(const char *) "OutputSlider" ); | 687 | OutputSlider = new QSlider( -100,0,10,0, QSlider::Vertical,tab_5,(const char *) "OutputSlider" ); |
688 | OutputSlider->setTickmarks( QSlider::Both); | 688 | OutputSlider->setTickmarks( QSlider::Both); |
689 | 689 | ||
690 | Layout15b->addWidget( OutputSlider ); | 690 | Layout15b->addWidget( OutputSlider ); |
691 | 691 | ||
692 | outMuteCheckBox = new QCheckBox ( tr("mute"), tab_5 ); | 692 | outMuteCheckBox = new QCheckBox ( tr("mute"), tab_5 ); |
693 | Layout15->addWidget( outMuteCheckBox ); | 693 | Layout15->addWidget( outMuteCheckBox ); |
694 | 694 | ||
695 | inMuteCheckBox = new QCheckBox ( tr("mute"), tab_5 ); | 695 | inMuteCheckBox = new QCheckBox ( tr("mute"), tab_5 ); |
696 | inMuteCheckBox-> setFocusPolicy ( QWidget::NoFocus ); | 696 | inMuteCheckBox-> setFocusPolicy ( QWidget::NoFocus ); |
697 | Layout15b->addWidget( inMuteCheckBox ); | 697 | Layout15b->addWidget( inMuteCheckBox ); |
698 | 698 | ||
699 | 699 | ||
700 | Layout19a->addLayout( Layout15 ); | 700 | Layout19a->addLayout( Layout15 ); |
701 | Layout19a->addLayout( Layout15b ); | 701 | Layout19a->addLayout( Layout15b ); |
702 | 702 | ||
703 | fillDirectoryCombo(); | 703 | fillDirectoryCombo(); |
704 | 704 | ||
705 | TabWidget->insertTab( tab_3, tr( "Options" ) ); | 705 | TabWidget->insertTab( tab_3, tr( "Options" ) ); |
706 | 706 | ||
707 | TabWidget->insertTab( tab_5, tr( "Volume" ) ); | 707 | TabWidget->insertTab( tab_5, tr( "Volume" ) ); |
708 | 708 | ||
709 | 709 | ||
710 | waveform = new Waveform( this, "waveform" ); | 710 | waveform = new Waveform( this, "waveform" ); |
711 | // waveform->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)3, waveform->sizePolicy().hasHeightForWidth() ) ); | 711 | // waveform->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)3, waveform->sizePolicy().hasHeightForWidth() ) ); |
712 | waveform->setMinimumSize( QSize( 0, 50 ) ); | 712 | waveform->setMinimumSize( QSize( 0, 50 ) ); |
713 | 713 | ||
714 | layout->addMultiCellWidget( waveform, 8, 8, 0, 8); | 714 | layout->addMultiCellWidget( waveform, 8, 8, 0, 8); |
715 | waveform->setBackgroundColor ( black ); | 715 | waveform->setBackgroundColor ( black ); |
716 | } | 716 | } |
717 | 717 | ||
718 | void QtRec::initIconView() { | 718 | void QtRec::initIconView() { |
719 | 719 | ||
720 | ListView1->clear(); | 720 | ListView1->clear(); |
721 | Config cfg("OpieRec"); | 721 | Config cfg("OpieRec"); |
722 | cfg.setGroup("Sounds"); | 722 | cfg.setGroup("Sounds"); |
723 | QString temp; | 723 | QString temp; |
724 | QPixmap image0( ( const char** ) image0_data ); | 724 | QPixmap image0( ( const char** ) image0_data ); |
725 | 725 | ||
726 | int nFiles = cfg.readNumEntry("NumberofFiles",0); | 726 | int nFiles = cfg.readNumEntry("NumberofFiles",0); |
727 | // odebug << "init number of files " << nFiles << "" << oendl; | 727 | // odebug << "init number of files " << nFiles << "" << oendl; |
728 | 728 | ||
729 | for(int i=1;i<= nFiles;i++) { | 729 | for(int i=1;i<= nFiles;i++) { |
730 | 730 | ||
731 | QListViewItem * item; | 731 | QListViewItem * item; |
732 | QString fileS, mediaLocation, fileDate, filePath; | 732 | QString fileS, mediaLocation, fileDate, filePath; |
733 | 733 | ||
734 | temp.sprintf( "%d",i); | 734 | temp.sprintf( "%d",i); |
735 | temp = cfg.readEntry( temp,""); //reads currentFile | 735 | temp = cfg.readEntry( temp,""); //reads currentFile |
736 | filePath = cfg.readEntry( temp,""); //currentFileName | 736 | filePath = cfg.readEntry( temp,""); //currentFileName |
737 | 737 | ||
738 | QFileInfo info(filePath); | 738 | QFileInfo info(filePath); |
739 | fileDate = info.lastModified().toString(); | 739 | fileDate = info.lastModified().toString(); |
740 | 740 | ||
741 | fileS = cfg.readEntry( filePath, "0" );// file length in seconds | 741 | fileS = cfg.readEntry( filePath, "0" );// file length in seconds |
742 | mediaLocation = getStorage( filePath); | 742 | mediaLocation = getStorage( filePath); |
743 | if( info.exists()) { | 743 | if( info.exists()) { |
744 | item = new QListViewItem( ListView1, temp, fileS /*, mediaLocation, fileDate*/); | 744 | item = new QListViewItem( ListView1, temp, fileS /*, mediaLocation, fileDate*/); |
745 | item->setPixmap( 0, image0); | 745 | item->setPixmap( 0, image0); |
746 | if( currentFileName == filePath) | 746 | if( currentFileName == filePath) |
747 | ListView1->setSelected( item, true); | 747 | ListView1->setSelected( item, true); |
748 | } | 748 | } |
749 | } | 749 | } |
750 | } | 750 | } |
751 | 751 | ||
752 | void QtRec::initConnections() { | 752 | void QtRec::initConnections() { |
753 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 753 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
754 | 754 | ||
755 | connect( toBeginningButton, SIGNAL( pressed()), | 755 | connect( toBeginningButton, SIGNAL( pressed()), |
756 | this, SLOT( rewindPressed() )); | 756 | this, SLOT( rewindPressed() )); |
757 | connect( toBeginningButton, SIGNAL( released()), | 757 | connect( toBeginningButton, SIGNAL( released()), |
758 | this, SLOT( rewindReleased() )); | 758 | this, SLOT( rewindReleased() )); |
759 | connect( toEndButton, SIGNAL( pressed()), | 759 | connect( toEndButton, SIGNAL( pressed()), |
760 | this, SLOT( FastforwardPressed() )); | 760 | this, SLOT( FastforwardPressed() )); |
761 | connect( toEndButton, SIGNAL( released()), | 761 | connect( toEndButton, SIGNAL( released()), |
762 | this, SLOT( FastforwardReleased() )); | 762 | this, SLOT( FastforwardReleased() )); |
763 | connect( deleteSoundButton, SIGNAL(released()), | 763 | connect( deleteSoundButton, SIGNAL(released()), |
764 | this, SLOT( deleteSound() )); | 764 | this, SLOT( deleteSound() )); |
765 | connect( Stop_PushButton, SIGNAL(released()), | 765 | connect( Stop_PushButton, SIGNAL(released()), |
766 | this, SLOT( doPlayBtn() )); | 766 | this, SLOT( doPlayBtn() )); |
767 | connect( Rec_PushButton, SIGNAL(released()), | 767 | connect( Rec_PushButton, SIGNAL(released()), |
768 | this, SLOT( newSound() ) ); | 768 | this, SLOT( newSound() ) ); |
769 | connect( TabWidget, SIGNAL( currentChanged(QWidget*)), | 769 | connect( TabWidget, SIGNAL( currentChanged(QWidget*)), |
770 | this, SLOT(thisTab(QWidget*) )); | 770 | this, SLOT(thisTab(QWidget*) )); |
771 | connect( OutputSlider, SIGNAL(sliderReleased()), | 771 | connect( OutputSlider, SIGNAL(sliderReleased()), |
772 | this, SLOT( changedOutVolume()) ); | 772 | this, SLOT( changedOutVolume()) ); |
773 | connect( InputSlider, SIGNAL(sliderReleased()), | 773 | connect( InputSlider, SIGNAL(sliderReleased()), |
774 | this, SLOT( changedInVolume()) ); | 774 | this, SLOT( changedInVolume()) ); |
775 | 775 | ||
776 | connect( sampleRateComboBox, SIGNAL(activated(int)), | 776 | connect( sampleRateComboBox, SIGNAL(activated(int)), |
777 | this, SLOT( changesamplerateCombo(int)) ); | 777 | this, SLOT( changesamplerateCombo(int)) ); |
778 | connect( bitRateComboBox, SIGNAL(activated(int)), | 778 | connect( bitRateComboBox, SIGNAL(activated(int)), |
779 | this, SLOT( changebitrateCombo(int)) ); | 779 | this, SLOT( changebitrateCombo(int)) ); |
780 | 780 | ||
781 | connect( directoryComboBox, SIGNAL(activated(int)), | 781 | connect( directoryComboBox, SIGNAL(activated(int)), |
782 | this, SLOT( changeDirCombo(int)) ); | 782 | this, SLOT( changeDirCombo(int)) ); |
783 | connect( sizeLimitCombo, SIGNAL(activated(int)), | 783 | connect( sizeLimitCombo, SIGNAL(activated(int)), |
784 | this, SLOT( changeSizeLimitCombo(int)) ); | 784 | this, SLOT( changeSizeLimitCombo(int)) ); |
785 | 785 | ||
786 | connect( stereoCheckBox, SIGNAL(toggled(bool)), | 786 | connect( stereoCheckBox, SIGNAL(toggled(bool)), |
787 | this, SLOT( changeStereoCheck(bool)) ); | 787 | this, SLOT( changeStereoCheck(bool)) ); |
788 | 788 | ||
789 | connect( outMuteCheckBox, SIGNAL(toggled(bool)), | 789 | connect( outMuteCheckBox, SIGNAL(toggled(bool)), |
790 | this, SLOT( doVolMuting(bool)) ); | 790 | this, SLOT( doVolMuting(bool)) ); |
791 | connect( inMuteCheckBox , SIGNAL(toggled(bool)), | 791 | connect( inMuteCheckBox , SIGNAL(toggled(bool)), |
792 | this, SLOT( doMicMuting(bool)) ); | 792 | this, SLOT( doMicMuting(bool)) ); |
793 | 793 | ||
794 | connect( ListView1,SIGNAL(doubleClicked(QListViewItem*)), | 794 | connect( ListView1,SIGNAL(doubleClicked(QListViewItem*)), |
795 | this,SLOT( itClick(QListViewItem*))); | 795 | this,SLOT( itClick(QListViewItem*))); |
796 | connect( ListView1, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), | 796 | connect( ListView1, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), |
797 | this,SLOT( listPressed(int,QListViewItem*,const QPoint&,int)) ); | 797 | this,SLOT( listPressed(int,QListViewItem*,const QPoint&,int)) ); |
798 | connect( timeSlider, SIGNAL( sliderMoved(int)), | 798 | connect( timeSlider, SIGNAL( sliderMoved(int)), |
799 | this, SLOT( changeTimeSlider(int) )); | 799 | this, SLOT( changeTimeSlider(int) )); |
800 | connect( timeSlider, SIGNAL( sliderPressed()), | 800 | connect( timeSlider, SIGNAL( sliderPressed()), |
801 | this, SLOT( timeSliderPressed() )); | 801 | this, SLOT( timeSliderPressed() )); |
802 | connect( timeSlider, SIGNAL( sliderReleased()), | 802 | connect( timeSlider, SIGNAL( sliderReleased()), |
803 | this, SLOT( timeSliderReleased() )); | 803 | this, SLOT( timeSliderReleased() )); |
804 | connect( compressionCheckBox, SIGNAL( toggled(bool)), | 804 | connect( compressionCheckBox, SIGNAL( toggled(bool)), |
805 | this, SLOT( compressionSelected(bool))); | 805 | this, SLOT( compressionSelected(bool))); |
806 | connect( autoMuteCheckBox, SIGNAL( toggled(bool)), | 806 | connect( autoMuteCheckBox, SIGNAL( toggled(bool)), |
807 | this, SLOT( slotAutoMute(bool))); | 807 | this, SLOT( slotAutoMute(bool))); |
808 | } | 808 | } |
809 | 809 | ||
810 | void QtRec::initConfig() { | 810 | void QtRec::initConfig() { |
811 | int index, fred, i; | 811 | int index, fred, i; |
812 | Config cfg("OpieRec"); | 812 | Config cfg("OpieRec"); |
813 | cfg.setGroup("Settings"); | 813 | cfg.setGroup("Settings"); |
814 | 814 | ||
815 | index = cfg.readNumEntry("samplerate",22050); | 815 | index = cfg.readNumEntry("samplerate",22050); |
816 | bool ok; | 816 | bool ok; |
817 | 817 | ||
818 | for(int ws=0;ws<sampleRateComboBox->count();ws++) { | 818 | for(int ws=0;ws<sampleRateComboBox->count();ws++) { |
819 | fred = sampleRateComboBox->text(ws).toInt(&ok, 10); | 819 | fred = sampleRateComboBox->text(ws).toInt(&ok, 10); |
820 | if( index == fred) { | 820 | if( index == fred) { |
821 | filePara.sampleRate = fred; | 821 | filePara.sampleRate = fred; |
822 | sampleRateComboBox->setCurrentItem(ws); | 822 | sampleRateComboBox->setCurrentItem(ws); |
823 | } | 823 | } |
824 | } | 824 | } |
825 | 825 | ||
826 | i = cfg.readNumEntry("bitrate",16); | 826 | i = cfg.readNumEntry("bitrate",16); |
827 | if(i == 16) | 827 | if(i == 16) |
828 | bitRateComboBox->setCurrentItem( 1); | 828 | bitRateComboBox->setCurrentItem( 1); |
829 | else if(i == 24) | 829 | else if(i == 24) |
830 | bitRateComboBox->setCurrentItem( 2); | 830 | bitRateComboBox->setCurrentItem( 2); |
831 | else if(i == 32) | 831 | else if(i == 32) |
832 | bitRateComboBox->setCurrentItem( 3); | 832 | bitRateComboBox->setCurrentItem( 3); |
833 | else | 833 | else |
834 | bitRateComboBox->setCurrentItem( 0); | 834 | bitRateComboBox->setCurrentItem( 0); |
835 | 835 | ||
836 | filePara.resolution = i; | 836 | filePara.resolution = i; |
837 | 837 | ||
838 | i = cfg.readNumEntry("sizeLimit", 5 ); | 838 | i = cfg.readNumEntry("sizeLimit", 5 ); |
839 | QString temp; | 839 | QString temp; |
840 | sizeLimitCombo->setCurrentItem((i/5)); | 840 | sizeLimitCombo->setCurrentItem((i/5)); |
841 | 841 | ||
842 | stereoCheckBox->setChecked( cfg.readBoolEntry("stereo", 1)); | 842 | stereoCheckBox->setChecked( cfg.readBoolEntry("stereo", 1)); |
843 | if( stereoCheckBox->isChecked()) { | 843 | if( stereoCheckBox->isChecked()) { |
844 | filePara.channels = 2; | 844 | filePara.channels = 2; |
845 | } else { | 845 | } else { |
846 | filePara.channels = 1; | 846 | filePara.channels = 1; |
847 | } | 847 | } |
848 | 848 | ||
849 | compressionCheckBox->setChecked( cfg.readBoolEntry("wavCompression",1)); | 849 | compressionCheckBox->setChecked( cfg.readBoolEntry("wavCompression",1)); |
850 | if( compressionCheckBox->isChecked()) { | 850 | if( compressionCheckBox->isChecked()) { |
851 | bitRateComboBox->setEnabled(false); | 851 | bitRateComboBox->setEnabled(false); |
852 | bitRateComboBox->setCurrentItem(0); | 852 | bitRateComboBox->setCurrentItem(0); |
853 | filePara.resolution=16; | 853 | filePara.resolution=16; |
854 | } | 854 | } |
855 | 855 | ||
856 | autoMuteCheckBox->setChecked( cfg.readBoolEntry("useAutoMute",0)); | 856 | autoMuteCheckBox->setChecked( cfg.readBoolEntry("useAutoMute",0)); |
857 | if( autoMuteCheckBox->isChecked()) | 857 | if( autoMuteCheckBox->isChecked()) |
858 | slotAutoMute(true); | 858 | slotAutoMute(true); |
859 | else | 859 | else |
860 | slotAutoMute(false); | 860 | slotAutoMute(false); |
861 | 861 | ||
862 | Config cofg( "qpe"); | 862 | Config cofg( "qpe"); |
863 | cofg.setGroup( "Volume"); | 863 | cofg.setGroup( "Volume"); |
864 | outMuteCheckBox->setChecked( cofg.readBoolEntry( "Mute",0)); | 864 | outMuteCheckBox->setChecked( cofg.readBoolEntry( "Mute",0)); |
865 | inMuteCheckBox->setChecked( cofg.readBoolEntry( "MicMute",0)); | 865 | inMuteCheckBox->setChecked( cofg.readBoolEntry( "MicMute",0)); |
866 | } | 866 | } |
867 | 867 | ||
868 | void QtRec::stop() { | 868 | void QtRec::stop() { |
869 | owarn << "STOP" << oendl; | 869 | owarn << "STOP" << oendl; |
870 | setRecordButton(false); | 870 | setRecordButton(false); |
871 | 871 | ||
872 | if( !recording) | 872 | if( !recording) |
873 | endPlaying(); | 873 | endPlaying(); |
874 | else | 874 | else |
875 | endRecording(); | 875 | endRecording(); |
876 | timeSlider->setValue(0); | 876 | timeSlider->setValue(0); |
877 | } | 877 | } |
878 | 878 | ||
879 | void QtRec::doPlayBtn() { | 879 | void QtRec::doPlayBtn() { |
880 | 880 | ||
881 | if(!stopped) { | 881 | if(!stopped) { |
882 | // playLabel2->setText(tr("Play")); | 882 | // playLabel2->setText(tr("Play")); |
883 | stop(); | 883 | stop(); |
884 | } else { | 884 | } else { |
885 | if(ListView1->currentItem() == 0) return; | 885 | if(ListView1->currentItem() == 0) return; |
886 | // playLabel2->setText(tr("Stop")); | 886 | // playLabel2->setText(tr("Stop")); |
887 | currentFile = ListView1->currentItem()->text(0); | 887 | currentFile = ListView1->currentItem()->text(0); |
888 | start(); | 888 | start(); |
889 | } | 889 | } |
890 | } | 890 | } |
891 | 891 | ||
892 | void QtRec::start() { //play | 892 | void QtRec::start() { //play |
893 | if( stopped) { | 893 | if( stopped) { |
894 | QPixmap image3( ( const char** ) image3_data ); | 894 | QPixmap image3( ( const char** ) image3_data ); |
895 | Stop_PushButton->setPixmap( image3 ); | 895 | Stop_PushButton->setPixmap( image3 ); |
896 | Stop_PushButton->setDown( true); | 896 | Stop_PushButton->setDown( true); |
897 | stopped = false; | 897 | stopped = false; |
898 | paused = false; | 898 | paused = false; |
899 | secCount = 1; | 899 | secCount = 1; |
900 | 900 | ||
901 | if( openPlayFile()) | 901 | if( openPlayFile()) |
902 | if( setupAudio( false)) //recording is false | 902 | if( setupAudio( false)) //recording is false |
903 | doPlay(); | 903 | doPlay(); |
904 | } | 904 | } |
905 | } | 905 | } |
906 | 906 | ||
907 | bool QtRec::rec() { //record | 907 | bool QtRec::rec() { //record |
908 | QString timeString; | 908 | QString timeString; |
909 | timeString.sprintf("%.0f", 0.0); | 909 | timeString.sprintf("%.0f", 0.0); |
910 | // timeLabel->setText( timeString+ " seconds"); | 910 | // timeLabel->setText( timeString+ " seconds"); |
911 | if(!stopped) { | 911 | if(!stopped) { |
912 | monitoring = true; | 912 | monitoring = true; |
913 | return false; | 913 | return false; |
914 | } else { | 914 | } else { |
915 | secCount = 1; | 915 | secCount = 1; |
916 | // playLabel2->setText(tr("Stop")); | 916 | // playLabel2->setText(tr("Stop")); |
917 | monitoring = false; | 917 | monitoring = false; |
918 | setRecordButton( true); | 918 | setRecordButton( true); |
919 | 919 | ||
920 | if( setupAudio( true)) | 920 | if( setupAudio( true)) |
921 | if(setUpFile()) { | 921 | if(setUpFile()) { |
922 | int fileSize = 0; | 922 | int fileSize = 0; |
923 | Config cfg("OpieRec"); | 923 | Config cfg("OpieRec"); |
924 | cfg.setGroup("Settings"); | 924 | cfg.setGroup("Settings"); |
925 | // odebug << "<<<<<<<Device bits " << soundDevice->getDeviceBits() | 925 | // odebug << "<<<<<<<Device bits " << soundDevice->getDeviceBits() |
926 | // << ", device rate " << soundDevice->getDeviceRate() | 926 | // << ", device rate " << soundDevice->getDeviceRate() |
927 | // << ", device channels " << soundDevice->getDeviceChannels() << oendl; | 927 | // << ", device channels " << soundDevice->getDeviceChannels() << oendl; |
928 | 928 | ||
929 | //filePara.sampleRate = cfg.readNumEntry("samplerate", 22050); | 929 | //filePara.sampleRate = cfg.readNumEntry("samplerate", 22050); |
930 | // odebug << "sample rate is " << filePara.sampleRate << "" << oendl; | 930 | // odebug << "sample rate is " << filePara.sampleRate << "" << oendl; |
931 | filePara.SecondsToRecord = getCurrentSizeLimit(); | 931 | filePara.SecondsToRecord = getCurrentSizeLimit(); |
932 | 932 | ||
933 | // odebug << "size limit " << filePara.SecondsToRecord << " sec" << oendl; | 933 | // odebug << "size limit " << filePara.SecondsToRecord << " sec" << oendl; |
934 | int diskSize = checkDiskSpace( (const QString &) wavFile->trackName()); | 934 | int diskSize = checkDiskSpace( (const QString &) wavFile->trackName()); |
935 | 935 | ||
936 | if( filePara.SecondsToRecord == 0) { | 936 | if( filePara.SecondsToRecord == 0) { |
937 | fileSize = diskSize; | 937 | fileSize = diskSize; |
938 | } else if( filePara.format == WAVE_FORMAT_PCM) { | 938 | } else if( filePara.format == WAVE_FORMAT_PCM) { |
939 | // odebug << "WAVE_FORMAT_PCM" << oendl; | 939 | // odebug << "WAVE_FORMAT_PCM" << oendl; |
940 | fileSize = (filePara.SecondsToRecord ) * filePara.channels | 940 | fileSize = (filePara.SecondsToRecord ) * filePara.channels |
941 | * filePara.sampleRate * ( filePara.resolution / 8) + 1000; | 941 | * filePara.sampleRate * ( filePara.resolution / 8) + 1000; |
942 | } else { | 942 | } else { |
943 | // odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl; | 943 | // odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl; |
944 | fileSize = ((filePara.SecondsToRecord) * filePara.channels | 944 | fileSize = ((filePara.SecondsToRecord) * filePara.channels |
945 | * filePara.sampleRate * ( filePara.resolution / 8) ) / 4 + 250; | 945 | * filePara.sampleRate * ( filePara.resolution / 8) ) / 4 + 250; |
946 | } | 946 | } |
947 | 947 | ||
948 | filePara.samplesToRecord = fileSize; | 948 | filePara.samplesToRecord = fileSize; |
949 | odebug << "filesize should be " << filePara.samplesToRecord | 949 | odebug << "filesize should be " << filePara.samplesToRecord |
950 | << ", bits " << filePara.resolution << ", rate " << filePara.sampleRate; | 950 | << ", bits " << filePara.resolution << ", rate " << filePara.sampleRate; |
951 | if( paused) { | 951 | if( paused) { |
952 | paused = false; | 952 | paused = false; |
953 | } | 953 | } |
954 | // else { | 954 | // else { |
955 | odebug << "Setting timeslider " << filePara.samplesToRecord << "" << oendl; | 955 | odebug << "Setting timeslider " << filePara.samplesToRecord << "" << oendl; |
956 | // if(fileSize != 0) | 956 | // if(fileSize != 0) |
957 | timeSlider->setRange(0, filePara.samplesToRecord); | 957 | timeSlider->setRange(0, filePara.samplesToRecord); |
958 | // } | 958 | // } |
959 | 959 | ||
960 | if( diskSize < fileSize/1024) { | 960 | if( diskSize < fileSize/1024) { |
961 | QMessageBox::warning(this, | 961 | QMessageBox::warning(this, |
962 | tr("Low Disk Space"), | 962 | tr("Low Disk Space"), |
963 | tr("You are running low of\nrecording space\n" | 963 | tr("You are running low of\nrecording space\n" |
964 | "or a card isn't being recognized")); | 964 | "or a card isn't being recognized")); |
965 | stopped = true; //we need to be stopped | 965 | stopped = true; //we need to be stopped |
966 | stop(); | 966 | stop(); |
967 | } else { | 967 | } else { |
968 | QString msg; | 968 | QString msg; |
969 | msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); | 969 | msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); |
970 | #ifdef DEV_VERSION | 970 | #ifdef DEV_VERSION |
971 | setCaption( msg); | 971 | setCaption( msg); |
972 | #endif | 972 | #endif |
973 | filePara.fileName=currentFile.latin1(); | 973 | filePara.fileName=currentFile.latin1(); |
974 | odebug << "Start recording" << oendl; | 974 | odebug << "Start recording" << oendl; |
975 | stopped = false; | 975 | stopped = false; |
976 | 976 | ||
977 | #ifdef THREADED | 977 | #ifdef THREADED |
978 | odebug << "Start recording thread" << oendl; | 978 | odebug << "Start recording thread" << oendl; |
979 | pthread_t thread1; | 979 | pthread_t thread1; |
980 | pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/); | 980 | pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/); |
981 | #endif | 981 | #endif |
982 | toBeginningButton->setEnabled( false); | 982 | toBeginningButton->setEnabled( false); |
983 | toEndButton->setEnabled( false); | 983 | toEndButton->setEnabled( false); |
984 | 984 | ||
985 | startTimer(1000); | 985 | startTimer(1000); |
986 | #ifndef THREADED | 986 | #ifndef THREADED |
987 | quickRec(); | 987 | quickRec(); |
988 | #endif | 988 | #endif |
989 | } | 989 | } |
990 | } //end setUpFile | 990 | } //end setUpFile |
991 | } //end setupAudio | 991 | } //end setupAudio |
992 | return true; | 992 | return true; |
993 | } | 993 | } |
994 | /* | 994 | /* |
995 | This happens when a tab is selected*/ | 995 | This happens when a tab is selected*/ |
996 | void QtRec::thisTab(QWidget* widg) { | 996 | void QtRec::thisTab(QWidget* widg) { |
997 | if(widg != NULL) { | 997 | if(widg != NULL) { |
998 | int index = TabWidget->currentPageIndex(); | 998 | int index = TabWidget->currentPageIndex(); |
999 | 999 | ||
1000 | if(index == 0) { //file page | 1000 | if(index == 0) { //file page |
1001 | } | 1001 | } |
1002 | 1002 | ||
1003 | if(index == 1) { //control page | 1003 | if(index == 1) { //control page |
1004 | fillDirectoryCombo(); | 1004 | fillDirectoryCombo(); |
1005 | // soundDevice->getOutVol(); | 1005 | // soundDevice->getOutVol(); |
1006 | // soundDevice->getInVol(); | 1006 | // soundDevice->getInVol(); |
1007 | } | 1007 | } |
1008 | 1008 | ||
1009 | if( index==2) { //help page | 1009 | if( index==2) { //help page |
1010 | } | 1010 | } |
1011 | 1011 | ||
1012 | qApp->processEvents(); | 1012 | qApp->processEvents(); |
1013 | update(); | 1013 | update(); |
1014 | } | 1014 | } |
1015 | } | 1015 | } |
1016 | 1016 | ||
1017 | void QtRec::getOutVol( ) { | 1017 | void QtRec::getOutVol( ) { |
1018 | filePara.outVol = soundDevice->getOutVolume(); | 1018 | filePara.outVol = soundDevice->getOutVolume(); |
1019 | // odebug << "out vol " << filePara.outVol << "" << oendl; | 1019 | // odebug << "out vol " << filePara.outVol << "" << oendl; |
1020 | OutputSlider->setValue( -filePara.outVol); | 1020 | OutputSlider->setValue( -filePara.outVol); |
1021 | } | 1021 | } |
1022 | 1022 | ||
1023 | void QtRec::getInVol() { | 1023 | void QtRec::getInVol() { |
1024 | filePara.inVol = soundDevice->getInVolume(); | 1024 | filePara.inVol = soundDevice->getInVolume(); |
1025 | // odebug << "in vol " << filePara.inVol << "" << oendl; | 1025 | // odebug << "in vol " << filePara.inVol << "" << oendl; |
1026 | InputSlider->setValue( -filePara.inVol); | 1026 | InputSlider->setValue( -filePara.inVol); |
1027 | } | 1027 | } |
1028 | 1028 | ||
1029 | void QtRec::changedOutVolume() { | 1029 | void QtRec::changedOutVolume() { |
1030 | soundDevice->changedOutVolume( -OutputSlider->value()); | 1030 | soundDevice->changedOutVolume( -OutputSlider->value()); |
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | void QtRec::changedInVolume( ) { | 1033 | void QtRec::changedInVolume( ) { |
1034 | soundDevice->changedInVolume( -InputSlider->value()); | 1034 | soundDevice->changedInVolume( -InputSlider->value()); |
1035 | } | 1035 | } |
1036 | 1036 | ||
1037 | 1037 | ||
1038 | bool QtRec::setupAudio( bool b) { | 1038 | bool QtRec::setupAudio( bool b) { |
1039 | bool ok; | 1039 | bool ok; |
1040 | int sampleformat, stereo, flags; | 1040 | int sampleformat, stereo, flags; |
1041 | QString dspString, mixerString; | 1041 | QString dspString, mixerString; |
1042 | 1042 | ||
1043 | filePara.resolution = bitRateComboBox->currentText().toInt( &ok,10); //16 | 1043 | filePara.resolution = bitRateComboBox->currentText().toInt( &ok,10); //16 |
1044 | 1044 | ||
1045 | if( !b) { | 1045 | if( !b) { |
1046 | // we want to play | 1046 | // we want to play |
1047 | #ifdef PDAUDIO //ALSA | 1047 | #ifdef PDAUDIO //ALSA |
1048 | if( filePara.resolution == 16 || compressionCheckBox->isChecked() ) { | 1048 | if( filePara.resolution == 16 || compressionCheckBox->isChecked() ) { |
1049 | sampleformat = SND_PCM_FORMAT_S16; | 1049 | sampleformat = SND_PCM_FORMAT_S16; |
1050 | filePara.resolution = 16; | 1050 | filePara.resolution = 16; |
1051 | } else if( filePara.resolution == 24 || compressionCheckBox->isChecked() ) { | 1051 | } else if( filePara.resolution == 24 || compressionCheckBox->isChecked() ) { |
1052 | sampleformat = SND_PCM_FORMAT_S24; | 1052 | sampleformat = SND_PCM_FORMAT_S24; |
1053 | filePara.resolution = 24; | 1053 | filePara.resolution = 24; |
1054 | } else if( filePara.resolution == 32 || compressionCheckBox->isChecked() ) { | 1054 | } else if( filePara.resolution == 32 || compressionCheckBox->isChecked() ) { |
1055 | sampleformat = SND_PCM_FORMAT_S32; | 1055 | sampleformat = SND_PCM_FORMAT_S32; |
1056 | filePara.resolution = 32; | 1056 | filePara.resolution = 32; |
1057 | } else { | 1057 | } else { |
1058 | sampleformat = SND_PCM_FORMAT_U8; | 1058 | sampleformat = SND_PCM_FORMAT_U8; |
1059 | filePara.resolution = 8; | 1059 | filePara.resolution = 8; |
1060 | } | 1060 | } |
1061 | #else | 1061 | #else |
1062 | // we want to play | 1062 | // we want to play |
1063 | if( filePara.resolution == 16 || compressionCheckBox->isChecked() ) { | 1063 | if( filePara.resolution == 16 || compressionCheckBox->isChecked() ) { |
1064 | sampleformat = AFMT_S16_LE; | 1064 | sampleformat = AFMT_S16_LE; |
1065 | filePara.resolution = 16; | 1065 | filePara.resolution = 16; |
1066 | } else { | 1066 | } else { |
1067 | sampleformat = AFMT_U8; | 1067 | sampleformat = AFMT_U8; |
1068 | filePara.resolution = 8; | 1068 | filePara.resolution = 8; |
1069 | } | 1069 | } |
1070 | #endif | 1070 | #endif |
1071 | 1071 | ||
1072 | stereo = filePara.channels; | 1072 | stereo = filePara.channels; |
1073 | flags = O_WRONLY; | 1073 | flags = O_WRONLY; |
1074 | Config hwcfg("OpieRec"); | 1074 | Config hwcfg("OpieRec"); |
1075 | hwcfg.setGroup("Hardware"); | 1075 | hwcfg.setGroup("Hardware"); |
1076 | dspString = hwcfg.readEntry( "Audio", DSPSTROUT); | 1076 | dspString = hwcfg.readEntry( "Audio", DSPSTROUT); |
1077 | mixerString = hwcfg.readEntry( "Mixer", DSPSTRMIXEROUT); | 1077 | mixerString = hwcfg.readEntry( "Mixer", DSPSTRMIXEROUT); |
1078 | recording = false; | 1078 | recording = false; |
1079 | } else { // we want to record | 1079 | } else { // we want to record |
1080 | 1080 | ||
1081 | #ifdef PDAUDIO //ALSA | 1081 | #ifdef PDAUDIO //ALSA |
1082 | if( !bitRateComboBox->isEnabled() || bitRateComboBox->currentText() == "16") | 1082 | if( !bitRateComboBox->isEnabled() || bitRateComboBox->currentText() == "16") |
1083 | sampleformat = SND_PCM_FORMAT_S16; | 1083 | sampleformat = SND_PCM_FORMAT_S16; |
1084 | else if( !bitRateComboBox->isEnabled() || bitRateComboBox->currentText() == "24") | 1084 | else if( !bitRateComboBox->isEnabled() || bitRateComboBox->currentText() == "24") |
1085 | sampleformat = SND_PCM_FORMAT_S24; | 1085 | sampleformat = SND_PCM_FORMAT_S24; |
1086 | else if( !bitRateComboBox->isEnabled() || bitRateComboBox->currentText() == "32") | 1086 | else if( !bitRateComboBox->isEnabled() || bitRateComboBox->currentText() == "32") |
1087 | sampleformat = SND_PCM_FORMAT_S32; | 1087 | sampleformat = SND_PCM_FORMAT_S32; |
1088 | else | 1088 | else |
1089 | sampleformat = SND_PCM_FORMAT_U8; | 1089 | sampleformat = SND_PCM_FORMAT_U8; |
1090 | 1090 | ||
1091 | #else | 1091 | #else |
1092 | if( !bitRateComboBox->isEnabled() || bitRateComboBox->currentText() == "16") | 1092 | if( !bitRateComboBox->isEnabled() || bitRateComboBox->currentText() == "16") |
1093 | sampleformat = AFMT_S16_LE; | 1093 | sampleformat = AFMT_S16_LE; |
1094 | else | 1094 | else |
1095 | sampleformat = AFMT_U8; | 1095 | sampleformat = AFMT_U8; |
1096 | 1096 | ||
1097 | if( !compressionCheckBox->isChecked()) { | 1097 | if( !compressionCheckBox->isChecked()) { |
1098 | filePara.format = WAVE_FORMAT_PCM; | 1098 | filePara.format = WAVE_FORMAT_PCM; |
1099 | // odebug << "WAVE_FORMAT_PCM" << oendl; | 1099 | // odebug << "WAVE_FORMAT_PCM" << oendl; |
1100 | } else { | 1100 | } else { |
1101 | filePara.format = WAVE_FORMAT_DVI_ADPCM; | 1101 | filePara.format = WAVE_FORMAT_DVI_ADPCM; |