aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--addons/resource.language.en_gb/resources/strings.po11
-rw-r--r--system/settings/settings.xml8
-rw-r--r--xbmc/Application.cpp3
-rw-r--r--xbmc/Application.h1
-rw-r--r--xbmc/cores/paplayer/PAPlayer.cpp5
-rw-r--r--xbmc/settings/Settings.cpp2
-rw-r--r--xbmc/settings/Settings.h1
7 files changed, 28 insertions, 3 deletions
diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po
index 699eae7852..589826b373 100644
--- a/addons/resource.language.en_gb/resources/strings.po
+++ b/addons/resource.language.en_gb/resources/strings.po
@@ -2911,7 +2911,10 @@ msgctxt "#642"
msgid "Files without ReplayGain information"
msgstr ""
-#empty string with id 643
+#: system/settings/settings.xml
+msgctxt "#643"
+msgid "Avoid clipping protection on ReplayGained files"
+msgstr ""
#: system/settings/settings.xml
msgctxt "#644"
@@ -18159,7 +18162,11 @@ msgctxt "#36269"
msgid "Reference volume (PreAmp level) to use for files without encoded ReplayGain information. Default is 89dB as per standard. Change with caution."
msgstr ""
-#empty string with id 36270
+#. Description of setting with label #643 "Avoid clipping protection on ReplayGained files"
+#: system/settings/settings.xml
+msgctxt "#36270"
+msgid "Play file at lower volume, if necessary, to avoid audio limiting clipping protection. Otherwise clipping protection will be provided by the audioengine in those parts that need it."
+msgstr ""
#. Description of setting with label #13314 "Crossfade between songs"
#: system/settings/settings.xml
diff --git a/system/settings/settings.xml b/system/settings/settings.xml
index bfbc512a96..5f0c23f987 100644
--- a/system/settings/settings.xml
+++ b/system/settings/settings.xml
@@ -471,6 +471,14 @@
<dependency type="enable" setting="musicplayer.replaygaintype" operator="!is">0</dependency>
</dependencies>
</setting>
+ <setting id="musicplayer.replaygainavoidclipping" type="boolean" parent="musicplayer.replaygaintype" label="643" help="36270">
+ <level>3</level>
+ <default>false</default>
+ <control type="toggle" />
+ <dependencies>
+ <dependency type="enable" setting="musicplayer.replaygaintype" operator="!is">0</dependency>
+ </dependencies>
+ </setting>
</group>
</category>
<category id="discs" label="14087" help="36193">
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
index a77e8776f8..cbab707a67 100644
--- a/xbmc/Application.cpp
+++ b/xbmc/Application.cpp
@@ -658,6 +658,7 @@ bool CApplication::Create()
m_replayGainSettings.iType = m_ServiceManager->GetSettings().GetInt(CSettings::SETTING_MUSICPLAYER_REPLAYGAINTYPE);
m_replayGainSettings.iPreAmp = m_ServiceManager->GetSettings().GetInt(CSettings::SETTING_MUSICPLAYER_REPLAYGAINPREAMP);
m_replayGainSettings.iNoGainPreAmp = m_ServiceManager->GetSettings().GetInt(CSettings::SETTING_MUSICPLAYER_REPLAYGAINNOGAINPREAMP);
+ m_replayGainSettings.bAvoidClipping = m_ServiceManager->GetSettings().GetBool(CSettings::SETTING_MUSICPLAYER_REPLAYGAINAVOIDCLIPPING);
// Create the Mouse, Keyboard, Remote, and Joystick devices
// Initialize after loading settings to get joystick deadzone setting
@@ -1462,6 +1463,8 @@ void CApplication::OnSettingChanged(const CSetting *setting)
m_replayGainSettings.iPreAmp = ((CSettingInt*)setting)->GetValue();
else if (StringUtils::EqualsNoCase(settingId, CSettings::SETTING_MUSICPLAYER_REPLAYGAINNOGAINPREAMP))
m_replayGainSettings.iNoGainPreAmp = ((CSettingInt*)setting)->GetValue();
+ else if (StringUtils::EqualsNoCase(settingId, CSettings::SETTING_MUSICPLAYER_REPLAYGAINAVOIDCLIPPING))
+ m_replayGainSettings.bAvoidClipping = ((CSettingBool*)setting)->GetValue();
}
void CApplication::OnSettingAction(const CSetting *setting)
diff --git a/xbmc/Application.h b/xbmc/Application.h
index 93bf3cce99..7cc550cc8b 100644
--- a/xbmc/Application.h
+++ b/xbmc/Application.h
@@ -108,6 +108,7 @@ struct ReplayGainSettings
int iPreAmp;
int iNoGainPreAmp;
int iType;
+ bool bAvoidClipping;
};
class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMsgTargetCallback,
diff --git a/xbmc/cores/paplayer/PAPlayer.cpp b/xbmc/cores/paplayer/PAPlayer.cpp
index edf8401963..db85ac44d4 100644
--- a/xbmc/cores/paplayer/PAPlayer.cpp
+++ b/xbmc/cores/paplayer/PAPlayer.cpp
@@ -498,8 +498,11 @@ inline bool PAPlayer::PrepareStream(StreamInfo *si)
if (peak * gain <= 1.0)
// No clipping protection needed
si->m_stream->SetReplayGain(gain);
+ else if (CServiceBroker::GetSettings().GetBool(CSettings::SETTING_MUSICPLAYER_REPLAYGAINAVOIDCLIPPING))
+ // Normalise volume reducing replaygain to avoid needing clipping protection, plays file at lower level
+ si->m_stream->SetReplayGain(1.0f / fabs(peak));
else
- // Clipping protecton provided as audio limiting
+ // Clipping protection (when enabled in AE) by audio limiting, applied just where needed
si->m_stream->SetAmplification(gain);
/* if its not the first stream and crossfade is not enabled */
diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp
index 89f0414803..7451bb51e8 100644
--- a/xbmc/settings/Settings.cpp
+++ b/xbmc/settings/Settings.cpp
@@ -280,6 +280,7 @@ const std::string CSettings::SETTING_MUSICPLAYER_SEEKDELAY = "musicplayer.seekde
const std::string CSettings::SETTING_MUSICPLAYER_REPLAYGAINTYPE = "musicplayer.replaygaintype";
const std::string CSettings::SETTING_MUSICPLAYER_REPLAYGAINPREAMP = "musicplayer.replaygainpreamp";
const std::string CSettings::SETTING_MUSICPLAYER_REPLAYGAINNOGAINPREAMP = "musicplayer.replaygainnogainpreamp";
+const std::string CSettings::SETTING_MUSICPLAYER_REPLAYGAINAVOIDCLIPPING = "musicplayer.replaygainavoidclipping";
const std::string CSettings::SETTING_MUSICPLAYER_CROSSFADE = "musicplayer.crossfade";
const std::string CSettings::SETTING_MUSICPLAYER_CROSSFADEALBUMTRACKS = "musicplayer.crossfadealbumtracks";
const std::string CSettings::SETTING_MUSICPLAYER_VISUALISATION = "musicplayer.visualisation";
@@ -1091,6 +1092,7 @@ void CSettings::InitializeISettingCallbacks()
settingSet.insert(CSettings::SETTING_MUSICPLAYER_REPLAYGAINPREAMP);
settingSet.insert(CSettings::SETTING_MUSICPLAYER_REPLAYGAINNOGAINPREAMP);
settingSet.insert(CSettings::SETTING_MUSICPLAYER_REPLAYGAINTYPE);
+ settingSet.insert(CSettings::SETTING_MUSICPLAYER_REPLAYGAINAVOIDCLIPPING);
settingSet.insert(CSettings::SETTING_SCRAPERS_MUSICVIDEOSDEFAULT);
settingSet.insert(CSettings::SETTING_SCREENSAVER_MODE);
settingSet.insert(CSettings::SETTING_SCREENSAVER_PREVIEW);
diff --git a/xbmc/settings/Settings.h b/xbmc/settings/Settings.h
index 2e3f04d6fc..4a1b4397cf 100644
--- a/xbmc/settings/Settings.h
+++ b/xbmc/settings/Settings.h
@@ -236,6 +236,7 @@ public:
static const std::string SETTING_MUSICPLAYER_REPLAYGAINTYPE;
static const std::string SETTING_MUSICPLAYER_REPLAYGAINPREAMP;
static const std::string SETTING_MUSICPLAYER_REPLAYGAINNOGAINPREAMP;
+ static const std::string SETTING_MUSICPLAYER_REPLAYGAINAVOIDCLIPPING;
static const std::string SETTING_MUSICPLAYER_CROSSFADE;
static const std::string SETTING_MUSICPLAYER_CROSSFADEALBUMTRACKS;
static const std::string SETTING_MUSICPLAYER_VISUALISATION;