From 60b4b403b38cf661e34c8739df69e6418f63220f Mon Sep 17 00:00:00 2001 From: notaz Date: Sat, 12 May 2007 15:06:44 +0000 Subject: [PATCH] fixed mp3 buffer overlapping of GP2X sound buffer git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@129 be3aeb3a-fb24-0410-a615-afba39da0efa --- gp2x/940ctl.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/gp2x/940ctl.c b/gp2x/940ctl.c index 6c52cca..8b3c7fe 100644 --- a/gp2x/940ctl.c +++ b/gp2x/940ctl.c @@ -29,7 +29,7 @@ static _940_data_t *shared_data = 0; _940_ctl_t *shared_ctl = 0; unsigned char *mp3_mem = 0; -#define MP3_SIZE_MAX (0x1000000 - 4*640*480) +#define MP3_SIZE_MAX (0x400000 + 0x800000) // 12M int crashed_940 = 0; @@ -360,7 +360,7 @@ void sharedmem_init(void) shared_data = (_940_data_t *) (shared_mem+0x100000); /* this area must not get buffered on either side */ shared_ctl = (_940_ctl_t *) (shared_mem+0x200000); - mp3_mem = (unsigned char *) mmap(0, MP3_SIZE_MAX, PROT_READ|PROT_WRITE, MAP_SHARED, memdev, 0x3000000); + mp3_mem = (unsigned char *) mmap(0, MP3_SIZE_MAX, PROT_READ|PROT_WRITE, MAP_SHARED, memdev, 0x2400000); if (mp3_mem == MAP_FAILED) { printf("mmap(mp3_mem) failed with %i\n", errno); @@ -599,7 +599,6 @@ void mp3_start_play(FILE *f, int pos) // pos is 0-1023 if (loaded_mp3 != f) { - // printf("loading mp3... "); fflush(stdout); if (PicoMessage != NULL) { fseek(f, 0, SEEK_END); @@ -608,8 +607,7 @@ void mp3_start_play(FILE *f, int pos) // pos is 0-1023 } fseek(f, 0, SEEK_SET); fread(mp3_mem, 1, MP3_SIZE_MAX, f); - // if (feof(f)) printf("done.\n"); - // else printf("done. mp3 too large, not all data loaded.\n"); + if (!feof(f)) printf("Warning: mp3 was too large, not all data loaded.\n"); shared_ctl->mp3_len = ftell(f); loaded_mp3 = f; -- 2.39.5