mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-16 08:42:28 +00:00
stm32: added samplerate compensation support
embedded: update audio api
This commit is contained in:
parent
8955f6de72
commit
32d9a3dfcc
@ -133,6 +133,9 @@ static void driver_timer_handler_source(btstack_timer_source_t * ts){
|
||||
btstack_run_loop_add_timer(ts);
|
||||
}
|
||||
|
||||
|
||||
static uint32_t sink_samplerate = 0;
|
||||
|
||||
static int btstack_audio_embedded_sink_init(
|
||||
uint8_t channels,
|
||||
uint32_t samplerate,
|
||||
@ -148,12 +151,18 @@ static int btstack_audio_embedded_sink_init(
|
||||
#endif
|
||||
|
||||
playback_callback = playback;
|
||||
|
||||
sink_samplerate = samplerate;
|
||||
hal_audio_sink_init(channels, samplerate, &btstack_audio_audio_played);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint32_t btstack_audio_embedded_sink_get_samplerate() {
|
||||
return sink_samplerate;
|
||||
}
|
||||
|
||||
static uint32_t source_samplerate = 0;
|
||||
|
||||
static int btstack_audio_embedded_source_init(
|
||||
uint8_t channels,
|
||||
uint32_t samplerate,
|
||||
@ -165,12 +174,16 @@ static int btstack_audio_embedded_source_init(
|
||||
}
|
||||
|
||||
recording_callback = recording;
|
||||
|
||||
source_samplerate = samplerate;
|
||||
hal_audio_source_init(channels, samplerate, &btstack_audio_audio_recorded);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint32_t btstack_audio_embedded_source_get_samplerate() {
|
||||
return source_samplerate;
|
||||
}
|
||||
|
||||
static void btstack_audio_embedded_sink_set_volume(uint8_t volume){
|
||||
UNUSED(volume);
|
||||
}
|
||||
@ -261,6 +274,7 @@ static void btstack_audio_embedded_source_close(void){
|
||||
|
||||
static const btstack_audio_sink_t btstack_audio_embedded_sink = {
|
||||
.init = &btstack_audio_embedded_sink_init,
|
||||
.get_samplerate = &btstack_audio_embedded_sink_get_samplerate,
|
||||
.set_volume = &btstack_audio_embedded_sink_set_volume,
|
||||
.start_stream = &btstack_audio_embedded_sink_start_stream,
|
||||
.stop_stream = &btstack_audio_embedded_sink_stop_stream,
|
||||
@ -269,6 +283,7 @@ static const btstack_audio_sink_t btstack_audio_embedded_sink = {
|
||||
|
||||
static const btstack_audio_source_t btstack_audio_embedded_source = {
|
||||
.init = &btstack_audio_embedded_source_init,
|
||||
.get_samplerate = &btstack_audio_embedded_source_get_samplerate,
|
||||
.set_gain = &btstack_audio_embedded_source_set_gain,
|
||||
.start_stream = &btstack_audio_embedded_source_start_stream,
|
||||
.stop_stream = &btstack_audio_embedded_source_stop_stream,
|
||||
|
@ -71,6 +71,7 @@ ${BTSTACK_ROOT}/src/ble/le_device_db_memory.c \
|
||||
${BTSTACK_ROOT}/src/ble/le_device_db_tlv.c \
|
||||
${BTSTACK_ROOT}/src/ble/sm.c \
|
||||
${BTSTACK_ROOT}/src/btstack_audio.c \
|
||||
${BTSTACK_ROOT}/src/btstack_sample_rate_compensation.c \
|
||||
${BTSTACK_ROOT}/src/btstack_crypto.c \
|
||||
${BTSTACK_ROOT}/src/btstack_hid_parser.c \
|
||||
${BTSTACK_ROOT}/src/btstack_linked_list.c \
|
||||
@ -304,6 +305,7 @@ LDSCRIPT = STM32F407VGTx_FLASH.ld
|
||||
LIBS = -lPDMFilter_CM4_GCC -lc -lm -lnosys
|
||||
LIBDIR = -Lpdm
|
||||
LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
|
||||
#LDFLAGS += -u_printf_float
|
||||
|
||||
# default action: build all
|
||||
EXAMPLES = \
|
||||
|
@ -12,6 +12,7 @@
|
||||
#define HAVE_EMBEDDED_TIME_MS
|
||||
#define HAVE_HAL_AUDIO
|
||||
#define HAVE_HAL_AUDIO_SINK_STEREO_ONLY
|
||||
#define HAVE_BTSTACK_AUDIO_EFFECTIVE_SAMPLERATE
|
||||
|
||||
// BTstack features that can be enabled
|
||||
#define ENABLE_BLE
|
||||
|
Loading…
x
Reference in New Issue
Block a user