-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 | |||
@@ -75,4 +75,4 @@ static int deviceBitRates[] = { 8, 16, -1 }; | |||
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" |
@@ -135,9 +135,9 @@ void quickRec() | |||
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; |
@@ -146,3 +146,3 @@ void quickRec() | |||
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 >>>>>>>>>>>>>>>>>>>>>> |
@@ -157,3 +157,3 @@ void quickRec() | |||
157 | if ( stopped) { | 157 | if ( stopped) { |
158 | // odebug << "quickRec:: stopped" << oendl; | 158 | odebug << "quickRec:: stopped" << oendl; |
159 | break; | 159 | break; |
@@ -182,4 +182,6 @@ void quickRec() | |||
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 | ||
@@ -206,3 +208,3 @@ void quickRec() | |||
206 | 208 | ||
207 | number = soundDevice->devRead( filePara.sd, (short *)inbuffer, BUFSIZE); | 209 | number = soundDevice->devRead( soundDevice->sd /*filePara.sd*/, (short *)inbuffer, BUFSIZE); |
208 | 210 | ||
@@ -230,4 +232,4 @@ void quickRec() | |||
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 | ||
@@ -256,3 +258,3 @@ void quickRec() | |||
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); |
@@ -269,3 +271,3 @@ void quickRec() | |||
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); |
@@ -499,3 +501,3 @@ void QtRec::init() { | |||
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); |
@@ -512,9 +514,9 @@ void QtRec::init() { | |||
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 | ||
@@ -535,7 +537,7 @@ void QtRec::init() { | |||
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 | ||
@@ -559,3 +561,3 @@ void QtRec::init() { | |||
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 | ||
@@ -565,15 +567,17 @@ void QtRec::init() { | |||
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 ); |
@@ -648,3 +652,3 @@ void QtRec::init() { | |||
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 | ||
@@ -709,3 +713,3 @@ void QtRec::init() { | |||
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 ); |
@@ -739,3 +743,3 @@ void QtRec::initIconView() { | |||
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); |
@@ -877,3 +881,3 @@ void QtRec::doPlayBtn() { | |||
877 | if(!stopped) { | 881 | if(!stopped) { |
878 | playLabel2->setText(tr("Play")); | 882 | // playLabel2->setText(tr("Play")); |
879 | stop(); | 883 | stop(); |
@@ -881,3 +885,3 @@ void QtRec::doPlayBtn() { | |||
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); |
@@ -905,3 +909,3 @@ bool QtRec::rec() { //record | |||
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) { |
@@ -911,3 +915,3 @@ bool QtRec::rec() { //record | |||
911 | secCount = 1; | 915 | secCount = 1; |
912 | playLabel2->setText(tr("Stop")); | 916 | // playLabel2->setText(tr("Stop")); |
913 | monitoring = false; | 917 | monitoring = false; |
@@ -969,3 +973,3 @@ bool QtRec::rec() { //record | |||
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; |
@@ -973,2 +977,3 @@ bool QtRec::rec() { //record | |||
973 | #ifdef THREADED | 977 | #ifdef THREADED |
978 | odebug << "Start recording thread" << oendl; | ||
974 | pthread_t thread1; | 979 | pthread_t thread1; |
@@ -1190,3 +1195,3 @@ bool QtRec::doPlay() { | |||
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 | ||
@@ -1478,3 +1483,3 @@ void QtRec::endRecording() { | |||
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()); |
@@ -1498,3 +1503,3 @@ void QtRec::endRecording() { | |||
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 | ||
@@ -1502,3 +1507,3 @@ void QtRec::endRecording() { | |||
1502 | odebug << "finished recording" << oendl; | 1507 | odebug << "finished recording" << oendl; |
1503 | timeLabel->setText(""); | 1508 | // timeLabel->setText(""); |
1504 | } | 1509 | } |
@@ -1519,3 +1524,3 @@ void QtRec::endPlaying() { | |||
1519 | // errorStop(); | 1524 | // errorStop(); |
1520 | // odebug << "end playing" << oendl; | 1525 | odebug << "end playing" << oendl; |
1521 | setRecordButton( false); | 1526 | setRecordButton( false); |
@@ -1531,4 +1536,4 @@ void QtRec::endPlaying() { | |||
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; |
@@ -1540,3 +1545,3 @@ void QtRec::endPlaying() { | |||
1540 | 1545 | ||
1541 | // odebug << "track closed" << oendl; | 1546 | odebug << "track closed" << oendl; |
1542 | killTimers(); | 1547 | killTimers(); |
@@ -1866,3 +1871,3 @@ void QtRec::timerEvent( QTimerEvent * ) { | |||
1866 | timeString.sprintf("%d", secCount); | 1871 | timeString.sprintf("%d", secCount); |
1867 | timeLabel->setText( timeString + " seconds"); | 1872 | // timeLabel->setText( timeString + " seconds"); |
1868 | 1873 | ||
@@ -1873,3 +1878,3 @@ 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; |
@@ -1883,3 +1888,3 @@ void QtRec::changeTimeSlider(int index) { | |||
1883 | secCount = (int)filePara.numberOfRecordedSeconds; | 1888 | secCount = (int)filePara.numberOfRecordedSeconds; |
1884 | timeLabel->setText( timeString + tr(" seconds")); | 1889 | // timeLabel->setText( timeString + tr(" seconds")); |
1885 | } | 1890 | } |
@@ -1888,3 +1893,3 @@ 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; |
@@ -1897,3 +1902,3 @@ void QtRec::timeSliderReleased() { | |||
1897 | 1902 | ||
1898 | // odebug << "slider released " << sliderPos << "" << oendl; | 1903 | odebug << "slider released " << sliderPos << "" << oendl; |
1899 | stopped = false; | 1904 | stopped = false; |
@@ -1927,3 +1932,3 @@ void QtRec::rewindTimerTimeout() { | |||
1927 | timeSlider->setValue( sliderValue ) ; | 1932 | timeSlider->setValue( sliderValue ) ; |
1928 | // odebug << "" << sliderValue << "" << oendl; | 1933 | odebug << "" << sliderValue << "" << oendl; |
1929 | QString timeString; | 1934 | QString timeString; |
@@ -1931,3 +1936,3 @@ void QtRec::rewindTimerTimeout() { | |||
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 | } |
@@ -1941,3 +1946,3 @@ void QtRec::rewindReleased() { | |||
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); |
@@ -1973,3 +1978,3 @@ void QtRec::forwardTimerTimeout() { | |||
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 | } |
@@ -2029,3 +2034,3 @@ void QtRec::setRecordButton(bool b) { | |||
2029 | Stop_PushButton->setDown( true); | 2034 | Stop_PushButton->setDown( true); |
2030 | playLabel2->setText( tr("Stop") ); | 2035 | // playLabel2->setText( tr("Stop") ); |
2031 | 2036 | ||
@@ -2037,3 +2042,3 @@ void QtRec::setRecordButton(bool b) { | |||
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()) |
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 | |||
@@ -6,3 +6,3 @@ copyright 2002 by L.J. Potter ljp@llornkcor.com | |||
6 | #define QTREC_H | 6 | #define QTREC_H |
7 | #define VERSION 20040101 | 7 | #define VERSION 20040628 |
8 | 8 | ||