comparison examples/04-Audio/filter-IIR/render.cpp @ 544:cdabbaf3a252 prerelease

Updated Audio examples for audioOutChannels etc.
author Robert Jack <robert.h.jack@gmail.com>
date Fri, 24 Jun 2016 13:32:07 +0100
parents 1cec96845a23
children
comparison
equal deleted inserted replaced
543:8f8809c77dda 544:cdabbaf3a252
61 61
62 62
63 bool setup(BelaContext *context, void *userData) 63 bool setup(BelaContext *context, void *userData)
64 { 64 {
65 65
66 // Check that we have the same number of inputs and outputs.
67 if(context->audioInChannels != context->audioOutChannels ||
68 context->analogInChannels != context-> analogOutChannels){
69 printf("Error: for this project, you need the same number of input and output channels.\n");
70 return false;
71 }
72
66 // Retrieve a parameter passed in from the initAudio() call 73 // Retrieve a parameter passed in from the initAudio() call
67 gSampleData = *(SampleData *)userData; 74 gSampleData = *(SampleData *)userData;
68 75
69 gReadPtr = -1; 76 gReadPtr = -1;
70 77
95 gLastX[1] = gLastX[0]; 102 gLastX[1] = gLastX[0];
96 gLastX[0] = out; 103 gLastX[0] = out;
97 gLastY[1] = gLastY[0]; 104 gLastY[1] = gLastY[0];
98 gLastY[0] = out; 105 gLastY[0] = out;
99 106
100 for(unsigned int channel = 0; channel < context->audioChannels; channel++) 107 for(unsigned int channel = 0; channel < context->audioOutChannels; channel++)
101 context->audioOut[n * context->audioChannels + channel] = out; // ...and put it in both left and right channel 108 context->audioOut[n * context->audioOutChannels + channel] = out; // ...and put it in both left and right channel
102 109
103 } 110 }
104 111
105 // Request that the lower-priority tasks run at next opportunity 112 // Request that the lower-priority tasks run at next opportunity
106 Bela_scheduleAuxiliaryTask(gChangeCoeffTask); 113 Bela_scheduleAuxiliaryTask(gChangeCoeffTask);