summaryrefslogtreecommitdiff
path: root/apps/plugins/rockboy/rbsound.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/rockboy/rbsound.c')
-rw-r--r--apps/plugins/rockboy/rbsound.c13
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;
12bool doneplay=1; 12bool doneplay=1;
13bool bufnum=0; 13bool bufnum=0;
14 14
15static unsigned short *buf=0; 15static unsigned short *buf=0, *hwbuf=0;
16 16
17static bool newly_started; 17static bool newly_started;
18 18
19void get_more(unsigned char** start, size_t* size) 19void 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;