comparison include/Bela.h @ 314:611306d840b3 prerelease

Merge
author Giulio Moro <giuliomoro@yahoo.it>
date Fri, 27 May 2016 19:00:43 +0100
parents 00725dfc1b87
children 5c8f46fcd4d0
comparison
equal deleted inserted replaced
313:c770cdf3d8b2 314:611306d840b3
35 #include <GPIOcontrol.h> 35 #include <GPIOcontrol.h>
36 36
37 // Useful constants 37 // Useful constants
38 38
39 /** \cond PRIVATE */ 39 /** \cond PRIVATE */
40 #define DBOX_CAPE // New custom cape
41 #ifdef DBOX_CAPE
42 #define CODEC_I2C_ADDRESS 0x18 // Address of TLV320AIC3104 codec 40 #define CODEC_I2C_ADDRESS 0x18 // Address of TLV320AIC3104 codec
43 #else
44 #define CODEC_I2C_ADDRESS 0x1B // Address of TLV320AIC3106 codec
45 #endif
46 41
47 #define MAX_PRU_FILENAME_LENGTH 256 42 #define MAX_PRU_FILENAME_LENGTH 256
48 #define MAX_SERVERNAME_LENGTH 256 43 #define MAX_SERVERNAME_LENGTH 256
49 /** \endcond */ 44 /** \endcond */
50 45
179 /// \brief Buffer holding audio input samples 174 /// \brief Buffer holding audio input samples
180 /// 175 ///
181 /// This buffer may be in either interleaved or non-interleaved format, 176 /// This buffer may be in either interleaved or non-interleaved format,
182 /// depending on the contents of the BelaInitSettings structure. 177 /// depending on the contents of the BelaInitSettings structure.
183 /// \b Note: this element is available in render() only. 178 /// \b Note: this element is available in render() only.
184 float *audioIn; 179 const float * const audioIn;
185 180
186 /// \brief Buffer holding audio output samples 181 /// \brief Buffer holding audio output samples
187 /// 182 ///
188 /// This buffer may be in either interleaved or non-interleaved format, 183 /// This buffer may be in either interleaved or non-interleaved format,
189 /// depending on the contents of the BelaInitSettings structure. 184 /// depending on the contents of the BelaInitSettings structure.
190 /// \b Note: this element is available in render() only. 185 /// \b Note: this element is available in render() only.
191 float *audioOut; 186 float * const audioOut;
192 187
193 /// \brief Buffer holding analog input samples 188 /// \brief Buffer holding analog input samples
194 /// 189 ///
195 /// This buffer may be in either interleaved or non-interleaved format, 190 /// This buffer may be in either interleaved or non-interleaved format,
196 /// depending on the contents of the BelaInitSettings structure. 191 /// depending on the contents of the BelaInitSettings structure.
197 /// \b Note: this element is available in render() only. 192 /// \b Note: this element is available in render() only.
198 float *analogIn; 193 const float * const analogIn;
199 194
200 /// \brief Buffer holding analog output samples 195 /// \brief Buffer holding analog output samples
201 /// 196 ///
202 /// This buffer may be in either interleaved or non-interleaved format, 197 /// This buffer may be in either interleaved or non-interleaved format,
203 /// depending on the contents of the BelaInitSettings structure. 198 /// depending on the contents of the BelaInitSettings structure.
204 /// \b Note: this element is available in render() only. 199 /// \b Note: this element is available in render() only.
205 float *analogOut; 200 float * const analogOut;
206 201
207 /// \brief Buffer holding digital input/output samples 202 /// \brief Buffer holding digital input/output samples
208 /// 203 ///
209 /// \b Note: this element is available in render() only. 204 /// \b Note: this element is available in render() only.
210 uint32_t *digital; 205 uint32_t * const digital;
211 206
212 /// Number of audio frames per period 207 /// Number of audio frames per period
213 uint32_t audioFrames; 208 const uint32_t audioFrames;
214 /// Number of audio channels (currently always 2) 209 /// Number of audio channels (currently always 2)
215 uint32_t audioChannels; 210 const uint32_t audioChannels;
216 /// Audio sample rate in Hz (currently always 44100.0) 211 /// Audio sample rate in Hz (currently always 44100.0)
217 float audioSampleRate; 212 const float audioSampleRate;
218 213
219 /// \brief Number of analog frames per period 214 /// \brief Number of analog frames per period
220 /// 215 ///
221 /// This will be 0 if analog I/O is disabled. 216 /// This will be 0 if analog I/O is disabled.
222 uint32_t analogFrames; 217 const uint32_t analogFrames;
223 218
224 /// \brief Number of analog channels 219 /// \brief Number of analog channels
225 /// 220 ///
226 /// This could take a value of 8, 4 or 2. This will be 0 if analog I/O is disabled. 221 /// This could take a value of 8, 4 or 2. This will be 0 if analog I/O is disabled.
227 uint32_t analogChannels; 222 const uint32_t analogChannels;
228 223
229 /// \brief Analog sample rate in Hz 224 /// \brief Analog sample rate in Hz
230 /// 225 ///
231 /// The analog sample rate depends on the number of analog channels used. If 226 /// The analog sample rate depends on the number of analog channels used. If
232 /// 8 channels are used, the sample rate is 22050. If 4 channels are used, the sample 227 /// 8 channels are used, the sample rate is 22050. If 4 channels are used, the sample
233 /// rate is 44100. If 2 channels are used, the sample rate is 88200. If analog I/O 228 /// rate is 44100. If 2 channels are used, the sample rate is 88200. If analog I/O
234 /// is disabled, the sample rate is 0. 229 /// is disabled, the sample rate is 0.
235 float analogSampleRate; 230 const float analogSampleRate;
236 231
237 /// Number of digital frames per period 232 /// Number of digital frames per period
238 uint32_t digitalFrames; 233 const uint32_t digitalFrames;
239 /// \brief Number of digital channels 234 /// \brief Number of digital channels
240 /// 235 ///
241 /// Currently this will always be 16, unless digital I/O is disabled, in which case it will be 0. 236 /// Currently this will always be 16, unless digital I/O is disabled, in which case it will be 0.
242 uint32_t digitalChannels; 237 const uint32_t digitalChannels;
243 /// Digital sample rate in Hz (currently always 44100.0) 238 /// Digital sample rate in Hz (currently always 44100.0)
244 float digitalSampleRate; 239 const float digitalSampleRate;
245 240
246 /// \brief Number of elapsed audio samples since the start of rendering. 241 /// \brief Number of elapsed audio frames since the start of rendering.
247 /// 242 ///
248 /// This holds the total number of audio samples as of the beginning of the current period. To 243 /// This holds the total number of audio frames as of the beginning of the current period. To
249 /// find the current number of analog or digital samples elapsed, multiply by the ratio of the 244 /// find the current number of analog or digital frames elapsed, multiply by the ratio of the
250 /// sample rates (e.g. half the number of analog samples will have elapsed if the analog sample 245 /// sample rates (e.g. half the number of analog frames will have elapsed if the analog sample
251 /// rate is 22050). 246 /// rate is 22050).
252 uint64_t audioSampleCount; 247 const uint64_t audioFramesElapsed;
253 248
254 /// \brief Other audio/sensor settings 249 /// \brief Other audio/sensor settings
255 /// 250 ///
256 /// Binary combination of flags including: 251 /// Binary combination of flags including:
257 /// 252 ///
258 /// BELA_FLAG_INTERLEAVED: indicates the audio and analog buffers are interleaved 253 /// BELA_FLAG_INTERLEAVED: indicates the audio and analog buffers are interleaved
259 /// 254 ///
260 /// BELA_FLAG_ANALOG_OUTPUTS_PERSIST: indicates that writes to the analog outputs will 255 /// BELA_FLAG_ANALOG_OUTPUTS_PERSIST: indicates that writes to the analog outputs will
261 /// persist for future frames. If not set, writes affect one frame only. 256 /// persist for future frames. If not set, writes affect one frame only.
262 uint32_t flags; 257 const uint32_t flags;
263 } BelaContext; 258 } BelaContext;
264 259
265 /** \ingroup auxtask 260 /** \ingroup auxtask
266 * 261 *
267 * Auxiliary task variable. Auxiliary tasks are created using createAuxiliaryTask() and 262 * Auxiliary task variable. Auxiliary tasks are created using createAuxiliaryTask() and