PARA_NOTICE_LOG("unable to find simple control '%s',%i\n",
snd_mixer_selem_id_get_name(sid),
snd_mixer_selem_id_get_index(sid));
- return -E_ALSA_MIX_BAD_ELEM;
+ return -E_BAD_CHANNEL;
}
ret = snd_mixer_selem_get_playback_volume_range(h->elem,
&h->pmin, &h->pmax);
if (ret < 0) {
PARA_NOTICE_LOG("unable to get %s range (%s): %s\n",
mixer_channel, h->card, snd_strerror(ret));
- return -E_ALSA_MIX_BAD_ELEM;
+ return -E_ALSA_MIX_RANGE;
}
if (h->pmin < 0 || h->pmax < 0 || h->pmin >= h->pmax) {
PARA_NOTICE_LOG("alsa reported %s range %ld-%ld (%s)\n",
mixer_channel, h->pmin, h->pmax, h->card);
- return -E_ALSA_MIX_BAD_ELEM;
+ return -E_ALSA_MIX_RANGE;
}
return 1;
}
#define GGO_ERRORS
#define COLOR_ERRORS
#define SIGNAL_ERRORS
-#define FADE_ERRORS
+#define OSS_MIX_ERRORS
#define STDOUT_ERRORS
#define FILE_WRITE_ERRORS
#define STDIN_ERRORS
extern const char **para_errlist[];
-#define OSS_MIX_ERRORS \
- PARA_ERROR(OSS_MIXER_CHANNEL, "invalid mixer channel"), \
-
-
#define ALSA_MIX_ERRORS \
PARA_ERROR(ALSA_MIX_OPEN, "could not open mixer"), \
- PARA_ERROR(ALSA_MIX_BAD_ELEM, "invalid/unsupported control element"), \
PARA_ERROR(ALSA_MIX_GET_VAL, "could not read control element state"), \
PARA_ERROR(ALSA_MIX_SET_VAL, "could not set control element state"), \
+ PARA_ERROR(ALSA_MIX_RANGE, "value control element out of range"), \
#define RESAMPLE_FILTER_ERRORS \
PARA_ERROR(NO_VALID_FILES, "no valid file found in playlist"), \
PARA_ERROR(BAD_PLAY_CMD, "invalid command"), \
+#define FADE_ERRORS \
+ PARA_ERROR(BAD_CHANNEL, "invalid channel"), \
#define FLACDEC_FILTER_ERRORS \
PARA_ERROR(FLACDEC_DECODER_ALLOC, "could not allocate stream decoder"), \
static int set_channel(struct mixer *m, struct mixer_handle *h, const char *channel)
{
- char *channels;
- int ret;
- ret = m->set_channel(h, channel);
- if (ret >= 0) {
- PARA_NOTICE_LOG("using %s mixer channel\n",
- channel? channel : "default");
- return ret;
- }
- channels = m->get_channels(h);
- printf("Available channels: %s\n", channels);
- free(channels);
- return ret;
+ PARA_NOTICE_LOG("using %s mixer channel\n", channel?
+ channel : "default");
+ return m->set_channel(h, channel);
}
/* Fade to new volume in fade_time seconds. */
if (ret < 0)
goto out;
ret = set_channel(m, h, conf.mixer_channel_arg);
+ if (ret == -E_BAD_CHANNEL) {
+ char *channels = m->get_channels(h);
+ printf("Available channels: %s\n", channels);
+ free(channels);
+ }
if (ret < 0)
goto out;
switch (conf.mode_arg) {
handle->id = i;
return 1;
}
- return -E_OSS_MIXER_CHANNEL;
+ return -E_BAD_CHANNEL;
}
static int oss_mix_get(struct mixer_handle *handle)