arduino-audio-tools
Loading...
Searching...
No Matches
AudioESP32ULP Class Reference

Outputs to ESP32 DAC through the ULP (Ultra> Low Power coprocessor), freeing I2S for other uses. Connect left channel on pin 25 Connect right channel on pin 26. More...

#include <AudioESP32ULP.h>

Inheritance diagram for AudioESP32ULP:
AudioOutput Print AudioInfoSupport AudioInfoSource Print AudioInfoSupport AudioInfoSource

Public Member Functions

virtual void addNotifyAudioChange (AudioInfoSupport &bi)
 Adds target to be notified about audio changes.
virtual void addNotifyAudioChange (AudioInfoSupport &bi)
 Adds target to be notified about audio changes.
virtual AudioInfo audioInfo () override
 provides the actual input AudioInfo
virtual AudioInfo audioInfo () override
 provides the actual input AudioInfo
virtual AudioInfo audioInfoOut ()
virtual AudioInfo audioInfoOut ()
int availableForWrite ()
virtual bool begin ()
virtual bool begin (AudioInfo info)
bool begin (AudioInfo info)
 Starts the processing. I the output is mono, we can determine the output pin by selecting DAC1 (gpio25) or DAC2 (gpio26).
virtual void clearNotifyAudioChange ()
 Deletes all change notify subscriptions.
virtual void clearNotifyAudioChange ()
 Deletes all change notify subscriptions.
AudioInfo defaultConfig ()
void end ()
virtual void flush ()
virtual void flush ()
virtual bool isDeletable ()
 If true we need to release the related memory in the destructor.
virtual bool isDeletable ()
 If true we need to release the related memory in the destructor.
bool isNotifyActive ()
 Checks if the automatic AudioInfo update is active.
bool isNotifyActive ()
 Checks if the automatic AudioInfo update is active.
virtual operator bool ()
virtual operator bool ()
virtual bool removeNotifyAudioChange (AudioInfoSupport &bi)
 Removes a target in order not to be notified about audio changes.
virtual bool removeNotifyAudioChange (AudioInfoSupport &bi)
 Removes a target in order not to be notified about audio changes.
virtual void setAudioInfo (AudioInfo newInfo) override
 Defines the input AudioInfo.
virtual void setAudioInfo (AudioInfo newInfo) override
 Defines the input AudioInfo.
void setMinWriteBytes (int bytes)
 Selects the limit for the availableForWrite to report the data.
void setMonoDAC (UlpDac dac)
 Selects the DAC when we have a mono signal.
void setNotifyActive (bool flag)
 Deactivate/Reactivate automatic AudioInfo updates: (default is active).
void setNotifyActive (bool flag)
 Deactivate/Reactivate automatic AudioInfo updates: (default is active).
virtual size_t write (uint8_t ch) override
size_t write (const uint8_t *data, size_t len)
virtual void writeSilence (size_t len)
virtual void writeSilence (size_t len)

Protected Member Functions

uint32_t create_I_BXI (uint32_t imm_pc)
uint32_t create_I_WR_REG (uint32_t reg, uint32_t low_bit, uint32_t high_bit, uint32_t val)
void notifyAudioChange (AudioInfo info)
void notifyAudioChange (AudioInfo info)
bool setup ()
bool writeFrame (int16_t sample[2])

Protected Attributes

int _timeout = 10
int activeDACs = 3
uint8_t bufferedOddSample = 128
const uint32_t bufferStart = indexAddress + 1
AudioInfo cfg
const uint32_t dacTableStart1 = 2048 - 512
const uint32_t dacTableStart2 = dacTableStart1 - 512
int hertz
const uint32_t indexAddress = opcodeCount
bool is_active = false
bool is_notify_active = true
int lastFilledWord = 0
int min_write_bytes = 128
Vector< AudioInfoSupport * > notify_vector
const int opcodeCount = 20
UlpDac selected_mono_dac = ULP_DAC1
bool stereoOutput = true
SingleBuffer< uint8_t > tmp { 8 }
int tmpPos = 0
const int totalSamples = totalSampleWords * 2
uint32_t totalSampleWords
bool waitingOddSample = true

