1*24b69d49SMatthias Ringwald /* 2*24b69d49SMatthias Ringwald * Copyright (C) {copyright_year} 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_SOURCE_H 37*24b69d49SMatthias Ringwald #define LE_AUDIO_DEMO_UTIL_SOURCE_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 typedef enum { 49*24b69d49SMatthias Ringwald AUDIO_SOURCE_COUNTER, 50*24b69d49SMatthias Ringwald AUDIO_SOURCE_SINE, 51*24b69d49SMatthias Ringwald AUDIO_SOURCE_MODPLAYER 52*24b69d49SMatthias Ringwald } le_audio_demo_source_generator; 53*24b69d49SMatthias Ringwald 54*24b69d49SMatthias Ringwald /** 55*24b69d49SMatthias Ringwald * @brief Init source functionality 56*24b69d49SMatthias Ringwald */ 57*24b69d49SMatthias Ringwald void le_audio_demo_util_source_init(void); 58*24b69d49SMatthias Ringwald 59*24b69d49SMatthias Ringwald /** 60*24b69d49SMatthias Ringwald * @brief Configure audio source 61*24b69d49SMatthias Ringwald * Supported num_streams x num_channels_per_stream configurations: 1 x 1, 1 x 2, 2 x 1 62*24b69d49SMatthias Ringwald * @param num_streams 63*24b69d49SMatthias Ringwald * @param num_channels_per_stream 64*24b69d49SMatthias Ringwald * @param sampling_frequency_hz 65*24b69d49SMatthias Ringwald * @param frame_duration 66*24b69d49SMatthias Ringwald * @param octets_per_frame 67*24b69d49SMatthias Ringwald */ 68*24b69d49SMatthias Ringwald void le_audio_demo_util_source_configure(uint8_t num_streams, uint8_t num_channels_per_stream, uint32_t sampling_frequency_hz, 69*24b69d49SMatthias Ringwald btstack_lc3_frame_duration_t frame_duration, uint16_t octets_per_frame); 70*24b69d49SMatthias Ringwald /** 71*24b69d49SMatthias Ringwald * @brief Generate audio and encode as ISO frame 72*24b69d49SMatthias Ringwald * @param channel 73*24b69d49SMatthias Ringwald * @param generator 74*24b69d49SMatthias Ringwald */ 75*24b69d49SMatthias Ringwald 76*24b69d49SMatthias Ringwald void le_audio_demo_util_source_generate_iso_frame(le_audio_demo_source_generator generator); 77*24b69d49SMatthias Ringwald 78*24b69d49SMatthias Ringwald /** 79*24b69d49SMatthias Ringwald * @brief Send prepared ISO packet 80*24b69d49SMatthias Ringwald * @param stream_index 81*24b69d49SMatthias Ringwald * @param con_handle 82*24b69d49SMatthias Ringwald */ 83*24b69d49SMatthias Ringwald void le_audio_demo_util_source_send(uint8_t stream_index, hci_con_handle_t con_handle); 84*24b69d49SMatthias Ringwald 85*24b69d49SMatthias Ringwald /** 86*24b69d49SMatthias Ringwald * @brief Close source 87*24b69d49SMatthias Ringwald */ 88*24b69d49SMatthias Ringwald void le_audio_demo_util_source_close(void); 89*24b69d49SMatthias Ringwald 90*24b69d49SMatthias Ringwald #if defined __cplusplus 91*24b69d49SMatthias Ringwald } 92*24b69d49SMatthias Ringwald #endif 93*24b69d49SMatthias Ringwald #endif // LE_AUDIO_DEMO_UTIL_SOURCE_H 94