diff projects/basic/render.cpp @ 56:3c3a1357657d newapi

Further API update to name three primary functions setup(), render() and cleanup(). Changed include paths so now can #include <BeagleRT.h>. Removed stale pru_rtaudio.bin file as this is now done as pru_rtaudio_bin.h. Updated examples to new API and fixed minor compiler warnings along the way. Network example needs further attention to compile.
author andrewm
date Wed, 15 Jul 2015 12:10:51 +0100
parents 579c86316008
children 07cfd337ad18
line wrap: on
line diff
--- a/projects/basic/render.cpp	Mon Jun 15 18:16:00 2015 +0100
+++ b/projects/basic/render.cpp	Wed Jul 15 12:10:51 2015 +0100
@@ -6,14 +6,14 @@
  */
 
 
-#include "../../include/BeagleRT.h"
+#include <BeagleRT.h>
 #include <cmath>
 
-float gFrequency;
+float gFrequency = 440.0;
 float gPhase;
 float gInverseSampleRate;
 
-// initialise_render() is called once before the audio rendering starts.
+// setup() is called once before the audio rendering starts.
 // Use it to perform any initialisation and allocation which is dependent
 // on the period size or sample rate.
 //
@@ -22,10 +22,11 @@
 //
 // Return true on success; returning false halts the program.
 
-bool initialise_render(BeagleRTContext *context, void *userData)
+bool setup(BeagleRTContext *context, void *userData)
 {
 	// Retrieve a parameter passed in from the initAudio() call
-	gFrequency = *(float *)userData;
+	if(userData != 0)
+		gFrequency = *(float *)userData;
 
 	gInverseSampleRate = 1.0 / context->audioSampleRate;
 	gPhase = 0.0;
@@ -51,10 +52,10 @@
 	}
 }
 
-// cleanup_render() is called once at the end, after the audio has stopped.
-// Release any resources that were allocated in initialise_render().
+// cleanup() is called once at the end, after the audio has stopped.
+// Release any resources that were allocated in setup().
 
-void cleanup_render(BeagleRTContext *context, void *userData)
+void cleanup(BeagleRTContext *context, void *userData)
 {
 
 }