Instantly share code, notes, and snippets.

anonymous /alsa_mixer_noheader.c Secret
Created Dec 1, 2017

Embed
What would you like to do?
int printf(char*, ...);
int snd_mixer_open(void**, int);
int snd_mixer_attach(void* mixer, char*);
int snd_mixer_selem_register(void*, void*, void**);
int snd_mixer_load(void* mixer);
void* snd_mixer_first_elem(void*);
void* snd_mixer_elem_next(void*);
char *snd_mixer_selem_get_name(void*);
int snd_mixer_selem_get_playback_volume_range(void*, long*, long*);
int snd_mixer_close(void*);
char* snd_mixer_selem_get_name(void*);
int snd_mixer_selem_set_playback_volume_all(void*, long);
int main()
{
void* handle;
void* elem;
snd_mixer_open(&handle, 0);
snd_mixer_attach(handle, "default");
snd_mixer_selem_register(handle, 0, 0);
snd_mixer_load(handle);
elem = snd_mixer_first_elem(handle);
while (elem)
{
long min, max;
snd_mixer_selem_get_playback_volume_range(
elem, &min, &max
);
snd_mixer_selem_set_playback_volume_all(elem, max);
printf("%s\n", snd_mixer_selem_get_name(elem));
elem = snd_mixer_elem_next(elem);
}
snd_mixer_close(handle);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment