AnsweredAssumed Answered

Arrangement of channels in a block

Question asked by Phonon on Dec 11, 2012
Latest reply on Dec 12, 2012 by JJoseph

I'm going through a simple example of a gain function given the the Algorithm Designer document (KT-1345 Rev 1.0). The example implements the block processing function as follows:

 

void BPROCESS_Scale (SSBlockAlgo* pBlkAlgoInfo)
{
     int index, sample, gain, blockSize, repCount;
     float *pInput, *pOutput;

     repCount = pBlkAlgoInfo->nGrowth;

     for(index = 0; index < repCount; index++)
     {
          blockSize = pBlkAlgoInfo->pInputs[2 * index].PBlockProperties->nBlockSize;
          gain = ((float *)pBlkAlgoInfo->pParam)[index];

          pInput = pBlkAlgoInfo->pInputs[index].pSamples;
          pOutput = pBlkAlgoInfo->pOutputs[index].pSamples;

          for(sample = 0; sample < blockSize; sample++)
          {
               pOutput[sample] = pInput[sample] * gain;
          }
     }
}

 

Suppose the algorithm operates on several channels of audio , and there are also several instances (nGrowth > 1) that we're working with. Why in this case do we extract blockSize from pBlkAlgoInfo->pInputs[2 * index] which to me implies that we have several stereo value pairs going one after the other (A:ch1, A:ch1, B:ch1, B:ch2, ...)? On the other hand, we extract pInput from pBlkAlgoInfo->pInputs[index] (notice we don't multiply the index by 2) which to me implies that we're actually using a mono configuration.

 

Why is that 2 there for extracting block size?

 

Cheers!

Outcomes