giuliomoro@301: #include giuliomoro@157: #include giuliomoro@157: #include giuliomoro@157: giuliomoro@157: WriteFile file1; giuliomoro@157: WriteFile file2; giuliomoro@157: giuliomoro@301: bool setup(BelaContext *context, void *userData) giuliomoro@157: { giuliomoro@157: file1.init("out.bin"); //set the file name to write to giuliomoro@157: file1.setEchoInterval(1000); giuliomoro@157: file1.setFileType(kBinary); giuliomoro@157: 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 giuliomoro@157: file2.init("out.m"); //set the file name to write to giuliomoro@157: file2.setHeader("myvar=[\n"); //set one or more lines to be printed at the beginning of the file giuliomoro@157: file2.setFooter("];\n"); //set one or more lines to be printed at the end of the file giuliomoro@157: file2.setFormat("%.4f\n"); // set the format that you want to use for your output. Please use %f only (with modifiers) giuliomoro@157: file2.setFileType(kText); giuliomoro@157: file2.setEchoInterval(10000); // only print to the console 1 line every other 10000 giuliomoro@157: return true; giuliomoro@157: } giuliomoro@157: giuliomoro@301: void render(BelaContext *context, void *userData) giuliomoro@157: { giuliomoro@157: for(unsigned int n = 0; n < context->analogFrames; n++) { giuliomoro@157: file1.log(&(context->analogIn[n*context->analogFrames]), 2); // log an array of values giuliomoro@157: file2.log(context->analogIn[n*context->analogFrames]); // log a single value giuliomoro@157: } giuliomoro@157: } giuliomoro@157: giuliomoro@157: // cleanup_render() is called once at the end, after the audio has stopped. giuliomoro@157: // Release any resources that were allocated in initialise_render(). giuliomoro@157: giuliomoro@301: void cleanup(BelaContext *context, void *userData) giuliomoro@157: { giuliomoro@157: giuliomoro@157: }