-rw-r--r-- | noncore/multimedia/opierec/qtrec.cpp | 178 |
1 files changed, 91 insertions, 87 deletions
diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp index 2187d5a..6eb6524 100644 --- a/noncore/multimedia/opierec/qtrec.cpp +++ b/noncore/multimedia/opierec/qtrec.cpp @@ -114,16 +114,16 @@ Waveform* waveform; Device *soundDevice; #ifdef THREADED void quickRec() #else - void QtRec::quickRec() + void QtRec::quickRec() #endif { - + qDebug("%d", filePara.numberSamples/filePara.sampleRate * filePara.channels); qDebug("samples %d, rate %d, channels %d", filePara.numberSamples, filePara.sampleRate, filePara.channels); int total = 0; // Total number of bytes read in so far. @@ -132,92 +132,93 @@ void quickRec() bytesWritten = 0; number = 0; QString num; int level = 0; int threshold = 0; // int bits = filePara.resolution; -// odebug << "bits " << bits << "" << oendl; +// 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; - // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_DVI_ADPCM >>>>>>>>>>>>>>>>>>>>>> +// 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; + 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( (const short *)abuf, bytesWritten ); + waveform->newSamples( sbuf, number ); total += bytesWritten; filePara.numberSamples = total; timeSlider->setValue( total); - filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2 / filePara.channels; + 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; + 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; + odebug << "quickRec:: stopped" << oendl; stopped = true; break; // stop if playing was set to false return; } number = soundDevice->devRead( filePara.sd, (short *)inbuffer, BUFSIZE); - waveform->newSamples( inbuffer, number ); if( number <= 0) { perror( "recording error "); - odebug << filePara.fileName << oendl; + 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; } @@ -228,13 +229,14 @@ void quickRec() if( filePara.SecondsToRecord != 0) timeSlider->setValue( total); // printf("Writing number %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; qApp->processEvents(); if( total >= filePara.samplesToRecord) { stopped = true; break; } @@ -246,22 +248,23 @@ void quickRec() 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; + odebug << "quickRec:: stopped" << oendl; break; // stop if playing was set to false } - + number = ::read( 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","There was a problem\nwriting to the file"); + QMessageBox::message("Note","<p>There was a problem writing to the file</p>"); perror("File writing error "); return; } total += bytesWritten; filePara.numberSamples = total; @@ -310,13 +313,13 @@ void playIt() adpcm_decoder( abuf, sbuf, number * 2, &decoder_state); // for (int i=0;i< number * 2; 2 * i++) { //2*i is left channel // sbuf2[i+1]=sbuf2[i]=sbuf[i]; // } bytesWritten = write ( filePara.sd, sbuf, number * 4); - waveform->newSamples( (const short *)sbuf, number ); + waveform->newSamples( (const short *)sbuf, number *4); // if(filePara.channels==1) // total += bytesWritten/2; //mono // else total += bytesWritten; filePara.numberSamples = total/4; filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / 2; @@ -351,13 +354,13 @@ void playIt() number = ::read( filePara.fd, inbuffer, BUFSIZE); // for (int i=0;i< number * 2; 2 * i++) { //2*i is left channel // // for (int i=0;i< number ; i++) { //2*i is left channel // outbuffer[i+1]= outbuffer[i]=inbuffer[i]; // } bytesWritten = ::write( filePara.sd, inbuffer, number); - waveform->newSamples( inbuffer, bytesWritten ); + waveform->newSamples( inbuffer, number); //-------------->>>> out to device // total+=bytesWritten; // if(filePara.channels==1) // total += bytesWritten/2; //mono // else total += bytesWritten; @@ -369,20 +372,20 @@ void playIt() // timeString.sprintf("%.2f",filePara.numberOfRecordedSeconds); // timeLabel->setText( timeString + tr(" seconds")); qApp->processEvents(); if( /*total >= filePara.numberSamples || */ bytesWritten == 0) { - owarn << "Jane! Stop this crazy thing!" << oendl; + owarn << "Jane! Stop this crazy thing!" << oendl; stopped = true; // playing = false; break; } } - printf("\nplaying number %d, bytes %d, total %d\r",number, bytesWritten, total); - fflush(stdout); +// printf("\nplaying number %d, bytes %d, total %d\r",number, bytesWritten, total); +// fflush(stdout); } //end loop } else { /////////////////////////////// format = AFMT_U8; unsigned char unsigned_inbuffer[ BUFSIZE ]; //, unsigned_outbuffer[BUFSIZE]; memset( unsigned_inbuffer, 0, BUFSIZE); for(;;) { @@ -429,13 +432,13 @@ QtRec::QtRec( QWidget* parent, const char* name, WFlags fl ) renameBox = 0; // open sound device to get volumes Config hwcfg("OpieRec"); hwcfg.setGroup("Hardware"); - + soundDevice = new Device( this, hwcfg.readEntry( "Audio",DSPSTROUT), hwcfg.readEntry( "Mixer",DSPSTRMIXEROUT), false); // soundDevice = new Device( this, hwcfg.readEntry( "Audio","hw:0"), hwcfg.readEntry( "Mixer","hw:0"), false); // soundDevice->setDeviceFormat(AFMT_S16_LE); @@ -447,23 +450,24 @@ QtRec::QtRec( QWidget* parent, const char* name, WFlags fl ) soundDevice->closeDevice( true); soundDevice->sd = -1; soundDevice = 0; wavFile = 0; - if( soundDevice) delete soundDevice; +// if( soundDevice) delete soundDevice; initIconView(); if( autoMute) doMute( true); ListView1->setFocus(); playing = false; } QtRec::~QtRec() { +// if( soundDevice) delete soundDevice; } void QtRec::cleanUp() { if( !stopped) { @@ -473,13 +477,13 @@ void QtRec::cleanUp() { ListView1->clear(); if( autoMute) doMute(false); - if( wavFile) delete wavFile; +// if( wavFile) delete wavFile; // if(soundDevice) delete soundDevice; } void QtRec::init() { needsStereoOut = false; @@ -714,13 +718,13 @@ void QtRec::initIconView() { Config cfg("OpieRec"); cfg.setGroup("Sounds"); QString temp; QPixmap image0( ( const char** ) image0_data ); int nFiles = cfg.readNumEntry("NumberofFiles",0); -// odebug << "init number of files " << nFiles << "" << oendl; +// odebug << "init number of files " << nFiles << "" << oendl; for(int i=1;i<= nFiles;i++) { QListViewItem * item; QString fileS, mediaLocation, fileDate, filePath; @@ -775,13 +779,13 @@ void QtRec::initConnections() { this, SLOT( changeDirCombo(int)) ); connect( sizeLimitCombo, SIGNAL(activated(int)), this, SLOT( changeSizeLimitCombo(int)) ); connect( stereoCheckBox, SIGNAL(toggled(bool)), this, SLOT( changeStereoCheck(bool)) ); - + connect( outMuteCheckBox, SIGNAL(toggled(bool)), this, SLOT( doVolMuting(bool)) ); connect( inMuteCheckBox , SIGNAL(toggled(bool)), this, SLOT( doMicMuting(bool)) ); connect( ListView1,SIGNAL(doubleClicked(QListViewItem*)), @@ -856,13 +860,13 @@ void QtRec::initConfig() { cofg.setGroup( "Volume"); outMuteCheckBox->setChecked( cofg.readBoolEntry( "Mute",0)); inMuteCheckBox->setChecked( cofg.readBoolEntry( "MicMute",0)); } void QtRec::stop() { - owarn << "STOP" << oendl; + owarn << "STOP" << oendl; setRecordButton(false); if( !recording) endPlaying(); else endRecording(); @@ -918,38 +922,38 @@ bool QtRec::rec() { //record // qDebug( "<<<<<<<Device bits %d, device rate %d, device channels %d", // soundDevice->getDeviceBits(), // soundDevice->getDeviceRate(), // soundDevice->getDeviceChannels()); //filePara.sampleRate = cfg.readNumEntry("samplerate", 22050); -// odebug << "sample rate is " << filePara.sampleRate << "" << oendl; +// odebug << "sample rate is " << filePara.sampleRate << "" << oendl; filePara.SecondsToRecord = getCurrentSizeLimit(); -// odebug << "size limit " << filePara.SecondsToRecord << " sec" << oendl; +// odebug << "size limit " << filePara.SecondsToRecord << " sec" << oendl; int diskSize = checkDiskSpace( (const QString &) wavFile->trackName()); if( filePara.SecondsToRecord == 0) { fileSize = diskSize; } else if( filePara.format == WAVE_FORMAT_PCM) { -// odebug << "WAVE_FORMAT_PCM" << oendl; +// odebug << "WAVE_FORMAT_PCM" << oendl; fileSize = (filePara.SecondsToRecord ) * filePara.channels * filePara.sampleRate * ( filePara.resolution / 8) + 1000; } else { -// odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl; +// odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl; fileSize = ((filePara.SecondsToRecord) * filePara.channels * filePara.sampleRate * ( filePara.resolution / 8) ) / 4 + 250; } filePara.samplesToRecord = fileSize; qDebug("filesize should be %d, bits %d, rate %d", filePara.samplesToRecord, filePara.resolution, filePara.sampleRate); if( paused) { paused = false; } // else { - odebug << "Setting timeslider " << filePara.samplesToRecord << "" << oendl; + odebug << "Setting timeslider " << filePara.samplesToRecord << "" << oendl; // if(fileSize != 0) timeSlider->setRange(0, filePara.samplesToRecord); // } if( diskSize < fileSize/1024) { QMessageBox::warning(this, @@ -962,13 +966,13 @@ bool QtRec::rec() { //record 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 thread" << oendl; stopped = false; #ifdef THREADED pthread_t thread1; pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/); #endif @@ -998,27 +1002,27 @@ void QtRec::thisTab(QWidget* widg) { // soundDevice->getOutVol(); // soundDevice->getInVol(); } if( index==2) { //help page } - + qApp->processEvents(); update(); } } void QtRec::getOutVol( ) { filePara.outVol = soundDevice->getOutVolume(); -// odebug << "out vol " << filePara.outVol << "" << oendl; +// odebug << "out vol " << filePara.outVol << "" << oendl; OutputSlider->setValue( -filePara.outVol); } void QtRec::getInVol() { filePara.inVol = soundDevice->getInVolume(); -// odebug << "in vol " << filePara.inVol << "" << oendl; +// odebug << "in vol " << filePara.inVol << "" << oendl; InputSlider->setValue( -filePara.inVol); } void QtRec::changedOutVolume() { soundDevice->changedOutVolume( -OutputSlider->value()); } @@ -1058,13 +1062,13 @@ bool QtRec::setupAudio( bool b) { filePara.resolution = 16; } else { sampleformat = AFMT_U8; filePara.resolution = 8; } #endif - + stereo = filePara.channels; flags = O_WRONLY; Config hwcfg("OpieRec"); hwcfg.setGroup("Hardware"); dspString = hwcfg.readEntry( "Audio", DSPSTROUT); mixerString = hwcfg.readEntry( "Mixer", DSPSTRMIXEROUT); @@ -1086,41 +1090,41 @@ bool QtRec::setupAudio( bool b) { sampleformat = AFMT_S16_LE; else sampleformat = AFMT_U8; if( !compressionCheckBox->isChecked()) { filePara.format = WAVE_FORMAT_PCM; -// odebug << "WAVE_FORMAT_PCM" << oendl; +// odebug << "WAVE_FORMAT_PCM" << oendl; } else { filePara.format = WAVE_FORMAT_DVI_ADPCM; sampleformat = AFMT_S16_LE; -// odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl; +// odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl; } #endif - + stereo = filePara.channels; // filePara.sampleRate = sampleRateComboBox->currentText().toInt( &ok,10);//44100; flags= O_RDWR; // flags= O_RDONLY; Config hwcfg("OpieRec"); hwcfg.setGroup("Hardware"); dspString = hwcfg.readEntry( "Audio", DSPSTRIN); mixerString = hwcfg.readEntry( "Mixer", DSPSTRMIXERIN); recording = true; } // if(soundDevice) delete soundDevice; - odebug << "<<<<<<<<<<<<<<<<<<<open dsp " << filePara.sampleRate << " " << filePara.channels << " " << sampleformat << "" << oendl; - owarn << "change waveform settings" << oendl; + odebug << "<<<<<<<<<<<<<<<<<<<open dsp " << filePara.sampleRate << " " << filePara.channels << " " << sampleformat << "" << oendl; + owarn << "change waveform settings" << oendl; waveform->changeSettings( filePara.sampleRate, filePara.channels ); soundDevice = new Device( this, dspString, mixerString, b); // soundDevice->openDsp(); soundDevice->reset(); - odebug << "device has been made " << soundDevice->sd << "" << oendl; + odebug << "device has been made " << soundDevice->sd << "" << oendl; ////////////////// <<<<<<<<<<<<>>>>>>>>>>>> soundDevice->setDeviceFormat( sampleformat); soundDevice->setDeviceChannels( filePara.channels); soundDevice->setDeviceRate( filePara.sampleRate); soundDevice->getDeviceFragSize(); @@ -1145,13 +1149,13 @@ bool QtRec::setupAudio( bool b) { return true; } bool QtRec::setUpFile() { //setup file for recording -// odebug << "Setting up wavfile" << oendl; +// odebug << "Setting up wavfile" << oendl; // if(wavFile) delete wavFile; wavFile = new WavFile( this, (const QString &)"", true, filePara.sampleRate, filePara.channels, filePara.resolution, @@ -1178,13 +1182,13 @@ bool QtRec::doPlay() { } playing = true; stopped = false; recording = false; QString num; - odebug << "Play number of samples " << filePara.numberSamples << "" << oendl; + odebug << "Play number of samples " << filePara.numberSamples << "" << oendl; // timeSlider->setRange( 0, filePara.numberSamples); timeString.sprintf("%f", filePara.numberOfRecordedSeconds); timeLabel->setText( timeString+ tr(" seconds")); @@ -1199,13 +1203,13 @@ bool QtRec::doPlay() { startTimer( 1000); #ifdef THREADED pthread_t thread2; pthread_create( &thread2, NULL, (void * (*)(void *))playIt, NULL/* &*/); #endif - + toBeginningButton->setEnabled( false); toEndButton->setEnabled( false); #ifndef THREADED playIt(); #endif return true; @@ -1230,13 +1234,13 @@ void QtRec::changesamplerateCombo(int i) { cfg.setGroup("Settings"); int rate=0; bool ok; rate = sampleRateComboBox->text(i).toInt(&ok, 10); cfg.writeEntry( "samplerate",rate); filePara.sampleRate=rate; - odebug << "Change sample rate " << rate << "" << oendl; + odebug << "Change sample rate " << rate << "" << oendl; cfg.write(); } void QtRec::changeDirCombo(int index) { Config cfg("OpieRec"); @@ -1250,13 +1254,13 @@ void QtRec::changeDirCombo(int index) { for( ; it.current(); ++it ){ if( sName == (*it)->name()+" "+ (*it)->path() || (*it)->name() == sName ) { const QString path = (*it)->path(); recDir = path; cfg.writeEntry("directory", recDir); - odebug << "new rec dir "+recDir << oendl; + odebug << "new rec dir "+recDir << oendl; } } cfg.write(); } @@ -1370,13 +1374,13 @@ void QtRec::keyPressEvent( QKeyEvent *e) { // stop(); break; case Key_Down: // newSound(); break; case Key_Left: { - odebug << "rewinding" << oendl; + odebug << "rewinding" << oendl; if( !e->isAutoRepeat()) rewindPressed(); } break; case Key_Right: { if( !e->isAutoRepeat()) @@ -1424,25 +1428,25 @@ void QtRec::keyReleaseEvent( QKeyEvent *e) { break; case Key_Delete: deleteSound(); break; case Key_Up: // stop(); - odebug << "Up" << oendl; + odebug << "Up" << oendl; break; case Key_Down: // start(); - // odebug << "Down" << oendl; + // odebug << "Down" << oendl; // newSound(); break; case Key_Left: - odebug << "Left" << oendl; + odebug << "Left" << oendl; rewindReleased(); break; case Key_Right: - odebug << "Right" << oendl; + odebug << "Right" << oendl; FastforwardReleased(); break; } } void QtRec::endRecording() { @@ -1471,17 +1475,17 @@ void QtRec::endRecording() { 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; + + odebug << "Just moved " + wavFile->currentFileName << oendl; Config cfg("OpieRec"); cfg.setGroup("Sounds"); int nFiles = cfg.readNumEntry( "NumberofFiles",0); currentFile = QFileInfo( wavFile->currentFileName).fileName(); @@ -1491,20 +1495,20 @@ void QtRec::endRecording() { 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; + odebug << "finished recording" << oendl; timeLabel->setText(""); } - if(soundDevice) delete soundDevice; +// if(soundDevice) delete soundDevice; timeSlider->setValue(0); initIconView(); selectItemByName( currentFile); } @@ -1512,39 +1516,39 @@ 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; +// 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; + owarn << "reset slider" << oendl; timeSlider->setValue(0); - if(soundDevice) delete soundDevice; +// if(soundDevice) delete soundDevice; } bool QtRec::openPlayFile() { qApp->processEvents(); @@ -1557,13 +1561,13 @@ bool QtRec::openPlayFile() { Config cfg("OpieRec"); cfg.setGroup("Sounds"); int nFiles = cfg.readNumEntry( "NumberofFiles", 0); for(int i=0;i<nFiles+1;i++) { //look for file if( cfg.readEntry( QString::number(i),"").find( currentFile,0,true) != -1) { currentFileName = cfg.readEntry( currentFile, "" ); - odebug << "opening for play: " + currentFileName << oendl; + odebug << "opening for play: " + currentFileName << oendl; } } wavFile = new WavFile(this, currentFileName, false); filePara.fd = wavFile->wavHandle(); @@ -1582,16 +1586,16 @@ bool QtRec::openPlayFile() { filePara.sampleRate = wavFile->getSampleRate(); filePara.resolution = wavFile->getResolution(); filePara.channels = wavFile->getChannels(); timeSlider->setPageStep(1); monitoring = true; - odebug << "file " << filePara.fd << ", samples " << filePara.numberSamples << " " << filePara.sampleRate << "" << oendl; + odebug << "file " << filePara.fd << ", samples " << filePara.numberSamples << " " << filePara.sampleRate << "" << oendl; int sec = (int) (( filePara.numberSamples / filePara.sampleRate) / filePara.channels) / ( filePara.channels*( filePara.resolution/8)); - owarn << "seconds " << sec << "" << oendl; + owarn << "seconds " << sec << "" << oendl; timeSlider->setRange(0, filePara.numberSamples ); } return true; } @@ -1686,25 +1690,25 @@ void QtRec::doRename() { renameBox->setFocus(); renameBox->show(); } void QtRec::okRename() { - odebug << renameBox->text() << oendl; + odebug << renameBox->text() << oendl; QString filename = renameBox->text(); cancelRename(); if( ListView1->currentItem() == NULL) return; Config cfg("OpieRec"); cfg.setGroup("Sounds"); QString file = ListView1->currentItem()->text(0); - odebug << "filename is " + filename << oendl; + odebug << "filename is " + filename << oendl; int nFiles = cfg.readNumEntry("NumberofFiles",0); for(int i=0;i<nFiles+1;i++) { //look for file if( cfg.readEntry( QString::number(i),"").find(file,0,true) != -1) { @@ -1769,13 +1773,13 @@ void QtRec::doVolMuting(bool b) { cfg.writeEntry( "Mute",b); cfg.write(); QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << b; } void QtRec::doMicMuting(bool b) { - // odebug << "mic mute" << oendl; + // odebug << "mic mute" << oendl; Config cfg( "qpe" ); cfg. setGroup( "Volume" ); cfg.writeEntry( "MicMute",b); cfg.write(); QCopEnvelope( "QPE/System", "micChange(bool)" ) << b; } @@ -1787,13 +1791,13 @@ void QtRec::compressionSelected(bool b) { cfg.writeEntry("bitrate", 16); filePara.resolution = 16; cfg.write(); if(b) { bitRateComboBox->setEnabled( false); - bitRateComboBox->setCurrentItem( 0); + bitRateComboBox->setCurrentItem( 1); filePara.resolution = 16; } else{ bitRateComboBox->setEnabled( true); } } @@ -1825,13 +1829,13 @@ long QtRec::checkDiskSpace(const QString &path) { // long f_files; /* Total number of file nodes */ // long f_ffree; /* Count of free file nodes */ // char f_fname[6]; /* Volumename */ // char f_fpack[6]; /* Pack name */ void QtRec::receive( const QCString &msg, const QByteArray & ) { - odebug << "Voicerecord received message "+msg << oendl; + odebug << "Voicerecord received message "+msg << oendl; } ///////////////////////////// timerEvent void QtRec::timerEvent( QTimerEvent * ) { @@ -1845,18 +1849,18 @@ void QtRec::timerEvent( QTimerEvent * ) { stop(); } if( stopped && recording ){ stop(); } - + if( recording && filePara.SecondsToRecord < secCount && filePara.SecondsToRecord != 0) { stop(); } - - odebug << "" << secCount << "" << oendl; + + 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 @@ -1866,13 +1870,13 @@ void QtRec::timerEvent( QTimerEvent * ) { 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; @@ -1881,22 +1885,22 @@ void QtRec::changeTimeSlider(int index) { secCount = (int)filePara.numberOfRecordedSeconds; 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(); @@ -1920,13 +1924,13 @@ void QtRec::rewindPressed() { 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")); } @@ -1934,13 +1938,13 @@ 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() { @@ -1998,13 +2002,13 @@ QString QtRec::getStorage(const QString &fileName) { const QString disk = ( *it)->disk(); if( fileName.find( path,0,true) != -1) storage = name; // const QString options = (*it)->options(); // if( name.find( tr("Internal"),0,true) == -1) { // storageComboBox->insertItem( name +" -> "+disk); - // odebug << name << oendl; + // odebug << name << oendl; } return storage; // struct mntent *me; // // if(fileName == "/etc/mtab") { // FILE *mntfp = setmntent( fileName.latin1(), "r" ); // if ( mntfp ) { @@ -2121,11 +2125,11 @@ void QtRec::changeStereoCheck(bool b) { cfg.setGroup("Settings"); int ch = 0; if ( !b) { ch = 1;} else { ch = 2;} cfg.writeEntry("stereo", b); filePara.channels = ch; - + cfg.write(); } - + |