andrewm@0: /* andrewm@0: * RTAudio.h andrewm@0: * andrewm@0: * Central control code for hard real-time audio on BeagleBone Black andrewm@0: * using PRU and Xenomai Linux extensions. This code began as part andrewm@0: * of the Hackable Instruments project (EPSRC) at Queen Mary University andrewm@0: * of London, 2013-14. andrewm@0: * andrewm@0: * (c) 2014 Victor Zappi and Andrew McPherson andrewm@0: * Queen Mary University of London andrewm@0: */ andrewm@0: andrewm@0: andrewm@0: #ifndef RTAUDIO_H_ andrewm@0: #define RTAUDIO_H_ andrewm@0: andrewm@0: #include "render.h" andrewm@0: andrewm@0: // Useful constants andrewm@0: #define DBOX_CAPE // New custom cape andrewm@0: andrewm@0: #ifdef DBOX_CAPE andrewm@0: #define CODEC_I2C_ADDRESS 0x18 // Address of TLV320AIC3104 codec andrewm@0: #else andrewm@0: #define CODEC_I2C_ADDRESS 0x1B // Address of TLV320AIC3106 codec andrewm@0: #endif andrewm@0: andrewm@0: enum { andrewm@0: kAmplifierMutePin = 61 // P8-26 controls amplifier mute andrewm@0: }; andrewm@0: andrewm@0: typedef void* AuxiliaryTask; // Opaque data type to keep track of aux tasks andrewm@0: andrewm@0: // Flag that indicates when the audio will stop; can be read or andrewm@0: // set by other components which should end at the same time as the audio andrewm@0: extern bool gShouldStop; andrewm@0: andrewm@0: int initAudio(int periodSize, int useMatrix, void *userData, andrewm@0: int codecI2CAddress = CODEC_I2C_ADDRESS, int ampMutePin = kAmplifierMutePin); andrewm@0: int startAudio(); andrewm@0: void stopAudio(); andrewm@0: void cleanupAudio(); andrewm@0: andrewm@0: AuxiliaryTask createAuxiliaryTaskLoop(void (*functionToCall)(void), int priority, const char *name); andrewm@0: void scheduleAuxiliaryTask(AuxiliaryTask task); andrewm@0: andrewm@0: void setVerboseLevel(int level); andrewm@0: andrewm@0: #endif /* RTAUDIO_H_ */