-rw-r--r-- | noncore/multimedia/opierec/qtrec.cpp | 32 |
1 files changed, 18 insertions, 14 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 @@ -176,5 +176,5 @@ void quickRec() bytesWritten = ::write( filePara.fd , (short *)abuf, number/4); - waveform->newSamples( (const short *)abuf, bytesWritten ); + waveform->newSamples( sbuf, number ); total += bytesWritten; @@ -182,5 +182,6 @@ void quickRec() 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(); @@ -206,5 +207,4 @@ void quickRec() number = soundDevice->devRead( filePara.sd, (short *)inbuffer, BUFSIZE); - waveform->newSamples( inbuffer, number ); if( number <= 0) { @@ -216,4 +216,5 @@ void quickRec() bytesWritten = ::write( filePara.fd , inbuffer, number); + waveform->newSamples( inbuffer, number ); if( bytesWritten < 0) { @@ -232,5 +233,6 @@ void quickRec() // 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(); @@ -256,8 +258,9 @@ void quickRec() 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; @@ -314,5 +317,5 @@ void playIt() // } 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 @@ -355,5 +358,5 @@ void playIt() // } bytesWritten = ::write( filePara.sd, inbuffer, number); - waveform->newSamples( inbuffer, bytesWritten ); + waveform->newSamples( inbuffer, number); //-------------->>>> out to device // total+=bytesWritten; @@ -379,6 +382,6 @@ void playIt() } } - 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 { @@ -451,5 +454,5 @@ QtRec::QtRec( QWidget* parent, const char* name, WFlags fl ) wavFile = 0; - if( soundDevice) delete soundDevice; +// if( soundDevice) delete soundDevice; initIconView(); @@ -462,4 +465,5 @@ QtRec::QtRec( QWidget* parent, const char* name, WFlags fl ) QtRec::~QtRec() { +// if( soundDevice) delete soundDevice; } @@ -477,5 +481,5 @@ void QtRec::cleanUp() { doMute(false); - if( wavFile) delete wavFile; +// if( wavFile) delete wavFile; // if(soundDevice) delete soundDevice; } @@ -1502,5 +1506,5 @@ void QtRec::endRecording() { } - if(soundDevice) delete soundDevice; +// if(soundDevice) delete soundDevice; timeSlider->setValue(0); @@ -1542,5 +1546,5 @@ void QtRec::endPlaying() { timeSlider->setValue(0); - if(soundDevice) delete soundDevice; +// if(soundDevice) delete soundDevice; } @@ -1791,5 +1795,5 @@ void QtRec::compressionSelected(bool b) { if(b) { bitRateComboBox->setEnabled( false); - bitRateComboBox->setCurrentItem( 0); + bitRateComboBox->setCurrentItem( 1); filePara.resolution = 16; } else{ |