-rw-r--r-- | core/applets/vmemo/vmemo.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp index 4b668de..ec46340 100644 --- a/core/applets/vmemo/vmemo.cpp +++ b/core/applets/vmemo/vmemo.cpp | |||
@@ -1,52 +1,52 @@ | |||
1 | /************************************************************************************ | 1 | /************************************************************************************ |
2 | ** | 2 | ** |
3 | ** This file may be distributed and/or modified under the terms of the | 3 | ** This file may be distributed and/or modified under the terms of the |
4 | ** GNU General Public License version 2 as published by the Free Software | 4 | ** GNU General Public License version 2 as published by the Free Software |
5 | ** Foundation and appearing in the file LICENSE.GPL included in the | 5 | ** Foundation and appearing in the file LICENSE.GPL included in the |
6 | ** packaging of this file. | 6 | ** packaging of this file. |
7 | ** | 7 | ** |
8 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 8 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
9 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 9 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
10 | ** | 10 | ** |
11 | ************************************************************************************/ | 11 | ************************************************************************************/ |
12 | /* | 12 | /* |
13 | * $Id$ | 13 | * $Id$ |
14 | */ | 14 | */ |
15 | // Sun 03-17-2002 L.J.Potter <ljp@llornkcor.com> | 15 | // Sun 03-17-2002 L.J.Potter <ljp@llornkcor.com> |
16 | #include <sys/utsname.h> | 16 | #include <sys/utsname.h> |
17 | #include <sys/time.h> | 17 | #include <sys/time.h> |
18 | #include <sys/types.h> | 18 | #include <sys/types.h> |
19 | #include <unistd.h> | 19 | #include <unistd.h> |
20 | #include <stdio.h> | 20 | #include <stdio.h> |
21 | #include <sys/stat.h> | 21 | #include <sys/stat.h> |
22 | #include <fcntl.h> | 22 | #include <fcntl.h> |
23 | #include <sys/ioctl.h> | 23 | #include <sys/ioctl.h> |
24 | #include <linux/soundcard.h> | 24 | #include <linux/soundcard.h> |
25 | |||
25 | #include <string.h> | 26 | #include <string.h> |
26 | #include <stdlib.h> | 27 | #include <stdlib.h> |
27 | #include <errno.h> | 28 | #include <errno.h> |
28 | #include <string.h> | ||
29 | 29 | ||
30 | typedef struct _waveheader { | 30 | typedef struct _waveheader { |
31 | u_long main_chunk; /* 'RIFF' */ | 31 | u_long main_chunk; /* 'RIFF' */ |
32 | u_long length; /* filelen */ | 32 | u_long length; /* filelen */ |
33 | u_long chunk_type; /* 'WAVE' */ | 33 | u_long chunk_type; /* 'WAVE' */ |
34 | u_long sub_chunk; /* 'fmt ' */ | 34 | u_long sub_chunk; /* 'fmt ' */ |
35 | u_long sc_len; /* length of sub_chunk, =16 | 35 | u_long sc_len; /* length of sub_chunk, =16 |
36 | (chunckSize) format len */ | 36 | (chunckSize) format len */ |
37 | u_short format; /* should be 1 for PCM-code (formatTag) */ | 37 | u_short format; /* should be 1 for PCM-code (formatTag) */ |
38 | 38 | ||
39 | u_short modus; /* 1 Mono, 2 Stereo (channels) */ | 39 | u_short modus; /* 1 Mono, 2 Stereo (channels) */ |
40 | u_long sample_fq; /* samples per second (samplesPerSecond) */ | 40 | u_long sample_fq; /* samples per second (samplesPerSecond) */ |
41 | u_long byte_p_sec; /* avg bytes per second (avgBytePerSecond) */ | 41 | u_long byte_p_sec; /* avg bytes per second (avgBytePerSecond) */ |
42 | u_short byte_p_spl; /* samplesize; 1 or 2 bytes (blockAlign) */ | 42 | u_short byte_p_spl; /* samplesize; 1 or 2 bytes (blockAlign) */ |
43 | u_short bit_p_spl; /* 8, 12 or 16 bit (bitsPerSample) */ | 43 | u_short bit_p_spl; /* 8, 12 or 16 bit (bitsPerSample) */ |
44 | 44 | ||
45 | u_long data_chunk; /* 'data' */ | 45 | u_long data_chunk; /* 'data' */ |
46 | 46 | ||
47 | u_long data_length;/* samplecount */ | 47 | u_long data_length;/* samplecount */ |
48 | } WaveHeader; | 48 | } WaveHeader; |
49 | 49 | ||
50 | #define RIFF 0x46464952 | 50 | #define RIFF 0x46464952 |
51 | #define WAVE 0x45564157 | 51 | #define WAVE 0x45564157 |
52 | #define FMT 0x20746D66 | 52 | #define FMT 0x20746D66 |
@@ -272,49 +272,49 @@ void VMemo::mousePressEvent( QMouseEvent *me ) | |||
272 | qDebug("Start recording"); | 272 | qDebug("Start recording"); |
273 | recording = TRUE; | 273 | recording = TRUE; |
274 | if (openDSP() == -1) { | 274 | if (openDSP() == -1) { |
275 | QMessageBox::critical(0, "VMemo", "Could not open dsp device.\n"+errorMsg, "Abort"); | 275 | QMessageBox::critical(0, "VMemo", "Could not open dsp device.\n"+errorMsg, "Abort"); |
276 | recording = FALSE; | 276 | recording = FALSE; |
277 | return; | 277 | return; |
278 | } | 278 | } |
279 | 279 | ||
280 | Config vmCfg("VMemo"); | 280 | Config vmCfg("VMemo"); |
281 | vmCfg.setGroup("Defaults"); | 281 | vmCfg.setGroup("Defaults"); |
282 | 282 | ||
283 | QDateTime dt = QDateTime::currentDateTime(); | 283 | QDateTime dt = QDateTime::currentDateTime(); |
284 | 284 | ||
285 | QString fName; | 285 | QString fName; |
286 | Config cfg( "Sound" ); | 286 | Config cfg( "Sound" ); |
287 | cfg.setGroup( "System" ); | 287 | cfg.setGroup( "System" ); |
288 | fName = QPEApplication::documentDir() ; | 288 | fName = QPEApplication::documentDir() ; |
289 | fileName = cfg.readEntry("RecLocation", fName); | 289 | fileName = cfg.readEntry("RecLocation", fName); |
290 | 290 | ||
291 | int s; | 291 | int s; |
292 | s=fileName.find(':'); | 292 | s=fileName.find(':'); |
293 | if(s) | 293 | if(s) |
294 | fileName=fileName.right(fileName.length()-s-2); | 294 | fileName=fileName.right(fileName.length()-s-2); |
295 | qDebug("filename will be "+fileName); | 295 | qDebug("filename will be "+fileName); |
296 | if( !fileName.right(1).find('/') == -1) | 296 | if( fileName.right(1).find('/') == -1) |
297 | fileName+="/"; | 297 | fileName+="/"; |
298 | 298 | ||
299 | // if(systemZaurus) | 299 | // if(systemZaurus) |
300 | // fileName=vmCfg.readEntry("Dir", "/mnt/cf/"); // zaurus does not have /mnt/ramfs | 300 | // fileName=vmCfg.readEntry("Dir", "/mnt/cf/"); // zaurus does not have /mnt/ramfs |
301 | // else | 301 | // else |
302 | // fileName=vmCfg.readEntry("Dir", "/mnt/ramfs/"); | 302 | // fileName=vmCfg.readEntry("Dir", "/mnt/ramfs/"); |
303 | 303 | ||
304 | fName = "vm_"+ dt.toString()+ ".wav"; | 304 | fName = "vm_"+ dt.toString()+ ".wav"; |
305 | 305 | ||
306 | fileName+=fName; | 306 | fileName+=fName; |
307 | qDebug("filename is "+fileName); | 307 | qDebug("filename is "+fileName); |
308 | // No spaces in the filename | 308 | // No spaces in the filename |
309 | fileName.replace(QRegExp("'"),""); | 309 | fileName.replace(QRegExp("'"),""); |
310 | fileName.replace(QRegExp(" "),"_"); | 310 | fileName.replace(QRegExp(" "),"_"); |
311 | fileName.replace(QRegExp(":"),"."); | 311 | fileName.replace(QRegExp(":"),"."); |
312 | fileName.replace(QRegExp(","),""); | 312 | fileName.replace(QRegExp(","),""); |
313 | 313 | ||
314 | if(openWAV(fileName.latin1()) == -1) { | 314 | if(openWAV(fileName.latin1()) == -1) { |
315 | QString err("Could not open the output file\n"); | 315 | QString err("Could not open the output file\n"); |
316 | err += fileName; | 316 | err += fileName; |
317 | QMessageBox::critical(0, "VMemo", err, "Abort"); | 317 | QMessageBox::critical(0, "VMemo", err, "Abort"); |
318 | close(dsp); | 318 | close(dsp); |
319 | return; | 319 | return; |
320 | } | 320 | } |