Skip to content

Commit

Permalink
Update alsa.c
Browse files Browse the repository at this point in the history
Changed minimal and maximal volumes for assersion to fix the problem, when mocp isn't starting if you have volume above 100.
Also added constants to avoid magic numbers.
  • Loading branch information
pasabanov authored Jan 2, 2023
1 parent 48b48e5 commit 57ca528
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion alsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
# define ALSA_CHECK(...) do {} while (0)
#endif

static const int MIN_VOLUME = 0;
static const int MAX_VOLUME = 150;

static snd_pcm_t *handle = NULL;

static struct
Expand Down Expand Up @@ -316,7 +319,7 @@ static int alsa_read_mixer_raw (snd_mixer_elem_t *elem)
return -1;
}

assert (RANGE(0, vol, 100));
assert (RANGE(MIN_VOLUME, vol, MAX_VOLUME));

#if 0
{
Expand Down

0 comments on commit 57ca528

Please sign in to comment.