diff include/Bela.h @ 307:ff5f346a293e prerelease

Changed BelaContext fields to be const where appropriate; there's now an InternalBelaContext used for setting the values within the core code. These need to stay aligned.
author andrewm
date Fri, 27 May 2016 18:12:15 +0100
parents 421a69d42943
children 493a07f6ec09
line wrap: on
line diff
--- a/include/Bela.h	Fri May 27 18:00:57 2016 +0100
+++ b/include/Bela.h	Fri May 27 18:12:15 2016 +0100
@@ -181,50 +181,50 @@
 	/// This buffer may be in either interleaved or non-interleaved format,
 	/// depending on the contents of the BelaInitSettings structure.
 	/// \b Note: this element is available in render() only.
-	float *audioIn;
+	const float * const audioIn;
 
 	/// \brief Buffer holding audio output samples
 	///
 	/// This buffer may be in either interleaved or non-interleaved format,
 	/// depending on the contents of the BelaInitSettings structure.
 	/// \b Note: this element is available in render() only.
-	float *audioOut;
+	float * const audioOut;
 
 	/// \brief Buffer holding analog input samples
 	///
 	/// This buffer may be in either interleaved or non-interleaved format,
 	/// depending on the contents of the BelaInitSettings structure.
 	/// \b Note: this element is available in render() only.
-	float *analogIn;
+	const float * const analogIn;
 
 	/// \brief Buffer holding analog output samples
 	///
 	/// This buffer may be in either interleaved or non-interleaved format,
 	/// depending on the contents of the BelaInitSettings structure.
 	/// \b Note: this element is available in render() only.
-	float *analogOut;
+	float * const analogOut;
 
 	/// \brief Buffer holding digital input/output samples
 	///
 	/// \b Note: this element is available in render() only.
-	uint32_t *digital;
+	uint32_t * const digital;
 
 	/// Number of audio frames per period
-	uint32_t audioFrames;
+	const uint32_t audioFrames;
 	/// Number of audio channels (currently always 2)
-	uint32_t audioChannels;
+	const uint32_t audioChannels;
 	/// Audio sample rate in Hz (currently always 44100.0)
-	float audioSampleRate;
+	const float audioSampleRate;
 
 	/// \brief Number of analog frames per period
 	///
 	/// This will be 0 if analog I/O is disabled.
-	uint32_t analogFrames;
+	const uint32_t analogFrames;
 
 	/// \brief Number of analog channels
 	///
 	/// This could take a value of 8, 4 or 2. This will be 0 if analog I/O is disabled.
-	uint32_t analogChannels;
+	const uint32_t analogChannels;
 
 	/// \brief Analog sample rate in Hz
 	///
@@ -232,16 +232,16 @@
 	/// 8 channels are used, the sample rate is 22050. If 4 channels are used, the sample
 	/// rate is 44100. If 2 channels are used, the sample rate is 88200. If analog I/O
 	/// is disabled, the sample rate is 0.
-	float analogSampleRate;
+	const float analogSampleRate;
 
 	/// Number of digital frames per period
-	uint32_t digitalFrames;
+	const uint32_t digitalFrames;
 	/// \brief Number of digital channels
 	///
 	/// Currently this will always be 16, unless digital I/O is disabled, in which case it will be 0.
-	uint32_t digitalChannels;
+	const uint32_t digitalChannels;
 	/// Digital sample rate in Hz (currently always 44100.0)
-	float digitalSampleRate;
+	const float digitalSampleRate;
 
 	/// \brief Number of elapsed audio samples since the start of rendering.
 	///
@@ -249,7 +249,7 @@
 	/// find the current number of analog or digital samples elapsed, multiply by the ratio of the
 	/// sample rates (e.g. half the number of analog samples will have elapsed if the analog sample
 	/// rate is 22050).
-	uint64_t audioSampleCount;
+	const uint64_t audioSampleCount;
 
 	/// \brief Other audio/sensor settings
 	///
@@ -259,7 +259,7 @@
 	///
 	/// BELA_FLAG_ANALOG_OUTPUTS_PERSIST: indicates that writes to the analog outputs will
 	/// persist for future frames. If not set, writes affect one frame only.
-	uint32_t flags;
+	const uint32_t flags;
 } BelaContext;
 
 /** \ingroup auxtask