Data type/format in ESP-IDF A2DP-SINK demo
Posted: Sun Jun 23, 2019 11:50 pm
In the Bluetooth A2DP sink demo data callback at https://github.com/espressif/esp-idf/bl ... .c#L70-L77:
In what specific format and order are the bytes pointed to by *data? Specifically:
1. Signed or unsigned?
2. little-endian or big-endian?
3. most significant byte first, or least significant byte first?
4. Channel format 2 channel: 16-bit right channel data followed by 16-bit left channel data?
I saw another post where BuddyCasino mentioned the (I2S) format should be MSB first (big-endian) two's complement (signed) integer (https://www.esp32.com/viewtopic.php?t=1756&start=20)
My goal: instead of writing the bytes to I2S, I want to convert/cast them into a pulse code modulation format as:
-Unsigned 16 bit integer (uint16_t)
-big-endian
-Most significant byte first
-Monochannel
Thanks.
Code: Select all
void bt_app_a2d_data_cb(const uint8_t *data, uint32_t len)
{
size_t bytes_written;
i2s_write(0, data, len, &bytes_written, portMAX_DELAY);
if (++s_pkt_cnt % 100 == 0) {
ESP_LOGI(BT_AV_TAG, "Audio packet count %u", s_pkt_cnt);
}
}
1. Signed or unsigned?
2. little-endian or big-endian?
3. most significant byte first, or least significant byte first?
4. Channel format 2 channel: 16-bit right channel data followed by 16-bit left channel data?
I saw another post where BuddyCasino mentioned the (I2S) format should be MSB first (big-endian) two's complement (signed) integer (https://www.esp32.com/viewtopic.php?t=1756&start=20)
My goal: instead of writing the bytes to I2S, I want to convert/cast them into a pulse code modulation format as:
-Unsigned 16 bit integer (uint16_t)
-big-endian
-Most significant byte first
-Monochannel
Thanks.