Skip to content

Commit

Permalink
Changed minimal and maximal volumes for assersion to fix the problem,…
Browse files Browse the repository at this point in the history
… when mocp isn't starting if you have volume above 100.

Also added constants to avoid magic numbers.
  • Loading branch information
pasabanov committed Sep 5, 2024
1 parent 48b48e5 commit 6c1b0cb
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 long MIN_VOLUME = 0;
static const long 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 6c1b0cb

Please sign in to comment.