diff options
author | Sébastien Règne <regseb@gmail.com> | 2020-11-14 15:55:09 +0100 |
---|---|---|
committer | Sébastien Règne <regseb@gmail.com> | 2020-11-14 15:55:09 +0100 |
commit | a4db568ce07d54ad1591b9339a0b6a2e0da4a821 (patch) | |
tree | 39b7220bdbaf0691c004460dcbeea09f995144ad | |
parent | 2d504f997ad9dd78609e237fe4832a14d9665b8a (diff) |
[JSON-RPC] Use int to volume in OnVolumeChanged
-rw-r--r-- | xbmc/Application.cpp | 4 | ||||
-rw-r--r-- | xbmc/interfaces/json-rpc/ApplicationOperations.cpp | 3 | ||||
-rw-r--r-- | xbmc/interfaces/json-rpc/schema/version.txt | 2 |
3 files changed, 6 insertions, 3 deletions
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 2bd0de56ce..35de935a74 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -93,6 +93,8 @@ #include "windowing/WinSystem.h" #include "windowing/WindowSystemFactory.h" +#include <cmath> + #ifdef HAS_UPNP #include "network/upnp/UPnP.h" #include "filesystem/UPnPDirectory.h" @@ -4449,7 +4451,7 @@ float CApplication::GetVolumeRatio() const void CApplication::VolumeChanged() { CVariant data(CVariant::VariantTypeObject); - data["volume"] = GetVolumePercent(); + data["volume"] = static_cast<int>(std::lroundf(GetVolumePercent())); data["muted"] = m_muted; CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Application, "OnVolumeChanged", data); diff --git a/xbmc/interfaces/json-rpc/ApplicationOperations.cpp b/xbmc/interfaces/json-rpc/ApplicationOperations.cpp index cdf158db55..f878a1321b 100644 --- a/xbmc/interfaces/json-rpc/ApplicationOperations.cpp +++ b/xbmc/interfaces/json-rpc/ApplicationOperations.cpp @@ -20,6 +20,7 @@ #include "utils/Variant.h" #include "utils/log.h" +#include <cmath> #include <string.h> using namespace JSONRPC; @@ -104,7 +105,7 @@ JSONRPC_STATUS CApplicationOperations::Quit(const std::string &method, ITranspor JSONRPC_STATUS CApplicationOperations::GetPropertyValue(const std::string &property, CVariant &result) { if (property == "volume") - result = static_cast<int>(g_application.GetVolumePercent()); + result = static_cast<int>(std::lroundf(g_application.GetVolumePercent())); else if (property == "muted") result = g_application.IsMuted(); else if (property == "name") diff --git a/xbmc/interfaces/json-rpc/schema/version.txt b/xbmc/interfaces/json-rpc/schema/version.txt index 651cf58459..ad71274949 100644 --- a/xbmc/interfaces/json-rpc/schema/version.txt +++ b/xbmc/interfaces/json-rpc/schema/version.txt @@ -1 +1 @@ -JSONRPC_VERSION 11.19.1 +JSONRPC_VERSION 11.19.2 |