ObliqueStrategy
New member
Sorry if I'm missing something obvious here, but why in AudioPlaySerialflashRaw::update, why does the code zero out the second half of the freshly-read block (in red below) :
Any thoughts / guidance appreciated!
Thanks,
Nick.
Code:
void AudioPlaySerialflashRaw::update(void)
{
unsigned int i, n;
audio_block_t *block;
// only update if we're playing
if (!playing) return;
// allocate the audio blocks to transmit
block = allocate();
if (block == NULL) return;
if (rawfile.available()) {
// we can read more data from the file...
n = rawfile.read(block->data, AUDIO_BLOCK_SAMPLES*2);
file_offset += n;
[COLOR="#FF0000"][B]for (i=n/2; i < AUDIO_BLOCK_SAMPLES; i++) {
block->data[i] = 0;[/B][/COLOR]
}
transmit(block);
} else {
rawfile.close();
AudioStopUsingSPI();
playing = false;
//Serial.println("Finished playing sample"); //TODO
}
release(block);
}
Any thoughts / guidance appreciated!
Thanks,
Nick.