summaryrefslogtreecommitdiff
path: root/apps/plugins/pacbox/pacbox.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2010-07-01 03:57:37 +0000
committerMichael Sevakis <jethead71@rockbox.org>2010-07-01 03:57:37 +0000
commitceab0b04ebb52da8fd632ed051cf833d35bbdd22 (patch)
tree810b17e7b1931ce0ac13a8105196bf958e8a94e8 /apps/plugins/pacbox/pacbox.c
parentf09370058ff170bcf99481dd8115871ba20ee816 (diff)
downloadrockbox-ceab0b04ebb52da8fd632ed051cf833d35bbdd22.zip
rockbox-ceab0b04ebb52da8fd632ed051cf833d35bbdd22.tar.gz
rockbox-ceab0b04ebb52da8fd632ed051cf833d35bbdd22.tar.bz2
rockbox-ceab0b04ebb52da8fd632ed051cf833d35bbdd22.tar.xz
PacBox: Premultiply sound prom data on load rather than during emulation. Use 16-bit data for 'raw' output instead of int.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27208 a1c6a512-1295-4272-9138-f99709370657
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 8d44857..7f40822 100644
--- a/apps/plugins/pacbox/pacbox.c
+++ b/apps/plugins/pacbox/pacbox.c
@@ -281,9 +281,9 @@ static bool pacbox_menu(void)
static uint32_t sound_buf[NBSAMPLES];
#if CONFIG_CPU == MCF5249
/* Not enough to put this in IRAM */
-static int raw_buf[NBSAMPLES];
+static int16_t raw_buf[NBSAMPLES];
#else
-static int raw_buf[NBSAMPLES] IBSS_ATTR;
+static int16_t raw_buf[NBSAMPLES] IBSS_ATTR;
#endif
/*
@@ -291,22 +291,23 @@ static int raw_buf[NBSAMPLES] IBSS_ATTR;
*/
static void get_more(unsigned char **start, size_t *size)
{
- int i;
- int32_t *out;
- int *raw;
+ int32_t *out, *outend;
+ int16_t *raw;
/* Emulate the audio for the current register settings */
playSound(raw_buf, NBSAMPLES);
out = sound_buf;
+ outend = out + NBSAMPLES;
raw = raw_buf;
- /* Normalize the audio and convert to stereo */
- for (i = 0; i < NBSAMPLES; i++)
+ /* Convert to stereo */
+ do
{
- uint32_t sample = (uint16_t)*raw++ << 6;
+ uint32_t sample = (uint16_t)*raw++;
*out++ = sample | (sample << 16);
}
+ while (out < outend);
*start = (unsigned char *)sound_buf;
*size = NBSAMPLES*sizeof(sound_buf[0]);