### begin Method Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/class_pins_audio_kit_a_c101_class.html Starts the audio driver functionality. ```APIDOC ## virtual bool begin() ### Description Initializes and begins the operation of the audio driver. ### Method POST ### Endpoint N/A ### Parameters None ### Request Example None ### Response #### Success Response (200) - **result** (bool) - True if the driver started successfully, false otherwise. #### Response Example ```json { "result": true } ``` ``` -------------------------------- ### begin Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_audio_driver_combined.html Initializes and starts the audio processing. ```APIDOC ## begin ### Description Starts the audio processing using the provided codec configuration and pin definitions. ### Parameters - **codecCfg** (CodecConfig) - Required - The configuration settings for the codec. - **pins** (DriverPins) - Required - The pin definitions for the hardware. ### Response - **bool** - Returns true if the driver started successfully. ``` -------------------------------- ### Minimal Setup with Manual I2C Initialization Source: https://context7.com/pschatzmann/arduino-audio-driver/llms.txt Use NoPins for a minimal setup and initialize the Wire library manually before calling board.begin(). This is useful when you need to manage I2C initialization yourself. ```cpp #include "AudioBoard.h" #include // Create board with no predefined pins AudioBoard board(AudioDriverES8388, NoPins); void setup() { Serial.begin(115200); AudioDriverLogger.begin(Serial, AudioDriverLogLevel::Info); // Initialize I2C manually with default pins Wire.begin(); // Or with custom pins: Wire.begin(SDA_PIN, SCL_PIN); // Configure codec CodecConfig cfg; cfg.input_device = ADC_INPUT_LINE1; cfg.output_device = DAC_OUTPUT_ALL; cfg.i2s.bits = BIT_LENGTH_16BITS; cfg.i2s.rate = RATE_44K; // Start the board board.begin(cfg); board.setVolume(70); } void loop() {} ``` -------------------------------- ### begin() Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_audio_driver.html Initializes and starts the audio processing for the codec. ```APIDOC ## begin() ### Description Starts the audio processing for the codec using the provided configuration and pin definitions. ### Parameters - **codecCfg** (CodecConfig) - Required - Configuration settings for the codec. - **pins** (DriverPins) - Required - Pin definitions for the hardware interface. ### Response - **bool** - Returns true if the operation was successful, false otherwise. ``` -------------------------------- ### begin Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_audio_driver_c_s42448_class.html Initializes and starts the audio processing for the CS42448 driver. ```APIDOC ## begin ### Description Starts the audio processing sequence. ### Parameters #### Request Body - **codecCfg** (CodecConfig) - Required - Configuration settings for the codec - **pins** (DriverPins) - Required - Pin definitions for the driver ``` -------------------------------- ### AudioDriver::begin Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/_driver_8h_source.html Starts the audio processing with the given configuration and pins. ```APIDOC ## POST /audio/begin ### Description Starts the audio processing. ### Method POST ### Endpoint /audio/begin ### Parameters #### Request Body - **codecCfg** (CodecConfig) - Required - The codec configuration. - **pins** (DriverPins) - Required - The driver pin configuration. ### Request Example ```json { "codecCfg": { "sampleRate": 44100, "bitsPerSample": 16, "numChannels": 2 }, "pins": { "i2c_sda": 21, "i2c_scl": 22, "i2s_mck": 0, "i2s_bck": 1, "i2s_ws": 2, "i2s_dout": 3, "i2s_din": 4, "pa_power_pin": 5 } } ``` ### Response #### Success Response (200) - **success** (bool) - Indicates if the operation was successful. #### Response Example ```json { "success": true } ``` ``` -------------------------------- ### begin Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_audio_driver_c_s43l22_class.html Starts the audio processing. This method is an override from the base AudioDriver class. ```APIDOC ## POST /audio/begin ### Description Starts the audio processing. This method is an override from the base AudioDriver class. ### Method POST ### Endpoint /audio/begin ### Parameters #### Request Body - **codecCfg** (CodecConfig) - Required - The codec configuration. - **pins** (DriverPins&) - Required - A reference to the driver pins object. ### Request Example ```json { "codecCfg": { "sampleRate": 44100, "bitsPerSample": 16, "numChannels": 2, "i2s_port": 0 }, "pins": { "i2s_data": 32, "i2s_ws": 33, "i2s_sck": 34, "i2s_mck": 0 } } ``` ### Response #### Success Response (200) - **status** (string) - Indicates success or failure. #### Response Example ```json { "status": "success" } ``` ``` -------------------------------- ### Setup Pin Mode Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_pins_audio_kit_a_c101_class.html Initializes the pin mode settings. ```APIDOC ## POST /audio_driver/pins/setup ### Description Initializes the pin mode configurations for the audio driver. ### Method POST ### Endpoint /audio_driver/pins/setup ### Request Body This endpoint does not require a request body. ### Response #### Success Response (200) - **void** - This endpoint does not return a value upon success. ### Response Example ```json { "status": "success" } ``` ``` -------------------------------- ### begin() - Initialize Audio Driver Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_audio_driver_w_m8978_class.html Starts the audio processing by initializing the driver with codec configuration and pins. ```APIDOC ## begin() ### Description Starts the processing. Initializes the audio driver with the provided codec configuration and pin definitions. ### Method `bool begin(CodecConfig _codecCfg, DriverPins & _pins)` ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **_codecCfg** (CodecConfig) - Required - The configuration settings for the codec. - **_pins** (DriverPins &) - Required - A reference to the driver pins configuration. ### Request Example ```cpp // Assuming codecCfg and pins are already defined bool success = myDriver.begin(codecCfg, pins); ``` ### Response #### Success Response (true) - **bool** (true) - Indicates that the driver was successfully initialized. #### Error Response (false) - **bool** (false) - Indicates that the driver initialization failed. #### Response Example ```cpp // If initialization is successful // true // If initialization fails // false ``` ``` -------------------------------- ### AudioDriverLyratMiniClass Initialization and Hardware Setup Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/_driver_8h_source.html The begin method initializes the ES8311 DAC and optionally the ES7243 ADC based on the provided codec configuration. ```cpp bool begin(CodecConfig codecCfg, DriverPins& pins) { AD_LOGI("AudioDriverLyratMiniClass::begin"); p_pins = &pins; codec_cfg = codecCfg; // setup SPI for SD // pins.setSPIActiveForSD(codecCfg.sd_active); // Start ES8311 AD_LOGI("starting ES8311"); pins.begin(); dac.setPins(this->pins()); if (!dac.setConfig(codecCfg)) { AD_LOGE("setConfig failed"); return false; } setPAPower(true); setVolume(DRIVER_DEFAULT_VOLUME); // Start ES7243 if (codecCfg.input_device != ADC_INPUT_NONE) { AD_LOGI("starting ES7243"); adc.setPins(this->pins()); if (!adc.setConfig(codecCfg)) { AD_LOGE("adc.begin failed"); return false; } } return true; } ``` -------------------------------- ### AudioDriverPCM3168Class::begin Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_audio_driver_p_c_m3168_class.html Starts the audio processing with the given codec configuration and driver pins. ```APIDOC ## bool begin(CodecConfig _codecCfg, DriverPins & _pins) ### Description Starts the audio processing. This method is virtual and reimplemented in various derived classes. ### Method `virtual bool begin` ### Endpoint N/A ### Parameters - **_codecCfg** (CodecConfig) - The codec configuration. - **_pins** (DriverPins &) - A reference to the driver pins. ### Request Example ```cpp // Example usage (assuming codecCfg and pins are defined) // bool success = audioDriverPCM3168.begin(codecCfg, pins); ``` ### Response - **bool** - True if the process started successfully, false otherwise. ``` -------------------------------- ### Generic Pin Additions Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/_pins_8h_source.html Individual pin configuration examples using the addPin method. ```cpp addPin(PA, 21); addPin(LED, 22, 1); addPin(LED, 19, 2); ``` -------------------------------- ### Initialize Hardware Interfaces Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/_driver_pins_8h_source.html Initializes SPI and I2C interfaces, conditionally starting SD card functionality based on the active state. ```cpp if (tmp.function == PinFunction::SD) { if (sd_active) result &= tmp.begin(); else result &= tmp.begin(); } } } // setup i2c for (auto& tmp : i2c) { result &= tmp.begin(); } return result; } ``` -------------------------------- ### ES8311 Start Audio Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/es8311_8h_source.html Starts the audio processing on the ES8311 codec. Specify the operating mode. ```c error_t es8311_start(codec_mode_t mode); ``` -------------------------------- ### begin() Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_audio_driver_n_a_u8325_class.html Initializes the audio processing for the NAU8325 driver. ```APIDOC ## begin() ### Description Starts the processing for the NAU8325 audio driver. ### Parameters - **codecCfg** (CodecConfig) - Required - Configuration settings for the codec. - **pins** (DriverPins&) - Required - Hardware pin definitions. ### Response - **bool** - Returns true if initialization was successful, false otherwise. ``` -------------------------------- ### Functions Starting with 'p' Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/functions_func_p.html This section lists functions in the arduino-audio-driver library that start with the letter 'p'. Each function is linked to the class it belongs to. ```APIDOC ## Functions Starting with 'p' ### pinMode() - **Description**: Sets the mode of a digital pin. - **Belongs to Classes**: API_GPIO, GPIO, GPIOExt, TCA9555 ### pins() - **Description**: Retrieves information about pins. - **Belongs to Classes**: AudioBoard, AudioDriver, AudioDriverCS42448Class ### PinsAudioKitAC101Class() - **Description**: Constructor for PinsAudioKitAC101Class. - **Belongs to Class**: PinsAudioKitAC101Class ### PinsAudioKitEs8388v1Class() - **Description**: Constructor for PinsAudioKitEs8388v1Class. - **Belongs to Class**: PinsAudioKitEs8388v1Class ### PinsAudioKitEs8388v2Class() - **Description**: Constructor for PinsAudioKitEs8388v2Class. - **Belongs to Class**: PinsAudioKitEs8388v2Class ### pinsAvailable() - **Description**: Checks for available pins. - **Belongs to Classes**: PinsI2C, PinsSPI ### PinsESP32S3AISmartSpeakerClass() - **Description**: Constructor for PinsESP32S3AISmartSpeakerClass. - **Belongs to Class**: PinsESP32S3AISmartSpeakerClass ### PinsFunction() - **Description**: Represents a pin function. - **Belongs to Struct**: PinsFunction ### PinsI2C() - **Description**: Constructor for PinsI2C. - **Belongs to Struct**: PinsI2C ### PinsI2S() - **Description**: Constructor for PinsI2S. - **Belongs to Struct**: PinsI2S ### PinsLyrat42Class() - **Description**: Constructor for PinsLyrat42Class. - **Belongs to Class**: PinsLyrat42Class ### PinsLyrat43Class() - **Description**: Constructor for PinsLyrat43Class. - **Belongs to Class**: PinsLyrat43Class ### PinsLyratMiniClass() - **Description**: Constructor for PinsLyratMiniClass. - **Belongs to Class**: PinsLyratMiniClass ### PinsSPI() - **Description**: Constructor for PinsSPI. - **Belongs to Struct**: PinsSPI ### PinsSTM32F411DiscoClass() - **Description**: Constructor for PinsSTM32F411DiscoClass. - **Belongs to Class**: PinsSTM32F411DiscoClass ### pop_back() - **Description**: Removes the last element from a vector. - **Belongs to Class**: Vector< T > ### pop_front() - **Description**: Removes the first element from a vector. - **Belongs to Class**: Vector< T > ### pos() - **Description**: Returns the current position of the iterator. - **Belongs to Class**: Vector< T >::iterator ### push_back() - **Description**: Adds an element to the end of a vector. - **Belongs to Class**: Vector< T > ### push_front() - **Description**: Adds an element to the beginning of a vector. - **Belongs to Class**: Vector< T > ``` -------------------------------- ### AudioBoard::begin() Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/_audio_board_8h_source.html Initializes the AudioBoard and the underlying audio driver. ```APIDOC ## AudioBoard::begin() ### Description Initializes the `AudioBoard` and the underlying audio driver. It checks for null pins and then calls the `begin` method of the `AudioDriver`. Sets the default volume and marks the board as active. ### Method `bool begin()` ### Endpoint N/A (This is a class method, not an API endpoint) ### Parameters None ### Request Example ```cpp // Assuming audioBoard is an instance of AudioBoard // if (audioBoard.begin()) { // // Initialization successful // } ``` ### Response #### Success Response (true) - `true` (bool) - Indicates that the initialization was successful. #### Error Response (false) - `false` (bool) - Indicates that the initialization failed (e.g., null pins or driver initialization failure). #### Response Example ```json // On success: true // On failure: false ``` ``` -------------------------------- ### Get Volume for NAU8325 Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/_driver_8h_source.html Returns the current volume for the NAU8325. Since the NAU8325 does not support getting the volume, this function returns a dummy value of 100. ```cpp int getVolume() override { // NAU8325 doesn't have a getVolume, so return last set or dummy return 100; } ``` -------------------------------- ### Initialize Driver Pins Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/_driver_pins_8h_source.html Initializes the driver pins by setting up pin modes and configuring SPI interfaces. Logs the start of the process. ```cpp virtual bool begin() { AD_LOGD("DriverPins::begin"); // setup function pins setupPinMode(); // setup spi bool result = true; for (auto& [tmp] : spi) { ``` -------------------------------- ### begin Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_audio_driver_e_s7210_class.html Initializes the audio processing for the driver. ```APIDOC ## begin ### Description Starts the audio processing for the codec. ### Parameters #### Request Body - **codecCfg** (CodecConfig) - Required - Configuration settings for the codec. - **pins** (DriverPins) - Required - Pin definitions for the driver. ``` -------------------------------- ### begin Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_audio_driver_a_d1938_class.html Initializes the audio driver processing with the provided configuration and pin definitions. ```APIDOC ## begin ### Description Starts the processing. ### Parameters #### Request Body - **codecCfg** (CodecConfig) - Required - Configuration settings for the codec. - **pins** (DriverPins) - Required - Hardware pin definitions. ``` -------------------------------- ### setSPIActiveForSD() Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_pins_lyrat42_class.html Defines if SPI for SD should be started. ```APIDOC ## setSPIActiveForSD() ### Description Defines if SPI for SD should be started. By default, it is true. ### Method Not specified (likely a member function of a class) ### Endpoint Not applicable (this is a function call, not an API endpoint) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```cpp // Example usage (assuming an instance of the class exists) // driverPins.setSPIActiveForSD(true); ``` ### Response #### Success Response (200) - **void** - This function does not return a value. ``` -------------------------------- ### setSDMMCActive() Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_pins_lyrat42_class.html Defines if SPI for SD should be started. ```APIDOC ## setSDMMCActive() ### Description Defines if SPI for SD should be started. By default, it is true. ### Method Not specified (likely a member function of a class) ### Endpoint Not applicable (this is a function call, not an API endpoint) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```cpp // Example usage (assuming an instance of the class exists) // driverPins.setSDMMCActive(true); ``` ### Response #### Success Response (200) - **void** - This function does not return a value. ``` -------------------------------- ### setSDMMCActive Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_pins_e_s_p32_s3_a_i_smart_speaker_class.html Defines if SPI for SD should be started. ```APIDOC ## setSDMMCActive ### Description Defines if SPI for SD should be started (by default true). ### Parameters #### Request Body - **active** (bool) - Required - The active state for SDMMC. ``` -------------------------------- ### begin Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_pins_e_s_p32_s3_a_i_smart_speaker_class.html Initializes the driver pins. ```APIDOC ## begin ### Description Sets up all pins, for example by calling pinMode(). ### Returns - **bool** - Returns true if initialization was successful. ``` -------------------------------- ### DriverPins::setSPIActiveForSD() Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_driver_pins.html Defines if SPI for SD should be started. ```APIDOC ## DriverPins::setSPIActiveForSD() ### Description Defines if SPI for SD should be started (by default true). ### Method `void setSPIActiveForSD(bool _active_)` ### Parameters * **_active_** (bool) - The active state for SD SPI. ``` -------------------------------- ### AudioBoard::begin(CodecConfig cfg) Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/_audio_board_8h_source.html Initializes the AudioBoard with a specific CodecConfig. ```APIDOC ## AudioBoard::begin(CodecConfig cfg) ### Description Initializes the `AudioBoard` with a specific `CodecConfig`. This method sets the codec configuration and then calls the default `begin()` method to complete the initialization. ### Method `bool begin(CodecConfig cfg)` ### Endpoint N/A (This is a class method, not an API endpoint) ### Parameters #### Request Body - **cfg** (`CodecConfig`) - The configuration structure for the audio codec. ### Request Example ```cpp // Assuming audioBoard is an instance of AudioBoard and codecConfig is a CodecConfig object // if (audioBoard.begin(codecConfig)) { // // Initialization successful // } ``` ### Response #### Success Response (true) - `true` (bool) - Indicates that the initialization was successful. #### Error Response (false) - `false` (bool) - Indicates that the initialization failed. #### Response Example ```json // On success: true // On failure: false ``` ``` -------------------------------- ### DriverPins::setSDMMCActive Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/_driver_pins_8h_source.html Defines if SPI for SD should be started. ```APIDOC ## setSDMMCActive ### Description Defines if SPI for SD should be started (by default true). ### Method POST ### Endpoint /arduino-audio-driver/DriverPins/setSDMMCActive ### Parameters #### Request Body - **active** (boolean) - Required - Set to true to start SPI for SD, false otherwise. ### Request Example ```json { "active": true } ``` ### Response #### Success Response (200) - **status** (string) - Indicates success or failure of the operation. #### Response Example ```json { "status": "success" } ``` ``` -------------------------------- ### begin Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_audio_driver_lyrat_mini_class.html Initializes the audio processing. ```APIDOC ## begin ### Description Starts the audio processing sequence. ### Parameters #### Request Body - **codecCfg** (CodecConfig) - Required - Configuration settings for the codec. - **pins** (DriverPins) - Required - Pin definitions for the hardware interface. ``` -------------------------------- ### DriverPins::begin Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/_driver_pins_8h_source.html Sets up all pins, e.g., by calling pinMode(). ```APIDOC ## begin ### Description Sets up all pins e.g. by calling pinMode(). ### Method POST ### Endpoint /arduino-audio-driver/DriverPins/begin ### Parameters None ### Response #### Success Response (200) - **success** (boolean) - True if the driver initialization was successful, false otherwise. #### Response Example ```json { "success": true } ``` ``` -------------------------------- ### getOutput Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_audio_driver_c_s43l22_class.html Gets the current output device setting. ```APIDOC ## GET /audio/output ### Description Gets the current output device setting. ### Method GET ### Endpoint /audio/output ### Parameters #### Query Parameters - **output_device** (output_device_t) - Required - The output device to query. ### Response #### Success Response (200) - **output_value** (uint16_t) - The value representing the output device setting. #### Response Example ```json { "output_value": 1 } ``` ``` -------------------------------- ### DriverPins::isSPIActiveForSD Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/_driver_pins_8h_source.html Checks if SPI for SD should be started automatically. ```APIDOC ## isSPIActiveForSD ### Description Check if SPI for SD should be started automatically. ### Method GET ### Endpoint /arduino-audio-driver/DriverPins/isSPIActiveForSD ### Parameters None ### Response #### Success Response (200) - **active** (boolean) - True if SPI for SD is set to be started automatically, false otherwise. #### Response Example ```json { "active": false } ``` ``` -------------------------------- ### Begin Audio Driver Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/class_pins_audio_kit_es8388v1_class.html Initializes the audio driver with the configured pins. ```APIDOC ## begin() ### Description Initializes the audio driver. This method should be called after configuring all necessary pins. ### Method `virtual bool begin()` ### Endpoint N/A ### Parameters None ### Request Example ```cpp if (pins.begin()) { // Audio driver started successfully } else { // Failed to start audio driver } ``` ### Response #### Success Response (true) - Returns `true` if the audio driver was successfully initialized. #### Error Response (false) - Returns `false` if the initialization failed. ``` -------------------------------- ### Demonstrate Predefined Audio Boards Source: https://context7.com/pschatzmann/arduino-audio-driver/llms.txt Initialize various predefined audio boards with a common codec configuration. This example shows how to select different board types like AI Thinker, Espressif LyraT, and others. ```cpp #include "AudioBoard.h" void demonstrateBoards() { CodecConfig cfg; cfg.input_device = ADC_INPUT_LINE1; cfg.output_device = DAC_OUTPUT_ALL; cfg.i2s.bits = BIT_LENGTH_16BITS; cfg.i2s.rate = RATE_44K; // AI Thinker AudioKit boards (ES8388 or AC101) AudioKitEs8388V1.begin(cfg); // ES8388 variant 1 (most common) // AudioKitEs8388V2.begin(cfg); // ES8388 variant 2 // AudioKitAC101.begin(cfg); // AC101 variant // Espressif LyraT boards (ES8388) // LyratV43.begin(cfg); // LyraT v4.3 // LyratV42.begin(cfg); // LyraT v4.2 // Espressif LyraT Mini (ES8311 + ES7243) // LyratMini.begin(cfg); // ESP32-S3 AI Smart Speaker (ES8311 + ES7210) // ESP32S3AISmartSpeaker.begin(cfg); // M5Stack Atom Echo S3R (ES8311) // M5stackAtomEchoS3R.begin(cfg); // Generic drivers (requires manual pin setup) // GenericWM8960.begin(cfg); // GenericCS43l22.begin(cfg); } ``` -------------------------------- ### AudioDriver begin Method Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_audio_driver_p_c_m3168_class.html Initializes the audio processing with the provided codec configuration and pin definitions. ```cpp virtual bool begin(CodecConfig codecCfg, DriverPins &pins) ``` -------------------------------- ### Get Audio Volume Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/_driver_8h_source.html Retrieves the current audio output volume setting. ```cpp int [getVolume](classaudio__driver_1_1_audio_driver_w_m8978_class.html#a016f575b7c0ff5b13cb1b907f66de665)() override { return [volume](classaudio__driver_1_1_audio_driver_w_m8978_class.html#aed48ca0bcd2162fd4fd495873e2631f5); } ``` -------------------------------- ### setupPinMode() Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_pins_lyrat42_class.html Sets up the pin mode. ```APIDOC ## setupPinMode() ### Description Sets up the pin mode. ### Method Not specified (likely a member function of a class) ### Endpoint Not applicable (this is a function call, not an API endpoint) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```cpp // Example usage (assuming an instance of the class exists) // driverPins.setupPinMode(); ``` ### Response #### Success Response (200) - **void** - This function does not return a value. ``` -------------------------------- ### AudioDriverAC101Class Get Volume Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/_driver_8h_source.html Retrieves the current voice volume from the AC101 codec. ```cpp int getVolume() { int vol; ac101_get_voice_volume(&vol); return vol; } ``` -------------------------------- ### setupPinMode Method Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_pins_lyrat43_class.html Sets up the pin modes for the audio driver. ```APIDOC ## setupPinMode() ### Description Configures the operating mode for the pins used by the audio driver. ### Method `void setupPinMode()` ### Endpoint N/A ### Parameters None ### Request Example N/A ### Response N/A ``` -------------------------------- ### GET isVolumeSupported Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_audio_driver_e_s8388_class.html Determines if the volume control is supported by the current audio driver. ```APIDOC ## GET isVolumeSupported ### Description Checks if the setVolume() function is supported by the hardware driver. ### Method GET ### Response #### Success Response (200) - **result** (bool) - Returns true if volume control is supported, false otherwise. ``` -------------------------------- ### AudioBoard Initialization Methods Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/_audio_board_8h_source.html Methods to initialize the audio board and configure codec settings. ```cpp bool begin(){ AD_LOGD("AudioBoard::begin"); if (p_pins==nullptr){ AD_LOGE("pins are null"); return false; } if (!p_driver->begin(codec_cfg, *p_pins)){ AD_LOGE("AudioBoard::driver::begin failed"); return false; } setVolume(DRIVER_DEFAULT_VOLUME); is_active = true; return true; } ``` ```cpp bool begin(CodecConfig cfg) { this->codec_cfg = cfg; return begin(); } ``` ```cpp bool setConfig(CodecConfig cfg) { this->codec_cfg = cfg; ``` -------------------------------- ### Audio Driver Volume Control Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_audio_driver_e_s7210_class.html Methods for getting and checking volume support. ```APIDOC ## GET /api/audio/volume ### Description Retrieves the current volume level (range: 0-100). ### Method GET ### Endpoint /api/audio/volume ### Response #### Success Response (200) - **volume** (int) - The current volume level. #### Response Example { "volume": 75 } ## GET /api/audio/volume/supported ### Description Determines if volume control is supported by the audio driver. ### Method GET ### Endpoint /api/audio/volume/supported ### Response #### Success Response (200) - **supported** (bool) - True if volume control is supported, false otherwise. #### Response Example { "supported": true } ## GET /api/audio/input-volume/supported ### Description Determines if input volume control is supported by the audio driver. ### Method GET ### Endpoint /api/audio/input-volume/supported ### Response #### Success Response (200) - **supported** (bool) - True if input volume control is supported, false otherwise. #### Response Example { "supported": true } ``` -------------------------------- ### Get SPI Pins Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/class_pins_audio_kit_es8388v1_class.html Retrieves the configured SPI pins for a given function. ```APIDOC ## getSPIPins() ### Description Retrieves the configured SPI pins associated with a specific function. ### Method `Optional getSPIPins(PinFunctionEnum function)` ### Endpoint N/A ### Parameters - **function** (PinFunctionEnum) - The function to query SPI pins for. ### Request Example ```cpp Optional spi_config = pins.getSPIPins(CODEC); if (spi_config.has_value()) { // Access pins: spi_config.value().clk, spi_config.value().miso, etc. } ``` ### Response #### Success Response - Returns an `Optional` object containing the SPI pin configuration if found. #### Response Example ```json { "function": "CODEC", "clk": "PA5", "miso": "PA6", "mosi": "PA7", "cs": "PA4" } ``` ``` -------------------------------- ### init Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_audio_driver_e_s7243_class.html Initializes the audio driver with the provided codec configuration. ```APIDOC ## POST /init ### Description Initializes the audio driver using the specified codec configuration. ### Parameters #### Request Body - **codec_cfg** (codec_config_t) - Required - The configuration settings for the audio codec. ### Response #### Success Response (200) - **status** (bool) - Returns true if initialization was successful. ``` -------------------------------- ### AudioDriver::begin Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/_driver_8h_source.html Initializes the AudioDriver with the specified codec configuration and driver pins. ```APIDOC ## POST /api/audio/begin ### Description Initializes the AudioDriver, setting up GPIO, I2C addresses, and configuring SD/SDMMC interfaces based on the provided codec configuration and driver pins. ### Method POST ### Endpoint /api/audio/begin ### Parameters #### Request Body - **codecCfg** (CodecConfig) - Required - The configuration settings for the audio codec. - **sd_active** (bool) - Required - Indicates if the SD card is active. - **sdmmc_active** (bool) - Required - Indicates if the SDMMC interface is active. - **pins** (DriverPins&) - Required - An object containing the driver pin configurations. ### Request Example ```json { "codecCfg": { "sd_active": true, "sdmmc_active": false }, "pins": { // ... driver pin configurations ... } } ``` ### Response #### Success Response (200) - **success** (bool) - Indicates if the initialization was successful. #### Response Example ```json { "success": true } ``` ``` -------------------------------- ### Get I2C Pins Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/class_pins_audio_kit_es8388v1_class.html Retrieves the configured I2C pins for a given function. ```APIDOC ## getI2CPins() ### Description Retrieves the configured I2C pins associated with a specific function. ### Method `Optional getI2CPins(PinFunctionEnum function)` ### Endpoint N/A ### Parameters - **function** (PinFunctionEnum) - The function to query I2C pins for. ### Request Example ```cpp Optional i2c_config = pins.getI2CPins(CODEC); if (i2c_config.has_value()) { // Access pins: i2c_config.value().scl, i2c_config.value().sda } ``` ### Response #### Success Response - Returns an `Optional` object containing the I2C pin configuration if found. #### Response Example ```json { "scl": "PB6", "sda": "PB7" } ``` ``` -------------------------------- ### init() - Initialize with Codec Configuration Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_audio_driver_w_m8978_class.html Initializes the audio driver with a specific codec configuration. ```APIDOC ## init() ### Description Initializes the audio driver with the provided codec configuration. ### Method `virtual bool init(codec_config_t codec_cfg)` ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **codec_cfg** (codec_config_t) - Required - The configuration structure for the codec. ### Request Example ```cpp // Assuming codec_cfg is defined bool initialized = myDriver.init(codec_cfg); ``` ### Response #### Success Response (true) - **bool** (true) - Indicates successful initialization. #### Error Response (false) - **bool** (false) - Indicates that initialization failed. #### Response Example ```cpp // If initialization is successful // true // If initialization fails // false ``` ``` -------------------------------- ### Get Driver Pins Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/_audio_board_8h_source.html Returns a reference to the currently configured pin object. ```cpp DriverPins& getPins() { return *p_pins; } ``` -------------------------------- ### Set SPI Active for SD Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_pins_audio_kit_a_c101_class.html Defines if SPI for SD should be started (by default true). ```APIDOC ## PUT /audio_driver/pins/spi/sd/active ### Description Controls the activation of SPI specifically for SD card operations. ### Method PUT ### Endpoint /audio_driver/pins/spi/sd/active ### Request Body - **active** (bool) - Required - Set to true to activate SPI for SD, false otherwise. ### Response #### Success Response (200) - **void** - This endpoint does not return a value upon success. ### Request Example ```json { "active": true } ``` ``` -------------------------------- ### Pins Class - begin Method Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/class_pins.html Initializes the pin configurations. ```APIDOC ## bool begin() ### Description Initializes the pin configurations managed by the Pins class. ### Method bool ### Endpoint N/A (Class Method) ### Parameters None ### Request Example ```cpp // Example usage (assuming Pins object 'myPins' exists) // if (myPins.begin()) { // // Initialization successful // } ``` ### Response #### Success Response (bool) - **true** if initialization was successful. - **false** if initialization failed. #### Response Example ```cpp // true ``` ``` -------------------------------- ### Set SDMMC Active State Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_pins_audio_kit_a_c101_class.html Defines if SPI for SD should be started (by default true). ```APIDOC ## PUT /audio_driver/pins/sdmmc/active ### Description Controls the activation of SPI for SD card operations. ### Method PUT ### Endpoint /audio_driver/pins/sdmmc/active ### Request Body - **active** (bool) - Required - Set to true to activate SPI for SD, false otherwise. ### Response #### Success Response (200) - **void** - This endpoint does not return a value upon success. ### Request Example ```json { "active": true } ``` ``` -------------------------------- ### Initialize and Configure WM8960 Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/_driver_8h_source.html Initializes the codec hardware, activates the device, and configures clocking. Returns false if any step fails. ```cpp int features = getFeatures(codecCfg); if (!mtb_wm8960_init(features)) { AD_LOGE("mtb_wm8960_init"); return false; } setVolume(DRIVER_DEFAULT_VOLUME); if (!mtb_wm8960_activate()) { AD_LOGE("mtb_wm8960_activate"); return false; } if (!configure_clocking()) { AD_LOGE("configure_clocking"); return false; } return true; } ``` -------------------------------- ### Initialization and Configuration Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_audio_driver_c_s42448_class.html Functions for initializing the audio driver and setting its configuration. ```APIDOC ## POST /api/audio/init ### Description Initializes the audio driver with the provided codec configuration. ### Method POST ### Endpoint /api/audio/init ### Parameters #### Request Body - **codecCfg** (object) - Required - The codec configuration object. - **sampleRate** (int) - Required - The sample rate for the codec. - **bitDepth** (int) - Required - The bit depth for the codec. - **numChannels** (int) - Required - The number of audio channels. ### Request Example ```json { "codecCfg": { "sampleRate": 44100, "bitDepth": 16, "numChannels": 2 } } ``` ### Response #### Success Response (200) - **initialized** (bool) - True if initialization was successful, false otherwise. #### Response Example ```json { "initialized": true } ``` ## PUT /api/audio/config ### Description Changes the configuration of the audio driver. ### Method PUT ### Endpoint /api/audio/config ### Parameters #### Request Body - **codecCfg** (object) - Required - The new codec configuration object. - **sampleRate** (int) - Required - The sample rate for the codec. - **bitDepth** (int) - Required - The bit depth for the codec. - **numChannels** (int) - Required - The number of audio channels. ### Request Example ```json { "codecCfg": { "sampleRate": 48000, "bitDepth": 24, "numChannels": 2 } } ``` ### Response #### Success Response (200) - **configured** (bool) - True if the configuration was changed successfully, false otherwise. #### Response Example ```json { "configured": true } ``` ``` -------------------------------- ### DriverPins::setupPinMode() Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_driver_pins.html Sets up the pin mode. ```APIDOC ## DriverPins::setupPinMode() ### Description Sets up the pin mode. ### Method `void setupPinMode()` ``` -------------------------------- ### AudioDriverES8311Class::begin Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_audio_driver_e_s8311_class.html Starts the audio driver processing with the specified codec configuration and pins. ```APIDOC ## bool begin(CodecConfig _codecCfg, DriverPins & _pins) ### Description Starts the processing with the given codec configuration and driver pins. ### Method Virtual ### Endpoint N/A ### Parameters - **_codecCfg** (CodecConfig) - The codec configuration object. - **_pins** (DriverPins &) - A reference to the driver pins object. ### Request Example N/A ### Response - **bool** - Returns true if the operation was successful, false otherwise. ``` -------------------------------- ### AudioDriverES8156Class::begin Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_audio_driver_e_s8156_class.html Starts the audio driver processing with the specified codec configuration and pins. ```APIDOC ## bool begin(CodecConfig _codecCfg, DriverPins & _pins) ### Description Starts the audio driver processing. This method initializes the driver with the provided codec configuration and pin definitions. ### Method `virtual bool` ### Endpoint N/A ### Parameters - **_codecCfg** (CodecConfig) - The configuration settings for the codec. - **_pins** (DriverPins &) - A reference to the driver pin definitions. ### Request Example ```cpp // Assuming codecCfg and pins are already defined bool success = myDriver.begin(codecCfg, pins); ``` ### Response - **bool** - Returns `true` if the driver started successfully, `false` otherwise. ``` -------------------------------- ### Configuration and Hardware Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_audio_driver_a_d1938_class.html Methods for initializing the driver, configuring codecs, and managing hardware pins. ```APIDOC ## init ### Description Initializes the audio driver with the provided codec configuration. ## setConfig ### Description Changes the current configuration of the audio driver. ## pins ### Description Provides access to the driver pin information. ## setPAPower ### Description Sets the PA Power pin to active or inactive. ``` -------------------------------- ### Get Master Volume for AD1938 Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/_driver_8h_source.html Retrieves the current master volume setting for the AD1938. ```cpp int getVolume() override { return volume; } ``` -------------------------------- ### Initializing Hardware Components Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/_e_s_p32_s3_a_i_smart_speaker_8h_source.html Overrides the begin method to initialize the driver and manage SD card or SDMMC activation states. ```cpp bool begin() override { AD_LOGD("PinsESP32S3AISmartSpeakerClass::begin"); bool rc = DriverPins::begin(); // activate SD CS if (sd_active) { AD_LOGD("Activate SD CS"); tca9555.digitalWrite(EXIO4, true); // activate SD CS } // activate SDMMC if (sdmmc_active) { AD_LOGD("Activate SDMMC"); if (!SD_MMC.setPins(40, 42, 41, -1, -1, -1)) { AD_LOGE("SDMMC setPins failed"); } tca9555.digitalWrite(EXIO4, true); // deactivate SD CS } return rc; } ``` -------------------------------- ### Get DAC Volume Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/_driver_8h_source.html Retrieves the current playback volume of the DAC. This function is an override. ```cpp int AudioDriverCombined::getVolume() override { return p_dac->getVolume(); } ``` -------------------------------- ### Get WM8978 Driver Instance Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/_driver_8h_source.html Returns a reference to the underlying WM8978 driver object. ```cpp WM8978& [driver](classaudio__driver_1_1_audio_driver_w_m8978_class.html#aa96f9a67b68f169a92195a760ffe894f)() { return [wm8078](classaudio__driver_1_1_audio_driver_w_m8978_class.html#acacc5a1cde1e90163709690a7fca38a9); } ``` -------------------------------- ### AudioDriverCS43l22Class::begin Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/_driver_8h_source.html Initializes the CS43l22 codec with the provided configuration and pins. This method sets up the codec for audio playback. ```APIDOC ## AudioDriverCS43l22Class::begin ### Description Initializes the CS43l22 codec with the provided configuration and pins. This method sets up the codec for audio playback. ### Method virtual bool ### Endpoint N/A (Class method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **codecCfg** (CodecConfig) - Required - The configuration settings for the codec. - **pins** (DriverPins&) - Required - A reference to the driver pins configuration. ### Request Example None ### Response #### Success Response (true) - **bool** (true) - Indicates successful initialization. #### Response Example ```json { "example": "true" } ``` ``` -------------------------------- ### Volume Hack Accessors Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/_driver_8h_source.html Methods to get and set the volume hack configuration value. ```cpp void setVolumeHack(int volume_hack) { this->volume_hack = volume_hack; } int getVolumeHack() { return volume_hack; } ``` -------------------------------- ### setupPinMode Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/classaudio__driver_1_1_pins_lyrat43_class.html Initializes the pin modes for the driver. ```APIDOC ## setupPinMode ### Description Configures the pin modes for the hardware interface. ``` -------------------------------- ### Get Audio Driver Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/_audio_board_8h_source.html Returns a pointer to the currently assigned audio driver object. ```cpp AudioDriver* getDriver(){ return p_driver; } ``` -------------------------------- ### Install Library via Git Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/src/Driver/wm8960/README.md Commands to clone the repository into the Arduino libraries directory. ```bash cd ~/Documents/Arduino/libraries git clone pschatzmann/arduino-wm8960.git ``` -------------------------------- ### setupI2CAddress() Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/functions_func_s.html Configures the I2C address for the audio driver. ```APIDOC ## setupI2CAddress() ### Description Sets the I2C address used by the audio driver to communicate with the codec. ### Method void ### Parameters #### Request Body - **address** (uint8_t) - Required - The I2C address. ``` -------------------------------- ### Initialize WM8978 Audio Driver Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/_driver_8h_source.html The begin method initializes the I2C interface, sets the codec configuration, and applies default volume settings. ```cpp bool begin(CodecConfig codecCfg, DriverPins& pins) override { bool rc = true; rc = wm8078.begin(getI2C(), getI2CAddress()); setConfig(codecCfg); // setup initial default volume setVolume(DRIVER_DEFAULT_VOLUME); return rc; } ``` -------------------------------- ### Get WM8994 Audio Volume Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/_driver_8h_source.html Retrieves the current volume setting for the WM8994 audio driver. ```cpp int getVolume() { return volume; } ``` -------------------------------- ### Volume Hack Configuration Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/_driver_8h_source.html Methods to get and set the volume hack value for the audio driver. ```APIDOC ## setVolumeHack ### Description Sets the volume hack value. ### Parameters - **volume_hack** (int) - Required - The volume hack integer value. ## getVolumeHack ### Description Retrieves the current volume hack value. ### Response - **int** - The current volume hack value. ``` -------------------------------- ### AudioDriver Configuration and Initialization Source: https://github.com/pschatzmann/arduino-audio-driver/blob/main/docs/html/_driver_8h_source.html Methods for setting up the audio driver configuration and initializing the codec. ```cpp 215 AD_LOGE("AudioBoard::pins::begin failed"); 216 return false; 217 } 218 219 if (!setConfig(codecCfg)) { 220 AD_LOGE("setConfig has failed"); 221 return false; 222 } 223 setPAPower(true); 224 // setup default volume 225 setVolume(DRIVER_DEFAULT_VOLUME); 226 return true; 227 } ``` ```cpp 230 virtual bool setConfig(CodecConfig codecCfg) { 231 AD_LOGI("AudioDriver::setConfig"); 232 codec_cfg = codecCfg; 233 if (!init(codec_cfg)) { 234 AD_LOGE("AudioDriver init failed"); 235 return false; 236 } 237 codec_mode_t codec_mode = codec_cfg.get_mode(); 238 if (!controlState(codec_mode)) { 239 AD_LOGE("AudioDriver controlState failed"); 240 return false; 241 } 242 bool result = configInterface(codec_mode, codec_cfg.i2s); 243 if (!result) { 244 AD_LOGE("AudioDriver configInterface failed"); 245 return false; 246 } 247 return result; 248 } ```