mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-12-22 16:56:31 +01:00
MUX1 & MUX2 renaming...
This commit is contained in:
parent
09502f8c1a
commit
228bf51025
4 changed files with 31 additions and 31 deletions
|
@ -682,17 +682,17 @@ static void mixer_mux1_value(char *name, int index, int type)
|
|||
snd_mixer_eid_t *ptr;
|
||||
snd_mixer_eid_t *eid;
|
||||
|
||||
if (Xelement->element.data.mux1.output_size <= Xelement->element.data.mux1.output) {
|
||||
Xelement->element.data.mux1.output_size += 4;
|
||||
ptr = (snd_mixer_eid_t *)realloc(Xelement->element.data.mux1.poutput, Xelement->element.data.mux1.output_size * sizeof(snd_mixer_eid_t));
|
||||
if (Xelement->element.data.mux1.sel_size <= Xelement->element.data.mux1.sel) {
|
||||
Xelement->element.data.mux1.sel_size += 4;
|
||||
ptr = (snd_mixer_eid_t *)realloc(Xelement->element.data.mux1.psel, Xelement->element.data.mux1.sel_size * sizeof(snd_mixer_eid_t));
|
||||
if (ptr == NULL) {
|
||||
error_nomem();
|
||||
free(name);
|
||||
return;
|
||||
}
|
||||
Xelement->element.data.mux1.poutput = ptr;
|
||||
Xelement->element.data.mux1.psel = ptr;
|
||||
}
|
||||
eid = &Xelement->element.data.mux1.poutput[Xelement->element.data.mux1.output++];
|
||||
eid = &Xelement->element.data.mux1.psel[Xelement->element.data.mux1.sel++];
|
||||
strncpy(eid->name, name, sizeof(eid->name));
|
||||
eid->index = index;
|
||||
eid->type = type;
|
||||
|
@ -708,7 +708,7 @@ static void mixer_mux2_value(char *name, int index, int type)
|
|||
{
|
||||
snd_mixer_eid_t *eid;
|
||||
|
||||
eid = &Xelement->element.data.mux2.output;
|
||||
eid = &Xelement->element.data.mux2.sel;
|
||||
strncpy(eid->name, name, sizeof(eid->name));
|
||||
eid->index = index;
|
||||
eid->type = type;
|
||||
|
|
|
@ -254,25 +254,25 @@ static int merge_one_element(struct mixer_element *celement, struct mixer_elemen
|
|||
memcpy(celement->element.data.accu3.pvoices, uelement->element.data.accu3.pvoices, tmp);
|
||||
break;
|
||||
case SND_MIXER_ETYPE_MUX1:
|
||||
if (celement->element.data.mux1.poutput)
|
||||
free(celement->element.data.mux1.poutput);
|
||||
celement->element.data.mux1.output_size = 0;
|
||||
celement->element.data.mux1.output = 0;
|
||||
celement->element.data.mux1.output_over = 0;
|
||||
tmp = uelement->element.data.mux1.output * sizeof(snd_mixer_eid_t);
|
||||
if (celement->element.data.mux1.psel)
|
||||
free(celement->element.data.mux1.psel);
|
||||
celement->element.data.mux1.sel_size = 0;
|
||||
celement->element.data.mux1.sel = 0;
|
||||
celement->element.data.mux1.sel_over = 0;
|
||||
tmp = uelement->element.data.mux1.sel * sizeof(snd_mixer_eid_t);
|
||||
if (tmp > 0) {
|
||||
celement->element.data.mux1.poutput = (snd_mixer_eid_t *)malloc(uelement->element.data.mux1.output_size * sizeof(snd_mixer_eid_t));
|
||||
if (!celement->element.data.mux1.poutput) {
|
||||
celement->element.data.mux1.psel = (snd_mixer_eid_t *)malloc(uelement->element.data.mux1.sel_size * sizeof(snd_mixer_eid_t));
|
||||
if (!celement->element.data.mux1.psel) {
|
||||
error("No enough memory...");
|
||||
return 1;
|
||||
}
|
||||
celement->element.data.mux1.output_size = uelement->element.data.mux1.output_size;
|
||||
celement->element.data.mux1.output = uelement->element.data.mux1.output;
|
||||
memcpy(celement->element.data.mux1.poutput, uelement->element.data.mux1.poutput, tmp);
|
||||
celement->element.data.mux1.sel_size = uelement->element.data.mux1.sel_size;
|
||||
celement->element.data.mux1.sel = uelement->element.data.mux1.sel;
|
||||
memcpy(celement->element.data.mux1.psel, uelement->element.data.mux1.psel, tmp);
|
||||
}
|
||||
break;
|
||||
case SND_MIXER_ETYPE_MUX2:
|
||||
celement->element.data.mux2.output = uelement->element.data.mux2.output;
|
||||
celement->element.data.mux2.sel = uelement->element.data.mux2.sel;
|
||||
break;
|
||||
case SND_MIXER_ETYPE_TONE_CONTROL1:
|
||||
if ((uelement->element.data.tc1.tc & ~celement->info.data.tc1.tc) != 0) {
|
||||
|
|
|
@ -744,14 +744,14 @@ static void soundcard_setup_write_mixer_element(FILE * out, struct mixer_element
|
|||
break;
|
||||
case SND_MIXER_ETYPE_MUX1:
|
||||
fprintf(out, " element(\"%s\",%i,%i,Mux1(", mixer_element_name(&element->eid), element->eid.index, element->eid.type);
|
||||
for (idx = 0; idx < element->data.mux1.output; idx++) {
|
||||
fprintf(out, "%selement(\"%s\",%i,%i)", idx > 0 ? "," : "", mixer_element_name(&element->data.mux1.poutput[idx]), element->data.mux1.poutput[idx].index, element->data.mux1.poutput[idx].type);
|
||||
for (idx = 0; idx < element->data.mux1.sel; idx++) {
|
||||
fprintf(out, "%selement(\"%s\",%i,%i)", idx > 0 ? "," : "", mixer_element_name(&element->data.mux1.psel[idx]), element->data.mux1.psel[idx].index, element->data.mux1.psel[idx].type);
|
||||
}
|
||||
fprintf(out, "))\n");
|
||||
break;
|
||||
case SND_MIXER_ETYPE_MUX2:
|
||||
fprintf(out, " element(\"%s\",%i,%i,Mux2(", mixer_element_name(&element->eid), element->eid.index, element->eid.type);
|
||||
fprintf(out, "element(\"%s\",%i,%i)", mixer_element_name(&element->data.mux2.output), element->data.mux2.output.index, element->data.mux2.output.type);
|
||||
fprintf(out, "element(\"%s\",%i,%i)", mixer_element_name(&element->data.mux2.sel), element->data.mux2.sel.index, element->data.mux2.sel.type);
|
||||
fprintf(out, "))\n");
|
||||
break;
|
||||
case SND_MIXER_ETYPE_TONE_CONTROL1:
|
||||
|
|
|
@ -743,8 +743,8 @@ int show_element_contents(void *handle, snd_mixer_eid_t *eid, const char *space)
|
|||
}
|
||||
break;
|
||||
case SND_MIXER_ETYPE_MUX1:
|
||||
for (idx = 0; idx < element.data.mux1.output; idx++) {
|
||||
snd_mixer_eid_t *eid = &element.data.mux1.poutput[idx];
|
||||
for (idx = 0; idx < element.data.mux1.sel; idx++) {
|
||||
snd_mixer_eid_t *eid = &element.data.mux1.psel[idx];
|
||||
printf("%sVoice %i: Element ", space, idx);
|
||||
if (eid->name[0] == '\0') {
|
||||
printf("NONE\n");
|
||||
|
@ -758,13 +758,13 @@ int show_element_contents(void *handle, snd_mixer_eid_t *eid, const char *space)
|
|||
case SND_MIXER_ETYPE_MUX2:
|
||||
{
|
||||
printf("%sAll voices: Element ", space);
|
||||
if (element.data.mux2.output.name[0] == '\0') {
|
||||
if (element.data.mux2.sel.name[0] == '\0') {
|
||||
printf("NONE\n");
|
||||
} else {
|
||||
printf("'%s',%i,%i\n",
|
||||
element_name(element.data.mux2.output.name),
|
||||
element.data.mux2.output.index,
|
||||
element.data.mux2.output.type);
|
||||
element_name(element.data.mux2.sel.name),
|
||||
element.data.mux2.sel.index,
|
||||
element.data.mux2.sel.type);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1335,8 +1335,8 @@ int eset_mux1(int argc, char *argv[], void *handle, snd_mixer_eid_t *eid)
|
|||
snd_mixer_element_info_free(&info);
|
||||
return 1;
|
||||
}
|
||||
for (idx = 0; idx < element.data.mux1.output; idx++)
|
||||
element.data.mux1.poutput[idx] = xeid;
|
||||
for (idx = 0; idx < element.data.mux1.sel; idx++)
|
||||
element.data.mux1.psel[idx] = xeid;
|
||||
} else {
|
||||
for (idx = 0; idx < element.data.volume1.voices; idx++) {
|
||||
if (parse_eid(argv[idx >= argc ? argc - 1 : idx], &xeid)) {
|
||||
|
@ -1345,7 +1345,7 @@ int eset_mux1(int argc, char *argv[], void *handle, snd_mixer_eid_t *eid)
|
|||
snd_mixer_element_info_free(&info);
|
||||
return 1;
|
||||
}
|
||||
element.data.mux1.poutput[idx] = xeid;
|
||||
element.data.mux1.psel[idx] = xeid;
|
||||
}
|
||||
}
|
||||
if ((err = snd_mixer_element_write(handle, &element)) < 0) {
|
||||
|
@ -1390,7 +1390,7 @@ int eset_mux2(int argc, char *argv[], void *handle, snd_mixer_eid_t *eid)
|
|||
snd_mixer_element_info_free(&info);
|
||||
return 1;
|
||||
}
|
||||
element.data.mux2.output = xeid;
|
||||
element.data.mux2.sel = xeid;
|
||||
if ((err = snd_mixer_element_write(handle, &element)) < 0) {
|
||||
error("Mixer element write error: %s\n", snd_strerror(err));
|
||||
snd_mixer_element_free(&element);
|
||||
|
|
Loading…
Reference in a new issue