Permalink
Browse files

Merge pull request #1076 from Montellese/onvolumechanged_fix

jsonrpc: fix OnVolumeChanged notifications after AE merge
  • Loading branch information...
2 parents 537bec4 + 146b49e commit 608efadad91713f9f44574f5cdc094482a0267e5 @Montellese Montellese committed Jun 17, 2012
Showing with 14 additions and 6 deletions.
  1. +12 −6 xbmc/Application.cpp
  2. +2 −0 xbmc/Application.h
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);
@@ -5180,6 +5180,7 @@ void CApplication::Mute()
CAEFactory::SetMute(true);
g_settings.m_bMute = true;
+ VolumeChanged();
}
void CApplication::UnMute()
@@ -5189,6 +5190,7 @@ void CApplication::UnMute()
CAEFactory::SetMute(false);
g_settings.m_bMute = false;
+ VolumeChanged();
}
void CApplication::SetVolume(float iValue, bool isPercentage/*=true*/)
@@ -5199,11 +5201,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)
@@ -5229,6 +5227,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();

0 comments on commit 608efad

Please sign in to comment.