-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 @@ -74,6 +74,6 @@ static int deviceBitRates[] = { 8, 16, -1 }; #else -#define DSPSTROUT "/dev/dsp" -#define DSPSTRIN "/dev/dsp" +#define DSPSTROUT "/dev/dsp1" +#define DSPSTRIN "/dev/dsp1" #define DSPSTRMIXERIN "/dev/mixer" #define DSPSTRMIXEROUT "/dev/mixer" @@ -134,16 +134,16 @@ void quickRec() int level = 0; int threshold = 0; -// int bits = filePara.resolution; -// odebug << "bits " << bits << "" << oendl; + int bits = filePara.resolution; + odebug << "bits " << bits << "" << oendl; if( filePara.resolution == 16 ) { //AFMT_S16_LE) -// odebug << "AFMT_S16_LE size " << filePara.SecondsToRecord << "" << oendl; -// odebug << "samples to record " << filePara.samplesToRecord << "" << oendl; -// odebug << "" << filePara.sd << "" << oendl; + odebug << "AFMT_S16_LE size " << filePara.SecondsToRecord << "" << oendl; + odebug << "samples to record " << filePara.samplesToRecord << "" << oendl; + odebug << "" << filePara.sd << "" << oendl; level = 7; threshold = 0; if( filePara.format == WAVE_FORMAT_DVI_ADPCM) { -// odebug << "start recording WAVE_FORMAT_DVI_ADPCM" << oendl; + odebug << "start recording WAVE_FORMAT_DVI_ADPCM" << oendl; // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_DVI_ADPCM >>>>>>>>>>>>>>>>>>>>>> char abuf[ BUFSIZE/2 ]; @@ -156,5 +156,5 @@ void quickRec() for(;;) { if ( stopped) { -// odebug << "quickRec:: stopped" << oendl; + odebug << "quickRec:: stopped" << oendl; break; } @@ -181,6 +181,8 @@ void quickRec() timeSlider->setValue( total); - filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2 - / filePara.channels; + printf("%d, bytes %d,total %d\r",number, bytesWritten, total); + fflush(stdout); + + filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2 / filePara.channels; qApp->processEvents(); @@ -205,5 +207,5 @@ void quickRec() } - number = soundDevice->devRead( filePara.sd, (short *)inbuffer, BUFSIZE); + number = soundDevice->devRead( soundDevice->sd /*filePara.sd*/, (short *)inbuffer, BUFSIZE); if( number <= 0) { @@ -229,6 +231,6 @@ void quickRec() if( filePara.SecondsToRecord != 0) timeSlider->setValue( total); -// printf("Writing number %d, bytes %d,total %d\r",number, bytesWritten , total); -// fflush(stdout); + printf("%d, bytes %d,total %d\r",number, bytesWritten , total); + fflush(stdout); filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate @@ -255,5 +257,5 @@ void quickRec() } - number = ::read( filePara.sd, unsigned_inbuffer, BUFSIZE); + number = ::read( soundDevice->sd /*filePara.sd*/ , unsigned_inbuffer, BUFSIZE); bytesWritten = ::write( filePara.fd , unsigned_inbuffer, number); waveform->newSamples( (const short *) unsigned_inbuffer, number ); @@ -268,5 +270,5 @@ void quickRec() total += bytesWritten; filePara.numberSamples = total; - // printf("\nWriting number %d, bytes %d,total %d \r",number, bytesWritten , total); + // printf("%d, bytes %d,total %d \r",number, bytesWritten , total); // fflush(stdout); if( filePara.SecondsToRecord !=0) @@ -498,5 +500,5 @@ void QtRec::init() { TabWidget = new QTabWidget( this, "TabWidget" ); - layout->addMultiCellWidget(TabWidget, 0, 7, 0, 7); + layout->addMultiCellWidget(TabWidget, 0, 7, 0, 8); // TabWidget->setTabShape(QTabWidget::Triangular); @@ -511,11 +513,11 @@ void QtRec::init() { layout1->addMultiCellWidget( timeSlider, 1, 1, 0, 3); - timeLabel = new QLabel( tab, "TimeLabel" ); - layout1->addMultiCellWidget( timeLabel, 0, 0, 0, 3); +// timeLabel = new QLabel( tab, "TimeLabel" ); +// layout1->addMultiCellWidget( timeLabel, 0, 0, 0, 3); - playLabel2 = new QLabel(tab, "PlayLabel2" ); - playLabel2->setText(tr("Play") ); - playLabel2->setFixedHeight( 18); - layout1->addMultiCellWidget( playLabel2, 0, 0, 4, 4); +// playLabel2 = new QLabel(tab, "PlayLabel2" ); +// playLabel2->setText(tr("Play") ); +// playLabel2->setFixedHeight( 18); +// layout1->addMultiCellWidget( playLabel2, 0, 0, 4, 4); Stop_PushButton = new QPushButton( tab, "Stop_PushButton" ); @@ -534,9 +536,9 @@ void QtRec::init() { toEndButton->setPixmap( Resource::loadPixmap( "fastforward" ) ); - QLabel *recLabel2; - recLabel2 = new QLabel( tab, "recLabel2" ); - recLabel2->setText(tr("Rec")); - recLabel2->setFixedHeight( 18); - layout1->addMultiCellWidget( recLabel2, 0, 0, 7, 7); +// QLabel *recLabel2; +// recLabel2 = new QLabel( tab, "recLabel2" ); +// recLabel2->setText(tr("Rec")); +// recLabel2->setFixedHeight( 18); +// layout1->addMultiCellWidget( recLabel2, 0, 0, 7, 7); Rec_PushButton = new QPushButton( tab, "Rec_PushButton" ); @@ -558,5 +560,5 @@ void QtRec::init() { deleteSoundButton = new QPushButton( tab, "deleteSoundButton" ); layout1->addMultiCellWidget( deleteSoundButton, 1, 1, 8, 8); - deleteSoundButton->setText( tr( "Delete" ) ); + deleteSoundButton->setText( tr( "Del" ) ); ListView1 = new QListView( tab, "IconView1" ); @@ -564,17 +566,19 @@ void QtRec::init() { ListView1->addColumn( tr( "Name" ) ); - ListView1->setColumnWidth( 0, 140); +// ListView1->setColumnWidth( 0, 140); ListView1->setSorting( 1, false); ListView1->addColumn( tr( "Time" ) ); //in seconds - ListView1->setColumnWidth( 1, 50); - ListView1->addColumn( tr("Location") ); - ListView1->setColumnWidth( 2, 50); - ListView1->addColumn( tr("Date") ); - ListView1->setColumnWidth( 3, 63); - - ListView1->setColumnWidthMode( 0, QListView::Manual); +// ListView1->setColumnWidth( 1, -1); +// ListView1->addColumn( tr("Location") ); +// ListView1->setColumnWidth( 2, -1); +// ListView1->addColumn( tr("Date") ); +// ListView1->setColumnWidth( 3, -1); + ListView1->setColumnWidthMode(0, QListView::Maximum); +// ListView1->setColumnWidthMode(1, QListView::Maximum); + +// ListView1->setColumnWidthMode( 0, QListView::Manual); ListView1->setColumnAlignment( 1, QListView::AlignCenter); - ListView1->setColumnAlignment( 2, QListView::AlignRight); - ListView1->setColumnAlignment( 3, QListView::AlignLeft); +// ListView1->setColumnAlignment( 2, QListView::AlignRight); +// ListView1->setColumnAlignment( 3, QListView::AlignLeft); ListView1->setAllColumnsShowFocus( true ); QPEApplication::setStylusOperation( ListView1->viewport(), QPEApplication::RightOnHold); @@ -647,5 +651,5 @@ void QtRec::init() { autoMuteCheckBox = new QCheckBox ( tr("Auto Mute"), tab_3 ); - stereoCheckBox = new QCheckBox ( tr("Stereo Channels"), tab_3 ); + stereoCheckBox = new QCheckBox ( tr("Stereo"), tab_3 ); glayout3->addMultiCellWidget( compressionCheckBox, 2, 2, 0, 3); @@ -708,5 +712,5 @@ void QtRec::init() { waveform->setMinimumSize( QSize( 0, 50 ) ); - layout->addMultiCellWidget( waveform, 8, 8, 0, 7 ); + layout->addMultiCellWidget( waveform, 8, 8, 0, 8); waveform->setBackgroundColor ( black ); } @@ -738,5 +742,5 @@ void QtRec::initIconView() { mediaLocation = getStorage( filePath); if( info.exists()) { - item = new QListViewItem( ListView1, temp, fileS, mediaLocation, fileDate); + item = new QListViewItem( ListView1, temp, fileS /*, mediaLocation, fileDate*/); item->setPixmap( 0, image0); if( currentFileName == filePath) @@ -876,9 +880,9 @@ void QtRec::doPlayBtn() { if(!stopped) { - playLabel2->setText(tr("Play")); +// playLabel2->setText(tr("Play")); stop(); } else { if(ListView1->currentItem() == 0) return; - playLabel2->setText(tr("Stop")); +// playLabel2->setText(tr("Stop")); currentFile = ListView1->currentItem()->text(0); start(); @@ -904,5 +908,5 @@ bool QtRec::rec() { //record QString timeString; timeString.sprintf("%.0f", 0.0); - timeLabel->setText( timeString+ " seconds"); +// timeLabel->setText( timeString+ " seconds"); if(!stopped) { monitoring = true; @@ -910,5 +914,5 @@ bool QtRec::rec() { //record } else { secCount = 1; - playLabel2->setText(tr("Stop")); +// playLabel2->setText(tr("Stop")); monitoring = false; setRecordButton( true); @@ -968,8 +972,9 @@ bool QtRec::rec() { //record #endif filePara.fileName=currentFile.latin1(); - odebug << "Start recording thread" << oendl; + odebug << "Start recording" << oendl; stopped = false; #ifdef THREADED + odebug << "Start recording thread" << oendl; pthread_t thread1; pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/); @@ -1189,5 +1194,5 @@ bool QtRec::doPlay() { timeString.sprintf("%f", filePara.numberOfRecordedSeconds); - timeLabel->setText( timeString+ tr(" seconds")); +// timeLabel->setText( timeString+ tr(" seconds")); QString msg; @@ -1477,5 +1482,5 @@ void QtRec::endRecording() { QString cmd; cmd.sprintf("mv "+ wavFile->trackName() + " " + wavFile->currentFileName); -// odebug << "moving tmp file to "+currentFileName << oendl; + odebug << "moving tmp file to "+currentFileName << oendl; system( cmd.latin1()); } @@ -1497,9 +1502,9 @@ void QtRec::endRecording() { time.sprintf("%.2f", filePara.numberOfRecordedSeconds); cfg.writeEntry( wavFile->currentFileName, time ); -// odebug << "writing config numberOfRecordedSeconds "+time << oendl; + odebug << "writing config numberOfRecordedSeconds "+time << oendl; cfg.write(); odebug << "finished recording" << oendl; - timeLabel->setText(""); +// timeLabel->setText(""); } @@ -1518,5 +1523,5 @@ void QtRec::endPlaying() { waveform->reset(); // errorStop(); -// odebug << "end playing" << oendl; + odebug << "end playing" << oendl; setRecordButton( false); @@ -1530,6 +1535,6 @@ void QtRec::endPlaying() { soundDevice->sd = -1; // if(soundDevice) delete soundDevice; -// odebug << "file and sound device closed" << oendl; - timeLabel->setText(""); + odebug << "file and sound device closed" << oendl; +// timeLabel->setText(""); total = 0; filePara.numberSamples = 0; @@ -1539,5 +1544,5 @@ void QtRec::endPlaying() { // if(wavFile) delete wavFile; //this crashes -// odebug << "track closed" << oendl; + odebug << "track closed" << oendl; killTimers(); owarn << "reset slider" << oendl; @@ -1865,5 +1870,5 @@ void QtRec::timerEvent( QTimerEvent * ) { timeString.sprintf("%d", secCount); - timeLabel->setText( timeString + " seconds"); +// timeLabel->setText( timeString + " seconds"); secCount++; @@ -1872,5 +1877,5 @@ void QtRec::timerEvent( QTimerEvent * ) { void QtRec::changeTimeSlider(int index) { if( ListView1->currentItem() == 0 || !wavFile->track.isOpen()) return; - // odebug << "Slider moved to " << index << "" << oendl; + odebug << "Slider moved to " << index << "" << oendl; paused = true; stopped = true; @@ -1882,10 +1887,10 @@ void QtRec::changeTimeSlider(int index) { timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds); secCount = (int)filePara.numberOfRecordedSeconds; - timeLabel->setText( timeString + tr(" seconds")); +// timeLabel->setText( timeString + tr(" seconds")); } void QtRec::timeSliderPressed() { if( ListView1->currentItem() == 0) return; - // odebug << "slider pressed" << oendl; + odebug << "slider pressed" << oendl; paused = true; stopped = true; @@ -1896,5 +1901,5 @@ void QtRec::timeSliderReleased() { sliderPos = timeSlider->value(); - // odebug << "slider released " << sliderPos << "" << oendl; + odebug << "slider released " << sliderPos << "" << oendl; stopped = false; int newPos = lseek( filePara.fd, sliderPos, SEEK_SET); @@ -1926,9 +1931,9 @@ void QtRec::rewindTimerTimeout() { // if(toBeginningButton->isDown()) timeSlider->setValue( sliderValue ) ; - // odebug << "" << sliderValue << "" << oendl; + odebug << "" << sliderValue << "" << oendl; QString timeString; filePara.numberOfRecordedSeconds = (float)sliderValue / (float)filePara.sampleRate * (float)2; timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds); - timeLabel->setText( timeString+ tr(" seconds")); +// timeLabel->setText( timeString+ tr(" seconds")); } @@ -1940,5 +1945,5 @@ void QtRec::rewindReleased() { int newPos = lseek( filePara.fd, sliderPos, SEEK_SET); total = newPos * 4; - // odebug << "rewind released " << total << "" << oendl; + odebug << "rewind released " << total << "" << oendl; startTimer( 1000); doPlay(); @@ -1972,5 +1977,5 @@ void QtRec::forwardTimerTimeout() { filePara.numberOfRecordedSeconds = (float)sliderValue / (float)filePara.sampleRate * (float)2; timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds); - timeLabel->setText( timeString+ tr(" seconds")); +// timeLabel->setText( timeString+ tr(" seconds")); } @@ -2028,5 +2033,5 @@ void QtRec::setRecordButton(bool b) { if(Stop_PushButton->isDown()) Stop_PushButton->setDown( true); - playLabel2->setText( tr("Stop") ); +// playLabel2->setText( tr("Stop") ); } else { //about to stop @@ -2036,5 +2041,5 @@ void QtRec::setRecordButton(bool b) { if(Stop_PushButton->isDown()) Stop_PushButton->setDown( false); - playLabel2->setText( tr("Play") ); +// playLabel2->setText( tr("Play") ); if(Rec_PushButton->isDown()) Rec_PushButton->setDown( false); 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 @@ -5,5 +5,5 @@ copyright 2002 by L.J. Potter ljp@llornkcor.com #ifndef QTREC_H #define QTREC_H -#define VERSION 20040101 +#define VERSION 20040628 #include <qpe/ir.h> |