arduino-audio-tools
|
A SimpleDAC which uses the Serial UART to output values. This implementation is not using any timers and therefore should work on any microcontroller. More...
#include <AudioDAC.h>
Public Member Functions | |
SerialDAC (HardwareSerial &out) | |
virtual void | addNotifyAudioChange (AudioInfoSupport &bi) |
Adds target to be notified about audio changes. | |
virtual AudioInfo | audioInfo () override |
provides the actual input AudioInfo | |
virtual AudioInfo | audioInfoOut () |
provides the actual output AudioInfo: this is usually the same as audioInfo() unless we use a transforming stream | |
virtual int | availableForWrite () override |
virtual bool | begin () |
virtual bool | begin (AudioInfo info) |
bool | begin (DACInfo info) override |
starts the Delta Sigma DAC | |
virtual void | clearNotifyAudioChange () |
Deletes all change notify subscriptions. | |
DACInfo | defaultConfig () override |
virtual void | end () |
Stops the output. | |
virtual void | flush () |
bool | isBlocking () |
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. | |
virtual | operator bool () |
virtual uint32_t | outputFrameCount () |
To be used for testing, we just count the number of frames that were sent to output. | |
virtual uint32_t | outputRate () override |
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. | |
void | setBlocking (bool blocking) |
void | setNotifyActive (bool flag) |
Deactivate/Reactivate automatic AudioInfo updates: (default is active) | |
virtual void | startTimer () |
TimerAlarmRepeating & | timer () |
virtual size_t | write (const uint8_t *data, size_t len) override |
just write the data to the UART w/o buffering | |
virtual size_t | write (uint8_t c) |
Writes a single byte (of audio data) to the output buffer. | |
virtual void | writeSilence (size_t len) |
Protected Member Functions | |
size_t | availableFramesToWrite () override |
determines how many frames we can write to the buffer | |
void | notifyAudioChange (AudioInfo info) |
virtual void | quantize (int16_t newSamp, int left_right_idx) override |
updates the buffer with analog value (represented by number of 1) | |
virtual void | reset () |
Releases the memory. | |
void | writePins () |
Default output. | |
Protected Attributes | |
int | _timeout = 10 |
bool | active |
RingBuffer< int32_t > | buffer = RingBuffer<int32_t>(DEFAULT_BUFFER_SIZE) |
uint8_t | bytes_per_sample = 2 |
DACInfo * | cfg |
int32_t * | cummulated_error = nullptr |
int | current_bit = -1 |
int32_t * | current_values = nullptr |
const int | fixedPosValue =0x007fff00 |
DACInfo | info |
bool | is_active = false |
bool | is_blocking = true |
bool | is_notify_active = true |
int32_t * | last_values = nullptr |
Vector< AudioInfoSupport * > | notify_vector |
DACOut | out |
HardwareSerial * | serial = nullptr |
TimerAlarmRepeating | timer_object |
SingleBuffer< uint8_t > | tmp {MAX_SINGLE_CHARS} |
int | tmpPos = 0 |
int16_t | totalSamples |
uint8_t | write_buffer [4] |
int | write_buffer_pos = 0 |
A SimpleDAC which uses the Serial UART to output values. This implementation is not using any timers and therefore should work on any microcontroller.
|
inlinevirtualinherited |
Writes n 0 values (= silence)
len |