summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNemu Manaka <beatrice@dangofactory.local>2026-08-20 04:17:40 +0900
committerNemu Manaka <beatrice@dangofactory.local>2026-08-20 04:17:40 +0900
commitdca8f65acf543bed9599dc4be4963ab18a0d0084 (patch)
treee77b1596783c82bfeb234616f0fdeddad40075df
parent5f40b453cdf38e10e851dba25a8d6cd2e327e6e6 (diff)
downloadwmamixer-master.tar.gz
wmamixer-master.tar.bz2
wmamixer-master.zip
-rw-r--r--wmamixer.c38
-rw-r--r--wmamixer.h2
2 files changed, 20 insertions, 20 deletions
diff --git a/wmamixer.c b/wmamixer.c
index 58ab9f0..b36b1fb 100644
--- a/wmamixer.c
+++ b/wmamixer.c
@@ -206,8 +206,8 @@ struct Mixer *Mixer_create() {
selems[mixer->devices_no]->oss_dev_idx = -1;
Mixer_set_limits(elem, selems[mixer->devices_no]);
- Mixer_set_selem_props(selems[mixer->devices_no], name);
- Mixer_set_channels(selems[mixer->devices_no]);
+ Mixer_set_selem_props(mixer, selems[mixer->devices_no], name);
+ Mixer_set_channels(selems[mixer->devices_no]);
mixer->devices_no++;
if (mixer->devices_no == 32) {
@@ -258,7 +258,7 @@ struct Mixer *Mixer_create() {
return mixer;
}
-void Mixer_set_selem_props(struct Selem *selem, const char *name) {
+void Mixer_set_selem_props(struct Mixer *mixer, struct Selem *selem, const char *name) {
const char *pcm = "PCM",
*mic = "Mic",
*cap = "Capture",
@@ -267,48 +267,48 @@ void Mixer_set_selem_props(struct Selem *selem, const char *name) {
*aux = "Aux";
// OSS elements have names set in Mixer_oss_enumerate
- if (mix->backend == BACKEND_OSS) return;
+ if (mixer->backend == BACKEND_OSS) return;
if (strcmp("Master", name) == 0) {
- selem->name = "mstr";
+ selem->name = strdup("mstr");
selem->iconIndex = 0;
} else if (strstr(pcm, name)) {
selem->iconIndex = 1;
if (strcmp(pcm, name) == 0)
- selem->name = "pcm ";
+ selem->name = strdup("pcm ");
else
Selem_set_name(selem, "pcm", &namesCount.pcm);
} else if (strstr("Headphone", name)) {
- selem->name = "hdph";
+ selem->name = strdup("hdph");
selem->iconIndex = 8;
} else if (strstr("Beep", name) || strstr("PC Speaker", name)) {
- selem->name = "beep";
+ selem->name = strdup("beep");
selem->iconIndex = 7;
} else if (strstr("Digital", name)) {
selem->iconIndex = selem->capture ? 3 : 15;
- selem->name = "digt";
+ selem->name = strdup("digt");
} else if (strstr("Bass", name)) {
- selem->name = "bass";
+ selem->name = strdup("bass");
selem->iconIndex = 9;
} else if (strstr("Treble", name)) {
- selem->name = "trbl";
+ selem->name = strdup("trbl");
selem->iconIndex = 10;
} else if (strstr("Synth", name)) {
- selem->name = "synt";
+ selem->name = strdup("synt");
selem->iconIndex = 11;
} else if (strstr("CD", name)) {
- selem->name = " cd ";
+ selem->name = strdup(" cd ");
selem->iconIndex = 12;
} else if (strstr("Phone", name)) {
- selem->name = "phne";
+ selem->name = strdup("phne");
selem->iconIndex = 13;
} else if (strstr("Video", name)) {
- selem->name = "vdeo";
+ selem->name = strdup("vdeo");
selem->iconIndex = 14;
} else if (strstr(mic, name)) {
if (strcmp(mic, name) == 0) {
- selem->name = "mic ";
+ selem->name = strdup("mic ");
} else {
if (strstr(boost, name))
Selem_set_name(selem, "mib", &namesCount.micb);
@@ -318,14 +318,14 @@ void Mixer_set_selem_props(struct Selem *selem, const char *name) {
selem->iconIndex = 4;
} else if (strstr(aux, name)) {
if (strcmp(aux, name) == 0) {
- selem->name = "aux ";
+ selem->name = strdup("aux ");
} else {
Selem_set_name(selem, "aux", &namesCount.aux);
}
selem->iconIndex = 5;
} else if (strstr(line, name)) {
if (strcmp(line, name) == 0) {
- selem->name = "line";
+ selem->name = strdup("line");
} else {
if (strstr(boost, name))
Selem_set_name(selem, "lnb", &namesCount.lineb);
@@ -335,7 +335,7 @@ void Mixer_set_selem_props(struct Selem *selem, const char *name) {
selem->iconIndex = 5;
} else if (strstr(cap, name)) {
if (strcmp(cap, name) == 0) {
- selem->name = "cap ";
+ selem->name = strdup("cap ");
} else {
Selem_set_name(selem, "cap", &namesCount.capt);
}
diff --git a/wmamixer.h b/wmamixer.h
index 9c8d864..661c33b 100644
--- a/wmamixer.h
+++ b/wmamixer.h
@@ -207,7 +207,7 @@ slideCaptureMono Mixer_get_capabilities(snd_mixer_elem_t *elem);
int Mixer_get_volume(int current, int channelIndex);
int Mixer_read_left(int current);
int Mixer_read_right(int current);
-void Mixer_set_selem_props(struct Selem *selem, const char *name);
+void Mixer_set_selem_props(struct Mixer *mixer, struct Selem *selem, const char *name);
void Mixer_set_channels(struct Selem *selem);
void Mixer_set_left(int current, int value);
void Mixer_set_right(int current, int value);