Re: Master volume control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Paul D. DeRocco wrote:
> ... But the analog output has a post-DAC volume control which I'd like to
> control from my synth app.
>
> Can anyone tell me how to do this?

Find out the name and the valid range of that mixer control, then
just execute:

  system("amixer cset name='Master Playback Volume' 42");

or access the control directly like this:

#include <stdio.h>
#include <stdlib.h>
#include <alsa/asoundlib.h>

static void check(int err, const char *f)
{
        if (err < 0) {
                fprintf(stderr, "%s failed: %s\n", f, snd_strerror(err));
                exit(EXIT_FAILURE);
        }
}
#define CHECK(f) check(f, #f)

int main()
{
        snd_ctl_t *ctl;
        snd_ctl_elem_value_t *value;

        CHECK(snd_ctl_open(&ctl, "default", 0));

        snd_ctl_elem_value_alloca(&value);
        snd_ctl_elem_value_set_interface(value, SND_CTL_ELEM_IFACE_MIXER);
        snd_ctl_elem_value_set_name(value, "Master Playback Volume");
        snd_ctl_elem_value_set_integer(value, 0, 42);
        CHECK(snd_ctl_elem_write(ctl, value));

        snd_ctl_close(ctl);
        return 0;
}


Regards,
Clemens

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user


[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux