author | llornkcor <llornkcor> | 2002-02-15 02:40:16 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-02-15 02:40:16 (UTC) |
commit | b429144b79049fcc25dfff5a9a38415451399e58 (patch) (unidiff) | |
tree | e6a6bf929667e3c5a521145809b2615bb4b0c6e9 | |
parent | e5ac946b3ced52f4aba73dfc64398bb3d8245734 (diff) | |
download | opie-b429144b79049fcc25dfff5a9a38415451399e58.zip opie-b429144b79049fcc25dfff5a9a38415451399e58.tar.gz opie-b429144b79049fcc25dfff5a9a38415451399e58.tar.bz2 |
forgot length in header
-rw-r--r-- | core/applets/vmemo/vmemo.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp index 25ee476..bba55a3 100644 --- a/core/applets/vmemo/vmemo.cpp +++ b/core/applets/vmemo/vmemo.cpp | |||
@@ -286,48 +286,49 @@ int VMemo::openDSP() | |||
286 | } | 286 | } |
287 | if(ioctl(dsp, SOUND_PCM_READ_RATE , &rate)==-1) | 287 | if(ioctl(dsp, SOUND_PCM_READ_RATE , &rate)==-1) |
288 | { | 288 | { |
289 | perror("ioctl(\"SOUND_PCM_READ_RATE\")"); | 289 | perror("ioctl(\"SOUND_PCM_READ_RATE\")"); |
290 | return -1; | 290 | return -1; |
291 | } | 291 | } |
292 | 292 | ||
293 | return 1; | 293 | return 1; |
294 | } | 294 | } |
295 | 295 | ||
296 | int VMemo::openWAV(const char *filename) | 296 | int VMemo::openWAV(const char *filename) |
297 | { | 297 | { |
298 | qDebug("Creating %s ",filename); | 298 | qDebug("Creating %s ",filename); |
299 | track.setName(filename); | 299 | track.setName(filename); |
300 | if(!track.open(IO_WriteOnly|IO_Truncate|IO_Raw)) | 300 | if(!track.open(IO_WriteOnly|IO_Truncate|IO_Raw)) |
301 | { | 301 | { |
302 | qDebug("Could not open file"); | 302 | qDebug("Could not open file"); |
303 | return -1; | 303 | return -1; |
304 | } | 304 | } |
305 | wav=track.handle(); | 305 | wav=track.handle(); |
306 | 306 | ||
307 | WaveHeader wh; | 307 | WaveHeader wh; |
308 | 308 | ||
309 | wh.main_chunk = RIFF;// RIFF | 309 | wh.main_chunk = RIFF;// RIFF |
310 | wh.length=0; /* filelen */ | ||
310 | wh.chunk_type = WAVE;//WAVE | 311 | wh.chunk_type = WAVE;//WAVE |
311 | wh.sub_chunk = FMT;// fmt | 312 | wh.sub_chunk = FMT;// fmt |
312 | wh.sc_len = 16;// format length = 16 | 313 | wh.sc_len = 16;// format length = 16 |
313 | wh.format = PCM_CODE;// PCM | 314 | wh.format = PCM_CODE;// PCM |
314 | wh.modus = channels;// channels | 315 | wh.modus = channels;// channels |
315 | wh.sample_fq = speed;//samplerate | 316 | wh.sample_fq = speed;//samplerate |
316 | wh.byte_p_sec = speed * channels * resolution/8;// av bytes per second | 317 | wh.byte_p_sec = speed * channels * resolution/8;// av bytes per second |
317 | wh.byte_p_spl = channels * (resolution / 8); //block align | 318 | wh.byte_p_spl = channels * (resolution / 8); //block align |
318 | wh.bit_p_spl = resolution;//bits per sample 8, or 16 | 319 | wh.bit_p_spl = resolution;//bits per sample 8, or 16 |
319 | wh.data_chunk = DATA; | 320 | wh.data_chunk = DATA; |
320 | wh.data_length= 0; // <--- | 321 | wh.data_length= 0; // <--- |
321 | // qDebug("Write header channels %d, speed %d, b/s %d, blockalign %d, bitrate %d" | 322 | // qDebug("Write header channels %d, speed %d, b/s %d, blockalign %d, bitrate %d" |
322 | // , wh.modus, wh.sample_fq, wh.byte_p_sec, wh.byte_p_spl, wh.bit_p_spl ); | 323 | // , wh.modus, wh.sample_fq, wh.byte_p_sec, wh.byte_p_spl, wh.bit_p_spl ); |
323 | write (wav, &wh, sizeof(WaveHeader)); | 324 | write (wav, &wh, sizeof(WaveHeader)); |
324 | 325 | ||
325 | return 1; | 326 | return 1; |
326 | } | 327 | } |
327 | 328 | ||
328 | void VMemo::record(void) | 329 | void VMemo::record(void) |
329 | { | 330 | { |
330 | int length=0, result, value; | 331 | int length=0, result, value; |
331 | char sound[8192]; | 332 | char sound[8192]; |
332 | 333 | ||
333 | qWarning("VMemo::record()"); | 334 | qWarning("VMemo::record()"); |