Mercurial > hg > beaglert
diff examples/04-Audio/filter-FIR/render.cpp @ 547:a2096488a21a prerelease
Merge
author | chnrx <chris.heinrichs@gmail.com> |
---|---|
date | Fri, 24 Jun 2016 14:12:22 +0100 |
parents | cdabbaf3a252 |
children |
line wrap: on
line diff
--- a/examples/04-Audio/filter-FIR/render.cpp Fri Jun 24 14:11:32 2016 +0100 +++ b/examples/04-Audio/filter-FIR/render.cpp Fri Jun 24 14:12:22 2016 +0100 @@ -51,6 +51,13 @@ bool setup(BelaContext *context, void *userData) { + // Check that we have the same number of inputs and outputs. + if(context->audioInChannels != context->audioOutChannels || + context->analogInChannels != context-> analogOutChannels){ + printf("Error: for this project, you need the same number of input and output channels.\n"); + return false; + } + // Retrieve a parameter passed in from the initAudio() call gSampleData = *(SampleData *)userData; @@ -83,8 +90,8 @@ ne10_fir_float_neon(&gFIRfilter, gFIRfilterIn, gFIRfilterOut, blockSize); for(unsigned int n = 0; n < context->audioFrames; n++) { - for(unsigned int channel = 0; channel < context->audioChannels; channel++) - context->audioOut[n * context->audioChannels + channel] = gFIRfilterOut[n]; // ...and put it in both left and right channel + for(unsigned int channel = 0; channel < context->audioOutChannels; channel++) + context->audioOut[n * context->audioOutChannels + channel] = gFIRfilterOut[n]; // ...and put it in both left and right channel }