1*24b69d49SMatthias Ringwald /* 2*24b69d49SMatthias Ringwald * Copyright (C) 2023 BlueKitchen GmbH 3*24b69d49SMatthias Ringwald * 4*24b69d49SMatthias Ringwald * Redistribution and use in source and binary forms, with or without 5*24b69d49SMatthias Ringwald * modification, are permitted provided that the following conditions 6*24b69d49SMatthias Ringwald * are met: 7*24b69d49SMatthias Ringwald * 8*24b69d49SMatthias Ringwald * 1. Redistributions of source code must retain the above copyright 9*24b69d49SMatthias Ringwald * notice, this list of conditions and the following disclaimer. 10*24b69d49SMatthias Ringwald * 2. Redistributions in binary form must reproduce the above copyright 11*24b69d49SMatthias Ringwald * notice, this list of conditions and the following disclaimer in the 12*24b69d49SMatthias Ringwald * documentation and/or other materials provided with the distribution. 13*24b69d49SMatthias Ringwald * 3. Neither the name of the copyright holders nor the names of 14*24b69d49SMatthias Ringwald * contributors may be used to endorse or promote products derived 15*24b69d49SMatthias Ringwald * from this software without specific prior written permission. 16*24b69d49SMatthias Ringwald * 17*24b69d49SMatthias Ringwald * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 18*24b69d49SMatthias Ringwald * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19*24b69d49SMatthias Ringwald * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 20*24b69d49SMatthias Ringwald * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN 21*24b69d49SMatthias Ringwald * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 22*24b69d49SMatthias Ringwald * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 23*24b69d49SMatthias Ringwald * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 24*24b69d49SMatthias Ringwald * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 25*24b69d49SMatthias Ringwald * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26*24b69d49SMatthias Ringwald * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 27*24b69d49SMatthias Ringwald * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28*24b69d49SMatthias Ringwald * SUCH DAMAGE. 29*24b69d49SMatthias Ringwald * 30*24b69d49SMatthias Ringwald */ 31*24b69d49SMatthias Ringwald 32*24b69d49SMatthias Ringwald /** 33*24b69d49SMatthias Ringwald * @brief Send/receive isochronous audio, used by le_audio_* demos 34*24b69d49SMatthias Ringwald */ 35*24b69d49SMatthias Ringwald 36*24b69d49SMatthias Ringwald #ifndef LE_AUDIO_DEMO_UTIL_SINK_H 37*24b69d49SMatthias Ringwald #define LE_AUDIO_DEMO_UTIL_SINK_H 38*24b69d49SMatthias Ringwald 39*24b69d49SMatthias Ringwald #include <stdint.h> 40*24b69d49SMatthias Ringwald #include "bluetooth.h" 41*24b69d49SMatthias Ringwald #include "btstack_bool.h" 42*24b69d49SMatthias Ringwald #include "btstack_lc3.h" 43*24b69d49SMatthias Ringwald 44*24b69d49SMatthias Ringwald #if defined __cplusplus 45*24b69d49SMatthias Ringwald extern "C" { 46*24b69d49SMatthias Ringwald #endif 47*24b69d49SMatthias Ringwald 48*24b69d49SMatthias Ringwald /** 49*24b69d49SMatthias Ringwald * @brief Init sink functionality 50*24b69d49SMatthias Ringwald * @param filename_wav 51*24b69d49SMatthias Ringwald */ 52*24b69d49SMatthias Ringwald void le_audio_demo_util_sink_init(const char * filename_wav); 53*24b69d49SMatthias Ringwald 54*24b69d49SMatthias Ringwald /** 55*24b69d49SMatthias Ringwald * @brief Enable LC3plus if available for 10 ms frame duration 56*24b69d49SMatthias Ringwald * @param enable 57*24b69d49SMatthias Ringwald */ 58*24b69d49SMatthias Ringwald void le_audio_demo_util_sink_enable_lc3plus(bool enable); 59*24b69d49SMatthias Ringwald 60*24b69d49SMatthias Ringwald /** 61*24b69d49SMatthias Ringwald * @brief Configure unicast sink 62*24b69d49SMatthias Ringwald * Supported num_streams x num_channels_per_stream configurations: 1 x 1, 1 x 2, 2 x 1 63*24b69d49SMatthias Ringwald * @param num_streams 64*24b69d49SMatthias Ringwald * @param num_channels_per_stream 65*24b69d49SMatthias Ringwald * @param sampling_frequency_hz 66*24b69d49SMatthias Ringwald * @param frame_duration 67*24b69d49SMatthias Ringwald * @param octets_per_frame 68*24b69d49SMatthias Ringwald * @param iso_interval_1250us 69*24b69d49SMatthias Ringwald * @param flush_timeout 70*24b69d49SMatthias Ringwald */ 71*24b69d49SMatthias Ringwald void le_audio_demo_util_sink_configure_unicast(uint8_t num_streams, uint8_t num_channels_per_stream, uint32_t sampling_frequency_hz, 72*24b69d49SMatthias Ringwald btstack_lc3_frame_duration_t frame_duration, uint16_t octets_per_frame, 73*24b69d49SMatthias Ringwald uint32_t iso_interval_1250us, uint8_t flush_timeout); 74*24b69d49SMatthias Ringwald 75*24b69d49SMatthias Ringwald /** 76*24b69d49SMatthias Ringwald * @brief Configure broadcast sink 77*24b69d49SMatthias Ringwald * Supported num_streams x num_channels_per_stream configurations: 1 x 1, 1 x 2, 2 x 1 78*24b69d49SMatthias Ringwald * @param num_streams 79*24b69d49SMatthias Ringwald * @param num_channels_per_stream 80*24b69d49SMatthias Ringwald * @param sampling_frequency_hz 81*24b69d49SMatthias Ringwald * @param frame_duration 82*24b69d49SMatthias Ringwald * @param octets_per_frame 83*24b69d49SMatthias Ringwald * @param iso_interval_1250us 84*24b69d49SMatthias Ringwald * @param pre_transmission_offset 85*24b69d49SMatthias Ringwald */ 86*24b69d49SMatthias Ringwald void le_audio_demo_util_sink_configure_broadcast(uint8_t num_streams, uint8_t num_channels_per_stream, uint32_t sampling_frequency_hz, 87*24b69d49SMatthias Ringwald btstack_lc3_frame_duration_t frame_duration, uint16_t octets_per_frame, 88*24b69d49SMatthias Ringwald uint32_t iso_interval_1250us, uint8_t pre_transmission_offset); 89*24b69d49SMatthias Ringwald 90*24b69d49SMatthias Ringwald /** 91*24b69d49SMatthias Ringwald * @brief Process ISO packet 92*24b69d49SMatthias Ringwald * @param stream_index 93*24b69d49SMatthias Ringwald * @param packet 94*24b69d49SMatthias Ringwald * @param size 95*24b69d49SMatthias Ringwald */ 96*24b69d49SMatthias Ringwald void le_audio_demo_util_sink_receive(uint8_t stream_index, uint8_t *packet, uint16_t size); 97*24b69d49SMatthias Ringwald 98*24b69d49SMatthias Ringwald /** 99*24b69d49SMatthias Ringwald * @brief Close sink: close wav file, stop playbacl 100*24b69d49SMatthias Ringwald */ 101*24b69d49SMatthias Ringwald void le_audio_demo_util_sink_close(void); 102*24b69d49SMatthias Ringwald 103*24b69d49SMatthias Ringwald #if defined __cplusplus 104*24b69d49SMatthias Ringwald } 105*24b69d49SMatthias Ringwald #endif 106*24b69d49SMatthias Ringwald #endif // LE_AUDIO_DEMO_UTIL_SINK_H 107