summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--src/interface.c4
-rw-r--r--src/interface.h1
-rw-r--r--src/pa-sink-ctl.c1
-rw-r--r--src/pa-sink-ctl.h7
-rw-r--r--src/sink_input.h3
6 files changed, 7 insertions, 11 deletions
diff --git a/configure.ac b/configure.ac
index 8d61691..2598614 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@ AC_SUBST(PULSE_CFLAGS)
AC_SUBST(PULSE_LIBS)
# Checks for header files.
-AC_CHECK_HEADERS([stdio.h stdlib.h string.h ncurses.h glib.h pulse/pulseaudio.h pulse/glib-mainloop.h])
+AC_CHECK_HEADERS([stdio.h stdlib.h stdint.h string.h ncurses.h glib.h pulse/pulseaudio.h pulse/glib-mainloop.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_UINT32_T
diff --git a/src/interface.c b/src/interface.c
index 4ac1a0f..771127b 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -9,7 +9,6 @@
#include "sink.h"
#include "pa-sink-ctl.h"
-#define VOLUME_MAX UINT16_MAX
#define VOLUME_BAR_LEN 50
#define WIDTH 80
#define HEIGHT 10
@@ -188,9 +187,8 @@ void get_input(void)
};
} else
break;
-
int input_vol = tmp.tmp_vol + 2 * volume_mult * (VOLUME_MAX / 100);
- tmp.tmp_vol = CLAMP(input_vol, 0, VOLUME_MAX); /* force input_vol in [0, VOL_MAX] */
+ tmp.tmp_vol = CLAMP(input_vol, VOLUME_MIN, VOLUME_MAX); /* force input_vol in [0, VOL_NORM] */
for (int i = 0; i < tmp.volume.channels; ++i)
tmp.volume.values[i] = tmp.tmp_vol;
diff --git a/src/interface.h b/src/interface.h
index c6208fb..0290d1f 100644
--- a/src/interface.h
+++ b/src/interface.h
@@ -3,7 +3,6 @@
#include <pulse/pulseaudio.h>
-#define VOLUME_MAX UINT16_MAX
#define VOLUME_BAR_LEN 50
#define WIDTH 80
#define HEIGHT 10
diff --git a/src/pa-sink-ctl.c b/src/pa-sink-ctl.c
index 98b57ad..aa7870a 100644
--- a/src/pa-sink-ctl.c
+++ b/src/pa-sink-ctl.c
@@ -15,7 +15,6 @@
#include "interface.h"
#include "pa-sink-ctl.h"
-#define VOLUME_MAX UINT16_MAX
#define VOLUME_BAR_LEN 50
#define WIDTH 80
#define HEIGHT 10
diff --git a/src/pa-sink-ctl.h b/src/pa-sink-ctl.h
index 36201cb..eb130d4 100644
--- a/src/pa-sink-ctl.h
+++ b/src/pa-sink-ctl.h
@@ -2,16 +2,19 @@
#define PA_SINK_CTL_H
#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
#include <pulse/pulseaudio.h>
#include <ncurses.h>
#include <string.h>
-#include <stdlib.h>
#include "sink_input.h"
#include "sink.h"
#include "interface.h"
-#define VOLUME_MAX UINT16_MAX
+#define VOLUME_MIN ((intmax_t) PA_VOLUME_MUTED)
+#define VOLUME_MAX ((intmax_t) PA_VOLUME_NORM)
+
#define VOLUME_BAR_LEN 50
#define WIDTH 80
#define HEIGHT 10
diff --git a/src/sink_input.h b/src/sink_input.h
index 4da8981..ec636d0 100644
--- a/src/sink_input.h
+++ b/src/sink_input.h
@@ -6,9 +6,6 @@
#include <glib.h>
#include <pulse/pulseaudio.h>
-// TODO: change this with the given define from pulselib
-#define VOLUME_MAX UINT16_MAX
-
typedef struct _sink_input_info {
uint32_t index;
uint32_t sink;