Skip to content

Commit

Permalink
Merge pull request #1076 from Montellese/onvolumechanged_fix
Browse files Browse the repository at this point in the history
jsonrpc: fix OnVolumeChanged notifications after AE merge
  • Loading branch information
Montellese committed Jun 17, 2012
2 parents 537bec4 + 146b49e commit 608efad
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
18 changes: 12 additions & 6 deletions xbmc/Application.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -5180,6 +5180,7 @@ void CApplication::Mute()

CAEFactory::SetMute(true);
g_settings.m_bMute = true;
VolumeChanged();
}

void CApplication::UnMute()
Expand All @@ -5189,6 +5190,7 @@ void CApplication::UnMute()

CAEFactory::SetMute(false);
g_settings.m_bMute = false;
VolumeChanged();
}

void CApplication::SetVolume(float iValue, bool isPercentage/*=true*/)
Expand All @@ -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)
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions xbmc/Application.h
Expand Up @@ -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();
Expand Down

0 comments on commit 608efad

Please sign in to comment.