gts4lv-common: Mimic stock behavior for quad speakers during rotation

Leave ASPRX2 untouched for now, as different values don't seem
to have any effect.

This also sets proper initial values for 0 degrees rotation, which
is needed since the service only reacts to rotation changes and
after boot is complete sys.audio.rotation prop is still empty.

Change-Id: I29989963ae2f5872f81704c34b5b9fd363ea8e78
This commit is contained in:
Bruno Martins
2019-08-20 23:32:25 +01:00
parent f0ec4cf585
commit 6217ecbfb0
2 changed files with 11 additions and 15 deletions

View File

@@ -18,10 +18,10 @@
#include <android-base/logging.h>
#include <tinyalsa/asoundlib.h>
constexpr int SLOT_POSITIONS_0[] = { 1, 0, 1, 2, 0, 1, 0, 1 };
constexpr int SLOT_POSITIONS_1[] = { 1, 0, 1, 2, 0, 1, 0, 1 };
constexpr int SLOT_POSITIONS_2[] = { 0, 1, 0, 1, 1, 0, 1, 2 };
constexpr int SLOT_POSITIONS_3[] = { 0, 1, 0, 1, 1, 0, 1, 2 };
constexpr int SLOT_POSITIONS_0[] = { 0, 1, 0, 1 };
constexpr int SLOT_POSITIONS_1[] = { 1, 1, 0, 0 };
constexpr int SLOT_POSITIONS_2[] = { 1, 0, 1, 0 };
constexpr int SLOT_POSITIONS_3[] = { 0, 0, 1, 1 };
void setMixerValueByName(mixer *mixer, const char *name, int value) {
const auto ctl = mixer_get_ctl_by_name(mixer, name);
@@ -46,13 +46,9 @@ void setSlotPositions(const int *values) {
}
setMixerValueByName(mixer, "FL ASPRX1 Slot Position", values[0]);
setMixerValueByName(mixer, "FL ASPRX2 Slot Position", values[1]);
setMixerValueByName(mixer, "FR ASPRX1 Slot Position", values[2]);
setMixerValueByName(mixer, "FR ASPRX2 Slot Position", values[3]);
setMixerValueByName(mixer, "RL ASPRX1 Slot Position", values[4]);
setMixerValueByName(mixer, "RL ASPRX2 Slot Position", values[5]);
setMixerValueByName(mixer, "RR ASPRX1 Slot Position", values[6]);
setMixerValueByName(mixer, "RR ASPRX2 Slot Position", values[7]);
setMixerValueByName(mixer, "FR ASPRX1 Slot Position", values[1]);
setMixerValueByName(mixer, "RL ASPRX1 Slot Position", values[2]);
setMixerValueByName(mixer, "RR ASPRX1 Slot Position", values[3]);
mixer_close(mixer);
};

View File

@@ -43,8 +43,8 @@
<ctl name="FL VPBR Max Attenuation" value="2" />
<ctl name="FL VPBR Threshold 1" value="2.687" />
<ctl name="FL VPBR Enable" value="Enabled" />
<ctl name="FL ASPRX1 Slot Position" value="1" />
<ctl name="FL ASPRX2 Slot Position" value="0" />
<ctl name="FL ASPRX1 Slot Position" value="0" />
<ctl name="FL ASPRX2 Slot Position" value="1" />
<ctl name="FL PCM Source" value="0" />
<ctl name="FL Boost Enable" value="0" />
<ctl name="FR DSP1 Firmware" value="Protection" />
@@ -100,8 +100,8 @@
<ctl name="RR VPBR Max Attenuation" value="2" />
<ctl name="RR VPBR Threshold 1" value="2.687" />
<ctl name="RR VPBR Enable" value="Enabled" />
<ctl name="RR ASPRX1 Slot Position" value="0" />
<ctl name="RR ASPRX2 Slot Position" value="1" />
<ctl name="RR ASPRX1 Slot Position" value="1" />
<ctl name="RR ASPRX2 Slot Position" value="2" />
<ctl name="RR PCM Source" value="0" />
<ctl name="RR Boost Enable" value="0" />
<ctl name="FL ASPTX1 Slot Position" value="0" />