|
esp32-audio-player 0.1.0
Audio player engine for ESP32
|
Audio formats and PCM conventions. More...
#include "audio_player/base.h"

Go to the source code of this file.
Data Structures | |
| struct | audio_format_t |
Macros | |
| #define | AUDIO_MAX_CHANNELS 2 |
Enumerations | |
| enum | rate_family_t { RATE_FAMILY_44K1 = 0 , RATE_FAMILY_48K = 1 , RATE_FAMILY_OTHER = 2 } |
| 44.1 kHz family (44100, 88200, 176400, 352800) or 48 kHz family (32000, 48000, 96000, 192000...). More... | |
Functions | |
| static bool | audio_format_equal (const audio_format_t *a, const audio_format_t *b) |
| rate_family_t | audio_rate_family (uint32_t sample_rate) |
| static int32_t | audio_s16_to_q31 (int16_t v) |
| static int32_t | audio_s24_to_q31 (int32_t v24) |
| static int16_t | audio_q31_to_s16_trunc (int32_t v) |
| uint64_t | audio_ms_to_frames (uint32_t ms, uint32_t sample_rate) |
| uint32_t | audio_frames_to_ms (uint64_t frames, uint32_t sample_rate) |
Audio formats and PCM conventions.
PCM inside the pipeline is ALWAYS interleaved int32_t, left-justified (Q31): a 16-bit sample 0x1234 becomes 0x12340000, a 24-bit sample 0x123456 becomes 0x12345600. Full scale is INT32_MIN..INT32_MAX. This keeps 16/24/32-bit sources bit-exact when DSP is bypassed: the sink takes the top bits it needs.
DSD is carried as DoP (DSD over PCM, 176.4 kHz for DSD64, 24-bit payload in the top 24 bits with 0x05/0xFA markers). DoP frames must never pass through DSP or volume; audio_format_t.dop marks them.
| #define AUDIO_MAX_CHANNELS 2 |
| enum rate_family_t |
|
inlinestatic |
| uint32_t audio_frames_to_ms | ( | uint64_t | frames, |
| uint32_t | sample_rate | ||
| ) |
| uint64_t audio_ms_to_frames | ( | uint32_t | ms, |
| uint32_t | sample_rate | ||
| ) |
|
inlinestatic |
| rate_family_t audio_rate_family | ( | uint32_t | sample_rate | ) |
|
inlinestatic |
|
inlinestatic |