-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 @@ -64,26 +64,26 @@ static int deviceBitRates[] = { 8, 16, -1 }; #endif #if defined(QT_QWS_SL5XXX) ///#if defined(QT_QWS_EBX) #define DSPSTROUT "/dev/dsp" #define DSPSTRIN "/dev/dsp1" #define DSPSTRMIXEROUT "/dev/mixer" #define DSPSTRMIXERIN "/dev/mixer1" #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" #endif //#define ZAURUS 0 struct adpcm_state encoder_state; struct adpcm_state decoder_state; typedef struct { int sampleRate; /* int fragSize; */ @@ -124,159 +124,161 @@ void quickRec() odebug << ( filePara.numberSamples/filePara.sampleRate * filePara.channels ) << oendl; odebug << "samples " << filePara.numberSamples << ", rate " << filePara.sampleRate << ", channels " << filePara.channels << oendl; int total = 0; // Total number of bytes read in so far. int bytesWritten, number; bytesWritten = 0; number = 0; QString num; 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 ]; short sbuf[ BUFSIZE ]; short sbuf2[ BUFSIZE ]; memset( abuf, 0, BUFSIZE/2); memset( sbuf, 0, BUFSIZE); memset( sbuf2, 0, BUFSIZE); for(;;) { if ( stopped) { -// odebug << "quickRec:: stopped" << oendl; + odebug << "quickRec:: stopped" << oendl; break; } // number=::read( filePara.sd, sbuf, BUFSIZE); number = soundDevice ->devRead( filePara.sd, sbuf, BUFSIZE); if(number <= 0) { perror("recording error "); odebug << "" << filePara.fileName << " " << number << "" << oendl; stopped = true; return; } //if(stereo == 2) { // adpcm_coder( sbuf2, abuf, number/2, &encoder_state); adpcm_coder( sbuf, abuf, number/2, &encoder_state); bytesWritten = ::write( filePara.fd , (short *)abuf, number/4); waveform->newSamples( sbuf, number ); total += bytesWritten; filePara.numberSamples = total; 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(); if( total >= filePara.samplesToRecord) { stopped = true; break; } } } else { // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_PCM >>>>>>>>>>>>>>>>>>>>>> odebug << "start recording WAVE_FORMAT_PCM" << oendl; short inbuffer[ BUFSIZE ], outbuffer[ BUFSIZE ]; memset( inbuffer, 0, BUFSIZE); memset( outbuffer, 0, BUFSIZE); for(;;) { if ( stopped) { odebug << "quickRec:: stopped" << oendl; stopped = true; break; // stop if playing was set to false return; } - number = soundDevice->devRead( filePara.sd, (short *)inbuffer, BUFSIZE); + number = soundDevice->devRead( soundDevice->sd /*filePara.sd*/, (short *)inbuffer, BUFSIZE); if( number <= 0) { perror( "recording error "); odebug << filePara.fileName << oendl; stopped = true; return; } bytesWritten = ::write( filePara.fd , inbuffer, number); waveform->newSamples( inbuffer, number ); if( bytesWritten < 0) { perror("File writing error "); stopped = true; return; } total += bytesWritten; filePara.numberSamples = total; 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 / (float)2/filePara.channels; qApp->processEvents(); if( total >= filePara.samplesToRecord) { stopped = true; break; } } } //end main loop } else { // <<<<<<<<<<<<<<<<<<<<<<< format = AFMT_U8; unsigned char unsigned_inbuffer[ BUFSIZE ], unsigned_outbuffer[ BUFSIZE ]; memset( unsigned_inbuffer, 0, BUFSIZE); memset( unsigned_outbuffer, 0, BUFSIZE); for(;;) { if ( stopped) { odebug << "quickRec:: stopped" << oendl; break; // stop if playing was set to false } - 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 ); if(bytesWritten < 0) { stopped = true; QMessageBox::message("Note","<p>There was a problem writing to the file</p>"); perror("File writing error "); return; } 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) timeSlider->setValue( total); filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate; qApp->processEvents(); if( total >= filePara.samplesToRecord) { stopped = true; break; } } //end main loop @@ -488,103 +490,105 @@ void QtRec::init() { needsStereoOut = false; QPixmap image3( ( const char** ) image3_data ); QPixmap image4( ( const char** ) image4_data ); QPixmap image6( ( const char** ) image6_data ); stopped = true; setCaption( tr( "OpieRecord " ) + QString::number(VERSION) ); QGridLayout *layout = new QGridLayout( this ); layout->setSpacing( 2); layout->setMargin( 2); TabWidget = new QTabWidget( this, "TabWidget" ); - layout->addMultiCellWidget(TabWidget, 0, 7, 0, 7); + layout->addMultiCellWidget(TabWidget, 0, 7, 0, 8); // TabWidget->setTabShape(QTabWidget::Triangular); ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** tab = new QWidget( TabWidget, "tab" ); QGridLayout *layout1 = new QGridLayout( tab); layout1->setSpacing( 2); layout1->setMargin( 2); timeSlider = new QSlider( 0,100,10,0, QSlider::Horizontal, tab, (const char *) "timeSlider" ); 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" ); layout1->addMultiCellWidget( Stop_PushButton, 1, 1, 4, 4); Stop_PushButton->setFixedSize( 22, 22); Stop_PushButton->setPixmap( image4 ); toBeginningButton = new QPushButton( tab, "Beginning_PushButton" ); layout1->addMultiCellWidget(toBeginningButton, 1, 1, 5, 5); toBeginningButton->setFixedSize( 22, 22); toBeginningButton->setPixmap( Resource::loadPixmap("fastback") ); toEndButton = new QPushButton( tab, "End_PushButton" ); layout1->addMultiCellWidget( toEndButton, 1, 1, 6, 6); toEndButton->setFixedSize( 22, 22); 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" ); layout1->addMultiCellWidget( Rec_PushButton, 1, 1, 7, 7); Rec_PushButton->setFixedSize( 22, 22); Rec_PushButton->setPixmap( image6 ); t = new QTimer( this ); connect( t, SIGNAL( timeout() ), SLOT( timerBreak() ) ); rewindTimer = new QTimer( this ); connect( rewindTimer, SIGNAL( timeout() ), this, SLOT( rewindTimerTimeout() ) ); forwardTimer = new QTimer( this ); connect( forwardTimer, SIGNAL( timeout() ), this, SLOT( forwardTimerTimeout() ) ); 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" ); layout1->addMultiCellWidget( ListView1, 2, 2, 0, 8); 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); TabWidget->insertTab( tab, tr( "Files" ) ); ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** tab_3 = new QWidget( TabWidget, "tab_3" ); QGridLayout *glayout3 = new QGridLayout( tab_3 ); glayout3->setSpacing( 2); glayout3->setMargin( 2); //////////////////////////////////// sampleGroup = new QGroupBox( tab_3, "samplegroup" ); @@ -637,25 +641,25 @@ void QtRec::init() { while( deviceBitRates[z] != -1) { bitRateComboBox->insertItem( s.setNum( deviceBitRates[z], 10) ); z++; } bitRateComboBox->setGeometry( QRect( 5, 20, 50, 25 ) ); glayout3->addMultiCellWidget( bitGroup, 1, 1, 1, 1); compressionCheckBox = new QCheckBox ( tr("Wave Compression (smaller files)"), tab_3 ); 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); glayout3->addMultiCellWidget( autoMuteCheckBox, 3, 3, 0, 0); glayout3->addMultiCellWidget( stereoCheckBox, 3, 3, 1, 1); tab_5 = new QWidget( TabWidget, "tab_5" ); QHBoxLayout *Layout19a; Layout19a = new QHBoxLayout( tab_5); Layout19a->setSpacing( 2 ); Layout19a->setMargin( 0 ); @@ -698,25 +702,25 @@ void QtRec::init() { fillDirectoryCombo(); TabWidget->insertTab( tab_3, tr( "Options" ) ); TabWidget->insertTab( tab_5, tr( "Volume" ) ); waveform = new Waveform( this, "waveform" ); // waveform->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)3, waveform->sizePolicy().hasHeightForWidth() ) ); waveform->setMinimumSize( QSize( 0, 50 ) ); - layout->addMultiCellWidget( waveform, 8, 8, 0, 7 ); + layout->addMultiCellWidget( waveform, 8, 8, 0, 8); waveform->setBackgroundColor ( black ); } void QtRec::initIconView() { ListView1->clear(); Config cfg("OpieRec"); cfg.setGroup("Sounds"); QString temp; QPixmap image0( ( const char** ) image0_data ); int nFiles = cfg.readNumEntry("NumberofFiles",0); @@ -728,25 +732,25 @@ void QtRec::initIconView() { QString fileS, mediaLocation, fileDate, filePath; temp.sprintf( "%d",i); temp = cfg.readEntry( temp,""); //reads currentFile filePath = cfg.readEntry( temp,""); //currentFileName QFileInfo info(filePath); fileDate = info.lastModified().toString(); fileS = cfg.readEntry( filePath, "0" );// file length in seconds 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) ListView1->setSelected( item, true); } } } void QtRec::initConnections() { connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); connect( toBeginningButton, SIGNAL( pressed()), this, SLOT( rewindPressed() )); @@ -866,59 +870,59 @@ void QtRec::stop() { setRecordButton(false); if( !recording) endPlaying(); else endRecording(); timeSlider->setValue(0); } 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(); } } void QtRec::start() { //play if( stopped) { QPixmap image3( ( const char** ) image3_data ); Stop_PushButton->setPixmap( image3 ); Stop_PushButton->setDown( true); stopped = false; paused = false; secCount = 1; if( openPlayFile()) if( setupAudio( false)) //recording is false doPlay(); } } bool QtRec::rec() { //record QString timeString; timeString.sprintf("%.0f", 0.0); - timeLabel->setText( timeString+ " seconds"); +// timeLabel->setText( timeString+ " seconds"); if(!stopped) { monitoring = true; return false; } else { secCount = 1; - playLabel2->setText(tr("Stop")); +// playLabel2->setText(tr("Stop")); monitoring = false; setRecordButton( true); if( setupAudio( true)) if(setUpFile()) { int fileSize = 0; Config cfg("OpieRec"); cfg.setGroup("Settings"); // odebug << "<<<<<<<Device bits " << soundDevice->getDeviceBits() // << ", device rate " << soundDevice->getDeviceRate() // << ", device channels " << soundDevice->getDeviceChannels() << oendl; @@ -958,28 +962,29 @@ bool QtRec::rec() { //record tr("Low Disk Space"), tr("You are running low of\nrecording space\n" "or a card isn't being recognized")); stopped = true; //we need to be stopped stop(); } else { QString msg; msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); #ifdef DEV_VERSION setCaption( msg); #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/* &*/); #endif toBeginningButton->setEnabled( false); toEndButton->setEnabled( false); startTimer(1000); #ifndef THREADED quickRec(); #endif } } //end setUpFile @@ -1179,25 +1184,25 @@ bool QtRec::doPlay() { secCount = (int)filePara.numberOfRecordedSeconds; } playing = true; stopped = false; recording = false; QString num; odebug << "Play number of samples " << filePara.numberSamples << "" << oendl; // timeSlider->setRange( 0, filePara.numberSamples); timeString.sprintf("%f", filePara.numberOfRecordedSeconds); - timeLabel->setText( timeString+ tr(" seconds")); +// timeLabel->setText( timeString+ tr(" seconds")); QString msg; msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); #ifdef DEV_VERSION setCaption( msg); #endif startTimer( 1000); #ifdef THREADED @@ -1467,87 +1472,87 @@ void QtRec::endRecording() { if( wavFile->track.isOpen()) { wavFile->adjustHeaders( filePara.fd, filePara.numberSamples); // soundDevice->sd=-1; filePara.numberSamples = 0; // filePara.sd=-1; wavFile->closeFile(); filePara.fd=0; if( wavFile->isTempFile()) { // move tmp file to regular file 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()); } odebug << "Just moved " + wavFile->currentFileName << oendl; Config cfg("OpieRec"); cfg.setGroup("Sounds"); int nFiles = cfg.readNumEntry( "NumberofFiles",0); currentFile = QFileInfo( wavFile->currentFileName).fileName(); currentFile = currentFile.left( currentFile.length() - 4); cfg.writeEntry( "NumberofFiles", nFiles + 1); cfg.writeEntry( QString::number( nFiles + 1), currentFile); cfg.writeEntry( currentFile, wavFile->currentFileName); QString time; 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(""); } // if(soundDevice) delete soundDevice; timeSlider->setValue(0); initIconView(); selectItemByName( currentFile); } void QtRec::endPlaying() { monitoring = false; recording = false; playing = false; stopped = true; waveform->reset(); // errorStop(); -// odebug << "end playing" << oendl; + odebug << "end playing" << oendl; setRecordButton( false); toBeginningButton->setEnabled( true); toEndButton->setEnabled( true); if(autoMute) doMute( true); soundDevice->closeDevice( false); 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; filePara.sd = -1; // wavFile->closeFile(); filePara.fd = 0; // if(wavFile) delete wavFile; //this crashes -// odebug << "track closed" << oendl; + odebug << "track closed" << oendl; killTimers(); owarn << "reset slider" << oendl; timeSlider->setValue(0); // if(soundDevice) delete soundDevice; } bool QtRec::openPlayFile() { qApp->processEvents(); if( currentFile.isEmpty()) { @@ -1855,56 +1860,56 @@ void QtRec::timerEvent( QTimerEvent * ) { stop(); } odebug << "" << secCount << "" << oendl; QString timeString; #ifdef DEV_VERSION QString msg; msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); setCaption( msg +" :: "+QString::number(secCount)); #endif timeString.sprintf("%d", secCount); - timeLabel->setText( timeString + " seconds"); +// timeLabel->setText( timeString + " seconds"); secCount++; } 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; sliderPos=index; QString timeString; filePara.numberOfRecordedSeconds = (float)sliderPos / (float)filePara.sampleRate * (float)2; 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; } void QtRec::timeSliderReleased() { if( ListView1->currentItem() == 0) return; sliderPos = timeSlider->value(); - // odebug << "slider released " << sliderPos << "" << oendl; + odebug << "slider released " << sliderPos << "" << oendl; stopped = false; int newPos = lseek( filePara.fd, sliderPos, SEEK_SET); total = newPos*4; filePara.numberOfRecordedSeconds = (float)sliderPos / (float)filePara.sampleRate * (float)2; doPlay(); } void QtRec::rewindPressed() { if( ListView1->currentItem() == 0) return; if( !wavFile->track.isOpen()) { if( !openPlayFile() ) @@ -1916,39 +1921,39 @@ void QtRec::rewindPressed() { killTimers(); paused = true; stopped = true; rewindTimer->start( 50, false); } } void QtRec::rewindTimerTimeout() { int sliderValue = timeSlider->value(); sliderValue = sliderValue - ( filePara.numberSamples / 100); // 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")); } void QtRec::rewindReleased() { rewindTimer->stop(); if( wavFile->track.isOpen()) { sliderPos=timeSlider->value(); stopped = false; int newPos = lseek( filePara.fd, sliderPos, SEEK_SET); total = newPos * 4; - // odebug << "rewind released " << total << "" << oendl; + odebug << "rewind released " << total << "" << oendl; startTimer( 1000); doPlay(); } } void QtRec::FastforwardPressed() { if( ListView1->currentItem() == 0) return; if( !wavFile->track.isOpen()) if( !openPlayFile() ) return; else if( !setupAudio( false)) @@ -1962,25 +1967,25 @@ void QtRec::FastforwardPressed() { void QtRec::forwardTimerTimeout() { int sliderValue = timeSlider->value(); sliderValue = sliderValue + ( filePara.numberSamples / 100); // if(toEndButton->isDown()) timeSlider->setValue( sliderValue); 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")); } void QtRec::FastforwardReleased() { forwardTimer->stop(); if( wavFile->track.isOpen()) { sliderPos=timeSlider->value(); stopped = false; int newPos = lseek( filePara.fd, sliderPos, SEEK_SET); total = newPos * 4; filePara.numberOfRecordedSeconds = (float)sliderPos / (float)filePara.sampleRate * (float)2; startTimer( 1000); doPlay(); @@ -2018,33 +2023,33 @@ QString QtRec::getStorage(const QString &fileName) { // endmntent( mntfp ); } void QtRec::setRecordButton(bool b) { if(b) { //about to record or play Rec_PushButton->setDown( true); QPixmap image3( ( const char** ) image3_data ); Stop_PushButton->setPixmap( image3 ); if(Stop_PushButton->isDown()) Stop_PushButton->setDown( true); - playLabel2->setText( tr("Stop") ); +// playLabel2->setText( tr("Stop") ); } else { //about to stop QPixmap image4( ( const char** ) image4_data ); Stop_PushButton->setPixmap( image4); if(Stop_PushButton->isDown()) Stop_PushButton->setDown( false); - playLabel2->setText( tr("Play") ); +// playLabel2->setText( tr("Play") ); if(Rec_PushButton->isDown()) Rec_PushButton->setDown( false); } } void QtRec::fillDirectoryCombo() { if( directoryComboBox->count() > 0) directoryComboBox->clear(); int index = 0; Config cfg("OpieRec"); cfg.setGroup("Settings"); QString dir = cfg.readEntry("directory", "/"); 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,19 +1,19 @@ /**************************************************************************** ** Created: Thu Jan 17 11:19:45 2002 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> #include <qfile.h> #include <qimage.h> #include <qlineedit.h> #include <qpixmap.h> #include <qvariant.h> #include <qwidget.h> #include <stdio.h> #include <stdlib.h> |