Fixed compile; removed snd_enum_xxx macros.

This commit is contained in:
Takashi Iwai 2001-07-11 15:00:59 +00:00
parent c7ed13b3ae
commit b2fca96965
2 changed files with 23 additions and 23 deletions

View file

@ -68,7 +68,7 @@ char *id_str(snd_ctl_elem_id_t *id)
static char str[128]; static char str[128];
assert(id); assert(id);
sprintf(str, "%i,%i,%i,%s,%i", sprintf(str, "%i,%i,%i,%s,%i",
snd_enum_to_int(snd_ctl_elem_id_get_interface(id)), snd_ctl_elem_id_get_interface(id),
snd_ctl_elem_id_get_device(id), snd_ctl_elem_id_get_device(id),
snd_ctl_elem_id_get_subdevice(id), snd_ctl_elem_id_get_subdevice(id),
snd_ctl_elem_id_get_name(id), snd_ctl_elem_id_get_name(id),
@ -215,7 +215,7 @@ static int get_control(snd_ctl_t *handle, snd_ctl_elem_id_t *id, snd_config_t *t
return err; return err;
} }
switch (snd_enum_to_int(type)) { switch (type) {
case SND_CTL_ELEM_TYPE_BOOLEAN: case SND_CTL_ELEM_TYPE_BOOLEAN:
break; break;
case SND_CTL_ELEM_TYPE_INTEGER: case SND_CTL_ELEM_TYPE_INTEGER:
@ -294,7 +294,7 @@ static int get_control(snd_ctl_t *handle, snd_ctl_elem_id_t *id, snd_config_t *t
} }
} }
switch (snd_enum_to_int(type)) { switch (type) {
case SND_CTL_ELEM_TYPE_BYTES: case SND_CTL_ELEM_TYPE_BYTES:
case SND_CTL_ELEM_TYPE_IEC958: case SND_CTL_ELEM_TYPE_IEC958:
{ {
@ -322,7 +322,7 @@ static int get_control(snd_ctl_t *handle, snd_ctl_elem_id_t *id, snd_config_t *t
} }
if (count == 1) { if (count == 1) {
switch (snd_enum_to_int(type)) { switch (type) {
case SND_CTL_ELEM_TYPE_BOOLEAN: case SND_CTL_ELEM_TYPE_BOOLEAN:
err = snd_config_string_add(control, "value", snd_ctl_elem_value_get_boolean(ctl, 0) ? "true" : "false"); err = snd_config_string_add(control, "value", snd_ctl_elem_value_get_boolean(ctl, 0) ? "true" : "false");
if (err < 0) { if (err < 0) {
@ -354,7 +354,7 @@ static int get_control(snd_ctl_t *handle, snd_ctl_elem_id_t *id, snd_config_t *t
return 0; return 0;
} }
default: default:
error("Unknown control type: %d\n", snd_enum_to_int(type)); error("Unknown control type: %d\n", type);
return -EINVAL; return -EINVAL;
} }
} }
@ -365,7 +365,7 @@ static int get_control(snd_ctl_t *handle, snd_ctl_elem_id_t *id, snd_config_t *t
return err; return err;
} }
switch (snd_enum_to_int(type)) { switch (type) {
case SND_CTL_ELEM_TYPE_BOOLEAN: case SND_CTL_ELEM_TYPE_BOOLEAN:
for (idx = 0; idx < count; idx++) { for (idx = 0; idx < count; idx++) {
err = snd_config_string_add(value, num_str(idx), snd_ctl_elem_value_get_boolean(ctl, idx) ? "true" : "false"); err = snd_config_string_add(value, num_str(idx), snd_ctl_elem_value_get_boolean(ctl, idx) ? "true" : "false");
@ -403,7 +403,7 @@ static int get_control(snd_ctl_t *handle, snd_ctl_elem_id_t *id, snd_config_t *t
} }
break; break;
default: default:
error("Unknown control type: %d\n", snd_enum_to_int(type)); error("Unknown control type: %d\n", type);
return -EINVAL; return -EINVAL;
} }
@ -519,7 +519,7 @@ static int config_iface(snd_config_t *n)
unsigned long i; unsigned long i;
snd_ctl_elem_iface_t idx; snd_ctl_elem_iface_t idx;
const char *str; const char *str;
switch (snd_enum_to_int(snd_config_get_type(n))) { switch (snd_config_get_type(n)) {
case SND_CONFIG_TYPE_INTEGER: case SND_CONFIG_TYPE_INTEGER:
snd_config_get_integer(n, &i); snd_config_get_integer(n, &i);
return i; return i;
@ -531,7 +531,7 @@ static int config_iface(snd_config_t *n)
} }
for (idx = 0; idx <= SND_CTL_ELEM_IFACE_LAST; snd_enum_incr(idx)) { for (idx = 0; idx <= SND_CTL_ELEM_IFACE_LAST; snd_enum_incr(idx)) {
if (strcasecmp(snd_ctl_elem_iface_name(idx), str) == 0) if (strcasecmp(snd_ctl_elem_iface_name(idx), str) == 0)
return snd_enum_to_int(idx); return idx;
} }
return -1; return -1;
} }
@ -540,7 +540,7 @@ static int config_bool(snd_config_t *n)
{ {
const char *str; const char *str;
long val; long val;
switch (snd_enum_to_int(snd_config_get_type(n))) { switch (snd_config_get_type(n)) {
case SND_CONFIG_TYPE_INTEGER: case SND_CONFIG_TYPE_INTEGER:
snd_config_get_integer(n, &val); snd_config_get_integer(n, &val);
if (val < 0 || val > 1) if (val < 0 || val > 1)
@ -565,7 +565,7 @@ static int config_enumerated(snd_config_t *n, snd_ctl_t *handle,
const char *str; const char *str;
long val; long val;
unsigned int idx, items; unsigned int idx, items;
switch (snd_enum_to_int(snd_config_get_type(n))) { switch (snd_config_get_type(n)) {
case SND_CONFIG_TYPE_INTEGER: case SND_CONFIG_TYPE_INTEGER:
snd_config_get_integer(n, &val); snd_config_get_integer(n, &val);
return val; return val;
@ -697,7 +697,7 @@ static int set_control(snd_ctl_t *handle, snd_config_t *control)
return -ENOENT; return -ENOENT;
} }
numid1 = snd_ctl_elem_info_get_numid(info); numid1 = snd_ctl_elem_info_get_numid(info);
iface1 = snd_enum_to_int(snd_ctl_elem_info_get_interface(info)); iface1 = snd_ctl_elem_info_get_interface(info);
device1 = snd_ctl_elem_info_get_device(info); device1 = snd_ctl_elem_info_get_device(info);
subdevice1 = snd_ctl_elem_info_get_subdevice(info); subdevice1 = snd_ctl_elem_info_get_subdevice(info);
name1 = snd_ctl_elem_info_get_name(info); name1 = snd_ctl_elem_info_get_name(info);
@ -723,7 +723,7 @@ static int set_control(snd_ctl_t *handle, snd_config_t *control)
snd_ctl_elem_value_set_numid(ctl, numid); snd_ctl_elem_value_set_numid(ctl, numid);
if (count == 1) { if (count == 1) {
switch (snd_enum_to_int(type)) { switch (type) {
case SND_CTL_ELEM_TYPE_BOOLEAN: case SND_CTL_ELEM_TYPE_BOOLEAN:
val = config_bool(value); val = config_bool(value);
if (val >= 0) { if (val >= 0) {
@ -749,11 +749,11 @@ static int set_control(snd_ctl_t *handle, snd_config_t *control)
case SND_CTL_ELEM_TYPE_IEC958: case SND_CTL_ELEM_TYPE_IEC958:
break; break;
default: default:
error("Unknow control type: %d", snd_enum_to_int(type)); error("Unknow control type: %d", type);
return -EINVAL; return -EINVAL;
} }
} }
switch (snd_enum_to_int(type)) { switch (type) {
case SND_CTL_ELEM_TYPE_BYTES: case SND_CTL_ELEM_TYPE_BYTES:
case SND_CTL_ELEM_TYPE_IEC958: case SND_CTL_ELEM_TYPE_IEC958:
{ {
@ -808,7 +808,7 @@ static int set_control(snd_ctl_t *handle, snd_config_t *control)
error("bad control.%d.value index", numid); error("bad control.%d.value index", numid);
return -EINVAL; return -EINVAL;
} }
switch (snd_enum_to_int(type)) { switch (type) {
case SND_CTL_ELEM_TYPE_BOOLEAN: case SND_CTL_ELEM_TYPE_BOOLEAN:
val = config_bool(n); val = config_bool(n);
if (val < 0) { if (val < 0) {

View file

@ -337,7 +337,7 @@ static int show_control(const char *space, snd_hctl_elem_t *elem,
count = snd_ctl_elem_info_get_count(info); count = snd_ctl_elem_info_get_count(info);
type = snd_ctl_elem_info_get_type(info); type = snd_ctl_elem_info_get_type(info);
printf("%s; type=%s,access=%s,values=%i", space, control_type(info), control_access(info), count); printf("%s; type=%s,access=%s,values=%i", space, control_type(info), control_access(info), count);
switch (snd_enum_to_int(type)) { switch (type) {
case SND_CTL_ELEM_TYPE_INTEGER: case SND_CTL_ELEM_TYPE_INTEGER:
printf(",min=%li,max=%li,step=%li\n", printf(",min=%li,max=%li,step=%li\n",
snd_ctl_elem_info_get_min(info), snd_ctl_elem_info_get_min(info),
@ -371,7 +371,7 @@ static int show_control(const char *space, snd_hctl_elem_t *elem,
for (idx = 0; idx < count; idx++) { for (idx = 0; idx < count; idx++) {
if (idx > 0) if (idx > 0)
printf(","); printf(",");
switch (snd_enum_to_int(type)) { switch (type) {
case SND_CTL_ELEM_TYPE_BOOLEAN: case SND_CTL_ELEM_TYPE_BOOLEAN:
printf("%s", snd_ctl_elem_value_get_boolean(control, idx) ? "on" : "off"); printf("%s", snd_ctl_elem_value_get_boolean(control, idx) ? "on" : "off");
break; break;
@ -477,7 +477,7 @@ static int show_selem(snd_mixer_t *handle, snd_mixer_selem_id_t *id, const char
if (snd_mixer_selem_is_playback_mono(elem)) { if (snd_mixer_selem_is_playback_mono(elem)) {
printf("Mono"); printf("Mono");
} else { } else {
for (chn = 0; chn <= SND_MIXER_SCHN_LAST; snd_enum_incr(chn)){ for (chn = 0; chn <= SND_MIXER_SCHN_LAST; chn++){
if (!snd_mixer_selem_has_playback_channel(elem, chn)) if (!snd_mixer_selem_has_playback_channel(elem, chn))
continue; continue;
printf("%s ", snd_mixer_selem_channel_name(chn)); printf("%s ", snd_mixer_selem_channel_name(chn));
@ -491,7 +491,7 @@ static int show_selem(snd_mixer_t *handle, snd_mixer_selem_id_t *id, const char
if (snd_mixer_selem_is_capture_mono(elem)) { if (snd_mixer_selem_is_capture_mono(elem)) {
printf("Mono"); printf("Mono");
} else { } else {
for (chn = 0; chn <= SND_MIXER_SCHN_LAST; snd_enum_incr(chn)){ for (chn = 0; chn <= SND_MIXER_SCHN_LAST; chn++){
if (!snd_mixer_selem_has_capture_channel(elem, chn)) if (!snd_mixer_selem_has_capture_channel(elem, chn))
continue; continue;
printf("%s ", snd_mixer_selem_channel_name(chn)); printf("%s ", snd_mixer_selem_channel_name(chn));
@ -521,7 +521,7 @@ static int show_selem(snd_mixer_t *handle, snd_mixer_selem_id_t *id, const char
(snd_mixer_selem_is_capture_mono(elem) || (snd_mixer_selem_is_capture_mono(elem) ||
(!snd_mixer_selem_has_capture_volume(elem) && (!snd_mixer_selem_has_capture_volume(elem) &&
!snd_mixer_selem_has_capture_switch(elem)))); !snd_mixer_selem_has_capture_switch(elem))));
for (chn = 0; chn <= SND_MIXER_SCHN_LAST; snd_enum_incr(chn)) { for (chn = 0; chn <= SND_MIXER_SCHN_LAST; chn++) {
if (!snd_mixer_selem_has_playback_channel(elem, chn) && if (!snd_mixer_selem_has_playback_channel(elem, chn) &&
!snd_mixer_selem_has_capture_channel(elem, chn)) !snd_mixer_selem_has_capture_channel(elem, chn))
continue; continue;
@ -777,7 +777,7 @@ static int cset(int argc, char *argv[], int roflag)
if (!roflag) { if (!roflag) {
ptr = argv[1]; ptr = argv[1];
for (idx = 0; idx < count && idx < 128 && *ptr; idx++) { for (idx = 0; idx < count && idx < 128 && *ptr; idx++) {
switch (snd_enum_to_int(type)) { switch (type) {
case SND_CTL_ELEM_TYPE_BOOLEAN: case SND_CTL_ELEM_TYPE_BOOLEAN:
tmp = 0; tmp = 0;
if (!strncasecmp(ptr, "on", 2) || !strncasecmp(ptr, "up", 2)) { if (!strncasecmp(ptr, "on", 2) || !strncasecmp(ptr, "up", 2)) {
@ -952,7 +952,7 @@ static int sset(unsigned int argc, char *argv[], int roflag)
multi = (strchr(argv[idx], ',') != NULL); multi = (strchr(argv[idx], ',') != NULL);
ptr = argv[idx]; ptr = argv[idx];
for (chn = 0; chn <= SND_MIXER_SCHN_LAST; snd_enum_incr(chn)) { for (chn = 0; chn <= SND_MIXER_SCHN_LAST; chn++) {
long vol; long vol;
if (!(channels & (1 << chn)) || if (!(channels & (1 << chn)) ||
!snd_mixer_selem_has_playback_channel(elem, chn)) !snd_mixer_selem_has_playback_channel(elem, chn))