andrewm@0
|
1 /*
|
andrewm@0
|
2 * RTAudio.h
|
andrewm@0
|
3 *
|
andrewm@0
|
4 * Central control code for hard real-time audio on BeagleBone Black
|
andrewm@0
|
5 * using PRU and Xenomai Linux extensions. This code began as part
|
andrewm@0
|
6 * of the Hackable Instruments project (EPSRC) at Queen Mary University
|
andrewm@0
|
7 * of London, 2013-14.
|
andrewm@0
|
8 *
|
andrewm@0
|
9 * (c) 2014 Victor Zappi and Andrew McPherson
|
andrewm@0
|
10 * Queen Mary University of London
|
andrewm@0
|
11 */
|
andrewm@0
|
12
|
andrewm@0
|
13
|
andrewm@0
|
14 #ifndef RTAUDIO_H_
|
andrewm@0
|
15 #define RTAUDIO_H_
|
andrewm@0
|
16
|
andrewm@0
|
17 #include "render.h"
|
andrewm@0
|
18
|
andrewm@0
|
19 // Useful constants
|
andrewm@0
|
20 #define DBOX_CAPE // New custom cape
|
andrewm@0
|
21
|
andrewm@0
|
22 #ifdef DBOX_CAPE
|
andrewm@0
|
23 #define CODEC_I2C_ADDRESS 0x18 // Address of TLV320AIC3104 codec
|
andrewm@0
|
24 #else
|
andrewm@0
|
25 #define CODEC_I2C_ADDRESS 0x1B // Address of TLV320AIC3106 codec
|
andrewm@0
|
26 #endif
|
andrewm@0
|
27
|
andrewm@0
|
28 enum {
|
andrewm@0
|
29 kAmplifierMutePin = 61 // P8-26 controls amplifier mute
|
andrewm@0
|
30 };
|
andrewm@0
|
31
|
andrewm@0
|
32 typedef void* AuxiliaryTask; // Opaque data type to keep track of aux tasks
|
andrewm@0
|
33
|
andrewm@0
|
34 // Flag that indicates when the audio will stop; can be read or
|
andrewm@0
|
35 // set by other components which should end at the same time as the audio
|
andrewm@0
|
36 extern bool gShouldStop;
|
andrewm@0
|
37
|
andrewm@0
|
38 int initAudio(int periodSize, int useMatrix, void *userData,
|
andrewm@0
|
39 int codecI2CAddress = CODEC_I2C_ADDRESS, int ampMutePin = kAmplifierMutePin);
|
andrewm@0
|
40 int startAudio();
|
andrewm@0
|
41 void stopAudio();
|
andrewm@0
|
42 void cleanupAudio();
|
andrewm@0
|
43
|
andrewm@0
|
44 AuxiliaryTask createAuxiliaryTaskLoop(void (*functionToCall)(void), int priority, const char *name);
|
andrewm@0
|
45 void scheduleAuxiliaryTask(AuxiliaryTask task);
|
andrewm@0
|
46
|
andrewm@0
|
47 void setVerboseLevel(int level);
|
andrewm@0
|
48
|
andrewm@0
|
49 #endif /* RTAUDIO_H_ */
|