Re #3815: Audio refactoring (#3926)

This commit is contained in:
Damjan Adamic
2016-10-19 22:56:25 +02:00
committed by Bertrand Songis
parent a19f4c78bf
commit 44133b595d
12 changed files with 935 additions and 875 deletions
+12 -4
View File
@@ -19,6 +19,7 @@
*/
#include "opentx.h"
const AudioBuffer * nextBuffer = 0;
const int8_t volumeScale[VOLUME_LEVEL_MAX+1] =
{
@@ -93,17 +94,24 @@ void dacInit()
NVIC_EnableIRQ(DACC_IRQn) ;
}
void audioPushBuffer(AudioBuffer *buffer)
void audioConsumeCurrentBuffer()
{
buffer->state = AUDIO_BUFFER_FILLED;
dacStart();
if (nextBuffer == 0) {
nextBuffer = audioQueue.buffersFifo.getNextFilledBuffer();
if (nextBuffer) {
dacStart();
}
}
}
extern "C" void DAC_IRQHandler()
{
uint32_t sr = DACC->DACC_ISR;
if (sr & DACC_ISR_ENDTX) {
AudioBuffer *nextBuffer = audioQueue.getNextFilledBuffer();
if (nextBuffer) audioQueue.buffersFifo.freeNextFilledBuffer();
nextBuffer = audioQueue.buffersFifo.getNextFilledBuffer();
if (nextBuffer) {
// Try the first PDC buffer
if ((DACC->DACC_TCR == 0) && (DACC->DACC_TNCR == 0)) {