-rw-r--r-- | core/applets/vmemo/vmemo.cpp | 69 | ||||
-rw-r--r-- | core/applets/vmemo/vmemo.pro | 2 | ||||
-rw-r--r-- | core/applets/vmemo/vmemoimpl.cpp | 0 |
3 files changed, 58 insertions, 13 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp index 7021fae..e25a1ab 100644 --- a/core/applets/vmemo/vmemo.cpp +++ b/core/applets/vmemo/vmemo.cpp | |||
@@ -223,2 +223,3 @@ VMemo::VMemo( QWidget *parent, const char *_name ) | |||
223 | if( toggleKey != -1 ) { | 223 | if( toggleKey != -1 ) { |
224 | // QPEApplication::grabKeyboard(); | ||
224 | QCopEnvelope e("QPE/Desktop", "keyRegister(int key, QString channel, QString message)"); | 225 | QCopEnvelope e("QPE/Desktop", "keyRegister(int key, QString channel, QString message)"); |
@@ -230,4 +231,4 @@ VMemo::VMemo( QWidget *parent, const char *_name ) | |||
230 | } | 231 | } |
231 | if( vmCfg.readNumEntry("hideIcon",0) == 1 || toggleKey > 0) | 232 | // if( vmCfg.readNumEntry("hideIcon",0) == 1 || toggleKey > 0) |
232 | hide(); | 233 | // hide(); |
233 | } | 234 | } |
@@ -289,9 +290,11 @@ bool VMemo::startRecording() { | |||
289 | // } else { | 290 | // } else { |
290 | if (!systemZaurus ) | 291 | // if (!systemZaurus ) |
291 | QSound::play(Resource::findSound("vmemob")); | 292 | // QSound::play(Resource::findSound("vmemob")); |
292 | // } | 293 | // } |
293 | qDebug("Start recording"); | 294 | qDebug("Start recording engines"); |
294 | recording = TRUE; | 295 | recording = TRUE; |
296 | |||
295 | if (openDSP() == -1) { | 297 | if (openDSP() == -1) { |
296 | QMessageBox::critical(0, "vmemo", "Could not open dsp device.\n"+errorMsg, "Abort"); | 298 | // QMessageBox::critical(0, "vmemo", "Could not open dsp device.\n"+errorMsg, "Abort"); |
299 | // delete msgLabel; | ||
297 | recording = FALSE; | 300 | recording = FALSE; |
@@ -329,5 +332,5 @@ bool VMemo::startRecording() { | |||
329 | if(openWAV(fileName.latin1()) == -1) { | 332 | if(openWAV(fileName.latin1()) == -1) { |
330 | QString err("Could not open the output file\n"); | 333 | // QString err("Could not open the output file\n"); |
331 | err += fileName; | 334 | // err += fileName; |
332 | QMessageBox::critical(0, "vmemo", err, "Abort"); | 335 | // QMessageBox::critical(0, "vmemo", err, "Abort"); |
333 | close(dsp); | 336 | close(dsp); |
@@ -350,2 +353,3 @@ bool VMemo::startRecording() { | |||
350 | record(); | 353 | record(); |
354 | // delete msgLabel; | ||
351 | return TRUE; | 355 | return TRUE; |
@@ -386,2 +390,3 @@ int VMemo::openDSP() | |||
386 | errorMsg="open(\"/dev/dsp\")\n "+(QString)strerror(errno); | 390 | errorMsg="open(\"/dev/dsp\")\n "+(QString)strerror(errno); |
391 | QMessageBox::critical(0, "vmemo", errorMsg, "Abort"); | ||
387 | return -1; | 392 | return -1; |
@@ -449,3 +454,7 @@ void VMemo::record(void) | |||
449 | if(systemZaurus) { | 454 | if(systemZaurus) { |
455 | |||
456 | msg.sprintf("Recording format zaurus"); | ||
457 | qDebug(msg); | ||
450 | signed short sound[512], monoBuffer[512]; | 458 | signed short sound[512], monoBuffer[512]; |
459 | |||
451 | if(format==AFMT_S16_LE) { | 460 | if(format==AFMT_S16_LE) { |
@@ -463,2 +472,4 @@ void VMemo::record(void) | |||
463 | length+=write(wav, monoBuffer, result); | 472 | length+=write(wav, monoBuffer, result); |
473 | if(length<0) | ||
474 | recording=false; | ||
464 | 475 | ||
@@ -466,4 +477,7 @@ void VMemo::record(void) | |||
466 | 477 | ||
478 | |||
467 | for (int i = 0; i < result; i+=2) { | 479 | for (int i = 0; i < result; i+=2) { |
468 | monoBuffer[j] = (sound[i]+sound[i+1])/2; | 480 | / monoBuffer[j] = sound[i]; |
481 | // monoBuffer[j] = (sound[i]+sound[i+1])/2; | ||
482 | |||
469 | j++; | 483 | j++; |
@@ -471,3 +485,6 @@ void VMemo::record(void) | |||
471 | 485 | ||
472 | length+=write(wav, monoBuffer, result/2); | 486 | length+=write(wav, monoBuffer, result); |
487 | if(length<0) | ||
488 | recording=false; | ||
489 | // length+=write(wav, monoBuffer, result/2); | ||
473 | } | 490 | } |
@@ -477,2 +494,3 @@ void VMemo::record(void) | |||
477 | } | 494 | } |
495 | |||
478 | } else { //AFMT_U8 | 496 | } else { //AFMT_U8 |
@@ -483,3 +501,5 @@ void VMemo::record(void) | |||
483 | int j=0; | 501 | int j=0; |
502 | |||
484 | if(systemZaurus) { | 503 | if(systemZaurus) { |
504 | |||
485 | 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 |
@@ -487,4 +507,7 @@ void VMemo::record(void) | |||
487 | } | 507 | } |
508 | |||
488 | length+=write(wav, monoBuffer, result); | 509 | length+=write(wav, monoBuffer, result); |
510 | |||
489 | } else { //ipaq /stereo inputs | 511 | } else { //ipaq /stereo inputs |
512 | |||
490 | for (int i = 0; i < result; i+=2) { | 513 | for (int i = 0; i < result; i+=2) { |
@@ -493,3 +516,8 @@ void VMemo::record(void) | |||
493 | } | 516 | } |
517 | |||
494 | length+=write(wav, monoBuffer, result/2); | 518 | length+=write(wav, monoBuffer, result/2); |
519 | |||
520 | if(length<0) | ||
521 | recording=false; | ||
522 | |||
495 | } | 523 | } |
@@ -505,2 +533,5 @@ void VMemo::record(void) | |||
505 | 533 | ||
534 | msg.sprintf("Recording format other"); | ||
535 | qDebug(msg); | ||
536 | |||
506 | signed short sound[512], monoBuffer[512]; | 537 | signed short sound[512], monoBuffer[512]; |
@@ -508,7 +539,12 @@ void VMemo::record(void) | |||
508 | while(recording) { | 539 | while(recording) { |
540 | |||
509 | result = read(dsp, sound, 512); // 8192 | 541 | result = read(dsp, sound, 512); // 8192 |
542 | |||
510 | write(wav, sound, result); | 543 | write(wav, sound, result); |
511 | length += result; | 544 | length += result; |
545 | if(length<0) { | ||
512 | 546 | ||
513 | qApp->processEvents(); | 547 | recording=false; |
548 | perror("dev/dsp's is a lookin' messy"); | ||
549 | QMessageBox::message("Vmemo"," Done1 recording\n"+ fileName); | ||
514 | } | 550 | } |
@@ -516,2 +552,4 @@ void VMemo::record(void) | |||
516 | // fflush(stdout); | 552 | // fflush(stdout); |
553 | qApp->processEvents(); | ||
554 | } | ||
517 | // qDebug("file has length of %d lasting %d seconds", | 555 | // qDebug("file has length of %d lasting %d seconds", |
@@ -521,3 +559,6 @@ void VMemo::record(void) | |||
521 | 559 | ||
560 | //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<// | ||
561 | |||
522 | value = length+36; | 562 | value = length+36; |
563 | |||
523 | lseek(wav, 4, SEEK_SET); | 564 | lseek(wav, 4, SEEK_SET); |
@@ -525,4 +566,7 @@ void VMemo::record(void) | |||
525 | lseek(wav, 40, SEEK_SET); | 566 | lseek(wav, 40, SEEK_SET); |
567 | |||
526 | write(wav, &length, 4); | 568 | write(wav, &length, 4); |
569 | |||
527 | track.close(); | 570 | track.close(); |
571 | qDebug("Tracvk closed"); | ||
528 | 572 | ||
@@ -530,2 +574,3 @@ void VMemo::record(void) | |||
530 | perror("ioctl(\"SNDCTL_DSP_RESET\")"); | 574 | perror("ioctl(\"SNDCTL_DSP_RESET\")"); |
575 | |||
531 | ::close(dsp); | 576 | ::close(dsp); |
diff --git a/core/applets/vmemo/vmemo.pro b/core/applets/vmemo/vmemo.pro index 298d989..734cf5c 100644 --- a/core/applets/vmemo/vmemo.pro +++ b/core/applets/vmemo/vmemo.pro | |||
@@ -7,3 +7,3 @@ DESTDIR =$(OPIEDIR)/plugins/applets | |||
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH += ../$(OPIEDIR)/include | 8 | DEPENDPATH += $(OPIEDIR)/include |
9 | LIBS += -lqpe | 9 | LIBS += -lqpe |
diff --git a/core/applets/vmemo/vmemoimpl.cpp b/core/applets/vmemo/vmemoimpl.cpp index 9e6c7cd..ef4a3a6 100644 --- a/core/applets/vmemo/vmemoimpl.cpp +++ b/core/applets/vmemo/vmemoimpl.cpp | |||