author | llornkcor <llornkcor> | 2002-06-23 13:46:45 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-06-23 13:46:45 (UTC) |
commit | 6563867791664113808d1b287510ca52b5f840e0 (patch) (unidiff) | |
tree | 643d1a90c0df95095b721b2f4c50af6627eec1a1 /core/applets/vmemo/vmemo.cpp | |
parent | f9c5bf03ae5a89ef5cda69e37cc2732f4e4f2808 (diff) | |
download | opie-6563867791664113808d1b287510ca52b5f840e0.zip opie-6563867791664113808d1b287510ca52b5f840e0.tar.gz opie-6563867791664113808d1b287510ca52b5f840e0.tar.bz2 |
automute and unmute
-rw-r--r-- | core/applets/vmemo/vmemo.cpp | 58 |
1 files changed, 35 insertions, 23 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp index 10a947e..b29ee62 100644 --- a/core/applets/vmemo/vmemo.cpp +++ b/core/applets/vmemo/vmemo.cpp | |||
@@ -409,6 +409,8 @@ int VMemo::openDSP() | |||
409 | return -1; | 409 | return -1; |
410 | } | 410 | } |
411 | 411 | ||
412 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; //mute | ||
413 | |||
412 | return 1; | 414 | return 1; |
413 | } | 415 | } |
414 | 416 | ||
@@ -459,12 +461,14 @@ void VMemo::record(void) | |||
459 | 461 | ||
460 | if(format==AFMT_S16_LE) { | 462 | if(format==AFMT_S16_LE) { |
461 | 463 | ||
464 | |||
465 | |||
462 | while(recording) { | 466 | while(recording) { |
463 | 467 | ||
464 | result = read(dsp, sound, 512); // 8192 | 468 | result = read(dsp, sound, 512); // 8192 |
465 | int j=0; | 469 | int j=0; |
466 | 470 | ||
467 | if(systemZaurus) { | 471 | // if(systemZaurus) { |
468 | for (int i = 0; i < result; i++) { //since Z is mono do normally | 472 | for (int i = 0; i < result; i++) { //since Z is mono do normally |
469 | monoBuffer[i] = sound[i]; | 473 | monoBuffer[i] = sound[i]; |
470 | } | 474 | } |
@@ -473,21 +477,21 @@ void VMemo::record(void) | |||
473 | if(length<0) | 477 | if(length<0) |
474 | recording=false; | 478 | recording=false; |
475 | 479 | ||
476 | } else { //ipaq /stereo inputs | 480 | // } else { //ipaq /stereo inputs |
477 | 481 | ||
478 | 482 | ||
479 | for (int i = 0; i < result; i+=2) { | 483 | // for (int i = 0; i < result; i+=2) { |
480 | monoBuffer[j] = sound[i]; | 484 | // monoBuffer[j] = sound[i]; |
481 | // monoBuffer[j] = (sound[i]+sound[i+1])/2; | 485 | // // monoBuffer[j] = (sound[i]+sound[i+1])/2; |
482 | 486 | ||
483 | j++; | 487 | // j++; |
484 | } | 488 | // } |
485 | 489 | ||
486 | length+=write(wav, monoBuffer, result); | 490 | // length+=write(wav, monoBuffer, result); |
487 | if(length<0) | 491 | // if(length<0) |
488 | recording=false; | 492 | // recording=false; |
489 | // length+=write(wav, monoBuffer, result/2); | 493 | // // length+=write(wav, monoBuffer, result/2); |
490 | } | 494 | // } |
491 | qApp->processEvents(); | 495 | qApp->processEvents(); |
492 | // printf("%d\r",length); | 496 | // printf("%d\r",length); |
493 | // fflush(stdout); | 497 | // fflush(stdout); |
@@ -500,7 +504,7 @@ void VMemo::record(void) | |||
500 | result = read(dsp, sound, 512); // 8192 | 504 | result = read(dsp, sound, 512); // 8192 |
501 | int j=0; | 505 | int j=0; |
502 | 506 | ||
503 | if(systemZaurus) { | 507 | // if(systemZaurus) { |
504 | 508 | ||
505 | for (int i = 0; i < result; i++) { //since Z is mono do normally | 509 | for (int i = 0; i < result; i++) { //since Z is mono do normally |
506 | monoBuffer[i] = sound[i]; | 510 | monoBuffer[i] = sound[i]; |
@@ -508,19 +512,19 @@ void VMemo::record(void) | |||
508 | 512 | ||
509 | length+=write(wav, monoBuffer, result); | 513 | length+=write(wav, monoBuffer, result); |
510 | 514 | ||
511 | } else { //ipaq /stereo inputs | 515 | // } else { //ipaq /stereo inputs |
512 | 516 | ||
513 | for (int i = 0; i < result; i+=2) { | 517 | // for (int i = 0; i < result; i+=2) { |
514 | monoBuffer[j] = (sound[i]+sound[i+1])/2; | 518 | // monoBuffer[j] = (sound[i]+sound[i+1])/2; |
515 | j++; | 519 | // j++; |
516 | } | 520 | // } |
517 | 521 | ||
518 | length+=write(wav, monoBuffer, result/2); | 522 | // length+=write(wav, monoBuffer, result/2); |
519 | 523 | ||
520 | if(length<0) | 524 | // if(length<0) |
521 | recording=false; | 525 | // recording=false; |
522 | 526 | ||
523 | } | 527 | // } |
524 | length += result; | 528 | length += result; |
525 | // printf("%d\r",length); | 529 | // printf("%d\r",length); |
526 | // fflush(stdout); | 530 | // fflush(stdout); |
@@ -529,7 +533,8 @@ void VMemo::record(void) | |||
529 | qApp->processEvents(); | 533 | qApp->processEvents(); |
530 | } | 534 | } |
531 | 535 | ||
532 | } else { // this is specific for ipaqs that do not have 8 bit capabilities | 536 | } else { // 16 bit only capabilities |
537 | |||
533 | 538 | ||
534 | msg.sprintf("Recording format other"); | 539 | msg.sprintf("Recording format other"); |
535 | qDebug(msg); | 540 | qDebug(msg); |
@@ -579,6 +584,13 @@ void VMemo::record(void) | |||
579 | // QMessageBox::message("Vmemo"," Done1 recording\n"+ fileName); | 584 | // QMessageBox::message("Vmemo"," Done1 recording\n"+ fileName); |
580 | qDebug("done recording "+fileName); | 585 | qDebug("done recording "+fileName); |
581 | QSound::play(Resource::findSound("vmemoe")); | 586 | QSound::play(Resource::findSound("vmemoe")); |
587 | |||
588 | Config cfg("qpe"); | ||
589 | cfg.setGroup("Volume"); | ||
590 | QString foo = cfg.readEntry("Mute","TRUE"); | ||
591 | if(foo.find("TRUE",0,TRUE) != -1) | ||
592 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; //mute | ||
593 | |||
582 | } | 594 | } |
583 | 595 | ||
584 | int VMemo::setToggleButton(int tog) { | 596 | int VMemo::setToggleButton(int tog) { |