124b69d49SMatthias Ringwald /* 224b69d49SMatthias Ringwald * Copyright (C) 2023 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_SINK_H 3724b69d49SMatthias Ringwald #define LE_AUDIO_DEMO_UTIL_SINK_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 /** 4924b69d49SMatthias Ringwald * @brief Init sink functionality 5024b69d49SMatthias Ringwald * @param filename_wav 5124b69d49SMatthias Ringwald */ 5224b69d49SMatthias Ringwald void le_audio_demo_util_sink_init(const char * filename_wav); 5324b69d49SMatthias Ringwald 5424b69d49SMatthias Ringwald /** 5524b69d49SMatthias Ringwald * @brief Enable LC3plus if available for 10 ms frame duration 5624b69d49SMatthias Ringwald * @param enable 5724b69d49SMatthias Ringwald */ 5824b69d49SMatthias Ringwald void le_audio_demo_util_sink_enable_lc3plus(bool enable); 5924b69d49SMatthias Ringwald 6024b69d49SMatthias Ringwald /** 6124b69d49SMatthias Ringwald * @brief Configure unicast sink 6224b69d49SMatthias Ringwald * Supported num_streams x num_channels_per_stream configurations: 1 x 1, 1 x 2, 2 x 1 6324b69d49SMatthias Ringwald * @param num_streams 6424b69d49SMatthias Ringwald * @param num_channels_per_stream 6524b69d49SMatthias Ringwald * @param sampling_frequency_hz 6624b69d49SMatthias Ringwald * @param frame_duration 6724b69d49SMatthias Ringwald * @param octets_per_frame 6824b69d49SMatthias Ringwald * @param iso_interval_1250us 6924b69d49SMatthias Ringwald * @param flush_timeout 7024b69d49SMatthias Ringwald */ 7124b69d49SMatthias Ringwald void le_audio_demo_util_sink_configure_unicast(uint8_t num_streams, uint8_t num_channels_per_stream, uint32_t sampling_frequency_hz, 7224b69d49SMatthias Ringwald btstack_lc3_frame_duration_t frame_duration, uint16_t octets_per_frame, 7324b69d49SMatthias Ringwald uint32_t iso_interval_1250us, uint8_t flush_timeout); 7424b69d49SMatthias Ringwald 7524b69d49SMatthias Ringwald /** 7624b69d49SMatthias Ringwald * @brief Configure broadcast sink 7724b69d49SMatthias Ringwald * Supported num_streams x num_channels_per_stream configurations: 1 x 1, 1 x 2, 2 x 1 7824b69d49SMatthias Ringwald * @param num_streams 7924b69d49SMatthias Ringwald * @param num_channels_per_stream 8024b69d49SMatthias Ringwald * @param sampling_frequency_hz 8124b69d49SMatthias Ringwald * @param frame_duration 8224b69d49SMatthias Ringwald * @param octets_per_frame 8324b69d49SMatthias Ringwald * @param iso_interval_1250us 8424b69d49SMatthias Ringwald * @param pre_transmission_offset 8524b69d49SMatthias Ringwald */ 8624b69d49SMatthias Ringwald void le_audio_demo_util_sink_configure_broadcast(uint8_t num_streams, uint8_t num_channels_per_stream, uint32_t sampling_frequency_hz, 8724b69d49SMatthias Ringwald btstack_lc3_frame_duration_t frame_duration, uint16_t octets_per_frame, 8824b69d49SMatthias Ringwald uint32_t iso_interval_1250us, uint8_t pre_transmission_offset); 8924b69d49SMatthias Ringwald 9024b69d49SMatthias Ringwald /** 9124b69d49SMatthias Ringwald * @brief Process ISO packet 9224b69d49SMatthias Ringwald * @param stream_index 9324b69d49SMatthias Ringwald * @param packet 9424b69d49SMatthias Ringwald * @param size 9524b69d49SMatthias Ringwald */ 9624b69d49SMatthias Ringwald void le_audio_demo_util_sink_receive(uint8_t stream_index, uint8_t *packet, uint16_t size); 9724b69d49SMatthias Ringwald 9824b69d49SMatthias Ringwald /** 99*a18990d3SMatthias Ringwald * @brief Analyze counting ISO packets 100*a18990d3SMatthias Ringwald * @param stream_index 101*a18990d3SMatthias Ringwald * @param packet 102*a18990d3SMatthias Ringwald * @param size 103*a18990d3SMatthias Ringwald */ 104*a18990d3SMatthias Ringwald void le_audio_demo_util_sink_count(uint8_t stream_index, uint8_t *packet, uint16_t size); 105*a18990d3SMatthias Ringwald 106*a18990d3SMatthias Ringwald /** 10724b69d49SMatthias Ringwald * @brief Close sink: close wav file, stop playbacl 10824b69d49SMatthias Ringwald */ 10924b69d49SMatthias Ringwald void le_audio_demo_util_sink_close(void); 11024b69d49SMatthias Ringwald 11124b69d49SMatthias Ringwald #if defined __cplusplus 11224b69d49SMatthias Ringwald } 11324b69d49SMatthias Ringwald #endif 11424b69d49SMatthias Ringwald #endif // LE_AUDIO_DEMO_UTIL_SINK_H 115