-rw-r--r-- | core/applets/vmemo/vmemo.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp index 035965e..0c792c6 100644 --- a/core/applets/vmemo/vmemo.cpp +++ b/core/applets/vmemo/vmemo.cpp | |||
@@ -473,24 +473,25 @@ int VMemo::openDSP() { | |||
473 | 473 | ||
474 | return 1; | 474 | return 1; |
475 | } | 475 | } |
476 | 476 | ||
477 | int VMemo::openWAV(const char *filename) { | 477 | int VMemo::openWAV(const char *filename) { |
478 | track.setName(filename); | 478 | track.setName(filename); |
479 | if(!track.open(IO_WriteOnly|IO_Truncate|IO_Raw)) { | 479 | if(!track.open(IO_WriteOnly|IO_Truncate|IO_Raw)) { |
480 | errorMsg=filename; | 480 | errorMsg=filename; |
481 | return -1; | 481 | return -1; |
482 | } | 482 | } |
483 | 483 | ||
484 | wav=track.handle(); | 484 | wav=track.handle(); |
485 | useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0); | ||
485 | 486 | ||
486 | WaveHeader wh; | 487 | WaveHeader wh; |
487 | 488 | ||
488 | wh.main_chunk = RIFF; | 489 | wh.main_chunk = RIFF; |
489 | wh.length=0; | 490 | wh.length=0; |
490 | wh.chunk_type = WAVE; | 491 | wh.chunk_type = WAVE; |
491 | wh.sub_chunk = FMT; | 492 | wh.sub_chunk = FMT; |
492 | wh.sc_len = 16; | 493 | wh.sc_len = 16; |
493 | if(useADPCM) | 494 | if(useADPCM) |
494 | wh.format = WAVE_FORMAT_DVI_ADPCM;//PCM_CODE; | 495 | wh.format = WAVE_FORMAT_DVI_ADPCM;//PCM_CODE; |
495 | else | 496 | else |
496 | wh.format = PCM_CODE; | 497 | wh.format = PCM_CODE; |
@@ -522,24 +523,25 @@ bool VMemo::record() { | |||
522 | 523 | ||
523 | // if(systemZaurus) { | 524 | // if(systemZaurus) { |
524 | // } else { // 16 bit only capabilities | 525 | // } else { // 16 bit only capabilities |
525 | 526 | ||
526 | msg.sprintf("Recording format other"); | 527 | msg.sprintf("Recording format other"); |
527 | qDebug(msg); | 528 | qDebug(msg); |
528 | 529 | ||
529 | int bufsize=1024; | 530 | int bufsize=1024; |
530 | int bytesWritten=0; | 531 | int bytesWritten=0; |
531 | signed short sound[1024], monoBuffer[1024]; | 532 | signed short sound[1024], monoBuffer[1024]; |
532 | char abuf[bufsize/2]; | 533 | char abuf[bufsize/2]; |
533 | short sbuf[bufsize]; | 534 | short sbuf[bufsize]; |
535 | useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0); | ||
534 | 536 | ||
535 | while(recording) { | 537 | while(recording) { |
536 | 538 | ||
537 | if(useADPCM) | 539 | if(useADPCM) |
538 | result = read( dsp, sbuf, bufsize); // 8192 | 540 | result = read( dsp, sbuf, bufsize); // 8192 |
539 | else | 541 | else |
540 | result = read(dsp, sound, 1024); // 8192 | 542 | result = read(dsp, sound, 1024); // 8192 |
541 | if( result <= 0) { | 543 | if( result <= 0) { |
542 | perror("recording error "); | 544 | perror("recording error "); |
543 | // qDebug(currentFileName); | 545 | // qDebug(currentFileName); |
544 | QMessageBox::message(tr("Note"),tr("error recording")); | 546 | QMessageBox::message(tr("Note"),tr("error recording")); |
545 | recording=FALSE; | 547 | recording=FALSE; |
@@ -564,25 +566,24 @@ bool VMemo::record() { | |||
564 | recording=false; | 566 | recording=false; |
565 | perror("dev/dsp's is a lookin' messy"); | 567 | perror("dev/dsp's is a lookin' messy"); |
566 | QMessageBox::message("Vmemo"," Done1 recording\n"+ fileName); | 568 | QMessageBox::message("Vmemo"," Done1 recording\n"+ fileName); |
567 | break; | 569 | break; |
568 | return FALSE; | 570 | return FALSE; |
569 | } | 571 | } |
570 | // printf("%d\r",length); | 572 | // printf("%d\r",length); |
571 | // fflush(stdout); | 573 | // fflush(stdout); |
572 | qApp->processEvents(); | 574 | qApp->processEvents(); |
573 | } | 575 | } |
574 | // qDebug("file has length of %d lasting %d seconds", | 576 | // qDebug("file has length of %d lasting %d seconds", |
575 | // length, (( length / speed) / channels) / 2 ); | 577 | // length, (( length / speed) / channels) / 2 ); |
576 | // medialplayer states wrong length in secs | ||
577 | // } | 578 | // } |
578 | 579 | ||
579 | //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<// | 580 | //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<// |
580 | 581 | ||
581 | value = length+36; | 582 | value = length+36; |
582 | 583 | ||
583 | lseek(wav, 4, SEEK_SET); | 584 | lseek(wav, 4, SEEK_SET); |
584 | write(wav, &value, 4); | 585 | write(wav, &value, 4); |
585 | lseek(wav, 40, SEEK_SET); | 586 | lseek(wav, 40, SEEK_SET); |
586 | 587 | ||
587 | write(wav, &length, 4); | 588 | write(wav, &length, 4); |
588 | 589 | ||