From 57ca528008029bfc6ee05707632371f23dcd0209 Mon Sep 17 00:00:00 2001 From: BrainKicker <30545094+BrainKicker@users.noreply.github.com> Date: Mon, 2 Jan 2023 19:59:15 +0300 Subject: [PATCH] Update alsa.c 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. --- alsa.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa.c b/alsa.c index 49a8196c..33ab1f8c 100644 --- a/alsa.c +++ b/alsa.c @@ -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 @@ -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 {