-rw-r--r-- | noncore/multimedia/opierec/qtrec.cpp | 200 | ||||
-rw-r--r-- | noncore/multimedia/opierec/qtrec.h | 2 |
2 files changed, 58 insertions, 144 deletions
diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp index 147f63d..2bf795f 100644 --- a/noncore/multimedia/opierec/qtrec.cpp +++ b/noncore/multimedia/opierec/qtrec.cpp | |||
@@ -102,152 +102,114 @@ int sd; | |||
102 | #define DSPSTRMIXERIN "/dev/mixer" | 102 | #define DSPSTRMIXERIN "/dev/mixer" |
103 | #define DSPSTRMIXEROUT "/dev/mixer" | 103 | #define DSPSTRMIXEROUT "/dev/mixer" |
104 | #endif | 104 | #endif |
105 | 105 | ||
106 | // threaded recording | 106 | // threaded recording |
107 | void quickRec() { | 107 | void quickRec() { |
108 | //void QtRec::quickRec() { | 108 | //void QtRec::quickRec() { |
109 | 109 | ||
110 | qDebug("%d", | ||
111 | filePara.numberSamples/filePara.sampleRate * filePara.channels); | ||
112 | qDebug("samples %d, rate %d, channels %d", | ||
113 | filePara.numberSamples, filePara.sampleRate, filePara.channels); | ||
114 | |||
115 | int total = 0; // Total number of bytes read in so far. | 110 | int total = 0; // Total number of bytes read in so far. |
116 | int bytesWritten, number; | 111 | int bytesWritten, number; |
117 | 112 | ||
118 | count_info info; | 113 | count_info info; |
119 | 114 | ||
120 | bytesWritten=0; | 115 | bytesWritten=0; |
121 | number=0; | 116 | number=0; |
122 | QString num, timeString; | 117 | QString num, timeString; |
123 | int level=0; | 118 | int level=0; |
124 | int threshold=0; | 119 | int threshold=0; |
125 | // if(limit != 0) | 120 | // if(limit != 0) |
126 | // t->start( ( limit +.3) , true); | 121 | // t->start( ( limit +.3) , true); |
127 | 122 | ||
128 | recording = true; | 123 | recording = true; |
129 | //rate=filePara.sampleRate; | 124 | //rate=filePara.sampleRate; |
130 | int bits = filePara.resolution; | 125 | // int bits = filePara.resolution; |
131 | qDebug("bits %d", bits); | ||
132 | // if( filePara.format==WAVE_FORMAT_DVI_ADPCM) | ||
133 | // else | ||
134 | audio_buf_info inInfo; | 126 | audio_buf_info inInfo; |
135 | ioctl( filePara.fd, SNDCTL_DSP_GETISPACE, &inInfo); | 127 | ioctl( filePara.fd, SNDCTL_DSP_GETISPACE, &inInfo); |
136 | qDebug("ispace is frags %d, total %d", inInfo.fragments, inInfo.fragstotal); | 128 | // qDebug("ispace is frags %d, total %d", inInfo.fragments, inInfo.fragstotal); |
137 | 129 | ||
138 | if( filePara.resolution == 16 ) { //AFMT_S16_LE) | 130 | if( filePara.resolution == 16 ) { //AFMT_S16_LE) |
139 | qDebug("AFMT_S16_LE size %d", filePara.SecondsToRecord); | ||
140 | qDebug("samples to record %d", filePara.samplesToRecord); | ||
141 | qDebug("%d", filePara.sd); | ||
142 | level=7; | 131 | level=7; |
143 | threshold=0; | 132 | threshold=0; |
144 | timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds); | 133 | timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds); |
145 | timeLabel->setText( timeString+ " seconds"); | 134 | timeLabel->setText( timeString+ " seconds"); |
146 | 135 | ||
147 | if( filePara.format==WAVE_FORMAT_DVI_ADPCM) { | 136 | if( filePara.format==WAVE_FORMAT_DVI_ADPCM) { |
148 | qDebug("start recording WAVE_FORMAT_DVI_ADPCM"); | 137 | // qDebug("start recording WAVE_FORMAT_DVI_ADPCM"); |
149 | // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_DVI_ADPCM >>>>>>>>>>>>>>>>>>>>>> | ||
150 | char abuf[BUFSIZE/2]; | 138 | char abuf[BUFSIZE/2]; |
151 | short sbuf[BUFSIZE]; | 139 | short sbuf[BUFSIZE]; |
152 | short sbuf2[BUFSIZE]; | 140 | short sbuf2[BUFSIZE]; |
153 | memset( abuf,0,BUFSIZE/2); | 141 | memset( abuf,0,BUFSIZE/2); |
154 | memset( sbuf,0,BUFSIZE); | 142 | memset( sbuf,0,BUFSIZE); |
155 | memset( sbuf2,0,BUFSIZE); | 143 | memset( sbuf2,0,BUFSIZE); |
156 | 144 | ||
157 | for(;;) { | 145 | for(;;) { |
158 | if (stopped) { | 146 | if (stopped) { |
159 | qDebug("quickRec:: stopped"); | ||
160 | break; // stop if playing was set to false | 147 | break; // stop if playing was set to false |
161 | // return; | ||
162 | } | 148 | } |
163 | 149 | ||
164 | number=::read( filePara.sd, sbuf, BUFSIZE); | 150 | number=::read( filePara.sd, sbuf, BUFSIZE); |
165 | |||
166 | if(number <= 0) { | 151 | if(number <= 0) { |
167 | perror("recording error "); | 152 | perror("recording error "); |
168 | qDebug( "%s %d", filePara.fileName, number); | 153 | // qDebug( "%s %d", filePara.fileName, number); |
169 | // errorStop(); | 154 | // errorStop(); |
170 | recording=stopped=false; | 155 | recording=stopped=false; |
171 | // QMessageBox::message("Note", | 156 | // QMessageBox::message("Note", "Error recording to file\n%s",filePara.fileName); |
172 | // "Error recording to file\n%s", | ||
173 | // filePara.fileName); | ||
174 | return; | 157 | return; |
175 | } | 158 | } |
176 | //if(stereo == 2) { | 159 | //if(stereo == 2) { |
177 | // adpcm_coder( sbuf2, abuf, number/2, &encoder_state); | 160 | // adpcm_coder( sbuf2, abuf, number/2, &encoder_state); |
178 | adpcm_coder( sbuf, abuf, number/2, &encoder_state); | 161 | adpcm_coder( sbuf, abuf, number/2, &encoder_state); |
179 | |||
180 | bytesWritten = ::write( filePara.fd , abuf, number/4); | 162 | bytesWritten = ::write( filePara.fd , abuf, number/4); |
181 | |||
182 | long peak; | 163 | long peak; |
183 | for (int i = 0; i < number; i++) | 164 | for (int i = 0; i < number; i++) |
184 | { //since Z is mono do normally | 165 | { //since Z is mono do normally |
185 | peak = findPeak((long)sbuf[i]); | 166 | peak = findPeak((long)sbuf[i]); |
186 | printf("peak %ld\r",peak); | 167 | printf("peak %ld\r",peak); |
187 | fflush(stdout); | 168 | fflush(stdout); |
188 | } | 169 | } |
189 | |||
190 | |||
191 | //------------->>>> out to file | 170 | //------------->>>> out to file |
192 | // if(filePara.channels==1) | 171 | // if(filePara.channels==1) |
193 | // total += bytesWritten/2; //mono | 172 | // total += bytesWritten/2; //mono |
194 | // else | 173 | // else |
195 | total += bytesWritten; | 174 | total += bytesWritten; |
196 | filePara.numberSamples = total; | 175 | filePara.numberSamples = total; |
197 | // if( total >= filePara.samplesToRecord) | 176 | // if( total >= filePara.samplesToRecord) |
198 | // timeSlider->setValue(0); | 177 | // timeSlider->setValue(0); |
199 | // else if( filePara.SecondsToRecord !=0) | 178 | // else if( filePara.SecondsToRecord !=0) |
200 | timeSlider->setValue( total); | 179 | timeSlider->setValue( total); |
201 | 180 | ||
202 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2; | 181 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2; |
203 | |||
204 | // printf("Writing number %d, bytes %d,total %d, sample rate %d, secs %.2f \n", | ||
205 | // number, | ||
206 | // bytesWritten , | ||
207 | // total, | ||
208 | // filePara.sampleRate, | ||
209 | // filePara.numberOfRecordedSeconds); | ||
210 | // fflush(stdout); | ||
211 | ioctl( filePara.sd, SNDCTL_DSP_GETIPTR, &info); | 182 | ioctl( filePara.sd, SNDCTL_DSP_GETIPTR, &info); |
212 | // qDebug("%d, %d", info.bytes, (info.bytes / filePara.sampleRate) / 2); | ||
213 | |||
214 | timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds); | 183 | timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds); |
215 | timeLabel->setText( timeString + " seconds"); | 184 | timeLabel->setText( timeString + " seconds"); |
216 | 185 | ||
217 | qApp->processEvents(); | 186 | qApp->processEvents(); |
218 | if( total >= filePara.samplesToRecord) | 187 | if( total >= filePara.samplesToRecord) |
219 | break; | 188 | break; |
220 | } | 189 | } |
221 | } else { | 190 | } else { |
222 | // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_PCM >>>>>>>>>>>>>>>>>>>>>> | 191 | // qDebug("start recording WAVE_FORMAT_PCM"); |
223 | qDebug("start recording WAVE_FORMAT_PCM"); | ||
224 | short inbuffer[BUFSIZE], outbuffer[BUFSIZE]; | 192 | short inbuffer[BUFSIZE], outbuffer[BUFSIZE]; |
225 | memset( inbuffer,0,BUFSIZE); | 193 | memset( inbuffer,0,BUFSIZE); |
226 | memset( outbuffer,0,BUFSIZE); | 194 | memset( outbuffer,0,BUFSIZE); |
227 | for(;;) { | 195 | for(;;) { |
228 | if (stopped) { | 196 | if (stopped) { |
229 | qDebug("quickRec:: stopped"); | ||
230 | break; // stop if playing was set to false | 197 | break; // stop if playing was set to false |
231 | return; | ||
232 | } | 198 | } |
233 | 199 | ||
234 | number=::read( filePara.sd, inbuffer, BUFSIZE); | 200 | number=::read( filePara.sd, inbuffer, BUFSIZE); |
235 | |||
236 | if(number <= 0) { | 201 | if(number <= 0) { |
237 | perror("recording error "); | 202 | perror("recording error "); |
238 | qDebug( filePara.fileName); | ||
239 | recording=stopped=false; | 203 | recording=stopped=false; |
240 | // errorStop(); | 204 | // errorStop(); |
241 | // QMessageBox::message("Note","error recording to file\n%s",filePara.fileName); | ||
242 | return;// false; | 205 | return;// false; |
243 | } | 206 | } |
244 | /* for (int i=0;i< number;i++) { //2*i is left channel | 207 | /* for (int i=0;i< number;i++) { //2*i is left channel |
245 | |||
246 | outbuffer[i]=inbuffer[i]>>1; // no clippy, please | 208 | outbuffer[i]=inbuffer[i]>>1; // no clippy, please |
247 | }*/ | 209 | }*/ |
248 | bytesWritten = ::write( filePara.fd , inbuffer, number); | 210 | bytesWritten = ::write( filePara.fd , inbuffer, number); |
249 | //------------->>>> out to file | 211 | //------------->>>> out to file |
250 | if(bytesWritten < 0) { | 212 | if(bytesWritten < 0) { |
251 | // errorStop(); | 213 | // errorStop(); |
252 | perror("File writing error "); | 214 | perror("File writing error "); |
253 | return;// false; | 215 | return;// false; |
@@ -259,46 +221,42 @@ outbuffer[i]=inbuffer[i]>>1; // no clippy, please | |||
259 | total += bytesWritten; | 221 | total += bytesWritten; |
260 | long peak; | 222 | long peak; |
261 | for (int i = 0; i < number; i++) | 223 | for (int i = 0; i < number; i++) |
262 | { //since Z is mono do normally | 224 | { //since Z is mono do normally |
263 | peak = findPeak((long)inbuffer[i]); | 225 | peak = findPeak((long)inbuffer[i]); |
264 | printf("peak %ld\r",peak); | 226 | printf("peak %ld\r",peak); |
265 | fflush(stdout); | 227 | fflush(stdout); |
266 | } | 228 | } |
267 | |||
268 | |||
269 | filePara.numberSamples = total; | 229 | filePara.numberSamples = total; |
270 | if(filePara.SecondsToRecord !=0) | 230 | if(filePara.SecondsToRecord !=0) |
271 | timeSlider->setValue( total); | 231 | timeSlider->setValue( total); |
272 | // printf("Writing number %d, bytes %d,total %d\r",number, bytesWritten , total); | 232 | // printf("Writing number %d, bytes %d,total %d\r",number, bytesWritten , total); |
273 | // fflush(stdout); | 233 | // fflush(stdout); |
274 | 234 | ||
275 | ioctl( filePara.sd, SNDCTL_DSP_GETIPTR, &info); | 235 | ioctl( filePara.sd, SNDCTL_DSP_GETIPTR, &info); |
276 | // qDebug("%d, %d", info.bytes, ( info.bytes / filePara.sampleRate) / 2); | 236 | // qDebug("%d, %d", info.bytes, ( info.bytes / filePara.sampleRate) / 2); |
277 | 237 | ||
278 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / (float)2; | 238 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / (float)2; |
279 | |||
280 | timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds); | 239 | timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds); |
281 | timeLabel->setText( timeString + " seconds"); | 240 | timeLabel->setText( timeString + " seconds"); |
282 | |||
283 | qApp->processEvents(); | 241 | qApp->processEvents(); |
284 | if( total >= filePara.samplesToRecord) | 242 | if( total >= filePara.samplesToRecord) |
285 | break; | 243 | break; |
286 | } | 244 | } |
287 | } //end main loop | 245 | } //end main loop |
288 | 246 | ||
289 | } else { // <<<<<<<<<<<<<<<<<<<<<<< format = AFMT_U8; | 247 | } else { // <<<<<<<<<<<<<<<<<<<<<<< format = AFMT_U8; |
290 | unsigned char unsigned_inbuffer[BUFSIZE], unsigned_outbuffer[BUFSIZE]; | 248 | unsigned char unsigned_inbuffer[BUFSIZE], unsigned_outbuffer[BUFSIZE]; |
291 | memset( unsigned_inbuffer, 0, BUFSIZE); | 249 | memset( unsigned_inbuffer, 0, BUFSIZE); |
292 | memset( unsigned_outbuffer, 0, BUFSIZE); | 250 | memset( unsigned_outbuffer, 0, BUFSIZE); |
293 | 251 | ||
294 | for(;;) { | 252 | for(;;) { |
295 | if (stopped) { | 253 | if (stopped) { |
296 | qDebug("quickRec:: stopped"); | 254 | // qDebug("quickRec:: stopped"); |
297 | break; // stop if playing was set to false | 255 | break; // stop if playing was set to false |
298 | } | 256 | } |
299 | number=::read( filePara.sd, unsigned_inbuffer, BUFSIZE); | 257 | number=::read( filePara.sd, unsigned_inbuffer, BUFSIZE); |
300 | //-------------<<<< in from device | 258 | //-------------<<<< in from device |
301 | // val = (data ^ 0x80) << 8; | 259 | // val = (data ^ 0x80) << 8; |
302 | 260 | ||
303 | //unsigned_outbuffer = (unsigned_inbuffer ^ 0x80) << 8; | 261 | //unsigned_outbuffer = (unsigned_inbuffer ^ 0x80) << 8; |
304 | 262 | ||
@@ -343,29 +301,23 @@ outbuffer[i]=inbuffer[i]>>1; // no clippy, please | |||
343 | // qDebug("Final %d, %d", filePara.samplesToRecord , filePara.numberOfRecordedSeconds); | 301 | // qDebug("Final %d, %d", filePara.samplesToRecord , filePara.numberOfRecordedSeconds); |
344 | } /// END quickRec() | 302 | } /// END quickRec() |
345 | 303 | ||
346 | // threaded play | 304 | // threaded play |
347 | void playIt() { | 305 | void playIt() { |
348 | 306 | ||
349 | } | 307 | } |
350 | 308 | ||
351 | |||
352 | |||
353 | /////////////////<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>> | 309 | /////////////////<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>> |
354 | /////////////////<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>> | ||
355 | |||
356 | QtRec::QtRec( QWidget* parent, const char* name, WFlags fl ) | 310 | QtRec::QtRec( QWidget* parent, const char* name, WFlags fl ) |
357 | : QWidget( parent, name, fl ) { | 311 | : QWidget( parent, name, fl ) { |
358 | // QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << true; // mute device | 312 | // QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << true; // mute device |
359 | // autoMute=TRUE; | 313 | // autoMute=TRUE; |
360 | // QPEApplication::grabKeyboard(); | 314 | // QPEApplication::grabKeyboard(); |
361 | 315 | ||
362 | // signal(SIGPIPE, SIG_IGN); | ||
363 | |||
364 | if ( !name ) | 316 | if ( !name ) |
365 | setName( "OpieRec" ); | 317 | setName( "OpieRec" ); |
366 | init(); | 318 | init(); |
367 | initConfig(); | 319 | initConfig(); |
368 | initConnections(); | 320 | initConnections(); |
369 | renameBox = 0; | 321 | renameBox = 0; |
370 | 322 | ||
371 | // open sound device to get volumes | 323 | // open sound device to get volumes |
@@ -406,17 +358,16 @@ void QtRec::cleanUp() { | |||
406 | 358 | ||
407 | ListView1->clear(); | 359 | ListView1->clear(); |
408 | 360 | ||
409 | if(autoMute) | 361 | if(autoMute) |
410 | doMute(false); | 362 | doMute(false); |
411 | 363 | ||
412 | if(wavFile) delete wavFile; | 364 | if(wavFile) delete wavFile; |
413 | // if(soundDevice) delete soundDevice; | 365 | // if(soundDevice) delete soundDevice; |
414 | |||
415 | // QPEApplication::grabKeyboard(); | 366 | // QPEApplication::grabKeyboard(); |
416 | // QPEApplication::ungrabKeyboard(); | 367 | // QPEApplication::ungrabKeyboard(); |
417 | } | 368 | } |
418 | 369 | ||
419 | void QtRec::init() { | 370 | void QtRec::init() { |
420 | 371 | ||
421 | needsStereoOut=false; | 372 | needsStereoOut=false; |
422 | QPixmap image3( ( const char** ) image3_data ); | 373 | QPixmap image3( ( const char** ) image3_data ); |
@@ -749,19 +700,20 @@ void QtRec::initIconView() { | |||
749 | 700 | ||
750 | 701 | ||
751 | int nFiles = cfg.readNumEntry("NumberofFiles",0); | 702 | int nFiles = cfg.readNumEntry("NumberofFiles",0); |
752 | for(int i=1;i<= nFiles;i++) { | 703 | for(int i=1;i<= nFiles;i++) { |
753 | 704 | ||
754 | QListViewItem * item; | 705 | QListViewItem * item; |
755 | QString fileS, mediaLocation, fileDate, filePath; | 706 | QString fileS, mediaLocation, fileDate, filePath; |
756 | 707 | ||
757 | // temp.sprintf("%d",i); | 708 | temp.sprintf("%d",i); |
758 | temp=cfg.readEntry(temp,""); //reads currentFile | 709 | temp=cfg.readEntry(temp,""); //reads currentFile |
759 | filePath = cfg.readEntry(temp,""); //currentFileName | 710 | filePath = cfg.readEntry(temp,""); //currentFileName |
711 | // qDebug(filePath); | ||
760 | 712 | ||
761 | QFileInfo info(filePath); | 713 | QFileInfo info(filePath); |
762 | fileDate = info.lastModified().toString(); | 714 | fileDate = info.lastModified().toString(); |
763 | 715 | ||
764 | fileS = cfg.readEntry( filePath, "0" );// file length in seconds | 716 | fileS = cfg.readEntry( filePath, "0" );// file length in seconds |
765 | mediaLocation=getStorage( filePath); | 717 | mediaLocation=getStorage( filePath); |
766 | if(info.exists()) { | 718 | if(info.exists()) { |
767 | item = new QListViewItem( ListView1, temp, fileS, mediaLocation, fileDate); | 719 | item = new QListViewItem( ListView1, temp, fileS, mediaLocation, fileDate); |
@@ -854,17 +806,17 @@ void QtRec::initConfig() { | |||
854 | cofg.setGroup( "Volume"); | 806 | cofg.setGroup( "Volume"); |
855 | outMuteCheckBox->setChecked( cofg.readBoolEntry( "Mute",0)); | 807 | outMuteCheckBox->setChecked( cofg.readBoolEntry( "Mute",0)); |
856 | inMuteCheckBox->setChecked( cofg.readBoolEntry( "MicMute",0)); | 808 | inMuteCheckBox->setChecked( cofg.readBoolEntry( "MicMute",0)); |
857 | } | 809 | } |
858 | 810 | ||
859 | //================ | 811 | //================ |
860 | 812 | ||
861 | void QtRec::stop() { | 813 | void QtRec::stop() { |
862 | qDebug("<<<<<<<<<stop()"); | 814 | // qDebug("<<<<<<<<<stop()"); |
863 | setRecordButton(false); | 815 | setRecordButton(false); |
864 | monitoring=false; | 816 | monitoring=false; |
865 | stopped=true; | 817 | stopped=true; |
866 | 818 | ||
867 | if( !recording) | 819 | if( !recording) |
868 | endPlaying(); | 820 | endPlaying(); |
869 | else | 821 | else |
870 | endRecording(); | 822 | endRecording(); |
@@ -882,105 +834,84 @@ void QtRec::doPlayBtn() { | |||
882 | playLabel2->setText(tr("Stop")); | 834 | playLabel2->setText(tr("Stop")); |
883 | currentFile = ListView1->currentItem()->text(0); | 835 | currentFile = ListView1->currentItem()->text(0); |
884 | start(); | 836 | start(); |
885 | } | 837 | } |
886 | } | 838 | } |
887 | 839 | ||
888 | void QtRec::start() { //play | 840 | void QtRec::start() { //play |
889 | if(stopped) { | 841 | if(stopped) { |
890 | qDebug("start::"); | ||
891 | QPixmap image3( ( const char** ) image3_data ); | 842 | QPixmap image3( ( const char** ) image3_data ); |
892 | Stop_PushButton->setPixmap( image3 ); | 843 | Stop_PushButton->setPixmap( image3 ); |
893 | Stop_PushButton->setDown(true); | 844 | Stop_PushButton->setDown(true); |
894 | stopped=false; | 845 | stopped=false; |
895 | paused=false; | 846 | paused=false; |
896 | secCount=1; | 847 | secCount=1; |
897 | 848 | ||
898 | if( openPlayFile()) | 849 | if( openPlayFile()) |
899 | if( setupAudio( false)) //recording is false | 850 | if( setupAudio( false)) //recording is false |
900 | doPlay(); | 851 | doPlay(); |
901 | } | 852 | } |
902 | } | 853 | } |
903 | 854 | ||
904 | bool QtRec::rec() { //record | 855 | bool QtRec::rec() { //record |
905 | qDebug("rec()"); | ||
906 | if(!stopped) { | 856 | if(!stopped) { |
907 | qDebug("rec:: !stopped"); | ||
908 | monitoring=true; | 857 | monitoring=true; |
909 | return false; | 858 | return false; |
910 | } else { | 859 | } else { |
911 | qDebug("go ahead and record"); | ||
912 | secCount=1; | 860 | secCount=1; |
913 | playLabel2->setText(tr("Stop")); | 861 | playLabel2->setText(tr("Stop")); |
914 | monitoring=false; | 862 | monitoring=false; |
915 | setRecordButton(true); | 863 | setRecordButton(true); |
916 | stopped=false; | 864 | stopped=false; |
917 | 865 | ||
918 | if( setupAudio( true)) | 866 | if( setupAudio( true)) |
919 | if(setUpFile()) { | 867 | if(setUpFile()) { |
920 | qDebug("Ok to start recording"); | ||
921 | int fileSize=0; | 868 | int fileSize=0; |
922 | Config cfg("OpieRec"); | 869 | Config cfg("OpieRec"); |
923 | cfg.setGroup("Settings"); | 870 | cfg.setGroup("Settings"); |
924 | qDebug( "<<<<<<<Device bits %d, device rate %d, device channels %d", | ||
925 | soundDevice->getDeviceBits(), | ||
926 | soundDevice->getDeviceRate(), | ||
927 | soundDevice->getDeviceChannels()); | ||
928 | |||
929 | //filePara.sampleRate = cfg.readNumEntry("samplerate", 22050); | 871 | //filePara.sampleRate = cfg.readNumEntry("samplerate", 22050); |
930 | qDebug("sample rate is %d", filePara.sampleRate); | 872 | // qDebug("sample rate is %d", filePara.sampleRate); |
931 | filePara.SecondsToRecord = getCurrentSizeLimit(); | 873 | filePara.SecondsToRecord = getCurrentSizeLimit(); |
932 | 874 | ||
933 | qDebug("size limit %d sec", filePara.SecondsToRecord); | ||
934 | int diskSize = checkDiskSpace( (const QString &) wavFile->trackName()); | 875 | int diskSize = checkDiskSpace( (const QString &) wavFile->trackName()); |
935 | 876 | ||
936 | if( filePara.SecondsToRecord == 0) { | 877 | if( filePara.SecondsToRecord == 0) { |
937 | fileSize = diskSize; | 878 | fileSize = diskSize; |
938 | } else if( filePara.format==WAVE_FORMAT_PCM) { | 879 | } else if( filePara.format==WAVE_FORMAT_PCM) { |
939 | qDebug("WAVE_FORMAT_PCM"); | ||
940 | fileSize = (filePara.SecondsToRecord ) * filePara.channels | 880 | fileSize = (filePara.SecondsToRecord ) * filePara.channels |
941 | * filePara.sampleRate *(filePara.resolution/8)+1000; | 881 | * filePara.sampleRate *(filePara.resolution/8)+1000; |
942 | } else { | 882 | } else { |
943 | qDebug("WAVE_FORMAT_DVI_ADPCM"); | ||
944 | fileSize = ((filePara.SecondsToRecord) * filePara.channels | 883 | fileSize = ((filePara.SecondsToRecord) * filePara.channels |
945 | * filePara.sampleRate *(filePara.resolution/8) )/4+250; | 884 | * filePara.sampleRate *(filePara.resolution/8) )/4+250; |
946 | } | 885 | } |
947 | 886 | ||
948 | filePara.samplesToRecord = fileSize; | 887 | filePara.samplesToRecord = fileSize; |
949 | qDebug("filesize should be %d, bits %d, rate %d", | ||
950 | filePara.samplesToRecord, filePara.resolution, filePara.sampleRate); | ||
951 | if(paused) { | 888 | if(paused) { |
952 | paused = false; | 889 | paused = false; |
953 | } | 890 | } |
954 | // else { | ||
955 | qDebug("Setting timeslider %d", filePara.samplesToRecord); | ||
956 | // if(fileSize != 0) | ||
957 | timeSlider->setRange(0, filePara.samplesToRecord); | 891 | timeSlider->setRange(0, filePara.samplesToRecord); |
958 | // } | ||
959 | 892 | ||
960 | if( diskSize < fileSize/1024) { | 893 | if( diskSize < fileSize/1024) { |
961 | QMessageBox::warning(this, | 894 | QMessageBox::warning(this, |
962 | tr("Low Disk Space"), | 895 | tr("Low Disk Space"), |
963 | tr("You are running low of\nrecording space\n" | 896 | tr("You are running low of\nrecording space\n" |
964 | "or a card isn't being recognized")); | 897 | "or a card isn't being recognized")); |
965 | stopped = true; //we need to be stopped | 898 | stopped = true; //we need to be stopped |
966 | stop(); | 899 | stop(); |
967 | } else { | 900 | } else { |
968 | QString msg; | 901 | QString msg; |
969 | msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); | 902 | msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); |
970 | #ifdef DEV_VERSION | 903 | #ifdef DEV_VERSION |
971 | setCaption( msg); | 904 | setCaption( msg); |
972 | #endif | 905 | #endif |
973 | filePara.fileName=currentFile.latin1(); | 906 | filePara.fileName=currentFile.latin1(); |
974 | qDebug("Start recording thread"); | ||
975 | 907 | ||
976 | pthread_t thread1; | 908 | pthread_t thread1; |
977 | pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/); | 909 | pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/); |
978 | // quickRec(); | ||
979 | toBeginningButton->setEnabled(false); | 910 | toBeginningButton->setEnabled(false); |
980 | toEndButton->setEnabled(false); | 911 | toEndButton->setEnabled(false); |
981 | 912 | ||
982 | startTimer(1000); | 913 | startTimer(1000); |
983 | } | 914 | } |
984 | } //end setUpFile | 915 | } //end setUpFile |
985 | } //end setupAudio | 916 | } //end setupAudio |
986 | // _exit( 0); | 917 | // _exit( 0); |
@@ -1005,41 +936,39 @@ bool QtRec::rec() { //record | |||
1005 | return true; | 936 | return true; |
1006 | } | 937 | } |
1007 | /* | 938 | /* |
1008 | This happens when a tab is selected*/ | 939 | This happens when a tab is selected*/ |
1009 | void QtRec::thisTab(QWidget* widg) { | 940 | void QtRec::thisTab(QWidget* widg) { |
1010 | if(widg != NULL) { | 941 | if(widg != NULL) { |
1011 | int index=TabWidget->currentPageIndex(); | 942 | int index=TabWidget->currentPageIndex(); |
1012 | 943 | ||
1013 | if(index==0) { //file page | 944 | // if(index==0) { //file page |
1014 | } | 945 | // } |
1015 | 946 | ||
1016 | if(index ==1) { //control page | 947 | if(index ==1) { //control page |
1017 | fillDirectoryCombo(); | 948 | fillDirectoryCombo(); |
1018 | // soundDevice->getOutVol(); | 949 | // soundDevice->getOutVol(); |
1019 | // soundDevice->getInVol(); | 950 | // soundDevice->getInVol(); |
1020 | } | 951 | } |
1021 | 952 | ||
1022 | if(index==2) { //help page | 953 | // if(index==2) { //help page |
1023 | } | 954 | // } |
1024 | qApp->processEvents(); | 955 | qApp->processEvents(); |
1025 | update(); | 956 | update(); |
1026 | } | 957 | } |
1027 | } | 958 | } |
1028 | 959 | ||
1029 | void QtRec::getOutVol( ) { | 960 | void QtRec::getOutVol( ) { |
1030 | filePara.outVol = soundDevice->getOutVolume(); | 961 | filePara.outVol = soundDevice->getOutVolume(); |
1031 | qDebug("out vol %d", filePara.outVol); | ||
1032 | OutputSlider->setValue( -filePara.outVol); | 962 | OutputSlider->setValue( -filePara.outVol); |
1033 | } | 963 | } |
1034 | 964 | ||
1035 | void QtRec::getInVol() { | 965 | void QtRec::getInVol() { |
1036 | filePara.inVol = soundDevice->getInVolume(); | 966 | filePara.inVol = soundDevice->getInVolume(); |
1037 | qDebug("in vol %d", filePara.inVol); | ||
1038 | InputSlider->setValue( -filePara.inVol); | 967 | InputSlider->setValue( -filePara.inVol); |
1039 | } | 968 | } |
1040 | 969 | ||
1041 | void QtRec::changedOutVolume() { | 970 | void QtRec::changedOutVolume() { |
1042 | soundDevice->changedOutVolume(-OutputSlider->value()); | 971 | soundDevice->changedOutVolume(-OutputSlider->value()); |
1043 | } | 972 | } |
1044 | 973 | ||
1045 | void QtRec::changedInVolume( ) { | 974 | void QtRec::changedInVolume( ) { |
@@ -1050,93 +979,82 @@ void QtRec::changedInVolume( ) { | |||
1050 | bool QtRec::setupAudio( bool b) { | 979 | bool QtRec::setupAudio( bool b) { |
1051 | bool ok; | 980 | bool ok; |
1052 | int sampleformat, stereo, flags; | 981 | int sampleformat, stereo, flags; |
1053 | char * dspString, *mixerString; | 982 | char * dspString, *mixerString; |
1054 | 983 | ||
1055 | filePara.resolution = bitRateComboBox->currentText().toInt( &ok,10); //16 | 984 | filePara.resolution = bitRateComboBox->currentText().toInt( &ok,10); //16 |
1056 | 985 | ||
1057 | if( !b){ // we want to play | 986 | if( !b){ // we want to play |
1058 | qDebug("setting up DSP for playing"); | ||
1059 | if( filePara.resolution == 16 || compressionCheckBox->isChecked() ) { | 987 | if( filePara.resolution == 16 || compressionCheckBox->isChecked() ) { |
1060 | sampleformat = AFMT_S16_LE; | 988 | sampleformat = AFMT_S16_LE; |
1061 | filePara.resolution = 16; | 989 | filePara.resolution = 16; |
1062 | } else { | 990 | } else { |
1063 | sampleformat = AFMT_U8; | 991 | sampleformat = AFMT_U8; |
1064 | filePara.resolution=8; | 992 | filePara.resolution=8; |
1065 | } | 993 | } |
1066 | 994 | ||
1067 | stereo = filePara.channels = 1; | 995 | stereo = filePara.channels = 1; |
1068 | flags= O_WRONLY; | 996 | flags= O_WRONLY; |
1069 | dspString = DSPSTROUT; | 997 | dspString = DSPSTROUT; |
1070 | mixerString = DSPSTRMIXEROUT; | 998 | mixerString = DSPSTRMIXEROUT; |
1071 | } else { // we want to record | 999 | } else { // we want to record |
1072 | qDebug("setting up DSP for recording"); | ||
1073 | 1000 | ||
1074 | if( !bitRateComboBox->isEnabled() || bitRateComboBox->currentText() == "16") | 1001 | if( !bitRateComboBox->isEnabled() || bitRateComboBox->currentText() == "16") |
1075 | sampleformat = AFMT_S16_LE; | 1002 | sampleformat = AFMT_S16_LE; |
1076 | else | 1003 | else |
1077 | sampleformat = AFMT_U8; | 1004 | sampleformat = AFMT_U8; |
1078 | 1005 | ||
1079 | if( !compressionCheckBox->isChecked()) { | 1006 | if( !compressionCheckBox->isChecked()) { |
1080 | filePara.format=WAVE_FORMAT_PCM; | 1007 | filePara.format=WAVE_FORMAT_PCM; |
1081 | qDebug("WAVE_FORMAT_PCM"); | ||
1082 | } else { | 1008 | } else { |
1083 | filePara.format=WAVE_FORMAT_DVI_ADPCM; | 1009 | filePara.format=WAVE_FORMAT_DVI_ADPCM; |
1084 | sampleformat=AFMT_S16_LE; | 1010 | sampleformat=AFMT_S16_LE; |
1085 | qDebug("WAVE_FORMAT_DVI_ADPCM"); | ||
1086 | } | 1011 | } |
1087 | 1012 | ||
1088 | stereo = filePara.channels = 1; | 1013 | stereo = filePara.channels = 1; |
1089 | // filePara.sampleRate = sampleRateComboBox->currentText().toInt( &ok,10);//44100; | ||
1090 | flags= O_RDWR; | 1014 | flags= O_RDWR; |
1091 | // flags= O_RDONLY; | ||
1092 | dspString = DSPSTRIN; | 1015 | dspString = DSPSTRIN; |
1093 | mixerString = DSPSTRMIXEROUT; | 1016 | mixerString = DSPSTRMIXEROUT; |
1094 | } | 1017 | } |
1095 | 1018 | ||
1096 | // if(soundDevice) delete soundDevice; | 1019 | // if(soundDevice) delete soundDevice; |
1097 | qDebug("<<<<<<<<<<<<<<<<<<<open dsp %d %d %d", filePara.sampleRate, filePara.channels, sampleformat); | ||
1098 | soundDevice = new Device( this, dspString, mixerString, b); | 1020 | soundDevice = new Device( this, dspString, mixerString, b); |
1099 | // soundDevice->openDsp(); | 1021 | // soundDevice->openDsp(); |
1100 | soundDevice->reset(); | 1022 | soundDevice->reset(); |
1101 | 1023 | ||
1102 | qDebug("device has been made %d", soundDevice->sd); | ||
1103 | |||
1104 | ////////////////// <<<<<<<<<<<<>>>>>>>>>>>> | ||
1105 | soundDevice->setDeviceFormat( sampleformat); | 1024 | soundDevice->setDeviceFormat( sampleformat); |
1106 | soundDevice->setDeviceChannels( filePara.channels); | 1025 | soundDevice->setDeviceChannels( filePara.channels); |
1107 | soundDevice->setDeviceRate( filePara.sampleRate); | 1026 | soundDevice->setDeviceRate( filePara.sampleRate); |
1108 | soundDevice->getDeviceFragSize(); | 1027 | soundDevice->getDeviceFragSize(); |
1109 | #ifdef QT_QWS_EBX | 1028 | #ifdef QT_QWS_EBX |
1110 | int frag = FRAGSIZE; | 1029 | int frag = FRAGSIZE; |
1111 | soundDevice->setFragSize( frag); | 1030 | soundDevice->setFragSize( frag); |
1112 | soundDevice->getDeviceFragSize(); | 1031 | soundDevice->getDeviceFragSize(); |
1113 | #endif | 1032 | #endif |
1114 | ///////////////// | 1033 | |
1115 | filePara.sd = soundDevice->sd; | 1034 | filePara.sd = soundDevice->sd; |
1116 | 1035 | ||
1117 | if ( filePara.sd == -1) { | 1036 | if ( filePara.sd == -1) { |
1118 | |||
1119 | monitoring=false; | 1037 | monitoring=false; |
1120 | stopped=true; | 1038 | stopped=true; |
1121 | update(); | 1039 | update(); |
1122 | setCaption( tr( "OpieRecord " ) + QString::number(VERSION) ); | 1040 | setCaption( tr( "OpieRecord " ) /*+ QString::number(VERSION)*/ ); |
1123 | stopped=true; | 1041 | stopped=true; |
1124 | return false; | 1042 | return false; |
1125 | } | 1043 | } |
1126 | if(autoMute) | 1044 | if(autoMute) |
1127 | doMute(false); | 1045 | doMute(false); |
1128 | 1046 | ||
1129 | return true; | 1047 | return true; |
1130 | } | 1048 | } |
1131 | 1049 | ||
1132 | 1050 | ||
1133 | bool QtRec::setUpFile() { //setup file for recording | 1051 | bool QtRec::setUpFile() { //setup file for recording |
1134 | qDebug("Setting up wavfile"); | 1052 | // qDebug("Setting up wavfile"); |
1135 | // if(wavFile) delete wavFile; | 1053 | // if(wavFile) delete wavFile; |
1136 | wavFile = new WavFile( this, (const QString &)"", | 1054 | wavFile = new WavFile( this, (const QString &)"", |
1137 | true, | 1055 | true, |
1138 | filePara.sampleRate, | 1056 | filePara.sampleRate, |
1139 | filePara.channels, | 1057 | filePara.channels, |
1140 | filePara.resolution, | 1058 | filePara.resolution, |
1141 | filePara.format); | 1059 | filePara.format); |
1142 | 1060 | ||
@@ -1155,46 +1073,45 @@ bool QtRec::doPlay() { | |||
1155 | // pthread_t thread2; | 1073 | // pthread_t thread2; |
1156 | // pthread_create( &thread2, NULL, (void * (*)(void *))playIt, NULL/* &*/); | 1074 | // pthread_create( &thread2, NULL, (void * (*)(void *))playIt, NULL/* &*/); |
1157 | 1075 | ||
1158 | // qDebug("doPlay file %d", filePara.fd); | 1076 | // qDebug("doPlay file %d", filePara.fd); |
1159 | int bytesWritten, number; | 1077 | int bytesWritten, number; |
1160 | recording = false; | 1078 | recording = false; |
1161 | // int number=0; | 1079 | // int number=0; |
1162 | if( !paused) { | 1080 | if( !paused) { |
1163 | qDebug("new"); | 1081 | // qDebug("new"); |
1164 | total=0; | 1082 | total=0; |
1165 | bytesWritten=0; | 1083 | bytesWritten=0; |
1166 | filePara.numberOfRecordedSeconds = 0; | 1084 | filePara.numberOfRecordedSeconds = 0; |
1167 | } else { | 1085 | } else { |
1168 | paused = false; | 1086 | paused = false; |
1169 | secCount = (int)filePara.numberOfRecordedSeconds; | 1087 | secCount = (int)filePara.numberOfRecordedSeconds; |
1170 | } | 1088 | } |
1171 | playing=true; | 1089 | playing=true; |
1172 | number=0; | 1090 | number=0; |
1173 | 1091 | ||
1174 | QString num; | 1092 | QString num; |
1175 | // block=BUFSIZE; | 1093 | // block=BUFSIZE; |
1176 | qDebug("Play number of samples %d", filePara.numberSamples); | ||
1177 | timeSlider->setRange(0, filePara.numberSamples); | 1094 | timeSlider->setRange(0, filePara.numberSamples); |
1178 | timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds); | 1095 | timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds); |
1179 | timeLabel->setText( timeString+ tr(" seconds")); | 1096 | timeLabel->setText( timeString+ tr(" seconds")); |
1180 | 1097 | ||
1181 | if( filePara.format==WAVE_FORMAT_DVI_ADPCM) { | 1098 | // if( filePara.format==WAVE_FORMAT_DVI_ADPCM) { |
1182 | qDebug("WAVE_FORMAT_DVI_ADPCM"); | 1099 | // // qDebug("WAVE_FORMAT_DVI_ADPCM"); |
1183 | } else { | 1100 | // } else { |
1184 | qDebug("WAVE_FORMAT_PCM"); | 1101 | // // qDebug("WAVE_FORMAT_PCM"); |
1185 | } | 1102 | // } |
1186 | QString msg; | 1103 | QString msg; |
1187 | msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); | 1104 | msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); |
1188 | #ifdef DEV_VERSION | 1105 | #ifdef DEV_VERSION |
1189 | setCaption( msg); | 1106 | setCaption( msg); |
1190 | #endif | 1107 | #endif |
1191 | if( filePara.resolution == 16 ) { //AFMT_S16_LE) { | 1108 | if( filePara.resolution == 16 ) { //AFMT_S16_LE) { |
1192 | qDebug("16 bit"); | 1109 | // qDebug("16 bit"); |
1193 | 1110 | ||
1194 | startTimer(1000); | 1111 | startTimer(1000); |
1195 | 1112 | ||
1196 | if( filePara.format==WAVE_FORMAT_DVI_ADPCM) { | 1113 | if( filePara.format==WAVE_FORMAT_DVI_ADPCM) { |
1197 | char abuf[BUFSIZE/2]; | 1114 | char abuf[BUFSIZE/2]; |
1198 | short sbuf[BUFSIZE]; | 1115 | short sbuf[BUFSIZE]; |
1199 | short sbuf2[BUFSIZE*2]; | 1116 | short sbuf2[BUFSIZE*2]; |
1200 | memset( abuf, 0, BUFSIZE / 2); | 1117 | memset( abuf, 0, BUFSIZE / 2); |
@@ -1272,17 +1189,17 @@ bool QtRec::doPlay() { | |||
1272 | stopped = true; | 1189 | stopped = true; |
1273 | endPlaying(); | 1190 | endPlaying(); |
1274 | } | 1191 | } |
1275 | } | 1192 | } |
1276 | // printf("\nplaying number %d, bytes %d, total %d\r",number, bytesWritten, total); | 1193 | // printf("\nplaying number %d, bytes %d, total %d\r",number, bytesWritten, total); |
1277 | // fflush(stdout); | 1194 | // fflush(stdout); |
1278 | } //end loop | 1195 | } //end loop |
1279 | } else { /////////////////////////////// format = AFMT_U8; | 1196 | } else { /////////////////////////////// format = AFMT_U8; |
1280 | unsigned char unsigned_inbuffer[BUFSIZE], unsigned_outbuffer[BUFSIZE]; | 1197 | unsigned char unsigned_inbuffer[BUFSIZE];//, unsigned_outbuffer[BUFSIZE]; |
1281 | memset( unsigned_inbuffer,0,BUFSIZE); | 1198 | memset( unsigned_inbuffer,0,BUFSIZE); |
1282 | for(;;) { // main loop | 1199 | for(;;) { // main loop |
1283 | if (stopped) | 1200 | if (stopped) |
1284 | break; // stop if playing was set to false | 1201 | break; // stop if playing was set to false |
1285 | number=::read( filePara.fd, unsigned_inbuffer, BUFSIZE); | 1202 | number=::read( filePara.fd, unsigned_inbuffer, BUFSIZE); |
1286 | //data = (val >> 8) ^ 0x80; | 1203 | //data = (val >> 8) ^ 0x80; |
1287 | // unsigned_outbuffer = (unsigned_inbuffer >> 8) ^ 0x80; | 1204 | // unsigned_outbuffer = (unsigned_inbuffer >> 8) ^ 0x80; |
1288 | bytesWritten = write ( filePara.sd, unsigned_inbuffer, number); | 1205 | bytesWritten = write ( filePara.sd, unsigned_inbuffer, number); |
@@ -1338,17 +1255,17 @@ void QtRec::changesamplerateCombo(int i) { | |||
1338 | // | 1255 | // |
1339 | // soundDevice->setDeviceFormat(AFMT_S16_LE); | 1256 | // soundDevice->setDeviceFormat(AFMT_S16_LE); |
1340 | // soundDevice->setDeviceChannels(filePara.channels); | 1257 | // soundDevice->setDeviceChannels(filePara.channels); |
1341 | // soundDevice->setDeviceRate(filePara.sampleRate); | 1258 | // soundDevice->setDeviceRate(filePara.sampleRate); |
1342 | // | 1259 | // |
1343 | // soundDevice->closeDevice( true); | 1260 | // soundDevice->closeDevice( true); |
1344 | // soundDevice=0; | 1261 | // soundDevice=0; |
1345 | // delete soundDevice; | 1262 | // delete soundDevice; |
1346 | qDebug("Change sample rate %d", rate); | 1263 | // qDebug("Change sample rate %d", rate); |
1347 | cfg.write(); | 1264 | cfg.write(); |
1348 | 1265 | ||
1349 | } | 1266 | } |
1350 | 1267 | ||
1351 | 1268 | ||
1352 | void QtRec::changeDirCombo(int index) { | 1269 | void QtRec::changeDirCombo(int index) { |
1353 | Config cfg("OpieRec"); | 1270 | Config cfg("OpieRec"); |
1354 | cfg.setGroup("Settings"); | 1271 | cfg.setGroup("Settings"); |
@@ -1359,35 +1276,35 @@ void QtRec::changeDirCombo(int index) { | |||
1359 | QListIterator<FileSystem> it ( fs ); | 1276 | QListIterator<FileSystem> it ( fs ); |
1360 | QString storage; | 1277 | QString storage; |
1361 | for( ; it.current(); ++it ){ | 1278 | for( ; it.current(); ++it ){ |
1362 | if( sName == (*it)->name()+" "+ (*it)->path() || | 1279 | if( sName == (*it)->name()+" "+ (*it)->path() || |
1363 | (*it)->name() == sName ) { | 1280 | (*it)->name() == sName ) { |
1364 | const QString path = (*it)->path(); | 1281 | const QString path = (*it)->path(); |
1365 | recDir = path; | 1282 | recDir = path; |
1366 | cfg.writeEntry("directory", recDir); | 1283 | cfg.writeEntry("directory", recDir); |
1367 | qDebug("new rec dir "+recDir); | 1284 | // qDebug("new rec dir "+recDir); |
1368 | } | 1285 | } |
1369 | } | 1286 | } |
1370 | cfg.write(); | 1287 | cfg.write(); |
1371 | } | 1288 | } |
1372 | 1289 | ||
1373 | 1290 | ||
1374 | void QtRec::changeSizeLimitCombo(int) { | 1291 | void QtRec::changeSizeLimitCombo(int) { |
1375 | Config cfg("OpieRec"); | 1292 | Config cfg("OpieRec"); |
1376 | cfg.setGroup("Settings"); | 1293 | cfg.setGroup("Settings"); |
1377 | cfg.writeEntry("sizeLimit", getCurrentSizeLimit() ); | 1294 | cfg.writeEntry("sizeLimit", getCurrentSizeLimit() ); |
1378 | cfg.write(); | 1295 | cfg.write(); |
1379 | } | 1296 | } |
1380 | 1297 | ||
1381 | void QtRec::newSound() { | 1298 | void QtRec::newSound() { |
1382 | qDebug("<<<<<<<<<new sound"); | 1299 | // qDebug("<<<<<<<<<new sound"); |
1383 | 1300 | ||
1384 | if( !rec()) { | 1301 | if( !rec()) { |
1385 | qDebug("rec() failed"); | 1302 | // qDebug("rec() failed"); |
1386 | endRecording(); | 1303 | endRecording(); |
1387 | deleteSound(); | 1304 | deleteSound(); |
1388 | } | 1305 | } |
1389 | 1306 | ||
1390 | } | 1307 | } |
1391 | 1308 | ||
1392 | void QtRec::itClick(QListViewItem *item) { | 1309 | void QtRec::itClick(QListViewItem *item) { |
1393 | currentFile=item->text(0); | 1310 | currentFile=item->text(0); |
@@ -1443,17 +1360,17 @@ void QtRec::deleteSound() { | |||
1443 | ListView1->clear(); | 1360 | ListView1->clear(); |
1444 | ListView1->setSelected(ListView1->firstChild(), true); | 1361 | ListView1->setSelected(ListView1->firstChild(), true); |
1445 | initIconView(); | 1362 | initIconView(); |
1446 | update(); | 1363 | update(); |
1447 | } | 1364 | } |
1448 | #ifndef DEV_VERSION | 1365 | #ifndef DEV_VERSION |
1449 | }; | 1366 | }; |
1450 | #endif | 1367 | #endif |
1451 | setCaption( tr( "OpieRecord " ) + QString::number(VERSION) ); | 1368 | setCaption( tr( "OpieRecord " ) /*+ QString::number(VERSION)*/ ); |
1452 | 1369 | ||
1453 | } | 1370 | } |
1454 | 1371 | ||
1455 | void QtRec::keyPressEvent( QKeyEvent *e) { | 1372 | void QtRec::keyPressEvent( QKeyEvent *e) { |
1456 | 1373 | ||
1457 | switch ( e->key() ) { | 1374 | switch ( e->key() ) { |
1458 | /* | 1375 | /* |
1459 | vercel keys-> | 1376 | vercel keys-> |
@@ -1508,17 +1425,17 @@ void QtRec::keyPressEvent( QKeyEvent *e) { | |||
1508 | break; | 1425 | break; |
1509 | case Key_Up: | 1426 | case Key_Up: |
1510 | // stop(); | 1427 | // stop(); |
1511 | break; | 1428 | break; |
1512 | case Key_Down: | 1429 | case Key_Down: |
1513 | // newSound(); | 1430 | // newSound(); |
1514 | break; | 1431 | break; |
1515 | case Key_Left: { | 1432 | case Key_Left: { |
1516 | qDebug("rewinding"); | 1433 | // qDebug("rewinding"); |
1517 | if( !e->isAutoRepeat()) | 1434 | if( !e->isAutoRepeat()) |
1518 | rewindPressed(); | 1435 | rewindPressed(); |
1519 | } | 1436 | } |
1520 | break; | 1437 | break; |
1521 | case Key_Right: { | 1438 | case Key_Right: { |
1522 | if( !e->isAutoRepeat()) | 1439 | if( !e->isAutoRepeat()) |
1523 | FastforwardPressed(); | 1440 | FastforwardPressed(); |
1524 | } | 1441 | } |
@@ -1562,36 +1479,36 @@ void QtRec::keyReleaseEvent( QKeyEvent *e) { | |||
1562 | else | 1479 | else |
1563 | stop(); | 1480 | stop(); |
1564 | break; | 1481 | break; |
1565 | case Key_Delete: | 1482 | case Key_Delete: |
1566 | deleteSound(); | 1483 | deleteSound(); |
1567 | break; | 1484 | break; |
1568 | case Key_Up: | 1485 | case Key_Up: |
1569 | // stop(); | 1486 | // stop(); |
1570 | qDebug("Up"); | 1487 | // qDebug("Up"); |
1571 | break; | 1488 | break; |
1572 | case Key_Down: | 1489 | case Key_Down: |
1573 | // start(); | 1490 | // start(); |
1574 | // qDebug("Down"); | 1491 | // qDebug("Down"); |
1575 | // newSound(); | 1492 | // newSound(); |
1576 | break; | 1493 | break; |
1577 | case Key_Left: | 1494 | case Key_Left: |
1578 | qDebug("Left"); | 1495 | // qDebug("Left"); |
1579 | rewindReleased(); | 1496 | rewindReleased(); |
1580 | break; | 1497 | break; |
1581 | case Key_Right: | 1498 | case Key_Right: |
1582 | qDebug("Right"); | 1499 | // qDebug("Right"); |
1583 | FastforwardReleased(); | 1500 | FastforwardReleased(); |
1584 | break; | 1501 | break; |
1585 | } | 1502 | } |
1586 | } | 1503 | } |
1587 | 1504 | ||
1588 | void QtRec::endRecording() { | 1505 | void QtRec::endRecording() { |
1589 | qDebug("endRecording"); | 1506 | // qDebug("endRecording"); |
1590 | setRecordButton(false); | 1507 | setRecordButton(false); |
1591 | timeSlider->setValue(0); | 1508 | timeSlider->setValue(0); |
1592 | toBeginningButton->setEnabled(true); | 1509 | toBeginningButton->setEnabled(true); |
1593 | toEndButton->setEnabled(true); | 1510 | toEndButton->setEnabled(true); |
1594 | 1511 | ||
1595 | monitoring=false; | 1512 | monitoring=false; |
1596 | 1513 | ||
1597 | killTimers(); | 1514 | killTimers(); |
@@ -1612,77 +1529,77 @@ void QtRec::endRecording() { | |||
1612 | // filePara.sd=-1; | 1529 | // filePara.sd=-1; |
1613 | wavFile->closeFile(); | 1530 | wavFile->closeFile(); |
1614 | filePara.fd=0; | 1531 | filePara.fd=0; |
1615 | 1532 | ||
1616 | if(wavFile->isTempFile()) { | 1533 | if(wavFile->isTempFile()) { |
1617 | // move tmp file to regular file | 1534 | // move tmp file to regular file |
1618 | QString cmd; | 1535 | QString cmd; |
1619 | cmd.sprintf("mv "+ wavFile->trackName() + " " + wavFile->currentFileName); | 1536 | cmd.sprintf("mv "+ wavFile->trackName() + " " + wavFile->currentFileName); |
1620 | qDebug("moving tmp file to "+currentFileName); | 1537 | // qDebug("moving tmp file to "+currentFileName); |
1621 | system(cmd.latin1()); | 1538 | system(cmd.latin1()); |
1622 | } | 1539 | } |
1623 | 1540 | ||
1624 | qDebug("Just moved "+wavFile->currentFileName); | 1541 | // qDebug("Just moved "+wavFile->currentFileName); |
1625 | Config cfg("OpieRec"); | 1542 | Config cfg("OpieRec"); |
1626 | cfg.setGroup("Sounds"); | 1543 | cfg.setGroup("Sounds"); |
1627 | 1544 | ||
1628 | int nFiles = cfg.readNumEntry( "NumberofFiles",0); | 1545 | int nFiles = cfg.readNumEntry( "NumberofFiles",0); |
1629 | 1546 | ||
1630 | currentFile = QFileInfo(wavFile->currentFileName).fileName(); | 1547 | currentFile = QFileInfo(wavFile->currentFileName).fileName(); |
1631 | currentFile=currentFile.left(currentFile.length()-4); | 1548 | currentFile=currentFile.left(currentFile.length()-4); |
1632 | 1549 | ||
1633 | cfg.writeEntry( "NumberofFiles",nFiles+1); | 1550 | cfg.writeEntry( "NumberofFiles",nFiles+1); |
1634 | cfg.writeEntry( QString::number( nFiles+1), currentFile); | 1551 | cfg.writeEntry( QString::number( nFiles+1), currentFile); |
1635 | cfg.writeEntry( currentFile, wavFile->currentFileName); | 1552 | cfg.writeEntry( currentFile, wavFile->currentFileName); |
1636 | 1553 | ||
1637 | QString time; | 1554 | QString time; |
1638 | time.sprintf("%.2f", filePara.numberOfRecordedSeconds); | 1555 | time.sprintf("%.2f", filePara.numberOfRecordedSeconds); |
1639 | cfg.writeEntry( wavFile->currentFileName, time ); | 1556 | cfg.writeEntry( wavFile->currentFileName, time ); |
1640 | qDebug("writing config numberOfRecordedSeconds "+time); | 1557 | // qDebug("writing config numberOfRecordedSeconds "+time); |
1641 | 1558 | ||
1642 | cfg.write(); | 1559 | cfg.write(); |
1643 | qDebug("finished recording"); | 1560 | // qDebug("finished recording"); |
1644 | timeLabel->setText(""); | 1561 | timeLabel->setText(""); |
1645 | } | 1562 | } |
1646 | 1563 | ||
1647 | if(soundDevice) delete soundDevice; | 1564 | if(soundDevice) delete soundDevice; |
1648 | 1565 | ||
1649 | initIconView(); | 1566 | initIconView(); |
1650 | selectItemByName(currentFile); | 1567 | selectItemByName(currentFile); |
1651 | } | 1568 | } |
1652 | 1569 | ||
1653 | void QtRec::endPlaying() { | 1570 | void QtRec::endPlaying() { |
1654 | 1571 | ||
1655 | qDebug("end playing"); | 1572 | // qDebug("end playing"); |
1656 | setRecordButton(false); | 1573 | setRecordButton(false); |
1657 | 1574 | ||
1658 | toBeginningButton->setEnabled(true); | 1575 | toBeginningButton->setEnabled(true); |
1659 | toEndButton->setEnabled(true); | 1576 | toEndButton->setEnabled(true); |
1660 | 1577 | ||
1661 | if(autoMute) | 1578 | if(autoMute) |
1662 | doMute(true); | 1579 | doMute(true); |
1663 | 1580 | ||
1664 | soundDevice->closeDevice( false); | 1581 | soundDevice->closeDevice( false); |
1665 | soundDevice->sd=-1; | 1582 | soundDevice->sd=-1; |
1666 | // if(soundDevice) delete soundDevice; | 1583 | // if(soundDevice) delete soundDevice; |
1667 | qDebug("file and sound device closed"); | 1584 | // qDebug("file and sound device closed"); |
1668 | stopped=true; | 1585 | stopped=true; |
1669 | recording=false; | 1586 | recording=false; |
1670 | playing=false; | 1587 | playing=false; |
1671 | timeLabel->setText(""); | 1588 | timeLabel->setText(""); |
1672 | monitoring=false; | 1589 | monitoring=false; |
1673 | total = 0; | 1590 | total = 0; |
1674 | filePara.numberSamples=0; | 1591 | filePara.numberSamples=0; |
1675 | filePara.sd=-1; | 1592 | filePara.sd=-1; |
1676 | wavFile->closeFile(); | 1593 | wavFile->closeFile(); |
1677 | filePara.fd=0; | 1594 | filePara.fd=0; |
1678 | // if(wavFile) delete wavFile; //this crashes | 1595 | // if(wavFile) delete wavFile; //this crashes |
1679 | 1596 | ||
1680 | qDebug("track closed"); | 1597 | // qDebug("track closed"); |
1681 | timeSlider->setValue(0); | 1598 | timeSlider->setValue(0); |
1682 | 1599 | ||
1683 | if(soundDevice) delete soundDevice; | 1600 | if(soundDevice) delete soundDevice; |
1684 | 1601 | ||
1685 | } | 1602 | } |
1686 | 1603 | ||
1687 | bool QtRec::openPlayFile() { | 1604 | bool QtRec::openPlayFile() { |
1688 | 1605 | ||
@@ -1694,28 +1611,28 @@ bool QtRec::openPlayFile() { | |||
1694 | } | 1611 | } |
1695 | QString currentFileName; | 1612 | QString currentFileName; |
1696 | Config cfg("OpieRec"); | 1613 | Config cfg("OpieRec"); |
1697 | cfg.setGroup("Sounds"); | 1614 | cfg.setGroup("Sounds"); |
1698 | int nFiles = cfg.readNumEntry("NumberofFiles",0); | 1615 | int nFiles = cfg.readNumEntry("NumberofFiles",0); |
1699 | for(int i=0;i<nFiles+1;i++) { //look for file | 1616 | for(int i=0;i<nFiles+1;i++) { //look for file |
1700 | if( cfg.readEntry( QString::number(i),"").find( currentFile,0,true) != -1) { | 1617 | if( cfg.readEntry( QString::number(i),"").find( currentFile,0,true) != -1) { |
1701 | currentFileName=cfg.readEntry( currentFile, "" ); | 1618 | currentFileName=cfg.readEntry( currentFile, "" ); |
1702 | qDebug("opening for play: "+currentFileName); | 1619 | // qDebug("opening for play: "+currentFileName); |
1703 | } | 1620 | } |
1704 | } | 1621 | } |
1705 | wavFile = new WavFile(this, | 1622 | wavFile = new WavFile(this, |
1706 | currentFileName, | 1623 | currentFileName, |
1707 | false); | 1624 | false); |
1708 | filePara.fd = wavFile->wavHandle(); | 1625 | filePara.fd = wavFile->wavHandle(); |
1709 | if(filePara.fd == -1) { | 1626 | if(filePara.fd == -1) { |
1710 | // if(!track.open(IO_ReadOnly)) { | 1627 | // if(!track.open(IO_ReadOnly)) { |
1711 | QString errorMsg=(QString)strerror(errno); | 1628 | QString errorMsg=(QString)strerror(errno); |
1712 | monitoring=false; | 1629 | monitoring=false; |
1713 | setCaption( tr( "OpieRecord " ) + QString::number(VERSION) ); | 1630 | setCaption( tr( "OpieRecord " )/* + QString::number(VERSION)*/ ); |
1714 | QMessageBox::message(tr("Note"),tr("Could not open audio file.\n") | 1631 | QMessageBox::message(tr("Note"),tr("Could not open audio file.\n") |
1715 | +errorMsg+"\n"+currentFile); | 1632 | +errorMsg+"\n"+currentFile); |
1716 | return false; | 1633 | return false; |
1717 | } else { | 1634 | } else { |
1718 | filePara.numberSamples=wavFile->getNumberSamples(); | 1635 | filePara.numberSamples=wavFile->getNumberSamples(); |
1719 | filePara.format = wavFile->getFormat(); | 1636 | filePara.format = wavFile->getFormat(); |
1720 | // qDebug("file %d, samples %f", filePara.fd, filePara.numberSamples); | 1637 | // qDebug("file %d, samples %f", filePara.fd, filePara.numberSamples); |
1721 | filePara.sampleRate= wavFile->getSampleRate(); | 1638 | filePara.sampleRate= wavFile->getSampleRate(); |
@@ -1816,30 +1733,30 @@ void QtRec::doRename() { | |||
1816 | renameBox->resize( r.size() ); | 1733 | renameBox->resize( r.size() ); |
1817 | ListView1->viewport()->setFocusProxy( renameBox ); | 1734 | ListView1->viewport()->setFocusProxy( renameBox ); |
1818 | renameBox->setFocus(); | 1735 | renameBox->setFocus(); |
1819 | renameBox->show(); | 1736 | renameBox->show(); |
1820 | 1737 | ||
1821 | } | 1738 | } |
1822 | 1739 | ||
1823 | void QtRec::okRename() { | 1740 | void QtRec::okRename() { |
1824 | qDebug("okRename"); | 1741 | // qDebug("okRename"); |
1825 | qDebug(renameBox->text()); | 1742 | // qDebug(renameBox->text()); |
1826 | QString filename = renameBox->text(); | 1743 | QString filename = renameBox->text(); |
1827 | cancelRename(); | 1744 | cancelRename(); |
1828 | 1745 | ||
1829 | if( ListView1->currentItem() == NULL) | 1746 | if( ListView1->currentItem() == NULL) |
1830 | return; | 1747 | return; |
1831 | 1748 | ||
1832 | Config cfg("OpieRec"); | 1749 | Config cfg("OpieRec"); |
1833 | cfg.setGroup("Sounds"); | 1750 | cfg.setGroup("Sounds"); |
1834 | 1751 | ||
1835 | QString file = ListView1->currentItem()->text(0); | 1752 | QString file = ListView1->currentItem()->text(0); |
1836 | 1753 | ||
1837 | qDebug("filename is " + filename); | 1754 | // qDebug("filename is " + filename); |
1838 | 1755 | ||
1839 | int nFiles = cfg.readNumEntry("NumberofFiles",0); | 1756 | int nFiles = cfg.readNumEntry("NumberofFiles",0); |
1840 | 1757 | ||
1841 | for(int i=0;i<nFiles+1;i++) { //look for file | 1758 | for(int i=0;i<nFiles+1;i++) { //look for file |
1842 | if( cfg.readEntry( QString::number(i),"").find(file,0,true) != -1) { | 1759 | if( cfg.readEntry( QString::number(i),"").find(file,0,true) != -1) { |
1843 | 1760 | ||
1844 | QString filePath = cfg.readEntry(file,""); | 1761 | QString filePath = cfg.readEntry(file,""); |
1845 | 1762 | ||
@@ -1853,17 +1770,17 @@ void QtRec::okRename() { | |||
1853 | ListView1->takeItem( ListView1->currentItem() ); | 1770 | ListView1->takeItem( ListView1->currentItem() ); |
1854 | delete ListView1->currentItem(); | 1771 | delete ListView1->currentItem(); |
1855 | ListView1->clear(); | 1772 | ListView1->clear(); |
1856 | initIconView(); | 1773 | initIconView(); |
1857 | update(); | 1774 | update(); |
1858 | } | 1775 | } |
1859 | 1776 | ||
1860 | void QtRec::cancelRename() { | 1777 | void QtRec::cancelRename() { |
1861 | qDebug("cancel rename"); | 1778 | // qDebug("cancel rename"); |
1862 | bool resetFocus = ListView1->viewport()->focusProxy() == renameBox; | 1779 | bool resetFocus = ListView1->viewport()->focusProxy() == renameBox; |
1863 | delete renameBox; | 1780 | delete renameBox; |
1864 | renameBox = 0; | 1781 | renameBox = 0; |
1865 | if ( resetFocus ) { | 1782 | if ( resetFocus ) { |
1866 | ListView1->viewport()->setFocusProxy( ListView1 ); | 1783 | ListView1->viewport()->setFocusProxy( ListView1 ); |
1867 | ListView1->setFocus(); | 1784 | ListView1->setFocus(); |
1868 | } | 1785 | } |
1869 | } | 1786 | } |
@@ -1889,17 +1806,17 @@ bool QtRec::eventFilter( QObject * o, QEvent * e ) { | |||
1889 | } | 1806 | } |
1890 | 1807 | ||
1891 | 1808 | ||
1892 | int QtRec::getCurrentSizeLimit() { | 1809 | int QtRec::getCurrentSizeLimit() { |
1893 | return sizeLimitCombo->currentItem() * 5; | 1810 | return sizeLimitCombo->currentItem() * 5; |
1894 | } | 1811 | } |
1895 | 1812 | ||
1896 | void QtRec::timerBreak() { | 1813 | void QtRec::timerBreak() { |
1897 | qDebug("timer break"); | 1814 | // qDebug("timer break"); |
1898 | stop(); | 1815 | stop(); |
1899 | } | 1816 | } |
1900 | 1817 | ||
1901 | void QtRec::doVolMuting(bool b) { | 1818 | void QtRec::doVolMuting(bool b) { |
1902 | Config cfg( "qpe" ); | 1819 | Config cfg( "qpe" ); |
1903 | cfg. setGroup( "Volume" ); | 1820 | cfg. setGroup( "Volume" ); |
1904 | cfg.writeEntry( "Mute",b); | 1821 | cfg.writeEntry( "Mute",b); |
1905 | cfg.write(); | 1822 | cfg.write(); |
@@ -1956,18 +1873,18 @@ long QtRec::checkDiskSpace(const QString &path) { | |||
1956 | // long f_frsize; /* Fragment size */ | 1873 | // long f_frsize; /* Fragment size */ |
1957 | // long f_blocks; /* Total number of blocks*/ | 1874 | // long f_blocks; /* Total number of blocks*/ |
1958 | // long f_bfree; /* Count of free blocks */ | 1875 | // long f_bfree; /* Count of free blocks */ |
1959 | // long f_files; /* Total number of file nodes */ | 1876 | // long f_files; /* Total number of file nodes */ |
1960 | // long f_ffree; /* Count of free file nodes */ | 1877 | // long f_ffree; /* Count of free file nodes */ |
1961 | // char f_fname[6]; /* Volumename */ | 1878 | // char f_fname[6]; /* Volumename */ |
1962 | // char f_fpack[6]; /* Pack name */ | 1879 | // char f_fpack[6]; /* Pack name */ |
1963 | 1880 | ||
1964 | void QtRec::receive( const QCString &msg, const QByteArray & ) { | 1881 | void QtRec::receive( const QCString &/* msg*/, const QByteArray & ) { |
1965 | qDebug("Voicerecord received message "+msg); | 1882 | // qDebug("Voicerecord received message "+msg); |
1966 | 1883 | ||
1967 | } | 1884 | } |
1968 | 1885 | ||
1969 | 1886 | ||
1970 | ///////////////////////////// timerEvent | 1887 | ///////////////////////////// timerEvent |
1971 | void QtRec::timerEvent( QTimerEvent *e ) { | 1888 | void QtRec::timerEvent( QTimerEvent *e ) { |
1972 | // qDebug( "%d", secCount ); | 1889 | // qDebug( "%d", secCount ); |
1973 | #ifdef DEV_VERSION | 1890 | #ifdef DEV_VERSION |
@@ -2222,33 +2139,30 @@ void QtRec::selectItemByName(const QString & name) { | |||
2222 | if(name == it.current()->text(0)) | 2139 | if(name == it.current()->text(0)) |
2223 | ListView1->setCurrentItem(it.current()); | 2140 | ListView1->setCurrentItem(it.current()); |
2224 | } | 2141 | } |
2225 | 2142 | ||
2226 | 2143 | ||
2227 | long findPeak(long input ) { | 2144 | long findPeak(long input ) { |
2228 | 2145 | ||
2229 | // halfLife = time in seconds for output to decay to half value after an impulse | 2146 | // halfLife = time in seconds for output to decay to half value after an impulse |
2230 | static float output = 0.0; | 2147 | float output = 0.0; |
2231 | int halfLife = .25; | 2148 | float halfLife = .25; |
2232 | float vsf = .0025; | 2149 | float vsf = .0025; |
2233 | float scalar = pow( 0.5, 1.0/(halfLife * filePara.sampleRate )); | 2150 | float scalar = pow( 0.5, 1.0/(halfLife * filePara.sampleRate )); |
2234 | if( input < 0.0 ) | 2151 | if( input < 0.0 ) |
2235 | input = -input; // Absolute value. | 2152 | input = -input; // Absolute value. |
2236 | if ( input >= output ) | 2153 | if ( input >= output) { |
2237 | { | ||
2238 | // When we hit a peak, ride the peak to the top. | 2154 | // When we hit a peak, ride the peak to the top. |
2239 | output = input; | 2155 | output = input; |
2240 | } | 2156 | } else { |
2241 | else | ||
2242 | { | ||
2243 | // Exponential decay of output when signal is low. | 2157 | // Exponential decay of output when signal is low. |
2244 | output = output * scalar; | 2158 | output = output * scalar; |
2245 | // | 2159 | // |
2246 | // When current gets close to 0.0, set current to 0.0 to prevent FP underflow | 2160 | // When current gets close to 0.0, set current to 0.0 to prevent FP underflow |
2247 | // which can cause a severe performance degradation due to a flood | 2161 | // which can cause a severe performance degradation due to a flood |
2248 | // of interrupts. | 2162 | // of interrupts. |
2249 | // | 2163 | // |
2250 | if( output < vsf ) output = 0.0; | 2164 | if( output < vsf ) output = 0.0; |
2251 | } | 2165 | } |
2252 | 2166 | ||
2253 | return output; | 2167 | return (long)output; |
2254 | } | 2168 | } |
diff --git a/noncore/multimedia/opierec/qtrec.h b/noncore/multimedia/opierec/qtrec.h index bcf5504..7965c74 100644 --- a/noncore/multimedia/opierec/qtrec.h +++ b/noncore/multimedia/opierec/qtrec.h | |||
@@ -1,15 +1,15 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** Created: Thu Jan 17 11:19:45 2002 | 2 | ** Created: Thu Jan 17 11:19:45 2002 |
3 | copyright 2002 by L.J. Potter ljp@llornkcor.com | 3 | copyright 2002 by L.J. Potter ljp@llornkcor.com |
4 | ****************************************************************************/ | 4 | ****************************************************************************/ |
5 | #ifndef QTREC_H | 5 | #ifndef QTREC_H |
6 | #define QTREC_H | 6 | #define QTREC_H |
7 | #define VERSION 20021202 | 7 | #define VERSION 1.0 |
8 | 8 | ||
9 | #include <qpe/ir.h> | 9 | #include <qpe/ir.h> |
10 | 10 | ||
11 | #include <iostream.h> | 11 | #include <iostream.h> |
12 | #include <qfile.h> | 12 | #include <qfile.h> |
13 | #include <qimage.h> | 13 | #include <qimage.h> |
14 | #include <qlineedit.h> | 14 | #include <qlineedit.h> |
15 | #include <qpixmap.h> | 15 | #include <qpixmap.h> |