summaryrefslogtreecommitdiff
path: root/noncore/multimedia
authorllornkcor <llornkcor>2004-04-25 20:38:04 (UTC)
committer llornkcor <llornkcor>2004-04-25 20:38:04 (UTC)
commit0e3e74030b2a38cfc754d253ab098a1126f382ef (patch) (unidiff)
tree9eb7544e6c29431cddbcfbc5bfe907d08227dbb2 /noncore/multimedia
parentae76c412a340a0808ed6ece5e4a8fbc04baa4ff3 (diff)
downloadopie-0e3e74030b2a38cfc754d253ab098a1126f382ef.zip
opie-0e3e74030b2a38cfc754d253ab098a1126f382ef.tar.gz
opie-0e3e74030b2a38cfc754d253ab098a1126f382ef.tar.bz2
hook things up
Diffstat (limited to 'noncore/multimedia') (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()
175 175
176 bytesWritten = ::write( filePara.fd , (short *)abuf, number/4); 176 bytesWritten = ::write( filePara.fd , (short *)abuf, number/4);
177 177
178 waveform->newSamples( (const short *)abuf, bytesWritten ); 178 waveform->newSamples( sbuf, number );
179 179
180 total += bytesWritten; 180 total += bytesWritten;
181 filePara.numberSamples = total; 181 filePara.numberSamples = total;
182 timeSlider->setValue( total); 182 timeSlider->setValue( total);
183 183
184 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2 / filePara.channels; 184 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2
185 / filePara.channels;
185 186
186 qApp->processEvents(); 187 qApp->processEvents();
187 if( total >= filePara.samplesToRecord) { 188 if( total >= filePara.samplesToRecord) {
@@ -205,7 +206,6 @@ void quickRec()
205 } 206 }
206 207
207 number = soundDevice->devRead( filePara.sd, (short *)inbuffer, BUFSIZE); 208 number = soundDevice->devRead( filePara.sd, (short *)inbuffer, BUFSIZE);
208 waveform->newSamples( inbuffer, number );
209 209
210 if( number <= 0) { 210 if( number <= 0) {
211 perror( "recording error "); 211 perror( "recording error ");
@@ -215,6 +215,7 @@ void quickRec()
215 } 215 }
216 216
217 bytesWritten = ::write( filePara.fd , inbuffer, number); 217 bytesWritten = ::write( filePara.fd , inbuffer, number);
218 waveform->newSamples( inbuffer, number );
218 219
219 if( bytesWritten < 0) { 220 if( bytesWritten < 0) {
220 perror("File writing error "); 221 perror("File writing error ");
@@ -231,7 +232,8 @@ void quickRec()
231// printf("Writing number %d, bytes %d,total %d\r",number, bytesWritten , total); 232// printf("Writing number %d, bytes %d,total %d\r",number, bytesWritten , total);
232// fflush(stdout); 233// fflush(stdout);
233 234
234 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / (float)2/filePara.channels; 235 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate
236 / (float)2/filePara.channels;
235 qApp->processEvents(); 237 qApp->processEvents();
236 238
237 if( total >= filePara.samplesToRecord) { 239 if( total >= filePara.samplesToRecord) {
@@ -255,10 +257,11 @@ void quickRec()
255 257
256 number = ::read( filePara.sd, unsigned_inbuffer, BUFSIZE); 258 number = ::read( filePara.sd, unsigned_inbuffer, BUFSIZE);
257 bytesWritten = ::write( filePara.fd , unsigned_inbuffer, number); 259 bytesWritten = ::write( filePara.fd , unsigned_inbuffer, number);
260 waveform->newSamples( (const short *) unsigned_inbuffer, number );
258 261
259 if(bytesWritten < 0) { 262 if(bytesWritten < 0) {
260 stopped = true; 263 stopped = true;
261 QMessageBox::message("Note","There was a problem\nwriting to the file"); 264 QMessageBox::message("Note","<p>There was a problem writing to the file</p>");
262 perror("File writing error "); 265 perror("File writing error ");
263 return; 266 return;
264 } 267 }
@@ -313,7 +316,7 @@ void playIt()
313// sbuf2[i+1]=sbuf2[i]=sbuf[i]; 316// sbuf2[i+1]=sbuf2[i]=sbuf[i];
314// } 317// }
315 bytesWritten = write ( filePara.sd, sbuf, number * 4); 318 bytesWritten = write ( filePara.sd, sbuf, number * 4);
316 waveform->newSamples( (const short *)sbuf, number ); 319 waveform->newSamples( (const short *)sbuf, number *4);
317 // if(filePara.channels==1) 320 // if(filePara.channels==1)
318 // total += bytesWritten/2; //mono 321 // total += bytesWritten/2; //mono
319 // else 322 // else
@@ -354,7 +357,7 @@ void playIt()
354// outbuffer[i+1]= outbuffer[i]=inbuffer[i]; 357// outbuffer[i+1]= outbuffer[i]=inbuffer[i];
355// } 358// }
356 bytesWritten = ::write( filePara.sd, inbuffer, number); 359 bytesWritten = ::write( filePara.sd, inbuffer, number);
357 waveform->newSamples( inbuffer, bytesWritten ); 360 waveform->newSamples( inbuffer, number);
358 //-------------->>>> out to device 361 //-------------->>>> out to device
359 // total+=bytesWritten; 362 // total+=bytesWritten;
360 // if(filePara.channels==1) 363 // if(filePara.channels==1)
@@ -378,8 +381,8 @@ void playIt()
378 break; 381 break;
379 } 382 }
380 } 383 }
381 printf("\nplaying number %d, bytes %d, total %d\r",number, bytesWritten, total); 384// printf("\nplaying number %d, bytes %d, total %d\r",number, bytesWritten, total);
382 fflush(stdout); 385// fflush(stdout);
383 } //end loop 386 } //end loop
384 } else { 387 } else {
385/////////////////////////////// format = AFMT_U8; 388/////////////////////////////// format = AFMT_U8;
@@ -450,7 +453,7 @@ QtRec::QtRec( QWidget* parent, const char* name, WFlags fl )
450 soundDevice = 0; 453 soundDevice = 0;
451 wavFile = 0; 454 wavFile = 0;
452 455
453 if( soundDevice) delete soundDevice; 456 // if( soundDevice) delete soundDevice;
454 457
455 initIconView(); 458 initIconView();
456 459
@@ -461,6 +464,7 @@ QtRec::QtRec( QWidget* parent, const char* name, WFlags fl )
461} 464}
462 465
463QtRec::~QtRec() { 466QtRec::~QtRec() {
467// if( soundDevice) delete soundDevice;
464 468
465} 469}
466 470
@@ -476,7 +480,7 @@ void QtRec::cleanUp() {
476 if( autoMute) 480 if( autoMute)
477 doMute(false); 481 doMute(false);
478 482
479 if( wavFile) delete wavFile; 483 // if( wavFile) delete wavFile;
480// if(soundDevice) delete soundDevice; 484// if(soundDevice) delete soundDevice;
481} 485}
482 486
@@ -1501,7 +1505,7 @@ void QtRec::endRecording() {
1501 timeLabel->setText(""); 1505 timeLabel->setText("");
1502 } 1506 }
1503 1507
1504 if(soundDevice) delete soundDevice; 1508 // if(soundDevice) delete soundDevice;
1505 1509
1506 timeSlider->setValue(0); 1510 timeSlider->setValue(0);
1507 initIconView(); 1511 initIconView();
@@ -1541,7 +1545,7 @@ void QtRec::endPlaying() {
1541 owarn << "reset slider" << oendl; 1545 owarn << "reset slider" << oendl;
1542 timeSlider->setValue(0); 1546 timeSlider->setValue(0);
1543 1547
1544 if(soundDevice) delete soundDevice; 1548 // if(soundDevice) delete soundDevice;
1545 1549
1546} 1550}
1547 1551
@@ -1790,7 +1794,7 @@ void QtRec::compressionSelected(bool b) {
1790 1794
1791 if(b) { 1795 if(b) {
1792 bitRateComboBox->setEnabled( false); 1796 bitRateComboBox->setEnabled( false);
1793 bitRateComboBox->setCurrentItem( 0); 1797 bitRateComboBox->setCurrentItem( 1);
1794 filePara.resolution = 16; 1798 filePara.resolution = 16;
1795 } else{ 1799 } else{
1796 bitRateComboBox->setEnabled( true); 1800 bitRateComboBox->setEnabled( true);