comparison examples/loggingSensors/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
comparison
equal deleted inserted replaced
300:dbeed520b014 301:e4392164b458
1 #include <BeagleRT.h> 1 #include <Bela.h>
2 #include <cmath> 2 #include <cmath>
3 #include <WriteFile.h> 3 #include <WriteFile.h>
4 4
5 WriteFile file1; 5 WriteFile file1;
6 WriteFile file2; 6 WriteFile file2;
7 7
8 bool setup(BeagleRTContext *context, void *userData) 8 bool setup(BelaContext *context, void *userData)
9 { 9 {
10 file1.init("out.bin"); //set the file name to write to 10 file1.init("out.bin"); //set the file name to write to
11 file1.setEchoInterval(1000); 11 file1.setEchoInterval(1000);
12 file1.setFileType(kBinary); 12 file1.setFileType(kBinary);
13 file1.setFormat("%.4f %.4f\n"); // set the format that you want to use for your output. Please use %f only (with modifiers). When in binary mode, this is used only for echoing to console 13 file1.setFormat("%.4f %.4f\n"); // set the format that you want to use for your output. Please use %f only (with modifiers). When in binary mode, this is used only for echoing to console
18 file2.setFileType(kText); 18 file2.setFileType(kText);
19 file2.setEchoInterval(10000); // only print to the console 1 line every other 10000 19 file2.setEchoInterval(10000); // only print to the console 1 line every other 10000
20 return true; 20 return true;
21 } 21 }
22 22
23 void render(BeagleRTContext *context, void *userData) 23 void render(BelaContext *context, void *userData)
24 { 24 {
25 for(unsigned int n = 0; n < context->analogFrames; n++) { 25 for(unsigned int n = 0; n < context->analogFrames; n++) {
26 file1.log(&(context->analogIn[n*context->analogFrames]), 2); // log an array of values 26 file1.log(&(context->analogIn[n*context->analogFrames]), 2); // log an array of values
27 file2.log(context->analogIn[n*context->analogFrames]); // log a single value 27 file2.log(context->analogIn[n*context->analogFrames]); // log a single value
28 } 28 }
29 } 29 }
30 30
31 // cleanup_render() is called once at the end, after the audio has stopped. 31 // cleanup_render() is called once at the end, after the audio has stopped.
32 // Release any resources that were allocated in initialise_render(). 32 // Release any resources that were allocated in initialise_render().
33 33
34 void cleanup(BeagleRTContext *context, void *userData) 34 void cleanup(BelaContext *context, void *userData)
35 { 35 {
36 36
37 } 37 }