arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
audio_tools::A2DPStream Class Reference

Stream support for A2DP: begin(TX_MODE) uses a2dp_source - begin(RX_MODE) a a2dp_sink The data is in int16_t with 2 channels at 44100 hertz. More...

#include <AudioA2DP.h>

Inheritance diagram for audio_tools::A2DPStream:
audio_tools::AudioStream Stream audio_tools::AudioBaseInfoDependent audio_tools::AudioBaseInfoSource Print

Public Member Functions

 ~A2DPStream ()
 Release the allocate a2dp_source or a2dp_sink.
 
virtual int available ()
 
virtual int availableForWrite ()
 
void begin (A2DPConfig cfg)
 Opens the processing.
 
void begin (RxTxMode mode, const char *name)
 
A2DPConfig defaultConfig (RxTxMode mode=RX_MODE)
 
virtual void flush ()
 
bool isConnected ()
 checks if we are connected
 
bool isReady ()
 is ready to process data
 
 operator bool ()
 convert to bool
 
virtual int peek ()
 
virtual int read ()
 
virtual size_t readBytes (uint8_t *data, size_t len)
 Reads the data from the temporary buffer. More...
 
virtual void setNotifyAudioChange (AudioBaseInfoDependent &bi)
 
virtual void setVolume (float volume)
 
BluetoothA2DPSink & sink ()
 provides access to the BluetoothA2DPSink
 
BluetoothA2DPSource & source ()
 provides access to the
 
virtual size_t write (const uint8_t *data, size_t len)
 Writes the data into a temporary send buffer - where it can be picked up by the callback. More...
 
virtual size_t write (uint8_t c)
 
- Public Member Functions inherited from audio_tools::AudioStream
 AudioStream (AudioStream const &)=delete
 
virtual AudioBaseInfo audioInfo () override
 
virtual int availableForWrite () override
 
virtual bool begin ()
 
virtual void end ()
 
virtual void flush ()
 
 operator bool ()
 
AudioStreamoperator= (AudioStream const &)=delete
 
virtual size_t readBytes (char *buffer, size_t length)
 
virtual size_t readBytes (uint8_t *buffer, size_t length)=0
 
virtual void setAudioInfo (AudioBaseInfo info)
 
virtual void setNotifyAudioChange (AudioBaseInfoDependent &bi)
 
virtual size_t write (const uint8_t *buffer, size_t size)=0
 
- Public Member Functions inherited from Stream
virtual int available ()=0
 
bool find (char target)
 
bool find (const char *target)
 
bool find (const char *target, size_t length)
 
bool find (const uint8_t *target)
 
bool find (const uint8_t *target, size_t length)
 
bool findUntil (const char *target, const char *terminator)
 
bool findUntil (const char *target, size_t targetLen, const char *terminate, size_t termLen)
 
bool findUntil (const uint8_t *target, const char *terminator)
 
bool findUntil (const uint8_t *target, size_t targetLen, const char *terminate, size_t termLen)
 
unsigned long getTimeout (void)
 
float parseFloat (LookaheadMode lookahead=SKIP_ALL, char ignore=NO_IGNORE_CHAR)
 
long parseInt (LookaheadMode lookahead=SKIP_ALL, char ignore=NO_IGNORE_CHAR)
 
virtual int peek ()=0
 
virtual int read ()=0
 
size_t readBytes (char *buffer, size_t length)
 
size_t readBytes (uint8_t *buffer, size_t length)
 
size_t readBytesUntil (char terminator, char *buffer, size_t length)
 
size_t readBytesUntil (char terminator, uint8_t *buffer, size_t length)
 
String readString ()
 
String readStringUntil (char terminator)
 
void setTimeout (unsigned long timeout)
 
- Public Member Functions inherited from Print
virtual int availableForWrite ()
 
void clearWriteError ()
 
virtual void flush ()
 
int getWriteError ()
 
size_t print (char)
 
size_t print (const __FlashStringHelper *)
 
size_t print (const char[])
 
size_t print (const Printable &)
 
size_t print (const String &)
 
size_t print (double, int=2)
 
size_t print (int, int=DEC)
 
size_t print (long long, int=DEC)
 
size_t print (long, int=DEC)
 
size_t print (unsigned char, int=DEC)
 
size_t print (unsigned int, int=DEC)
 
size_t print (unsigned long long, int=DEC)
 
size_t print (unsigned long, int=DEC)
 
size_t println (char)
 
size_t println (const __FlashStringHelper *)
 
