summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/config-example1
-rw-r--r--contrib/pianobar.14
-rw-r--r--src/settings.h7
-rw-r--r--src/ui_act.c18
-rw-r--r--src/ui_act.h1
-rw-r--r--src/ui_dispatch.h2
6 files changed, 26 insertions, 7 deletions
diff --git a/contrib/config-example b/contrib/config-example
index 4958e66..b1648fd 100644
--- a/contrib/config-example
+++ b/contrib/config-example
@@ -37,6 +37,7 @@
#act_stationselectquickmix = x
#act_voldown = (
#act_volup = )
+#act_volreset = ^
# Misc
#audio_quality = low
diff --git a/contrib/pianobar.1 b/contrib/pianobar.1
index 5efaca1..490ee23 100644
--- a/contrib/pianobar.1
+++ b/contrib/pianobar.1
@@ -162,6 +162,10 @@ with 'a' or select none with 'n'.
Decrease volume.
.TP
+.B act_volreset = ^
+Reset volume.
+
+.TP
.B act_volup = )
Increase volume.
diff --git a/src/settings.h b/src/settings.h
index 819f8cb..aad1fc4 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -57,10 +57,11 @@ typedef enum {
BAR_KS_MANAGESTATION = 23,
BAR_KS_PLAYPAUSE2 = 24,
BAR_KS_CREATESTATIONFROMSONG = 25,
- BAR_KS_PLAY = 26,
- BAR_KS_PAUSE = 27,
+ BAR_KS_PLAY = 26,
+ BAR_KS_PAUSE = 27,
+ BAR_KS_VOLRESET = 28,
/* insert new shortcuts _before_ this element and increase its value */
- BAR_KS_COUNT = 28,
+ BAR_KS_COUNT = 29,
} BarKeyShortcutId_t;
#define BAR_KS_DISABLED '\x00'
diff --git a/src/ui_act.c b/src/ui_act.c
index 0f73018..270c1f5 100644
--- a/src/ui_act.c
+++ b/src/ui_act.c
@@ -647,20 +647,30 @@ BarUiActCallback(BarUiActBookmark) {
}
}
+static void BarUiActUpdateScale (BarApp_t *app) {
+ /* FIXME: assuming unsigned integer store is atomic operation */
+ app->player.scale = BarPlayerCalcScale (app->player.gain + app->settings.volume);
+}
+
/* decrease volume
*/
BarUiActCallback(BarUiActVolDown) {
--app->settings.volume;
- /* FIXME: assuming unsigned integer store is atomic operation */
- app->player.scale = BarPlayerCalcScale (app->player.gain + app->settings.volume);
+ BarUiActUpdateScale (app);
}
/* increase volume
*/
BarUiActCallback(BarUiActVolUp) {
++app->settings.volume;
- /* FIXME: assuming unsigned integer store is atomic operation */
- app->player.scale = BarPlayerCalcScale (app->player.gain + app->settings.volume);
+ BarUiActUpdateScale (app);
+}
+
+/* reset volume
+ */
+BarUiActCallback(BarUiActVolReset) {
+ app->settings.volume = 0;
+ BarUiActUpdateScale (app);
}
/* manage station (remove seeds or feedback)
diff --git a/src/ui_act.h b/src/ui_act.h
index 3e6c4c5..bd2cf88 100644
--- a/src/ui_act.h
+++ b/src/ui_act.h
@@ -60,5 +60,6 @@ BarUiActCallback(BarUiActBookmark);
BarUiActCallback(BarUiActVolDown);
BarUiActCallback(BarUiActVolUp);
BarUiActCallback(BarUiActManageStation);
+BarUiActCallback(BarUiActVolReset);
#endif /* _UI_ACT_H */
diff --git a/src/ui_dispatch.h b/src/ui_dispatch.h
index 6b96ae3..ca8a292 100644
--- a/src/ui_dispatch.h
+++ b/src/ui_dispatch.h
@@ -101,6 +101,8 @@ static const BarUiDispatchAction_t dispatchActions[BAR_KS_COUNT] = {
"act_songplay"},
{'S', BAR_DC_GLOBAL | BAR_DC_STATION, BarUiActPause, "pause playback",
"act_songpause"},
+ {'^', BAR_DC_GLOBAL, BarUiActVolReset, "reset volume",
+ "act_volreset"},
};
#include <piano.h>