summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2003-04-27 13:28:37 (UTC)
committer llornkcor <llornkcor>2003-04-27 13:28:37 (UTC)
commit1d7eb1dd34ce10b01dddc65b3bfd34363969b987 (patch) (unidiff)
treef00b7e2c8f14e0ceb0a7862955683f83aa22f5cc
parent6d032a24be12c13e10723dc27cbedc1a30628428 (diff)
downloadopie-1d7eb1dd34ce10b01dddc65b3bfd34363969b987.zip
opie-1d7eb1dd34ce10b01dddc65b3bfd34363969b987.tar.gz
opie-1d7eb1dd34ce10b01dddc65b3bfd34363969b987.tar.bz2
remove help tab
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opierec/qtrec.cpp78
1 files changed, 39 insertions, 39 deletions
diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp
index 8a0f8db..28f6546 100644
--- a/noncore/multimedia/opierec/qtrec.cpp
+++ b/noncore/multimedia/opierec/qtrec.cpp
@@ -157,185 +157,185 @@ void quickRec() {
157 qDebug("%d", filePara.sd); 157 qDebug("%d", filePara.sd);
158 level=7; 158 level=7;
159 threshold=0; 159 threshold=0;
160 timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds); 160 timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds);
161 timeLabel->setText( timeString+ " seconds"); 161 timeLabel->setText( timeString+ " seconds");
162 162
163 if( filePara.format==WAVE_FORMAT_DVI_ADPCM) { 163 if( filePara.format==WAVE_FORMAT_DVI_ADPCM) {
164 qDebug("start recording WAVE_FORMAT_DVI_ADPCM"); 164 qDebug("start recording WAVE_FORMAT_DVI_ADPCM");
165 // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_DVI_ADPCM >>>>>>>>>>>>>>>>>>>>>> 165 // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_DVI_ADPCM >>>>>>>>>>>>>>>>>>>>>>
166 char abuf[BUFSIZE/2]; 166 char abuf[BUFSIZE/2];
167 short sbuf[BUFSIZE]; 167 short sbuf[BUFSIZE];
168 short sbuf2[BUFSIZE]; 168 short sbuf2[BUFSIZE];
169 memset( abuf,0,BUFSIZE/2); 169 memset( abuf,0,BUFSIZE/2);
170 memset( sbuf,0,BUFSIZE); 170 memset( sbuf,0,BUFSIZE);
171 memset( sbuf2,0,BUFSIZE); 171 memset( sbuf2,0,BUFSIZE);
172 172
173 for(;;) { 173 for(;;) {
174 if (stopped) { 174 if (stopped) {
175 qDebug("quickRec:: stopped"); 175 qDebug("quickRec:: stopped");
176 break; // stop if playing was set to false 176 break; // stop if playing was set to false
177// return; 177// return;
178 } 178 }
179 179
180 number=::read( filePara.sd, sbuf, BUFSIZE); 180 number=::read( filePara.sd, sbuf, BUFSIZE);
181 181
182 if(number <= 0) { 182 if(number <= 0) {
183 perror("recording error "); 183 perror("recording error ");
184 qDebug( "%s %d", filePara.fileName, number); 184 qDebug( "%s %d", filePara.fileName, number);
185 // errorStop(); 185 // errorStop();
186 recording=stopped=false; 186 recording=stopped=false;
187// QMessageBox::message("Note", 187// QMessageBox::message("Note",
188// "Error recording to file\n%s", 188// "Error recording to file\n%s",
189// filePara.fileName); 189// filePara.fileName);
190 return; 190 return;
191 } 191 }
192 //if(stereo == 2) { 192 //if(stereo == 2) {
193// adpcm_coder( sbuf2, abuf, number/2, &encoder_state); 193// adpcm_coder( sbuf2, abuf, number/2, &encoder_state);
194 adpcm_coder( sbuf, abuf, number/2, &encoder_state); 194 adpcm_coder( sbuf, abuf, number/2, &encoder_state);
195 195
196 bytesWritten = ::write( filePara.fd , abuf, number/4); 196 bytesWritten = ::write( filePara.fd , abuf, number/4);
197 197
198 long peak; 198 long peak;
199 for (int i = 0; i < number; i++) 199 for (int i = 0; i < number; i++)
200 { //since Z is mono do normally 200 { //since Z is mono do normally
201 peak = findPeak((long)sbuf[i]); 201 peak = findPeak((long)sbuf[i]);
202 printf("peak %ld\r",peak); 202 printf("peak %ld\r",peak);
203 fflush(stdout); 203 fflush(stdout);
204 } 204 }
205 205
206 206
207 //------------->>>> out to file 207 //------------->>>> out to file
208 // if(filePara.channels==1) 208 // if(filePara.channels==1)
209 // total += bytesWritten/2; //mono 209 // total += bytesWritten/2; //mono
210 // else 210 // else
211 total += bytesWritten; 211 total += bytesWritten;
212 filePara.numberSamples = total; 212 filePara.numberSamples = total;
213// if( total >= filePara.samplesToRecord) 213// if( total >= filePara.samplesToRecord)
214// timeSlider->setValue(0); 214// timeSlider->setValue(0);
215// else if( filePara.SecondsToRecord !=0) 215// else if( filePara.SecondsToRecord !=0)
216 timeSlider->setValue( total); 216 timeSlider->setValue( total);
217 217
218 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2; 218 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2;
219 219
220// printf("Writing number %d, bytes %d,total %d, sample rate %d, secs %.2f \n", 220// printf("Writing number %d, bytes %d,total %d, sample rate %d, secs %.2f \n",
221// number, 221// number,
222// bytesWritten , 222// bytesWritten ,
223// total, 223// total,
224// filePara.sampleRate, 224// filePara.sampleRate,
225// filePara.numberOfRecordedSeconds); 225// filePara.numberOfRecordedSeconds);
226// fflush(stdout); 226// fflush(stdout);
227 ioctl( filePara.sd, SNDCTL_DSP_GETIPTR, &info); 227 ioctl( filePara.sd, SNDCTL_DSP_GETIPTR, &info);
228// qDebug("%d, %d", info.bytes, (info.bytes / filePara.sampleRate) / 2); 228// qDebug("%d, %d", info.bytes, (info.bytes / filePara.sampleRate) / 2);
229 229
230 timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds); 230 timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds);
231 timeLabel->setText( timeString + " seconds"); 231 timeLabel->setText( timeString + " seconds");
232 232
233 qApp->processEvents(); 233 qApp->processEvents();
234 if( total >= filePara.samplesToRecord) 234 if( total >= filePara.samplesToRecord)
235 break; 235 break;
236 } 236 }
237 } else { 237 } else {
238 // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_PCM >>>>>>>>>>>>>>>>>>>>>> 238 // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_PCM >>>>>>>>>>>>>>>>>>>>>>
239 qDebug("start recording WAVE_FORMAT_PCM"); 239 qDebug("start recording WAVE_FORMAT_PCM");
240 short inbuffer[BUFSIZE], outbuffer[BUFSIZE]; 240 short inbuffer[BUFSIZE], outbuffer[BUFSIZE];
241 memset( inbuffer,0,BUFSIZE); 241 memset( inbuffer,0,BUFSIZE);
242 memset( outbuffer,0,BUFSIZE); 242 memset( outbuffer,0,BUFSIZE);
243 for(;;) { 243 for(;;) {
244 if (stopped) { 244 if (stopped) {
245 qDebug("quickRec:: stopped"); 245 qDebug("quickRec:: stopped");
246 break; // stop if playing was set to false 246 break; // stop if playing was set to false
247 return; 247 return;
248 } 248 }
249 249
250 number=::read( filePara.sd, inbuffer, BUFSIZE); 250 number=::read( filePara.sd, inbuffer, BUFSIZE);
251 251
252 if(number <= 0) { 252 if(number <= 0) {
253 perror("recording error "); 253 perror("recording error ");
254 qDebug( filePara.fileName); 254 qDebug( filePara.fileName);
255 recording=stopped=false; 255 recording=stopped=false;
256 // errorStop(); 256 // errorStop();
257// QMessageBox::message("Note","error recording to file\n%s",filePara.fileName); 257// QMessageBox::message("Note","error recording to file\n%s",filePara.fileName);
258 return;// false; 258 return;// false;
259 } 259 }
260/* for (int i=0;i< number;i++) { //2*i is left channel 260/* for (int i=0;i< number;i++) { //2*i is left channel
261 261
262outbuffer[i]=inbuffer[i]>>1; // no clippy, please 262outbuffer[i]=inbuffer[i]>>1; // no clippy, please
263}*/ 263}*/
264 bytesWritten = ::write( filePara.fd , inbuffer, number); 264 bytesWritten = ::write( filePara.fd , inbuffer, number);
265//------------->>>> out to file 265//------------->>>> out to file
266 if(bytesWritten < 0) { 266 if(bytesWritten < 0) {
267 // errorStop(); 267 // errorStop();
268 perror("File writing error "); 268 perror("File writing error ");
269 return;// false; 269 return;// false;
270 } 270 }
271 271
272 // if(filePara.channels==1) 272 // if(filePara.channels==1)
273 // total += bytesWritten/2; //mono 273 // total += bytesWritten/2; //mono
274 // else 274 // else
275 total += bytesWritten; 275 total += bytesWritten;
276 long peak; 276 long peak;
277 for (int i = 0; i < number; i++) 277 for (int i = 0; i < number; i++)
278 { //since Z is mono do normally 278 { //since Z is mono do normally
279 peak = findPeak((long)inbuffer[i]); 279 peak = findPeak((long)inbuffer[i]);
280 printf("peak %ld\r",peak); 280 printf("peak %ld\r",peak);
281 fflush(stdout); 281 fflush(stdout);
282 } 282 }
283 283
284 284
285 filePara.numberSamples = total; 285 filePara.numberSamples = total;
286 if(filePara.SecondsToRecord !=0) 286 if(filePara.SecondsToRecord !=0)
287 timeSlider->setValue( total); 287 timeSlider->setValue( total);
288// printf("Writing number %d, bytes %d,total %d\r",number, bytesWritten , total); 288// printf("Writing number %d, bytes %d,total %d\r",number, bytesWritten , total);
289// fflush(stdout); 289// fflush(stdout);
290 290
291 ioctl( filePara.sd, SNDCTL_DSP_GETIPTR, &info); 291 ioctl( filePara.sd, SNDCTL_DSP_GETIPTR, &info);
292// qDebug("%d, %d", info.bytes, ( info.bytes / filePara.sampleRate) / 2); 292// qDebug("%d, %d", info.bytes, ( info.bytes / filePara.sampleRate) / 2);
293 293
294 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / (float)2; 294 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / (float)2;
295 295
296 timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds); 296 timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds);
297 timeLabel->setText( timeString + " seconds"); 297 timeLabel->setText( timeString + " seconds");
298 298
299 qApp->processEvents(); 299 qApp->processEvents();
300 if( total >= filePara.samplesToRecord) 300 if( total >= filePara.samplesToRecord)
301 break; 301 break;
302 } 302 }
303 } //end main loop 303 } //end main loop
304 304
305 } else { // <<<<<<<<<<<<<<<<<<<<<<< format = AFMT_U8; 305 } else { // <<<<<<<<<<<<<<<<<<<<<<< format = AFMT_U8;
306 unsigned char unsigned_inbuffer[BUFSIZE], unsigned_outbuffer[BUFSIZE]; 306 unsigned char unsigned_inbuffer[BUFSIZE], unsigned_outbuffer[BUFSIZE];
307 memset( unsigned_inbuffer, 0, BUFSIZE); 307 memset( unsigned_inbuffer, 0, BUFSIZE);
308 memset( unsigned_outbuffer, 0, BUFSIZE); 308 memset( unsigned_outbuffer, 0, BUFSIZE);
309 309
310 for(;;) { 310 for(;;) {
311 if (stopped) { 311 if (stopped) {
312 qDebug("quickRec:: stopped"); 312 qDebug("quickRec:: stopped");
313 break; // stop if playing was set to false 313 break; // stop if playing was set to false
314 } 314 }
315 number=::read( filePara.sd, unsigned_inbuffer, BUFSIZE); 315 number=::read( filePara.sd, unsigned_inbuffer, BUFSIZE);
316//-------------<<<< in from device 316//-------------<<<< in from device
317// val = (data ^ 0x80) << 8; 317// val = (data ^ 0x80) << 8;
318 318
319//unsigned_outbuffer = (unsigned_inbuffer ^ 0x80) << 8; 319//unsigned_outbuffer = (unsigned_inbuffer ^ 0x80) << 8;
320 320
321// if(number <= 0) { 321// if(number <= 0) {
322// perror("recording error "); 322// perror("recording error ");
323// qDebug(filePara.fileName); 323// qDebug(filePara.fileName);
324// // errorStop(); 324// // errorStop();
325// QMessageBox::message("Note","error recording"); 325// QMessageBox::message("Note","error recording");
326// return;// false; 326// return;// false;
327// } 327// }
328// for (int i=0;i< number;i++) { //2*i is left channel 328// for (int i=0;i< number;i++) { //2*i is left channel
329// unsigned_outbuffer[i]=unsigned_inbuffer[i]>>1; // no clippy, please 329// unsigned_outbuffer[i]=unsigned_inbuffer[i]>>1; // no clippy, please
330// } 330// }
331 331
332 bytesWritten = ::write( filePara.fd , unsigned_inbuffer, number); 332 bytesWritten = ::write( filePara.fd , unsigned_inbuffer, number);
333 333
334//------------->>>> out to file 334//------------->>>> out to file
335 if(bytesWritten < 0) { 335 if(bytesWritten < 0) {
336 recording=stopped=false; 336 recording=stopped=false;
337 // errorStop(); 337 // errorStop();
338 QMessageBox::message("Note","There was a problem\nwriting to the file"); 338 QMessageBox::message("Note","There was a problem\nwriting to the file");
339 perror("File writing error "); 339 perror("File writing error ");
340 return;// false; 340 return;// false;
341 } 341 }
@@ -513,97 +513,97 @@ void QtRec::init() {
513 513
514 ListView1->addColumn( tr( "Name" ) ); 514 ListView1->addColumn( tr( "Name" ) );
515 ListView1->setColumnWidth(0,140); 515 ListView1->setColumnWidth(0,140);
516 ListView1->setSorting( 1, false); 516 ListView1->setSorting( 1, false);
517 ListView1->addColumn( tr( "Time" ) ); //in seconds 517 ListView1->addColumn( tr( "Time" ) ); //in seconds
518 ListView1->setColumnWidth(1,50); 518 ListView1->setColumnWidth(1,50);
519 ListView1->addColumn( "Location"); 519 ListView1->addColumn( "Location");
520 ListView1->setColumnWidth(2,50); 520 ListView1->setColumnWidth(2,50);
521 ListView1->addColumn( "Date"); 521 ListView1->addColumn( "Date");
522 ListView1->setColumnWidth(3,63); 522 ListView1->setColumnWidth(3,63);
523 523
524 ListView1->setColumnWidthMode(0,QListView::Manual); 524 ListView1->setColumnWidthMode(0,QListView::Manual);
525 ListView1->setColumnAlignment(1,QListView::AlignCenter); 525 ListView1->setColumnAlignment(1,QListView::AlignCenter);
526 ListView1->setColumnAlignment(2,QListView::AlignRight); 526 ListView1->setColumnAlignment(2,QListView::AlignRight);
527 ListView1->setColumnAlignment(3,QListView::AlignLeft); 527 ListView1->setColumnAlignment(3,QListView::AlignLeft);
528 ListView1->setAllColumnsShowFocus( true ); 528 ListView1->setAllColumnsShowFocus( true );
529 QPEApplication::setStylusOperation( ListView1->viewport(),QPEApplication::RightOnHold); 529 QPEApplication::setStylusOperation( ListView1->viewport(),QPEApplication::RightOnHold);
530 530
531 TabWidget->insertTab( tab, tr( "Files" ) ); 531 TabWidget->insertTab( tab, tr( "Files" ) );
532 532
533 ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** 533 ///**********<<<<<<<<<<<<>>>>>>>>>>>>***************
534 tab_3 = new QWidget( TabWidget, "tab_3" ); 534 tab_3 = new QWidget( TabWidget, "tab_3" );
535 //////////////////////////////////// 535 ////////////////////////////////////
536 536
537 Layout19 = new QHBoxLayout( tab_3); 537 Layout19 = new QHBoxLayout( tab_3);
538 Layout19->setSpacing( 2 ); 538 Layout19->setSpacing( 2 );
539 Layout19->setMargin( 0 ); 539 Layout19->setMargin( 0 );
540 540
541 Layout18 = new QVBoxLayout(this); 541 Layout18 = new QVBoxLayout(this);
542 Layout18->setSpacing( 2 ); 542 Layout18->setSpacing( 2 );
543 Layout18->setMargin( 0 ); 543 Layout18->setMargin( 0 );
544 544
545 Layout17 = new QHBoxLayout(this); 545 Layout17 = new QHBoxLayout(this);
546 Layout17->setSpacing( 2 ); 546 Layout17->setSpacing( 2 );
547 Layout17->setMargin( 0 ); 547 Layout17->setMargin( 0 );
548 548
549 sampleGroup = new QGroupBox( tab_3, "samplegroup" ); 549 sampleGroup = new QGroupBox( tab_3, "samplegroup" );
550 sampleGroup->setTitle( tr( "Sample Rate" ) ); 550 sampleGroup->setTitle( tr( "Sample Rate" ) );
551 sampleGroup->setFixedSize( 95,50); 551 sampleGroup->setFixedSize( 95,50);
552 552
553 sampleRateComboBox = new QComboBox( false, sampleGroup, "SampleRateComboBox" ); 553 sampleRateComboBox = new QComboBox( false, sampleGroup, "SampleRateComboBox" );
554 sampleRateComboBox->setGeometry( QRect( 10, 20, 80, 25 ) ); 554 sampleRateComboBox->setGeometry( QRect( 10, 20, 80, 25 ) );
555//#ifndef QT_QWS_EBX 555//#ifndef QT_QWS_EBX
556 sampleRateComboBox->insertItem( tr( "44100")); 556 sampleRateComboBox->insertItem( tr( "44100"));
557 sampleRateComboBox->insertItem( tr( "32000")); 557 sampleRateComboBox->insertItem( tr( "32000"));
558//#endif 558//#endif
559 sampleRateComboBox->insertItem( tr( "22050")); 559 sampleRateComboBox->insertItem( tr( "22050"));
560 //#ifndef QT_QWS_VERCEL_IDR 560 //#ifndef QT_QWS_VERCEL_IDR
561 sampleRateComboBox->insertItem( tr( "16000")); 561 sampleRateComboBox->insertItem( tr( "16000"));
562 sampleRateComboBox->insertItem( tr( "11025")); 562 sampleRateComboBox->insertItem( tr( "11025"));
563 sampleRateComboBox->insertItem( tr( "8000")); 563 sampleRateComboBox->insertItem( tr( "8000"));
564 //#endif 564 //#endif
565 565
566 Layout17->addWidget( sampleGroup ); 566 Layout17->addWidget( sampleGroup );
567 567
568 sizeGroup= new QGroupBox( tab_3, "sizeGroup" ); 568 sizeGroup= new QGroupBox( tab_3, "sizeGroup" );
569 sizeGroup->setTitle( tr( "Limit Size" ) ); 569 sizeGroup->setTitle( tr( "Limit Size" ) );
570 sizeGroup->setFixedSize(80,50); 570 sizeGroup->setFixedSize(80,50);
571 571
572 sizeLimitCombo = new QComboBox( false, sizeGroup, "sizeLimitCombo" ); 572 sizeLimitCombo = new QComboBox( false, sizeGroup, "sizeLimitCombo" );
573 sizeLimitCombo ->setGeometry( QRect( 5, 20, 70, 25 ) ); 573 sizeLimitCombo ->setGeometry( QRect( 5, 20, 70, 25 ) );
574 sizeLimitCombo->insertItem(tr("Unlimited")); 574 sizeLimitCombo->insertItem(tr("Unlimited"));
575 for(int i=1;i<13; i++) { 575 for(int i=1;i<13; i++) {
576 sizeLimitCombo->insertItem( QString::number(i*5)); 576 sizeLimitCombo->insertItem( QString::number(i*5));
577 } 577 }
578 578
579// sizeLimitCombo->insertItem(tr("5 secs")); 579// sizeLimitCombo->insertItem(tr("5 secs"));
580// sizeLimitCombo->insertItem(tr("10 secs")); 580// sizeLimitCombo->insertItem(tr("10 secs"));
581// sizeLimitCombo->insertItem(tr("15 secs")); 581// sizeLimitCombo->insertItem(tr("15 secs"));
582// sizeLimitCombo->insertItem(tr("20 secs")); 582// sizeLimitCombo->insertItem(tr("20 secs"));
583 583
584 // Layout18->addWidget( sizeGroup ); 584 // Layout18->addWidget( sizeGroup );
585 Layout17->addWidget( sizeGroup ); 585 Layout17->addWidget( sizeGroup );
586 586
587 Layout18->addLayout( Layout17 ); 587 Layout18->addLayout( Layout17 );
588 588
589 Layout16 = new QHBoxLayout(this); 589 Layout16 = new QHBoxLayout(this);
590 Layout16->setSpacing( 2 ); 590 Layout16->setSpacing( 2 );
591 Layout16->setMargin( 0 ); 591 Layout16->setMargin( 0 );
592 592
593 dirGroup = new QGroupBox( tab_3, "dirGroup" ); 593 dirGroup = new QGroupBox( tab_3, "dirGroup" );
594 dirGroup->setTitle( tr( "File Directory" ) ); 594 dirGroup->setTitle( tr( "File Directory" ) );
595 dirGroup->setFixedSize(130,50); 595 dirGroup->setFixedSize(130,50);
596 596
597 directoryComboBox = new QComboBox( false, dirGroup, "dirGroup" ); 597 directoryComboBox = new QComboBox( false, dirGroup, "dirGroup" );
598 directoryComboBox->setGeometry( QRect( 10, 15, 115, 25 ) ); 598 directoryComboBox->setGeometry( QRect( 10, 15, 115, 25 ) );
599 599
600 Layout18->addWidget( dirGroup ); 600 Layout18->addWidget( dirGroup );
601 601
602 bitGroup = new QGroupBox( tab_3, "bitGroup" ); 602 bitGroup = new QGroupBox( tab_3, "bitGroup" );
603 bitGroup->setTitle( tr( "Bit Depth" ) ); 603 bitGroup->setTitle( tr( "Bit Depth" ) );
604 bitGroup->setFixedSize(65,50); 604 bitGroup->setFixedSize(65,50);
605 605
606 bitRateComboBox = new QComboBox( false, bitGroup, "BitRateComboBox" ); 606 bitRateComboBox = new QComboBox( false, bitGroup, "BitRateComboBox" );
607 bitRateComboBox->insertItem( tr( "16" ) ); 607 bitRateComboBox->insertItem( tr( "16" ) );
608 bitRateComboBox->insertItem( tr( "8" ) ); 608 bitRateComboBox->insertItem( tr( "8" ) );
609 bitRateComboBox->setGeometry( QRect( 5, 20, 50, 25 ) ); 609 bitRateComboBox->setGeometry( QRect( 5, 20, 50, 25 ) );
@@ -682,120 +682,120 @@ void QtRec::init() {
682 // Layout16->addWidget( dirGroup ); 682 // Layout16->addWidget( dirGroup );
683 // Layout18->addLayout( Layout16 ); 683 // Layout18->addLayout( Layout16 );
684 Layout15 = new QVBoxLayout(this); 684 Layout15 = new QVBoxLayout(this);
685 Layout15->setSpacing( 2 ); 685 Layout15->setSpacing( 2 );
686 Layout15->setMargin( 0 ); 686 Layout15->setMargin( 0 );
687 687
688 Layout15b = new QVBoxLayout(this); 688 Layout15b = new QVBoxLayout(this);
689 Layout15b->setSpacing( 2 ); 689 Layout15b->setSpacing( 2 );
690 Layout15b->setMargin( 0 ); 690 Layout15b->setMargin( 0 );
691 691
692 TextLabel2 = new QLabel( tab_3, "InputLabel" ); 692 TextLabel2 = new QLabel( tab_3, "InputLabel" );
693 TextLabel2->setText( tr( "In")); 693 TextLabel2->setText( tr( "In"));
694 TextLabel2->setFixedWidth(35); 694 TextLabel2->setFixedWidth(35);
695 Layout15->addWidget( TextLabel2 ); 695 Layout15->addWidget( TextLabel2 );
696 696
697 TextLabel3 = new QLabel( tab_3, "OutputLabel" ); 697 TextLabel3 = new QLabel( tab_3, "OutputLabel" );
698 TextLabel3->setText( tr( "Out" ) ); 698 TextLabel3->setText( tr( "Out" ) );
699 Layout15b->addWidget( TextLabel3 ); 699 Layout15b->addWidget( TextLabel3 );
700 700
701 InputSlider = new QSlider( -100, 0, 10, 0, QSlider::Vertical, tab_3, (const char *) "InputSlider" ); 701 InputSlider = new QSlider( -100, 0, 10, 0, QSlider::Vertical, tab_3, (const char *) "InputSlider" );
702 // InputSlider->setTickmarks(QSlider::Both); 702 // InputSlider->setTickmarks(QSlider::Both);
703 Layout15->addWidget( InputSlider); 703 Layout15->addWidget( InputSlider);
704 704
705 OutputSlider = new QSlider( -100,0,10,0, QSlider::Vertical,tab_3,(const char *) "OutputSlider" ); 705 OutputSlider = new QSlider( -100,0,10,0, QSlider::Vertical,tab_3,(const char *) "OutputSlider" );
706 // OutputSlider->setTickmarks(QSlider::Both); 706 // OutputSlider->setTickmarks(QSlider::Both);
707 707
708 Layout15b->addWidget( OutputSlider ); 708 Layout15b->addWidget( OutputSlider );
709 709
710 outMuteCheckBox = new QCheckBox ( "mute", tab_3 ); 710 outMuteCheckBox = new QCheckBox ( "mute", tab_3 );
711 Layout15->addWidget( outMuteCheckBox ); 711 Layout15->addWidget( outMuteCheckBox );
712 712
713 inMuteCheckBox = new QCheckBox ( "mute", tab_3 ); 713 inMuteCheckBox = new QCheckBox ( "mute", tab_3 );
714 inMuteCheckBox-> setFocusPolicy ( QWidget::NoFocus ); 714 inMuteCheckBox-> setFocusPolicy ( QWidget::NoFocus );
715 Layout15b->addWidget( inMuteCheckBox ); 715 Layout15b->addWidget( inMuteCheckBox );
716 716
717 717
718 Layout19->addLayout( Layout15 ); 718 Layout19->addLayout( Layout15 );
719 Layout19->addLayout( Layout15b ); 719 Layout19->addLayout( Layout15b );
720 720
721 fillDirectoryCombo(); 721 fillDirectoryCombo();
722 722
723 TabWidget->insertTab( tab_3, tr( "Options" ) ); 723 TabWidget->insertTab( tab_3, tr( "Options" ) );
724 724
725 } 725 }
726 726
727 727
728 ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** 728 ///**********<<<<<<<<<<<<>>>>>>>>>>>>***************
729 729
730 tab_4 = new QWidget( TabWidget, "tab_4" ); 730// tab_4 = new QWidget( TabWidget, "tab_4" );
731 QGridLayout *layout4 = new QGridLayout( tab_4); 731// QGridLayout *layout4 = new QGridLayout( tab_4);
732 layout4->setSpacing( 2); 732// layout4->setSpacing( 2);
733 layout4->setMargin( 2); 733// layout4->setMargin( 2);
734 TabWidget->insertTab( tab_4, tr( "Help")); 734// TabWidget->insertTab( tab_4, tr( "Help"));
735 735
736 ///////////////////////////////////////////// FIXME change to a real helpfile path 736// ///////////////////////////////////////////// FIXME change to a real helpfile path
737 QString url="/index.html"; 737// QString url="/index.html";
738 HelpWindow *help = new HelpWindow( url, ".", tab_4, "opierec_help"); 738// HelpWindow *help = new HelpWindow( url, ".", tab_4, "opierec_help");
739 layout4->addMultiCellWidget( help, 0, 1, 0, 1); 739// layout4->addMultiCellWidget( help, 0, 1, 0, 1);
740 if( !QFile(url).exists()) { 740// if( !QFile(url).exists()) {
741 help->hide(); 741// help->hide();
742 //help->showMaximized(); 742// //help->showMaximized();
743 QLabel *helpLabel; 743// QLabel *helpLabel;
744 helpLabel = new QLabel( tab_4, "TimeLabel" ); 744// helpLabel = new QLabel( tab_4, "TimeLabel" );
745 layout4->addMultiCellWidget( helpLabel, 0, 3, 0, 4 ); 745// layout4->addMultiCellWidget( helpLabel, 0, 3, 0, 4 );
746 helpLabel->setText( "<B>OpieRec</B><br>" 746// helpLabel->setText( "<B>OpieRec</B><br>"
747 "Records files in standard wav format<br>" 747// "Records files in standard wav format<br>"
748 "or a compressed version<br>" 748// "or a compressed version<br>"
749 "For help, please email the author<br>" 749// "For help, please email the author<br>"
750 "<B>OpieRec</B> is copyright&copy; 2002 by" 750// "<B>OpieRec</B> is copyright&copy; 2002 by"
751 " L.J. Potter<br>llornkcor@handhelds.org<BR>" 751// " L.J. Potter<br>llornkcor@handhelds.org<BR>"
752 "and is licensed under the <B>QPL</B>"); 752// "and is licensed under the <B>QPL</B>");
753 } 753// }
754 ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** 754 ///**********<<<<<<<<<<<<>>>>>>>>>>>>***************
755 755
756} 756}
757 757
758void QtRec::initIconView() { 758void QtRec::initIconView() {
759 759
760 ListView1->clear(); 760 ListView1->clear();
761 Config cfg("OpieRec"); 761 Config cfg("OpieRec");
762 cfg.setGroup("Sounds"); 762 cfg.setGroup("Sounds");
763 QString temp; 763 QString temp;
764 QPixmap image0( ( const char** ) image0_data ); 764 QPixmap image0( ( const char** ) image0_data );
765 765
766 766
767 int nFiles = cfg.readNumEntry("NumberofFiles",0); 767 int nFiles = cfg.readNumEntry("NumberofFiles",0);
768 for(int i=1;i<= nFiles;i++) { 768 for(int i=1;i<= nFiles;i++) {
769 769
770 QListViewItem * item; 770 QListViewItem * item;
771 QString fileS, mediaLocation, fileDate, filePath; 771 QString fileS, mediaLocation, fileDate, filePath;
772 772
773// temp.sprintf("%d",i); 773// temp.sprintf("%d",i);
774 temp=cfg.readEntry(temp,""); //reads currentFile 774 temp=cfg.readEntry(temp,""); //reads currentFile
775 filePath = cfg.readEntry(temp,""); //currentFileName 775 filePath = cfg.readEntry(temp,""); //currentFileName
776 776
777 QFileInfo info(filePath); 777 QFileInfo info(filePath);
778 fileDate = info.lastModified().toString(); 778 fileDate = info.lastModified().toString();
779 779
780 fileS = cfg.readEntry( filePath, "0" );// file length in seconds 780 fileS = cfg.readEntry( filePath, "0" );// file length in seconds
781 mediaLocation=getStorage( filePath); 781 mediaLocation=getStorage( filePath);
782 if(info.exists()) { 782 if(info.exists()) {
783 item = new QListViewItem( ListView1, temp, fileS, mediaLocation, fileDate); 783 item = new QListViewItem( ListView1, temp, fileS, mediaLocation, fileDate);
784 item->setPixmap( 0, image0); 784 item->setPixmap( 0, image0);
785 if(currentFileName == filePath) 785 if(currentFileName == filePath)
786 ListView1->setSelected( item, true); 786 ListView1->setSelected( item, true);
787 } 787 }
788 } 788 }
789} 789}
790 790
791void QtRec::initConnections() { 791void QtRec::initConnections() {
792 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 792 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
793 793
794 connect( toBeginningButton, SIGNAL( pressed()), this, SLOT( rewindPressed() )); 794 connect( toBeginningButton, SIGNAL( pressed()), this, SLOT( rewindPressed() ));
795 connect( toBeginningButton, SIGNAL( released()), this, SLOT( rewindReleased() )); 795 connect( toBeginningButton, SIGNAL( released()), this, SLOT( rewindReleased() ));
796 connect( toEndButton, SIGNAL( pressed()), this, SLOT( FastforwardPressed() )); 796 connect( toEndButton, SIGNAL( pressed()), this, SLOT( FastforwardPressed() ));
797 connect( toEndButton, SIGNAL( released()), this, SLOT( FastforwardReleased() )); 797 connect( toEndButton, SIGNAL( released()), this, SLOT( FastforwardReleased() ));
798 connect( deleteSoundButton, SIGNAL(released()), this, SLOT( deleteSound() )); 798 connect( deleteSoundButton, SIGNAL(released()), this, SLOT( deleteSound() ));
799 connect( Stop_PushButton, SIGNAL(released()), this, SLOT( doPlayBtn() )); 799 connect( Stop_PushButton, SIGNAL(released()), this, SLOT( doPlayBtn() ));
800 connect( Rec_PushButton, SIGNAL(released()), this, SLOT( newSound() ) ); 800 connect( Rec_PushButton, SIGNAL(released()), this, SLOT( newSound() ) );
801 connect( TabWidget, SIGNAL( currentChanged( QWidget*)),this, SLOT(thisTab(QWidget*) )); 801 connect( TabWidget, SIGNAL( currentChanged( QWidget*)),this, SLOT(thisTab(QWidget*) ));
@@ -803,249 +803,249 @@ void QtRec::initConnections() {
803 connect( InputSlider, SIGNAL(sliderReleased()), this, SLOT( changedInVolume()) ); 803 connect( InputSlider, SIGNAL(sliderReleased()), this, SLOT( changedInVolume()) );
804 804
805 // connect( OutputSlider, SIGNAL(valueChanged( int)), this, SLOT(changedOutVolume(int)) ); 805 // connect( OutputSlider, SIGNAL(valueChanged( int)), this, SLOT(changedOutVolume(int)) );
806 // connect( InputSlider, SIGNAL(valueChanged( int)), this, SLOT(changedInVolume(int)) ); 806 // connect( InputSlider, SIGNAL(valueChanged( int)), this, SLOT(changedInVolume(int)) );
807 807
808 connect( sampleRateComboBox, SIGNAL(activated( int)), this, SLOT( changesamplerateCombo(int)) ); 808 connect( sampleRateComboBox, SIGNAL(activated( int)), this, SLOT( changesamplerateCombo(int)) );
809 connect( bitRateComboBox, SIGNAL(activated( int)), this, SLOT( changebitrateCombo(int)) ); 809 connect( bitRateComboBox, SIGNAL(activated( int)), this, SLOT( changebitrateCombo(int)) );
810 connect( directoryComboBox, SIGNAL(activated( int)), this, SLOT( changeDirCombo(int)) ); 810 connect( directoryComboBox, SIGNAL(activated( int)), this, SLOT( changeDirCombo(int)) );
811 connect( sizeLimitCombo, SIGNAL(activated( int)), this, SLOT( changeSizeLimitCombo(int)) ); 811 connect( sizeLimitCombo, SIGNAL(activated( int)), this, SLOT( changeSizeLimitCombo(int)) );
812 connect( outMuteCheckBox, SIGNAL(toggled( bool)), this, SLOT( doVolMuting(bool)) ); 812 connect( outMuteCheckBox, SIGNAL(toggled( bool)), this, SLOT( doVolMuting(bool)) );
813 connect( inMuteCheckBox , SIGNAL(toggled( bool)), this, SLOT( doMicMuting(bool)) ); 813 connect( inMuteCheckBox , SIGNAL(toggled( bool)), this, SLOT( doMicMuting(bool)) );
814 connect( ListView1,SIGNAL(doubleClicked( QListViewItem*)),this,SLOT( itClick(QListViewItem*))); 814 connect( ListView1,SIGNAL(doubleClicked( QListViewItem*)),this,SLOT( itClick(QListViewItem*)));
815 connect( ListView1, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 815 connect( ListView1, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
816 this,SLOT( listPressed(int, QListViewItem *, const QPoint&, int)) ); 816 this,SLOT( listPressed(int, QListViewItem *, const QPoint&, int)) );
817 connect( timeSlider, SIGNAL( sliderMoved( int)), this, SLOT( changeTimeSlider(int) )); 817 connect( timeSlider, SIGNAL( sliderMoved( int)), this, SLOT( changeTimeSlider(int) ));
818 connect( timeSlider, SIGNAL( sliderPressed( )), this, SLOT( timeSliderPressed() )); 818 connect( timeSlider, SIGNAL( sliderPressed( )), this, SLOT( timeSliderPressed() ));
819 connect( timeSlider, SIGNAL( sliderReleased( )), this, SLOT( timeSliderReleased() )); 819 connect( timeSlider, SIGNAL( sliderReleased( )), this, SLOT( timeSliderReleased() ));
820 connect( compressionCheckBox, SIGNAL( toggled(bool)),this, SLOT( compressionSelected(bool))); 820 connect( compressionCheckBox, SIGNAL( toggled(bool)),this, SLOT( compressionSelected(bool)));
821 connect( autoMuteCheckBox, SIGNAL( toggled(bool)),this, SLOT( slotAutoMute(bool))); 821 connect( autoMuteCheckBox, SIGNAL( toggled(bool)),this, SLOT( slotAutoMute(bool)));
822} 822}
823 823
824void QtRec::initConfig() { 824void QtRec::initConfig() {
825 int index, fred, i; 825 int index, fred, i;
826 Config cfg("OpieRec"); 826 Config cfg("OpieRec");
827 cfg.setGroup("Settings"); 827 cfg.setGroup("Settings");
828 828
829 index = cfg.readNumEntry("samplerate",22050); 829 index = cfg.readNumEntry("samplerate",22050);
830 bool ok; 830 bool ok;
831 831
832 for(int ws=0;ws<sampleRateComboBox->count();ws++) { 832 for(int ws=0;ws<sampleRateComboBox->count();ws++) {
833 fred = sampleRateComboBox->text(ws).toInt(&ok, 10); 833 fred = sampleRateComboBox->text(ws).toInt(&ok, 10);
834 if(index == fred) { 834 if(index == fred) {
835 filePara.sampleRate = fred; 835 filePara.sampleRate = fred;
836 sampleRateComboBox->setCurrentItem(ws); 836 sampleRateComboBox->setCurrentItem(ws);
837 } 837 }
838 } 838 }
839 839
840 i=cfg.readNumEntry("bitrate",16); 840 i=cfg.readNumEntry("bitrate",16);
841 if(i == 16) 841 if(i == 16)
842 bitRateComboBox->setCurrentItem( 0); 842 bitRateComboBox->setCurrentItem( 0);
843 else 843 else
844 bitRateComboBox->setCurrentItem( 1); 844 bitRateComboBox->setCurrentItem( 1);
845 filePara.resolution = i; 845 filePara.resolution = i;
846 846
847 i=cfg.readNumEntry("sizeLimit", 5 ); 847 i=cfg.readNumEntry("sizeLimit", 5 );
848 QString temp; 848 QString temp;
849// for(int i=1;i<13; i++) { 849// for(int i=1;i<13; i++) {
850// temp = sizeLimitCombo->text(i); 850// temp = sizeLimitCombo->text(i);
851 851
852// sizeLimitCombo->insertItem( QString::number(i*5)+tr(" secs")); 852// sizeLimitCombo->insertItem( QString::number(i*5)+tr(" secs"));
853// } 853// }
854 sizeLimitCombo->setCurrentItem((i/5)); 854 sizeLimitCombo->setCurrentItem((i/5));
855 855
856 compressionCheckBox->setChecked( cfg.readBoolEntry("wavCompression",1)); 856 compressionCheckBox->setChecked( cfg.readBoolEntry("wavCompression",1));
857 if( compressionCheckBox->isChecked()) { 857 if( compressionCheckBox->isChecked()) {
858 bitRateComboBox->setEnabled(false); 858 bitRateComboBox->setEnabled(false);
859 bitRateComboBox->setCurrentItem(0); 859 bitRateComboBox->setCurrentItem(0);
860 filePara.resolution=16; 860 filePara.resolution=16;
861 } 861 }
862 862
863 autoMuteCheckBox->setChecked( cfg.readBoolEntry("useAutoMute",0)); 863 autoMuteCheckBox->setChecked( cfg.readBoolEntry("useAutoMute",0));
864 if( autoMuteCheckBox->isChecked()) 864 if( autoMuteCheckBox->isChecked())
865 slotAutoMute(true); 865 slotAutoMute(true);
866 else 866 else
867 slotAutoMute(false); 867 slotAutoMute(false);
868 868
869 Config cofg( "qpe"); 869 Config cofg( "qpe");
870 cofg.setGroup( "Volume"); 870 cofg.setGroup( "Volume");
871 outMuteCheckBox->setChecked( cofg.readBoolEntry( "Mute",0)); 871 outMuteCheckBox->setChecked( cofg.readBoolEntry( "Mute",0));
872 inMuteCheckBox->setChecked( cofg.readBoolEntry( "MicMute",0)); 872 inMuteCheckBox->setChecked( cofg.readBoolEntry( "MicMute",0));
873} 873}
874 874
875//================ 875//================
876 876
877void QtRec::stop() { 877void QtRec::stop() {
878 qDebug("<<<<<<<<<stop()"); 878 qDebug("<<<<<<<<<stop()");
879 setRecordButton(false); 879 setRecordButton(false);
880 monitoring=false; 880 monitoring=false;
881 stopped=true; 881 stopped=true;
882 882
883 if( !recording) 883 if( !recording)
884 endPlaying(); 884 endPlaying();
885 else 885 else
886 endRecording(); 886 endRecording();
887 timeSlider->setValue(0); 887 timeSlider->setValue(0);
888 // QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << true; // mute device 888 // QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << true; // mute device
889} 889}
890 890
891void QtRec::doPlayBtn() { 891void QtRec::doPlayBtn() {
892 892
893 if(!stopped) { 893 if(!stopped) {
894 playLabel2->setText("Play"); 894 playLabel2->setText("Play");
895 stop(); 895 stop();
896 } else { 896 } else {
897 if(ListView1->currentItem() == 0) return; 897 if(ListView1->currentItem() == 0) return;
898 playLabel2->setText("Stop"); 898 playLabel2->setText("Stop");
899 currentFile = ListView1->currentItem()->text(0); 899 currentFile = ListView1->currentItem()->text(0);
900 start(); 900 start();
901 } 901 }
902} 902}
903 903
904void QtRec::start() { //play 904void QtRec::start() { //play
905 if(stopped) { 905 if(stopped) {
906 qDebug("start::"); 906 qDebug("start::");
907 QPixmap image3( ( const char** ) image3_data ); 907 QPixmap image3( ( const char** ) image3_data );
908 Stop_PushButton->setPixmap( image3 ); 908 Stop_PushButton->setPixmap( image3 );
909 Stop_PushButton->setDown(true); 909 Stop_PushButton->setDown(true);
910 stopped=false; 910 stopped=false;
911 paused=false; 911 paused=false;
912 secCount=1; 912 secCount=1;
913 913
914 if( openPlayFile()) 914 if( openPlayFile())
915 if( setupAudio( false)) //recording is false 915 if( setupAudio( false)) //recording is false
916 doPlay(); 916 doPlay();
917 } 917 }
918} 918}
919 919
920bool QtRec::rec() { //record 920bool QtRec::rec() { //record
921 qDebug("rec()"); 921 qDebug("rec()");
922 if(!stopped) { 922 if(!stopped) {
923 qDebug("rec:: !stopped"); 923 qDebug("rec:: !stopped");
924 monitoring=true; 924 monitoring=true;
925 return false; 925 return false;
926 } else { 926 } else {
927 qDebug("go ahead and record"); 927 qDebug("go ahead and record");
928 secCount=1; 928 secCount=1;
929 playLabel2->setText("Stop"); 929 playLabel2->setText("Stop");
930 monitoring=false; 930 monitoring=false;
931 setRecordButton(true); 931 setRecordButton(true);
932 stopped=false; 932 stopped=false;
933 933
934 if( setupAudio( true)) 934 if( setupAudio( true))
935 if(setUpFile()) { 935 if(setUpFile()) {
936 qDebug("Ok to start recording"); 936 qDebug("Ok to start recording");
937 int fileSize=0; 937 int fileSize=0;
938 Config cfg("OpieRec"); 938 Config cfg("OpieRec");
939 cfg.setGroup("Settings"); 939 cfg.setGroup("Settings");
940 qDebug( "<<<<<<<Device bits %d, device rate %d, device channels %d", 940 qDebug( "<<<<<<<Device bits %d, device rate %d, device channels %d",
941 soundDevice->getDeviceBits(), 941 soundDevice->getDeviceBits(),
942 soundDevice->getDeviceRate(), 942 soundDevice->getDeviceRate(),
943 soundDevice->getDeviceChannels()); 943 soundDevice->getDeviceChannels());
944 944
945 //filePara.sampleRate = cfg.readNumEntry("samplerate", 22050); 945 //filePara.sampleRate = cfg.readNumEntry("samplerate", 22050);
946 qDebug("sample rate is %d", filePara.sampleRate); 946 qDebug("sample rate is %d", filePara.sampleRate);
947 filePara.SecondsToRecord = getCurrentSizeLimit(); 947 filePara.SecondsToRecord = getCurrentSizeLimit();
948 948
949 qDebug("size limit %d sec", filePara.SecondsToRecord); 949 qDebug("size limit %d sec", filePara.SecondsToRecord);
950 int diskSize = checkDiskSpace( (const QString &) wavFile->trackName()); 950 int diskSize = checkDiskSpace( (const QString &) wavFile->trackName());
951 951
952 if( filePara.SecondsToRecord == 0) { 952 if( filePara.SecondsToRecord == 0) {
953 fileSize = diskSize; 953 fileSize = diskSize;
954 } else if( filePara.format==WAVE_FORMAT_PCM) { 954 } else if( filePara.format==WAVE_FORMAT_PCM) {
955 qDebug("WAVE_FORMAT_PCM"); 955 qDebug("WAVE_FORMAT_PCM");
956 fileSize = (filePara.SecondsToRecord ) * filePara.channels 956 fileSize = (filePara.SecondsToRecord ) * filePara.channels
957 * filePara.sampleRate *(filePara.resolution/8)+1000; 957 * filePara.sampleRate *(filePara.resolution/8)+1000;
958 } else { 958 } else {
959 qDebug("WAVE_FORMAT_DVI_ADPCM"); 959 qDebug("WAVE_FORMAT_DVI_ADPCM");
960 fileSize = ((filePara.SecondsToRecord) * filePara.channels 960 fileSize = ((filePara.SecondsToRecord) * filePara.channels
961 * filePara.sampleRate *(filePara.resolution/8) )/4+250; 961 * filePara.sampleRate *(filePara.resolution/8) )/4+250;
962 } 962 }
963 963
964 filePara.samplesToRecord = fileSize; 964 filePara.samplesToRecord = fileSize;
965 qDebug("filesize should be %d, bits %d, rate %d", 965 qDebug("filesize should be %d, bits %d, rate %d",
966 filePara.samplesToRecord, filePara.resolution, filePara.sampleRate); 966 filePara.samplesToRecord, filePara.resolution, filePara.sampleRate);
967 if(paused) { 967 if(paused) {
968 paused = false; 968 paused = false;
969 } 969 }
970 // else { 970 // else {
971 qDebug("Setting timeslider %d", filePara.samplesToRecord); 971 qDebug("Setting timeslider %d", filePara.samplesToRecord);
972 // if(fileSize != 0) 972 // if(fileSize != 0)
973 timeSlider->setRange(0, filePara.samplesToRecord); 973 timeSlider->setRange(0, filePara.samplesToRecord);
974 // } 974 // }
975 975
976 if( diskSize < fileSize/1024) { 976 if( diskSize < fileSize/1024) {
977 QMessageBox::warning(this, 977 QMessageBox::warning(this,
978 tr("Low Disk Space"), 978 tr("Low Disk Space"),
979 tr("You are running low of\nrecording space\n" 979 tr("You are running low of\nrecording space\n"
980 "or a card isn't being recognized")); 980 "or a card isn't being recognized"));
981 stopped = true; //we need to be stopped 981 stopped = true; //we need to be stopped
982 stop(); 982 stop();
983 } else { 983 } else {
984 QString msg; 984 QString msg;
985 msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); 985 msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution);
986#ifdef DEV_VERSION 986#ifdef DEV_VERSION
987 setCaption( msg); 987 setCaption( msg);
988#endif 988#endif
989 filePara.fileName=currentFile.latin1(); 989 filePara.fileName=currentFile.latin1();
990 qDebug("Start recording thread"); 990 qDebug("Start recording thread");
991 991
992 pthread_t thread1; 992 pthread_t thread1;
993 pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/); 993 pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/);
994// quickRec(); 994// quickRec();
995 toBeginningButton->setEnabled(false); 995 toBeginningButton->setEnabled(false);
996 toEndButton->setEnabled(false); 996 toEndButton->setEnabled(false);
997 997
998 startTimer(1000); 998 startTimer(1000);
999 } 999 }
1000 } //end setUpFile 1000 } //end setUpFile
1001 } //end setupAudio 1001 } //end setupAudio
1002 // _exit( 0); 1002 // _exit( 0);
1003 1003
1004 // ///* default: 1004 // ///* default:
1005// // /* pid greater than zero is parent getting the child's pid */ 1005// // /* pid greater than zero is parent getting the child's pid */
1006// /* printf("Child's pid is %d\n",pid); 1006// /* printf("Child's pid is %d\n",pid);
1007// waitpid( pid, &status, 0); 1007// waitpid( pid, &status, 0);
1008// printf("Child[%d] exited with status %d\n", pid, status);*/ 1008// printf("Child[%d] exited with status %d\n", pid, status);*/
1009 // while (wait(NULL) != pid) 1009 // while (wait(NULL) != pid)
1010// ; 1010// ;
1011// printf("child %ld terminated normally, return status is zero\n", (long) pid); 1011// printf("child %ld terminated normally, return status is zero\n", (long) pid);
1012 // endRecording(); 1012 // endRecording();
1013/* else { //device was not opened 1013/* else { //device was not opened
1014 qDebug("Audio device open failed"); 1014 qDebug("Audio device open failed");
1015 return false; 1015 return false;
1016 } 1016 }
1017 }*/ 1017 }*/
1018// } //end fork 1018// } //end fork
1019// } 1019// }
1020// } 1020// }
1021 return true; 1021 return true;
1022} 1022}
1023/* 1023/*
1024 This happens when a tab is selected*/ 1024 This happens when a tab is selected*/
1025void QtRec::thisTab(QWidget* widg) { 1025void QtRec::thisTab(QWidget* widg) {
1026 if(widg != NULL) { 1026 if(widg != NULL) {
1027 int index=TabWidget->currentPageIndex(); 1027 int index=TabWidget->currentPageIndex();
1028 1028
1029 if(index==0) { //file page 1029 if(index==0) { //file page
1030 } 1030 }
1031 1031
1032 if(index ==1) { //control page 1032 if(index ==1) { //control page
1033 fillDirectoryCombo(); 1033 fillDirectoryCombo();
1034// soundDevice->getOutVol(); 1034// soundDevice->getOutVol();
1035// soundDevice->getInVol(); 1035// soundDevice->getInVol();
1036 } 1036 }
1037 1037
1038 if(index==2) { //help page 1038 if(index==2) { //help page
1039 } 1039 }
1040 qApp->processEvents(); 1040 qApp->processEvents();
1041 update(); 1041 update();
1042 } 1042 }
1043} 1043}
1044 1044
1045void QtRec::getOutVol( ) { 1045void QtRec::getOutVol( ) {
1046 filePara.outVol = soundDevice->getOutVolume(); 1046 filePara.outVol = soundDevice->getOutVolume();
1047 qDebug("out vol %d", filePara.outVol); 1047 qDebug("out vol %d", filePara.outVol);
1048 OutputSlider->setValue( -filePara.outVol); 1048 OutputSlider->setValue( -filePara.outVol);
1049} 1049}
1050 1050
1051void QtRec::getInVol() { 1051void QtRec::getInVol() {
@@ -1071,107 +1071,107 @@ bool QtRec::setupAudio( bool b) {
1071 filePara.resolution = bitRateComboBox->currentText().toInt( &ok,10); //16 1071 filePara.resolution = bitRateComboBox->currentText().toInt( &ok,10); //16
1072 1072
1073 if( !b){ // we want to play 1073 if( !b){ // we want to play
1074 qDebug("setting up DSP for playing"); 1074 qDebug("setting up DSP for playing");
1075 if( filePara.resolution == 16 || compressionCheckBox->isChecked() ) { 1075 if( filePara.resolution == 16 || compressionCheckBox->isChecked() ) {
1076 sampleformat = AFMT_S16_LE; 1076 sampleformat = AFMT_S16_LE;
1077 filePara.resolution = 16; 1077 filePara.resolution = 16;
1078 } else { 1078 } else {
1079 sampleformat = AFMT_U8; 1079 sampleformat = AFMT_U8;
1080 filePara.resolution=8; 1080 filePara.resolution=8;
1081 } 1081 }
1082 1082
1083 stereo = filePara.channels = 1; 1083 stereo = filePara.channels = 1;
1084 flags= O_WRONLY; 1084 flags= O_WRONLY;
1085 dspString = DSPSTROUT; 1085 dspString = DSPSTROUT;
1086 mixerString = DSPSTRMIXEROUT; 1086 mixerString = DSPSTRMIXEROUT;
1087 } else { // we want to record 1087 } else { // we want to record
1088 qDebug("setting up DSP for recording"); 1088 qDebug("setting up DSP for recording");
1089 1089
1090 if( !bitRateComboBox->isEnabled() || bitRateComboBox->currentText() == "16") 1090 if( !bitRateComboBox->isEnabled() || bitRateComboBox->currentText() == "16")
1091 sampleformat = AFMT_S16_LE; 1091 sampleformat = AFMT_S16_LE;
1092 else 1092 else
1093 sampleformat = AFMT_U8; 1093 sampleformat = AFMT_U8;
1094 1094
1095 if( !compressionCheckBox->isChecked()) { 1095 if( !compressionCheckBox->isChecked()) {
1096 filePara.format=WAVE_FORMAT_PCM; 1096 filePara.format=WAVE_FORMAT_PCM;
1097 qDebug("WAVE_FORMAT_PCM"); 1097 qDebug("WAVE_FORMAT_PCM");
1098 } else { 1098 } else {
1099 filePara.format=WAVE_FORMAT_DVI_ADPCM; 1099 filePara.format=WAVE_FORMAT_DVI_ADPCM;
1100 sampleformat=AFMT_S16_LE; 1100 sampleformat=AFMT_S16_LE;
1101 qDebug("WAVE_FORMAT_DVI_ADPCM"); 1101 qDebug("WAVE_FORMAT_DVI_ADPCM");
1102 } 1102 }
1103 1103
1104 stereo = filePara.channels = 1; 1104 stereo = filePara.channels = 1;
1105// filePara.sampleRate = sampleRateComboBox->currentText().toInt( &ok,10);//44100; 1105// filePara.sampleRate = sampleRateComboBox->currentText().toInt( &ok,10);//44100;
1106 flags= O_RDWR; 1106 flags= O_RDWR;
1107// flags= O_RDONLY; 1107// flags= O_RDONLY;
1108 dspString = DSPSTRIN; 1108 dspString = DSPSTRIN;
1109 mixerString = DSPSTRMIXEROUT; 1109 mixerString = DSPSTRMIXEROUT;
1110 } 1110 }
1111 1111
1112 // if(soundDevice) delete soundDevice; 1112 // if(soundDevice) delete soundDevice;
1113 qDebug("<<<<<<<<<<<<<<<<<<<open dsp %d %d %d", filePara.sampleRate, filePara.channels, sampleformat); 1113 qDebug("<<<<<<<<<<<<<<<<<<<open dsp %d %d %d", filePara.sampleRate, filePara.channels, sampleformat);
1114 soundDevice = new Device( this, dspString, mixerString, b); 1114 soundDevice = new Device( this, dspString, mixerString, b);
1115// soundDevice->openDsp(); 1115// soundDevice->openDsp();
1116 soundDevice->reset(); 1116 soundDevice->reset();
1117 1117
1118 qDebug("device has been made %d", soundDevice->sd); 1118 qDebug("device has been made %d", soundDevice->sd);
1119 1119
1120 ////////////////// <<<<<<<<<<<<>>>>>>>>>>>> 1120 ////////////////// <<<<<<<<<<<<>>>>>>>>>>>>
1121 soundDevice->setDeviceFormat( sampleformat); 1121 soundDevice->setDeviceFormat( sampleformat);
1122 soundDevice->setDeviceChannels( filePara.channels); 1122 soundDevice->setDeviceChannels( filePara.channels);
1123 soundDevice->setDeviceRate( filePara.sampleRate); 1123 soundDevice->setDeviceRate( filePara.sampleRate);
1124 soundDevice->getDeviceFragSize(); 1124 soundDevice->getDeviceFragSize();
1125#ifdef QT_QWS_EBX 1125#ifdef QT_QWS_EBX
1126 int frag = FRAGSIZE; 1126 int frag = FRAGSIZE;
1127 soundDevice->setFragSize( frag); 1127 soundDevice->setFragSize( frag);
1128 soundDevice->getDeviceFragSize(); 1128 soundDevice->getDeviceFragSize();
1129#endif 1129#endif
1130 ///////////////// 1130 /////////////////
1131 filePara.sd = soundDevice->sd; 1131 filePara.sd = soundDevice->sd;
1132 1132
1133 if ( filePara.sd == -1) { 1133 if ( filePara.sd == -1) {
1134 1134
1135 monitoring=false; 1135 monitoring=false;
1136 stopped=true; 1136 stopped=true;
1137 update(); 1137 update();
1138 setCaption( tr( "OpieRecord " ) + QString::number(VERSION) ); 1138 setCaption( tr( "OpieRecord " ) + QString::number(VERSION) );
1139 stopped=true; 1139 stopped=true;
1140 return false; 1140 return false;
1141 } 1141 }
1142 if(autoMute) 1142 if(autoMute)
1143 doMute(false); 1143 doMute(false);
1144 1144
1145 return true; 1145 return true;
1146} 1146}
1147 1147
1148 1148
1149bool QtRec::setUpFile() { //setup file for recording 1149bool QtRec::setUpFile() { //setup file for recording
1150 qDebug("Setting up wavfile"); 1150 qDebug("Setting up wavfile");
1151// if(wavFile) delete wavFile; 1151// if(wavFile) delete wavFile;
1152 wavFile = new WavFile( this, (const QString &)"", 1152 wavFile = new WavFile( this, (const QString &)"",
1153 true, 1153 true,
1154 filePara.sampleRate, 1154 filePara.sampleRate,
1155 filePara.channels, 1155 filePara.channels,
1156 filePara.resolution, 1156 filePara.resolution,
1157 filePara.format); 1157 filePara.format);
1158 1158
1159 filePara.fd = wavFile->wavHandle(); 1159 filePara.fd = wavFile->wavHandle();
1160 if(filePara.fd == -1) { 1160 if(filePara.fd == -1) {
1161 return false; 1161 return false;
1162 } else { 1162 } else {
1163 filePara.channels=1; 1163 filePara.channels=1;
1164 } 1164 }
1165 return true; 1165 return true;
1166} 1166}
1167 1167
1168/// <<<<<<<<<<<<<<<< PLAY >>>>>>>>>>>>>>>>>>> 1168/// <<<<<<<<<<<<<<<< PLAY >>>>>>>>>>>>>>>>>>>
1169bool QtRec::doPlay() { 1169bool QtRec::doPlay() {
1170 1170
1171// pthread_t thread2; 1171// pthread_t thread2;
1172// pthread_create( &thread2, NULL, (void * (*)(void *))playIt, NULL/* &*/); 1172// pthread_create( &thread2, NULL, (void * (*)(void *))playIt, NULL/* &*/);
1173 1173
1174 // qDebug("doPlay file %d", filePara.fd); 1174 // qDebug("doPlay file %d", filePara.fd);
1175 int bytesWritten, number; 1175 int bytesWritten, number;
1176 recording = false; 1176 recording = false;
1177// int number=0; 1177// int number=0;
@@ -1306,101 +1306,101 @@ bool QtRec::doPlay() {
1306 1306
1307 timeSlider->setValue( total); 1307 timeSlider->setValue( total);
1308 1308
1309 filePara.numberOfRecordedSeconds=(float)total/(float)filePara.sampleRate; 1309 filePara.numberOfRecordedSeconds=(float)total/(float)filePara.sampleRate;
1310 timeString.sprintf("%.2f",filePara.numberOfRecordedSeconds); 1310 timeString.sprintf("%.2f",filePara.numberOfRecordedSeconds);
1311 timeLabel->setText( timeString + tr(" seconds")); 1311 timeLabel->setText( timeString + tr(" seconds"));
1312 qApp->processEvents(); 1312 qApp->processEvents();
1313 1313
1314 if( bytesWritten <= 0 && secCount > filePara.numberOfRecordedSeconds ) { 1314 if( bytesWritten <= 0 && secCount > filePara.numberOfRecordedSeconds ) {
1315 stopped = true; 1315 stopped = true;
1316 endPlaying(); 1316 endPlaying();
1317 } 1317 }
1318 // printf("Writing number %d, bytes %d, total %d, numberSamples %d\r",number, bytesWritten , total, filePara.numberSamples); 1318 // printf("Writing number %d, bytes %d, total %d, numberSamples %d\r",number, bytesWritten , total, filePara.numberSamples);
1319 // fflush(stdout); 1319 // fflush(stdout);
1320 } 1320 }
1321 } 1321 }
1322 1322
1323// qDebug("\nstopped or paused %d", total/4); 1323// qDebug("\nstopped or paused %d", total/4);
1324 if(!paused && !stopped) { 1324 if(!paused && !stopped) {
1325 stopped = true; 1325 stopped = true;
1326// endPlaying(); 1326// endPlaying();
1327 endPlaying(); 1327 endPlaying();
1328 } 1328 }
1329 return true; 1329 return true;
1330} 1330}
1331 1331
1332 1332
1333void QtRec::changebitrateCombo(int i) { 1333void QtRec::changebitrateCombo(int i) {
1334 Config cfg("OpieRec"); 1334 Config cfg("OpieRec");
1335 cfg.setGroup("Settings"); 1335 cfg.setGroup("Settings");
1336 int bits=0; 1336 int bits=0;
1337 if(i==0) { bits=16; } 1337 if(i==0) { bits=16; }
1338 else { bits=8; } 1338 else { bits=8; }
1339 cfg.writeEntry("bitrate", bits); 1339 cfg.writeEntry("bitrate", bits);
1340 filePara.resolution=bits; 1340 filePara.resolution=bits;
1341 cfg.write(); 1341 cfg.write();
1342} 1342}
1343 1343
1344void QtRec::changesamplerateCombo(int i) { 1344void QtRec::changesamplerateCombo(int i) {
1345 Config cfg("OpieRec"); 1345 Config cfg("OpieRec");
1346 cfg.setGroup("Settings"); 1346 cfg.setGroup("Settings");
1347 int rate=0; 1347 int rate=0;
1348 bool ok; 1348 bool ok;
1349 rate = sampleRateComboBox->text(i).toInt(&ok, 10); 1349 rate = sampleRateComboBox->text(i).toInt(&ok, 10);
1350 cfg.writeEntry("samplerate",rate); 1350 cfg.writeEntry("samplerate",rate);
1351 filePara.sampleRate=rate; 1351 filePara.sampleRate=rate;
1352/* soundDevice = new Device( this, DSPSTROUT, DSPSTRMIXER, false); 1352/* soundDevice = new Device( this, DSPSTROUT, DSPSTRMIXER, false);
1353 soundDevice->openDsp();*/ 1353 soundDevice->openDsp();*/
1354// 1354//
1355// soundDevice->setDeviceFormat(AFMT_S16_LE); 1355// soundDevice->setDeviceFormat(AFMT_S16_LE);
1356// soundDevice->setDeviceChannels(filePara.channels); 1356// soundDevice->setDeviceChannels(filePara.channels);
1357// soundDevice->setDeviceRate(filePara.sampleRate); 1357// soundDevice->setDeviceRate(filePara.sampleRate);
1358// 1358//
1359// soundDevice->closeDevice( true); 1359// soundDevice->closeDevice( true);
1360// soundDevice=0; 1360// soundDevice=0;
1361// delete soundDevice; 1361// delete soundDevice;
1362 qDebug("Change sample rate %d", rate); 1362 qDebug("Change sample rate %d", rate);
1363 cfg.write(); 1363 cfg.write();
1364 1364
1365} 1365}
1366 1366
1367 1367
1368void QtRec::changeDirCombo(int index) { 1368void QtRec::changeDirCombo(int index) {
1369 Config cfg("OpieRec"); 1369 Config cfg("OpieRec");
1370 cfg.setGroup("Settings"); 1370 cfg.setGroup("Settings");
1371 QString sName = directoryComboBox->text(index); 1371 QString sName = directoryComboBox->text(index);
1372 1372
1373 StorageInfo storageInfo; 1373 StorageInfo storageInfo;
1374 const QList<FileSystem> &fs = storageInfo.fileSystems(); 1374 const QList<FileSystem> &fs = storageInfo.fileSystems();
1375 QListIterator<FileSystem> it ( fs ); 1375 QListIterator<FileSystem> it ( fs );
1376 QString storage; 1376 QString storage;
1377 for( ; it.current(); ++it ){ 1377 for( ; it.current(); ++it ){
1378 if( sName == (*it)->name()+" "+ (*it)->path() || 1378 if( sName == (*it)->name()+" "+ (*it)->path() ||
1379 (*it)->name() == sName ) { 1379 (*it)->name() == sName ) {
1380 const QString path = (*it)->path(); 1380 const QString path = (*it)->path();
1381 recDir = path; 1381 recDir = path;
1382 cfg.writeEntry("directory", recDir); 1382 cfg.writeEntry("directory", recDir);
1383 qDebug("new rec dir "+recDir); 1383 qDebug("new rec dir "+recDir);
1384 } 1384 }
1385 } 1385 }
1386 cfg.write(); 1386 cfg.write();
1387} 1387}
1388 1388
1389 1389
1390void QtRec::changeSizeLimitCombo(int) { 1390void QtRec::changeSizeLimitCombo(int) {
1391 Config cfg("OpieRec"); 1391 Config cfg("OpieRec");
1392 cfg.setGroup("Settings"); 1392 cfg.setGroup("Settings");
1393 cfg.writeEntry("sizeLimit", getCurrentSizeLimit() ); 1393 cfg.writeEntry("sizeLimit", getCurrentSizeLimit() );
1394 cfg.write(); 1394 cfg.write();
1395} 1395}
1396 1396
1397void QtRec::newSound() { 1397void QtRec::newSound() {
1398 qDebug("<<<<<<<<<new sound"); 1398 qDebug("<<<<<<<<<new sound");
1399 1399
1400 if( !rec()) { 1400 if( !rec()) {
1401 qDebug("rec() failed"); 1401 qDebug("rec() failed");
1402 endRecording(); 1402 endRecording();
1403 deleteSound(); 1403 deleteSound();
1404 } 1404 }
1405 1405
1406} 1406}
@@ -1944,97 +1944,97 @@ void QtRec::compressionSelected(bool b) {
1944 filePara.resolution=16; 1944 filePara.resolution=16;
1945 } else{ 1945 } else{
1946 bitRateComboBox->setEnabled(true); 1946 bitRateComboBox->setEnabled(true);
1947 } 1947 }
1948} 1948}
1949 1949
1950long QtRec::checkDiskSpace(const QString &path) { 1950long QtRec::checkDiskSpace(const QString &path) {
1951 1951
1952 struct statfs fs; 1952 struct statfs fs;
1953 1953
1954 if ( !statfs( path.latin1(), &fs ) ) { 1954 if ( !statfs( path.latin1(), &fs ) ) {
1955 1955
1956 int blkSize = fs.f_bsize; 1956 int blkSize = fs.f_bsize;
1957 int availBlks = fs.f_bavail; 1957 int availBlks = fs.f_bavail;
1958 1958
1959 long mult = blkSize / 1024; 1959 long mult = blkSize / 1024;
1960 long div = 1024 / blkSize; 1960 long div = 1024 / blkSize;
1961 1961
1962 if ( !mult ) mult = 1; 1962 if ( !mult ) mult = 1;
1963 if ( !div ) div = 1; 1963 if ( !div ) div = 1;
1964 1964
1965 return availBlks * mult / div; 1965 return availBlks * mult / div;
1966 } 1966 }
1967 return -1; 1967 return -1;
1968} 1968}
1969 1969
1970// short f_fstyp; /* File system type */ 1970// short f_fstyp; /* File system type */
1971// long f_bsize; /* Block size */ 1971// long f_bsize; /* Block size */
1972// long f_frsize; /* Fragment size */ 1972// long f_frsize; /* Fragment size */
1973// long f_blocks; /* Total number of blocks*/ 1973// long f_blocks; /* Total number of blocks*/
1974// long f_bfree; /* Count of free blocks */ 1974// long f_bfree; /* Count of free blocks */
1975// long f_files; /* Total number of file nodes */ 1975// long f_files; /* Total number of file nodes */
1976// long f_ffree; /* Count of free file nodes */ 1976// long f_ffree; /* Count of free file nodes */
1977// char f_fname[6]; /* Volumename */ 1977// char f_fname[6]; /* Volumename */
1978// char f_fpack[6]; /* Pack name */ 1978// char f_fpack[6]; /* Pack name */
1979 1979
1980void QtRec::receive( const QCString &msg, const QByteArray & ) { 1980void QtRec::receive( const QCString &msg, const QByteArray & ) {
1981 qDebug("Voicerecord received message "+msg); 1981 qDebug("Voicerecord received message "+msg);
1982 1982
1983} 1983}
1984 1984
1985 1985
1986///////////////////////////// timerEvent 1986///////////////////////////// timerEvent
1987void QtRec::timerEvent( QTimerEvent *e ) { 1987void QtRec::timerEvent( QTimerEvent *e ) {
1988// qDebug( "%d", secCount ); 1988// qDebug( "%d", secCount );
1989#ifdef DEV_VERSION 1989#ifdef DEV_VERSION
1990 QString msg; 1990 QString msg;
1991 msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); 1991 msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution);
1992 setCaption( msg +" :: "+QString::number(secCount)); 1992 setCaption( msg +" :: "+QString::number(secCount));
1993#endif 1993#endif
1994 1994
1995 if( !playing ) { 1995 if( !playing ) {
1996 if(!recording ){ 1996 if(!recording ){
1997 killTimer(e->timerId()); 1997 killTimer(e->timerId());
1998///* stopped=true; 1998///* stopped=true;
1999// recording=false; 1999// recording=false;
2000///*/ 2000///*/
2001// _exit( 0); 2001// _exit( 0);
2002 } 2002 }
2003 if(filePara.SecondsToRecord < secCount && filePara.SecondsToRecord !=0) { 2003 if(filePara.SecondsToRecord < secCount && filePara.SecondsToRecord !=0) {
2004 killTimer(e->timerId()); 2004 killTimer(e->timerId());
2005 stop(); 2005 stop();
2006 } 2006 }
2007 } 2007 }
2008// if( stopped && !paused) { 2008// if( stopped && !paused) {
2009// if( filePara.numberOfRecordedSeconds < secCount) { 2009// if( filePara.numberOfRecordedSeconds < secCount) {
2010// stopped = true; 2010// stopped = true;
2011// // playing=false; 2011// // playing=false;
2012// killTimer(e->timerId()); 2012// killTimer(e->timerId());
2013// endPlaying(); 2013// endPlaying();
2014// } 2014// }
2015// } 2015// }
2016// qApp->processEvents(); 2016// qApp->processEvents();
2017 secCount++; 2017 secCount++;
2018} 2018}
2019 2019
2020void QtRec::changeTimeSlider(int index) { 2020void QtRec::changeTimeSlider(int index) {
2021 if(ListView1->currentItem() == 0 || !wavFile->track.isOpen()) return; 2021 if(ListView1->currentItem() == 0 || !wavFile->track.isOpen()) return;
2022 // qDebug("Slider moved to %d",index); 2022 // qDebug("Slider moved to %d",index);
2023 paused = true; 2023 paused = true;
2024 stopped = true; 2024 stopped = true;
2025 2025
2026 sliderPos=index; 2026 sliderPos=index;
2027 2027
2028 QString timeString; 2028 QString timeString;
2029 filePara.numberOfRecordedSeconds=(float)sliderPos/(float)filePara.sampleRate*(float)2; 2029 filePara.numberOfRecordedSeconds=(float)sliderPos/(float)filePara.sampleRate*(float)2;
2030 timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds); 2030 timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds);
2031 secCount = (int)filePara.numberOfRecordedSeconds; 2031 secCount = (int)filePara.numberOfRecordedSeconds;
2032 timeLabel->setText( timeString+ tr(" seconds")); 2032 timeLabel->setText( timeString+ tr(" seconds"));
2033} 2033}
2034 2034
2035void QtRec::timeSliderPressed() { 2035void QtRec::timeSliderPressed() {
2036 if(ListView1->currentItem() == 0) return; 2036 if(ListView1->currentItem() == 0) return;
2037 // qDebug("slider pressed"); 2037 // qDebug("slider pressed");
2038 paused = true; 2038 paused = true;
2039 stopped = true; 2039 stopped = true;
2040} 2040}
@@ -2213,58 +2213,58 @@ void QtRec::fillDirectoryCombo() {
2213 2213
2214void QtRec::errorStop() { 2214void QtRec::errorStop() {
2215 stopped = true; 2215 stopped = true;
2216 wavFile->closeFile(); 2216 wavFile->closeFile();
2217 killTimers(); 2217 killTimers();
2218} 2218}
2219 2219
2220void QtRec::doMute(bool b) { 2220void QtRec::doMute(bool b) {
2221 doVolMuting( b); 2221 doVolMuting( b);
2222 doMicMuting( b); 2222 doMicMuting( b);
2223} 2223}
2224 2224
2225void QtRec::slotAutoMute(bool b) { 2225void QtRec::slotAutoMute(bool b) {
2226 autoMute=b; 2226 autoMute=b;
2227 Config cfg("OpieRec"); 2227 Config cfg("OpieRec");
2228 cfg.setGroup("Settings"); 2228 cfg.setGroup("Settings");
2229 cfg.writeEntry("useAutoMute",b); 2229 cfg.writeEntry("useAutoMute",b);
2230 doMute(b); 2230 doMute(b);
2231 outMuteCheckBox->setChecked( b); 2231 outMuteCheckBox->setChecked( b);
2232 inMuteCheckBox->setChecked( b); 2232 inMuteCheckBox->setChecked( b);
2233} 2233}
2234 2234
2235void QtRec::selectItemByName(const QString & name) { 2235void QtRec::selectItemByName(const QString & name) {
2236 QListViewItemIterator it( ListView1 ); 2236 QListViewItemIterator it( ListView1 );
2237 for ( ; it.current(); ++it ) 2237 for ( ; it.current(); ++it )
2238 if(name == it.current()->text(0)) 2238 if(name == it.current()->text(0))
2239 ListView1->setCurrentItem(it.current()); 2239 ListView1->setCurrentItem(it.current());
2240} 2240}
2241 2241
2242 2242
2243long findPeak(long input ) { 2243long findPeak(long input ) {
2244 2244
2245// halfLife = time in seconds for output to decay to half value after an impulse 2245// halfLife = time in seconds for output to decay to half value after an impulse
2246 static float output = 0.0; 2246 static float output = 0.0;
2247 int halfLife = .25; 2247 int halfLife = .25;
2248 float vsf = .0025; 2248 float vsf = .0025;
2249 float scalar = pow( 0.5, 1.0/(halfLife * filePara.sampleRate )); 2249 float scalar = pow( 0.5, 1.0/(halfLife * filePara.sampleRate ));
2250 if( input < 0.0 ) 2250 if( input < 0.0 )
2251 input = -input; // Absolute value. 2251 input = -input; // Absolute value.
2252 if ( input >= output ) 2252 if ( input >= output )
2253 { 2253 {
2254 // When we hit a peak, ride the peak to the top. 2254 // When we hit a peak, ride the peak to the top.
2255 output = input; 2255 output = input;
2256 } 2256 }
2257 else 2257 else
2258 { 2258 {
2259// Exponential decay of output when signal is low. 2259// Exponential decay of output when signal is low.
2260 output = output * scalar; 2260 output = output * scalar;
2261// 2261//
2262// When current gets close to 0.0, set current to 0.0 to prevent FP underflow 2262// When current gets close to 0.0, set current to 0.0 to prevent FP underflow
2263// which can cause a severe performance degradation due to a flood 2263// which can cause a severe performance degradation due to a flood
2264// of interrupts. 2264// of interrupts.
2265// 2265//
2266 if( output < vsf ) output = 0.0; 2266 if( output < vsf ) output = 0.0;
2267 } 2267 }
2268 2268
2269 return output; 2269 return output;
2270} 2270}