mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/hfp_demo_audio_not_sine' into 'master'
bugfix/fix hfp demo audio not sine Closes IDFGH-6114 See merge request espressif/esp-idf!15745
This commit is contained in:
commit
f5a2fc578d
@ -105,7 +105,8 @@ const char *c_codec_mode_str[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#if CONFIG_BT_HFP_AUDIO_DATA_PATH_HCI
|
#if CONFIG_BT_HFP_AUDIO_DATA_PATH_HCI
|
||||||
#define TABLE_SIZE 100
|
#define TABLE_SIZE 100
|
||||||
|
#define TABLE_SIZE_BYTE 200
|
||||||
// Produce a sine audio
|
// Produce a sine audio
|
||||||
static const int16_t sine_int16[TABLE_SIZE] = {
|
static const int16_t sine_int16[TABLE_SIZE] = {
|
||||||
0, 2057, 4107, 6140, 8149, 10126, 12062, 13952, 15786, 17557,
|
0, 2057, 4107, 6140, 8149, 10126, 12062, 13952, 15786, 17557,
|
||||||
@ -179,14 +180,13 @@ static void bt_app_hf_incoming_cb(const uint8_t *buf, uint32_t sz)
|
|||||||
|
|
||||||
static uint32_t bt_app_hf_create_audio_data(uint8_t *p_buf, uint32_t sz)
|
static uint32_t bt_app_hf_create_audio_data(uint8_t *p_buf, uint32_t sz)
|
||||||
{
|
{
|
||||||
static int sine_phase = 0;
|
static int index = 0;
|
||||||
|
uint8_t *data = (uint8_t *)sine_int16;
|
||||||
|
|
||||||
for (int i = 0; i * 2 + 1 < sz; i++) {
|
for (uint32_t i = 0; i < sz; i++) {
|
||||||
p_buf[i * 2] = sine_int16[sine_phase];
|
p_buf[i] = data[index++];
|
||||||
p_buf[i * 2 + 1] = sine_int16[sine_phase];
|
if (index >= TABLE_SIZE_BYTE) {
|
||||||
++sine_phase;
|
index -= TABLE_SIZE_BYTE;
|
||||||
if (sine_phase >= TABLE_SIZE) {
|
|
||||||
sine_phase -= TABLE_SIZE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sz;
|
return sz;
|
||||||
|
Loading…
Reference in New Issue
Block a user