I'm working on a 4-output I2S class for the Open Audio Library. I'm trying to find the reason why code in the update() method of the 2-output I2S is done with interrupts disabled in some parts of the code. Here is an example from the 2-output I2S class update() with the disable/enables:
I did a search and found this comment by Chip Audette where he says the disable/enable interrupts are not necessary:
https://forum.pjrc.com/index.php?threads/custom-audio-object-causes-lock-ups.75891/#post-350039
But if I search through either the I16 or F32 libraries, this is often done in the update() methods. Why?
Thank you,
Greg
Code:
//now that we have our working memory, proceed with getting the audio data and processing
block_f32 = receiveReadOnly_f32(0); // input 0 = left channel
// Optional scaling for easy volume control. Leave outputScale==1.0f for default
if(outputScale<1.0f || outputScale>1.0f)
arm_scale_f32 (block_f32->data, outputScale, block_f32->data, block_f32->length);
scale_f32_to_i32(block_f32->data, block_f32_scaled->data, audio_block_samples);
//now process the data blocks
__disable_irq();
if (block_left_1st == NULL) {
block_left_1st = block_f32_scaled;
block_left_offset = 0;
__enable_irq();
} else if (block_left_2nd == NULL) {
block_left_2nd = block_f32_scaled;
__enable_irq();
} else {
audio_block_f32_t *tmp = block_left_1st;
block_left_1st = block_left_2nd;
block_left_2nd = block_f32_scaled;
block_left_offset = 0;
__enable_irq();
AudioStream_F32::release(tmp);
}
I did a search and found this comment by Chip Audette where he says the disable/enable interrupts are not necessary:
https://forum.pjrc.com/index.php?threads/custom-audio-object-causes-lock-ups.75891/#post-350039
But if I search through either the I16 or F32 libraries, this is often done in the update() methods. Why?
Thank you,
Greg