]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/performance-audio-sr.git/blobdiff - processor_audio_sdk_1_00_00_00/pasdk/test_dsp/framework/audioStreamOutProc.c
Fix metadata buffer size in ARM/DSP params
[processor-sdk/performance-audio-sr.git] / processor_audio_sdk_1_00_00_00 / pasdk / test_dsp / framework / audioStreamOutProc.c
index c883b1caf663398d5bf6ab2d105919e68c2cd6d2..816b8a88e93c6d26af4ad6fc560705169706e54c 100644 (file)
@@ -56,7 +56,7 @@ All rights reserved.
 #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"
 
@@ -93,24 +93,36 @@ All rights reserved.
 
 #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;
@@ -126,11 +138,12 @@ UInt32 gAsopQuitCnt     =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_AST_Config *pC;             /* Local configuration pointer */
+    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 */
@@ -160,8 +173,11 @@ Void taskAsopFxn(
     //
     // Audio Framework Configuration (*pC):
     //
-    pC = &gPAF_AST_config;
-    as = pC->as;        /* Audio Stream Number (1, 2, etc.) */    
+    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);
 
     //
@@ -176,7 +192,7 @@ Void taskAsopFxn(
     //
     // Determine stream index
     //
-    zMS = pC->masterStr;
+    zMS = pAstCfg->masterStr;
 
     // Initialize as per parametrized phases:
     //
@@ -239,9 +255,9 @@ Void taskAsopFxn(
         {
             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);
                 }
             }
         