Detailed Description

Outputs to ESP32 DAC through the ULP (Ultra> Low Power coprocessor), freeing I2S for other uses. Connect left channel on pin 25 Connect right channel on pin 26.

Version
0.1
Date
2023-03-26
Note
Supported only on ESP32 platforms with ULP!

Member Function Documentation

◆ addNotifyAudioChange() [1/2]

virtual void addNotifyAudioChange ( AudioInfoSupport & bi)
inlinevirtualinherited

Adds target to be notified about audio changes.

Reimplemented in CodecNOP, CodecNOP, EncodedAudioOutput, and EncodedAudioStream.

◆ addNotifyAudioChange() [2/2]

virtual void addNotifyAudioChange ( AudioInfoSupport & bi)
inlinevirtualinherited

Adds target to be notified about audio changes.

Reimplemented in CodecNOP, CodecNOP, EncodedAudioOutput, and EncodedAudioStream.

◆ audioInfo() [1/2]

virtual AudioInfo audioInfo ( )
inlineoverridevirtualinherited

◆ audioInfo() [2/2]

virtual AudioInfo audioInfo ( )
inlineoverridevirtualinherited

◆ audioInfoOut() [1/2]

◆ audioInfoOut() [2/2]

◆ availableForWrite()

int availableForWrite ( )
inlinevirtual

Reimplemented from AudioOutput.

◆ begin() [1/3]

◆ begin() [2/3]

virtual bool begin ( AudioInfo info)
inlinevirtualinherited

◆ begin() [3/3]

bool begin ( AudioInfo info)
inline

Starts the processing. I the output is mono, we can determine the output pin by selecting DAC1 (gpio25) or DAC2 (gpio26).

◆ clearNotifyAudioChange() [1/2]

virtual void clearNotifyAudioChange ( )
inlinevirtualinherited

◆ clearNotifyAudioChange() [2/2]

virtual void clearNotifyAudioChange ( )
inlinevirtualinherited

◆ create_I_BXI()

uint32_t create_I_BXI ( uint32_t imm_pc)
inlineprotected

◆ create_I_WR_REG()

uint32_t create_I_WR_REG ( uint32_t reg,
uint32_t low_bit,
uint32_t high_bit,
uint32_t val )
inlineprotected

◆ defaultConfig()

AudioInfo defaultConfig ( )
inline

◆ end()

void end ( )
inlinevirtual

Reimplemented from AudioOutput.

◆ flush() [1/2]

virtual void flush ( )
inlinevirtualinherited

Reimplemented from Print.

Reimplemented in HexDumpOutput, HexDumpOutput, MultiOutput, HexDumpOutput, and MultiOutput.

◆ flush() [2/2]

virtual void flush ( )
inlinevirtualinherited

Reimplemented from Print.

Reimplemented in HexDumpOutput, HexDumpOutput, MultiOutput, HexDumpOutput, and MultiOutput.

◆ isDeletable() [1/2]

virtual bool isDeletable ( )
inlinevirtualinherited

If true we need to release the related memory in the destructor.

Reimplemented in AdapterAudioStreamToAudioOutput, AdapterPrintToAudioOutput, AdapterAudioStreamToAudioOutput, and AdapterPrintToAudioOutput.

◆ isDeletable() [2/2]

virtual bool isDeletable ( )
inlinevirtualinherited

If true we need to release the related memory in the destructor.

Reimplemented in AdapterAudioStreamToAudioOutput, AdapterPrintToAudioOutput, AdapterAudioStreamToAudioOutput, and AdapterPrintToAudioOutput.

◆ isNotifyActive() [1/2]

bool isNotifyActive ( )
inlineinherited

Checks if the automatic AudioInfo update is active.

◆ isNotifyActive() [2/2]

bool isNotifyActive ( )
inlineinherited

Checks if the automatic AudioInfo update is active.

◆ notifyAudioChange() [1/2]

void notifyAudioChange ( AudioInfo info)
inlineprotectedinherited

◆ notifyAudioChange() [2/2]

void notifyAudioChange ( AudioInfo info)
inlineprotectedinherited

