summaryrefslogtreecommitdiff
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
parent9b26abba399a9b6d779713033693b631e5084458 (diff)
downloadpianobar-aaf5eae5e2a66c4f1b0e18e266377182525448d3.tar.gz
pianobar-aaf5eae5e2a66c4f1b0e18e266377182525448d3.tar.bz2
pianobar-aaf5eae5e2a66c4f1b0e18e266377182525448d3.zip
Added gain_mul setting to soften effect of replaygain.
-rw-r--r--contrib/pianobar.16
-rw-r--r--src/player.c4
-rw-r--r--src/settings.c3
-rw-r--r--src/settings.h1
4 files changed, 12 insertions, 2 deletions
diff --git a/contrib/pianobar.1 b/contrib/pianobar.1
index 4fc09c3..0bea781 100644
--- a/contrib/pianobar.1
+++ b/contrib/pianobar.1
@@ -364,6 +364,12 @@ Your pandora.com username.
.B volume = 0
Initial volume correction in dB. Usually between -30 and +5.
+.TP
+.B gain_mul = 1.0
+Pandora sends a ReplayGain value with every song. This sets a multiplier so that the gain adjustment can be
+reduced. 0.0 means no gain adjustment, 1.0 means full gain adjustment, values inbetween reduce the magnitude
+of gain adjustment.
+
.SH REMOTE CONTROL
.B pianobar
can be controlled through a fifo. You have to create it yourself by executing
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;