124b69d49SMatthias Ringwald /* 224b69d49SMatthias Ringwald * Copyright (C) {copyright_year} BlueKitchen GmbH 324b69d49SMatthias Ringwald * 424b69d49SMatthias Ringwald * Redistribution and use in source and binary forms, with or without 524b69d49SMatthias Ringwald * modification, are permitted provided that the following conditions 624b69d49SMatthias Ringwald * are met: 724b69d49SMatthias Ringwald * 824b69d49SMatthias Ringwald * 1. Redistributions of source code must retain the above copyright 924b69d49SMatthias Ringwald * notice, this list of conditions and the following disclaimer. 1024b69d49SMatthias Ringwald * 2. Redistributions in binary form must reproduce the above copyright 1124b69d49SMatthias Ringwald * notice, this list of conditions and the following disclaimer in the 1224b69d49SMatthias Ringwald * documentation and/or other materials provided with the distribution. 1324b69d49SMatthias Ringwald * 3. Neither the name of the copyright holders nor the names of 1424b69d49SMatthias Ringwald * contributors may be used to endorse or promote products derived 1524b69d49SMatthias Ringwald * from this software without specific prior written permission. 1624b69d49SMatthias Ringwald * 1724b69d49SMatthias Ringwald * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 1824b69d49SMatthias Ringwald * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1924b69d49SMatthias Ringwald * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 2024b69d49SMatthias Ringwald * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN 2124b69d49SMatthias Ringwald * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 2224b69d49SMatthias Ringwald * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 2324b69d49SMatthias Ringwald * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 2424b69d49SMatthias Ringwald * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 2524b69d49SMatthias Ringwald * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 2624b69d49SMatthias Ringwald * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 2724b69d49SMatthias Ringwald * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2824b69d49SMatthias Ringwald * SUCH DAMAGE. 2924b69d49SMatthias Ringwald * 3024b69d49SMatthias Ringwald */ 3124b69d49SMatthias Ringwald 3224b69d49SMatthias Ringwald /** 3324b69d49SMatthias Ringwald * @brief Send/receive isochronous audio, used by le_audio_* demos 3424b69d49SMatthias Ringwald */ 3524b69d49SMatthias Ringwald 3624b69d49SMatthias Ringwald #ifndef LE_AUDIO_DEMO_UTIL_SOURCE_H 3724b69d49SMatthias Ringwald #define LE_AUDIO_DEMO_UTIL_SOURCE_H 3824b69d49SMatthias Ringwald 3924b69d49SMatthias Ringwald #include <stdint.h> 4024b69d49SMatthias Ringwald #include "bluetooth.h" 4124b69d49SMatthias Ringwald #include "btstack_bool.h" 4224b69d49SMatthias Ringwald #include "btstack_lc3.h" 4324b69d49SMatthias Ringwald 4424b69d49SMatthias Ringwald #if defined __cplusplus 4524b69d49SMatthias Ringwald extern "C" { 4624b69d49SMatthias Ringwald #endif 4724b69d49SMatthias Ringwald 4824b69d49SMatthias Ringwald typedef enum { 4924b69d49SMatthias Ringwald AUDIO_SOURCE_COUNTER, 5024b69d49SMatthias Ringwald AUDIO_SOURCE_SINE, 5165e76442SMatthias Ringwald AUDIO_SOURCE_MODPLAYER, 5265e76442SMatthias Ringwald AUDIO_SOURCE_RECORDING, 53*b9151789SMatthias Ringwald AUDIO_SOURCE_LOOPBACK, 5424b69d49SMatthias Ringwald } le_audio_demo_source_generator; 5524b69d49SMatthias Ringwald 5624b69d49SMatthias Ringwald /** 5724b69d49SMatthias Ringwald * @brief Init source functionality 5824b69d49SMatthias Ringwald */ 5924b69d49SMatthias Ringwald void le_audio_demo_util_source_init(void); 6024b69d49SMatthias Ringwald 6124b69d49SMatthias Ringwald /** 6224b69d49SMatthias Ringwald * @brief Configure audio source 6324b69d49SMatthias Ringwald * Supported num_streams x num_channels_per_stream configurations: 1 x 1, 1 x 2, 2 x 1 6424b69d49SMatthias Ringwald * @param num_streams 6524b69d49SMatthias Ringwald * @param num_channels_per_stream 6624b69d49SMatthias Ringwald * @param sampling_frequency_hz 6724b69d49SMatthias Ringwald * @param frame_duration 6824b69d49SMatthias Ringwald * @param octets_per_frame 6924b69d49SMatthias Ringwald */ 7024b69d49SMatthias Ringwald void le_audio_demo_util_source_configure(uint8_t num_streams, uint8_t num_channels_per_stream, uint32_t sampling_frequency_hz, 7124b69d49SMatthias Ringwald btstack_lc3_frame_duration_t frame_duration, uint16_t octets_per_frame); 7224b69d49SMatthias Ringwald /** 7324b69d49SMatthias Ringwald * @brief Generate audio and encode as ISO frame 7424b69d49SMatthias Ringwald * @param channel 7524b69d49SMatthias Ringwald * @param generator 7624b69d49SMatthias Ringwald */ 7724b69d49SMatthias Ringwald 7824b69d49SMatthias Ringwald void le_audio_demo_util_source_generate_iso_frame(le_audio_demo_source_generator generator); 7924b69d49SMatthias Ringwald 8024b69d49SMatthias Ringwald /** 8124b69d49SMatthias Ringwald * @brief Send prepared ISO packet 8224b69d49SMatthias Ringwald * @param stream_index 8324b69d49SMatthias Ringwald * @param con_handle 8424b69d49SMatthias Ringwald */ 8524b69d49SMatthias Ringwald void le_audio_demo_util_source_send(uint8_t stream_index, hci_con_handle_t con_handle); 8624b69d49SMatthias Ringwald 8724b69d49SMatthias Ringwald /** 8824b69d49SMatthias Ringwald * @brief Close source 8924b69d49SMatthias Ringwald */ 9024b69d49SMatthias Ringwald void le_audio_demo_util_source_close(void); 9124b69d49SMatthias Ringwald 9224b69d49SMatthias Ringwald #if defined __cplusplus 9324b69d49SMatthias Ringwald } 9424b69d49SMatthias Ringwald #endif 9524b69d49SMatthias Ringwald #endif // LE_AUDIO_DEMO_UTIL_SOURCE_H 96