diff --git a/HTML/EN/plugins/DSDPlayer/settings/player.html b/HTML/EN/plugins/DSDPlayer/settings/player.html
index b012e9b..54a87d7 100644
--- a/HTML/EN/plugins/DSDPlayer/settings/player.html
+++ b/HTML/EN/plugins/DSDPlayer/settings/player.html
@@ -82,6 +82,24 @@
[% END %]
+[% WRAPPER settingGroup title="PLUGIN_DSDPLAYER_GAIN" desc="PLUGIN_DSDPLAYER_GAIN_DESC" %]
+
+[% END %]
+
[% WRAPPER settingGroup title="PLUGIN_DSDPLAYER_OTHER" desc="PLUGIN_DSDPLAYER_OTHER_DESC" %]
diff --git a/PlayerSettings.pm b/PlayerSettings.pm
index 78e6708..9c2c972 100644
--- a/PlayerSettings.pm
+++ b/PlayerSettings.pm
@@ -35,6 +35,7 @@ sub handler {
if ($params->{'saveSettings'}) {
$prefs->client($client)->set('usedop', $params->{'pref_usedop'} || 0);
+ $prefs->client($client)->set('gain', $params->{'pref_gain'} || 0);
my $quality= $params->{'pref_quality'} || "";
my $filter = $params->{'pref_filter'} || "";
@@ -48,7 +49,8 @@ sub handler {
$prefs->client($client)->set('resample', "$quality$filter$steep:$flags:$att:$precision:$end:$start:$phase");
- $log->debug("usdop: " . $params->{'pref_usedop'});
+ $log->debug("usedop: " . $params->{'pref_usedop'});
+ $log->debug("gain: " . $params->{'pref_gain'});
$log->debug("resample: $quality$filter$steep:$flags:$att:$precision:$end:$start:$phase");
Plugins::DSDPlayer::Plugin::setupTranscoder($client);
@@ -61,6 +63,7 @@ sub handler {
$params->{'dopavail'} = $client->maxSupportedSamplerate >= 176400 ? 1 : 0;
$params->{'prefs'}->{'usedop'} = $prefs->client($client)->get('usedop');
+ $params->{'prefs'}->{'gain'} = $prefs->client($client)->get('gain');
my $resample = $prefs->client($client)->get('resample');
my ($recipe, $flags, $att, $precision, $end, $start, $phase) = split(":", $resample);
diff --git a/Plugin.pm b/Plugin.pm
index 8c6a62c..e8fbb35 100644
--- a/Plugin.pm
+++ b/Plugin.pm
@@ -31,8 +31,10 @@ sub setupTranscoder {
my $usedop = $prefs->client($client)->get('usedop');
my $resample = $prefs->client($client)->get('resample') || "::::::";
+ my $gain = $prefs->client($client)->get('gain');
my $cmdTable = "[dsdplay] -R $resample " . '$START$ $END$ $RESAMPLE$ $FILE$';
+ $cmdTable .= " | [sox] -q -t flac - -t flac -C 0 - gain -l $gain" if $gain;
my $cmdTableDoP = "[dsdplay] -R $resample -u " . '$START$ $END$ $RESAMPLE$ $FILE$';
my $capabilities = { F => 'noArgs', T => 'START=-s %t', U => 'END=-e %v', D => 'RESAMPLE=-r %d' };
diff --git a/strings.txt b/strings.txt
index 1566cdd..5dbe7b2 100644
--- a/strings.txt
+++ b/strings.txt
@@ -70,8 +70,13 @@ PLUGIN_DSDPLAYER_OTHER
EN Other Params
PLUGIN_DSDPLAYER_OTHER_DESC
- EN Specifiy additional parameters for soxr resampling.
+ EN Specify additional parameters for soxr resampling.
PLUGIN_DSDPLAYER_NONE
EN (none selected)
+PLUGIN_DSDPLAYER_GAIN
+ EN Add gain
+
+PLUGIN_DSDPLAYER_GAIN_DESC
+ EN Many DSD/DSF files (especially SACD rips) are mastered to a peak of -6dB. This makes their volume low compared to other files. You can increase the level when resampling to PCM. If your chosen gain introduces audible distortion for any of your files, reduce it.