Add UserBufferManagementInit()

Used to reset any state required in UserBufferManagement(). Weak default
implementation provided, which does nothing.

Also tidied up weak default implementation of UserBufferManagement(),
and added a header file to define both function protypes.
This commit is contained in:
Sam Chesney
2017-01-31 18:42:19 +00:00
parent 342bf64c21
commit ba37e87dab
5 changed files with 35 additions and 12 deletions

View File

@@ -16,6 +16,7 @@
#include "devicedefines.h"
#include "userbuffermanagement.h"
#include "xua_audio.h"
#include "audioports.h"
#include "audiohw.h"
@@ -243,10 +244,6 @@ static inline void TransferAdatTxSamples(chanend c_adat_out, const unsigned samp
}
#endif
/* sampsFromUsbToAudio: The sample frame the device has received from the host and is going to play to the output audio interfaces */
/* sampsFromAudioToUsb: The sample frame that was received from the audio interfaces and that the device is going to send to the host */
void UserBufferManagement(unsigned sampsFromUsbToAudio[], unsigned sampsFromAudioToUsb[], client audManage_if i_audMan);
#ifndef NO_USB
#pragma unsafe arrays
static inline unsigned DoSampleTransfer(chanend c_out, const int readBuffNo, const unsigned underflowWord, client audManage_if i_audMan)
@@ -526,8 +523,13 @@ int i2sOutUpsamplingCounter = 0;
memset(&i2sOutUs3.delayLine, 0, sizeof i2sOutUs3.delayLine);
#endif // (I2S_UPSAMPLE_FACTOR_OUT > 1)
UserBufferManagementInit(i_audMan);
unsigned command = DoSampleTransfer(c_out, readBuffNo, underflowWord, i_audMan);
// Reinitialise user state before entering the main loop
UserBufferManagementInit(i_audMan);
#ifdef ADAT_TX
unsafe{
//TransferAdatTxSamples(c_adat_out, samplesOut, adatSmuxMode, 0);