Skip to content

Volume Control

pschatzmann edited this page Oct 3, 2026 · 11 revisions

The BluetoothA2DPSink and the BluetoothA2DPSource class provide the possibility to set the volume by calling the set_volume method. This is also used for adjusting the volume via AVRC.

We provide different implementations of the A2DPVolumeControl which have different properties:

curve

You can select an alternative implementation the following way:

#include "AudioTools.h"
#include "BluetoothA2DPSink.h"

I2SStream i2s;
BluetoothA2DPSink a2dp_sink(i2s);
A2DPSimpleExponentialVolumeControl vc;

void setup() {
  a2dp_sink.set_volume_control(&vc);  
  a2dp_sink.start("BTExpVolume");  
}

void loop() {
}

If you already have an Audio Pot, I suggest to use the A2DPLinearVolumeControl.

Not happy with the provided volume profiles ? Do you want to build a left and right balance control? You can easily provide your own implementation by just subclassing the A2DPVolumeControl class!

Clone this wiki locally