Mercurial > hg > beaglert
diff examples/01-Basics/passthrough/render.cpp @ 543:8f8809c77dda prerelease
updated basics, digital, instruments, extras examples
author | chnrx <chris.heinrichs@gmail.com> |
---|---|
date | Fri, 24 Jun 2016 13:19:52 +0100 |
parents | bfcbeb437869 |
children |
line wrap: on
line diff
--- a/examples/01-Basics/passthrough/render.cpp Fri Jun 24 13:00:31 2016 +0100 +++ b/examples/01-Basics/passthrough/render.cpp Fri Jun 24 13:19:52 2016 +0100 @@ -25,7 +25,7 @@ bool setup(BelaContext *context, void *userData) { - // Nothing to do here... + // For this example we need the same amount of audio and analog input and output channels 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"); @@ -82,10 +82,10 @@ In `render()` you'll see a nested for loop structure. You'll see this in all Bela projects. The first for loop cycles through `audioFrames`, the second through -`audioChannels` (in this case left 0 and right 1). +`audioInChannels` (in this case left 0 and right 1). You can access any information about current audio and sensor settings you can do the following: -`context->name_of_item`. For example `context->audioChannels` returns current number of channels, +`context->name_of_item`. For example `context->audioInChannels` returns current number of input channels, `context->audioFrames` returns the current number of audio frames, `context->audioSampleRate` returns the audio sample rate. @@ -112,7 +112,7 @@ Note that for the analog channels we write to and read from the buffers in a separate set of nested for loops. This is because the they are sampled at half audio rate by default. The first of these for loops cycles through `analogFrames`, the second through -`analogChannels`. +`analogInChannels`. By setting `audioWriteFrame(context, n, ch, audioReadFrame(context, n, ch))` and `analogWrite(context, n, ch, analogReadFrame(context, n, ch))` we have a simple @@ -120,5 +120,5 @@ It is also possible to address the buffers directly, for example: -`context->audioOut[n * context->audioChannels + ch]`. +`context->audioOut[n * context->audioOutChannels + ch]`. */