### start() Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_sink_queued.html Starts the I2S Bluetooth sink with the indicated name. This is the main function to start the Bluetooth Processing. This method is virtual and inherited. ```APIDOC ## start() ### Description Starts the I2S Bluetooth sink with the indicated name. This is the main function to start the Bluetooth Processing. This method is virtual and inherited. ### Method `void BluetoothA2DPSink::start(const char * _name)` ### Parameters #### Path Parameters - **_name** (const char *) - Required - The name to identify the Bluetooth sink. ``` -------------------------------- ### Simple I2S Example (A2DP Sink) Source: https://pschatzmann.github.io/ESP32-A2DP/html/index.html This is the simplest example for an A2DP Sink using default I2S pins. It starts a Bluetooth device named 'MyMusic' and streams audio to the default I2S pins connected to an external DAC. ```cpp #include "AudioTools.h" #include "BluetoothA2DPSink.h" I2SStream i2s; BluetoothA2DPSink a2dp_sink(i2s); void setup() { Serial.begin(115200); a2dp_sink.start("MyMusic"); } void loop() { } ``` -------------------------------- ### start (name) Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_sink.html Starts the I2S Bluetooth sink with the specified name. ```APIDOC ## start (name) ### Description Starts the I2S Bluetooth sink with the indicated name. ### Parameters #### Parameters - **name** (const char *) - Required - The name for the Bluetooth sink. ``` -------------------------------- ### start Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_source-members.html Starts the A2DP source functionality with various overloads to specify names and callbacks. ```APIDOC ## start ### Description Starts the A2DP source functionality. This method has multiple overloads to specify device names and a callback for music data frames. ### Method inline virtual (overloaded) ### Parameters * **name** (const char *) - Optional - The name of the device to connect to. * **names** (std::vector< const char * >) - Optional - A vector of device names to connect to. * **callback** (music_data_frames_cb_t) - Optional - Callback function for receiving music data frames. ``` -------------------------------- ### Install ESP32-A2DP Library for Arduino Source: https://pschatzmann.github.io/ESP32-A2DP/html/index.html Clone the ESP32-A2DP library into your Arduino libraries folder. Ensure you also clone the arduino-audio-tools library as it's required for the examples. ```bash cd ~/Documents/Arduino/libraries git clone https://github.com/pschatzmann/ESP32-A2DP.git git clone https://github.com/pschatzmann/arduino-audio-tools.git ``` -------------------------------- ### start() Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_source.html Starts the A2DP source. This method allows initiating the A2DP source without specifying device names, relying on a callback for device selection. ```APIDOC ## start() ### Description Starts the A2DP source. This function does not indicate any specific device names; instead, it uses a callback mechanism (ssid callback) to select the target device. ### Method Signature `virtual void BluetoothA2DPSource::start()` ``` -------------------------------- ### bt_start() Source: https://pschatzmann.github.io/ESP32-A2DP/html/functions_b.html Starts the Bluetooth A2DP common functionality. ```APIDOC ## bt_start() ### Description Starts the Bluetooth A2DP common functionality. ### Method Function ### Endpoint N/A ### Parameters None ### Request Example None ### Response None ### Response Example None ``` -------------------------------- ### start Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_sink_queued.html Starts the I2S Bluetooth sink with the indicated name. This version does not support auto-reconnect. ```APIDOC ## start ### Description Starts the I2S Bluetooth sink with the indicated name. This version does not support auto-reconnect. ### Method virtual void ### Parameters * **name** (const char *) - Description: The name for the Bluetooth sink. ``` -------------------------------- ### start (name, auto_reconect) Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_sink.html Starts the I2S Bluetooth sink with the specified name and an option to automatically reconnect. ```APIDOC ## start (name, auto_reconect) ### Description Starts the I2S Bluetooth sink with the indicated name and auto-reconnect capability. ### Parameters #### Parameters - **name** (const char *) - Required - The name for the Bluetooth sink. - **auto_reconect** (bool) - Required - Whether to enable automatic reconnection. ``` -------------------------------- ### start Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_sink.html Starts the I2S Bluetooth sink with the specified name. This is the main function to initiate Bluetooth processing. ```APIDOC ## start() ### Description Starts the I2S Bluetooth sink with the indicated name. Main function to start the Bluetooth Processing. ### Method void ### Parameters * **_name_** (const char *) - The name for the Bluetooth sink. ### Endpoint N/A (This is an SDK method) ### Request Example N/A ### Response N/A ``` -------------------------------- ### start Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_source.html Starts the A2DP source, initiating the audio streaming process. This function can be called with or without a specific device name. ```APIDOC ## start ### Description Starts the A2DP source. ### Method ``` virtual void start(const char *name) ``` ### Parameters * **name** (const char *) - The name of the A2DP source device to start. If null or empty, the first available source may be used. ``` ```APIDOC ## start ### Description Starts the A2DP source. ### Method ``` virtual void start(std::vector< const char * > names) ``` ### Parameters * **names** (std::vector) - A vector of A2DP source device names to attempt to start. The first available device in the list will be used. ``` -------------------------------- ### start (auto_reconnect) Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_sink_queued.html Starts the I2S Bluetooth sink with the indicated name and enables auto-reconnect functionality. ```APIDOC ## start ### Description Starts the I2S Bluetooth sink with the indicated name and enables auto-reconnect functionality. ### Method virtual void ### Parameters * **name** (const char *) - Description: The name for the Bluetooth sink. * **auto_reconect** (bool) - Description: If true, the sink will attempt to automatically reconnect. ``` -------------------------------- ### BluetoothA2DPOutputAudioTools::begin Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_output_audio_tools-members.html Starts the BluetoothA2DPOutputAudioTools functionality. This is an override of the base class begin method. ```APIDOC ## BluetoothA2DPOutputAudioTools::begin ### Description Starts the BluetoothA2DPOutputAudioTools functionality. This is an override of the base class begin method. ### Method (Not specified, likely part of a class initialization) ### Endpoint (Not applicable) ### Parameters (None explicitly documented) ### Request Example (Not applicable) ### Response #### Success Response (Not specified) #### Response Example (Not specified) ``` -------------------------------- ### Start A2DP Sink Source: https://pschatzmann.github.io/ESP32-A2DP/html/index.html Starts the A2DP sink service with a given Bluetooth name. ```APIDOC ## start ### Description Initializes and starts the A2DP sink service. ### Method Signature `void start(const char* name);` ### Parameters * **name** (string) - The Bluetooth name for the A2DP sink device. ``` -------------------------------- ### start_raw Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_source-members.html Starts raw A2DP data streaming with optional name and callback. ```APIDOC ## start_raw ### Description Starts raw A2DP data streaming. Allows specifying a device name and a callback for raw music data. ### Method inline virtual (overloaded) ### Parameters * **name** (const char *) - Optional - The name of the device for raw streaming. * **names** (std::vector< const char * >) - Optional - A vector of device names for raw streaming. * **callback** (music_data_cb_t) - Optional - Callback function for receiving raw music data. ``` -------------------------------- ### Start A2DP Source with Multiple Bluetooth Names Source: https://pschatzmann.github.io/ESP32-A2DP/html/index.html Starts the A2DP source and attempts to connect to the first available Bluetooth device from a list of names. Requires a callback function to provide audio data. ```cpp void setup() { static std::vector bt_names = {"MyMusic","RadioPlayer","MusicPlayer"}; a2dp_source.set_data_callback(get_sound_data) a2dp_source.start(bt_names); } ``` -------------------------------- ### Start A2DP Source with Single Bluetooth Name Source: https://pschatzmann.github.io/ESP32-A2DP/html/index.html Starts the A2DP source and connects to a specified Bluetooth device. Requires a callback function to provide audio data. ```cpp #include "BluetoothA2DPSource.h" BluetoothA2DPSource a2dp_source; // callback int32_t get_sound_data(uint8 *data, int32_t byteCount) { // generate your sound data // return the effective length in bytes return byteCount; } void setup() { a2dp_source.set_data_callback(get_sound_data) a2dp_source.start("MyMusic"); } void loop() {} ``` -------------------------------- ### start Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_sink-members.html Starts the Bluetooth A2DP sink service. This method can be used to initiate the A2DP connection with a specified device name and an option to auto-reconnect. ```APIDOC ## start ### Description Starts the Bluetooth A2DP sink service with a given name and an option for automatic reconnection. ### Method virtual ### Parameters #### Path Parameters - **name** (const char *) - Description: The name of the Bluetooth device. - **auto_reconect** (bool) - Description: If true, the sink will attempt to auto-reconnect. ### Endpoint N/A (Method Call) ``` -------------------------------- ### bt_i2s_task_start_up() Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_sink_queued.html Starts up the I2S task for the Bluetooth A2DP sink queued implementation. This method overrides the base class implementation. ```APIDOC ## bt_i2s_task_start_up() ### Description Starts up the I2S task for the Bluetooth A2DP sink queued implementation. This method overrides the base class implementation. ### Signature `void BluetoothA2DPSinkQueued::bt_i2s_task_start_up(void)` ### Remarks overrideprotectedvirtual Reimplemented from BluetoothA2DPSink. ``` -------------------------------- ### play() Source: https://pschatzmann.github.io/ESP32-A2DP/html/functions_func_p.html Resumes or starts audio playback. This function is part of the BluetoothA2DPSink class. ```APIDOC ## play() ### Description Resumes or starts audio playback. ### Method N/A (This is a class method) ### Endpoint N/A ### Parameters None ### Request Example None ### Response None ``` -------------------------------- ### set_task_core Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_common.html Defines the core which is used to start the tasks (to process the events and audio queue). Default is 1. ```APIDOC ## set_task_core() ### Description Defines the core which is used to start the tasks (to process the events and audio queue). Default is 1. ### Signature ```cpp void BluetoothA2DPCommon::set_task_core(BaseType_t _core_) ``` ``` -------------------------------- ### set_spp_config Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_sink.html Sets the SPP configuration. Must be called before starting SPP. ```APIDOC ## set_spp_config ### Description Configures the Serial Port Profile (SPP) settings. This function must be called before starting the SPP service. ### Method ``` void set_spp_config(esp_spp_cfg_t cfg) ``` ### Parameters * **cfg** (esp_spp_cfg_t) - The structure containing the SPP configuration parameters. ``` -------------------------------- ### BluetoothA2DPSource::start Source: https://pschatzmann.github.io/ESP32-A2DP/html/index.html Starts the A2DP audio source, initiating a connection to a specified Bluetooth device. It can accept a single device name or a list of preferred names. ```APIDOC ## BluetoothA2DPSource::start ### Description Starts the A2DP audio source and attempts to connect to the specified Bluetooth device(s). ### Method `virtual void start(const char* name)` `virtual void start(const std::vector& names)` ### Parameters #### Path Parameters - **name** (const char*) - The name of the Bluetooth device to connect to. - **names** (const std::vector&) - A vector of preferred Bluetooth device names to connect to. ### Request Example ```cpp // Connect to a single device a2dp_source.start("MyMusic"); // Connect to one of multiple devices static std::vector bt_names = {"MyMusic","RadioPlayer","MusicPlayer"}; a2dp_source.start(bt_names); ``` ``` -------------------------------- ### begin() Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_output-members.html Initializes the BluetoothA2DPOutput. This is a pure virtual function and must be implemented by derived classes. ```APIDOC ## begin() ### Description Initializes the BluetoothA2DPOutput. This is a pure virtual function and must be implemented by derived classes. ### Method virtual bool begin() = 0 ### Endpoint N/A (Class method) ### Parameters None ### Request Example N/A ### Response #### Success Response (bool) Returns true if initialization is successful, false otherwise. #### Response Example ``` true ``` ``` -------------------------------- ### begin() Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_output_legacy-members.html Initializes the BluetoothA2DPOutputLegacy object. This method is overridden from the base class. ```APIDOC ## begin() ### Description Initializes the BluetoothA2DPOutputLegacy object. This method is overridden from the base class. ### Method (Implicitly called, likely part of an initialization sequence) ### Parameters None explicitly documented for this call. ### Response None explicitly documented. ``` -------------------------------- ### bt_start Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_sink.html Initiates the Bluetooth stack and performs startup logic as implemented by Arduino. ```APIDOC ## bt_start ### Description Startup logic as implemented by Arduino. Initiates the Bluetooth stack. ### Method BT_START ### Endpoint /bt_start ### Response #### Success Response (bool) - **bool**: Returns true if the Bluetooth stack started successfully, false otherwise. ``` -------------------------------- ### Define Custom I2S Pins for AudioTools Source: https://pschatzmann.github.io/ESP32-A2DP/html/index.html Configure custom pins for the I2S interface before starting the Bluetooth A2DP sink. This is useful when the default pins are not suitable for your hardware setup. ```cpp #include "AudioTools.h" #include "BluetoothA2DPSink.h" I2SStream i2s; BluetoothA2DPSink a2dp_sink(i2s); void setup() { Serial.begin(115200); auto cfg = i2s.defaultConfig(); cfg.pin_bck = 14; cfg.pin_ws = 15; cfg.pin_data = 22; i2s.begin(cfg); a2dp_sink.start("MyMusic"); } void loop() { } ``` -------------------------------- ### bt_start() Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_sink_queued.html Initiates the startup logic for the Bluetooth A2DP common functionality, as implemented by Arduino. Returns true on success, false otherwise. ```APIDOC ## bt_start() ### Description Initiates the startup logic for the Bluetooth A2DP common functionality, as implemented by Arduino. ### Signature `bool BluetoothA2DPCommon::bt_start(void)` ### Returns - `true`: Startup successful. - `false`: Startup failed. ### Remarks protectedvirtualinherited Startup logic as implemented by Arduino. ``` -------------------------------- ### Constructors Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_sink_queued.html Initializes the BluetoothA2DPSinkQueued object with different output configurations. ```APIDOC ## BluetoothA2DPSinkQueued(audio_tools::AudioOutput &output) ### Description Output AudioOutput using AudioTools library. ### Parameters * **output** (audio_tools::AudioOutput &) - Reference to an AudioOutput object. ## BluetoothA2DPSinkQueued(audio_tools::AudioStream &output) ### Description Output AudioStream using AudioTools library. ### Parameters * **output** (audio_tools::AudioStream &) - Reference to an AudioStream object. ## BluetoothA2DPSinkQueued(Print &output) ### Description Output to Arduino Print. ### Parameters * **output** (Print &) - Reference to a Print object. ``` -------------------------------- ### connect_to Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_common.html Establishes a connection to a specified Bluetooth device address. ```APIDOC ## connect_to(esp_bd_addr_t peer) ### Description Connects to the indicated Bluetooth address. ### Method bool ### Parameters #### Path Parameters - **peer** (esp_bd_addr_t) - Required - The Bluetooth address of the peer device to connect to. ``` -------------------------------- ### set_output_active Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_sink_queued.html Activates or deactivates the output, for example, to I2S. ```APIDOC ## set_output_active ### Description Activate/Deactivate output e.g. to I2S. ### Method void ### Parameters #### Path Parameters - **flag** (bool) - Required - Set to true to activate the output, false to deactivate. ### Endpoint N/A (Method within a class) ``` -------------------------------- ### write_audio Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_sink.html Outputs audio data, for example, to I2S or a queue. ```APIDOC ## write_audio ### Description Outputs audio data, for example, to I2S or to a queue. ### Method WRITE_AUDIO ### Endpoint /write_audio ### Parameters #### Path Parameters - **data** (const uint8_t *) - Required - Pointer to the audio data buffer. - **size** (size_t) - Required - The size of the audio data in bytes. ### Response #### Success Response (size_t) - **size_t**: The number of bytes successfully written. ``` -------------------------------- ### get_volume_factor_max Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_a2_d_p_linear_volume_control.html Gets the maximum possible volume factor value, which is 4096. ```APIDOC ## get_volume_factor_max ### Description Gets the maximum volume factor value. ### Method int32_t ### Response #### Success Response (int32_t) - **Maximum factor value** (int32_t) - The maximum factor value, which is 4096. ``` -------------------------------- ### Constructor and Destructor Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_source.html Initializes and cleans up the BluetoothA2DPSource object. ```APIDOC ## BluetoothA2DPSource() ### Description Constructor for the BluetoothA2DPSource class. ### Method Constructor ### Endpoint N/A ## ~BluetoothA2DPSource() ### Description Destructor for the BluetoothA2DPSource class. ### Method Destructor ### Endpoint N/A ``` -------------------------------- ### get_reference Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_common.html Gets a reference to an object of a specified type, useful for callbacks. ```APIDOC ## get_reference(int type=0) ### Description Get the reference to an object (e.g. to use in the callbacks). ### Method void* ### Parameters #### Path Parameters - **type** (int) - Optional - The type of object reference to retrieve. Defaults to 0. ``` -------------------------------- ### BluetoothA2DPOutputLegacy::begin Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_output_legacy.html Initializes the Bluetooth A2DP output. This method overrides the base class method. ```APIDOC ## BluetoothA2DPOutputLegacy::begin ### Description Initializes the Bluetooth A2DP output. This method overrides the base class method. ### Method bool ### Endpoint N/A ### Parameters None ### Response - **bool**: Returns true if initialization is successful, false otherwise. ``` -------------------------------- ### connect_to Source: https://pschatzmann.github.io/ESP32-A2DP/html/functions_func_c.html Establishes a connection to a specified Bluetooth A2DP device. ```APIDOC ## connect_to() ### Description Establishes a connection to a specified Bluetooth A2DP device. ### Method Not specified (likely a function call within the library). ### Endpoint N/A ### Parameters None ### Request Example N/A ### Response N/A ``` -------------------------------- ### BluetoothA2DPSink::play Source: https://pschatzmann.github.io/ESP32-A2DP/html/functions_p.html Resumes or starts audio playback on the Bluetooth A2DP sink. ```APIDOC ## play() BluetoothA2DPSink ### Description Starts or resumes audio playback. ### Method `play()` ### Parameters None ### Response None specified. ``` -------------------------------- ### Constructors Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_a2_d_p_simple_exponential_volume_control.html Provides constructors for initializing the A2DPSimpleExponentialVolumeControl. ```APIDOC ## Constructors ### Default Constructor ```cpp A2DPSimpleExponentialVolumeControl ()=default ``` #### Description Default constructor. ### Constructor with Custom Limit ```cpp A2DPSimpleExponentialVolumeControl (int32_t limit) ``` #### Description Constructor with custom volume factor clipping limit. #### Parameters - **limit** (int32_t) - The custom clipping limit for the volume factor. ``` -------------------------------- ### end() Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_sink_queued.html Ends the I2S Bluetooth sink. Optionally releases memory, which may prevent future starts. ```APIDOC ## end() ### Description Ends the I2S Bluetooth sink with the indicated name. If `_release_memory_` is true, a future start might not be possible. ### Signature `void BluetoothA2DPSink::end(bool _release_memory_ = false)` ### Parameters - `_release_memory_` (bool): If true, releases memory, potentially preventing future starts. Defaults to `false`. ### Remarks virtualinherited Reimplemented from BluetoothA2DPCommon. ``` -------------------------------- ### Constructors Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_a2_d_p_default_volume_control-members.html Constructors for the A2DPDefaultVolumeControl class. ```APIDOC ## A2DPDefaultVolumeControl() ### Description Default constructor for A2DPDefaultVolumeControl. ### Method Constructor ### Endpoint N/A ### Parameters None ### Request Example None ### Response None ``` ```APIDOC ## A2DPDefaultVolumeControl(int32_t limit) ### Description Constructor for A2DPDefaultVolumeControl with a specified limit. ### Method Constructor ### Endpoint N/A ### Parameters * **limit** (int32_t) - Description not available in source. ### Request Example None ### Response None ``` -------------------------------- ### set_spp_config Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_sink_queued.html Sets the Serial Port Profile (SPP) configuration. This must be called before starting the A2DP sink. ```APIDOC ## set_spp_config ### Description Sets the Serial Port Profile (SPP) configuration. This must be called before starting the A2DP sink. ### Method void ### Parameters * **cfg** (esp_spp_cfg_t) - Description: The SPP configuration structure. ``` -------------------------------- ### Audio and Output Configuration Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_sink-members.html Configure audio codec, mono downmix, and output streams. ```APIDOC ## set_codec(A2DPCodec codec, void(*encoded_cb)(const uint8_t *data, size_t len)=nullptr) ### Description Sets the audio codec to be used for A2DP streaming and optionally provides a callback for encoded data. ### Method ## set_mono_downmix(bool enabled) ### Description Enables or disables mono downmix for the audio stream. ### Method inlinevirtual ## set_output(BluetoothA2DPOutput &output) ### Description Sets the A2DP output stream using a BluetoothA2DPOutput object. ### Method inline ## set_output(Print &output) ### Description Sets the output stream using a generic Print object. ### Method inline ## set_output(audio_tools::AudioOutput &output) ### Description Sets the output stream using an AudioOutput object from the audio_tools library. ### Method inline ## set_output(audio_tools::AudioStream &output) ### Description Sets the output stream using an AudioStream object from the audio_tools library. ### Method inline ``` -------------------------------- ### BluetoothA2DPSink::end Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_sink.html Ends the I2S Bluetooth sink. Optionally releases memory, which may prevent future starts. ```APIDOC ## BluetoothA2DPSink::end ### Description Ends the I2S Bluetooth sink with the specified name. If `release_memory` is true, the memory used by the sink will be freed, and a future start will not be possible. ### Method void ### Parameters - **release_memory** (bool) - Optional - If true, releases memory associated with the sink. ### Remarks Reimplemented from BluetoothA2DPCommon. ``` -------------------------------- ### A2DPDefaultVolumeControl Constructors Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_a2_d_p_default_volume_control.html Provides details on the constructors for the A2DPDefaultVolumeControl class, including the default constructor and a constructor that accepts a custom volume limit. ```APIDOC ## A2DPDefaultVolumeControl() ### Description Default constructor for the A2DPDefaultVolumeControl class. ### Constructor `A2DPDefaultVolumeControl()` ## A2DPDefaultVolumeControl(int32_t limit) ### Description Constructor with a custom volume factor clipping limit. ### Constructor `A2DPDefaultVolumeControl(int32_t limit)` ### Parameters #### Path Parameters - **limit** (int32_t) - Description: Custom volume factor clipping limit. ``` -------------------------------- ### Bluetooth Core Settings Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_sink-members.html Configure Bluetooth mode, discoverability, and event queue/stack sizes. ```APIDOC ## set_default_bt_mode(esp_bt_mode_t mode) ### Description Sets the default Bluetooth mode (e.g., Classic, BLE). ### Method inlinevirtual ## set_discoverability(esp_bt_discovery_mode_t d) ### Description Sets the discoverability mode for the Bluetooth device. ### Method virtual ## set_event_queue_size(int size) ### Description Sets the size of the event queue used by the Bluetooth module. ### Method inline ## set_event_stack_size(int size) ### Description Sets the stack size for the Bluetooth event task. ### Method inline ``` -------------------------------- ### write_audio() Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_sink_queued.html Outputs audio data, for example to I2S or to a queue. This method overrides a protected virtual method and is reimplemented from BluetoothA2DPSink. ```APIDOC ## write_audio() ### Description Outputs audio data, for example to I2S or to a queue. This method overrides a protected virtual method and is reimplemented from BluetoothA2DPSink. ### Method `size_t BluetoothA2DPSinkQueued::write_audio(const uint8_t * _data, size_t _size)` ### Parameters #### Path Parameters - **_data** (const uint8_t *) - Required - Pointer to the audio data buffer. - **_size** (size_t) - Required - The size of the audio data in bytes. ``` -------------------------------- ### Set AVRC Metadata Attribute Mask Source: https://pschatzmann.github.io/ESP32-A2DP/html/index.html Configure which AVRC metadata attributes to receive. Call this before starting the A2DP sink to filter metadata. ```cpp set_avrc_metadata_attribute_mask(ESP_AVRC_MD_ATTR_TITLE | ESP_AVRC_MD_ATTR_PLAYING_TIME); ``` -------------------------------- ### BluetoothA2DPSink Constructors Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_sink.html Provides different ways to construct a BluetoothA2DPSink object, allowing for various output methods including callbacks, I2S, AudioTools, and Arduino Print. ```APIDOC ## BluetoothA2DPSink() ### Description Default Constructor: output via callback or Legacy I2S. ### Method Constructor ### Endpoint N/A ### Parameters None ### Request Example None ### Response None ``` ```APIDOC ## BluetoothA2DPSink(audio_tools::AudioOutput &output) ### Description Output AudioOutput using AudioTools library. ### Method Constructor ### Endpoint N/A ### Parameters * **output** (audio_tools::AudioOutput&) - Reference to an AudioOutput object from the AudioTools library. ### Request Example None ### Response None ``` ```APIDOC ## BluetoothA2DPSink(audio_tools::AudioStream &output) ### Description Output AudioStream using AudioTools library. ### Method Constructor ### Endpoint N/A ### Parameters * **output** (audio_tools::AudioStream&) - Reference to an AudioStream object from the AudioTools library. ### Request Example None ### Response None ``` ```APIDOC ## BluetoothA2DPSink(BluetoothA2DPOutput &out) ### Description Define output scenario class. ### Method Constructor ### Endpoint N/A ### Parameters * **out** (BluetoothA2DPOutput&) - Reference to a BluetoothA2DPOutput object. ### Request Example None ### Response None ``` ```APIDOC ## BluetoothA2DPSink(Print &output) ### Description Output to Arduino Print. ### Method Constructor ### Endpoint N/A ### Parameters * **output** (Print&) - Reference to an Arduino Print object. ### Request Example None ### Response None ``` -------------------------------- ### BluetoothA2DPSink::previous Source: https://pschatzmann.github.io/ESP32-A2DP/html/functions_p.html Navigates to the previous track in the playback queue. ```APIDOC ## previous() BluetoothA2DPSink ### Description Navigates to the previous track. ### Method `previous()` ### Parameters None ### Response None specified. ``` -------------------------------- ### A2DPLinearVolumeControl Constructor Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_a2_d_p_linear_volume_control.html Initializes the A2DPLinearVolumeControl. The constructor sets the maximum volume factor to 128, enabling linear scaling. ```APIDOC ## A2DPLinearVolumeControl() ### Description Constructor that sets volumeFactorMax to 128 for linear scaling. ### Method Constructor ### Parameters None ``` -------------------------------- ### esp_a2d_connect() Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_sink_queued.html Initiates an A2DP connection to a specified peer device. This is an inline, overridden, protected, virtual, inherited method. ```APIDOC ## esp_a2d_connect() ### Description Initiates an A2DP connection to a specified peer device. ### Signature `esp_err_t BluetoothA2DPSink::esp_a2d_connect(esp_bd_addr_t _peer_)` ### Parameters - `_peer_` (esp_bd_addr_t): The Bluetooth address of the peer device to connect to. ### Remarks inlineoverrideprotectedvirtualinherited Implements BluetoothA2DPCommon. ``` -------------------------------- ### Other Configuration Methods Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_sink-members.html Miscellaneous configuration methods for Bluetooth A2DP Sink. ```APIDOC ## set_bluedroid_config_t(esp_bluedroid_config_t cfg) ### Description Sets the Bluedroid configuration structure. ### Method inline ## set_connectable(bool connectable) ### Description Sets whether the device should be connectable by other Bluetooth devices. ### Method inlinevirtual ## set_i2s_active(bool active) ### Description Activates or deactivates the I2S interface. ### Method protectedvirtual ## set_last_connection(esp_bd_addr_t bda) ### Description Sets the Bluetooth device address of the last successful connection. ### Method protectedvirtual ## set_max_write_delay_ms(int delay) ### Description Sets the maximum delay in milliseconds for write operations. ### Method inline ## set_max_write_size(int size) ### Description Sets the maximum size for write operations. ### Method inline ## set_mono_downmix(bool enabled) ### Description Enables or disables mono downmix for the audio stream. ### Method inlinevirtual ## set_on_audio_state_changed(void(*callBack)(esp_a2d_audio_state_t state, void *), void *obj=nullptr) ### Description Sets a callback function to be invoked when the audio state changes. ### Method virtual ## set_on_audio_state_changed_post(void(*callBack)(esp_a2d_audio_state_t state, void *), void *obj=nullptr) ### Description Sets a callback function to be invoked after the audio state has changed. ### Method virtual ## set_on_data_received(void(*callBack)()) ### Description Sets a callback function to be invoked when data is received. ### Method virtual ## set_on_volumechange(void(*callBack)(int)) ### Description Sets a callback function to be invoked when the volume changes. ### Method virtual ## set_output_active(bool flag) ### Description Activates or deactivates the audio output. ### Method inline ## set_output_active_by_state(bool active) ### Description Activates or deactivates the audio output based on the current state. ### Method inline ## set_peer_name_callback(void(*callback)(char *peer_name)) ### Description Sets a callback function to receive the name of the connected peer device. ### Method inlinevirtual ## set_reconnect_delay(int delay) ### Description Sets the delay in milliseconds before attempting to reconnect. ### Method inline ## set_reference(void *ref, int type=0) ### Description Sets a reference pointer for internal use. ### Method ## set_rssi_active(bool active) ### Description Activates or deactivates RSSI (Received Signal Strength Indicator) monitoring. ### Method inline ## set_rssi_callback(void(*callback)(esp_bt_gap_cb_param_t::read_rssi_delta_param &rssi)) ### Description Sets a callback function to receive RSSI updates. ### Method inlinevirtual ## set_scan_mode_connectable(bool connectable) ### Description Sets the scan mode to determine if the device is connectable. ### Method protectedvirtual ## set_scan_mode_connectable_default() ### Description Sets the scan mode to its default connectable state. ### Method inlineprotectedvirtual ## set_spp_active(bool flag) ### Description Activates or deactivates the SPP (Serial Port Profile) connection. ### Method inline ## set_spp_config(esp_spp_cfg_t cfg) ### Description Configures the SPP connection parameters. ### Method inline ## set_swap_lr_channels(bool swap) ### Description Enables or disables swapping of the left and right audio channels. ### Method inlinevirtual ## set_task_core(BaseType_t core) ### Description Sets the core on which the Bluetooth task will run. ### Method inline ## set_task_priority(UBaseType_t priority) ### Description Sets the priority of the Bluetooth task. ### Method inline ``` -------------------------------- ### A2DPDefaultVolumeControl Functions Source: https://pschatzmann.github.io/ESP32-A2DP/html/functions_s.html Functions for default volume control. ```APIDOC ## set_volume() ### Description Sets the volume using the default volume control. ### Method N/A (Function Signature) ### Endpoint N/A ### Parameters None explicitly documented. ### Request Example N/A ### Response N/A ``` -------------------------------- ### set_output (BluetoothA2DPOutput) Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_sink_queued.html Defines the output class. By default, BluetoothA2DPOutputDefault is used. ```APIDOC ## set_output (BluetoothA2DPOutput) ### Description Defines the output class: by default we use BluetoothA2DPOutputDefault. ### Method void ### Parameters #### Path Parameters - **output** (BluetoothA2DPOutput &) - Required - A reference to a BluetoothA2DPOutput object. ### Endpoint N/A (Method within a class) ``` -------------------------------- ### set_output Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_sink.html Configures the audio output for the A2DP sink. ```APIDOC ## set_output ### Description Configures the audio output for the A2DP sink. This function can accept different output types, including `AudioOutput`, `AudioStream`, `BluetoothA2DPOutput`, or an Arduino `Print` object. ### Method ``` void set_output(audio_tools::AudioOutput &output) void set_output(audio_tools::AudioStream &output) void set_output(BluetoothA2DPOutput &output) void set_output(Print &output) ``` ### Parameters * **output** (audio_tools::AudioOutput &) - An instance of `AudioOutput` to direct audio. * **output** (audio_tools::AudioStream &) - An instance of `AudioStream` to direct audio. * **output** (BluetoothA2DPOutput &) - An instance of `BluetoothA2DPOutput` to direct audio (default). * **output** (Print &) - An Arduino `Print` object to direct audio output. ``` -------------------------------- ### BluetoothA2DPSource() Source: https://pschatzmann.github.io/ESP32-A2DP/html/functions_b.html Constructor for the BluetoothA2DPSource class. ```APIDOC ## BluetoothA2DPSource() ### Description Constructor for the BluetoothA2DPSource class. ### Method Constructor ### Endpoint N/A ### Parameters None ### Request Example None ### Response None ### Response Example None ``` -------------------------------- ### BluetoothA2DPSink() Source: https://pschatzmann.github.io/ESP32-A2DP/html/functions_b.html Constructor for the BluetoothA2DPSink class. ```APIDOC ## BluetoothA2DPSink() ### Description Constructor for the BluetoothA2DPSink class. ### Method Constructor ### Endpoint N/A ### Parameters None ### Request Example None ### Response None ### Response Example None ``` -------------------------------- ### BluetoothA2DPOutputAudioTools Methods Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_output_audio_tools.html This section covers the public member functions of the BluetoothA2DPOutputAudioTools class, detailing how to initialize, configure, and manage Bluetooth A2DP audio output. ```APIDOC ## Public Member Functions ### `bool begin()` - **Description**: Initializes the BluetoothA2DPOutput. - **Method**: `bool begin()` - **Override**: `override virtual` - **Implements**: `BluetoothA2DPOutput` ### `void end()` - **Description**: Ends the BluetoothA2DPOutput session. - **Method**: `void end()` - **Override**: `override virtual` - **Implements**: `BluetoothA2DPOutput` ### `operator bool()` - **Description**: Converts the object to a boolean, likely indicating its operational status. - **Method**: `operator bool()` ### `void set_output(audio_tools::AudioOutput &output)` - **Description**: Sets the audio output to an `AudioOutput` object from the AudioTools library. - **Method**: `void set_output(audio_tools::AudioOutput &output)` - **Parameters**: `output` (audio_tools::AudioOutput&) - The audio output object. - **Reimplemented from**: `BluetoothA2DPOutput` ### `void set_output(audio_tools::AudioStream &output)` - **Description**: Sets the audio output to an `AudioStream` object from the AudioTools library. - **Method**: `void set_output(audio_tools::AudioStream &output)` - **Parameters**: `output` (audio_tools::AudioStream&) - The audio stream object. - **Reimplemented from**: `BluetoothA2DPOutput` ### `void set_output(Print &output)` - **Description**: Sets the audio output to an Arduino `Print` object. - **Method**: `void set_output(Print &output)` - **Parameters**: `output` (Print&) - The Print object. - **Reimplemented from**: `BluetoothA2DPOutput` ### `void set_output_active(bool active)` - **Description**: Activates or deactivates the audio output. - **Method**: `void set_output_active(bool active)` - **Parameters**: `active` (bool) - `true` to activate, `false` to deactivate. - **Override**: `override virtual` - **Implements**: `BluetoothA2DPOutput` ### `void set_sample_rate(int rate)` - **Description**: Sets the sample rate for the audio output. - **Method**: `void set_sample_rate(int rate)` - **Parameters**: `rate` (int) - The desired sample rate. - **Override**: `override virtual` - **Implements**: `BluetoothA2DPOutput` ### `size_t write(const uint8_t *data, size_t len)` - **Description**: Writes audio data to the output. - **Method**: `size_t write(const uint8_t *data, size_t len)` - **Parameters**: - `data` (const uint8_t*) - Pointer to the data buffer. - `len` (size_t) - The number of bytes to write. - **Override**: `override virtual` - **Implements**: `BluetoothA2DPOutput` ``` -------------------------------- ### A2DPDefaultVolumeControl Constructor Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_a2_d_p_default_volume_control.html Constructs an A2DPDefaultVolumeControl object with a custom volume factor clipping limit. ```APIDOC ## A2DPDefaultVolumeControl() ### Description Constructor with custom volume factor clipping limit. ### Parameters * **_limit** (int32_t) - Required - Maximum volume factor limit (must be less than 4096) ``` -------------------------------- ### A2DPVolumeControl Class Methods Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_a2_d_p_volume_control.html This section details the public member functions of the A2DPVolumeControl class, which allow users to interact with and control audio volume. ```APIDOC ## A2DPVolumeControl() ### Description Default constructor for the A2DPVolumeControl class. ### Method Constructor ### Parameters None ## int32_t get_volume_factor () ### Description Gets the current volume factor. ### Method GET ### Endpoint N/A (Class Method) ### Parameters None ### Response #### Success Response - **volume_factor** (int32_t) - The current volume factor. ## int32_t get_volume_factor_max () ### Description Gets the maximum volume factor value. ### Method GET ### Endpoint N/A (Class Method) ### Parameters None ### Response #### Success Response - **max_volume_factor** (int32_t) - The maximum volume factor. ## void set_enabled (bool enabled) ### Description Enables or disables volume control. ### Method POST ### Endpoint N/A (Class Method) ### Parameters #### Request Body - **enabled** (bool) - Required - True to enable, false to disable. ## void set_mono_downmix (bool enabled) ### Description Enables or disables mono downmix. ### Method POST ### Endpoint N/A (Class Method) ### Parameters #### Request Body - **enabled** (bool) - Required - True to enable, false to disable. ## virtual void set_volume (uint8_t volume)=0 ### Description Sets the volume level. This is a pure virtual function and must be implemented by derived classes. ### Method POST ### Endpoint N/A (Class Method) ### Parameters #### Request Body - **volume** (uint8_t) - Required - The desired volume level. ## virtual void update_audio_data (Frame *data, uint16_t frameCount) ### Description Updates audio data with volume control and optional mono downmix. This overload accepts Frame objects. ### Method POST ### Endpoint N/A (Class Method) ### Parameters #### Request Body - **data** (Frame *) - Required - Pointer to the audio data frames. - **frameCount** (uint16_t) - Required - The number of frames in the data. ## virtual void update_audio_data (uint8_t *data, uint16_t byteCount) ### Description Updates audio data with volume control and optional mono downmix. This overload accepts raw byte data. ### Method POST ### Endpoint N/A (Class Method) ### Parameters #### Request Body - **data** (uint8_t *) - Required - Pointer to the audio data bytes. - **byteCount** (uint16_t) - Required - The number of bytes in the data. ``` -------------------------------- ### set_volume (A2DPNoVolumeControl) Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_a2_d_p_no_volume_control.html This method in A2DPNoVolumeControl is an override that does nothing, as no volume setting is applied. ```APIDOC ## set_volume(uint8_t _volume) ### Description Override that does nothing - no volume setting. ### Parameters - **_volume** (uint8_t) - Required - Volume level (unused) ### Implements A2DPVolumeControl ``` -------------------------------- ### Sample Rate Configuration Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_sink-members.html Allows retrieval of the current sample rate and setting a callback for sample rate changes. ```APIDOC ## sample_rate() ### Description Retrieves the current audio sample rate. ### Method inlinevirtual ## set_sample_rate_callback(void(*callback)(uint16_t rate)) ### Description Sets a callback function to be invoked when the audio sample rate changes. ### Method inlinevirtual ``` -------------------------------- ### get_millis Source: https://pschatzmann.github.io/ESP32-A2DP/html/class_bluetooth_a2_d_p_common.html Returns the system time in milliseconds since the last boot. ```APIDOC ## get_millis() ### Description Provides the time in milliseconds since the last system boot. ### Method unsigned long ```