summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opierec/qtrec.cpp32
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
@@ -175,13 +175,14 @@ void quickRec()
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) {
@@ -205,7 +206,6 @@ void quickRec()
}
number = soundDevice->devRead( filePara.sd, (short *)inbuffer, BUFSIZE);
- waveform->newSamples( inbuffer, number );
if( number <= 0) {
perror( "recording error ");
@@ -215,6 +215,7 @@ void quickRec()
}
bytesWritten = ::write( filePara.fd , inbuffer, number);
+ waveform->newSamples( inbuffer, number );
if( bytesWritten < 0) {
perror("File writing error ");
@@ -231,7 +232,8 @@ void quickRec()
// 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) {
@@ -255,10 +257,11 @@ 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;
}
@@ -313,7 +316,7 @@ void playIt()
// 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
@@ -354,7 +357,7 @@ void playIt()
// 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)
@@ -378,8 +381,8 @@ void playIt()
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;
@@ -450,7 +453,7 @@ QtRec::QtRec( QWidget* parent, const char* name, WFlags fl )
soundDevice = 0;
wavFile = 0;
- if( soundDevice) delete soundDevice;
+// if( soundDevice) delete soundDevice;
initIconView();
@@ -461,6 +464,7 @@ QtRec::QtRec( QWidget* parent, const char* name, WFlags fl )
}
QtRec::~QtRec() {
+// if( soundDevice) delete soundDevice;
}
@@ -476,7 +480,7 @@ void QtRec::cleanUp() {
if( autoMute)
doMute(false);
- if( wavFile) delete wavFile;
+// if( wavFile) delete wavFile;
// if(soundDevice) delete soundDevice;
}
@@ -1501,7 +1505,7 @@ void QtRec::endRecording() {
timeLabel->setText("");
}
- if(soundDevice) delete soundDevice;
+// if(soundDevice) delete soundDevice;
timeSlider->setValue(0);
initIconView();
@@ -1541,7 +1545,7 @@ void QtRec::endPlaying() {
owarn << "reset slider" << oendl;
timeSlider->setValue(0);
- if(soundDevice) delete soundDevice;
+// if(soundDevice) delete soundDevice;
}
@@ -1790,7 +1794,7 @@ void QtRec::compressionSelected(bool b) {
if(b) {
bitRateComboBox->setEnabled( false);
- bitRateComboBox->setCurrentItem( 0);
+ bitRateComboBox->setCurrentItem( 1);
filePara.resolution = 16;
} else{
bitRateComboBox->setEnabled( true);