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

#define VOL_CH  "Master"

void increaseVolume()
{
long vol = 0;
long min, max;
snd_mixer_t *handle;
snd_mixer_selem_id_t *sid;

snd_mixer_open(&handle, 0);
snd_mixer_attach(handle, "default");
snd_mixer_selem_register(handle, NULL, NULL);
snd_mixer_load(handle);

snd_mixer_selem_id_alloca(&sid);
snd_mixer_selem_id_set_index(sid, 0);
snd_mixer_selem_id_set_name(sid, VOL_CH);
snd_mixer_elem_t* elem = snd_mixer_find_selem(handle, sid);

snd_mixer_selem_get_playback_volume_range(elem, &min, &max);
snd_mixer_selem_get_playback_volume(elem, SND_MIXER_SCHN_MONO, &vol );
long vol_percent = vol * 100 / ( int )max;
long vol_new = vol_percent * max / 100;

printf( "%ld%%", vol_percent );
printf( "%ld%%", vol_new );
int volume = vol_percent + 3;
printf( "%i", volume );
snd_mixer_selem_set_playback_volume_all(elem, volume * max / 100);

snd_mixer_close(handle);
}
