Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

jsonrpc: fix OnVolumeChanged notifications after AE merge #1076

Merged
merged 1 commit into from Jun 17, 2012
Jump to file or symbol
Failed to load files and symbols.
+14 −6
Split
View
@@ -2684,7 +2684,7 @@ bool CApplication::OnAction(const CAction &action)
else
volume -= (float)fabs(action.GetAmount()) * action.GetAmount() * step;
- SetHardwareVolume(volume);
+ SetVolume(volume, false);
}
// show visual feedback of volume change...
ShowVolumeBar(&action);
@@ -5186,6 +5186,7 @@ void CApplication::Mute()
CAEFactory::AE->SetMute(true);
g_settings.m_bMute = true;
+ VolumeChanged();
}
void CApplication::UnMute()
@@ -5195,6 +5196,7 @@ void CApplication::UnMute()
CAEFactory::AE->SetMute(false);
g_settings.m_bMute = false;
+ VolumeChanged();
}
void CApplication::SetVolume(float iValue, bool isPercentage/*=true*/)
@@ -5205,11 +5207,7 @@ void CApplication::SetVolume(float iValue, bool isPercentage/*=true*/)
hardwareVolume /= 100.0f;
SetHardwareVolume(hardwareVolume);
-
- CVariant data(CVariant::VariantTypeObject);
- data["volume"] = (int)(hardwareVolume * 100.0f + 0.5f);
- data["muted"] = g_settings.m_bMute;
- CAnnouncementManager::Announce(Application, "xbmc", "OnVolumeChanged", data);
+ VolumeChanged();
}
void CApplication::SetHardwareVolume(float hardwareVolume)
@@ -5235,6 +5233,14 @@ int CApplication::GetVolume() const
return (int)(g_settings.m_fVolumeLevel * 100.0f);
}
+void CApplication::VolumeChanged() const
+{
+ CVariant data(CVariant::VariantTypeObject);
+ data["volume"] = GetVolume();
+ data["muted"] = g_settings.m_bMute;
+ CAnnouncementManager::Announce(Application, "xbmc", "OnVolumeChanged", data);
+}
+
int CApplication::GetSubtitleDelay() const
{
// converts subtitle delay to a percentage
View
@@ -410,6 +410,8 @@ class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMs
void UpdateLCD();
void FatalErrorHandler(bool WindowSystemInitialized, bool MapDrives, bool InitNetwork);
+ void VolumeChanged() const;
+
bool PlayStack(const CFileItem& item, bool bRestart);
bool SwitchToFullScreen();
bool ProcessMouse();