[processor-sdk/performance-audio-sr.git] / processor_audio_sdk_1_00_00_00 / pasdk / test_dsp / framework / audioStreamOutProc.c
diff --git a/processor_audio_sdk_1_00_00_00/pasdk/test_dsp/framework/audioStreamOutProc.c b/processor_audio_sdk_1_00_00_00/pasdk/test_dsp/framework/audioStreamOutProc.c
index 30228251423eb2865377898a9e3c25ec6c1c7322..c9194211868041352ead8ca1ae21aaac51f88da0 100644 (file)
#include "common.h"
#include "aspMsg_common.h"
#include "aspMsg_master.h"
-#include "paf_decOpCircBuf.h"
+#include "aspDecOpCircBuf_master.h"
#include "audioStreamProc_common.h"
#include "audioStreamOutProc.h"
#define __TASK_NAME__ "TaskAsop"
+
/* FL: Check if at least one output selected */
static Int checkOutSel(
- const PAF_AST_Params *pP,
- PAF_AST_Config *pC,
+ const PAF_ASOT_Params *pP,
+ PAF_ASOT_Config *pC,
Int *pOutSel
);
/* FL: Check if at least one output sio changed */
static Int checkOutSio(
- const PAF_AST_Params *pP,
- PAF_AST_Config *pC,
+ const PAF_ASOT_Params *pP,
+ PAF_ASOT_Config *pC,
Int *pOutSioUpdate
);
-
LINNO_DEFN(TaskAsop); /* Line number macros */
ERRNO_DEFN(TaskAsop); /* Error number macros */
+// ASOT configuration
+#pragma DATA_SECTION(gPAF_ASOT_config, ".globalSectionPafAsotConfig")
+PAF_ASOT_Config gPAF_ASOT_config = {
+ NULL, // acp
+ &gPAF_ASPM_config, // pAspmCfg
+ &gPAF_AST_config // pAstCfg
+};
+
+// Underflow threshold before returning error to Top-Level FSM
+#define DEC_OP_CB_RDAF_UND_THR ( 20 ) // FL: arbitrary setting
+UInt32 gDecOpCbRdAfUnd =0; // decoder output circular buffer underflow count
+
// Global debug counters */
UInt32 gTaskAsopCnt=0; // debug
UInt32 gAsopInitCnt =0;
*/
Void taskAsopFxn(
// Int betaPrimeValue, // FL: revisit
- const PAF_AST_Params *pP,
- const PAF_AST_Patchs *pQ
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ
)
{
+ PAF_ASOT_Config *pC; /* Local configuration pointer */
+ PAF_AST_Config *pAstCfg; /* Common (shared) configuration pointer */
Int as; /* Audio Stream Number (1, 2, etc.) */
Int z; /* input/encode/stream/decode/output counter */
Int i; /* phase */
Log_info0("Enter taskAsopFxn()");
- //
- // Audio Framework Configuration (*pC):
- //
- pC = &gPAF_AST_config;
-
- TRACE_TERSE1("TaskAsop: Started with betaPrimeValue=%d.", gBetaPrimeValue);
- as = pC->as; /* Audio Stream Number (1, 2, etc.) */
-
//
// Audio Framework Parameters & Patch (*pP, *pQ)
//
if (!pP)
{
- TRACE_TERSE1("TaskAsop: AS%d: No Parameters defined. Exiting.", as);
+ TRACE_TERSE0("TaskAsop: No Parameters defined. Exiting.");
LINNO_RPRT(TaskAsop, -1);
return;
}
if (!pQ)
{
- TRACE_TERSE1("TaskAsip: AS%d: No Patchs defined. Exiting.", as);
+ TRACE_TERSE0("TaskAsip: No Patchs defined. Exiting.");
LINNO_RPRT(TaskAsop, -1);
return;
}
+ //
+ // Audio Framework Configuration (*pC):
+ //
+ pC = &gPAF_ASOT_config;
+ pAstCfg = pC->pAstCfg;
+
+ /* Obtain Audio Stream Number (1, 2, etc.) */
+ as = pAstCfg->as;
+ TRACE_TERSE1("TaskAsop: Started with AS%d.", as);
+
//
// Initialize message log trace and line number reporting
//
//
// Determine stream index
//
- zMS = pC->masterStr;
+ zMS = pAstCfg->masterStr;
// Initialize as per parametrized phases:
//
{
for (z=OUTPUT1; z < OUTPUTN; z++)
{
- if (pC->xOut[z].hTxSio)
+ if (pAstCfg->xOut[z].hTxSio)
{
- SIO_idle(pC->xOut[z].hTxSio);
+ SIO_idle(pAstCfg->xOut[z].hTxSio);
}
}
Int
PAF_ASOT_initPhaseMalloc (
- const PAF_AST_Params *pP,
- const PAF_AST_Patchs *pQ,
- PAF_AST_Config *pC
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pC
)
{
- Int as = pC->as; /* Audio Stream Number (1, 2, etc.) */
- Int zMS = pC->masterStr;
+ PAF_AST_Config *pAstCfg;
+ Int as; /* Audio Stream Number (1, 2, etc.) */
+ Int zMS;
Error_Block eb;
//Int i;
+ pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
+ as = pAstCfg->as;
+ zMS = pAstCfg->masterStr;
+
TRACE_TERSE1("PAF_ASOT_initPhaseMalloc: AS%d: initialization phase - memory allocation", as+zMS);
// Initialize error block
Error_init(&eb);
/* Stream memory */
- if (!(pC->xStr = Memory_calloc((IHeap_Handle)HEAP_INTERNAL, STREAMN * sizeof (*pC->xStr), 4, &eb)))
+ if (!(pAstCfg->xStr = Memory_calloc((IHeap_Handle)HEAP_INTERNAL, STREAMN * sizeof (*pAstCfg->xStr), 4, &eb)))
{
TRACE_TERSE1("PAF_ASOT_initPhaseMalloc: AS%d: Memory_calloc failed", as+zMS);
SW_BREAKPOINT;
return __LINE__;
}
- TRACE_TERSE3("PAF_ASOT_initPhaseMalloc. (pC->xStr) %d bytes from space %d at 0x%x.",
- STREAMN * sizeof (*pC->xStr),
- HEAP_ID_INTERNAL, (IArg)pC->xStr);
+ TRACE_TERSE3("PAF_ASOT_initPhaseMalloc. (pAstCfg->xStr) %d bytes from space %d at 0x%x.",
+ STREAMN * sizeof (*pAstCfg->xStr),
+ HEAP_ID_INTERNAL, (IArg)pAstCfg->xStr);
{
Int z; /* stream counter */
for (z=STREAM1; z < STREAMN; z++)
{
- pC->xStr[z].pAudioFrame = &fBuf[z-STREAM1];
- TRACE_TERSE2("pC->xStr[%d].pAudioFrame = 0x%x", z, (IArg)pC->xStr[z].pAudioFrame);
+ pAstCfg->xStr[z].pAudioFrame = &fBuf[z-STREAM1];
+ TRACE_TERSE2("pAstCfg->xStr[%d].pAudioFrame = 0x%x", z, (IArg)pAstCfg->xStr[z].pAudioFrame);
}
}
/* Encode memory */
- if (!(pC->xEnc = Memory_calloc((IHeap_Handle)HEAP_INTERNAL, ENCODEN * sizeof (*pC->xEnc), 4, &eb)))
+ if (!(pAstCfg->xEnc = Memory_calloc((IHeap_Handle)HEAP_INTERNAL, ENCODEN * sizeof (*pAstCfg->xEnc), 4, &eb)))
{
TRACE_TERSE1("PAF_ASOT_initPhaseMalloc: AS%d: Memory_calloc failed", as+zMS);
SW_BREAKPOINT;
return __LINE__;
}
- TRACE_TERSE3("PAF_ASOT_initPhaseMalloc. (pC->xEnc) %d bytes from space %d at 0x%x.",
- ENCODEN * sizeof (*pC->xEnc),
- HEAP_ID_INTERNAL, (IArg)pC->xEnc);
+ TRACE_TERSE3("PAF_ASOT_initPhaseMalloc. (pAstCfg->xEnc) %d bytes from space %d at 0x%x.",
+ ENCODEN * sizeof (*pAstCfg->xEnc),
+ HEAP_ID_INTERNAL, (IArg)pAstCfg->xEnc);
/* Output memory */
- if (!(pC->xOut = Memory_calloc((IHeap_Handle)HEAP_INTERNAL, OUTPUTN * sizeof (*pC->xOut), 4, &eb)))
+ if (!(pAstCfg->xOut = Memory_calloc((IHeap_Handle)HEAP_INTERNAL, OUTPUTN * sizeof (*pAstCfg->xOut), 4, &eb)))
{
TRACE_TERSE1("PAF_ASOT_initPhaseMalloc: AS%d: Memory_calloc failed", as+zMS);
SW_BREAKPOINT;
return __LINE__;
}
- TRACE_TERSE3("PAF_ASOT_initPhaseMalloc. (pC->xOut) %d bytes from space %d at 0x%x.",
- OUTPUTN * sizeof (*pC->xOut),
- HEAP_ID_INTERNAL, (IArg)pC->xOut);
+ TRACE_TERSE3("PAF_ASOT_initPhaseMalloc. (pAstCfg->xOut) %d bytes from space %d at 0x%x.",
+ OUTPUTN * sizeof (*pAstCfg->xOut),
+ HEAP_ID_INTERNAL, (IArg)pAstCfg->xOut);
TRACE_TERSE1("PAF_ASOT_initPhaseMalloc: AS%d: initialization phase - memory allocation complete.", as+zMS);
return 0;
//
Int
PAF_ASOT_initPhaseConfig(
- const PAF_AST_Params *pP,
- const PAF_AST_Patchs *pQ,
- PAF_AST_Config *pC
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pC
)
{
- Int as = pC->as; /* Audio Stream Number (1, 2, etc.) */
- Int z; /* input/encode/stream/decode/output counter */
- Int zMS = pC->masterStr;
+ PAF_AST_Config *pAstCfg;
+ Int as; /* Audio Stream Number (1, 2, etc.) */
+ Int z; /* input/encode/stream/decode/output counter */
+ Int zMS;
+
+ pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
+ as = pAstCfg->as;
+ zMS = pAstCfg->masterStr;
TRACE_TERSE1("PAF_ASOT_initPhaseConfig: AS%d: initialization phase - configuration", as+zMS);
{
Int zO = pP->outputsFromEncodes[z];
Int zS = pP->streamsFromEncodes[z];
- pC->xEnc[z].encodeControl.size = sizeof(pC->xEnc[z].encodeControl);
- pC->xEnc[z].encodeControl.pAudioFrame = pC->xStr[zS].pAudioFrame;
- pC->xEnc[z].encodeControl.pVolumeStatus = &pC->xEnc[z].volumeStatus;
- pC->xEnc[z].encodeControl.pOutBufConfig = &pC->xOut[zO].outBufConfig;
- pC->xEnc[z].encodeStatus = *pP->z_pEncodeStatus[z];
- pC->xEnc[z].encodeControl.encActive = pC->xEnc[z].encodeStatus.select;
- pC->xEnc[z].volumeStatus = *pP->pVolumeStatus;
- pC->xEnc[z].encodeInStruct.pAudioFrame = pC->xStr[zS].pAudioFrame;
+ pAstCfg->xEnc[z].encodeControl.size = sizeof(pAstCfg->xEnc[z].encodeControl);
+ pAstCfg->xEnc[z].encodeControl.pAudioFrame = pAstCfg->xStr[zS].pAudioFrame;
+ pAstCfg->xEnc[z].encodeControl.pVolumeStatus = &pAstCfg->xEnc[z].volumeStatus;
+ pAstCfg->xEnc[z].encodeControl.pOutBufConfig = &pAstCfg->xOut[zO].outBufConfig;
+ pAstCfg->xEnc[z].encodeStatus = *pP->z_pEncodeStatus[z];
+ pAstCfg->xEnc[z].encodeControl.encActive = pAstCfg->xEnc[z].encodeStatus.select;
+ pAstCfg->xEnc[z].volumeStatus = *pP->pVolumeStatus;
+ pAstCfg->xEnc[z].encodeInStruct.pAudioFrame = pAstCfg->xStr[zS].pAudioFrame;
}
for (z=OUTPUT1; z < OUTPUTN; z++)
{
- pC->xOut[z].outBufStatus = *pP->pOutBufStatus;
+ pAstCfg->xOut[z].outBufStatus = *pP->pOutBufStatus;
}
TRACE_TERSE1("PAF_ASOT_initPhaseConfig: AS%d: initialization phase - configuration complete.", as+zMS);
//
Int
PAF_ASOT_initPhaseAcpAlg(
- const PAF_AST_Params *pP,
- const PAF_AST_Patchs *pQ,
- PAF_AST_Config *pC
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pC
)
{
- Int as = pC->as; /* Audio Stream Number (1, 2, etc.) */
- Int z; /* input/encode/stream/decode/output counter */
+ PAF_AST_Config *pAstCfg;
+ Int as; /* Audio Stream Number (1, 2, etc.) */
+ Int z; /* input/encode/stream/decode/output counter */
Int betaPrimeOffset;
ACP_Handle acp;
- Int zMS = pC->masterStr;
+ Int zMS;
Int zS, zX;
+ pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
+ as = pAstCfg->as;
+ zMS = pAstCfg->masterStr;
+
TRACE_TERSE1("PAF_ASOT_initPhaseAcpAlg: AS%d: initialization phase - ACP Algorithm", as+zMS);
ACP_MDS_init();
zS = pP->streamsFromEncodes[z];
acp->fxns->attach(acp, ACP_SERIES_STD,
STD_BETA_ENCODE + betaPrimeOffset * (as-1+zS),
- (IALG_Status *)&pC->xEnc[z].encodeStatus);
+ (IALG_Status *)&pAstCfg->xEnc[z].encodeStatus);
acp->fxns->attach(acp, ACP_SERIES_STD,
STD_BETA_VOLUME + betaPrimeOffset * (as-1+zS),
- (IALG_Status *)&pC->xEnc[z].volumeStatus);
+ (IALG_Status *)&pAstCfg->xEnc[z].volumeStatus);
/* Ignore errors, not reported. */
}
}
acp->fxns->attach(acp, ACP_SERIES_STD,
STD_BETA_OB + betaPrimeOffset * (as-1+zS),
- (IALG_Status *)&pC->xOut[z].outBufStatus);
+ (IALG_Status *)&pAstCfg->xOut[z].outBufStatus);
/* Ignore errors, not reported. */
}
//
Int
PAF_ASOT_initPhaseCommon(
- const PAF_AST_Params *pP,
- const PAF_AST_Patchs *pQ,
- PAF_AST_Config *pC
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pC
)
{
- Int as = pC->as; /* Audio Stream Number (1, 2, etc.) */
- Int z; /* stream counter */
- Int g; /* gear */
- ACP_Handle acp = pC->acp;
+ PAF_AST_Config *pAstCfg;
+ Int as; /* Audio Stream Number (1, 2, etc.) */
+ Int z; /* stream counter */
+ Int g; /* gear */
+ ACP_Handle acp;
PAF_IALG_Config pafAlgConfig;
IALG_MemRec common[3][PAF_IALG_COMMON_MEMN+1];
+ acp = pC->acp;
+ pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
+ as = pAstCfg->as;
+
TRACE_TERSE0("PAF_ASOT_initPhaseCommon: initialization phase - Common Memory");
//
HEAP_ID_INTERNAL1, HEAP_INTERNAL1,
HEAP_ID_EXTERNAL, HEAP_EXTERNAL,
HEAP_ID_INTERNAL1_SHM, HEAP_INTERNAL1_SHM,
+ HEAP_ID_EXTERNAL_SHM, HEAP_EXTERNAL_SHM,
HEAP_CLEAR);
if (pP->fxns->headerPrint)
TRACE_TERSE1("PAF_ASOT_initPhaseCommon: calling PAF_ALG_ALLOC outLinkInit common[%d].", z);
if (PAF_ALG_ALLOC(outLinkInit[z-OUTPUT1], common[z]))
{
- TRACE_TERSE1("PAF_AST_initPhaseMalloc: AS%d: PAF_ALG_alloc failed", as+z);
+ TRACE_TERSE1("PAF_ASOT_initPhaseMalloc: AS%d: PAF_ALG_alloc failed", as+z);
TRACE_TERSE2("Failed to alloc %d bytes from space %d", common[z]->size, (IArg)common[z]->space);
SW_BREAKPOINT;
return __LINE__;
}
}
- pC->xStr[z].aspChain[0] = NULL;
+ pAstCfg->xStr[z].aspChain[0] = NULL;
for (g=0; g < GEARS; g++)
{
PAF_ASP_Chain *chain;
TRACE_TERSE0("PAF_ASOT_initPhaseCommon: calling PAF_ASP_chainInit for ASPs.");
- chain = PAF_ASP_chainInit(&pC->xStr[z].aspChainData[g], pP->pChainFxns,
+ chain = PAF_ASP_chainInit(&pAstCfg->xStr[z].aspChainData[g], pP->pChainFxns,
HEAP_INTERNAL, as+z, acp, &trace,
- aspLinkInit[z-STREAM1][g], pC->xStr[z].aspChain[0], common[z], &pafAlgConfig);
+ aspLinkInit[z-STREAM1][g], pAstCfg->xStr[z].aspChain[0], common[z], &pafAlgConfig);
if (!chain)
{
TRACE_TERSE2("AS%d: ASP chain %d initialization failed", as+z, g);
}
else
{
- pC->xStr[z].aspChain[g] = chain;
+ pAstCfg->xStr[z].aspChain[g] = chain;
}
}
{
PAF_ASP_Chain *chain;
TRACE_TERSE0("PAF_ASOT_initPhaseCommon: calling PAF_ASP_chainInit for encode.");
- chain = PAF_ASP_chainInit(&pC->xEnc[zE].encChainData, pP->pChainFxns,
+ chain = PAF_ASP_chainInit(&pAstCfg->xEnc[zE].encChainData, pP->pChainFxns,
HEAP_INTERNAL, as+z, acp, &trace,
encLinkInit[zE-ENCODE1], NULL, common[z], &pafAlgConfig);
if (!chain)
PAF_ASP_Chain *chain;
TRACE_TERSE2("PAF_ASOT_initPhaseMalloc: AS%d: non-common output chain init for %d",
as+z, z);
- chain = PAF_ASP_chainInit (&pC->xOut[z].outChainData, pP->pChainFxns,
+ chain = PAF_ASP_chainInit (&pAstCfg->xOut[z].outChainData, pP->pChainFxns,
HEAP_EXTERNAL, as+z, acp, &trace,
outLinkInit[z-OUTPUT1], NULL, common[z], &pafAlgConfig);
if (!chain)
// .............................................................................
Int
PAF_ASOT_initPhaseAlgKey(
- const PAF_AST_Params *pP,
- const PAF_AST_Patchs *pQ,
- PAF_AST_Config *pC
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pC
)
{
- Int as = pC->as; /* Audio Stream Number (1, 2, etc.) */
- Int z; /* decode/encode counter */
- Int s; /* key number */
+ PAF_AST_Config *pAstCfg;
+ Int as; /* Audio Stream Number (1, 2, etc.) */
+ Int z; /* decode/encode counter */
+ Int s; /* key number */
PAF_ASP_Link *that;
+ pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
+ as = pAstCfg->as;
(void)as; // clear compiler warning in case not used with tracing disabled
TRACE_VERBOSE1("PAF_ASOT_initPhaseAlgKey: AS%d: initialization phase - Algorithm Keys", as);
for (s=0; s < pP->pEncAlgKey->length; s++)
{
if ((pP->pEncAlgKey->code[s].full != 0) &&
- (that = PAF_ASP_chainFind(&pC->xEnc[z].encChainData, pP->pEncAlgKey->code[s])))
+ (that = PAF_ASP_chainFind(&pAstCfg->xEnc[z].encChainData, pP->pEncAlgKey->code[s])))
{
- pC->xEnc[z].encAlg[s] = (ALG_Handle )that->alg;
+ pAstCfg->xEnc[z].encAlg[s] = (ALG_Handle )that->alg;
}
/* Cast in interface, for now --Kurt */
else
{
- pC->xEnc[z].encAlg[s] = NULL;
+ pAstCfg->xEnc[z].encAlg[s] = NULL;
}
}
}
//
Int
PAF_ASOT_initPhaseDevice(
- const PAF_AST_Params *pP,
- const PAF_AST_Patchs *pQ,
- PAF_AST_Config *pC
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pC
)
{
- Int as = pC->as; /* Audio Stream Number (1, 2, etc.) */
- Int z; /* input/output counter */
+ PAF_AST_Config *pAstCfg;
+ Int as; /* Audio Stream Number (1, 2, etc.) */
+ Int z; /* input/output counter */
PAF_SIO_IALG_Obj *pObj;
PAF_SIO_IALG_Config *pAlgConfig;
PAF_IALG_Config pafAlgConfig;
+ pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
+ as = pAstCfg->as;
(void)as; // clear compiler warning in case not used with tracing disabled
TRACE_TERSE1("PAF_ASOT_initPhaseDevice: AS%d: initialization phase - I/O Devices", as);
HEAP_ID_INTERNAL1, HEAP_INTERNAL1,
HEAP_ID_EXTERNAL, HEAP_EXTERNAL,
HEAP_ID_INTERNAL1_SHM, HEAP_INTERNAL1_SHM,
+ HEAP_ID_EXTERNAL_SHM, HEAP_EXTERNAL_SHM,
HEAP_CLEAR);
TRACE_TERSE2("PAF_ASOT_initPhaseDevice: AS%d: calling PAF_ALG_setup with clear at %d.", as, HEAP_CLEAR);
}
for (z=OUTPUT1; z < OUTPUTN; z++)
{
- PAF_OutBufConfig *pConfig = &pC->xOut[z].outBufConfig;
+ PAF_OutBufConfig *pConfig = &pAstCfg->xOut[z].outBufConfig;
- pObj = (PAF_SIO_IALG_Obj *)pC->xOut[z].outChainData.head->alg;
+ pObj = (PAF_SIO_IALG_Obj *)pAstCfg->xOut[z].outChainData.head->alg;
pAlgConfig = &pObj->config;
- pC->xOut[z].hTxSio = NULL;
+ pAstCfg->xOut[z].hTxSio = NULL;
pConfig->base.pVoid = pAlgConfig->pMemRec[0].base;
pConfig->pntr.pVoid = pAlgConfig->pMemRec[0].base;
pConfig->head.pVoid = pAlgConfig->pMemRec[0].base;
Int
PAF_ASOT_initFrame0(
- const PAF_AST_Params *pP,
- const PAF_AST_Patchs *pQ,
- PAF_AST_Config *pC,
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pC,
Int z
)
{
- Int as = pC->as; /* Audio Stream Number (1, 2, etc.) */
+ PAF_AST_Config *pAstCfg;
+ Int as; /* Audio Stream Number (1, 2, etc.) */
Int ch;
//Int aLen;
Int aLen_int=0,aLen_ext=0;
char i;
Error_Block eb;
+ pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
+ as = pAstCfg->as;
+
// Initialize error block
Error_init(&eb);
//
// Initialize audio frame elements directly
//
- pC->xStr[z].pAudioFrame->fxns = pP->pAudioFrameFunctions;
- pC->xStr[z].pAudioFrame->data.nChannels = PAF_MAXNUMCHAN; ///
-/// pC->xStr[z].pAudioFrame->data.nChannels = PAF_MAXNUMCHAN_AF;
- pC->xStr[z].pAudioFrame->data.nSamples = FRAMELENGTH;
- pC->xStr[z].pAudioFrame->data.sample = pC->xStr[z].audioFrameChannelPointers;
- pC->xStr[z].pAudioFrame->data.samsiz = pC->xStr[z].audioFrameChannelSizes;
- pC->xStr[z].pAudioFrame->pChannelConfigurationMaskTable = &PAF_ASP_stdCCMT;
+ pAstCfg->xStr[z].pAudioFrame->fxns = pP->pAudioFrameFunctions;
+ pAstCfg->xStr[z].pAudioFrame->data.nChannels = PAF_MAXNUMCHAN; ///
+/// pAstCfg->xStr[z].pAudioFrame->data.nChannels = PAF_MAXNUMCHAN_AF;
+ pAstCfg->xStr[z].pAudioFrame->data.nSamples = FRAMELENGTH;
+ pAstCfg->xStr[z].pAudioFrame->data.sample = pAstCfg->xStr[z].audioFrameChannelPointers;
+ pAstCfg->xStr[z].pAudioFrame->data.samsiz = pAstCfg->xStr[z].audioFrameChannelSizes;
+ pAstCfg->xStr[z].pAudioFrame->pChannelConfigurationMaskTable = &PAF_ASP_stdCCMT;
//
// Allocate memory for and initialize pointers to audio data buffers
TRACE_TERSE3(" maxFrameLength: %d. aLen_ext*aSize: %d. aBuf_ext: 0x%x", maxFrameLength, aLen_ext*aSize, (IArg)aBuf_ext);
TRACE_TERSE1("PAF_ASOT_initFrame0: AS%d: Memory_calloc for metadata buffers", as+z);
- //if (! (metadataBuf = (XDAS_UInt8 *)MEM_calloc (*(pP->pMetadataBufStatus->pSpace), pP->pMetadataBufStatus->bufSize*pP->pMetadataBufStatus->NumBuf, pP->pMetadataBufStatus->alignment))) {
if (!(metadataBuf = (XDAS_UInt8 *)Memory_calloc((IHeap_Handle)HEAP_MDBUF, pP->pMetadataBufStatus->bufSize*pP->pMetadataBufStatus->NumBuf, pP->pMetadataBufStatus->alignment, &eb)))
{
TRACE_TERSE1("PAF_ASOT_initFrame0: AS%d: Memory_calloc failed", as+z);
#pragma UNROLL(1)
for (i=0; i < PAF_MAXNUMCHAN_AF; i++)
{
- pC->xStr[z].audioFrameChannelPointers[i] = NULL;
+ pAstCfg->xStr[z].audioFrameChannelPointers[i] = NULL;
}
}
{
if(pP->pAudioFrameBufStatus->space[i] == IALG_SARAM)
{
- pC->xStr[z].audioFrameChannelPointers[chan] = aBuf_int + maxFrameLength*(j+1) - FRAMELENGTH;
+ pAstCfg->xStr[z].audioFrameChannelPointers[chan] = aBuf_int + maxFrameLength*(j+1) - FRAMELENGTH;
j++;
}
else
{
- pC->xStr[z].audioFrameChannelPointers[chan] = aBuf_ext + maxFrameLength*(k+1) - FRAMELENGTH;
+ pAstCfg->xStr[z].audioFrameChannelPointers[chan] = aBuf_ext + maxFrameLength*(k+1) - FRAMELENGTH;
k++;
}
TRACE_TERSE3("PAF_ASOT_initFrame0: chan = %d = AFChanPtrMap[%d][%d].", chan, numchan[z], i);
- TRACE_TERSE2("PAF_ASOT_initFrame0: audioFrameChannelPointers[%d]: 0x%x", chan, (IArg)pC->xStr[z].audioFrameChannelPointers[chan]);
+ TRACE_TERSE2("PAF_ASOT_initFrame0: audioFrameChannelPointers[%d]: 0x%x", chan, (IArg)pAstCfg->xStr[z].audioFrameChannelPointers[chan]);
}
}
}
for (ch=PAF_LEFT; ch < PAF_MAXNUMCHAN_AF; ch++)
{
- if (pC->xStr[z].audioFrameChannelPointers[ch])
+ if (pAstCfg->xStr[z].audioFrameChannelPointers[ch])
{
- pC->xStr[z].origAudioFrameChannelPointers[ch] = pC->xStr[z].audioFrameChannelPointers[ch];
+ pAstCfg->xStr[z].origAudioFrameChannelPointers[ch] = pAstCfg->xStr[z].audioFrameChannelPointers[ch];
}
}
//
// Initialize meta data elements
//
- pC->xStr[z].pAudioFrame->pafBsMetadataUpdate = XDAS_FALSE;
- pC->xStr[z].pAudioFrame->numPrivateMetadata = 0;
- pC->xStr[z].pAudioFrame->bsMetadata_offset = 0;
- pC->xStr[z].pAudioFrame->bsMetadata_type = PAF_bsMetadata_channelData;
- pC->xStr[z].pAudioFrame->privateMetadataBufSize = pP->pMetadataBufStatus->bufSize;
+ pAstCfg->xStr[z].pAudioFrame->pafBsMetadataUpdate = XDAS_FALSE;
+ pAstCfg->xStr[z].pAudioFrame->numPrivateMetadata = 0;
+ pAstCfg->xStr[z].pAudioFrame->bsMetadata_offset = 0;
+ pAstCfg->xStr[z].pAudioFrame->bsMetadata_type = PAF_bsMetadata_channelData;
+ pAstCfg->xStr[z].pAudioFrame->privateMetadataBufSize = pP->pMetadataBufStatus->bufSize;
for(i=0;i<pP->pMetadataBufStatus->NumBuf;i++)
{
- pC->xStr[z].pAudioFrame->pafPrivateMetadata[i].offset = 0;
- pC->xStr[z].pAudioFrame->pafPrivateMetadata[i].size = 0;
- pC->xStr[z].pAudioFrame->pafPrivateMetadata[i].pMdBuf = metadataBuf + pP->pMetadataBufStatus->bufSize*i;
+ pAstCfg->xStr[z].pAudioFrame->pafPrivateMetadata[i].offset = 0;
+ pAstCfg->xStr[z].pAudioFrame->pafPrivateMetadata[i].size = 0;
+ pAstCfg->xStr[z].pAudioFrame->pafPrivateMetadata[i].pMdBuf = metadataBuf + pP->pMetadataBufStatus->bufSize*i;
}
//
if (pP->streamsFromDecodes[zX] == z)
{
#ifdef NOAUDIOSHARE
- pC->xDec[zX].decodeInStruct.audioShare.nSamples = 0;
- pC->xDec[zX].decodeInStruct.audioShare.sample = NULL;
+ pAstCfg->xDec[zX].decodeInStruct.audioShare.nSamples = 0;
+ pAstCfg->xDec[zX].decodeInStruct.audioShare.sample = NULL;
#else /* NOAUDIOSHARE */
- pC->xDec[zX].decodeInStruct.audioShare.nSamples = aLen_int;
- pC->xDec[zX].decodeInStruct.audioShare.sample = aBuf_int;
+ pAstCfg->xDec[zX].decodeInStruct.audioShare.nSamples = aLen_int;
+ pAstCfg->xDec[zX].decodeInStruct.audioShare.sample = aBuf_int;
#endif /* NOAUDIOSHARE */
}
}
//
Int
PAF_ASOT_initFrame1(
- const PAF_AST_Params *pP,
- const PAF_AST_Patchs *pQ,
- PAF_AST_Config *pC,
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pC,
Int z,
Int apply
)
{
+ PAF_AST_Config *pAstCfg;
+
+ pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
+
//
// Reinitialize audio frame elements:
//
if (apply < 0)
{
- pC->xStr[z].pAudioFrame->channelConfigurationRequest.legacy = PAF_CC_UNKNOWN;
- pC->xStr[z].pAudioFrame->channelConfigurationStream.legacy = PAF_CC_UNKNOWN;
+ pAstCfg->xStr[z].pAudioFrame->channelConfigurationRequest.legacy = PAF_CC_UNKNOWN;
+ pAstCfg->xStr[z].pAudioFrame->channelConfigurationStream.legacy = PAF_CC_UNKNOWN;
}
else
{
- pC->xStr[z].pAudioFrame->channelConfigurationRequest.legacy = PAF_CC_NONE;
- pC->xStr[z].pAudioFrame->channelConfigurationStream.legacy = PAF_CC_NONE;
+ pAstCfg->xStr[z].pAudioFrame->channelConfigurationRequest.legacy = PAF_CC_NONE;
+ pAstCfg->xStr[z].pAudioFrame->channelConfigurationStream.legacy = PAF_CC_NONE;
}
if (apply < 1)
{
- pC->xStr[z].pAudioFrame->sampleRate = PAF_SAMPLERATE_UNKNOWN;
- pC->xStr[z].pAudioFrame->sampleCount = 0;
+ pAstCfg->xStr[z].pAudioFrame->sampleRate = PAF_SAMPLERATE_UNKNOWN;
+ pAstCfg->xStr[z].pAudioFrame->sampleCount = 0;
}
return 0;
-} //PAF_AST_initFrame1
+} //PAF_ASOT_initFrame1
// -----------------------------------------------------------------------------
// ASOT Selection Function - Output Device Selection
//
Int
PAF_ASOT_selectDevices(
- const PAF_AST_Params *pP,
- const PAF_AST_Patchs *pQ,
- PAF_AST_Config *pC
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pC
)
{
- Int as = pC->as; /* Audio Stream Number (1, 2, etc.) */
- Int z; /* input/output counter */
- Int errno = 0; /* error number */
- Int errme; /* error number, local */
+ PAF_AST_Config *pAstCfg;
+ Int as; /* Audio Stream Number (1, 2, etc.) */
+ Int z; /* input/output counter */
+ Int errno = 0; /* error number */
+ Int errme; /* error number, local */
Int device;
+ pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
+ as = pAstCfg->as;
(void)as; // clear compiler warning in case not used with tracing disabled
// Select output devices
for (z=OUTPUT1; z < OUTPUTN; z++)
{
- if ((device = pC->xOut[z].outBufStatus.sioSelect) >= 0)
+ if ((device = pAstCfg->xOut[z].outBufStatus.sioSelect) >= 0)
{
TRACE_VERBOSE2("PAF_ASOT_selectDevices: AS%d: output device %d selecting ...", as+z, device);
device = 0; /* treat as device None */
}
- errme = pP->fxns->deviceSelect(&pC->xOut[z].hTxSio, SIO_OUTPUT,
+ errme = pP->fxns->deviceSelect(&pAstCfg->xOut[z].hTxSio, SIO_OUTPUT,
HEAP_ID_OUTBUF, (Ptr)pQ->devout->x[device]);
if (errme)
{
{
errno = ASPERR_DEVOUT + errme;
}
- pC->xOut[z].outBufStatus.sioSelect = 0x80;
+ pAstCfg->xOut[z].outBufStatus.sioSelect = 0x80;
}
else
{
Int zE;
- pC->xOut[z].outBufStatus.sioSelect = device | 0x80;
+ pAstCfg->xOut[z].outBufStatus.sioSelect = device | 0x80;
// register outBufStatus and encodeStatus pointers with output devices
// This enables proper IEC encapsulation.
- if (pC->xOut[z].hTxSio)
+ if (pAstCfg->xOut[z].hTxSio)
{
// set max # of output buffers (use override if necessary)
- if (pC->xOut[z].outBufStatus.maxNumBufOverride == 0)
+ if (pAstCfg->xOut[z].outBufStatus.maxNumBufOverride == 0)
{
- SIO_ctrl(pC->xOut[z].hTxSio, PAF_SIO_CONTROL_SET_MAX_NUMBUF,
+ SIO_ctrl(pAstCfg->xOut[z].hTxSio, PAF_SIO_CONTROL_SET_MAX_NUMBUF,
(Arg)pP->poutNumBufMap[z]->maxNumBuf);
}
else
{
- SIO_ctrl(pC->xOut[z].hTxSio, PAF_SIO_CONTROL_SET_MAX_NUMBUF,
- (Arg)pC->xOut[z].outBufStatus.maxNumBufOverride);
+ SIO_ctrl(pAstCfg->xOut[z].hTxSio, PAF_SIO_CONTROL_SET_MAX_NUMBUF,
+ (Arg)pAstCfg->xOut[z].outBufStatus.maxNumBufOverride);
}
// register PAF_SIO_IALG object address
- SIO_ctrl(pC->xOut[z].hTxSio, PAF_SIO_CONTROL_SET_IALGADDR,
- (Arg)pC->xOut[z].outChainData.head->alg);
- SIO_ctrl(pC->xOut[z].hTxSio, PAF_SIO_CONTROL_SET_BUFSTATUSADDR,
- (Arg)&pC->xOut[z].outBufStatus);
+ SIO_ctrl(pAstCfg->xOut[z].hTxSio, PAF_SIO_CONTROL_SET_IALGADDR,
+ (Arg)pAstCfg->xOut[z].outChainData.head->alg);
+ SIO_ctrl(pAstCfg->xOut[z].hTxSio, PAF_SIO_CONTROL_SET_BUFSTATUSADDR,
+ (Arg)&pAstCfg->xOut[z].outBufStatus);
for (zE=ENCODE1; zE < ENCODEN; zE++)
{
if (pP->outputsFromEncodes[zE] == z)
{
- SIO_ctrl (pC->xOut[z].hTxSio,
+ SIO_ctrl(pAstCfg->xOut[z].hTxSio,
PAF_SIO_CONTROL_SET_ENCSTATUSADDR,
- (Arg)&pC->xEnc[zE].encodeStatus);
+ (Arg)&pAstCfg->xEnc[zE].encodeStatus);
break;
}
}
// if device selected and valid then enable stat tracking if
// required and start clocking
- if ((pC->xOut[z].outBufStatus.sioSelect < 0) && (pC->xOut[z].hTxSio))
+ if ((pAstCfg->xOut[z].outBufStatus.sioSelect < 0) && (pAstCfg->xOut[z].hTxSio))
{
TRACE_VERBOSE0("PAF_ASOT_selectDevices: start SIO clocks");
- errme = SIO_ctrl(pC->xOut[z].hTxSio, PAF_SIO_CONTROL_OUTPUT_START_CLOCKS, 0);
+ errme = SIO_ctrl(pAstCfg->xOut[z].hTxSio, PAF_SIO_CONTROL_OUTPUT_START_CLOCKS, 0);
if (errme)
{
TRACE_VERBOSE2("PAF_ASOT_selectDevices: errme 0x%x, errno 0x%x", errme, errno);
- SIO_idle (pC->xOut[z].hTxSio);
+ SIO_idle(pAstCfg->xOut[z].hTxSio);
if (!errno)
{
errno = ASPERR_DEVOUT + errme;
//
Int
PAF_ASOT_decodeProcessing(
- const PAF_AST_Params *pP,
- const PAF_AST_Patchs *pQ,
- PAF_AST_Config *pC,
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pC,
Int sourceSelect
)
{
+ PAF_AST_Config *pAstCfg;
Int z; /* decode counter */
Int errno; /* error number */
Int getVal;
Int block; // decoder output block count / input frame
Int outSioUpdate;
+ pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
+
for (;;)
{
// FL: Check if any change in output SIO, e.g. from Output shortcut.
Int ch;
for (ch=PAF_LEFT; ch < PAF_MAXNUMCHAN_AF; ch++)
{
- if (pC->xStr[z].audioFrameChannelPointers[ch])
+ if (pAstCfg->xStr[z].audioFrameChannelPointers[ch])
{
- pC->xStr[z].audioFrameChannelPointers[ch] =
- pC->xStr[z].origAudioFrameChannelPointers[ch];
+ pAstCfg->xStr[z].audioFrameChannelPointers[ch] =
+ pAstCfg->xStr[z].origAudioFrameChannelPointers[ch];
}
}
}
for (z=STREAM1; z < STREAMN; z++)
{
- pC->xStr[z].pAudioFrame->pafBsMetadataUpdate = XDAS_FALSE;
- pC->xStr[z].pAudioFrame->numPrivateMetadata = 0;
- pC->xStr[z].pAudioFrame->bsMetadata_offset = 0;
- pC->xStr[z].pAudioFrame->bsMetadata_type = PAF_bsMetadata_channelData;
+ pAstCfg->xStr[z].pAudioFrame->pafBsMetadataUpdate = XDAS_FALSE;
+ pAstCfg->xStr[z].pAudioFrame->numPrivateMetadata = 0;
+ pAstCfg->xStr[z].pAudioFrame->bsMetadata_offset = 0;
+ pAstCfg->xStr[z].pAudioFrame->bsMetadata_type = PAF_bsMetadata_channelData;
for (i=0; i<pP->pMetadataBufStatus->NumBuf; i++)
{
- pC->xStr[z].pAudioFrame->pafPrivateMetadata[i].offset = 0;
- pC->xStr[z].pAudioFrame->pafPrivateMetadata[i].size = 0;
+ pAstCfg->xStr[z].pAudioFrame->pafPrivateMetadata[i].offset = 0;
+ pAstCfg->xStr[z].pAudioFrame->pafPrivateMetadata[i].size = 0;
}
}
}
Int ch;
for (ch=PAF_LEFT; ch < PAF_MAXNUMCHAN_AF; ch++)
{
- if (pC->xStr[z].audioFrameChannelPointers[ch])
+ if (pAstCfg->xStr[z].audioFrameChannelPointers[ch])
{
- pC->xStr[z].audioFrameChannelPointers[ch] =
- pC->xStr[z].origAudioFrameChannelPointers[ch];
+ pAstCfg->xStr[z].audioFrameChannelPointers[ch] =
+ pAstCfg->xStr[z].origAudioFrameChannelPointers[ch];
}
}
}
{
for (z=OUTPUT1; z < OUTPUTN; z++)
{
- if ((pC->xOut[z].outBufStatus.audio & 0x0f) == PAF_OB_AUDIO_SOUND)
+ if ((pAstCfg->xOut[z].outBufStatus.audio & 0x0f) == PAF_OB_AUDIO_SOUND)
{
- TRACE_VERBOSE0("PAF_AST_outputProcessing: state: FINAL: SOUND -> QUIET");
- pC->xOut[z].outBufStatus.audio++; // SOUND -> QUIET
+ TRACE_VERBOSE0("PAF_ASOT_outputProcessing: state: FINAL: SOUND -> QUIET");
+ pAstCfg->xOut[z].outBufStatus.audio++; // SOUND -> QUIET
}
}
break;
//
Int
PAF_ASOT_encodeCommand(
- const PAF_AST_Params *pP,
- const PAF_AST_Patchs *pQ,
- PAF_AST_Config *pC
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pC
)
{
- Int as = pC->as; /* Audio Stream Number (1, 2, etc.) */
- Int z; /* encode counter */
- Int errno = 0; /* error number */
+ PAF_AST_Config *pAstCfg;
+ Int as; /* Audio Stream Number (1, 2, etc.) */
+ Int z; /* encode counter */
+ Int errno = 0; /* error number */
Int zO, zS;
+ pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
+ as = pAstCfg->as;
+
for (z=ENCODE1; z < ENCODEN; z++)
{
zO = pP->outputsFromEncodes[z];
zS = pP->streamsFromEncodes[z];
- if (! (pC->xEnc[z].encodeStatus.command2 & 0x80))
+ if (! (pAstCfg->xEnc[z].encodeStatus.command2 & 0x80))
{
- switch (pC->xEnc[z].encodeStatus.command2)
+ switch (pAstCfg->xEnc[z].encodeStatus.command2)
{
case 0: // command none - process
- pC->xEnc[z].encodeStatus.command2 |= 0x80;
+ pAstCfg->xEnc[z].encodeStatus.command2 |= 0x80;
break;
case 1: // mute command
TRACE_VERBOSE2("AS%d: PAF_ASOT_encodeCommand: encode command mute (0x%02x)", as+zS, 1);
- if ((pC->xOut[zO].outBufStatus.audio & 0x0f) != PAF_OB_AUDIO_QUIET
- && pC->xOut[zO].hTxSio
- && (errno = SIO_ctrl (pC->xOut[zO].hTxSio, PAF_SIO_CONTROL_MUTE, 0)))
+ if ((pAstCfg->xOut[zO].outBufStatus.audio & 0x0f) != PAF_OB_AUDIO_QUIET
+ && pAstCfg->xOut[zO].hTxSio
+ && (errno = SIO_ctrl (pAstCfg->xOut[zO].hTxSio, PAF_SIO_CONTROL_MUTE, 0)))
{
errno = (errno & 0xff) | ASPERR_MUTE;
/* convert to sensical errno */
}
else
{
- pC->xOut[zO].outBufStatus.audio |= PAF_OB_AUDIO_MUTED;
+ pAstCfg->xOut[zO].outBufStatus.audio |= PAF_OB_AUDIO_MUTED;
}
- pC->xEnc[z].encodeStatus.command2 |= 0x80;
+ pAstCfg->xEnc[z].encodeStatus.command2 |= 0x80;
break;
case 2: // unmute command
TRACE_VERBOSE2("AS%d: PAF_ASOT_encodeCommand: encode command unmute (0x%02x)", as+zS, 2);
- if ((pC->xOut[zO].outBufStatus.audio & 0x0f) != PAF_OB_AUDIO_QUIET
- && pC->xOut[zO].hTxSio
- && (errno = SIO_ctrl (pC->xOut[zO].hTxSio, PAF_SIO_CONTROL_UNMUTE, 0)))
+ if ((pAstCfg->xOut[zO].outBufStatus.audio & 0x0f) != PAF_OB_AUDIO_QUIET
+ && pAstCfg->xOut[zO].hTxSio
+ && (errno = SIO_ctrl (pAstCfg->xOut[zO].hTxSio, PAF_SIO_CONTROL_UNMUTE, 0)))
{
errno = (errno & 0xff) | ASPERR_MUTE;
/* convert to sensical errno */
}
else
{
- pC->xOut[zO].outBufStatus.audio &= ~PAF_OB_AUDIO_MUTED;
+ pAstCfg->xOut[zO].outBufStatus.audio &= ~PAF_OB_AUDIO_MUTED;
}
- pC->xEnc[z].encodeStatus.command2 |= 0x80;
+ pAstCfg->xEnc[z].encodeStatus.command2 |= 0x80;
break;
default: // command unknown - ignore
break;
// Purpose: Decoding Function for reinitializing the decoding process.
Int
PAF_ASOT_decodeInit(
- const PAF_AST_Params *pP,
- const PAF_AST_Patchs *pQ,
- PAF_AST_Config *pC,
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pC,
Int sourceSelect
)
{
- Int as = pC->as; /* Audio Stream Number (1, 2, etc.) */
+ PAF_AST_Config *pAstCfg;
+ PAF_AST_DecOpCircBufCtl *pCbCtl; /* Decoder output circular buffer control */
+ Int as; /* Audio Stream Number (1, 2, etc.) */
Int z; /* decode/encode counter */
Int errno; /* error number */
Int zO, zS;
- PAF_DecodeOpCircBuf *pCb; /* decoder output circular buffer */
+
+
+ pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
+ as = pAstCfg->as;
+
+ pCbCtl = &pC->pAspmCfg->decOpCircBufCtl; // get pointer to circular buffer control
for (z=DECODE1; z < DECODEN; z++)
{
// Start decoder output circular buffer reads
- pCb = &pC->xDec[z].decOpCb;
- errno = cbReadStart(pCb);
+ errno = cbReadStart(pCbCtl, z);
if (errno)
{
TRACE_TERSE1("PAF_ASOT_decodeInit:cbReadStart() error=%d", errno);
return errno;
}
// FL: debug
- cbLog(pCb, 1, "PAF_ASOT_decodeInit:cbReadStart");
+ cbLog(pCbCtl, z, 1, "PAF_ASOT_decodeInit:cbReadStart");
}
// TODO: move this to start of this function so that it doesn't affect IO timing
{
zO = pP->outputsFromEncodes[z];
zS = pP->streamsFromEncodes[z];
- if (pC->xOut[zO].hTxSio && pC->xEnc[z].encodeStatus.mode)
+ if (pAstCfg->xOut[zO].hTxSio && pAstCfg->xEnc[z].encodeStatus.mode)
{
- Int select = pC->xEnc[z].encodeStatus.select;
- ALG_Handle encAlg = pC->xEnc[z].encAlg[select];
+ Int select = pAstCfg->xEnc[z].encodeStatus.select;
+ ALG_Handle encAlg = pAstCfg->xEnc[z].encAlg[select];
ENC_Handle enc = (ENC_Handle )encAlg;
TRACE_VERBOSE1("AS%d: PAF_ASOT_decodeInit: initializing encode", as+zS);
if (encAlg->fxns->algActivate)
}
if (enc->fxns->reset
&& (errno = enc->fxns->reset(enc, NULL,
- &pC->xEnc[z].encodeControl, &pC->xEnc[z].encodeStatus)))
+ &pAstCfg->xEnc[z].encodeControl, &pAstCfg->xEnc[z].encodeStatus)))
{
return errno;
}
//
Int
PAF_ASOT_decodeInfo1(
- const PAF_AST_Params *pP,
- const PAF_AST_Patchs *pQ,
- PAF_AST_Config *pC,
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pC,
Int frame,
Int block
)
{
+ PAF_AST_Config *pAstCfg;
Int z; /* decode/encode counter */
Int errno; /* error number */
+ pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
+
// run the chain of ASP's on the stream.
TRACE_VERBOSE0("PAF_ASOT_decodeInfo1: calling streamChainFunction.");
if (errno = pP->fxns->streamChainFunction(pP, pQ, pC,
for (z=ENCODE1; z < ENCODEN; z++)
{
Int zO = pP->outputsFromEncodes[z];
- if (pC->xOut[zO].hTxSio && pC->xEnc[z].encodeStatus.mode)
+ if (pAstCfg->xOut[zO].hTxSio && pAstCfg->xEnc[z].encodeStatus.mode)
{
- Int select = pC->xEnc[z].encodeStatus.select;
- ALG_Handle encAlg = pC->xEnc[z].encAlg[select];
+ Int select = pAstCfg->xEnc[z].encodeStatus.select;
+ ALG_Handle encAlg = pAstCfg->xEnc[z].encAlg[select];
ENC_Handle enc = (ENC_Handle )encAlg;
if (enc->fxns->info
&& (errno = enc->fxns->info(enc, NULL,
- &pC->xEnc[z].encodeControl, &pC->xEnc[z].encodeStatus)))
+ &pAstCfg->xEnc[z].encodeControl, &pAstCfg->xEnc[z].encodeStatus)))
{
TRACE_TERSE1("PAF_ASOT_decodeInfo1: info returns errno 0x%x ", errno);
return errno;
//
Int
PAF_ASOT_decodeInfo2(
- const PAF_AST_Params *pP,
- const PAF_AST_Patchs *pQ,
- PAF_AST_Config *pC,
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pC,
Int frame,
Int block
)
{
+ //PAF_AST_Config *pAstCfg;
Int errno;
+
+ //pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
+
errno = pP->fxns->setCheckRateX (pP, pQ, pC, 1);
TRACE_VERBOSE1("PAF_ASOT_decodeInfo2: return 0x%x", errno);
return errno;
//
Int
PAF_ASOT_decodeStream(
- const PAF_AST_Params *pP,
- const PAF_AST_Patchs *pQ,
- PAF_AST_Config *pC,
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pC,
Int frame,
Int block
)
{
+ PAF_AST_Config *pAstCfg;
+ PAF_AST_DecOpCircBufCtl *pCbCtl; /* Decoder output circular buffer control */
Int z; /* decode/stream counter */
- PAF_DecodeOpCircBuf *pCb;
PAF_AudioFrame *pAfRd;
Int cbErrno;
Int errno;
+
+ pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
+
+ pCbCtl = &pC->pAspmCfg->decOpCircBufCtl; // get pointer to circular buffer control
+
for (z=DECODE1; z < DECODEN; z++)
{
Int zS = pP->streamsFromDecodes[z];
//
- // (***) FL: read circular buffer
+ // Read decoder output circular buffer
//
- pCb = &pC->xDec[z].decOpCb;
- pAfRd = pC->xStr[zS].pAudioFrame;
- cbErrno = cbReadAf(pCb, pAfRd);
+ pAfRd = pAstCfg->xStr[zS].pAudioFrame;
+ cbErrno = cbReadAf(pCbCtl, z, pAfRd);
if (cbErrno != 0)
{
TRACE_TERSE1("PAF_ASOT_decodeStream:cbReadAf() error=%d", cbErrno);
//SW_BREAKPOINT; // FL: debug
- //return cbErrno; // (***) FL: ignoring read failures??
+
+ if (cbErrno == ASP_DECOP_CB_READ_UNDERFLOW)
+ {
+ // Reset circular buffer
+ cbReset(pCbCtl, z);
+ Log_info0("PAF_ASOT_decodeStream:cbReset");
+
+ // Update underflow count, return if above threshold
+ gDecOpCbRdAfUnd++;
+ if (gDecOpCbRdAfUnd == DEC_OP_CB_RDAF_UND_THR)
+ {
+ gDecOpCbRdAfUnd = 0;
+ return cbErrno;
+ }
+ }
}
//Log_info0("PAF_ASOT_decodeStream:cbReadAf() complete.");
// FL: debug
- cbLog(pCb, 1, "PAF_ASOT_decodeStream:cbReadAf");
+ cbLog(pCbCtl, z, 1, "PAF_ASOT_decodeStream:cbReadAf");
//if (capAfWrite(pAfRd, 0) != CAP_AF_SOK)
//{
// Log_info0("capAfWrite() error");
//
Int
PAF_ASOT_decodeEncode(
- const PAF_AST_Params *pP,
- const PAF_AST_Patchs *pQ,
- PAF_AST_Config *pC,
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pC,
Int frame,
Int block
)
{
- Int as = pC->as; /* Audio Stream Number (1, 2, etc.) */
- Int z; /* encode/output counter */
- Int errno; /* error number */
+ PAF_AST_Config *pAstCfg;
+ Int as; /* Audio Stream Number (1, 2, etc.) */
+ Int z; /* encode/output counter */
+ Int errno; /* error number */
Int zX, zE, zS;
UInt32 curTime;
+ pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
+ as = pAstCfg->as;
// Await output buffers (but not first time)
for (z=OUTPUT1; z < OUTPUTN; z++)
}
zS = pP->streamsFromEncodes[zE];
- if (pC->xOut[z].hTxSio)
+ if (pAstCfg->xOut[z].hTxSio)
{
// update length (e.g. ARC may have changed)
- pC->xOut[z].outBufConfig.lengthofFrame =
- pC->xEnc[zE].encodeInStruct.pAudioFrame->sampleCount;
+ pAstCfg->xOut[z].outBufConfig.lengthofFrame =
+ pAstCfg->xEnc[zE].encodeInStruct.pAudioFrame->sampleCount;
TRACE_GEN2("PAF_ASOT_decodeEncode: AS%d: processing block %d -- idle", as+zS, block);
- errno = SIO_reclaim(pC->xOut[z].hTxSio,(Ptr *) &pC->xOut[z].pOutBuf, NULL);
+ errno = SIO_reclaim(pAstCfg->xOut[z].hTxSio,(Ptr *) &pAstCfg->xOut[z].pOutBuf, NULL);
if (errno < 0)
{
- SIO_idle(pC->xOut[z].hTxSio);
+ SIO_idle(pAstCfg->xOut[z].hTxSio);
TRACE_TERSE2("PAF_ASOT_decodeEncode: AS%d: SIO_reclaim returns error %d", as+zS, -errno);
return -errno; // SIO negates error codes
}
Int zO = pP->outputsFromEncodes[z];
Int zS = pP->streamsFromEncodes[z];
(void)zS; // clear compiler warning in case not used with tracing disabled
- if (pC->xOut[zO].hTxSio && pC->xEnc[z].encodeStatus.mode)
+ if (pAstCfg->xOut[zO].hTxSio && pAstCfg->xEnc[z].encodeStatus.mode)
{
- Int select = pC->xEnc[z].encodeStatus.select;
- ALG_Handle encAlg = pC->xEnc[z].encAlg[select];
+ Int select = pAstCfg->xEnc[z].encodeStatus.select;
+ ALG_Handle encAlg = pAstCfg->xEnc[z].encAlg[select];
ENC_Handle enc = (ENC_Handle )encAlg;
- if (select != pC->xEnc[z].encodeControl.encActive)
+ if (select != pAstCfg->xEnc[z].encodeControl.encActive)
{
- pC->xEnc[z].encodeControl.encActive = select;
+ pAstCfg->xEnc[z].encodeControl.encActive = select;
TRACE_TERSE0("PAF_ASOT_decodeEncode: return error");
return (-1);
}
TRACE_GEN2("AS%d: PAF_ASOT_decodeEncode: processing block %d -- encode", as+zS, block);
// (MID 1933) temp. workaround for PCE2
- pC->xEnc[z].encodeInStruct.pAudioFrame->data.nChannels = PAF_MAXNUMCHAN;
+ pAstCfg->xEnc[z].encodeInStruct.pAudioFrame->data.nChannels = PAF_MAXNUMCHAN;
/*
#if (CURRENT_TRACE_MASK & TRACE_MASK_DATA)
if (enc->fxns->encode)
{
- pC->xEnc[z].encodeOutStruct.bypassFlag =
+ pAstCfg->xEnc[z].encodeOutStruct.bypassFlag =
pP->z_pEncodeStatus[z]->encBypass;
if (errno = enc->fxns->encode(enc, NULL,
- &pC->xEnc[z].encodeInStruct, &pC->xEnc[z].encodeOutStruct))
+ &pAstCfg->xEnc[z].encodeInStruct, &pAstCfg->xEnc[z].encodeOutStruct))
{
if (errno != PCEERR_OUTPUT_POINTERNULL)
{
}
zS = pP->streamsFromEncodes[zE];
- if (pC->xOut[z].hTxSio)
+ if (pAstCfg->xOut[z].hTxSio)
{
TRACE_GEN2("PAF_ASOT_decodeEncode: AS%d: processing block %d -- output", as+zS, block);
- errno = SIO_issue(pC->xOut[z].hTxSio,
- &pC->xOut[z].outBufConfig, sizeof (pC->xOut[z].outBufConfig), 0);
+ errno = SIO_issue(pAstCfg->xOut[z].hTxSio,
+ &pAstCfg->xOut[z].outBufConfig, sizeof (pAstCfg->xOut[z].outBufConfig), 0);
if (errno)
{
- SIO_idle(pC->xOut[z].hTxSio);
+ SIO_idle(pAstCfg->xOut[z].hTxSio);
if (errno == 0x105) // 0x105 == RINGIO_EBUFFULL
{
// statStruct_LogFullRing(STATSTRUCT_AS1_F2);
//
Int
PAF_ASOT_decodeComplete(
- const PAF_AST_Params *pP,
- const PAF_AST_Patchs *pQ,
- PAF_AST_Config *pC,
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pC,
ALG_Handle decAlg[],
Int frame,
Int block
)
{
- Int as = pC->as; /* Audio Stream Number (1, 2, etc.) */
+ PAF_AST_Config *pAstCfg;
+ PAF_AST_DecOpCircBufCtl *pCbCtl; /* Decoder output circular buffer control */
+ Int as; /* Audio Stream Number (1, 2, etc.) */
Int z; /* decode/encode counter */
Int errno; /* error number */
- PAF_DecodeOpCircBuf *pCb; /* decoder output circular buffer */
+
+ pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
+ as = pAstCfg->as;
(void)as; // clear compiler warning in case not used with tracing disabled
+ pCbCtl = &pC->pAspmCfg->decOpCircBufCtl; // get pointer to circular buffer control
+
for (z=DECODE1; z < DECODEN; z++)
{
// Stop decoder output circular buffer reads
- pCb = &pC->xDec[z].decOpCb;
- errno = cbReadStop(pCb);
+ errno = cbReadStop(pCbCtl, z);
if (errno)
{
TRACE_TERSE1("PAF_ASOT_decodeComplete:cbReadStop() error=%d", errno);
return errno;
}
// FL: debug
- cbLog(pCb, 1, "PAF_ASOT_decodeComplete:cbReadStop");
+ cbLog(pCbCtl, z, 1, "PAF_ASOT_decodeComplete:cbReadStop");
}
pP->fxns->streamChainFunction(pP, pQ, pC, PAF_ASP_CHAINFRAMEFXNS_FINAL, 0, frame);
for (z=ENCODE1; z < ENCODEN; z++)
{
Int zO = pP->outputsFromEncodes[z];
- if (pC->xOut[zO].hTxSio && pC->xEnc[z].encodeStatus.mode)
+ if (pAstCfg->xOut[zO].hTxSio && pAstCfg->xEnc[z].encodeStatus.mode)
{
- Int select = pC->xEnc[z].encodeStatus.select;
- ALG_Handle encAlg = pC->xEnc[z].encAlg[select];
+ Int select = pAstCfg->xEnc[z].encodeStatus.select;
+ ALG_Handle encAlg = pAstCfg->xEnc[z].encAlg[select];
#ifdef PAF_ASP_FINAL
ENC_Handle enc = (ENC_Handle)encAlg;
#endif /* PAF_ASP_FINAL */
TRACE_VERBOSE1("PAF_ASOT_decodeComplete: AS%d: finalizing encode", as+z);
#ifdef PAF_ASP_FINAL
if (enc->fxns->final)
- enc->fxns->final(enc, NULL, &pC->xEnc[z].encodeControl,
- &pC->xEnc[z].encodeStatus);
+ enc->fxns->final(enc, NULL, &pAstCfg->xEnc[z].encodeControl,
+ &pAstCfg->xEnc[z].encodeStatus);
#endif /* PAF_ASP_FINAL */
if (encAlg->fxns->algDeactivate)
{
Int
PAF_ASOT_startOutput(
- const PAF_AST_Params *pP,
- const PAF_AST_Patchs *pQ,
- PAF_AST_Config *pC
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pC
)
{
- Int as = pC->as; /* Audio Stream Number (1, 2, etc.) */
- Int z; /* output counter */
- Int errno,nbufs; /* error number */
+ PAF_AST_Config *pAstCfg;
+ Int as; /* Audio Stream Number (1, 2, etc.) */
+ Int z; /* output counter */
+ Int errno,nbufs; /* error number */
Int zE, zS, zX;
- Int zMD = pC->masterDec;
+ Int zMD;
PAF_SIO_IALG_Obj *pObj;
PAF_SIO_IALG_Config *pAlgConfig;
+
+ pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
+ as = pAstCfg->as;
+ zMD = pAstCfg->masterDec;
for (z=OUTPUT1; z < OUTPUTN; z++)
{
- if (pC->xOut[z].hTxSio)
+ if (pAstCfg->xOut[z].hTxSio)
{
// determine associated encoder and stream
zE = z;
}
// Set sample count so that DOB knows how much data to send
- pC->xOut[z].outBufConfig.lengthofFrame =
- pC->xEnc[zE].encodeInStruct.pAudioFrame->sampleCount;
+ pAstCfg->xOut[z].outBufConfig.lengthofFrame =
+ pAstCfg->xEnc[zE].encodeInStruct.pAudioFrame->sampleCount;
- if (pC->xOut[z].outBufStatus.markerMode == PAF_OB_MARKER_ENABLED)
+ if (pAstCfg->xOut[z].outBufStatus.markerMode == PAF_OB_MARKER_ENABLED)
{
- pObj = (PAF_SIO_IALG_Obj *) pC->xOut[z].outChainData.head->alg;
+ pObj = (PAF_SIO_IALG_Obj *) pAstCfg->xOut[z].outChainData.head->alg;
pAlgConfig = &pObj->config;
- memset(pC->xOut[z].outBufConfig.base.pVoid, 0xAA,
+ memset(pAstCfg->xOut[z].outBufConfig.base.pVoid, 0xAA,
pAlgConfig->pMemRec[0].size);
}
// The index to DEC_OUTNUMBUF_MAP will always come from the primary/master
// decoder. How should we handle the sourceProgram for multiple decoders?
// Override as needed
- nbufs = DEC_OUTNUMBUF_MAP(pC->xDec[zMD].decodeStatus.sourceProgram);
- if (pC->xOut[z].outBufStatus.numBufOverride[pC->xDec[zMD].decodeStatus.sourceProgram] > 0)
+ nbufs = DEC_OUTNUMBUF_MAP(pAstCfg->xDec[zMD].decodeStatus.sourceProgram);
+ if (pAstCfg->xOut[z].outBufStatus.numBufOverride[pAstCfg->xDec[zMD].decodeStatus.sourceProgram] > 0)
{
- nbufs = pC->xOut[z].outBufStatus.numBufOverride[pC->xDec[zMD].decodeStatus.sourceProgram];
+ nbufs = pAstCfg->xOut[z].outBufStatus.numBufOverride[pAstCfg->xDec[zMD].decodeStatus.sourceProgram];
}
- SIO_ctrl(pC->xOut[z].hTxSio, PAF_SIO_CONTROL_SET_NUMBUF, nbufs);
+ SIO_ctrl(pAstCfg->xOut[z].hTxSio, PAF_SIO_CONTROL_SET_NUMBUF, nbufs);
- if (errno = SIO_issue(pC->xOut[z].hTxSio,
- &pC->xOut[z].outBufConfig, sizeof(pC->xOut[z].outBufConfig), 0))
+ if (errno = SIO_issue(pAstCfg->xOut[z].hTxSio,
+ &pAstCfg->xOut[z].outBufConfig, sizeof(pAstCfg->xOut[z].outBufConfig), 0))
{
- SIO_idle(pC->xOut[z].hTxSio);
+ SIO_idle(pAstCfg->xOut[z].hTxSio);
TRACE_TERSE2("PAF_ASOT_startOutput: AS%d: SIO_issue failed (0x%x)", as+zS, errno);
return errno;
}
- if (!(pC->xOut[z].outBufStatus.audio & 0xf0) &&
- (errno = SIO_ctrl (pC->xOut[z].hTxSio, PAF_SIO_CONTROL_UNMUTE, 0)))
+ if (!(pAstCfg->xOut[z].outBufStatus.audio & 0xf0) &&
+ (errno = SIO_ctrl (pAstCfg->xOut[z].hTxSio, PAF_SIO_CONTROL_UNMUTE, 0)))
{
errno = (errno & 0xff) | ASPERR_MUTE;
/* convert to sensical errno */
}
else
{
- pC->xOut[z].outBufStatus.audio
- = (pC->xOut[z].outBufStatus.audio & 0xf0) | PAF_OB_AUDIO_SOUND;
+ pAstCfg->xOut[z].outBufStatus.audio
+ = (pAstCfg->xOut[z].outBufStatus.audio & 0xf0) | PAF_OB_AUDIO_SOUND;
}
TRACE_VERBOSE1("PAF_ASOT_startOutput: AS%d: output started", as+zS);
//
Int
PAF_ASOT_stopOutput(
- const PAF_AST_Params *pP,
- const PAF_AST_Patchs *pQ,
- PAF_AST_Config *pC
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pC
)
{
- Int as = pC->as; /* Audio Stream Number (1, 2, etc.) */
- Int z; /* output counter */
+ PAF_AST_Config *pAstCfg;
+ Int as; /* Audio Stream Number (1, 2, etc.) */
+ Int z; /* output counter */
Int errno = 0, getVal;
Int zS, zX;
PAF_SIO_IALG_Obj *pObj;
PAF_SIO_IALG_Config *pAlgConfig;
+ pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
+ as = pAstCfg->as;
(void)as; // clear compiler warning in case not used with tracing disabled
for (z=OUTPUT1; z < OUTPUTN; z++)
{
- if (pC->xOut[z].hTxSio)
+ if (pAstCfg->xOut[z].hTxSio)
{
// determine associated encoder and stream
zS = z;
// where such termination is due to decode error or user command.
// Identification of this as the usual case is provided by the
// "decode processing" state machine.
- if (!(pC->xOut[z].outBufStatus.audio & 0xf0) &&
- ((pC->xOut[z].outBufStatus.audio & 0x0f) == PAF_OB_AUDIO_SOUND) &&
- (getVal = SIO_ctrl(pC->xOut[z].hTxSio, PAF_SIO_CONTROL_MUTE, 0)))
+ if (!(pAstCfg->xOut[z].outBufStatus.audio & 0xf0) &&
+ ((pAstCfg->xOut[z].outBufStatus.audio & 0x0f) == PAF_OB_AUDIO_SOUND) &&
+ (getVal = SIO_ctrl(pAstCfg->xOut[z].hTxSio, PAF_SIO_CONTROL_MUTE, 0)))
{
if (!errno)
{
#else
// This form should be used when driver support for truncating
// data is supported for both internal and external clocks.
- getVal = SIO_ctrl(pC->xOut[z].hTxSio, PAF_SIO_CONTROL_IDLE,
- pC->xOut[z].outBufStatus.flush ? 1 :
- (pC->xOut[z].outBufStatus.audio & 0x0f) == PAF_OB_AUDIO_FLUSH
+ getVal = SIO_ctrl(pAstCfg->xOut[z].hTxSio, PAF_SIO_CONTROL_IDLE,
+ pAstCfg->xOut[z].outBufStatus.flush ? 1 :
+ (pAstCfg->xOut[z].outBufStatus.audio & 0x0f) == PAF_OB_AUDIO_FLUSH
? 1 : 0);
/* TESTED */
#endif
// where such termination is due to processing of a final frame
// or user command. Identification of this as a special case is
// provided by the "decode processing" state machine.
- if (!(pC->xOut[z].outBufStatus.audio & 0xf0) &&
- ((pC->xOut[z].outBufStatus.audio & 0x0f) == PAF_OB_AUDIO_FLUSH) &&
- (getVal = SIO_ctrl(pC->xOut[z].hTxSio, PAF_SIO_CONTROL_MUTE, 0)))
+ if (!(pAstCfg->xOut[z].outBufStatus.audio & 0xf0) &&
+ ((pAstCfg->xOut[z].outBufStatus.audio & 0x0f) == PAF_OB_AUDIO_FLUSH) &&
+ (getVal = SIO_ctrl(pAstCfg->xOut[z].hTxSio, PAF_SIO_CONTROL_MUTE, 0)))
{
if (!errno)
{
TRACE_VERBOSE1("as1-f2: PAF_ASOT_stopOutput: AS%d: SIO control failed (mute)", as+zS);
}
- pC->xOut[z].outBufStatus.audio &= ~0x0f;
+ pAstCfg->xOut[z].outBufStatus.audio &= ~0x0f;
// zero output buffers
- pObj = (PAF_SIO_IALG_Obj *) pC->xOut[z].outChainData.head->alg;
+ pObj = (PAF_SIO_IALG_Obj *) pAstCfg->xOut[z].outChainData.head->alg;
pAlgConfig = &pObj->config;
- memset (pC->xOut[z].outBufConfig.base.pVoid, 0, pAlgConfig->pMemRec[0].size);
- } //pC->xOut[z].hTxSio
+ memset (pAstCfg->xOut[z].outBufConfig.base.pVoid, 0, pAlgConfig->pMemRec[0].size);
+ } //pAstCfg->xOut[z].hTxSio
}//OUTPUT
return errno;
-} //PAF_AST_stopOutput
+} //PAF_ASOT_stopOutput
// -----------------------------------------------------------------------------
// ASOT Decoding Function Helper - SIO Driver Change
/* 0: set, 1: check, unused for now. --Kurt */
Int
PAF_ASOT_setCheckRateX(
- const PAF_AST_Params *pP,
- const PAF_AST_Patchs *pQ,
- PAF_AST_Config *pC,
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pC,
Int check
)
{
+ PAF_AST_Config *pAstCfg;
float rateX;
PAF_SampleRateHz rateO /* std */, rateI /* inv */;
Int z; /* output counter */
Int zx; /* output re-counter */
Int getVal;
int inputRate, inputCount, outputRate, outputCount;
- Int zMD = pC->masterDec;
- Int zMI = pP->zone.master;
- Int zMS = pC->masterStr;
+ Int zMD;
+ Int zMI;
+ Int zMS;
Int zE, zX;
+ pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
+ zMD = pAstCfg->masterDec;
+ zMS = pAstCfg->masterStr;
+ zMI = pP->zone.master;
- inputRate = pC->xInp[zMI].inpBufStatus.sampleRateStatus;
- inputCount = pC->xDec[zMD].decodeStatus.frameLength;
- rateI = pC->xStr[zMS].pAudioFrame->fxns->sampleRateHz
- (pC->xStr[zMS].pAudioFrame, inputRate, PAF_SAMPLERATEHZ_INV);
+ inputRate = pAstCfg->xInp[zMI].inpBufStatus.sampleRateStatus;
+ inputCount = pAstCfg->xDec[zMD].decodeStatus.frameLength;
+ rateI = pAstCfg->xStr[zMS].pAudioFrame->fxns->sampleRateHz
+ (pAstCfg->xStr[zMS].pAudioFrame, inputRate, PAF_SAMPLERATEHZ_INV);
for (z=OUTPUT1; z < OUTPUTN; z++) {
- if (pC->xOut[z].hTxSio && (pC->xOut[z].outBufStatus.clock & 0x01)) {
+ if (pAstCfg->xOut[z].hTxSio && (pAstCfg->xOut[z].outBufStatus.clock & 0x01)) {
// determine associated encoder
zE = z;
}
}
- outputRate = pC->xEnc[zE].encodeStatus.sampleRate;
- outputCount = pC->xEnc[zE].encodeStatus.frameLength;
- rateO = pC->xStr[zMS].pAudioFrame->fxns->sampleRateHz
- (pC->xStr[zMS].pAudioFrame, outputRate, PAF_SAMPLERATEHZ_STD);
+ outputRate = pAstCfg->xEnc[zE].encodeStatus.sampleRate;
+ outputCount = pAstCfg->xEnc[zE].encodeStatus.frameLength;
+ rateO = pAstCfg->xStr[zMS].pAudioFrame->fxns->sampleRateHz
+ (pAstCfg->xStr[zMS].pAudioFrame, outputRate, PAF_SAMPLERATEHZ_STD);
if (rateI > 0 && rateO > 0)
rateX = rateO /* std */ * rateI /* inv */;
else if (inputCount != 0)
else
return ( ASPERR_INFO_RATERATIO );
- getVal = SIO_ctrl (pC->xOut[z].hTxSio, PAF_SIO_CONTROL_SET_RATEX, (Arg) &rateX);
+ getVal = SIO_ctrl (pAstCfg->xOut[z].hTxSio, PAF_SIO_CONTROL_SET_RATEX, (Arg) &rateX);
if (getVal == DOBERR_RATECHANGE) {
for (zx=OUTPUT1; zx < OUTPUTN; zx++)
- if (pC->xOut[zx].hTxSio)
- SIO_idle (pC->xOut[zx].hTxSio);
+ if (pAstCfg->xOut[zx].hTxSio)
+ SIO_idle (pAstCfg->xOut[zx].hTxSio);
// this forces an exit from the calling state machine which will
// eventually call startOutput which calls setCheckRateX for all outputs
//
Int
PAF_ASOT_streamChainFunction(
- const PAF_AST_Params *pP,
- const PAF_AST_Patchs *pQ,
- PAF_AST_Config *pC,
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pC,
Int iChainFrameFxns,
Int abortOnError,
Int logArg
)
{
- Int as = pC->as; /* Audio Stream Number (1, 2, etc.) */
- Int z; /* stream counter */
- Int errno; /* error number */
+ PAF_AST_Config *pAstCfg;
+ Int as; /* Audio Stream Number (1, 2, etc.) */
+ Int z; /* stream counter */
+ Int errno; /* error number */
Int dFlag, eFlag, gear;
Int zX;
Int zS;
+ pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
+ as = pAstCfg->as;
(void)as; // clear compiler warning in case not used with tracing disabled
for (zS = STREAM1; zS < STREAMN; zS++)
gear = 0;
for (zX = DECODE1; zX < DECODEN; zX++) {
if (pP->streamsFromDecodes[zX] == z) {
- dFlag = pC->xDec[zX].decodeStatus.mode;
- gear = pC->xDec[zX].decodeStatus.aspGearStatus;
+ dFlag = pAstCfg->xDec[zX].decodeStatus.mode;
+ gear = pAstCfg->xDec[zX].decodeStatus.aspGearStatus;
break;
}
}
eFlag = 1;
for (zX = ENCODE1; zX < ENCODEN; zX++) {
if (pP->streamsFromEncodes[zX] == z) {
- eFlag = pC->xEnc[zX].encodeStatus.mode;
+ eFlag = pAstCfg->xEnc[zX].encodeStatus.mode;
break;
}
}
if (dFlag && eFlag) {
- PAF_ASP_Chain *chain = pC->xStr[z].aspChain[gear];
- PAF_AudioFrame *frame = pC->xStr[z].pAudioFrame;
+ PAF_ASP_Chain *chain = pAstCfg->xStr[z].aspChain[gear];
+ PAF_AudioFrame *frame = pAstCfg->xStr[z].pAudioFrame;
Int (*func) (PAF_ASP_Chain *, PAF_AudioFrame *) =
chain->fxns->chainFrameFunction[iChainFrameFxns];
}
return 0;
-} //PAF_AST_streamChainFunction
+} //PAF_ASOT_streamChainFunction
/* FL: Check if at least one output selected */
static Int checkOutSel(
- const PAF_AST_Params *pP,
- PAF_AST_Config *pC,
+ const PAF_ASOT_Params *pP,
+ PAF_ASOT_Config *pC,
Int *pOutSel
)
{
+ PAF_AST_Config *pAstCfg;
Int outSel;
Int z;
+ pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
+
outSel = 0;
for (z=OUTPUT1; z < OUTPUTN; z++)
{
- if (pC->xOut[z].hTxSio)
+ if (pAstCfg->xOut[z].hTxSio)
{
outSel = 1;
break;
/* FL: Check if at least one output sio changed */
static Int checkOutSio(
- const PAF_AST_Params *pP,
- PAF_AST_Config *pC,
+ const PAF_ASOT_Params *pP,
+ PAF_ASOT_Config *pC,
Int *pOutSioUpdate
)
{
+ PAF_AST_Config *pAstCfg;
Int outSioUpdate;
Int z;
+ pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
+
outSioUpdate = 0;
for (z=OUTPUT1; z < OUTPUTN; z++)
{
- if (pC->xOut[z].outBufStatus.sioSelect >= 0)
+ if (pAstCfg->xOut[z].outBufStatus.sioSelect >= 0)
{
outSioUpdate = 1;
break;