summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-02-15 03:04:38 (UTC)
committer llornkcor <llornkcor>2002-02-15 03:04:38 (UTC)
commit7c4ee87ab334a8e245d8345b378400bf787a7d5a (patch) (unidiff)
treeddf4f90a7cdd18c62f07e4cc2b28cdb6f79481aa
parentb429144b79049fcc25dfff5a9a38415451399e58 (diff)
downloadopie-7c4ee87ab334a8e245d8345b378400bf787a7d5a.zip
opie-7c4ee87ab334a8e245d8345b378400bf787a7d5a.tar.gz
opie-7c4ee87ab334a8e245d8345b378400bf787a7d5a.tar.bz2
cleaned up comments
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/vmemo/vmemo.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp
index bba55a3..9c0025d 100644
--- a/core/applets/vmemo/vmemo.cpp
+++ b/core/applets/vmemo/vmemo.cpp
@@ -277,91 +277,91 @@ int VMemo::openDSP()
277 if(ioctl(dsp, SNDCTL_DSP_CHANNELS , &channels)==-1) 277 if(ioctl(dsp, SNDCTL_DSP_CHANNELS , &channels)==-1)
278 { 278 {
279 perror("ioctl(\"SNDCTL_DSP_CHANNELS\")"); 279 perror("ioctl(\"SNDCTL_DSP_CHANNELS\")");
280 return -1; 280 return -1;
281 } 281 }
282 if(ioctl(dsp, SNDCTL_DSP_SPEED , &speed)==-1) 282 if(ioctl(dsp, SNDCTL_DSP_SPEED , &speed)==-1)
283 { 283 {
284 perror("ioctl(\"SNDCTL_DSP_SPEED\")"); 284 perror("ioctl(\"SNDCTL_DSP_SPEED\")");
285 return -1; 285 return -1;
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
296int VMemo::openWAV(const char *filename) 296int 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;
310 wh.length=0; /* filelen */ 310 wh.length=0;
311 wh.chunk_type = WAVE;//WAVE 311 wh.chunk_type = WAVE;
312 wh.sub_chunk = FMT;// fmt 312 wh.sub_chunk = FMT;
313 wh.sc_len = 16;// format length = 16 313 wh.sc_len = 16;
314 wh.format = PCM_CODE;// PCM 314 wh.format = PCM_CODE;
315 wh.modus = channels;// channels 315 wh.modus = channels;
316 wh.sample_fq = speed;//samplerate 316 wh.sample_fq = speed;
317 wh.byte_p_sec = speed * channels * resolution/8;// av bytes per second 317 wh.byte_p_sec = speed * channels * resolution/8;
318 wh.byte_p_spl = channels * (resolution / 8); //block align 318 wh.byte_p_spl = channels * (resolution / 8);
319 wh.bit_p_spl = resolution;//bits per sample 8, or 16 319 wh.bit_p_spl = resolution;
320 wh.data_chunk = DATA; 320 wh.data_chunk = DATA;
321 wh.data_length= 0; // <--- 321 wh.data_length= 0;
322// 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"
323// , 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 );
324 write (wav, &wh, sizeof(WaveHeader)); 324 write (wav, &wh, sizeof(WaveHeader));
325 325
326 return 1; 326 return 1;
327} 327}
328 328
329void VMemo::record(void) 329void VMemo::record(void)
330{ 330{
331 int length=0, result, value; 331 int length=0, result, value;
332 char sound[8192]; 332 char sound[8192];
333 333
334 qWarning("VMemo::record()"); 334 qWarning("VMemo::record()");
335 335
336 while(recording) 336 while(recording)
337 { 337 {
338 result = read(dsp, sound, 512); // 8192 338 result = read(dsp, sound, 512); // 8192
339 qApp->processEvents(); 339 qApp->processEvents();
340 write(wav, sound, result); 340 write(wav, sound, result);
341 qApp->processEvents(); 341 qApp->processEvents();
342 length += result; 342 length += result;
343 qApp->processEvents(); 343 qApp->processEvents();
344// printf("%d\r",length); 344// printf("%d\r",length);
345// fflush(stdout); 345// fflush(stdout);
346 } 346 }
347 347
348 qWarning("VMemo::record() -> Done recording"); 348 qWarning("VMemo::record() -> Done recording");
349 qWarning("VMemo::record() -> Closing dsp"); 349 qWarning("VMemo::record() -> Closing dsp");
350 350
351 value = length+36; 351 value = length+36;
352 lseek(wav, 4, SEEK_SET); 352 lseek(wav, 4, SEEK_SET);
353 write(wav, &value, 4); 353 write(wav, &value, 4);
354 lseek(wav, 40, SEEK_SET); 354 lseek(wav, 40, SEEK_SET);
355 write(wav, &length, 4); 355 write(wav, &length, 4);
356// qDebug("File length %d, samplecount %d", value, length); 356// qDebug("File length %d, samplecount %d", value, length);
357 track.close(); 357 track.close();
358 358
359 if( ioctl( dsp, SNDCTL_DSP_RESET,0) == -1)// ); //tell driver to stop for a while 359 if( ioctl( dsp, SNDCTL_DSP_RESET,0) == -1)
360 perror("ioctl(\"SNDCTL_DSP_RESET\")"); 360 perror("ioctl(\"SNDCTL_DSP_RESET\")");
361 ::close(dsp); 361 ::close(dsp);
362 362
363 qWarning("VMemo::record() -> playing done recording sound"); 363 qWarning("VMemo::record() -> playing done recording sound");
364 QSound::play(Resource::findSound("vmemoe")); 364 QSound::play(Resource::findSound("vmemoe"));
365 qWarning("VMemo::record() -> terminating"); 365 qWarning("VMemo::record() -> terminating");
366 QMessageBox::information(0, "VMemo", "Recording Done", 1); 366 QMessageBox::information(0, "VMemo", "Recording Done", 1);
367} 367}