summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-05-29 10:26:06 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-05-29 10:26:06 +0000
commitf779e26c89f3f419af82dd18561fc5f00a5da491 (patch)
tree9772ed4e963809bed9080935f6c9615f063dcd26
parent7b719114a10225613470296d10299c38545e6a65 (diff)
downloadrockbox-f779e26c89f3f419af82dd18561fc5f00a5da491.tar.gz
rockbox-f779e26c89f3f419af82dd18561fc5f00a5da491.zip
Boosted the volume. Now handles end-of-song better
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@786 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/mpeg.c90
1 files changed, 46 insertions, 44 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index cb19ebddf9..dae0ef4d41 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -354,62 +354,64 @@ static void mpeg_thread(void)
354 read too large chunks because the bitswapping will take 354 read too large chunks because the bitswapping will take
355 too much time. We must keep the DMA happy and also give 355 too much time. We must keep the DMA happy and also give
356 the other threads a chance to run. */ 356 the other threads a chance to run. */
357 DEBUGF("R\n"); 357 if(filling)
358 len = read(mpeg_file, mp3buf+mp3buf_write, amount_to_read);
359 if(len)
360 { 358 {
361 DEBUGF("B\n"); 359 DEBUGF("R\n");
362 bitswap(mp3buf + mp3buf_write, len); 360 len = read(mpeg_file, mp3buf+mp3buf_write, amount_to_read);
363 361 if(len)
364 mp3buf_write += len;
365 if(mp3buf_write >= mp3buflen)
366 { 362 {
367 mp3buf_write = 0; 363 DEBUGF("B\n");
368 DEBUGF("W\n"); 364 bitswap(mp3buf + mp3buf_write, len);
369 } 365
366 mp3buf_write += len;
367 if(mp3buf_write >= mp3buflen)
368 {
369 mp3buf_write = 0;
370 DEBUGF("W\n");
371 }
370 372
371 /* Tell ourselves that we want more data */ 373 /* Tell ourselves that we want more data */
372 queue_post(&mpeg_queue, MPEG_NEED_DATA, 0); 374 queue_post(&mpeg_queue, MPEG_NEED_DATA, 0);
373 375
374 /* And while we're at it, see if we have startet playing 376 /* And while we're at it, see if we have started
375 yet. If not, do it. */ 377 playing yet. If not, do it. */
376 if(play_pending) 378 if(play_pending)
377 { 379 {
378 play_pending = false; 380 play_pending = false;
379 playing = true; 381 playing = true;
380 382
381 init_dma(); 383 init_dma();
382 start_dma(); 384 start_dma();
385 }
383 } 386 }
384 } 387 else
385 else 388 {
386 { 389 close(mpeg_file);
387 close(mpeg_file);
388 390
389 /* Make sure that the write pointer is at a word 391 /* Make sure that the write pointer is at a word
390 boundary */ 392 boundary */
391 mp3buf_write &= 0xfffffffe; 393 mp3buf_write &= 0xfffffffe;
392 394
393#if 1 395#if 1
394 /* No more data to play */
395 DEBUGF("Finished playing\n");
396 playing = false;
397 filling = false;
398#else
399 next_track();
400 if(new_file() < 0)
401 {
402 /* No more data to play */ 396 /* No more data to play */
403 DEBUGF("Finished playing\n"); 397 DEBUGF("Finished playing\n");
404 playing = false;
405 filling = false; 398 filling = false;
406 } 399#else
407 else 400 next_track();
408 { 401 if(new_file() < 0)
409 /* Tell ourselves that we want more data */ 402 {
410 queue_post(&mpeg_queue, MPEG_NEED_DATA, 0); 403 /* No more data to play */
411 } 404 DEBUGF("Finished playing\n");
405 playing = false;
406 filling = false;
407 }
408 else
409 {
410 /* Tell ourselves that we want more data */
411 queue_post(&mpeg_queue, MPEG_NEED_DATA, 0);
412 }
412#endif 413#endif
414 }
413 } 415 }
414 break; 416 break;
415 } 417 }
@@ -482,7 +484,7 @@ void mpeg_resume(void)
482 484
483void mpeg_volume(int percent) 485void mpeg_volume(int percent)
484{ 486{
485 int volume = 0x2c * percent / 100; 487 int volume = 0x38 * percent / 100;
486 dac_volume(volume); 488 dac_volume(volume);
487} 489}
488 490