Adds headphone mic and some things from xnux

https://xnux.eu/devices/feature/audio-pp.html

In an effort to sort out audio in a call
master
Jonathan Hodgson 4 years ago
parent 3aec2ee2ee
commit 0861fcd906
  1. 23
      megiaudioroute.c

@ -207,6 +207,7 @@ struct audio_setup {
bool spk_on;
bool hp_on;
bool ear_on;
bool hpmic_on;
// when sending audio to modem from AIF1 R, also play that back
// to me locally (just like AIF1 L plays just to me)
@ -225,6 +226,7 @@ struct audio_setup {
bool dai2_en;
int mic_gain;
int hpmic_gain;
int spk_vol;
int ear_vol;
int hp_vol;
@ -241,7 +243,7 @@ static void audio_set_controls(struct audio_setup* s)
{ .name = "Mic1 Boost Volume", .vals.i = { s->mic_gain } },
// Mic 2 (headphones)
{ .name = "Mic2 Boost Volume", .vals.i = { 0 } },
{ .name = "Mic2 Boost Volume", .vals.i = { s->hpmic_gain } },
// Line in (unused on PP)
// no controls yet
@ -249,7 +251,7 @@ static void audio_set_controls(struct audio_setup* s)
// Input mixers before ADC
{ .name = "Mic1 Capture Switch", .vals.i = { !!s->mic_on, !!s->mic_on } },
{ .name = "Mic2 Capture Switch", .vals.i = { 0, 0 } },
{ .name = "Mic2 Capture Switch", .vals.i = { !!s->hpmic_on, !!s->hpmic_on } },
{ .name = "Line In Capture Switch", .vals.i = { 0, 0 } }, // Out Mix -> In Mix
{ .name = "Mixer Capture Switch", .vals.i = { 0, 0 } },
{ .name = "Mixer Reversed Capture Switch", .vals.i = { 0, 0 } },
@ -337,10 +339,11 @@ static void audio_set_controls(struct audio_setup* s)
}
static struct audio_setup audio_setup = {
.mic_on = true,
.ear_on = true,
.mic_on = false,
.ear_on = false,
.spk_on = false,
.hp_on = false,
.hpmic_on = false,
.from_modem_on = true,
.to_modem_on = true,
@ -352,13 +355,14 @@ static struct audio_setup audio_setup = {
.spk_vol = 15,
.ear_vol = 31,
.mic_gain = 1,
.hpmic_gain = 1,
};
int main(int ac, char* av[])
{
int opt;
while ((opt = getopt(ac, av, "smhe2")) != -1) {
while ((opt = getopt(ac, av, "smhle2")) != -1) {
switch (opt) {
case 's':
audio_setup.spk_on = 1;
@ -369,6 +373,9 @@ int main(int ac, char* av[])
case 'h':
audio_setup.hp_on = 1;
break;
case 'l':
audio_setup.hpmic_on = 1;
break;
case 'e':
audio_setup.ear_on = 1;
break;
@ -376,12 +383,14 @@ int main(int ac, char* av[])
audio_setup.dai2_en = 1;
break;
default: /* '?' */
fprintf(stderr, "Usage: %s [-s] [-m] [-h] [-e] [-2]\n", av[0]);
fprintf(stderr, "Usage: %s [-s] [-m] [-h] [-l] [-e] [-2]\n", av[0]);
fprintf(stderr, "\t-s\tSpeaker On\n");
fprintf(stderr, "\t-m\tMicrophone On\n");
fprintf(stderr, "\t-h\tHeadphones On\n");
fprintf(stderr, "\t-l\tHeadphone Microphone On\n");
fprintf(stderr, "\t-e\tEarpiece On\n");
fprintf(stderr, "\t-2\t???\n");
fprintf(stderr, "\t-2\tDigital Audio Interface\n");
fprintf(stderr, "\t\tI think this allows audio input/out to the modem\n");
exit(EXIT_FAILURE);
}
}

Loading…
Cancel
Save