X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=alsa_mix.c;h=af4adc46382da236e7fec5786fa3d40234f16546;hb=4ce5b6570ed83ef2ab5296f369f147593507286b;hp=cad58af0a9481bd8cb7985cf87b431685f537c01;hpb=ca006af72cef95b0aba3cad799badde47010a621;p=paraslash.git diff --git a/alsa_mix.c b/alsa_mix.c index cad58af0..af4adc46 100644 --- a/alsa_mix.c +++ b/alsa_mix.c @@ -1,8 +1,4 @@ -/* - * Copyright (C) 2012 Andre Noll - * - * Licensed under the GPL v2. For licencing details see COPYING. - */ +/* Copyright (C) 2012 Andre Noll , see file COPYING. */ /** \file alsa_mix.c The ALSA mixer plugin. */ @@ -56,7 +52,7 @@ static int alsa_mix_open(const char *dev, struct mixer_handle **handle) PARA_INFO_LOG("snd_mixer_{open,attach,register,load}\n"); *handle = NULL; - h = para_calloc(sizeof(*h)); + h = zalloc(sizeof(*h)); h->card = para_strdup(dev? dev : "hw:0"); ret = snd_mixer_open(&h->mixer, 0); if (ret < 0) { @@ -142,7 +138,7 @@ static int alsa_mix_set_channel(struct mixer_handle *h, snd_mixer_selem_id_set_name(sid, mixer_channel); h->elem = snd_mixer_find_selem(h->mixer, sid); if (!h->elem) { - PARA_NOTICE_LOG("unable to find simple control '%s',%i\n", + PARA_NOTICE_LOG("unable to find simple control '%s',%u\n", snd_mixer_selem_id_get_name(sid), snd_mixer_selem_id_get_index(sid)); ret = -E_BAD_CHANNEL; @@ -216,19 +212,13 @@ static int alsa_mix_set(struct mixer_handle *h, int val) return 1; } -/** - * The init function of the ALSA mixer. - * - * \param self The structure to initialize. - * - * \sa struct \ref mixer, \ref oss_mix_init(). - */ -void alsa_mix_init(struct mixer *self) -{ - self->open = alsa_mix_open; - self->get_channels = alsa_mix_get_channels; - self->set_channel = alsa_mix_set_channel; - self->close = alsa_mix_close; - self->get = alsa_mix_get; - self->set = alsa_mix_set; -} +/** The mixer operations for the ALSA mixer. */ +const struct mixer alsa_mixer = { + .name = "alsa", + .open = alsa_mix_open, + .get_channels = alsa_mix_get_channels, + .set_channel = alsa_mix_set_channel, + .close = alsa_mix_close, + .get = alsa_mix_get, + .set = alsa_mix_set +};