@@ -304,31 +320,36 @@ Void taskAsopFxn(
 
 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 */
@@ -347,32 +368,32 @@ PAF_ASOT_initPhaseMalloc (
 
         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;
@@ -394,14 +415,19 @@ PAF_ASOT_initPhaseMalloc (
 //
 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);
 
@@ -426,19 +452,19 @@ PAF_ASOT_initPhaseConfig(
     {
         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);
@@ -462,18 +488,23 @@ PAF_ASOT_initPhaseConfig(
 //
 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();
@@ -493,10 +524,10 @@ PAF_ASOT_initPhaseAcpAlg(
         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. */
     }
 
@@ -513,7 +544,7 @@ PAF_ASOT_initPhaseAcpAlg(
         }
         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. */
     }
 
@@ -542,18 +573,23 @@ PAF_ASOT_initPhaseAcpAlg(
 //
 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");
 
     //
@@ -636,7 +672,7 @@ PAF_ASOT_initPhaseCommon(
             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__;
@@ -703,14 +739,14 @@ PAF_ASOT_initPhaseCommon(
             }
         }
 
-        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);
@@ -718,7 +754,7 @@ PAF_ASOT_initPhaseCommon(
             }
             else
             {
-                pC->xStr[z].aspChain[g] = chain;
+                pAstCfg->xStr[z].aspChain[g] = chain;
             }
         }
 
@@ -726,7 +762,7 @@ PAF_ASOT_initPhaseCommon(
         {
             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) 
@@ -744,7 +780,7 @@ PAF_ASOT_initPhaseCommon(
             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) 
@@ -775,16 +811,19 @@ PAF_ASOT_initPhaseCommon(
 // .............................................................................
 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);
@@ -794,14 +833,14 @@ PAF_ASOT_initPhaseAlgKey(
         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;                
             }
         }
     }
@@ -825,17 +864,20 @@ PAF_ASOT_initPhaseAlgKey(
 //
 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);
@@ -853,12 +895,12 @@ PAF_ASOT_initPhaseDevice(
     
     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;
@@ -899,13 +941,14 @@ extern PAF_ChannelConfigurationMaskTable PAF_ASP_stdCCMT_patch;
 
 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;
@@ -919,6 +962,9 @@ PAF_ASOT_initFrame0(
     char i;
     Error_Block    eb;
 
+    pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
+    as = pAstCfg->as;
+
     // Initialize error block
     Error_init(&eb); 
 
@@ -940,13 +986,13 @@ PAF_ASOT_initFrame0(
     //
     // 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
@@ -990,7 +1036,6 @@ PAF_ASOT_initFrame0(
     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);
@@ -1005,7 +1050,7 @@ PAF_ASOT_initFrame0(
 #pragma UNROLL(1)
         for (i=0; i < PAF_MAXNUMCHAN_AF; i++)
         {
-            pC->xStr[z].audioFrameChannelPointers[i] = NULL;
+            pAstCfg->xStr[z].audioFrameChannelPointers[i] = NULL;
         }
     }
 
@@ -1027,41 +1072,41 @@ PAF_ASOT_initFrame0(
             {
                 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;
     }
 
     //
@@ -1073,11 +1118,11 @@ PAF_ASOT_initFrame0(
         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 */
         }
     }
@@ -1103,13 +1148,17 @@ PAF_ASOT_initFrame0(
 //
 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:
     //
@@ -1121,23 +1170,23 @@ PAF_ASOT_initFrame1(
 
     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
@@ -1154,23 +1203,26 @@ PAF_ASOT_initFrame1(
 //
 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);
 
@@ -1180,7 +1232,7 @@ PAF_ASOT_selectDevices(
                 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)
             {
@@ -1189,41 +1241,41 @@ PAF_ASOT_selectDevices(
                 {
                     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;
                         }
                     }
@@ -1233,14 +1285,14 @@ PAF_ASOT_selectDevices(
 
         // 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;
@@ -1260,12 +1312,13 @@ PAF_ASOT_selectDevices(
 //
 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;
@@ -1276,6 +1329,8 @@ PAF_ASOT_decodeProcessing(
     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.
@@ -1311,10 +1366,10 @@ PAF_ASOT_decodeProcessing(
                     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];
                         }
                     }
                 }
@@ -1325,15 +1380,15 @@ PAF_ASOT_decodeProcessing(
                     
                     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;
                         }
                     }
                 }
@@ -1393,10 +1448,10 @@ PAF_ASOT_decodeProcessing(
                     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];
                         }
                     }
                 }
@@ -1435,10 +1490,10 @@ PAF_ASOT_decodeProcessing(
                 {
                     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;
@@ -1496,33 +1551,37 @@ PAF_ASOT_decodeProcessing(
 //
 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 */
@@ -1531,15 +1590,15 @@ PAF_ASOT_encodeCommand(
                     }
                     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 */
@@ -1548,9 +1607,9 @@ PAF_ASOT_encodeCommand(
                     }
                     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;
@@ -1566,23 +1625,29 @@ PAF_ASOT_encodeCommand(
 //   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_AST_DecOpCircBuf *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->xDecOpCb[z];
-        errno = cbReadStart(pCb);
+        errno = cbReadStart(pCbCtl, z);
         if (errno)
         {
             TRACE_TERSE1("PAF_ASOT_decodeInit:cbReadStart() error=%d", errno);
@@ -1590,7 +1655,7 @@ PAF_ASOT_decodeInit(
             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
@@ -1598,10 +1663,10 @@ PAF_ASOT_decodeInit(
     {
         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)
@@ -1610,7 +1675,7 @@ PAF_ASOT_decodeInit(
             }
             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;
             }
@@ -1635,16 +1700,19 @@ PAF_ASOT_decodeInit(
 //
 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, 
@@ -1658,14 +1726,14 @@ PAF_ASOT_decodeInfo1(
     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;
@@ -1720,15 +1788,19 @@ PAF_ASOT_decodeInfo1(
 //
 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;
@@ -1749,39 +1821,57 @@ PAF_ASOT_decodeInfo2(
 //
 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_AST_DecOpCircBuf *pCb;          /* decoder output circular buffer */
     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->xDecOpCb[z];
-        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);
+
+                // 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");
@@ -1816,19 +1906,22 @@ PAF_ASOT_decodeStream(
 //
 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++) 
@@ -1845,16 +1938,16 @@ PAF_ASOT_decodeEncode(
         }
         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
             }
@@ -1881,21 +1974,21 @@ PAF_ASOT_decodeEncode(
         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)
@@ -1917,10 +2010,10 @@ PAF_ASOT_decodeEncode(
 
             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)
                     {
@@ -1961,14 +2054,14 @@ PAF_ASOT_decodeEncode(
         }
         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);
@@ -2017,26 +2110,31 @@ PAF_ASOT_decodeEncode(
 //
 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_AST_DecOpCircBuf *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->xDecOpCb[z];
-        errno = cbReadStop(pCb);
+        errno = cbReadStop(pCbCtl, z);
         if (errno)
         {
             TRACE_TERSE1("PAF_ASOT_decodeComplete:cbReadStop() error=%d", errno);
@@ -2044,7 +2142,7 @@ PAF_ASOT_decodeComplete(
             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);
@@ -2052,18 +2150,18 @@ PAF_ASOT_decodeComplete(
     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)
             {
@@ -2100,23 +2198,28 @@ PAF_ASOT_decodeComplete(
 
 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;
@@ -2132,37 +2235,37 @@ PAF_ASOT_startOutput(
             }
 
             // 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 */
@@ -2171,8 +2274,8 @@ PAF_ASOT_startOutput(
             }
             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);
@@ -2197,23 +2300,26 @@ PAF_ASOT_startOutput(
 //
 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;
@@ -2231,9 +2337,9 @@ PAF_ASOT_stopOutput(
             // 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) 
                 {
@@ -2261,9 +2367,9 @@ PAF_ASOT_stopOutput(
 #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
@@ -2279,9 +2385,9 @@ PAF_ASOT_stopOutput(
             // 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) 
                 {
@@ -2291,17 +2397,17 @@ PAF_ASOT_stopOutput(
                 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
@@ -2319,31 +2425,36 @@ PAF_ASOT_stopOutput(
 /* 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;
@@ -2354,10 +2465,10 @@ PAF_ASOT_setCheckRateX(
                 }
             }
 
-            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)
@@ -2365,11 +2476,11 @@ PAF_ASOT_setCheckRateX(
             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
@@ -2401,21 +2512,24 @@ PAF_ASOT_setCheckRateX(
 //
 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++)
@@ -2432,22 +2546,22 @@ PAF_ASOT_streamChainFunction(
         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];
 
@@ -2493,22 +2607,25 @@ PAF_ASOT_streamChainFunction(
     }
 
     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;
@@ -2522,18 +2639,21 @@ static Int checkOutSel(
 
 /* 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;