author | llornkcor <llornkcor> | 2004-06-28 11:35:26 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-06-28 11:35:26 (UTC) |
commit | 6944350eaea708414b9c0ff26122d7b2d19cd8f5 (patch) (unidiff) | |
tree | 725c3e90cd724a6f43c03bcdadfa40d88508aa34 /noncore/multimedia/opierec | |
parent | dd7341867ccd9f9718c4d10698f5ee0d292dba24 (diff) | |
download | opie-6944350eaea708414b9c0ff26122d7b2d19cd8f5.zip opie-6944350eaea708414b9c0ff26122d7b2d19cd8f5.tar.gz opie-6944350eaea708414b9c0ff26122d7b2d19cd8f5.tar.bz2 |
fix up interface
-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 | |||
@@ -70,14 +70,14 @@ static int deviceBitRates[] = { 8, 16, -1 }; | |||
70 | #define DSPSTRIN "/dev/dsp1" | 70 | #define DSPSTRIN "/dev/dsp1" |
71 | #define DSPSTRMIXEROUT "/dev/mixer" | 71 | #define DSPSTRMIXEROUT "/dev/mixer" |
72 | #define DSPSTRMIXERIN "/dev/mixer1" | 72 | #define DSPSTRMIXERIN "/dev/mixer1" |
73 | 73 | ||
74 | #else | 74 | #else |
75 | 75 | ||
76 | #define DSPSTROUT "/dev/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 | ||
81 | #endif | 81 | #endif |
82 | 82 | ||
83 | //#define ZAURUS 0 | 83 | //#define ZAURUS 0 |
@@ -130,35 +130,35 @@ void quickRec() | |||
130 | 130 | ||
131 | bytesWritten = 0; | 131 | bytesWritten = 0; |
132 | number = 0; | 132 | number = 0; |
133 | QString num; | 133 | QString num; |
134 | int level = 0; | 134 | int level = 0; |
135 | int threshold = 0; | 135 | int threshold = 0; |
136 | // int bits = filePara.resolution; | 136 | int bits = filePara.resolution; |
137 | // odebug << "bits " << bits << "" << oendl; | 137 | odebug << "bits " << bits << "" << oendl; |
138 | 138 | ||
139 | if( filePara.resolution == 16 ) { //AFMT_S16_LE) | 139 | if( filePara.resolution == 16 ) { //AFMT_S16_LE) |
140 | // odebug << "AFMT_S16_LE size " << filePara.SecondsToRecord << "" << oendl; | 140 | odebug << "AFMT_S16_LE size " << filePara.SecondsToRecord << "" << oendl; |
141 | // odebug << "samples to record " << filePara.samplesToRecord << "" << oendl; | 141 | odebug << "samples to record " << filePara.samplesToRecord << "" << oendl; |
142 | // odebug << "" << filePara.sd << "" << oendl; | 142 | odebug << "" << filePara.sd << "" << oendl; |
143 | level = 7; | 143 | level = 7; |
144 | threshold = 0; | 144 | threshold = 0; |
145 | 145 | ||
146 | if( filePara.format == WAVE_FORMAT_DVI_ADPCM) { | 146 | if( filePara.format == WAVE_FORMAT_DVI_ADPCM) { |
147 | // odebug << "start recording WAVE_FORMAT_DVI_ADPCM" << oendl; | 147 | odebug << "start recording WAVE_FORMAT_DVI_ADPCM" << oendl; |
148 | // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_DVI_ADPCM >>>>>>>>>>>>>>>>>>>>>> | 148 | // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_DVI_ADPCM >>>>>>>>>>>>>>>>>>>>>> |
149 | char abuf[ BUFSIZE/2 ]; | 149 | char abuf[ BUFSIZE/2 ]; |
150 | short sbuf[ BUFSIZE ]; | 150 | short sbuf[ BUFSIZE ]; |
151 | short sbuf2[ BUFSIZE ]; | 151 | short sbuf2[ BUFSIZE ]; |
152 | memset( abuf, 0, BUFSIZE/2); | 152 | memset( abuf, 0, BUFSIZE/2); |
153 | memset( sbuf, 0, BUFSIZE); | 153 | memset( sbuf, 0, BUFSIZE); |
154 | memset( sbuf2, 0, BUFSIZE); | 154 | memset( sbuf2, 0, BUFSIZE); |
155 | 155 | ||
156 | for(;;) { | 156 | for(;;) { |
157 | if ( stopped) { | 157 | if ( stopped) { |
158 | // odebug << "quickRec:: stopped" << oendl; | 158 | odebug << "quickRec:: stopped" << oendl; |
159 | break; | 159 | break; |
160 | } | 160 | } |
161 | 161 | ||
162 | // number=::read( filePara.sd, sbuf, BUFSIZE); | 162 | // number=::read( filePara.sd, sbuf, BUFSIZE); |
163 | number = soundDevice ->devRead( filePara.sd, sbuf, BUFSIZE); | 163 | number = soundDevice ->devRead( filePara.sd, sbuf, BUFSIZE); |
164 | 164 | ||
@@ -177,14 +177,16 @@ void quickRec() | |||
177 | waveform->newSamples( sbuf, number ); | 177 | waveform->newSamples( sbuf, number ); |
178 | 178 | ||
179 | total += bytesWritten; | 179 | total += bytesWritten; |
180 | filePara.numberSamples = total; | 180 | filePara.numberSamples = total; |
181 | timeSlider->setValue( total); | 181 | timeSlider->setValue( total); |
182 | 182 | ||
183 | 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) { |
188 | stopped = true; | 190 | stopped = true; |
189 | break; | 191 | break; |
190 | } | 192 | } |
@@ -201,13 +203,13 @@ void quickRec() | |||
201 | odebug << "quickRec:: stopped" << oendl; | 203 | odebug << "quickRec:: stopped" << oendl; |
202 | stopped = true; | 204 | stopped = true; |
203 | break; // stop if playing was set to false | 205 | break; // stop if playing was set to false |
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 "); |
211 | odebug << filePara.fileName << oendl; | 213 | odebug << filePara.fileName << oendl; |
212 | stopped = true; | 214 | stopped = true; |
213 | return; | 215 | return; |
@@ -225,14 +227,14 @@ void quickRec() | |||
225 | total += bytesWritten; | 227 | total += bytesWritten; |
226 | 228 | ||
227 | filePara.numberSamples = total; | 229 | filePara.numberSamples = total; |
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; |
236 | qApp->processEvents(); | 238 | qApp->processEvents(); |
237 | 239 | ||
238 | if( total >= filePara.samplesToRecord) { | 240 | if( total >= filePara.samplesToRecord) { |
@@ -251,26 +253,26 @@ void quickRec() | |||
251 | for(;;) { | 253 | for(;;) { |
252 | if ( stopped) { | 254 | if ( stopped) { |
253 | odebug << "quickRec:: stopped" << oendl; | 255 | odebug << "quickRec:: stopped" << oendl; |
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 | ||
261 | if(bytesWritten < 0) { | 263 | if(bytesWritten < 0) { |
262 | stopped = true; | 264 | stopped = true; |
263 | QMessageBox::message("Note","<p>There was a problem writing to the file</p>"); | 265 | QMessageBox::message("Note","<p>There was a problem writing to the file</p>"); |
264 | perror("File writing error "); | 266 | perror("File writing error "); |
265 | return; | 267 | return; |
266 | } | 268 | } |
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); |
274 | 276 | ||
275 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate; | 277 | filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate; |
276 | 278 | ||
@@ -494,32 +496,32 @@ void QtRec::init() { | |||
494 | setCaption( tr( "OpieRecord " ) + QString::number(VERSION) ); | 496 | setCaption( tr( "OpieRecord " ) + QString::number(VERSION) ); |
495 | QGridLayout *layout = new QGridLayout( this ); | 497 | QGridLayout *layout = new QGridLayout( this ); |
496 | layout->setSpacing( 2); | 498 | layout->setSpacing( 2); |
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 | ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** |
504 | tab = new QWidget( TabWidget, "tab" ); | 506 | tab = new QWidget( TabWidget, "tab" ); |
505 | 507 | ||
506 | QGridLayout *layout1 = new QGridLayout( tab); | 508 | QGridLayout *layout1 = new QGridLayout( tab); |
507 | layout1->setSpacing( 2); | 509 | layout1->setSpacing( 2); |
508 | layout1->setMargin( 2); | 510 | layout1->setMargin( 2); |
509 | 511 | ||
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); |
523 | Stop_PushButton->setFixedSize( 22, 22); | 525 | Stop_PushButton->setFixedSize( 22, 22); |
524 | Stop_PushButton->setPixmap( image4 ); | 526 | Stop_PushButton->setPixmap( image4 ); |
525 | 527 | ||
@@ -530,17 +532,17 @@ void QtRec::init() { | |||
530 | 532 | ||
531 | toEndButton = new QPushButton( tab, "End_PushButton" ); | 533 | toEndButton = new QPushButton( tab, "End_PushButton" ); |
532 | layout1->addMultiCellWidget( toEndButton, 1, 1, 6, 6); | 534 | layout1->addMultiCellWidget( toEndButton, 1, 1, 6, 6); |
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); |
544 | Rec_PushButton->setFixedSize( 22, 22); | 546 | Rec_PushButton->setFixedSize( 22, 22); |
545 | Rec_PushButton->setPixmap( image6 ); | 547 | Rec_PushButton->setPixmap( image6 ); |
546 | 548 | ||
@@ -554,31 +556,33 @@ void QtRec::init() { | |||
554 | forwardTimer = new QTimer( this ); | 556 | forwardTimer = new QTimer( this ); |
555 | connect( forwardTimer, SIGNAL( timeout() ), | 557 | connect( forwardTimer, SIGNAL( timeout() ), |
556 | this, SLOT( forwardTimerTimeout() ) ); | 558 | this, SLOT( forwardTimerTimeout() ) ); |
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 | ||
582 | TabWidget->insertTab( tab, tr( "Files" ) ); | 586 | TabWidget->insertTab( tab, tr( "Files" ) ); |
583 | 587 | ||
584 | ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** | 588 | ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** |
@@ -643,13 +647,13 @@ void QtRec::init() { | |||
643 | 647 | ||
644 | glayout3->addMultiCellWidget( bitGroup, 1, 1, 1, 1); | 648 | glayout3->addMultiCellWidget( bitGroup, 1, 1, 1, 1); |
645 | 649 | ||
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); |
653 | glayout3->addMultiCellWidget( stereoCheckBox, 3, 3, 1, 1); | 657 | glayout3->addMultiCellWidget( stereoCheckBox, 3, 3, 1, 1); |
654 | 658 | ||
655 | tab_5 = new QWidget( TabWidget, "tab_5" ); | 659 | tab_5 = new QWidget( TabWidget, "tab_5" ); |
@@ -704,13 +708,13 @@ void QtRec::init() { | |||
704 | 708 | ||
705 | 709 | ||
706 | waveform = new Waveform( this, "waveform" ); | 710 | waveform = new Waveform( this, "waveform" ); |
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 | ||
714 | void QtRec::initIconView() { | 718 | void QtRec::initIconView() { |
715 | 719 | ||
716 | ListView1->clear(); | 720 | ListView1->clear(); |
@@ -734,13 +738,13 @@ void QtRec::initIconView() { | |||
734 | QFileInfo info(filePath); | 738 | QFileInfo info(filePath); |
735 | fileDate = info.lastModified().toString(); | 739 | fileDate = info.lastModified().toString(); |
736 | 740 | ||
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); |
744 | } | 748 | } |
745 | } | 749 | } |
746 | } | 750 | } |
@@ -872,17 +876,17 @@ void QtRec::stop() { | |||
872 | timeSlider->setValue(0); | 876 | timeSlider->setValue(0); |
873 | } | 877 | } |
874 | 878 | ||
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 | } |
886 | } | 890 | } |
887 | 891 | ||
888 | void QtRec::start() { //play | 892 | void QtRec::start() { //play |
@@ -900,19 +904,19 @@ void QtRec::start() { //play | |||
900 | } | 904 | } |
901 | } | 905 | } |
902 | 906 | ||
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 | ||
916 | if( setupAudio( true)) | 920 | if( setupAudio( true)) |
917 | if(setUpFile()) { | 921 | if(setUpFile()) { |
918 | int fileSize = 0; | 922 | int fileSize = 0; |
@@ -964,16 +968,17 @@ bool QtRec::rec() { //record | |||
964 | QString msg; | 968 | QString msg; |
965 | msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); | 969 | msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); |
966 | #ifdef DEV_VERSION | 970 | #ifdef DEV_VERSION |
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 |
977 | toBeginningButton->setEnabled( false); | 982 | toBeginningButton->setEnabled( false); |
978 | toEndButton->setEnabled( false); | 983 | toEndButton->setEnabled( false); |
979 | 984 | ||
@@ -1185,13 +1190,13 @@ bool QtRec::doPlay() { | |||
1185 | QString num; | 1190 | QString num; |
1186 | odebug << "Play number of samples " << filePara.numberSamples << "" << oendl; | 1191 | odebug << "Play number of samples " << filePara.numberSamples << "" << oendl; |
1187 | 1192 | ||
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", |
1195 | filePara.sampleRate, | 1200 | filePara.sampleRate, |
1196 | filePara.channels, | 1201 | filePara.channels, |
1197 | filePara.resolution); | 1202 | filePara.resolution); |
@@ -1473,13 +1478,13 @@ void QtRec::endRecording() { | |||
1473 | filePara.fd=0; | 1478 | filePara.fd=0; |
1474 | 1479 | ||
1475 | if( wavFile->isTempFile()) { | 1480 | if( wavFile->isTempFile()) { |
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 | ||
1483 | odebug << "Just moved " + wavFile->currentFileName << oendl; | 1488 | odebug << "Just moved " + wavFile->currentFileName << oendl; |
1484 | Config cfg("OpieRec"); | 1489 | Config cfg("OpieRec"); |
1485 | cfg.setGroup("Sounds"); | 1490 | cfg.setGroup("Sounds"); |
@@ -1493,17 +1498,17 @@ void QtRec::endRecording() { | |||
1493 | cfg.writeEntry( QString::number( nFiles + 1), currentFile); | 1498 | cfg.writeEntry( QString::number( nFiles + 1), currentFile); |
1494 | cfg.writeEntry( currentFile, wavFile->currentFileName); | 1499 | cfg.writeEntry( currentFile, wavFile->currentFileName); |
1495 | 1500 | ||
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; |
1507 | 1512 | ||
1508 | timeSlider->setValue(0); | 1513 | timeSlider->setValue(0); |
1509 | initIconView(); | 1514 | initIconView(); |
@@ -1514,34 +1519,34 @@ void QtRec::endPlaying() { | |||
1514 | monitoring = false; | 1519 | monitoring = false; |
1515 | recording = false; | 1520 | recording = false; |
1516 | playing = false; | 1521 | playing = false; |
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); |
1524 | toEndButton->setEnabled( true); | 1529 | toEndButton->setEnabled( true); |
1525 | 1530 | ||
1526 | if(autoMute) | 1531 | if(autoMute) |
1527 | doMute( true); | 1532 | doMute( true); |
1528 | 1533 | ||
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; |
1537 | // wavFile->closeFile(); | 1542 | // wavFile->closeFile(); |
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); |
1545 | 1550 | ||
1546 | // if(soundDevice) delete soundDevice; | 1551 | // if(soundDevice) delete soundDevice; |
1547 | 1552 | ||
@@ -1861,44 +1866,44 @@ void QtRec::timerEvent( QTimerEvent * ) { | |||
1861 | QString msg; | 1866 | QString msg; |
1862 | msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); | 1867 | msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); |
1863 | setCaption( msg +" :: "+QString::number(secCount)); | 1868 | setCaption( msg +" :: "+QString::number(secCount)); |
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 | ||
1878 | sliderPos=index; | 1883 | sliderPos=index; |
1879 | 1884 | ||
1880 | QString timeString; | 1885 | QString timeString; |
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 | } |
1893 | 1898 | ||
1894 | void QtRec::timeSliderReleased() { | 1899 | 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; |
1902 | filePara.numberOfRecordedSeconds = (float)sliderPos / (float)filePara.sampleRate * (float)2; | 1907 | filePara.numberOfRecordedSeconds = (float)sliderPos / (float)filePara.sampleRate * (float)2; |
1903 | 1908 | ||
1904 | doPlay(); | 1909 | doPlay(); |
@@ -1922,27 +1927,27 @@ void QtRec::rewindPressed() { | |||
1922 | 1927 | ||
1923 | void QtRec::rewindTimerTimeout() { | 1928 | void QtRec::rewindTimerTimeout() { |
1924 | int sliderValue = timeSlider->value(); | 1929 | int sliderValue = timeSlider->value(); |
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() { |
1936 | rewindTimer->stop(); | 1941 | rewindTimer->stop(); |
1937 | if( wavFile->track.isOpen()) { | 1942 | if( wavFile->track.isOpen()) { |
1938 | sliderPos=timeSlider->value(); | 1943 | sliderPos=timeSlider->value(); |
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 | } |
1946 | } | 1951 | } |
1947 | 1952 | ||
1948 | void QtRec::FastforwardPressed() { | 1953 | void QtRec::FastforwardPressed() { |
@@ -1968,13 +1973,13 @@ void QtRec::forwardTimerTimeout() { | |||
1968 | // if(toEndButton->isDown()) | 1973 | // if(toEndButton->isDown()) |
1969 | timeSlider->setValue( sliderValue); | 1974 | timeSlider->setValue( sliderValue); |
1970 | 1975 | ||
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() { |
1978 | forwardTimer->stop(); | 1983 | forwardTimer->stop(); |
1979 | if( wavFile->track.isOpen()) { | 1984 | if( wavFile->track.isOpen()) { |
1980 | sliderPos=timeSlider->value(); | 1985 | sliderPos=timeSlider->value(); |
@@ -2024,21 +2029,21 @@ void QtRec::setRecordButton(bool b) { | |||
2024 | 2029 | ||
2025 | Rec_PushButton->setDown( true); | 2030 | Rec_PushButton->setDown( true); |
2026 | QPixmap image3( ( const char** ) image3_data ); | 2031 | QPixmap image3( ( const char** ) image3_data ); |
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 | ||
2034 | QPixmap image4( ( const char** ) image4_data ); | 2039 | QPixmap image4( ( const char** ) image4_data ); |
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 | } |
2042 | } | 2047 | } |
2043 | 2048 | ||
2044 | void QtRec::fillDirectoryCombo() { | 2049 | void QtRec::fillDirectoryCombo() { |
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 | |||
@@ -1,13 +1,13 @@ | |||
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 20040101 | 7 | #define VERSION 20040628 |
8 | 8 | ||
9 | #include <qpe/ir.h> | 9 | #include <qpe/ir.h> |
10 | 10 | ||
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | #include <qimage.h> | 12 | #include <qimage.h> |
13 | #include <qlineedit.h> | 13 | #include <qlineedit.h> |