Mercurial > hg > beaglert
diff include/Utilities.h @ 179:f1012082f142
Added audioReadFrame() and audioWriteFrame(). Closes #1519
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Sat, 02 Jan 2016 13:50:36 +0100 |
parents | c529505203ee |
children | d7148d21aaa5 |
line wrap: on
line diff
--- a/include/Utilities.h Sat Jan 02 13:08:39 2016 +0100 +++ b/include/Utilities.h Sat Jan 02 13:50:36 2016 +0100 @@ -71,6 +71,36 @@ // Also, make volume change functions callable from render() thread -- as an aux task? /** + * \brief Read an audio input, specifying the frame number (when to read) and the channel. + * + * This function returns the value of an audio input, at the time indicated by \c frame. + * The returned value ranges from -1 to 1. + * + * \param context The I/O data structure which is passed by BeagleRT to render(). + * \param frame Which frame (i.e. what time) to read the audio input. Valid values range + * from 0 to (context->audioFrames - 1). + * \param channel Which audio input to read. Valid values are between 0 and + * (context->audioChannels - 1), typically 0 to 1 by default. + * \return Value of the analog input, range to 1. + */ +float audioReadFrame(BeagleRTContext *context, int frame, int channel); + +/** + * \brief Write an audio output, specifying the frame number (when to write) and the channel. + * + * This function sets the value of an audio output, at the time indicated by \c frame. Valid + * values are between -1 and 1. + * + * \param context The I/O data structure which is passed by BeagleRT to render(). + * \param frame Which frame (i.e. what time) to write the audio output. Valid values range + * from 0 to (context->audioFrames - 1). + * \param channel Which analog output to write. Valid values are between 0 and + * (context->audioChannels - 1), typically 0 to 1 by default. + * \param value Value to write to the output, range -1 to 1. + */ +void audioWriteFrame(BeagleRTContext *context, int frame, int channel, float value); + +/** * \brief Read an analog input, specifying the frame number (when to read) and the channel. * * This function returns the value of an analog input, at the time indicated by \c frame.