1
0
Fork 0
forked from len0rd/rockbox

pdbox: Code cleanup, optimizations.

* Reverted minimal working memory to 4 MB
* Reverted size of a single audio buffer
* Optimized sound output loop


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26454 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Wincent Balin 2010-06-01 20:37:16 +00:00
parent 279969618d
commit f52c9aae3a
2 changed files with 40 additions and 35 deletions

View file

@ -131,8 +131,9 @@ int rockbox_send_dacs(void)
if(outbuf_fill >= OUTBUFSIZE-1) if(outbuf_fill >= OUTBUFSIZE-1)
return SENDDACS_NO; return SENDDACS_NO;
do
{
/* Write the block of sound. */ /* Write the block of sound. */
write_block:
for(out = outbuf[outbuf_head].data + for(out = outbuf[outbuf_head].data +
outbuf[outbuf_head].fill * PD_OUT_CHANNELS; outbuf[outbuf_head].fill * PD_OUT_CHANNELS;
outbuf[outbuf_head].fill < (AUDIOBUFSIZE / PD_OUT_CHANNELS) && outbuf[outbuf_head].fill < (AUDIOBUFSIZE / PD_OUT_CHANNELS) &&
@ -168,8 +169,8 @@ write_block:
} }
/* If needed, fill the next frame. */ /* If needed, fill the next frame. */
if(samples_out < DEFDACBLKSIZE) }
goto write_block; while(samples_out < DEFDACBLKSIZE);
/* Clear Pure Data output buffer. */ /* Clear Pure Data output buffer. */
memset(sys_soundout, memset(sys_soundout,

View file

@ -32,7 +32,7 @@
#include "PDa/src/m_pd.h" #include "PDa/src/m_pd.h"
/* Minimal memory size. */ /* Minimal memory size. */
#define MIN_MEM_SIZE (2 * 1024 * 1024) #define MIN_MEM_SIZE (4 * 1024 * 1024)
/* Memory prototypes. */ /* Memory prototypes. */
@ -49,7 +49,11 @@
#define PD_OUT_CHANNELS 2 #define PD_OUT_CHANNELS 2
/* Audio buffer part. Contains data for one HZ period. */ /* Audio buffer part. Contains data for one HZ period. */
#ifdef SIMULATOR
#define AUDIOBUFSIZE (PD_SAMPLES_PER_HZ * PD_OUT_CHANNELS * 16)
#else
#define AUDIOBUFSIZE (PD_SAMPLES_PER_HZ * PD_OUT_CHANNELS) #define AUDIOBUFSIZE (PD_SAMPLES_PER_HZ * PD_OUT_CHANNELS)
#endif
struct audio_buffer struct audio_buffer
{ {
int16_t data[AUDIOBUFSIZE]; int16_t data[AUDIOBUFSIZE];