Class espos_audio::NullAudio¶
ClassList > espos_audio > NullAudio
#include <espos_audio/null_audio.h>
Inherits the following classes: espos_audio::AudioDriver
Public Functions¶
| Type | Name |
|---|---|
| virtual void | init () override |
| virtual void | play_pcm (const int16_t * samples, size_t frames) override Enqueue frames signed-16-bit mono samples for playback. |
| virtual bool | ready () override const True once init() brought the codec up successfully. |
| virtual uint32_t | sample_rate () override const Sample rate the driver expects play_pcm() buffers to be in. |
Public Functions inherited from espos_audio::AudioDriver¶
| Type | Name |
|---|---|
| virtual bool | begin_stream (uint32_t, uint8_t, uint8_t) Begin a stream at rate Hz /bits per sample /channels . |
| virtual bool | can_capture () const True if this board can capture (a mic is wired to the codec ADC and init brought it up). |
| virtual uint32_t | capture_rate () const Sample rate of record_pcm() buffers. |
| virtual void | end_stream () End the active stream: drain the codec so the last chunk doesn't loop on the DMA ring, then leave the codec open for the next stream/clip. |
| virtual void | init () = 0 |
| virtual float | mic_gain_db () const |
| virtual void | play_cue (const int16_t * samples, size_t frames) Like play_pcm() , but for a clip that must NOT be silently dropped: the wake cue is the user's only feedback that the panel heard them, and it fires exactly when the pipeline is taking the mic, so the disposable-clip policy (drop on a busy codec) loses precisely the one sound that matters. |
| virtual void | play_pcm (const int16_t * samples, size_t frames) = 0 Enqueue frames signed-16-bit mono samples for playback. |
| virtual bool | probe_mic_channels (MicLevels &) |
| virtual bool | ready () const = 0 True once init() brought the codec up successfully. |
| virtual size_t | record_pcm (int16_t *, size_t) Read up to max_frames signed-16-bit mono samples intoout , BLOCKING until that many are captured (or a codec error). |
| virtual size_t | record_pcm2 (int16_t *, size_t) Read up to max_frames 2-channel interleaved [MIC1,MIC2] int16 frames intoout (soout holds2 * max_frames samples), BLOCKING until that many frames are captured (or a codec error). |
| virtual uint32_t | sample_rate () const = 0 Sample rate the driver expects play_pcm() buffers to be in. |
| virtual void | set_enabled (bool) Mute / unmute without tearing down the codec. |
| virtual void | set_mic_gain_db (float) Analog mic preamp gain in dB, applied on the next capture open. |
| virtual void | set_volume (uint8_t) Output volume 0-100. Applied at the codec. Default no-op. |
| virtual void | start_capture () Start / stop the ADC capture path. |
| virtual void | start_capture2 () Open / close the 2-channel capture handle. |
| virtual void | stop_capture () |
| virtual void | stop_capture2 () |
| virtual bool | supports_dual_mic () const True if this board exposes a 2-channel [MIC1,MIC2] capture path (start_capture2/record_pcm2/stop_capture2). |
| virtual size_t | write_stream (const int16_t *, size_t) Write frames signed-16-bit mono samples into the active stream. |
| virtual | ~AudioDriver () = default |
Public Functions Documentation¶
function init¶
Implements espos_audio::AudioDriver::init
function play_pcm¶
Enqueue frames signed-16-bit mono samples for playback.
inline virtual void espos_audio::NullAudio::play_pcm (
const int16_t * samples,
size_t frames
) override
Copies the buffer and returns immediately; the samples play on the driver's audio task. Passing a null buffer or zero frames is a no-op. If the queue is full the buffer is dropped (a chime is disposable — never block the caller waiting for audio).
Implements espos_audio::AudioDriver::play_pcm
function ready¶
True once init() brought the codec up successfully.
False if the board has no audio or init failed (play_pcm then no-ops). Lets a status endpoint report audio health without racing the boot log.
Implements espos_audio::AudioDriver::ready
function sample_rate¶
Sample rate the driver expects play_pcm() buffers to be in.
Callers synthesise / resample to this. 16 kHz is plenty for alert tones and speech.
Implements espos_audio::AudioDriver::sample_rate
The documentation for this class was generated from the following file espos_audio/include/espos_audio/null_audio.h