summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2004-04-25 20:38:04 (UTC)
committer llornkcor <llornkcor>2004-04-25 20:38:04 (UTC)
commit0e3e74030b2a38cfc754d253ab098a1126f382ef (patch) (side-by-side diff)
tree9eb7544e6c29431cddbcfbc5bfe907d08227dbb2
parentae76c412a340a0808ed6ece5e4a8fbc04baa4ff3 (diff)
downloadopie-0e3e74030b2a38cfc754d253ab098a1126f382ef.zip
opie-0e3e74030b2a38cfc754d253ab098a1126f382ef.tar.gz
opie-0e3e74030b2a38cfc754d253ab098a1126f382ef.tar.bz2
hook things up
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
@@ -174,15 +174,16 @@ void quickRec()
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;
@@ -204,9 +205,8 @@ void quickRec()
return;
}
number = soundDevice->devRead( filePara.sd, (short *)inbuffer, BUFSIZE);
- waveform->newSamples( inbuffer, number );
if( number <= 0) {
perror( "recording error ");
odebug << filePara.fileName << oendl;
@@ -214,8 +214,9 @@ void quickRec()
return;
}
bytesWritten = ::write( filePara.fd , inbuffer, number);
+ waveform->newSamples( inbuffer, number );
if( bytesWritten < 0) {
perror("File writing error ");
stopped = true;
@@ -230,9 +231,10 @@ void quickRec()
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;
@@ -254,12 +256,13 @@ 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;
}
@@ -312,9 +315,9 @@ void playIt()
// 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;
@@ -353,9 +356,9 @@ void playIt()
// // 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
@@ -377,10 +380,10 @@ void playIt()
// 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];
@@ -449,9 +452,9 @@ QtRec::QtRec( QWidget* parent, const char* name, WFlags fl )
soundDevice->sd = -1;
soundDevice = 0;
wavFile = 0;
- if( soundDevice) delete soundDevice;
+// if( soundDevice) delete soundDevice;
initIconView();
if( autoMute)
@@ -460,8 +463,9 @@ QtRec::QtRec( QWidget* parent, const char* name, WFlags fl )
playing = false;
}
QtRec::~QtRec() {
+// if( soundDevice) delete soundDevice;
}
void QtRec::cleanUp() {
@@ -475,9 +479,9 @@ void QtRec::cleanUp() {
if( autoMute)
doMute(false);
- if( wavFile) delete wavFile;
+// if( wavFile) delete wavFile;
// if(soundDevice) delete soundDevice;
}
void QtRec::init() {
@@ -1500,9 +1504,9 @@ void QtRec::endRecording() {
odebug << "finished recording" << oendl;
timeLabel->setText("");
}
- if(soundDevice) delete soundDevice;
+// if(soundDevice) delete soundDevice;
timeSlider->setValue(0);
initIconView();
selectItemByName( currentFile);
@@ -1540,9 +1544,9 @@ void QtRec::endPlaying() {
killTimers();
owarn << "reset slider" << oendl;
timeSlider->setValue(0);
- if(soundDevice) delete soundDevice;
+// if(soundDevice) delete soundDevice;
}
bool QtRec::openPlayFile() {
@@ -1789,9 +1793,9 @@ void QtRec::compressionSelected(bool b) {
cfg.write();
if(b) {
bitRateComboBox->setEnabled( false);
- bitRateComboBox->setCurrentItem( 0);
+ bitRateComboBox->setCurrentItem( 1);
filePara.resolution = 16;
} else{
bitRateComboBox->setEnabled( true);
}