#include <audio.h>
Definition at line 11 of file audio.h.
◆ AudioStreamInfo() [1/2]
esphome::audio::AudioStreamInfo::AudioStreamInfo |
( |
| ) |
|
|
inline |
◆ AudioStreamInfo() [2/2]
esphome::audio::AudioStreamInfo::AudioStreamInfo |
( |
uint8_t |
bits_per_sample, |
|
|
uint8_t |
channels, |
|
|
uint32_t |
sample_rate |
|
) |
| |
◆ bytes_to_frames()
uint32_t esphome::audio::AudioStreamInfo::bytes_to_frames |
( |
size_t |
bytes | ) |
const |
|
inline |
Convert bytes to frames.
- Parameters
-
bytes | Number of bytes to convert |
- Returns
- Audio frames that will store
bytes
bytes.
Definition at line 43 of file audio.h.
◆ bytes_to_ms()
uint32_t esphome::audio::AudioStreamInfo::bytes_to_ms |
( |
size_t |
bytes | ) |
const |
|
inline |
Convert bytes to duration in milliseconds.
- Parameters
-
bytes | Number of bytes to convert |
- Returns
- Duration in milliseconds that will store
bytes
bytes of audio. May round down for certain sample rates or values of bytes
.
Definition at line 36 of file audio.h.
◆ bytes_to_samples()
uint32_t esphome::audio::AudioStreamInfo::bytes_to_samples |
( |
size_t |
bytes | ) |
const |
|
inline |
Convert bytes to samples.
- Parameters
-
bytes | Number of bytes to convert |
- Returns
- Audio samples that will store
bytes
bytes.
Definition at line 48 of file audio.h.
◆ frames_to_bytes()
size_t esphome::audio::AudioStreamInfo::frames_to_bytes |
( |
uint32_t |
frames | ) |
const |
|
inline |
Converts frames to bytes.
- Parameters
-
frames | Number of frames to convert. |
- Returns
- Number of bytes that will store
frames
frames of audio.
Definition at line 53 of file audio.h.
◆ frames_to_microseconds()
uint32_t esphome::audio::AudioStreamInfo::frames_to_microseconds |
( |
uint32_t |
frames | ) |
const |
Computes the duration, in microseconds, the given amount of frames represents.
- Parameters
-
frames | Number of audio frames |
- Returns
- Duration in microseconds
frames
respresents. May be slightly inaccurate due to integer divison rounding for certain sample rates.
Definition at line 22 of file audio.cpp.
◆ frames_to_milliseconds_with_remainder()
uint32_t esphome::audio::AudioStreamInfo::frames_to_milliseconds_with_remainder |
( |
uint32_t * |
frames | ) |
const |
Computes the duration, in milliseconds, the given amount of frames represents.
Avoids accumulating rounding errors by updating frames
with the remainder after converting.
- Parameters
-
frames | Pointer to uint32_t with the number of audio frames. Replaced with the remainder. |
- Returns
- Duration in milliseconds
frames
represents. Always less than or equal to the actual value due to rounding.
Definition at line 26 of file audio.cpp.
◆ get_bits_per_sample()
uint8_t esphome::audio::AudioStreamInfo::get_bits_per_sample |
( |
| ) |
const |
|
inline |
◆ get_channels()
uint8_t esphome::audio::AudioStreamInfo::get_channels |
( |
| ) |
const |
|
inline |
◆ get_sample_rate()
uint32_t esphome::audio::AudioStreamInfo::get_sample_rate |
( |
| ) |
const |
|
inline |
◆ ms_to_bytes()
size_t esphome::audio::AudioStreamInfo::ms_to_bytes |
( |
uint32_t |
ms | ) |
const |
|
inline |
Converts duration to bytes.
May round down for certain sample rates.
- Parameters
-
ms | Duration in milliseconds |
- Returns
- Bytes that will store
ms
milliseconds of audio. May round down for certain sample rates.
Definition at line 73 of file audio.h.
◆ ms_to_frames()
uint32_t esphome::audio::AudioStreamInfo::ms_to_frames |
( |
uint32_t |
ms | ) |
const |
|
inline |
Converts duration to frames.
- Parameters
-
ms | Duration in milliseconds |
- Returns
- Audio frames that will store
ms
milliseconds of audio. May round down for certain sample rates.
Definition at line 63 of file audio.h.
◆ ms_to_samples()
uint32_t esphome::audio::AudioStreamInfo::ms_to_samples |
( |
uint32_t |
ms | ) |
const |
|
inline |
Converts duration to samples.
- Parameters
-
ms | Duration in milliseconds |
- Returns
- Audio samples that will store
ms
milliseconds of audio. May round down for certain sample rates.
Definition at line 68 of file audio.h.
◆ operator!=()
bool esphome::audio::AudioStreamInfo::operator!= |
( |
const AudioStreamInfo & |
rhs | ) |
const |
|
inline |
◆ operator==()
bool esphome::audio::AudioStreamInfo::operator== |
( |
const AudioStreamInfo & |
rhs | ) |
const |
◆ samples_to_bytes()
size_t esphome::audio::AudioStreamInfo::samples_to_bytes |
( |
uint32_t |
samples | ) |
const |
|
inline |
Converts samples to bytes.
- Parameters
-
samples | Number of samples to convert. |
- Returns
- Number of bytes that will store
samples
samples of audio.
Definition at line 58 of file audio.h.
◆ bits_per_sample_
uint8_t esphome::audio::AudioStreamInfo::bits_per_sample_ |
|
protected |
◆ bytes_per_sample_
size_t esphome::audio::AudioStreamInfo::bytes_per_sample_ |
|
protected |
◆ channels_
uint8_t esphome::audio::AudioStreamInfo::channels_ |
|
protected |
◆ ms_sample_rate_gcd_
uint32_t esphome::audio::AudioStreamInfo::ms_sample_rate_gcd_ |
|
protected |
◆ sample_rate_
uint32_t esphome::audio::AudioStreamInfo::sample_rate_ |
|
protected |
The documentation for this class was generated from the following files:
- /opt/build/esphome/esphome/components/audio/audio.h
- /opt/build/esphome/esphome/components/audio/audio.cpp