-rw-r--r-- | core/applets/vmemo/vmemo.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp index 577db75..4b398ad 100644 --- a/core/applets/vmemo/vmemo.cpp +++ b/core/applets/vmemo/vmemo.cpp @@ -363,13 +363,13 @@ bool VMemo::startRecording() { fileName+=fName; // No spaces in the filename fileName.replace(QRegExp("'"),""); fileName.replace(QRegExp(" "),"_"); fileName.replace(QRegExp(":"),"."); fileName.replace(QRegExp(","),""); - fileName += ".wav"; + qDebug("filename is "+fileName); // open tmp file here char *pointer; pointer=tmpnam(NULL); qDebug("Opening tmp file %s",pointer); @@ -383,14 +383,18 @@ bool VMemo::startRecording() { ::close(dsp); return FALSE; } if( record() ) { QString cmd; + if( fileName.find(".wav",0,TRUE) == -1) + fileName += ".wav"; + cmd.sprintf("mv %s "+fileName, pointer); // move tmp file to regular file here + system(cmd.latin1()); QArray<int> cats(1); cats[0] = config.readNumEntry("Category", 0); QString dlName("vm_"); @@ -480,12 +484,14 @@ int VMemo::openWAV(const char *filename) { if(!track.open(IO_WriteOnly|IO_Truncate|IO_Raw)) { errorMsg=filename; return -1; } wav=track.handle(); + Config vmCfg("Vmemo"); + vmCfg.setGroup("Defaults"); useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0); WaveHeader wh; wh.main_chunk = RIFF; wh.length=0; @@ -530,12 +536,14 @@ bool VMemo::record() { int bufsize=1024; int bytesWritten=0; signed short sound[1024], monoBuffer[1024]; char abuf[bufsize/2]; short sbuf[bufsize]; + Config vmCfg("Vmemo"); + vmCfg.setGroup("Defaults"); useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0); while(recording) { if(useADPCM) result = read( dsp, sbuf, bufsize); // 8192 @@ -592,13 +600,13 @@ bool VMemo::record() { qDebug("Track closed"); if( ioctl( dsp, SNDCTL_DSP_RESET,0) == -1) perror("ioctl(\"SNDCTL_DSP_RESET\")"); ::close(dsp); - fileName = fileName.left(fileName.length()-4); + // if(useAlerts) // QMessageBox::message("Vmemo"," Done1 recording\n"+ fileName); qDebug("done recording "+fileName); // QSound::play(Resource::findSound("vmemoe")); |