arduino-audio-tools
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
VBANStream Class Reference

VBAN Audio Source and Sink for the ESP32. For further details please see https://vb-audio.com/Voicemeeter/vban.htm . Inspired by https://github.com/rkinnett/ESP32-VBAN-Audio-Source/tree/master and https://github.com/rkinnett/ESP32-VBAN-Network-Audio-Player. More...

#include <VBANStream.h>

Inheritance diagram for VBANStream:
AudioStream Stream AudioInfoSupport AudioInfoSource Print

Public Member Functions

virtual AudioInfo audioInfo () override
 
int available ()
 
int availableForWrite ()
 
bool begin ()
 
bool begin (VBANConfig cfg)
 
VBANConfig defaultConfig (RxTxMode mode=TX_MODE)
 
virtual void end ()
 
virtual void flush () override
 
 operator bool ()
 
size_t readBytes (uint8_t *data, size_t byteCount) override
 
virtual size_t readSilence (uint8_t *buffer, size_t length)
 Source to generate silence: just sets the buffer to 0.
 
void setAudioInfo (AudioInfo info) override
 
virtual void setNotifyAudioChange (AudioInfoSupport &bi) override
 
virtual bool validate (AudioInfo &info)
 
size_t write (const uint8_t *data, size_t byteCount) override
 
virtual size_t write (uint8_t ch) override
 
virtual void writeSilence (size_t len)
 Writes len bytes of silence (=0).
 

Protected Member Functions

bool begin_rx ()
 
bool begin_tx ()
 
bool configure_tx ()
 
void configure_vban (VBanSampleRates rate)
 
virtual int not_supported (int out, const char *msg="")
 
void receive_udp (AsyncUDPPacket &packet)
 VBAN adjusts the number of samples per packet according to sample rate. Assuming 16-bit PCM mono, sample rates 11025, 22050, 44100, and 88200 yield packets containing 64, 128, 256, and 256 samples per packet, respectively. The even-thousands sample rates below 48000 yield non-power-of-2 lengths. For example, sample rate 24000 yields 139 samples per packet. This VBAN->DMA->DAC method seems to require the dma buffer length be set equal to the number of samples in each VBAN packet. ESP32 I2S/DMA does not seem to handle non-power-of-2 buffer lengths well. Sample rate 24000 doesn't work reliably at all. Sample rate 32000 is stable but stutters. Recommend selecting from sample rates 11025, 22050, 44100, and above And set samplesPerPacket to 64 for 11025, 128 for 22050, or 256 for all else.
 
void refillReadBuffer ()
 
void start_wifi ()
 
int vban_sample_rate ()
 

Protected Attributes

int _timeout = 10
 
const IPAddress broadcast_address {0,0,0,0}
 
VBANConfig cfg
 
AudioInfo info
 
AudioInfoSupportp_notify =nullptr
 
uint32_t packet_counter = 0
 
NBuffer< uint8_t > rx_buffer {VBAN_PACKET_MAX_LEN_BYTES, 0}
 
Throttle throttle
 
RingBuffer< uint8_t > tmp_in {0}
 
RingBuffer< uint8_t > tmp_out {0}
 
SingleBuffer< int16_t > tx_buffer {0}
 
AsyncUDP udp
 
bool udp_connected = false
 
VBan vban
 

Detailed Description

VBAN Audio Source and Sink for the ESP32. For further details please see https://vb-audio.com/Voicemeeter/vban.htm . Inspired by https://github.com/rkinnett/ESP32-VBAN-Audio-Source/tree/master and https://github.com/rkinnett/ESP32-VBAN-Network-Audio-Player.

Author
Phil Schatzmann

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