-rw-r--r-- | core/applets/vmemo/vmemo.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp index e25a1ab..10a947e 100644 --- a/core/applets/vmemo/vmemo.cpp +++ b/core/applets/vmemo/vmemo.cpp | |||
@@ -432,97 +432,97 @@ int VMemo::openWAV(const char *filename) | |||
432 | wh.format = PCM_CODE; | 432 | wh.format = PCM_CODE; |
433 | wh.modus = channels; | 433 | wh.modus = channels; |
434 | wh.sample_fq = speed; | 434 | wh.sample_fq = speed; |
435 | wh.byte_p_sec = speed * channels * resolution/8; | 435 | wh.byte_p_sec = speed * channels * resolution/8; |
436 | wh.byte_p_spl = channels * (resolution / 8); | 436 | wh.byte_p_spl = channels * (resolution / 8); |
437 | wh.bit_p_spl = resolution; | 437 | wh.bit_p_spl = resolution; |
438 | wh.data_chunk = DATA; | 438 | wh.data_chunk = DATA; |
439 | wh.data_length= 0; | 439 | wh.data_length= 0; |
440 | // qDebug("Write header channels %d, speed %d, b/s %d, blockalign %d, bitrate %d" | 440 | // qDebug("Write header channels %d, speed %d, b/s %d, blockalign %d, bitrate %d" |
441 | // , wh.modus, wh.sample_fq, wh.byte_p_sec, wh.byte_p_spl, wh.bit_p_spl ); | 441 | // , wh.modus, wh.sample_fq, wh.byte_p_sec, wh.byte_p_spl, wh.bit_p_spl ); |
442 | write (wav, &wh, sizeof(WaveHeader)); | 442 | write (wav, &wh, sizeof(WaveHeader)); |
443 | 443 | ||
444 | return 1; | 444 | return 1; |
445 | } | 445 | } |
446 | 446 | ||
447 | void VMemo::record(void) | 447 | void VMemo::record(void) |
448 | { | 448 | { |
449 | int length=0, result, value; | 449 | int length=0, result, value; |
450 | QString msg; | 450 | QString msg; |
451 | msg.sprintf("Recording format %d", format); | 451 | msg.sprintf("Recording format %d", format); |
452 | qDebug(msg); | 452 | qDebug(msg); |
453 | 453 | ||
454 | if(systemZaurus) { | 454 | if(systemZaurus) { |
455 | 455 | ||
456 | msg.sprintf("Recording format zaurus"); | 456 | msg.sprintf("Recording format zaurus"); |
457 | qDebug(msg); | 457 | qDebug(msg); |
458 | signed short sound[512], monoBuffer[512]; | 458 | signed short sound[512], monoBuffer[512]; |
459 | 459 | ||
460 | if(format==AFMT_S16_LE) { | 460 | if(format==AFMT_S16_LE) { |
461 | 461 | ||
462 | while(recording) { | 462 | while(recording) { |
463 | 463 | ||
464 | result = read(dsp, sound, 512); // 8192 | 464 | result = read(dsp, sound, 512); // 8192 |
465 | int j=0; | 465 | int j=0; |
466 | 466 | ||
467 | if(systemZaurus) { | 467 | if(systemZaurus) { |
468 | for (int i = 0; i < result; i++) { //since Z is mono do normally | 468 | for (int i = 0; i < result; i++) { //since Z is mono do normally |
469 | monoBuffer[i] = sound[i]; | 469 | monoBuffer[i] = sound[i]; |
470 | } | 470 | } |
471 | 471 | ||
472 | length+=write(wav, monoBuffer, result); | 472 | length+=write(wav, monoBuffer, result); |
473 | if(length<0) | 473 | if(length<0) |
474 | recording=false; | 474 | recording=false; |
475 | 475 | ||
476 | } else { //ipaq /stereo inputs | 476 | } else { //ipaq /stereo inputs |
477 | 477 | ||
478 | 478 | ||
479 | for (int i = 0; i < result; i+=2) { | 479 | for (int i = 0; i < result; i+=2) { |
480 | / monoBuffer[j] = sound[i]; | 480 | monoBuffer[j] = sound[i]; |
481 | // monoBuffer[j] = (sound[i]+sound[i+1])/2; | 481 | // monoBuffer[j] = (sound[i]+sound[i+1])/2; |
482 | 482 | ||
483 | j++; | 483 | j++; |
484 | } | 484 | } |
485 | 485 | ||
486 | length+=write(wav, monoBuffer, result); | 486 | length+=write(wav, monoBuffer, result); |
487 | if(length<0) | 487 | if(length<0) |
488 | recording=false; | 488 | recording=false; |
489 | // length+=write(wav, monoBuffer, result/2); | 489 | // length+=write(wav, monoBuffer, result/2); |
490 | } | 490 | } |
491 | qApp->processEvents(); | 491 | qApp->processEvents(); |
492 | // printf("%d\r",length); | 492 | // printf("%d\r",length); |
493 | // fflush(stdout); | 493 | // fflush(stdout); |
494 | } | 494 | } |
495 | 495 | ||
496 | } else { //AFMT_U8 | 496 | } else { //AFMT_U8 |
497 | // 8bit unsigned | 497 | // 8bit unsigned |
498 | unsigned short sound[512], monoBuffer[512]; | 498 | unsigned short sound[512], monoBuffer[512]; |
499 | while(recording) { | 499 | while(recording) { |
500 | result = read(dsp, sound, 512); // 8192 | 500 | result = read(dsp, sound, 512); // 8192 |
501 | int j=0; | 501 | int j=0; |
502 | 502 | ||
503 | if(systemZaurus) { | 503 | if(systemZaurus) { |
504 | 504 | ||
505 | for (int i = 0; i < result; i++) { //since Z is mono do normally | 505 | for (int i = 0; i < result; i++) { //since Z is mono do normally |
506 | monoBuffer[i] = sound[i]; | 506 | monoBuffer[i] = sound[i]; |
507 | } | 507 | } |
508 | 508 | ||
509 | length+=write(wav, monoBuffer, result); | 509 | length+=write(wav, monoBuffer, result); |
510 | 510 | ||
511 | } else { //ipaq /stereo inputs | 511 | } else { //ipaq /stereo inputs |
512 | 512 | ||
513 | for (int i = 0; i < result; i+=2) { | 513 | for (int i = 0; i < result; i+=2) { |
514 | monoBuffer[j] = (sound[i]+sound[i+1])/2; | 514 | monoBuffer[j] = (sound[i]+sound[i+1])/2; |
515 | j++; | 515 | j++; |
516 | } | 516 | } |
517 | 517 | ||
518 | length+=write(wav, monoBuffer, result/2); | 518 | length+=write(wav, monoBuffer, result/2); |
519 | 519 | ||
520 | if(length<0) | 520 | if(length<0) |
521 | recording=false; | 521 | recording=false; |
522 | 522 | ||
523 | } | 523 | } |
524 | length += result; | 524 | length += result; |
525 | // printf("%d\r",length); | 525 | // printf("%d\r",length); |
526 | // fflush(stdout); | 526 | // fflush(stdout); |
527 | } | 527 | } |
528 | 528 | ||