Sandro
Well-known member
Hi all,
in my new object "player-with-pitch" I need to read "many" samples (e.g.: 10*AUDIO_BLOCK_SAMPLES) from flash memory and, after some elaborations, send to the output the usual amount of "AUDIO_BLOCK_SAMPLES" samples.
First, i tried this strategy:
And this was a disaster... I partially solved the problem with multiple reading cycles of of "AUDIO_BLOCK_SAMPLES" samples per time; it works but requires a lot of time.. I'd like to read with a single request!
I tried something like this, defining 2 audio_block_t objects, one for reading, one for sending:
but this doesnt't work...
Any tip to go on experimenting?
Thanks a lot!
in my new object "player-with-pitch" I need to read "many" samples (e.g.: 10*AUDIO_BLOCK_SAMPLES) from flash memory and, after some elaborations, send to the output the usual amount of "AUDIO_BLOCK_SAMPLES" samples.
First, i tried this strategy:
Code:
...
...
void MyObjct::update(void)
{
audio_block_t *block; // used to read and send samples
...
...
...
block= allocate();
if (block==NULL ) return;
...
...
...
n = rawfile.read(block->data, 10*AUDIO_BLOCK_SAMPLES);
...
...
transmit(block);
...
...
release(block);
}
And this was a disaster... I partially solved the problem with multiple reading cycles of of "AUDIO_BLOCK_SAMPLES" samples per time; it works but requires a lot of time.. I'd like to read with a single request!
I tried something like this, defining 2 audio_block_t objects, one for reading, one for sending:
Code:
void MyObjct::update(void)
{
audio_block_t *block_temp; // used to read samples
audio_block_t *block; // used to send samples
...
...
...
block_temp= allocate();
block= allocate();
if (block_temp == NULL || block==NULL ) return;
...
...
...
n = rawfile.read(block_temp->data, 10*AUDIO_BLOCK_SAMPLES);
...
...
<my code calculate block->data[i] >
...
...
transmit(block);
...
...
release(block);
release(block_temp);
}
but this doesnt't work...
Any tip to go on experimenting?
Thanks a lot!
Last edited: