Mercurial > hg > beaglert
diff examples/01-Basics/sinetone/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 | 1cec96845a23 |
children | db3e1a08cdee |
line wrap: on
line diff
--- a/examples/01-Basics/sinetone/render.cpp Fri Jun 24 13:00:31 2016 +0100 +++ b/examples/01-Basics/sinetone/render.cpp Fri Jun 24 13:19:52 2016 +0100 @@ -30,12 +30,8 @@ bool setup(BelaContext *context, void *userData) { - // Retrieve a parameter passed in from the initAudio() call - if(userData != 0) - gFrequency = *(float *)userData; - gInverseSampleRate = 1.0 / context->audioSampleRate; - gPhase = 0.0; + gPhase = 0.0;s return true; } @@ -48,11 +44,11 @@ if(gPhase > 2.0 * M_PI) gPhase -= 2.0 * M_PI; - for(unsigned int channel = 0; channel < context->audioChannels; channel++) { + for(unsigned int channel = 0; channel < context->audioOutChannels; channel++) { // Two equivalent ways to write this code // The long way, using the buffers directly: - // context->audioOut[n * context->audioChannels + channel] = out; + // context->audioOut[n * context->audioOutChannels + channel] = out; // Or using the macros: audioWrite(context, n, channel, out);