comparison 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
comparison
equal deleted inserted replaced
546:db3e1a08cdee 547:a2096488a21a
49 void trigger_samples(); 49 void trigger_samples();
50 50
51 bool setup(BelaContext *context, void *userData) 51 bool setup(BelaContext *context, void *userData)
52 { 52 {
53 53
54 // Check that we have the same number of inputs and outputs.
55 if(context->audioInChannels != context->audioOutChannels ||
56 context->analogInChannels != context-> analogOutChannels){
57 printf("Error: for this project, you need the same number of input and output channels.\n");
58 return false;
59 }
60
54 // Retrieve a parameter passed in from the initAudio() call 61 // Retrieve a parameter passed in from the initAudio() call
55 gSampleData = *(SampleData *)userData; 62 gSampleData = *(SampleData *)userData;
56 63
57 gReadPtr = -1; 64 gReadPtr = -1;
58 65
81 } 88 }
82 89
83 ne10_fir_float_neon(&gFIRfilter, gFIRfilterIn, gFIRfilterOut, blockSize); 90 ne10_fir_float_neon(&gFIRfilter, gFIRfilterIn, gFIRfilterOut, blockSize);
84 91
85 for(unsigned int n = 0; n < context->audioFrames; n++) { 92 for(unsigned int n = 0; n < context->audioFrames; n++) {
86 for(unsigned int channel = 0; channel < context->audioChannels; channel++) 93 for(unsigned int channel = 0; channel < context->audioOutChannels; channel++)
87 context->audioOut[n * context->audioChannels + channel] = gFIRfilterOut[n]; // ...and put it in both left and right channel 94 context->audioOut[n * context->audioOutChannels + channel] = gFIRfilterOut[n]; // ...and put it in both left and right channel
88 } 95 }
89 96
90 97
91 // Request that the lower-priority task run at next opportunity 98 // Request that the lower-priority task run at next opportunity
92 Bela_scheduleAuxiliaryTask(gTriggerSamplesTask); 99 Bela_scheduleAuxiliaryTask(gTriggerSamplesTask);