arduino-audio-tools
|
Stream support for A2DP using https://github.com/pschatzmann/ESP32-A2DP: begin(TX_MODE) opens a a2dp_source and begin(RX_MODE) a a2dp_sink. The data is in int16_t with 2 channels at 44100 hertz. We support only one instance of the class! Please note that this is a conveniance class that supports the stream api, however this is rather inefficient, beause quite a big buffer needs to be allocated. It is recommended to use the API with the callbacks. Examples can be found in the a2dp examples directory starting with basic. More...
#include <A2DPStream.h>
Public Member Functions | |
~A2DPStream () | |
Release the allocate a2dp_source or a2dp_sink. | |
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 () |
int | available () override |
Provides the number of bytes available to read. | |
int | availableForWrite () override |
Provides the number of bytes available to write. | |
virtual bool | begin () |
bool | begin (A2DPConfig cfg) |
Starts the processing. | |
bool | begin (RxTxMode mode, const char *name, bool wait_for_connection=true) |
Starts the processing. | |
BaseBuffer< uint8_t > & | buffer () |
Provides access to the buffer. | |
virtual void | clearNotifyAudioChange () |
Deletes all change notify subscriptions. | |
A2DPConfig | defaultConfig (RxTxMode mode=RX_MODE) |
void | end () override |
virtual void | flush () override |
bool | isConnected () |
checks if we are connected | |
bool | isNotifyActive () |
Checks if the automatic AudioInfo update is active. | |
bool | isReady () |
is ready to process data | |
operator bool () | |
convert to bool | |
size_t | readBytes (uint8_t *data, size_t len) override |
Reads the data from the temporary buffer. | |
virtual size_t | readSilence (uint8_t *buffer, size_t length) |
Source to generate silence: just sets the buffer to 0. | |
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 | setNotifyActive (bool flag) |
Deactivate/Reactivate automatic AudioInfo updates: (default is active) | |
void | setSilenceOnNoData (bool silence) |
Manage config.silence_on_nodata dynamically. | |
bool | setVolume (float volume) override |
Define the volume (values between 0.0 and 1.0) | |
BluetoothA2DPSink & | sink () |
provides access to the BluetoothA2DPSink | |
BluetoothA2DPSource & | source () |
provides access to the | |
virtual float | volume () |
provides the actual volume in the range of 0.0f to 1.0f | |
size_t | write (const uint8_t *data, size_t len) override |
Writes the data into a temporary send buffer - where it can be picked up by the callback. | |
virtual size_t | write (uint8_t ch) override |
virtual void | writeSilence (size_t len) |
Writes len bytes of silence (=0). | |
Protected Member Functions | |
virtual int | not_supported (int out, const char *msg="") |
void | notify_base_Info (int rate) |
notify subscriber with AudioInfo | |
void | notifyAudioChange (AudioInfo info) |
void | refillReadBuffer () |
Protected Attributes | |
int | _timeout = 10 |
BluetoothA2DPCommon * | a2dp =nullptr |
const int | A2DP_MAX_VOL = 128 |
BluetoothA2DPSink * | a2dp_sink = nullptr |
BluetoothA2DPSource * | a2dp_source = nullptr |
A2DPConfig | config |
AudioInfo | info |
bool | is_notify_active = true |
Vector< AudioInfoSupport * > | notify_vector |
RingBuffer< uint8_t > | tmp_in {0} |
RingBuffer< uint8_t > | tmp_out {0} |
float | volume_value = 1.0f |
Stream support for A2DP using https://github.com/pschatzmann/ESP32-A2DP: begin(TX_MODE) opens a a2dp_source and begin(RX_MODE) a a2dp_sink. The data is in int16_t with 2 channels at 44100 hertz. We support only one instance of the class! Please note that this is a conveniance class that supports the stream api, however this is rather inefficient, beause quite a big buffer needs to be allocated. It is recommended to use the API with the callbacks. Examples can be found in the a2dp examples directory starting with basic.
Requires: https://github.com/pschatzmann/ESP32-A2DP
|
inlinevirtualinherited |
Adds target to be notified about audio changes.
Reimplemented in CodecNOP, MP3DecoderMAD, EncodedAudioOutput, EncodedAudioStream, AACDecoderFDK, DecoderBasic, MP3DecoderHelix, OggContainerDecoder, Pipeline, and Pipeline::ModifyingStreamAdapter.
|
inlineoverridevirtualinherited |
provides the actual input AudioInfo
Implements AudioInfoSupport.
Reimplemented in JupyterAudioT< T >, MozziStream, TimerCallbackAudioStream, PureDataStream, AdapterAudioOutputToAudioStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, and InputMerge< T >.
|
inlinevirtualinherited |
provides the actual output AudioInfo: this is usually the same as audioInfo() unless we use a transforming stream
Reimplemented in PureDataStream, PWMAudioOutput, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, FormatConverterStream, Pipeline, and ResampleStream.
|
inlineoverridevirtual |
Provides the number of bytes available to read.
Reimplemented from BaseStream.
|
inlineoverridevirtual |
Provides the number of bytes available to write.
Reimplemented from BaseStream.
|
inlinevirtualinherited |
Reimplemented in AudioOutputWithCallback, HLSStreamT< URLStream >, SPDIFOutput, VS1053Stream, WM8960Stream, ESPNowStream, TimerCallbackAudioStream, QueueStream< T >, QueueStream< uint8_t >, DynamicMemoryStream, AudioFFTBase, AnalogAudioArduino, AnalogAudioStream, MemoryStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, FormatConverterStream, and Pipeline.
|
inlineoverridevirtual |
Reimplemented from BaseStream.
|
inlineoverridevirtualinherited |
Reimplemented from Print.
Reimplemented in ResampleStream, BufferedTaskStream, and BufferedStream.
|
inlinevirtual |
convert to bool
Reimplemented from AudioStream.
|
inlineoverridevirtual |
Reads the data from the temporary buffer.
Reimplemented from AudioStream.
|
inlineoverridevirtualinherited |
Defines the input AudioInfo.
Implements AudioInfoSupport.
Reimplemented in VS1053Stream, WM8960Stream, I2SBitBang, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, VolumeStream, MiniAudioStream, PortAudioStream, I2SCodecStream, MozziStream, SPDIFOutput, AudioLoRa, AnalogAudioStream, I2SStream, MeasuringStream, VolumeMeter, TimerCallbackAudioStream, AudioBLEStream, LoRaStream, AudioFFTBase, AudioKitStream, VBANStream, AnalogAudioArduino, Equalizer3Bands, AdapterAudioOutputToAudioStream, TimedStream, ProgressStream, FormatConverterStream, FadeStream, Pipeline::ModifyingStreamAdapter, PureDataStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, Pipeline, and ResampleStream.
|
inlineoverridevirtual |
Define the volume (values between 0.0 and 1.0)
Reimplemented from VolumeSupport.
|
inlinevirtualinherited |
provides the actual volume in the range of 0.0f to 1.0f
Reimplemented in I2SCodecStream, VS1053Stream, AudioPlayer, and VolumeStream.
|
inlineoverridevirtual |
Writes the data into a temporary send buffer - where it can be picked up by the callback.
Reimplemented from AudioStream.
|
inlineoverridevirtualinherited |
Reimplemented in BufferedTaskStream, and BufferedStream.