◆ operator bool() [1/2]

virtual operator bool ( )
inlinevirtualinherited

◆ operator bool() [2/2]

virtual operator bool ( )
inlinevirtualinherited

◆ removeNotifyAudioChange() [1/2]

virtual bool removeNotifyAudioChange ( AudioInfoSupport & bi)
inlinevirtualinherited

Removes a target in order not to be notified about audio changes.

◆ removeNotifyAudioChange() [2/2]

virtual bool removeNotifyAudioChange ( AudioInfoSupport & bi)
inlinevirtualinherited

Removes a target in order not to be notified about audio changes.

◆ setAudioInfo() [1/2]

virtual void setAudioInfo ( AudioInfo info)
inlineoverridevirtualinherited

◆ setAudioInfo() [2/2]

virtual void setAudioInfo ( AudioInfo info)
inlineoverridevirtualinherited

◆ setMinWriteBytes()

void setMinWriteBytes ( int bytes)
inline

Selects the limit for the availableForWrite to report the data.

◆ setMonoDAC()

void setMonoDAC ( UlpDac dac)
inline

Selects the DAC when we have a mono signal.

◆ setNotifyActive() [1/2]

void setNotifyActive ( bool flag)
inlineinherited

Deactivate/Reactivate automatic AudioInfo updates: (default is active).

◆ setNotifyActive() [2/2]

void setNotifyActive ( bool flag)
inlineinherited

Deactivate/Reactivate automatic AudioInfo updates: (default is active).

◆ setup()

bool setup ( )
inlineprotected

◆ write() [1/2]

virtual size_t write ( uint8_t ch)
inlineoverridevirtualinherited

Reimplemented in MultiOutput, MetaDataOutput, and MultiOutput.

◆ write() [2/2]

size_t write ( const uint8_t * data,
size_t len )
inlinevirtual

Implements AudioOutput.

◆ writeFrame()

bool writeFrame ( int16_t sample[2])
inlineprotected

◆ writeSilence() [1/2]

virtual void writeSilence ( size_t len)
inlinevirtualinherited

Writes n 0 values (= silence)

Parameters
len

◆ writeSilence() [2/2]

virtual void writeSilence ( size_t len)
inlinevirtualinherited

Writes n 0 values (= silence)

Parameters
len

Member Data Documentation

◆ _timeout

int _timeout = 10
protectedinherited

◆ activeDACs

int activeDACs = 3
protected

◆ bufferedOddSample

uint8_t bufferedOddSample = 128
protected

◆ bufferStart

const uint32_t bufferStart = indexAddress + 1
protected

◆ cfg

AudioInfo cfg
protectedinherited

◆ dacTableStart1

const uint32_t dacTableStart1 = 2048 - 512
protected

◆ dacTableStart2

const uint32_t dacTableStart2 = dacTableStart1 - 512
protected

◆ hertz

int hertz
protected

◆ indexAddress

const uint32_t indexAddress = opcodeCount
protected

◆ is_active

bool is_active = false
protectedinherited

◆ is_notify_active

bool is_notify_active = true
protectedinherited

◆ lastFilledWord

int lastFilledWord = 0
protected

◆ min_write_bytes

int min_write_bytes = 128
protected

◆ notify_vector

Vector< AudioInfoSupport * > notify_vector
protectedinherited

◆ opcodeCount

const int opcodeCount = 20
protected

◆ selected_mono_dac

UlpDac selected_mono_dac = ULP_DAC1
protected

◆ stereoOutput

bool stereoOutput = true
protected

◆ tmp

SingleBuffer< uint8_t > tmp { 8 }
protectedinherited

◆ tmpPos

int tmpPos = 0
protectedinherited

◆ totalSamples

const int totalSamples = totalSampleWords * 2
protected

◆ totalSampleWords

uint32_t totalSampleWords
protected
Initial value:
=
2048 - 512 - 512 - (opcodeCount + 1)
const int opcodeCount
Definition AudioESP32ULP.h:130

◆ waitingOddSample

bool waitingOddSample = true
protected

The documentation for this class was generated from the following file: