fix hfp_ag demo audio not sine_v4.1

This commit is contained in:
jincheng
2021-11-01 12:19:58 +08:00
parent 1e309a3885
commit 4e34c26a56

View File

@ -117,16 +117,16 @@ static const int16_t sine_int16[] = {
};
#define TABLE_SIZE_CVSD 100
#define TABLE_SIZE_CVSD_BYTE 200
static uint32_t bt_app_hf_outgoing_cb(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++) {
p_buf[i * 2] = sine_int16[sine_phase];
p_buf[i * 2 + 1] = sine_int16[sine_phase];
++sine_phase;
if (sine_phase >= TABLE_SIZE_CVSD) {
sine_phase -= TABLE_SIZE_CVSD;
for (uint32_t i = 0; i < sz; i++) {
p_buf[i] = data[index++];
if (index >= TABLE_SIZE_CVSD_BYTE) {
index -= TABLE_SIZE_CVSD_BYTE;
}
}
return sz;