Skip to content

Volume Control

Phil Schatzmann edited this page Nov 6, 2021 · 10 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 VolumeControl which have different properties:

curve

You can select an alternative implementation the following way:

#include "BluetoothA2DPSin.h"

BluetoothA2DPSink32 a2dp_sink;
SimpleExponentialVolumeControl 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 LinearVolumeControl.

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 VolumeControl class!

Clone this wiki locally