summaryrefslogtreecommitdiff
path: root/apps/plugins/pacbox/pacbox.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/pacbox/pacbox.c')
-rw-r--r--apps/plugins/pacbox/pacbox.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/apps/plugins/pacbox/pacbox.c b/apps/plugins/pacbox/pacbox.c
index 8d44857666..7f40822e0d 100644
--- a/apps/plugins/pacbox/pacbox.c
+++ b/apps/plugins/pacbox/pacbox.c
@@ -281,9 +281,9 @@ static bool pacbox_menu(void)
281static uint32_t sound_buf[NBSAMPLES]; 281static uint32_t sound_buf[NBSAMPLES];
282#if CONFIG_CPU == MCF5249 282#if CONFIG_CPU == MCF5249
283/* Not enough to put this in IRAM */ 283/* Not enough to put this in IRAM */
284static int raw_buf[NBSAMPLES]; 284static int16_t raw_buf[NBSAMPLES];
285#else 285#else
286static int raw_buf[NBSAMPLES] IBSS_ATTR; 286static int16_t raw_buf[NBSAMPLES] IBSS_ATTR;
287#endif 287#endif
288 288
289/* 289/*
@@ -291,22 +291,23 @@ static int raw_buf[NBSAMPLES] IBSS_ATTR;
291 */ 291 */
292static void get_more(unsigned char **start, size_t *size) 292static void get_more(unsigned char **start, size_t *size)
293{ 293{
294 int i; 294 int32_t *out, *outend;
295 int32_t *out; 295 int16_t *raw;
296 int *raw;
297 296
298 /* Emulate the audio for the current register settings */ 297 /* Emulate the audio for the current register settings */
299 playSound(raw_buf, NBSAMPLES); 298 playSound(raw_buf, NBSAMPLES);
300 299
301 out = sound_buf; 300 out = sound_buf;
301 outend = out + NBSAMPLES;
302 raw = raw_buf; 302 raw = raw_buf;
303 303
304 /* Normalize the audio and convert to stereo */ 304 /* Convert to stereo */
305 for (i = 0; i < NBSAMPLES; i++) 305 do
306 { 306 {
307 uint32_t sample = (uint16_t)*raw++ << 6; 307 uint32_t sample = (uint16_t)*raw++;
308 *out++ = sample | (sample << 16); 308 *out++ = sample | (sample << 16);
309 } 309 }
310 while (out < outend);
310 311
311 *start = (unsigned char *)sound_buf; 312 *start = (unsigned char *)sound_buf;
312 *size = NBSAMPLES*sizeof(sound_buf[0]); 313 *size = NBSAMPLES*sizeof(sound_buf[0]);