Unverified Commit 0f05ad1c authored by Earle F. Philhower, III's avatar Earle F. Philhower, III Committed by GitHub

Use block writes for BT audio consumers (#2204)

Around 2x the performance, and every bit is needed w/BT SBC compression
and decompression.
parent 0ec12aa4
......@@ -75,10 +75,8 @@ void BluetoothAudioConsumerI2S::fill() {
_a2dpSink->playback_handler((int16_t *) buff, 32);
num_samples -= 64;
for (int i = 0; i < 64; i++) {
int32_t tmp = buff[i];
tmp *= _gain;
tmp >>= 8;
_i2s->write((int16_t)tmp);
buff[i] = (((int32_t)buff[i]) * _gain) >> 8;
}
_i2s->write((uint8_t *)buff, 64 * 2);
}
}
......@@ -76,10 +76,8 @@ void BluetoothAudioConsumerPWM::fill() {
_a2dpSink->playback_handler((int16_t *) buff, 32);
num_samples -= 64;
for (int i = 0; i < 64; i++) {
int32_t tmp = buff[i];
tmp *= _gain;
tmp >>= 8;
_pwm->write((int16_t)tmp);
buff[i] = (((int32_t)buff[i]) * _gain) >> 8;
}
_pwm->write((uint8_t *)buff, 64 * 2);
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment