comparison 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
comparison
equal deleted inserted replaced
178:a156a694864d 179:f1012082f142
67 67
68 #if 1 68 #if 1
69 // Note: pinMode(), analogWrite() and digitalWrite() should be able to be called from setup() 69 // Note: pinMode(), analogWrite() and digitalWrite() should be able to be called from setup()
70 // Likewise, thread launch should be able to be called from setup() 70 // Likewise, thread launch should be able to be called from setup()
71 // Also, make volume change functions callable from render() thread -- as an aux task? 71 // Also, make volume change functions callable from render() thread -- as an aux task?
72
73 /**
74 * \brief Read an audio input, specifying the frame number (when to read) and the channel.
75 *
76 * This function returns the value of an audio input, at the time indicated by \c frame.
77 * The returned value ranges from -1 to 1.
78 *
79 * \param context The I/O data structure which is passed by BeagleRT to render().
80 * \param frame Which frame (i.e. what time) to read the audio input. Valid values range
81 * from 0 to (context->audioFrames - 1).
82 * \param channel Which audio input to read. Valid values are between 0 and
83 * (context->audioChannels - 1), typically 0 to 1 by default.
84 * \return Value of the analog input, range to 1.
85 */
86 float audioReadFrame(BeagleRTContext *context, int frame, int channel);
87
88 /**
89 * \brief Write an audio output, specifying the frame number (when to write) and the channel.
90 *
91 * This function sets the value of an audio output, at the time indicated by \c frame. Valid
92 * values are between -1 and 1.
93 *
94 * \param context The I/O data structure which is passed by BeagleRT to render().
95 * \param frame Which frame (i.e. what time) to write the audio output. Valid values range
96 * from 0 to (context->audioFrames - 1).
97 * \param channel Which analog output to write. Valid values are between 0 and
98 * (context->audioChannels - 1), typically 0 to 1 by default.
99 * \param value Value to write to the output, range -1 to 1.
100 */
101 void audioWriteFrame(BeagleRTContext *context, int frame, int channel, float value);
72 102
73 /** 103 /**
74 * \brief Read an analog input, specifying the frame number (when to read) and the channel. 104 * \brief Read an analog input, specifying the frame number (when to read) and the channel.
75 * 105 *
76 * This function returns the value of an analog input, at the time indicated by \c frame. 106 * This function returns the value of an analog input, at the time indicated by \c frame.