diff options
author | Karl Kurbjun <kkurbjun@gmail.com> | 2007-07-21 04:00:58 +0000 |
---|---|---|
committer | Karl Kurbjun <kkurbjun@gmail.com> | 2007-07-21 04:00:58 +0000 |
commit | fa3fc0c5c7e89ad6ce26e9d3563e3a064b018413 (patch) | |
tree | 6f7a0f73c8bf25ced6286614e01af7983b59070a /apps/plugins/rockboy/rbsound.c | |
parent | e9c09d4d0e1170c6c81991c2660608854d960a77 (diff) | |
download | rockbox-fa3fc0c5c7e89ad6ce26e9d3563e3a064b018413.tar.gz rockbox-fa3fc0c5c7e89ad6ce26e9d3563e3a064b018413.zip |
Commit FS #7379 - This patch fixes most of the sound problems from the previous version. This is a complete rewrite of VisualBoyAdvance's sound code from C++ to C. This patch also eliminates the need for some large tables giving more room in IRAM and the plugin buffer.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13947 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/rockboy/rbsound.c')
-rw-r--r-- | apps/plugins/rockboy/rbsound.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/apps/plugins/rockboy/rbsound.c b/apps/plugins/rockboy/rbsound.c index fe2c27af67..b5cfc96fa4 100644 --- a/apps/plugins/rockboy/rbsound.c +++ b/apps/plugins/rockboy/rbsound.c | |||
@@ -12,13 +12,14 @@ struct pcm pcm IBSS_ATTR; | |||
12 | bool doneplay=1; | 12 | bool doneplay=1; |
13 | bool bufnum=0; | 13 | bool bufnum=0; |
14 | 14 | ||
15 | static unsigned short *buf=0; | 15 | static unsigned short *buf=0, *hwbuf=0; |
16 | 16 | ||
17 | static bool newly_started; | 17 | static bool newly_started; |
18 | 18 | ||
19 | void get_more(unsigned char** start, size_t* size) | 19 | void get_more(unsigned char** start, size_t* size) |
20 | { | 20 | { |
21 | *start = (unsigned char*)(&buf[pcm.len*doneplay]); | 21 | memcpy(hwbuf, &buf[pcm.len*doneplay], BUF_SIZE*sizeof(short)); |
22 | *start = (unsigned char*)(hwbuf); | ||
22 | *size = BUF_SIZE*sizeof(short); | 23 | *size = BUF_SIZE*sizeof(short); |
23 | doneplay=1; | 24 | doneplay=1; |
24 | } | 25 | } |
@@ -29,14 +30,20 @@ void pcm_init(void) | |||
29 | return; | 30 | return; |
30 | 31 | ||
31 | newly_started = true; | 32 | newly_started = true; |
32 | 33 | ||
34 | #if defined(HW_HAVE_11) && !defined(TOSHIBA_GIGABEAT_F) | ||
35 | pcm.hz = SAMPR_11; | ||
36 | #else | ||
33 | pcm.hz = SAMPR_44; | 37 | pcm.hz = SAMPR_44; |
38 | #endif | ||
39 | |||
34 | pcm.stereo = 1; | 40 | pcm.stereo = 1; |
35 | 41 | ||
36 | pcm.len = BUF_SIZE; | 42 | pcm.len = BUF_SIZE; |
37 | if(!buf) | 43 | if(!buf) |
38 | { | 44 | { |
39 | buf = my_malloc(pcm.len * N_BUFS *sizeof(short)); | 45 | buf = my_malloc(pcm.len * N_BUFS *sizeof(short)); |
46 | hwbuf = my_malloc(pcm.len *sizeof(short)); | ||
40 | 47 | ||
41 | pcm.buf = buf; | 48 | pcm.buf = buf; |
42 | pcm.pos = 0; | 49 | pcm.pos = 0; |