Hello
I thing the right code of the main is:
if(audio_rec_buffer_state == BUFFER_OFFSET_HALF)
{
signal_0=1;
audio_rec_buffer_state = BUFFER_OFFSET_NONE;
/* Copy recorded 1st half block */
memcpy((uint16_t *)(AUDIO_BUFFER_OUT), (uint16_t *)(AUDIO_BUFFER_IN), AUDIO_BLOCK_SIZE);
signal_0=0;
}
while (1) {
/* Wait end of half block recording */
/* Wait end of one block recording */
while (1) {
/* Wait end of half block recording */
if(audio_rec_buffer_state == BUFFER_OFFSET_HALF)
{
signal_0=1;
audio_rec_buffer_state = BUFFER_OFFSET_NONE;
/* Copy recorded 1st half block */
memcpy((uint16_t *)(AUDIO_BUFFER_OUT), (uint16_t *)(AUDIO_BUFFER_IN), AUDIO_BLOCK_SIZE);
signal_0=0;
}
/* Wait end of one block recording */
if(audio_rec_buffer_state == BUFFER_OFFSET_FULL)
{
signal_1=1;
audio_rec_buffer_state = BUFFER_OFFSET_NONE;
/* Copy recorded 2nd half block */
memcpy((uint16_t *)(AUDIO_BUFFER_OUT + (AUDIO_BLOCK_SIZE)), (uint16_t *)(AUDIO_BUFFER_IN + (AUDIO_BLOCK_SIZE)), AUDIO_BLOCK_SIZE);
signal_1=0;
}
}
Best regards
P.S. Can anyone help me to improve code presentation. Thanks
Hello
I thing the right code of the main is: if(audio_rec_buffer_state == BUFFER_OFFSET_HALF) { signal_0=1; audio_rec_buffer_state = BUFFER_OFFSET_NONE; /* Copy recorded 1st half block */ memcpy((uint16_t *)(AUDIO_BUFFER_OUT), (uint16_t *)(AUDIO_BUFFER_IN), AUDIO_BLOCK_SIZE); signal_0=0; } while (1) { /* Wait end of half block recording */
/* Wait end of one block recording */ while (1) { /* Wait end of half block recording */ if(audio_rec_buffer_state == BUFFER_OFFSET_HALF) { signal_0=1; audio_rec_buffer_state = BUFFER_OFFSET_NONE; /* Copy recorded 1st half block */ memcpy((uint16_t *)(AUDIO_BUFFER_OUT), (uint16_t *)(AUDIO_BUFFER_IN), AUDIO_BLOCK_SIZE); signal_0=0; } /* Wait end of one block recording */ if(audio_rec_buffer_state == BUFFER_OFFSET_FULL) { signal_1=1; audio_rec_buffer_state = BUFFER_OFFSET_NONE; /* Copy recorded 2nd half block */ memcpy((uint16_t *)(AUDIO_BUFFER_OUT + (AUDIO_BLOCK_SIZE)), (uint16_t *)(AUDIO_BUFFER_IN + (AUDIO_BLOCK_SIZE)), AUDIO_BLOCK_SIZE); signal_1=0; } }
Best regards P.S. Can anyone help me to improve code presentation. Thanks