summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/vmemo/vmemo.cpp42
1 files changed, 26 insertions, 16 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp
index b80b378..e747a19 100644
--- a/core/applets/vmemo/vmemo.cpp
+++ b/core/applets/vmemo/vmemo.cpp
@@ -236,7 +236,8 @@ VMemo::VMemo( QWidget *parent, const char *_name )
236 else 236 else
237 usingIcon = FALSE; 237 usingIcon = FALSE;
238// if( vmCfg.readNumEntry("hideIcon",0) == 1) 238// if( vmCfg.readNumEntry("hideIcon",0) == 1)
239// hide(); 239 if (!usingIcon)
240 hide();
240 recording = FALSE; 241 recording = FALSE;
241 // } 242 // }
242} 243}
@@ -375,7 +376,7 @@ bool VMemo::startRecording() {
375} 376}
376 377
377void VMemo::stopRecording() { 378void VMemo::stopRecording() {
378 show(); 379// show();
379 odebug << "Stopped recording" << oendl; 380 odebug << "Stopped recording" << oendl;
380 recording = FALSE; 381 recording = FALSE;
381 if(useAlerts) { 382 if(useAlerts) {
@@ -485,30 +486,37 @@ int VMemo::openWAV(const char *filename) {
485 486
486bool VMemo::record() { 487bool VMemo::record() {
487 length = 0; 488 length = 0;
488 int bytesWritten = 0; 489 int bytesWritten = 0;
489 int result = 0; 490 int result = 0;
490 int value = 0; 491 int value = 0;
492
491 QString msg; 493 QString msg;
492 msg.sprintf("Recording format %d", format); 494 msg.sprintf("Recording format %d", format);
493 odebug << msg << oendl; 495 odebug << msg << oendl;
496
494 Config config("Vmemo"); 497 Config config("Vmemo");
495 config.setGroup("Record"); 498 config.setGroup("Record");
496 int sRate = config.readNumEntry("SizeLimit", 30); 499 int sRate = config.readNumEntry("SizeLimit", 30);
497 if(sRate > 0) 500 odebug << "VMEMO rate" << sRate << oendl;
498 t_timer->start( sRate * 1000+1000, TRUE);
499 501
500 msg.sprintf("Recording format other"); 502 if(sRate > 0) {
501 odebug << msg << oendl; 503 t_timer->start( sRate * 1000+1000, TRUE);
504 }
505
506 msg.sprintf("Recording format other");
507 odebug << msg << oendl;
502 508
503 config.setGroup("Defaults"); 509 config.setGroup("Defaults");
504 useADPCM = config.readBoolEntry("use_ADPCM", 0); 510 useADPCM = config.readBoolEntry("use_ADPCM", 0);
505 511
506 int bufsize = config.readNumEntry("BufferSize",1024); 512 int bufsize = config.readNumEntry("BufferSize",1024);
507 unsigned short sound[bufsize]; //, monoBuffer[bufsize]; 513 unsigned short sound[bufsize]; //, monoBuffer[bufsize];
508 char abuf[bufsize / 2]; 514 char abuf[bufsize / 2];
509 short sbuf[bufsize]; 515 short sbuf[bufsize];
510 516 odebug << "ready to record"<< oendl;
511 if(useADPCM) { 517 if(useADPCM) {
518 odebug << "usr ADPCM" << oendl;
519
512 while(recording) { 520 while(recording) {
513 result = ::read(dsp, sbuf, bufsize); // adpcm read 521 result = ::read(dsp, sbuf, bufsize); // adpcm read
514 if( result <= 0) { 522 if( result <= 0) {
@@ -529,11 +537,12 @@ bool VMemo::record() {
529 break; 537 break;
530 return FALSE; 538 return FALSE;
531 } 539 }
532 // printf("%d\r", length); 540 printf("%d\r", length);
533 // fflush(stdout); 541 fflush(stdout);
534 qApp->processEvents(); 542 qApp->processEvents();
535 } 543 }
536 } else { 544 } else {
545 odebug << "use regular wav" << oendl;
537 while(recording) { 546 while(recording) {
538 result = ::read(dsp, sound, bufsize); // read 547 result = ::read(dsp, sound, bufsize); // read
539 if( result <= 0) { 548 if( result <= 0) {
@@ -542,6 +551,7 @@ bool VMemo::record() {
542 recording = FALSE; 551 recording = FALSE;
543 break; 552 break;
544 return FALSE; 553 return FALSE;
554 }
545 555
546 bytesWritten = ::write(wav, sound, result); // write 556 bytesWritten = ::write(wav, sound, result); // write
547 length += bytesWritten; 557 length += bytesWritten;
@@ -553,13 +563,13 @@ bool VMemo::record() {
553 break; 563 break;
554 return FALSE; 564 return FALSE;
555 } 565 }
556 // printf("%d\r", length); 566// printf("%d\r", length);
557 // fflush(stdout); 567// fflush(stdout);
558 qApp->processEvents(); 568 qApp->processEvents();
559 } 569 }
570 // odebug << "result is " << result << oendl;
560 } 571 }
561 } 572 odebug << "file has length of " << length << " lasting " << (( length / speed) / channels) / 2 << " seconds" << oendl;
562 // odebug << "file has length of " << length << " lasting " << (( length / speed) / channels) / 2 ) << " seconds" << oendl;
563 573
564 value = length + 36; 574 value = length + 36;
565 575