mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
fix hfp_ag demo audio not sine_v4.1
This commit is contained in:
parent
f370d5089f
commit
c0fc6500cf
@ -116,17 +116,17 @@ static const int16_t sine_int16[] = {
|
||||
-19260, -17557, -15786, -13952, -12062, -10126, -8149, -6140, -4107, -2057,
|
||||
};
|
||||
|
||||
#define TABLE_SIZE_CVSD 100
|
||||
#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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user