mirror of
https://github.com/esphome/esphome.git
synced 2025-10-29 06:04:01 +00:00
[speaker, i2s_audio] I2S Speaker implementation using a ring buffer (#7605)
This commit is contained in:
9
esphome/components/audio/__init__.py
Normal file
9
esphome/components/audio/__init__.py
Normal file
@@ -0,0 +1,9 @@
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
|
||||
CODEOWNERS = ["@kahrendt"]
|
||||
audio_ns = cg.esphome_ns.namespace("audio")
|
||||
|
||||
CONFIG_SCHEMA = cv.All(
|
||||
cv.Schema({}),
|
||||
)
|
||||
21
esphome/components/audio/audio.h
Normal file
21
esphome/components/audio/audio.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <stddef.h>
|
||||
|
||||
namespace esphome {
|
||||
namespace audio {
|
||||
|
||||
struct AudioStreamInfo {
|
||||
bool operator==(const AudioStreamInfo &rhs) const {
|
||||
return (channels == rhs.channels) && (bits_per_sample == rhs.bits_per_sample) && (sample_rate == rhs.sample_rate);
|
||||
}
|
||||
bool operator!=(const AudioStreamInfo &rhs) const { return !operator==(rhs); }
|
||||
size_t get_bytes_per_sample() const { return bits_per_sample / 8; }
|
||||
uint8_t channels = 1;
|
||||
uint8_t bits_per_sample = 16;
|
||||
uint32_t sample_rate = 16000;
|
||||
};
|
||||
|
||||
} // namespace audio
|
||||
} // namespace esphome
|
||||
Reference in New Issue
Block a user