Skip to content

Commit

Permalink
Merge pull request #8 from darrell-k/master
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelherger authored Jun 3, 2024
2 parents d9cde23 + 2a4dde2 commit 0433742
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
18 changes: 18 additions & 0 deletions HTML/EN/plugins/DSDPlayer/settings/player.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,24 @@
</select>
[% END %]

[% WRAPPER settingGroup title="PLUGIN_DSDPLAYER_GAIN" desc="PLUGIN_DSDPLAYER_GAIN_DESC" %]
<select class="stdedit" name="pref_gain" id="gain">
[% FOREACH option = {
'0' => '0 dB',
'1' => '1 dB',
'2' => '2 dB',
'3' => '3 dB',
'4' => '4 dB',
'5' => '5 dB',
'6' => '6 dB',
} %]
<option [% IF prefs.gain == option.key %]selected [% END %]value="[% option.key %]">
[% option.value %]
</option>
[%- END -%]
</select>
[% END %]

[% WRAPPER settingGroup title="PLUGIN_DSDPLAYER_OTHER" desc="PLUGIN_DSDPLAYER_OTHER_DESC" %]
<div class="input">
<input class="input" type="text" name="pref_flags" value="[% prefs.flags %]" placeholder="Flags" id="flags" />
Expand Down
5 changes: 4 additions & 1 deletion PlayerSettings.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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'} || "";
Expand All @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions Plugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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' };

Expand Down
7 changes: 6 additions & 1 deletion strings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit 0433742

Please sign in to comment.