summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/rockboy/rbsound.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/apps/plugins/rockboy/rbsound.c b/apps/plugins/rockboy/rbsound.c
index 92f824aa3b..7d359d847d 100644
--- a/apps/plugins/rockboy/rbsound.c
+++ b/apps/plugins/rockboy/rbsound.c
@@ -11,6 +11,13 @@ struct pcm pcm;
11#define DMA_PORTION (1024) 11#define DMA_PORTION (1024)
12 12
13static short buf1_unal[(BUF_SIZE / sizeof(short)) + 2]; // to make sure 4 byte aligned 13static short buf1_unal[(BUF_SIZE / sizeof(short)) + 2]; // to make sure 4 byte aligned
14
15rcvar_t pcm_exports[] =
16{
17 RCV_END
18};
19
20#if CONFIG_HWCODEC == MASNONE
14static short* buf1; 21static short* buf1;
15 22
16static short front_buf[512]; 23static short front_buf[512];
@@ -20,11 +27,6 @@ static short* last_back_pos;
20static bool newly_started; 27static bool newly_started;
21static int turns; 28static int turns;
22 29
23rcvar_t pcm_exports[] =
24{
25 RCV_END
26};
27
28void pcm_init(void) 30void pcm_init(void)
29{ 31{
30 buf1 = (signed short*)((((unsigned int)buf1_unal) >> 2) << 2); /* here i just make sure that buffer is aligned to 4 bytes*/ 32 buf1 = (signed short*)((((unsigned int)buf1_unal) >> 2) << 2); /* here i just make sure that buffer is aligned to 4 bytes*/
@@ -85,7 +87,6 @@ void get_more(unsigned char** start, long* size)
85 87
86int pcm_submit(void) 88int pcm_submit(void)
87{ 89{
88#ifdef RBSOUND
89 while( (turns < 0) && ((((unsigned int)last_back_pos) + pcm.pos * sizeof(short)) > ((unsigned int)SAR0)) && !newly_started) rb->yield(); /* wait until data is passed through DAC or until exit*/ 90 while( (turns < 0) && ((((unsigned int)last_back_pos) + pcm.pos * sizeof(short)) > ((unsigned int)SAR0)) && !newly_started) rb->yield(); /* wait until data is passed through DAC or until exit*/
90 int shorts_left = ((((unsigned int)buf1) + BUF_SIZE) - ((unsigned int)last_back_pos)) / sizeof(short); 91 int shorts_left = ((((unsigned int)buf1) + BUF_SIZE) - ((unsigned int)last_back_pos)) / sizeof(short);
91 if( shorts_left >= pcm.pos ) 92 if( shorts_left >= pcm.pos )
@@ -112,13 +113,25 @@ int pcm_submit(void)
112 113
113 pcm.pos = 0; 114 pcm.pos = 0;
114 return 1; 115 return 1;
116}
115#else 117#else
118void pcm_init(void)
119{
120 pcm.hz = 11025;
121 pcm.stereo = 1;
122 pcm.buf = buf1_unal;
123 pcm.len = (BUF_SIZE / sizeof(short));
116 pcm.pos = 0; 124 pcm.pos = 0;
117 return 0;
118#endif
119} 125}
120 126
121 127void pcm_close(void)
122 128{
123 129 memset(&pcm, 0, sizeof pcm);
130}
131int pcm_submit(void)
132{
133 pcm.pos =0;
134 return 0;
135}
136#endif
124 137