size_t println (const char[])
 
size_t println (const Printable &)
 
size_t println (const String &s)
 
size_t println (double, int=2)
 
size_t println (int, int=DEC)
 
size_t println (long long, int=DEC)
 
size_t println (long, int=DEC)
 
size_t println (unsigned char, int=DEC)
 
size_t println (unsigned int, int=DEC)
 
size_t println (unsigned long long, int=DEC)
 
size_t println (unsigned long, int=DEC)
 
size_t println (void)
 
size_t write (const char *buffer, size_t size)
 
size_t write (const char *str)
 
virtual size_t write (const uint8_t *buffer, size_t size)
 
virtual size_t write (uint8_t)=0
 
- Public Member Functions inherited from audio_tools::AudioBaseInfoDependent
virtual AudioBaseInfo audioInfo ()=0
 
virtual void setAudioInfo (AudioBaseInfo info)=0
 
virtual bool validate (AudioBaseInfo &info)
 
virtual void setNotifyAudioChange (AudioBaseInfoDependent &bi)=0
 

Protected Member Functions

bool lockSemaphore (bool locked, bool immediate=false)
 
void notifyBaseInfo (int rate)
 notify subscriber with AudioBaseInfo
 
- Protected Member Functions inherited from audio_tools::AudioStream
virtual int not_supported (int out)
 
- Protected Member Functions inherited from Stream
int findMulti (struct MultiTarget *targets, int tCount)
 
float parseFloat (char ignore)
 
long parseInt (char ignore)
 
int peekNextDigit (LookaheadMode lookahead, bool detectDecimal)
 
int timedPeek ()
 
int timedRead ()
 
- Protected Member Functions inherited from Print
void setWriteError (int err=1)
 

Static Protected Member Functions

static void a2dp_stream_sink_sound_data (const uint8_t *data, uint32_t len)
 callback used by A2DP to write the sound data
 
static int32_t a2dp_stream_source_sound_data (Frame *data, int32_t len)
 
static void a2dpStateCallback (esp_a2d_connection_state_t state, void *caller)
 
static void sample_rate_callback (uint16_t rate)
 callback to update audio info with used a2dp sample rate
 

Protected Attributes

BluetoothA2DPCommon * a2dp =nullptr
 
BluetoothA2DPSink * a2dp_sink = nullptr
 
BluetoothA2DPSource * a2dp_source = nullptr
 
AudioBaseInfoDependentaudioBaseInfoDependent =nullptr
 
A2DPConfig config
 
float volume = 1.0
 
SemaphoreHandle_t xSemaphore = NULL
 
- Protected Attributes inherited from audio_tools::AudioStream
AudioBaseInfo info
 
AudioBaseInfoDependentp_notify =nullptr
 
- Protected Attributes inherited from Stream
unsigned long _startMillis
 
unsigned long _timeout
 

Detailed Description

Stream support for A2DP: begin(TX_MODE) uses a2dp_source - 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!

Author
Phil Schatzmann

Member Function Documentation

◆ available()

virtual int audio_tools::A2DPStream::available ( )
inlinevirtual

Implements Stream.

◆ availableForWrite()

virtual int audio_tools::A2DPStream::availableForWrite ( )
inlinevirtual

Reimplemented from audio_tools::AudioStream.

◆ flush()

virtual void audio_tools::A2DPStream::flush ( )
inlinevirtual

Reimplemented from audio_tools::AudioStream.

◆ peek()

virtual int audio_tools::A2DPStream::peek ( )
inlinevirtual

Implements Stream.

◆ read()

virtual int audio_tools::A2DPStream::read ( )
inlinevirtual

Implements Stream.

◆ readBytes()

virtual size_t audio_tools::A2DPStream::readBytes ( uint8_t *  data,
size_t  len 
)
inlinevirtual

Reads the data from the temporary buffer.

Implements audio_tools::AudioStream.

◆ setNotifyAudioChange()

virtual void audio_tools::A2DPStream::setNotifyAudioChange ( AudioBaseInfoDependent bi)
inlinevirtual

Reimplemented from audio_tools::AudioStream.

◆ write() [1/2]

virtual size_t audio_tools::A2DPStream::write ( const uint8_t *  data,
size_t  len 
)
inlinevirtual

Writes the data into a temporary send buffer - where it can be picked up by the callback.

Implements audio_tools::AudioStream.

◆ write() [2/2]

virtual size_t audio_tools::A2DPStream::write ( uint8_t  c)
inlinevirtual

Implements Print.


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