mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-12-19 08:57:08 -05:00
Added Synth Tone Controls
This commit is contained in:
parent
014de04488
commit
1acf1f3fb9
1 changed files with 29 additions and 9 deletions
|
|
@ -29,6 +29,17 @@
|
||||||
#include "asoundlib.h"
|
#include "asoundlib.h"
|
||||||
#include "mixer_local.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)
|
static snd_hcontrol_t *test_mixer_id(snd_mixer_t *handle, const char *name, int index)
|
||||||
{
|
{
|
||||||
snd_control_id_t id;
|
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)
|
static const char *get_full_name(const char *sname)
|
||||||
{
|
{
|
||||||
if (!strcmp(sname, "Bass"))
|
struct mixer_name_table *p;
|
||||||
return "Tone Control - Bass";
|
for (p = name_table; p->longname; p++) {
|
||||||
if (!strcmp(sname, "Treble"))
|
if (!strcmp(sname, p->shortname))
|
||||||
return "Tone Control - Treble";
|
return p->longname;
|
||||||
|
}
|
||||||
return sname;
|
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)
|
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];
|
char str[128];
|
||||||
|
|
@ -677,11 +699,7 @@ static int build_input(snd_mixer_t *handle, const char *sname)
|
||||||
}
|
}
|
||||||
if (present == 0)
|
if (present == 0)
|
||||||
break;
|
break;
|
||||||
sname1 = sname;
|
sname1 = get_short_name(sname);
|
||||||
if (!strcmp(sname, "Tone Control - Bass"))
|
|
||||||
sname1 = "Bass";
|
|
||||||
else if (!strcmp(sname, "Tone Control - Treble"))
|
|
||||||
sname1 = "Treble";
|
|
||||||
simple = build_input_scontrol(handle, sname1, index);
|
simple = build_input_scontrol(handle, sname1, index);
|
||||||
if (simple == NULL) {
|
if (simple == NULL) {
|
||||||
snd_ctl_hbag_destroy(&bag, NULL);
|
snd_ctl_hbag_destroy(&bag, NULL);
|
||||||
|
|
@ -718,6 +736,8 @@ int snd_mixer_simple_build(snd_mixer_t *handle)
|
||||||
"Master Digital",
|
"Master Digital",
|
||||||
"Tone Control - Bass",
|
"Tone Control - Bass",
|
||||||
"Tone Control - Treble",
|
"Tone Control - Treble",
|
||||||
|
"Synth Tone Control - Bass",
|
||||||
|
"Synth Tone Control - Treble",
|
||||||
"PCM",
|
"PCM",
|
||||||
"Synth",
|
"Synth",
|
||||||
"FM",
|
"FM",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue