summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSean Greenslade <sean@seangreenslade.com>2017-03-14 19:36:24 -0700
committerSean Greenslade <sean@seangreenslade.com>2017-03-14 19:36:24 -0700
commitaaf5eae5e2a66c4f1b0e18e266377182525448d3 (patch)
tree5b691432fc4a961d197bb3a4cb736d7398dd8192 /src
parent9b26abba399a9b6d779713033693b631e5084458 (diff)
downloadpianobar-aaf5eae5e2a66c4f1b0e18e266377182525448d3.tar.gz
pianobar-aaf5eae5e2a66c4f1b0e18e266377182525448d3.tar.bz2
pianobar-aaf5eae5e2a66c4f1b0e18e266377182525448d3.zip
Added gain_mul setting to soften effect of replaygain.
Diffstat (limited to 'src')
-rw-r--r--src/player.c4
-rw-r--r--src/settings.c3
-rw-r--r--src/settings.h1
3 files changed, 6 insertions, 2 deletions
diff --git a/src/player.c b/src/player.c
index 784616c..f3c57f8 100644
--- a/src/player.c
+++ b/src/player.c
@@ -94,13 +94,13 @@ void BarPlayerSetVolume (player_t * const player) {
* -> print to string and let them parse it again */
char strbuf[16];
snprintf (strbuf, sizeof (strbuf), "%fdB",
- player->settings->volume + player->gain);
+ player->settings->volume + (player->gain * player->settings->gainMul));
assert (player->fgraph != NULL);
if ((ret = avfilter_graph_send_command (player->fgraph, "volume", "volume",
strbuf, NULL, 0, 0)) < 0) {
#else
/* convert from decibel */
- const double volume = pow (10, (player->settings->volume + player->gain) / 20);
+ const double volume = pow (10, (player->settings->volume + (player->gain * player->settings->gainMul)) / 20);
/* libav does not provide other means to set this right now. it might not
* even work everywhere. */
assert (player->fvolume != NULL);
diff --git a/src/settings.c b/src/settings.c
index 5731577..9dababc 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -160,6 +160,7 @@ void BarSettingsRead (BarSettings_t *settings) {
settings->autoselect = true;
settings->history = 5;
settings->volume = 0;
+ settings->gainMul = 1.0;
settings->maxPlayerErrors = 5;
settings->sortOrder = BAR_SORT_NAME_AZ;
settings->loveIcon = strdup (" <3");
@@ -362,6 +363,8 @@ void BarSettingsRead (BarSettings_t *settings) {
settings->atIcon = strdup (val);
} else if (streq ("volume", key)) {
settings->volume = atoi (val);
+ } else if (streq ("gain_mul", key)) {
+ settings->gainMul = atof (val);
} else if (streq ("format_nowplaying_song", key)) {
free (settings->npSongFormat);
settings->npSongFormat = strdup (val);
diff --git a/src/settings.h b/src/settings.h
index 0b40113..0403a83 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -87,6 +87,7 @@ typedef struct {
bool autoselect;
unsigned int history, maxPlayerErrors;
int volume;
+ float gainMul;
BarStationSorting_t sortOrder;
PianoAudioQuality_t audioQuality;
char *username;