Diffstat (limited to 'noncore/multimedia/opierec/qtrec.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opierec/qtrec.cpp | 123 |
1 files changed, 63 insertions, 60 deletions
diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp index e827083..9b761aa 100644 --- a/noncore/multimedia/opierec/qtrec.cpp +++ b/noncore/multimedia/opierec/qtrec.cpp @@ -119,9 +119,9 @@ void quickRec() 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; @@ -130,3 +130,3 @@ void quickRec() 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 >>>>>>>>>>>>>>>>>>>>>> @@ -158,3 +158,3 @@ void quickRec() - bytesWritten = ::write( filePara.fd , (short *)abuf, number/4); + bytesWritten = ::write( filePara.fd , abuf, number/4); @@ -166,6 +166,6 @@ void quickRec() - printf("%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; + filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2;// / filePara.channels; @@ -216,4 +216,4 @@ void quickRec() timeSlider->setValue( total); - printf("%d, bytes %d,total %d\r",number, bytesWritten , total); - fflush(stdout); + printf("%d, bytes %d,total %d\r",number, bytesWritten , total); + fflush(stdout); @@ -303,4 +303,6 @@ void playIt() // } - bytesWritten = write ( filePara.sd, sbuf, number * 4); - waveform->newSamples( (const short *)sbuf, number *4); + bytesWritten = write ( soundDevice->sd , sbuf, number * 4); + + waveform->newSamples( sbuf, number ); + // if(filePara.channels==1) @@ -344,3 +346,3 @@ void playIt() // } - bytesWritten = ::write( filePara.sd, inbuffer, number); + bytesWritten = ::write( soundDevice->sd, inbuffer, number); waveform->newSamples( inbuffer, number); @@ -434,3 +436,3 @@ QtRec::QtRec( QWidget* parent, const char* name, WFlags fl ) // if( soundDevice) delete soundDevice; - QTimer::singleShot(100,this, SLOT(initIconView())); + QTimer::singleShot(100,this, SLOT(initIconView())); @@ -790,4 +792,4 @@ void QtRec::initConfig() { if( compressionCheckBox->isChecked()) { + bitRateComboBox->setCurrentItem(1); bitRateComboBox->setEnabled(false); - bitRateComboBox->setCurrentItem(0); filePara.resolution=16; @@ -1050,3 +1052,3 @@ bool QtRec::setupAudio( bool b) { // if(soundDevice) delete soundDevice; - odebug << "<<<<<<<<<<<<<<<<<<<open dsp " << filePara.sampleRate << " " << filePara.channels << " " << sampleformat << "" << oendl; + owarn << "<<<<<<<<<<<<<<<<<<<open dsp " << filePara.sampleRate << " " << filePara.channels << " " << sampleformat << "" << oendl; // owarn << "change waveform settings" << oendl; @@ -1232,34 +1234,34 @@ void QtRec::deleteSound() { // { - QString file = ListView1->currentItem()->text(0); - QString fileName; - fileName = cfg.readEntry( file, ""); - QFile f( fileName); - if( f.exists()) - if( !f.remove()) - QMessageBox::message( tr("Error"), tr("Could not remove file.")); - - int nFiles = cfg.readNumEntry( "NumberofFiles",0); - bool found = false; - for(int i=0;i<nFiles+1;i++) { - - if( cfg.readEntry( QString::number(i),"").find( file,0,true) != -1) { - found = true; - cfg.writeEntry( QString::number(i), cfg.readEntry( QString::number(i+1),"")); - } - if(found) - cfg.writeEntry( QString::number(i), cfg.readEntry( QString::number(i+1),"")); - } - - cfg.removeEntry( cfg.readEntry( file)); - cfg.removeEntry( file); - cfg.writeEntry( "NumberofFiles", nFiles-1); - cfg.write(); - - ListView1->takeItem( ListView1->currentItem() ); - delete ListView1->currentItem(); - - ListView1->clear(); - ListView1->setSelected( ListView1->firstChild(), true); - initIconView(); - update(); + QString file = ListView1->currentItem()->text(0); + QString fileName; + fileName = cfg.readEntry( file, ""); + QFile f( fileName); + if( f.exists()) + if( !f.remove()) + QMessageBox::message( tr("Error"), tr("Could not remove file.")); + + int nFiles = cfg.readNumEntry( "NumberofFiles",0); + bool found = false; + for(int i=0;i<nFiles+1;i++) { + + if( cfg.readEntry( QString::number(i),"").find( file,0,true) != -1) { + found = true; + cfg.writeEntry( QString::number(i), cfg.readEntry( QString::number(i+1),"")); + } + if(found) + cfg.writeEntry( QString::number(i), cfg.readEntry( QString::number(i+1),"")); + } + + cfg.removeEntry( cfg.readEntry( file)); + cfg.removeEntry( file); + cfg.writeEntry( "NumberofFiles", nFiles-1); + cfg.write(); + + ListView1->takeItem( ListView1->currentItem() ); + delete ListView1->currentItem(); + + ListView1->clear(); + ListView1->setSelected( ListView1->firstChild(), true); + initIconView(); + update(); setCaption( tr( "OpieRecord " )); @@ -1411,3 +1413,3 @@ void QtRec::endRecording() { cmd.sprintf("mv "+ wavFile->trackName() + " " + wavFile->currentFileName); - odebug << "moving tmp file to "+currentFileName << oendl; + odebug << "moving tmp file to "+currentFileName << oendl; system( cmd.latin1()); @@ -1431,3 +1433,3 @@ void QtRec::endRecording() { cfg.writeEntry( wavFile->currentFileName, time ); - odebug << "writing config numberOfRecordedSeconds "+time << oendl; + odebug << "writing config numberOfRecordedSeconds "+time << oendl; @@ -1485,6 +1487,6 @@ void QtRec::endPlaying() { bool QtRec::openPlayFile() { - + qWarning("opening file"); qApp->processEvents(); if( currentFile.isEmpty()) { - QMessageBox::message(tr("Opierec"),tr("Please select file to play")); + QMessageBox::message(tr("Opierec"),tr("Please select file to play")); endPlaying(); @@ -1728,4 +1730,5 @@ void QtRec::compressionSelected(bool b) { if(b) { - bitRateComboBox->setEnabled( false); + qWarning("set adpcm"); bitRateComboBox->setCurrentItem( 1); + bitRateComboBox->setEnabled( false); filePara.resolution = 16; @@ -1803,3 +1806,3 @@ 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; @@ -1818,3 +1821,3 @@ void QtRec::timeSliderPressed() { if( ListView1->currentItem() == 0) return; - odebug << "slider pressed" << oendl; + odebug << "slider pressed" << oendl; paused = true; @@ -1827,3 +1830,3 @@ void QtRec::timeSliderReleased() { - odebug << "slider released " << sliderPos << "" << oendl; + odebug << "slider released " << sliderPos << "" << oendl; stopped = false; @@ -1857,3 +1860,3 @@ void QtRec::rewindTimerTimeout() { timeSlider->setValue( sliderValue ) ; - odebug << "" << sliderValue << "" << oendl; + odebug << "" << sliderValue << "" << oendl; QString timeString; @@ -1871,3 +1874,3 @@ void QtRec::rewindReleased() { total = newPos * 4; - odebug << "rewind released " << total << "" << oendl; + odebug << "rewind released " << total << "" << oendl; startTimer( 1000); |