author | llornkcor <llornkcor> | 2004-04-22 08:33:56 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-04-22 08:33:56 (UTC) |
commit | 731e459a8621fb359ca39ccf4d11bffcc024dcfa (patch) (unidiff) | |
tree | 0b6e6ab404dfa323e7b714f3926996f0bf82a2d1 | |
parent | a0952719afc122e5a16d81253a9de86ee7e608b8 (diff) | |
download | opie-731e459a8621fb359ca39ccf4d11bffcc024dcfa.zip opie-731e459a8621fb359ca39ccf4d11bffcc024dcfa.tar.gz opie-731e459a8621fb359ca39ccf4d11bffcc024dcfa.tar.bz2 |
make buffersize user config BufferSize, default 1024, remove some mishmash
-rw-r--r-- | core/applets/vmemo/vmemo.cpp | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp index 622b1df..1ead4dd 100644 --- a/core/applets/vmemo/vmemo.cpp +++ b/core/applets/vmemo/vmemo.cpp | |||
@@ -214,5 +214,6 @@ VMemo::VMemo( QWidget *parent, const char *_name ) | |||
214 | odebug << "toggleKey " << toggleKey << "" << oendl; | 214 | odebug << "toggleKey " << toggleKey << "" << oendl; |
215 | if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) | 215 | |
216 | systemZaurus=TRUE; | 216 | // if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) |
217 | else | 217 | // systemZaurus=TRUE; |
218 | // else | ||
218 | systemZaurus=FALSE; | 219 | systemZaurus=FALSE; |
@@ -224,3 +225,3 @@ VMemo::VMemo( QWidget *parent, const char *_name ) | |||
224 | if( toggleKey != -1 ) { | 225 | if( toggleKey != -1 ) { |
225 | // keyRegister(key, channel, message) | 226 | qDebug("Register key %d", toggleKey); |
226 | QCopEnvelope e("QPE/Launcher", "keyRegister(int,QCString,QCString)"); | 227 | QCopEnvelope e("QPE/Launcher", "keyRegister(int,QCString,QCString)"); |
@@ -236,4 +237,4 @@ VMemo::VMemo( QWidget *parent, const char *_name ) | |||
236 | usingIcon=FALSE; | 237 | usingIcon=FALSE; |
237 | if( vmCfg.readNumEntry("hideIcon",0) == 1) | 238 | // if( vmCfg.readNumEntry("hideIcon",0) == 1) |
238 | hide(); | 239 | // hide(); |
239 | recording = FALSE; | 240 | recording = FALSE; |
@@ -251,3 +252,3 @@ int VMemo::position() | |||
251 | void VMemo::receive( const QCString &msg, const QByteArray &data ) { | 252 | void VMemo::receive( const QCString &msg, const QByteArray &data ) { |
252 | odebug << "receive" << oendl; | 253 | odebug << "Vmemo receive" << oendl; |
253 | QDataStream stream( data, IO_ReadOnly ); | 254 | QDataStream stream( data, IO_ReadOnly ); |
@@ -387,4 +388,4 @@ void VMemo::stopRecording() { | |||
387 | cfg.setGroup("Defaults"); | 388 | cfg.setGroup("Defaults"); |
388 | if( cfg.readNumEntry("hideIcon",0) == 1 ) | 389 | // if( cfg.readNumEntry("hideIcon",0) == 1 ) |
389 | hide(); | 390 | // hide(); |
390 | } | 391 | } |
@@ -502,7 +503,5 @@ bool VMemo::record() { | |||
502 | 503 | ||
503 | int bufsize=1024; | 504 | |
504 | int bytesWritten=0; | 505 | int bytesWritten=0; |
505 | signed short sound[1024], monoBuffer[1024]; | 506 | |
506 | char abuf[bufsize/2]; | ||
507 | short sbuf[bufsize]; | ||
508 | Config vmCfg("Vmemo"); | 507 | Config vmCfg("Vmemo"); |
@@ -511,2 +510,7 @@ bool VMemo::record() { | |||
511 | 510 | ||
511 | int bufsize = vmCfg.readNumEntry("BufferSize",1024); | ||
512 | signed short sound[bufsize], monoBuffer[bufsize]; | ||
513 | char abuf[bufsize / 2]; | ||
514 | short sbuf[bufsize]; | ||
515 | |||
512 | while(recording) { | 516 | while(recording) { |
@@ -514,5 +518,5 @@ bool VMemo::record() { | |||
514 | if(useADPCM) | 518 | if(useADPCM) |
515 | result = read( dsp, sbuf, bufsize); // 8192 | 519 | result = ::read(dsp, sbuf, bufsize); // 8192 |
516 | else | 520 | else |
517 | result = read(dsp, sound, 1024); // 8192 | 521 | result = ::read(dsp, sound, bufsize); // 8192 |
518 | if( result <= 0) { | 522 | if( result <= 0) { |
@@ -531,7 +535,7 @@ bool VMemo::record() { | |||
531 | } else { | 535 | } else { |
532 | for (int i = 0; i < result; i++) { //since Z is mono do normally | 536 | // for (int i = 0; i < result; i++) { //since Z is mono do normally |
533 | monoBuffer[i] = sound[i]; | 537 | // monoBuffer[i] = sound[i]; |
534 | } | 538 | // } |
535 | 539 | ||
536 | length+=write(wav, monoBuffer, result); | 540 | length += write(wav, sound, result); |
537 | } | 541 | } |