From 1acf1f3fb9d3034f66c70abaa1c8309b71ec5381 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 11 Sep 2000 15:09:51 +0000 Subject: [PATCH] Added Synth Tone Controls --- src/mixer/simple.c | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/src/mixer/simple.c b/src/mixer/simple.c index 8c2fe61b..c5151a15 100644 --- a/src/mixer/simple.c +++ b/src/mixer/simple.c @@ -29,6 +29,17 @@ #include "asoundlib.h" #include "mixer_local.h" +static struct mixer_name_table { + const char *longname; + const char *shortname; +} name_table[] = { + {"Tone Control - Bass", "Bass"}, + {"Tone Control - Treble", "Treble"}, + {"Synth Tone Control - Bass", "Synth Bass"}, + {"Synth Tone Control - Treble", "Synth Treble"}, + {0, 0}, +}; + static snd_hcontrol_t *test_mixer_id(snd_mixer_t *handle, const char *name, int index) { snd_control_id_t id; @@ -139,13 +150,24 @@ static int simple_remove(snd_mixer_t *handle, mixer_simple_t *scontrol) static const char *get_full_name(const char *sname) { - if (!strcmp(sname, "Bass")) - return "Tone Control - Bass"; - if (!strcmp(sname, "Treble")) - return "Tone Control - Treble"; + struct mixer_name_table *p; + for (p = name_table; p->longname; p++) { + if (!strcmp(sname, p->shortname)) + return p->longname; + } return sname; } +static const char *get_short_name(const char *lname) +{ + struct mixer_name_table *p; + for (p = name_table; p->longname; p++) { + if (!strcmp(lname, p->longname)) + return p->shortname; + } + return lname; +} + static int input_get_volume(snd_mixer_t *handle, mixer_simple_t *simple, snd_mixer_simple_control_t *control, const char *direction, const char *postfix, int voices) { char str[128]; @@ -677,11 +699,7 @@ static int build_input(snd_mixer_t *handle, const char *sname) } if (present == 0) break; - sname1 = sname; - if (!strcmp(sname, "Tone Control - Bass")) - sname1 = "Bass"; - else if (!strcmp(sname, "Tone Control - Treble")) - sname1 = "Treble"; + sname1 = get_short_name(sname); simple = build_input_scontrol(handle, sname1, index); if (simple == NULL) { snd_ctl_hbag_destroy(&bag, NULL); @@ -718,6 +736,8 @@ int snd_mixer_simple_build(snd_mixer_t *handle) "Master Digital", "Tone Control - Bass", "Tone Control - Treble", + "Synth Tone Control - Bass", + "Synth Tone Control - Treble", "PCM", "Synth", "FM", -- 2.47.1