diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/settings.h | 7 | ||||
-rw-r--r-- | src/ui_act.c | 18 | ||||
-rw-r--r-- | src/ui_act.h | 1 | ||||
-rw-r--r-- | src/ui_dispatch.h | 2 |
4 files changed, 21 insertions, 7 deletions
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> |