Mercurial > hg > beaglert
comparison examples/stepper/render.cpp @ 301:e4392164b458 prerelease
RENAMED BeagleRT to Bela AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, scripts probably not working
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Fri, 27 May 2016 14:34:41 +0100 |
parents | dbeed520b014 |
children | 1feb9c23ac57 |
comparison
equal
deleted
inserted
replaced
300:dbeed520b014 | 301:e4392164b458 |
---|---|
4 * Created on: Oct 24, 2014 | 4 * Created on: Oct 24, 2014 |
5 * Author: parallels | 5 * Author: parallels |
6 */ | 6 */ |
7 | 7 |
8 | 8 |
9 #include <BeagleRT.h> | 9 #include <Bela.h> |
10 #include <Utilities.h> | 10 #include <Utilities.h> |
11 | 11 |
12 const int kStepLengthSlow = 1000; | 12 const int kStepLengthSlow = 1000; |
13 const int kStepLengthFast = 500; | 13 const int kStepLengthFast = 500; |
14 | 14 |
47 // userData holds an opaque pointer to a data structure that was passed | 47 // userData holds an opaque pointer to a data structure that was passed |
48 // in from the call to initAudio(). | 48 // in from the call to initAudio(). |
49 // | 49 // |
50 // Return true on success; returning false halts the program. | 50 // Return true on success; returning false halts the program. |
51 | 51 |
52 bool setup(BeagleRTContext *context, void *userData) | 52 bool setup(BelaContext *context, void *userData) |
53 { | 53 { |
54 // This project makes the assumption that the audio and digital | 54 // This project makes the assumption that the audio and digital |
55 // sample rates are the same. But check it to be sure! | 55 // sample rates are the same. But check it to be sure! |
56 if(context->audioFrames != context->digitalFrames) { | 56 if(context->audioFrames != context->digitalFrames) { |
57 rt_printf("Error: this project needs the audio and digital sample rates to be the same.\n"); | 57 rt_printf("Error: this project needs the audio and digital sample rates to be the same.\n"); |
70 // render() is called regularly at the highest priority by the audio engine. | 70 // render() is called regularly at the highest priority by the audio engine. |
71 // Input and output are given from the audio hardware and the other | 71 // Input and output are given from the audio hardware and the other |
72 // ADCs and DACs (if available). If only audio is available, numMatrixFrames | 72 // ADCs and DACs (if available). If only audio is available, numMatrixFrames |
73 // will be 0. | 73 // will be 0. |
74 | 74 |
75 void render(BeagleRTContext *context, void *userData) | 75 void render(BelaContext *context, void *userData) |
76 { | 76 { |
77 for(unsigned int n = 0; n < context->audioFrames; n++) { | 77 for(unsigned int n = 0; n < context->audioFrames; n++) { |
78 if(gPhase == 0 || gPhase == 1) { | 78 if(gPhase == 0 || gPhase == 1) { |
79 digitalWriteFrameOnce(context, n, gPinB1, HIGH); | 79 digitalWriteFrameOnce(context, n, gPinB1, HIGH); |
80 digitalWriteFrameOnce(context, n, gPinB2, LOW); | 80 digitalWriteFrameOnce(context, n, gPinB2, LOW); |
143 } | 143 } |
144 | 144 |
145 // cleanup() is called once at the end, after the audio has stopped. | 145 // cleanup() is called once at the end, after the audio has stopped. |
146 // Release any resources that were allocated in setup(). | 146 // Release any resources that were allocated in setup(). |
147 | 147 |
148 void cleanup(BeagleRTContext *context, void *userData) | 148 void cleanup(BelaContext *context, void *userData) |
149 { | 149 { |
150 | 150 |
151 } | 151 } |