File syn_audio.h¶
FileList > audio > syn_audio.h
Go to the source code of this file
Codec-Agnostic PCM Double-Buffered Audio Playback Engine. More...
#include "../common/syn_defs.h"#include <stdbool.h>#include <stddef.h>#include <stdint.h>
Classes¶
| Type | Name |
|---|---|
| struct | SYN_Audio Audio Playback Engine Instance State. |
| struct | SYN_Audio_Config Audio Playback Configuration. |
Public Types¶
| Type | Name |
|---|---|
| typedef void(* | SYN_Audio_OutputFn Hardware output callback function signature. |
Public Functions¶
| Type | Name |
|---|---|
| size_t | syn_audio_feed (SYN_Audio * audio, const int16_t * samples, size_t count) Feed decoded PCM audio samples into the stream buffer. |
| SYN_Status | syn_audio_init (SYN_Audio * audio, const SYN_Audio_Config * cfg) Initialize an Audio Streaming Engine instance. |
| void | syn_audio_isr_complete (SYN_Audio * audio) Hardware ISR Handler for DMA Transfer-Complete Interrupt. |
| void | syn_audio_isr_half (SYN_Audio * audio) Hardware ISR Handler for DMA Half-Transfer Interrupt. |
| SYN_Status | syn_audio_start (SYN_Audio * audio) Start audio playback streaming. |
| SYN_Status | syn_audio_stop (SYN_Audio * audio) Stop audio playback streaming. |
Detailed Description¶
Provides a zero-malloc, hardware-decoupled PCM streaming engine designed to feed audio samples to microcontroller DMA, I2S, SAI, or DAC peripherals.
Uses double-buffering (ping-pong halves) to allow uninterrupted audio decoding while the hardware transfers the alternate half-buffer to the DAC via DMA.
Public Types Documentation¶
typedef SYN_Audio_OutputFn¶
Hardware output callback function signature.
Called when a buffer half is ready to be submitted to DMA or DAC hardware.
Parameters:
samplesPointer to PCM sample array (16-bit linear PCM).countNumber of samples in the array.ctxUser context pointer.
Public Functions Documentation¶
function syn_audio_feed¶
Feed decoded PCM audio samples into the stream buffer.
Parameters:
audioPointer to Audio instance.samplesInput 16-bit PCM sample array.countNumber of samples to push.
Returns:
Number of samples actually written to the buffer.
function syn_audio_init¶
Initialize an Audio Streaming Engine instance.
Parameters:
audioPointer to Audio instance.cfgConfiguration structure pointer.
Returns:
SYN_OK on success, or SYN_INVALID_PARAM.
function syn_audio_isr_complete¶
Hardware ISR Handler for DMA Transfer-Complete Interrupt.
Call this function from your hardware DMA interrupt when the entire circular buffer transfer completes (SYN_DMA_EVENT_COMPLETE).
Parameters:
audioPointer to Audio instance.
function syn_audio_isr_half¶
Hardware ISR Handler for DMA Half-Transfer Interrupt.
Call this function from your hardware DMA interrupt when half of the circular buffer transfer completes (SYN_DMA_EVENT_HALF_COMPLETE).
Parameters:
audioPointer to Audio instance.
function syn_audio_start¶
Start audio playback streaming.
Parameters:
audioPointer to Audio instance.
Returns:
SYN_OK on success, or SYN_INVALID_PARAM.
function syn_audio_stop¶
Stop audio playback streaming.
Parameters:
audioPointer to Audio instance.
Returns:
SYN_OK on success, or SYN_INVALID_PARAM.
The documentation for this class was generated from the following file src/syntropic/audio/syn_audio.h