Mercurial > hg > beaglert
comparison examples/7segment/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 #define NUM_PINS 12 | 12 #define NUM_PINS 12 |
13 | 13 |
14 // Breadboard wiring layout: | 14 // Breadboard wiring layout: |
46 // userData holds an opaque pointer to a data structure that was passed | 46 // userData holds an opaque pointer to a data structure that was passed |
47 // in from the call to initAudio(). | 47 // in from the call to initAudio(). |
48 // | 48 // |
49 // Return true on success; returning false halts the program. | 49 // Return true on success; returning false halts the program. |
50 | 50 |
51 bool setup(BeagleRTContext *context, void *userData) | 51 bool setup(BelaContext *context, void *userData) |
52 { | 52 { |
53 // This project makes the assumption that the audio and digital | 53 // This project makes the assumption that the audio and digital |
54 // sample rates are the same. But check it to be sure! | 54 // sample rates are the same. But check it to be sure! |
55 if(context->audioFrames != context->digitalFrames) { | 55 if(context->audioFrames != context->digitalFrames) { |
56 rt_printf("Error: this project needs the audio and digital sample rates to be the same.\n"); | 56 rt_printf("Error: this project needs the audio and digital sample rates to be the same.\n"); |
67 // render() is called regularly at the highest priority by the audio engine. | 67 // render() is called regularly at the highest priority by the audio engine. |
68 // Input and output are given from the audio hardware and the other | 68 // Input and output are given from the audio hardware and the other |
69 // ADCs and DACs (if available). If only audio is available, numMatrixFrames | 69 // ADCs and DACs (if available). If only audio is available, numMatrixFrames |
70 // will be 0. | 70 // will be 0. |
71 | 71 |
72 void render(BeagleRTContext *context, void *userData) | 72 void render(BelaContext *context, void *userData) |
73 { | 73 { |
74 for(unsigned int n = 0; n < context->audioFrames; n++) { | 74 for(unsigned int n = 0; n < context->audioFrames; n++) { |
75 // Check for rotation between digits | 75 // Check for rotation between digits |
76 if(--gDigitDisplayTime <= 0) { | 76 if(--gDigitDisplayTime <= 0) { |
77 gCurrentlyDisplayingDigit = (gCurrentlyDisplayingDigit + 1) % 4; | 77 gCurrentlyDisplayingDigit = (gCurrentlyDisplayingDigit + 1) % 4; |
119 } | 119 } |
120 | 120 |
121 // cleanup() is called once at the end, after the audio has stopped. | 121 // cleanup() is called once at the end, after the audio has stopped. |
122 // Release any resources that were allocated in setup(). | 122 // Release any resources that were allocated in setup(). |
123 | 123 |
124 void cleanup(BeagleRTContext *context, void *userData) | 124 void cleanup(BelaContext *context, void *userData) |
125 { | 125 { |
126 | 126 |
127 } | 127 } |