如何输出32bit的i2s音频数据
Posted: Fri Jun 05, 2020 8:26 am
播放蓝牙音乐的时候,接收到音频是Receive music info from Bluetooth, sample_rates=44100, bits=16, ch=2。
但是我的功放是要使用bits=32的音频数据。如何修改?。谢谢
但是我的功放是要使用bits=32的音频数据。如何修改?。谢谢
Code: Select all
int my_i2s_write(audio_element_handle_t self, char *buffer, int len, TickType_t ticks_to_wait, void *context)
{
i2s_stream_t *i2s = (i2s_stream_t *)audio_element_getdata(self);
size_t bytes_written = 0;
i2s_write_expand(i2s->config.i2s_port, buffer, len, 16, 32, &bytes_written, ticks_to_wait);
return bytes_written;
}
i2s_stream_cfg_t i2s_writer = I2S_STREAM_CFG_DEFAULT();
i2s_writer.type = AUDIO_STREAM_WRITER;
i2s_writer.stack_in_ext = true;
i2s_writer.i2s_config.sample_rate = 48000;
i2s_writer.i2s_config.mode = I2S_MODE_MASTER | I2S_MODE_TX;
i2s_writer.i2s_config.bits_per_sample = 32; //for cupid digital loopback
audio_element_handle_t my_i2s = i2s_stream_init(&i2s_writer);
audio_element_set_write_cb(my_i2s, my_i2s_write, NULL);