We initial an ext module from following example
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[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; } } }
In this example, `nGrowth` seems to be used as total channel number, but this sample not matchs our requirement, cause its input and output pins are equal, but we do need to implement an ext module which has different input & output pin, for example, 4 input channels, and 2 output channels
input channel 0 to 3 merge to output channel 0, input channel 0 to 3 merge to output channel 1. How do I handle this requirement? `nGrowth` hehalf which channel number? input channel or output channel?
for this requirement, only one channel number (nGrowth) seems not enough, I guess maybe another member `nGrowthB` will be used for output channel number, and the code should be like this
int sample, blockSize, outChs, inChs; float *pInput, *pOutput; inChs = pBlkAlgoInfo->nGrowth; outChs = pBlkAlgoInfo->nGrowthB; for(out_ch = 0; out_ch < outChs; out_ch++) { pOutput[sample] = 0; blockSize = pBlkAlgoInfo->pInputs[out_ch].PBlockProperties->nBlockSize; for(sample = 0; sample < blockSize; sample++) { for (in_ch = 0; in_ch < inChs; in_ch++) { pInput = pBlkAlgoInfo->pInputs[in_ch].pSamples; pOutput[sample] += pInput[sample]; } } }
anyone can help me to understand and correct?
One more thing, since struct SSBlockAlgo has memver nInputs which indicates number of input channels, why use nGrowth for channels again? my point is nInputs indicates max input channel buffers, and nGrowth maybe less than nInputs, for example, there are 5 input channel buffers, but only 3 actual carry the input data, is my understanding correct or not?