1
0
Fork 0
forked from len0rd/rockbox

Increase temp buffer size to fit more samples, put in simple safeguard to avoid memory corruption when writing to the temp buffer

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15253 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Nils Wallménius 2007-10-21 22:50:10 +00:00
parent 47d8323deb
commit 2d91cf3ea3

View file

@ -424,13 +424,17 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i
/* buffer to hold all the samples for the current tick, this is a hack /* buffer to hold all the samples for the current tick, this is a hack
neccesary for coldfire targets as pcm_play_data uses the dma which cannot neccesary for coldfire targets as pcm_play_data uses the dma which cannot
access iram */ access iram */
int32_t samp_buf[256] IBSS_ATTR; int32_t samp_buf[512] IBSS_ATTR;
/* synth num_samples samples and write them to the */ /* synth num_samples samples and write them to the */
/* buffer pointed to by buf_ptr */ /* buffer pointed to by buf_ptr */
void synthSamples(int32_t *buf_ptr, unsigned int num_samples) ICODE_ATTR; void synthSamples(int32_t *buf_ptr, unsigned int num_samples) ICODE_ATTR;
void synthSamples(int32_t *buf_ptr, unsigned int num_samples) void synthSamples(int32_t *buf_ptr, unsigned int num_samples)
{ {
if (num_samples > 512)
DEBUGF("num_samples is too big!\n");
else
{
int i; int i;
struct SynthObject *voicept; struct SynthObject *voicept;
@ -446,7 +450,7 @@ void synthSamples(int32_t *buf_ptr, unsigned int num_samples)
} }
rb->memcpy(buf_ptr, samp_buf, num_samples*4); rb->memcpy(buf_ptr, samp_buf, num_samples*4);
}
/* TODO: Automatic Gain Control, anyone? */ /* TODO: Automatic Gain Control, anyone? */
/* Or, should this be implemented on the DSP's output volume instead? */ /* Or, should this be implemented on the DSP's output volume instead? */