-rw-r--r-- | noncore/multimedia/opierec/qtrec.cpp | 137 | ||||
-rw-r--r-- | noncore/multimedia/opierec/qtrec.h | 2 |
2 files changed, 72 insertions, 67 deletions
diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp index 3b8cb0d..fb2d819 100644 --- a/noncore/multimedia/opierec/qtrec.cpp +++ b/noncore/multimedia/opierec/qtrec.cpp | |||
@@ -73,8 +73,8 @@ static int deviceBitRates[] = { 8, 16, -1 }; | |||
73 | 73 | ||
74 | #else | 74 | #else |
75 | 75 | ||
76 | #define DSPSTROUT "/dev/dsp" | 76 | #define DSPSTROUT "/dev/dsp1" |
77 | #define DSPSTRIN "/dev/dsp" | 77 | #define DSPSTRIN "/dev/dsp1" |
78 | #define DSPSTRMIXERIN "/dev/mixer" | 78 | #define DSPSTRMIXERIN "/dev/mixer" |
79 | #define DSPSTRMIXEROUT "/dev/mixer" | 79 | #define DSPSTRMIXEROUT "/dev/mixer" |
80 | 80 | ||
@@ -133,18 +133,18 @@ void quickRec() | |||
133 | QString num; | 133 | QString num; |
134 | int level = 0; | 134 | int level = 0; |
135 | int threshold = 0; | 135 | int threshold = 0; |
136 | // int bits = filePara.resolution; | 136 | int bits = filePara.resolution; |
137 | // odebug << "bits " << bits << "" << oendl; | 137 | odebug << "bits " << bits << "" << oendl; |
138 | 138 | ||
139 | if( filePara.resolution == 16 ) { //AFMT_S16_LE) | 139 | if( filePara.resolution == 16 ) { //AFMT_S16_LE) |
140 | // odebug << "AFMT_S16_LE size " << filePara.SecondsToRecord << "" << oendl; | 140 | odebug << "AFMT_S16_LE size " << filePara.SecondsToRecord << "" << oendl; |
141 | // odebug << "samples to record " << filePara.samplesToRecord << "" << oendl; | 141 | odebug << "samples to record " << filePara.samplesToRecord << "" << oendl; |
142 | // odebug << "" << filePara.sd << "" << oendl; | 142 | odebug << "" << filePara.sd << "" << oendl; |
143 | level = 7; | 143 | level = 7; |
144 | threshold = 0; | 144 | threshold = 0; |
145 | 145 | ||
146 | if( filePara.format == WAVE_FORMAT_DVI_ADPCM) { | 146 | if( filePara.format == WAVE_FORMAT_DVI_ADPCM) { |
147 | // odebug << "start recording WAVE_FORMAT_DVI_ADPCM" << oendl; | 147 | odebug << "start recording WAVE_FORMAT_DVI_ADPCM" << oendl; |
148 | // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_DVI_ADPCM >>>>>>>>>>>>>>>>>>>>>> | 148 | // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_DVI_ADPCM >>>>>>>>>>>>>>>>>>>>>> |
149 | char abuf[ BUFSIZE/2 ]; | 149 | char abuf[ BUFSIZE/2 ]; |
150 | short sbuf[ BUFSIZE ]; | 150 | short sbuf[ BUFSIZE ]; |
@@ -155,7 +155,7 @@ void quickRec() | |||
155 | 155 | ||
156 | for(;;) { | 156 | for(;;) { |
157 | if ( stopped) { | 157 | if ( stopped) { |
158 | // odebug << "quickRec:: stopped" << oendl; | 158 | odebug << "quickRec:: stopped" << oendl; |
159 | break; | 159 | break; |
160 | } | 160 | } |
161 | 161 | ||
@@ -180,8 +180,10 @@ void quickRec() | |||
180 | filePara.numberSamples = total; | 180 | filePara.numberSamples = total; |
181 | timeSlider->setValue( total); | 181 | timeSlider->setValue( total); |
182 | 182 | ||
183 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2 | 183 | printf("%d, bytes %d,total %d\r",number, bytesWritten, total); |
184 | / filePara.channels; | 184 | fflush(stdout); |
185 | |||
186 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2/ filePara.channels; | ||
185 | 187 | ||
186 | qApp->processEvents(); | 188 | qApp->processEvents(); |
187 | if( total >= filePara.samplesToRecord) { | 189 | if( total >= filePara.samplesToRecord) { |
@@ -204,7 +206,7 @@ void quickRec() | |||
204 | return; | 206 | return; |
205 | } | 207 | } |
206 | 208 | ||
207 | number = soundDevice->devRead( filePara.sd, (short *)inbuffer, BUFSIZE); | 209 | number = soundDevice->devRead( soundDevice->sd /*filePara.sd*/, (short *)inbuffer, BUFSIZE); |
208 | 210 | ||
209 | if( number <= 0) { | 211 | if( number <= 0) { |
210 | perror( "recording error "); | 212 | perror( "recording error "); |
@@ -228,8 +230,8 @@ void quickRec() | |||
228 | 230 | ||
229 | if( filePara.SecondsToRecord != 0) | 231 | if( filePara.SecondsToRecord != 0) |
230 | timeSlider->setValue( total); | 232 | timeSlider->setValue( total); |
231 | // printf("Writing number %d, bytes %d,total %d\r",number, bytesWritten , total); | 233 | printf("%d, bytes %d,total %d\r",number, bytesWritten , total); |
232 | // fflush(stdout); | 234 | fflush(stdout); |
233 | 235 | ||
234 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate | 236 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate |
235 | / (float)2/filePara.channels; | 237 | / (float)2/filePara.channels; |
@@ -254,7 +256,7 @@ void quickRec() | |||
254 | break; // stop if playing was set to false | 256 | break; // stop if playing was set to false |
255 | } | 257 | } |
256 | 258 | ||
257 | number = ::read( filePara.sd, unsigned_inbuffer, BUFSIZE); | 259 | number = ::read( soundDevice->sd /*filePara.sd*/ , unsigned_inbuffer, BUFSIZE); |
258 | bytesWritten = ::write( filePara.fd , unsigned_inbuffer, number); | 260 | bytesWritten = ::write( filePara.fd , unsigned_inbuffer, number); |
259 | waveform->newSamples( (const short *) unsigned_inbuffer, number ); | 261 | waveform->newSamples( (const short *) unsigned_inbuffer, number ); |
260 | 262 | ||
@@ -267,7 +269,7 @@ void quickRec() | |||
267 | 269 | ||
268 | total += bytesWritten; | 270 | total += bytesWritten; |
269 | filePara.numberSamples = total; | 271 | filePara.numberSamples = total; |
270 | // printf("\nWriting number %d, bytes %d,total %d \r",number, bytesWritten , total); | 272 | // printf("%d, bytes %d,total %d \r",number, bytesWritten , total); |
271 | // fflush(stdout); | 273 | // fflush(stdout); |
272 | if( filePara.SecondsToRecord !=0) | 274 | if( filePara.SecondsToRecord !=0) |
273 | timeSlider->setValue( total); | 275 | timeSlider->setValue( total); |
@@ -497,7 +499,7 @@ void QtRec::init() { | |||
497 | layout->setMargin( 2); | 499 | layout->setMargin( 2); |
498 | 500 | ||
499 | TabWidget = new QTabWidget( this, "TabWidget" ); | 501 | TabWidget = new QTabWidget( this, "TabWidget" ); |
500 | layout->addMultiCellWidget(TabWidget, 0, 7, 0, 7); | 502 | layout->addMultiCellWidget(TabWidget, 0, 7, 0, 8); |
501 | // TabWidget->setTabShape(QTabWidget::Triangular); | 503 | // TabWidget->setTabShape(QTabWidget::Triangular); |
502 | 504 | ||
503 | ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** | 505 | ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** |
@@ -510,13 +512,13 @@ void QtRec::init() { | |||
510 | timeSlider = new QSlider( 0,100,10,0, QSlider::Horizontal, tab, (const char *) "timeSlider" ); | 512 | timeSlider = new QSlider( 0,100,10,0, QSlider::Horizontal, tab, (const char *) "timeSlider" ); |
511 | layout1->addMultiCellWidget( timeSlider, 1, 1, 0, 3); | 513 | layout1->addMultiCellWidget( timeSlider, 1, 1, 0, 3); |
512 | 514 | ||
513 | timeLabel = new QLabel( tab, "TimeLabel" ); | 515 | // timeLabel = new QLabel( tab, "TimeLabel" ); |
514 | layout1->addMultiCellWidget( timeLabel, 0, 0, 0, 3); | 516 | // layout1->addMultiCellWidget( timeLabel, 0, 0, 0, 3); |
515 | 517 | ||
516 | playLabel2 = new QLabel(tab, "PlayLabel2" ); | 518 | // playLabel2 = new QLabel(tab, "PlayLabel2" ); |
517 | playLabel2->setText(tr("Play") ); | 519 | // playLabel2->setText(tr("Play") ); |
518 | playLabel2->setFixedHeight( 18); | 520 | // playLabel2->setFixedHeight( 18); |
519 | layout1->addMultiCellWidget( playLabel2, 0, 0, 4, 4); | 521 | // layout1->addMultiCellWidget( playLabel2, 0, 0, 4, 4); |
520 | 522 | ||
521 | Stop_PushButton = new QPushButton( tab, "Stop_PushButton" ); | 523 | Stop_PushButton = new QPushButton( tab, "Stop_PushButton" ); |
522 | layout1->addMultiCellWidget( Stop_PushButton, 1, 1, 4, 4); | 524 | layout1->addMultiCellWidget( Stop_PushButton, 1, 1, 4, 4); |
@@ -533,11 +535,11 @@ void QtRec::init() { | |||
533 | toEndButton->setFixedSize( 22, 22); | 535 | toEndButton->setFixedSize( 22, 22); |
534 | toEndButton->setPixmap( Resource::loadPixmap( "fastforward" ) ); | 536 | toEndButton->setPixmap( Resource::loadPixmap( "fastforward" ) ); |
535 | 537 | ||
536 | QLabel *recLabel2; | 538 | // QLabel *recLabel2; |
537 | recLabel2 = new QLabel( tab, "recLabel2" ); | 539 | // recLabel2 = new QLabel( tab, "recLabel2" ); |
538 | recLabel2->setText(tr("Rec")); | 540 | // recLabel2->setText(tr("Rec")); |
539 | recLabel2->setFixedHeight( 18); | 541 | // recLabel2->setFixedHeight( 18); |
540 | layout1->addMultiCellWidget( recLabel2, 0, 0, 7, 7); | 542 | // layout1->addMultiCellWidget( recLabel2, 0, 0, 7, 7); |
541 | 543 | ||
542 | Rec_PushButton = new QPushButton( tab, "Rec_PushButton" ); | 544 | Rec_PushButton = new QPushButton( tab, "Rec_PushButton" ); |
543 | layout1->addMultiCellWidget( Rec_PushButton, 1, 1, 7, 7); | 545 | layout1->addMultiCellWidget( Rec_PushButton, 1, 1, 7, 7); |
@@ -557,25 +559,27 @@ void QtRec::init() { | |||
557 | 559 | ||
558 | deleteSoundButton = new QPushButton( tab, "deleteSoundButton" ); | 560 | deleteSoundButton = new QPushButton( tab, "deleteSoundButton" ); |
559 | layout1->addMultiCellWidget( deleteSoundButton, 1, 1, 8, 8); | 561 | layout1->addMultiCellWidget( deleteSoundButton, 1, 1, 8, 8); |
560 | deleteSoundButton->setText( tr( "Delete" ) ); | 562 | deleteSoundButton->setText( tr( "Del" ) ); |
561 | 563 | ||
562 | ListView1 = new QListView( tab, "IconView1" ); | 564 | ListView1 = new QListView( tab, "IconView1" ); |
563 | layout1->addMultiCellWidget( ListView1, 2, 2, 0, 8); | 565 | layout1->addMultiCellWidget( ListView1, 2, 2, 0, 8); |
564 | 566 | ||
565 | ListView1->addColumn( tr( "Name" ) ); | 567 | ListView1->addColumn( tr( "Name" ) ); |
566 | ListView1->setColumnWidth( 0, 140); | 568 | // ListView1->setColumnWidth( 0, 140); |
567 | ListView1->setSorting( 1, false); | 569 | ListView1->setSorting( 1, false); |
568 | ListView1->addColumn( tr( "Time" ) ); //in seconds | 570 | ListView1->addColumn( tr( "Time" ) ); //in seconds |
569 | ListView1->setColumnWidth( 1, 50); | 571 | // ListView1->setColumnWidth( 1, -1); |
570 | ListView1->addColumn( tr("Location") ); | 572 | // ListView1->addColumn( tr("Location") ); |
571 | ListView1->setColumnWidth( 2, 50); | 573 | // ListView1->setColumnWidth( 2, -1); |
572 | ListView1->addColumn( tr("Date") ); | 574 | // ListView1->addColumn( tr("Date") ); |
573 | ListView1->setColumnWidth( 3, 63); | 575 | // ListView1->setColumnWidth( 3, -1); |
574 | 576 | ListView1->setColumnWidthMode(0, QListView::Maximum); | |
575 | ListView1->setColumnWidthMode( 0, QListView::Manual); | 577 | // ListView1->setColumnWidthMode(1, QListView::Maximum); |
578 | |||
579 | // ListView1->setColumnWidthMode( 0, QListView::Manual); | ||
576 | ListView1->setColumnAlignment( 1, QListView::AlignCenter); | 580 | ListView1->setColumnAlignment( 1, QListView::AlignCenter); |
577 | ListView1->setColumnAlignment( 2, QListView::AlignRight); | 581 | // ListView1->setColumnAlignment( 2, QListView::AlignRight); |
578 | ListView1->setColumnAlignment( 3, QListView::AlignLeft); | 582 | // ListView1->setColumnAlignment( 3, QListView::AlignLeft); |
579 | ListView1->setAllColumnsShowFocus( true ); | 583 | ListView1->setAllColumnsShowFocus( true ); |
580 | QPEApplication::setStylusOperation( ListView1->viewport(), QPEApplication::RightOnHold); | 584 | QPEApplication::setStylusOperation( ListView1->viewport(), QPEApplication::RightOnHold); |
581 | 585 | ||
@@ -646,7 +650,7 @@ void QtRec::init() { | |||
646 | compressionCheckBox = new QCheckBox ( tr("Wave Compression (smaller files)"), tab_3 ); | 650 | compressionCheckBox = new QCheckBox ( tr("Wave Compression (smaller files)"), tab_3 ); |
647 | 651 | ||
648 | autoMuteCheckBox = new QCheckBox ( tr("Auto Mute"), tab_3 ); | 652 | autoMuteCheckBox = new QCheckBox ( tr("Auto Mute"), tab_3 ); |
649 | stereoCheckBox = new QCheckBox ( tr("Stereo Channels"), tab_3 ); | 653 | stereoCheckBox = new QCheckBox ( tr("Stereo"), tab_3 ); |
650 | 654 | ||
651 | glayout3->addMultiCellWidget( compressionCheckBox, 2, 2, 0, 3); | 655 | glayout3->addMultiCellWidget( compressionCheckBox, 2, 2, 0, 3); |
652 | glayout3->addMultiCellWidget( autoMuteCheckBox, 3, 3, 0, 0); | 656 | glayout3->addMultiCellWidget( autoMuteCheckBox, 3, 3, 0, 0); |
@@ -707,7 +711,7 @@ void QtRec::init() { | |||
707 | // waveform->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)3, waveform->sizePolicy().hasHeightForWidth() ) ); | 711 | // waveform->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)3, waveform->sizePolicy().hasHeightForWidth() ) ); |
708 | waveform->setMinimumSize( QSize( 0, 50 ) ); | 712 | waveform->setMinimumSize( QSize( 0, 50 ) ); |
709 | 713 | ||
710 | layout->addMultiCellWidget( waveform, 8, 8, 0, 7 ); | 714 | layout->addMultiCellWidget( waveform, 8, 8, 0, 8); |
711 | waveform->setBackgroundColor ( black ); | 715 | waveform->setBackgroundColor ( black ); |
712 | } | 716 | } |
713 | 717 | ||
@@ -737,7 +741,7 @@ void QtRec::initIconView() { | |||
737 | fileS = cfg.readEntry( filePath, "0" );// file length in seconds | 741 | fileS = cfg.readEntry( filePath, "0" );// file length in seconds |
738 | mediaLocation = getStorage( filePath); | 742 | mediaLocation = getStorage( filePath); |
739 | if( info.exists()) { | 743 | if( info.exists()) { |
740 | item = new QListViewItem( ListView1, temp, fileS, mediaLocation, fileDate); | 744 | item = new QListViewItem( ListView1, temp, fileS /*, mediaLocation, fileDate*/); |
741 | item->setPixmap( 0, image0); | 745 | item->setPixmap( 0, image0); |
742 | if( currentFileName == filePath) | 746 | if( currentFileName == filePath) |
743 | ListView1->setSelected( item, true); | 747 | ListView1->setSelected( item, true); |
@@ -875,11 +879,11 @@ void QtRec::stop() { | |||
875 | void QtRec::doPlayBtn() { | 879 | void QtRec::doPlayBtn() { |
876 | 880 | ||
877 | if(!stopped) { | 881 | if(!stopped) { |
878 | playLabel2->setText(tr("Play")); | 882 | // playLabel2->setText(tr("Play")); |
879 | stop(); | 883 | stop(); |
880 | } else { | 884 | } else { |
881 | if(ListView1->currentItem() == 0) return; | 885 | if(ListView1->currentItem() == 0) return; |
882 | playLabel2->setText(tr("Stop")); | 886 | // playLabel2->setText(tr("Stop")); |
883 | currentFile = ListView1->currentItem()->text(0); | 887 | currentFile = ListView1->currentItem()->text(0); |
884 | start(); | 888 | start(); |
885 | } | 889 | } |
@@ -903,13 +907,13 @@ void QtRec::start() { //play | |||
903 | bool QtRec::rec() { //record | 907 | bool QtRec::rec() { //record |
904 | QString timeString; | 908 | QString timeString; |
905 | timeString.sprintf("%.0f", 0.0); | 909 | timeString.sprintf("%.0f", 0.0); |
906 | timeLabel->setText( timeString+ " seconds"); | 910 | // timeLabel->setText( timeString+ " seconds"); |
907 | if(!stopped) { | 911 | if(!stopped) { |
908 | monitoring = true; | 912 | monitoring = true; |
909 | return false; | 913 | return false; |
910 | } else { | 914 | } else { |
911 | secCount = 1; | 915 | secCount = 1; |
912 | playLabel2->setText(tr("Stop")); | 916 | // playLabel2->setText(tr("Stop")); |
913 | monitoring = false; | 917 | monitoring = false; |
914 | setRecordButton( true); | 918 | setRecordButton( true); |
915 | 919 | ||
@@ -967,10 +971,11 @@ bool QtRec::rec() { //record | |||
967 | setCaption( msg); | 971 | setCaption( msg); |
968 | #endif | 972 | #endif |
969 | filePara.fileName=currentFile.latin1(); | 973 | filePara.fileName=currentFile.latin1(); |
970 | odebug << "Start recording thread" << oendl; | 974 | odebug << "Start recording" << oendl; |
971 | stopped = false; | 975 | stopped = false; |
972 | 976 | ||
973 | #ifdef THREADED | 977 | #ifdef THREADED |
978 | odebug << "Start recording thread" << oendl; | ||
974 | pthread_t thread1; | 979 | pthread_t thread1; |
975 | pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/); | 980 | pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/); |
976 | #endif | 981 | #endif |
@@ -1188,7 +1193,7 @@ bool QtRec::doPlay() { | |||
1188 | // timeSlider->setRange( 0, filePara.numberSamples); | 1193 | // timeSlider->setRange( 0, filePara.numberSamples); |
1189 | 1194 | ||
1190 | timeString.sprintf("%f", filePara.numberOfRecordedSeconds); | 1195 | timeString.sprintf("%f", filePara.numberOfRecordedSeconds); |
1191 | timeLabel->setText( timeString+ tr(" seconds")); | 1196 | // timeLabel->setText( timeString+ tr(" seconds")); |
1192 | 1197 | ||
1193 | QString msg; | 1198 | QString msg; |
1194 | msg.sprintf("%d, %d, %d", | 1199 | msg.sprintf("%d, %d, %d", |
@@ -1476,7 +1481,7 @@ void QtRec::endRecording() { | |||
1476 | // move tmp file to regular file | 1481 | // move tmp file to regular file |
1477 | QString cmd; | 1482 | QString cmd; |
1478 | cmd.sprintf("mv "+ wavFile->trackName() + " " + wavFile->currentFileName); | 1483 | cmd.sprintf("mv "+ wavFile->trackName() + " " + wavFile->currentFileName); |
1479 | // odebug << "moving tmp file to "+currentFileName << oendl; | 1484 | odebug << "moving tmp file to "+currentFileName << oendl; |
1480 | system( cmd.latin1()); | 1485 | system( cmd.latin1()); |
1481 | } | 1486 | } |
1482 | 1487 | ||
@@ -1496,11 +1501,11 @@ void QtRec::endRecording() { | |||
1496 | QString time; | 1501 | QString time; |
1497 | time.sprintf("%.2f", filePara.numberOfRecordedSeconds); | 1502 | time.sprintf("%.2f", filePara.numberOfRecordedSeconds); |
1498 | cfg.writeEntry( wavFile->currentFileName, time ); | 1503 | cfg.writeEntry( wavFile->currentFileName, time ); |
1499 | // odebug << "writing config numberOfRecordedSeconds "+time << oendl; | 1504 | odebug << "writing config numberOfRecordedSeconds "+time << oendl; |
1500 | 1505 | ||
1501 | cfg.write(); | 1506 | cfg.write(); |
1502 | odebug << "finished recording" << oendl; | 1507 | odebug << "finished recording" << oendl; |
1503 | timeLabel->setText(""); | 1508 | // timeLabel->setText(""); |
1504 | } | 1509 | } |
1505 | 1510 | ||
1506 | // if(soundDevice) delete soundDevice; | 1511 | // if(soundDevice) delete soundDevice; |
@@ -1517,7 +1522,7 @@ void QtRec::endPlaying() { | |||
1517 | stopped = true; | 1522 | stopped = true; |
1518 | waveform->reset(); | 1523 | waveform->reset(); |
1519 | // errorStop(); | 1524 | // errorStop(); |
1520 | // odebug << "end playing" << oendl; | 1525 | odebug << "end playing" << oendl; |
1521 | setRecordButton( false); | 1526 | setRecordButton( false); |
1522 | 1527 | ||
1523 | toBeginningButton->setEnabled( true); | 1528 | toBeginningButton->setEnabled( true); |
@@ -1529,8 +1534,8 @@ void QtRec::endPlaying() { | |||
1529 | soundDevice->closeDevice( false); | 1534 | soundDevice->closeDevice( false); |
1530 | soundDevice->sd = -1; | 1535 | soundDevice->sd = -1; |
1531 | // if(soundDevice) delete soundDevice; | 1536 | // if(soundDevice) delete soundDevice; |
1532 | // odebug << "file and sound device closed" << oendl; | 1537 | odebug << "file and sound device closed" << oendl; |
1533 | timeLabel->setText(""); | 1538 | // timeLabel->setText(""); |
1534 | total = 0; | 1539 | total = 0; |
1535 | filePara.numberSamples = 0; | 1540 | filePara.numberSamples = 0; |
1536 | filePara.sd = -1; | 1541 | filePara.sd = -1; |
@@ -1538,7 +1543,7 @@ void QtRec::endPlaying() { | |||
1538 | filePara.fd = 0; | 1543 | filePara.fd = 0; |
1539 | // if(wavFile) delete wavFile; //this crashes | 1544 | // if(wavFile) delete wavFile; //this crashes |
1540 | 1545 | ||
1541 | // odebug << "track closed" << oendl; | 1546 | odebug << "track closed" << oendl; |
1542 | killTimers(); | 1547 | killTimers(); |
1543 | owarn << "reset slider" << oendl; | 1548 | owarn << "reset slider" << oendl; |
1544 | timeSlider->setValue(0); | 1549 | timeSlider->setValue(0); |
@@ -1864,14 +1869,14 @@ void QtRec::timerEvent( QTimerEvent * ) { | |||
1864 | #endif | 1869 | #endif |
1865 | 1870 | ||
1866 | timeString.sprintf("%d", secCount); | 1871 | timeString.sprintf("%d", secCount); |
1867 | timeLabel->setText( timeString + " seconds"); | 1872 | // timeLabel->setText( timeString + " seconds"); |
1868 | 1873 | ||
1869 | secCount++; | 1874 | secCount++; |
1870 | } | 1875 | } |
1871 | 1876 | ||
1872 | void QtRec::changeTimeSlider(int index) { | 1877 | void QtRec::changeTimeSlider(int index) { |
1873 | if( ListView1->currentItem() == 0 || !wavFile->track.isOpen()) return; | 1878 | if( ListView1->currentItem() == 0 || !wavFile->track.isOpen()) return; |
1874 | // odebug << "Slider moved to " << index << "" << oendl; | 1879 | odebug << "Slider moved to " << index << "" << oendl; |
1875 | paused = true; | 1880 | paused = true; |
1876 | stopped = true; | 1881 | stopped = true; |
1877 | 1882 | ||
@@ -1881,12 +1886,12 @@ void QtRec::changeTimeSlider(int index) { | |||
1881 | filePara.numberOfRecordedSeconds = (float)sliderPos / (float)filePara.sampleRate * (float)2; | 1886 | filePara.numberOfRecordedSeconds = (float)sliderPos / (float)filePara.sampleRate * (float)2; |
1882 | timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds); | 1887 | timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds); |
1883 | secCount = (int)filePara.numberOfRecordedSeconds; | 1888 | secCount = (int)filePara.numberOfRecordedSeconds; |
1884 | timeLabel->setText( timeString + tr(" seconds")); | 1889 | // timeLabel->setText( timeString + tr(" seconds")); |
1885 | } | 1890 | } |
1886 | 1891 | ||
1887 | void QtRec::timeSliderPressed() { | 1892 | void QtRec::timeSliderPressed() { |
1888 | if( ListView1->currentItem() == 0) return; | 1893 | if( ListView1->currentItem() == 0) return; |
1889 | // odebug << "slider pressed" << oendl; | 1894 | odebug << "slider pressed" << oendl; |
1890 | paused = true; | 1895 | paused = true; |
1891 | stopped = true; | 1896 | stopped = true; |
1892 | } | 1897 | } |
@@ -1895,7 +1900,7 @@ void QtRec::timeSliderReleased() { | |||
1895 | if( ListView1->currentItem() == 0) return; | 1900 | if( ListView1->currentItem() == 0) return; |
1896 | sliderPos = timeSlider->value(); | 1901 | sliderPos = timeSlider->value(); |
1897 | 1902 | ||
1898 | // odebug << "slider released " << sliderPos << "" << oendl; | 1903 | odebug << "slider released " << sliderPos << "" << oendl; |
1899 | stopped = false; | 1904 | stopped = false; |
1900 | int newPos = lseek( filePara.fd, sliderPos, SEEK_SET); | 1905 | int newPos = lseek( filePara.fd, sliderPos, SEEK_SET); |
1901 | total = newPos*4; | 1906 | total = newPos*4; |
@@ -1925,11 +1930,11 @@ void QtRec::rewindTimerTimeout() { | |||
1925 | sliderValue = sliderValue - ( filePara.numberSamples / 100); | 1930 | sliderValue = sliderValue - ( filePara.numberSamples / 100); |
1926 | // if(toBeginningButton->isDown()) | 1931 | // if(toBeginningButton->isDown()) |
1927 | timeSlider->setValue( sliderValue ) ; | 1932 | timeSlider->setValue( sliderValue ) ; |
1928 | // odebug << "" << sliderValue << "" << oendl; | 1933 | odebug << "" << sliderValue << "" << oendl; |
1929 | QString timeString; | 1934 | QString timeString; |
1930 | filePara.numberOfRecordedSeconds = (float)sliderValue / (float)filePara.sampleRate * (float)2; | 1935 | filePara.numberOfRecordedSeconds = (float)sliderValue / (float)filePara.sampleRate * (float)2; |
1931 | timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds); | 1936 | timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds); |
1932 | timeLabel->setText( timeString+ tr(" seconds")); | 1937 | // timeLabel->setText( timeString+ tr(" seconds")); |
1933 | } | 1938 | } |
1934 | 1939 | ||
1935 | void QtRec::rewindReleased() { | 1940 | void QtRec::rewindReleased() { |
@@ -1939,7 +1944,7 @@ void QtRec::rewindReleased() { | |||
1939 | stopped = false; | 1944 | stopped = false; |
1940 | int newPos = lseek( filePara.fd, sliderPos, SEEK_SET); | 1945 | int newPos = lseek( filePara.fd, sliderPos, SEEK_SET); |
1941 | total = newPos * 4; | 1946 | total = newPos * 4; |
1942 | // odebug << "rewind released " << total << "" << oendl; | 1947 | odebug << "rewind released " << total << "" << oendl; |
1943 | startTimer( 1000); | 1948 | startTimer( 1000); |
1944 | doPlay(); | 1949 | doPlay(); |
1945 | } | 1950 | } |
@@ -1971,7 +1976,7 @@ void QtRec::forwardTimerTimeout() { | |||
1971 | QString timeString; | 1976 | QString timeString; |
1972 | filePara.numberOfRecordedSeconds = (float)sliderValue / (float)filePara.sampleRate * (float)2; | 1977 | filePara.numberOfRecordedSeconds = (float)sliderValue / (float)filePara.sampleRate * (float)2; |
1973 | timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds); | 1978 | timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds); |
1974 | timeLabel->setText( timeString+ tr(" seconds")); | 1979 | // timeLabel->setText( timeString+ tr(" seconds")); |
1975 | } | 1980 | } |
1976 | 1981 | ||
1977 | void QtRec::FastforwardReleased() { | 1982 | void QtRec::FastforwardReleased() { |
@@ -2027,7 +2032,7 @@ void QtRec::setRecordButton(bool b) { | |||
2027 | Stop_PushButton->setPixmap( image3 ); | 2032 | Stop_PushButton->setPixmap( image3 ); |
2028 | if(Stop_PushButton->isDown()) | 2033 | if(Stop_PushButton->isDown()) |
2029 | Stop_PushButton->setDown( true); | 2034 | Stop_PushButton->setDown( true); |
2030 | playLabel2->setText( tr("Stop") ); | 2035 | // playLabel2->setText( tr("Stop") ); |
2031 | 2036 | ||
2032 | } else { //about to stop | 2037 | } else { //about to stop |
2033 | 2038 | ||
@@ -2035,7 +2040,7 @@ void QtRec::setRecordButton(bool b) { | |||
2035 | Stop_PushButton->setPixmap( image4); | 2040 | Stop_PushButton->setPixmap( image4); |
2036 | if(Stop_PushButton->isDown()) | 2041 | if(Stop_PushButton->isDown()) |
2037 | Stop_PushButton->setDown( false); | 2042 | Stop_PushButton->setDown( false); |
2038 | playLabel2->setText( tr("Play") ); | 2043 | // playLabel2->setText( tr("Play") ); |
2039 | if(Rec_PushButton->isDown()) | 2044 | if(Rec_PushButton->isDown()) |
2040 | Rec_PushButton->setDown( false); | 2045 | Rec_PushButton->setDown( false); |
2041 | } | 2046 | } |
diff --git a/noncore/multimedia/opierec/qtrec.h b/noncore/multimedia/opierec/qtrec.h index 5878d37..3808d99 100644 --- a/noncore/multimedia/opierec/qtrec.h +++ b/noncore/multimedia/opierec/qtrec.h | |||
@@ -4,7 +4,7 @@ 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 20040101 | 7 | #define VERSION 20040628 |
8 | 8 | ||
9 | #include <qpe/ir.h> | 9 | #include <qpe/ir.h> |
10 | 10 | ||