Mercurial > hg > beaglert
diff examples/01-Basics/passthrough/render.cpp @ 537:bfcbeb437869 API-update
Updated RTAudioSettings with in/out, ported some examples and libpd
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Fri, 24 Jun 2016 01:36:07 +0100 |
parents | 5c8f46fcd4d0 |
children | 8f8809c77dda |
line wrap: on
line diff
--- a/examples/01-Basics/passthrough/render.cpp Thu Jun 23 18:17:35 2016 +0100 +++ b/examples/01-Basics/passthrough/render.cpp Fri Jun 24 01:36:07 2016 +0100 @@ -22,26 +22,24 @@ */ #include <Bela.h> -#include <Scope.h> - -Scope scope; bool setup(BelaContext *context, void *userData) { // Nothing to do here... - printf("%d %d\n", context->audioInChannels, context->audioOutChannels); - scope.setup(8, 44100); + 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; + } return true; } void render(BelaContext *context, void *userData) { - static const unsigned int audioChannels = min(context->audioInChannels, context->audioOutChannels); - static const unsigned int analogChannels = min(context->analogInChannels, context->analogOutChannels); // Simplest possible case: pass inputs through to outputs for(unsigned int n = 0; n < context->audioFrames; n++) { - for(unsigned int ch = 0; ch < audioChannels; ch++){ + for(unsigned int ch = 0; ch < context->audioInChannels; ch++){ // Two equivalent ways to write this code // The long way, using the buffers directly: @@ -55,7 +53,7 @@ // Same with analog channels for(unsigned int n = 0; n < context->analogFrames; n++) { - for(unsigned int ch = 0; ch < analogChannels; ch++) { + for(unsigned int ch = 0; ch < context->analogInChannels; ch++) { // Two equivalent ways to write this code // The long way, using the buffers directly: