Skip to content

Commit 98e9cc7

Browse files
committed
Started documentation of MOZZI_BUFFER_SIZE
1 parent fe17896 commit 98e9cc7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

config/mozzi_config_documentation.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,23 @@
249249
* */
250250
#define MOZZI_AUDIO_PIN_1 FOR_DOXYGEN_ONLY
251251

252+
/** @ingroup config
253+
* @def MOZZI_BUFFER_SIZE
254+
*
255+
* @brief Audio buffer setting.
256+
*
257+
* For a lot of outputting modes, Mozzi is buffering the audio samples in order to be able to coop with varying loads on the processor.
258+
* The bigger the buffer, the more able Mozzi will be to coop with big change of processor loads as the buffered values can compensate for that.
259+
* At the same time, a bigger buffer produces a bigger latency as the time between when Mozzi produces the sample and the time it is actually outputted increases. For instance, for a long time Mozzi's buffer size was of a fixed size of 256. This produces a potential latency of 15.6 ms for a MOZZI_AUDIO_RATE of 16384, and half this value for a MOZZI_AUDIO_RATE of 32768.
260+
* Depending on the application, this is usually not a problem but can lead to synchronisation issues in some cases (for instance when working with clocks).
261+
* MOZZI_BUFFER_SIZE can be reduced to smaller values with this config, leading to more accurate timings but potentially to glitches if the buffer runs low.
262+
* Valid values are power of two from 256 downward (128, 64, …).
263+
* Note that this might not have an effect in all modes/platforms combination as Mozzi is sometimes using an external buffer which is not always configurable.
264+
*
265+
* TODO: Throw a warning if config does not have an effect
266+
*/
267+
#define MOZZI_BUFFER_SIZE FOR_DOXYGEN_ONLY
268+
252269

253270
/***************************************** ADVANCED SETTTINGS -- External audio output ******************************************
254271
*

0 commit comments

Comments
 (0)