Skip to content

Commit

Permalink
[AE] volume: remove dynamic range compression support at the app level
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Marshall committed May 9, 2012
1 parent e529389 commit 926cf9e
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 19 deletions.
14 changes: 1 addition & 13 deletions xbmc/Application.cpp
Expand Up @@ -5140,8 +5140,6 @@ void CApplication::SetVolume(long iValue, bool isPercentage /* = true */)

CVariant data(CVariant::VariantTypeObject);
data["volume"] = (int)(((float)(g_settings.m_nVolumeLevel - VOLUME_MINIMUM)) / (VOLUME_MAXIMUM - VOLUME_MINIMUM) * 100.0f + 0.5f);
/* TODO: add once DRC is available
data["drc"] = (int)(((float)(g_settings.m_dynamicRangeCompressionLevel - VOLUME_DRC_MINIMUM)) / (VOLUME_DRC_MAXIMUM - VOLUME_DRC_MINIMUM) * 100.0f + 0.5f);*/
data["muted"] = g_settings.m_bMute;
CAnnouncementManager::Announce(Application, "xbmc", "OnVolumeChanged", data);
}
Expand All @@ -5156,29 +5154,19 @@ void CApplication::SetHardwareVolume(long hardwareVolume)

// update our settings
if (hardwareVolume > VOLUME_MAXIMUM)
{
g_settings.m_dynamicRangeCompressionLevel = hardwareVolume - VOLUME_MAXIMUM;
g_settings.m_nVolumeLevel = VOLUME_MAXIMUM;
}
else
{
g_settings.m_dynamicRangeCompressionLevel = 0;
g_settings.m_nVolumeLevel = hardwareVolume;
}

// and tell our player to update the volume
if (m_pPlayer)
{
m_pPlayer->SetVolume(g_settings.m_nVolumeLevel);
// TODO DRC
// m_pPlayer->SetDynamicRangeCompression(g_settings.m_dynamicRangeCompressionLevel);
}
}

int CApplication::GetVolume() const
{
// converts the hardware volume (in mB) to a percentage
return int(((float)(g_settings.m_nVolumeLevel + g_settings.m_dynamicRangeCompressionLevel - VOLUME_MINIMUM)) / (VOLUME_MAXIMUM - VOLUME_MINIMUM)*100.0f + 0.5f);
return int(((float)(g_settings.m_nVolumeLevel - VOLUME_MINIMUM)) / (VOLUME_MAXIMUM - VOLUME_MINIMUM)*100.0f + 0.5f);
}

int CApplication::GetSubtitleDelay() const
Expand Down
2 changes: 0 additions & 2 deletions xbmc/interfaces/http-api/XBMChttp.cpp
Expand Up @@ -2613,8 +2613,6 @@ int CXbmcHttp::xbmcSTSetting(int numParas, CStdString paras[])
tmp.Format("%i",g_settings.m_HttpApiBroadcastLevel);
else if (paras[i]=="volumelevel")
tmp.Format("%i",g_settings.m_nVolumeLevel);
else if (paras[i]=="dynamicrangecompressionlevel")
tmp.Format("%i",g_settings.m_dynamicRangeCompressionLevel);
else if (paras[i]=="systemtimetotalup")
tmp.Format("%i",g_settings.m_iSystemTimeTotalUp);
else if (paras[i]=="mute")
Expand Down
3 changes: 0 additions & 3 deletions xbmc/settings/Settings.cpp
Expand Up @@ -94,7 +94,6 @@ void CSettings::Initialize()
m_bAddonForeignFilter = false;

m_nVolumeLevel = 0;
m_dynamicRangeCompressionLevel = 0;
m_bMute = false;
m_fZoomAmount = 1.0f;
m_fPixelRatio = 1.0f;
Expand Down Expand Up @@ -724,7 +723,6 @@ bool CSettings::LoadSettings(const CStdString& strSettingsFile)
{
XMLUtils::GetBoolean(pElement, "mute", m_bMute);
GetInteger(pElement, "volumelevel", m_nVolumeLevel, VOLUME_MAXIMUM, VOLUME_MINIMUM, VOLUME_MAXIMUM);
GetInteger(pElement, "dynamicrangecompression", m_dynamicRangeCompressionLevel, VOLUME_DRC_MINIMUM, VOLUME_DRC_MINIMUM, VOLUME_DRC_MAXIMUM);
}

LoadCalibration(pRootElement, strSettingsFile);
Expand Down Expand Up @@ -902,7 +900,6 @@ bool CSettings::SaveSettings(const CStdString& strSettingsFile, CGUISettings *lo
if (!pNode) return false;
XMLUtils::SetBoolean(pNode, "mute", m_bMute);
XMLUtils::SetInt(pNode, "volumelevel", m_nVolumeLevel);
XMLUtils::SetInt(pNode, "dynamicrangecompression", m_dynamicRangeCompressionLevel);

SaveCalibration(pRoot);

Expand Down
1 change: 0 additions & 1 deletion xbmc/settings/Settings.h
Expand Up @@ -219,7 +219,6 @@ class CSettings
int m_HttpApiBroadcastPort;
int m_HttpApiBroadcastLevel;
int m_nVolumeLevel; // measured in milliBels -60dB -> 0dB range.
int m_dynamicRangeCompressionLevel; // measured in milliBels 0dB -> 30dB range.
bool m_bMute;
int m_iSystemTimeTotalUp; // Uptime in minutes!

Expand Down

0 comments on commit 926cf9e

Please sign in to comment.