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>
|
| bool | begin_rx () |
| |
| bool | begin_tx () |
| |
| bool | configure_tx () |
| |
| void | configure_vban (VBanSampleRates rate) |
| |
| virtual int | not_supported (int out, const char *msg="") |
| |
| void | notifyAudioChange (AudioInfo info) |
| |
| 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 () |
| | Refill small read buffer (e.g. 8 bytes) to avoid single byte reads when calling read()
|
| |
| void | safe_strncpy (char *dest, const char *src, size_t dest_size) |
| |
| void | sendVbanPing0Reply (AsyncUDPPacket &sourcePacket) |
| |
| void | start_wifi () |
| |
| const char * | toString (IPAddress adr) |
| |
| int | vban_sample_rate () |
| |
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.
- Note
- Supported only on Arduino ESP32 platforms with WiFi support!
- Author
- Phil Schatzmann
- Copyright
- GPLv3
◆ addNotifyAudioChange()
Adds target to be notified about audio changes.
Reimplemented in CodecNOP, EncodedAudioOutput, EncodedAudioStream, AACDecoderFDK, DecoderBasic, CodecChain, MP3DecoderHelix, MP3DecoderMAD, OggContainerDecoder, RTSPClient< TcpClient, UdpSocket >, Pipeline, and Pipeline::ModifyingStreamAdapter.
◆ audioInfo()
|
|
inlineoverridevirtualinherited |
◆ audioInfoOut()
provides the actual output AudioInfo: this is usually the same as audioInfo() unless we use a transforming stream
Reimplemented in MP3EncoderShine, PureDataStream, PWMAudioOutput< PWMDriverT >, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, FormatConverterStream, Pipeline, ResampleStream, and ResampleStreamT< TInterpolator >.
◆ available()
◆ availableForWrite()
| int availableForWrite |
( |
| ) |
|
|
inlinevirtual |
◆ begin() [1/2]
◆ begin() [2/2]
◆ begin_rx()
◆ begin_tx()
◆ clearNotifyAudioChange()
| virtual void clearNotifyAudioChange |
( |
| ) |
|
|
inlinevirtualinherited |
◆ configure_tx()
◆ configure_vban()
◆ defaultConfig()
◆ end()
Reimplemented in FaustStream< DSP >, AudioMP34DT05, I2SCodecStream, MozziStream, PureDataStream, SPDIFOutput, VS1053Stream, WM8960Stream, AdaptiveResamplingStream, AudioLoRa, ESPNowStream, BufferedTaskStream, URLStreamBufferedT< T >, URLStreamBufferedT< ICYStream >, USBAudioDeviceBase, Equalizer3Bands, I2SStream, AudioStreamWrapper, TimerCallbackAudioStream, FormatConverterStream, GoertzelStream, FileLoopT< FileType >, FileLoopT< File >, EqualizerNBands< SampleT, AccT, NUM_TAPS, NUM_BANDS >, EncodedAudioStream, AudioKitStream, MiniAudioStream, PortAudioStream, StdioStream, A2DPStream, HLSStreamT< URLStream >, HttpRequest, ICYStreamT< T >, URLStream, URLStreamESP32, NRF24Stream, SPIAudioSlave, AnalogAudioStream, AudioEffectStreamT< T >, AudioEffectStream, Equalizer3BandsPerChannel, ReformatBaseStream, AdapterAudioOutputToAudioStream, MemoryStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, InputMixer< T, SumT >, InputMerge< T >, CallbackStream, FilteredStream< T, TF >, FilteredStream< int16_t, int16_t >, ChannelFormatConverterStream, NumberFormatConverterStream, CatStream, QueueStream< T >, QueueStream< uint8_t >, DynamicMemoryStream, Pipeline, Pipeline::ModifyingStreamAdapter, VolumeStream, AudioFFTBase, AudioBLEClient, AudioBLEClient, AudioBLEServer, AudioBLEServer, AbstractURLStream, and AudioBLEStream.
◆ flush()
|
|
inlineoverridevirtualinherited |
Reimplemented from Print.
Reimplemented in PureDataStream, URLStreamBufferedT< T >, URLStreamBufferedT< ICYStream >, ReformatBaseStream, AudioStreamWrapper, ResampleStream, EncodedAudioStream, URLStream, BufferedTaskStream, I2SStream, MemoryStream, RingBufferStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, and BufferedStream.
◆ isNotifyActive()
Checks if the automatic AudioInfo update is active.
◆ not_supported()
| virtual int not_supported |
( |
int |
out, |
|
|
const char * |
msg = "" |
|
) |
| |
|
inlineprotectedvirtualinherited |
◆ notifyAudioChange()
◆ operator bool()
| virtual operator bool |
( |
| ) |
|
|
inlinevirtualinherited |
Reimplemented in A2DPStream, ICYStreamT< T >, AudioBLEStream, PortAudioStream, URLStream, USBAudioDeviceBase, I2SStream, AdapterAudioOutputToAudioStream, TimedStream, MemoryStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, Pipeline, and AudioFFTBase.
◆ readBytes()
| size_t readBytes |
( |
uint8_t * |
data, |
|
|
size_t |
len |
|
) |
| |
|
inlineoverridevirtual |
◆ readSilence()
| virtual size_t readSilence |
( |
uint8_t * |
buffer, |
|
|
size_t |
length |
|
) |
| |
|
inlinevirtualinherited |
Source to generate silence: just sets the buffer to 0.
◆ receive_udp()
| void receive_udp |
( |
AsyncUDPPacket & |
packet | ) |
|
|
inlineprotected |
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.
◆ refillReadBuffer()
| void refillReadBuffer |
( |
| ) |
|
|
inlineprotectedinherited |
Refill small read buffer (e.g. 8 bytes) to avoid single byte reads when calling read()
◆ removeNotifyAudioChange()
◆ safe_strncpy()
| void safe_strncpy |
( |
char * |
dest, |
|
|
const char * |
src, |
|
|
size_t |
dest_size |
|
) |
| |
|
inlineprotected |
◆ sendVbanPing0Reply()
| void sendVbanPing0Reply |
( |
AsyncUDPPacket & |
sourcePacket | ) |
|
|
inlineprotected |
◆ setAudioInfo()
◆ setNotifyActive()
| void setNotifyActive |
( |
bool |
flag | ) |
|
|
inlineinherited |
Deactivate/Reactivate automatic AudioInfo updates: (default is active)
◆ setOutput()
| void setOutput |
( |
Print & |
out | ) |
|
|
inline |
◆ setWriteBufferSize()
| void setWriteBufferSize |
( |
int |
size | ) |
|
|
inlineinherited |
◆ start_wifi()
◆ toString()
◆ vban_sample_rate()
◆ write() [1/2]
| size_t write |
( |
const uint8_t * |
data, |
|
|
size_t |
len |
|
) |
| |
|
inlineoverridevirtual |
◆ write() [2/2]
| virtual size_t write |
( |
uint8_t |
ch | ) |
|
|
inlineoverridevirtualinherited |
◆ writeSilence()
| virtual void writeSilence |
( |
size_t |
len | ) |
|
|
inlinevirtualinherited |
Writes len bytes of silence (=0).
◆ _timeout
◆ available_active
| bool available_active = false |
|
protected |
◆ broadcast_address
| const IPAddress broadcast_address {0, 0, 0, 0} |
|
protected |
◆ bytes_received
| size_t bytes_received = 0 |
|
protected |
◆ cfg
◆ info
◆ is_notify_active
| bool is_notify_active = true |
|
protectedinherited |
◆ notify_vector
◆ p_out
◆ packet_counter
| uint32_t packet_counter = 0 |
|
protected |
◆ rx_buffer
◆ throttle
◆ tmp_in
◆ tmp_out
◆ tx_buffer
◆ udp
◆ udp_connected
| bool udp_connected = false |
|
protected |
◆ vban
◆ write_buffer_size
The documentation for this class was generated from the following file: