comparison examples/basic_writeFile/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 float gPhase1, gPhase2; 5 float gPhase1, gPhase2;
6 float gFrequency1, gFrequency2; 6 float gFrequency1, gFrequency2;
7 float gInverseSampleRate; 7 float gInverseSampleRate;
8 8
9 WriteFile file1; 9 WriteFile file1;
10 WriteFile file2; 10 WriteFile file2;
11 11
12 bool setup(BeagleRTContext *context, void *userData) 12 bool setup(BelaContext *context, void *userData)
13 { 13 {
14 gInverseSampleRate = 1.0/context->audioSampleRate; 14 gInverseSampleRate = 1.0/context->audioSampleRate;
15 file1.init("out1.m"); //set the file name to write to 15 file1.init("out1.m"); //set the file name to write to
16 file1.setHeader("myvar=[\n"); //set a line to be printed at the beginning of the file 16 file1.setHeader("myvar=[\n"); //set a line to be printed at the beginning of the file
17 file1.setFooter("];\n"); //set a line to be printed at the end of the file 17 file1.setFooter("];\n"); //set a line to be printed at the end of the file
28 gFrequency1 = 200.0; 28 gFrequency1 = 200.0;
29 gFrequency2 = 201.0; 29 gFrequency2 = 201.0;
30 return true; 30 return true;
31 } 31 }
32 32
33 void render(BeagleRTContext *context, void *userData) 33 void render(BelaContext *context, void *userData)
34 { 34 {
35 static int count = 0; 35 static int count = 0;
36 if((count&16383) == 0){ 36 if((count&16383) == 0){
37 file2.log(context->audioIn, context->audioFrames); //write the input buffer every so often 37 file2.log(context->audioIn, context->audioFrames); //write the input buffer every so often
38 } 38 }
55 } 55 }
56 56
57 // cleanup_render() is called once at the end, after the audio has stopped. 57 // cleanup_render() is called once at the end, after the audio has stopped.
58 // Release any resources that were allocated in initialise_render(). 58 // Release any resources that were allocated in initialise_render().
59 59
60 void cleanup(BeagleRTContext *context, void *userData) 60 void cleanup(BelaContext *context, void *userData)
61 { 61 {
62 62
63 } 63 }