2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
11 #include "application/IApplicationComponent.h"
20 * \brief Class handling application support for audio volume management.
22 class CApplicationVolumeHandling
: public IApplicationComponent
24 friend class CApplication
;
27 // replay gain settings struct for quick access by the player multiple
28 // times per second (saves doing settings lookup)
29 struct ReplayGainSettings
37 float GetVolumePercent() const;
38 float GetVolumeRatio() const;
41 void SetVolume(float iValue
, bool isPercentage
= true);
42 void SetMute(bool mute
);
43 void ToggleMute(void);
45 const ReplayGainSettings
& GetReplayGainSettings() const { return m_replayGainSettings
; }
47 static constexpr float VOLUME_MINIMUM
= 0.0f
; // -60dB
48 static constexpr float VOLUME_MAXIMUM
= 1.0f
; // 0dB
49 static constexpr float VOLUME_DYNAMIC_RANGE
= 90.0f
; // 60dB
51 bool Load(const TiXmlNode
* settings
);
52 bool Save(TiXmlNode
* settings
) const;
53 bool OnSettingChanged(const CSetting
& setting
);
56 bool IsMutedInternal() const { return m_muted
; }
57 void ShowVolumeBar(const CAction
* action
= nullptr);
59 void CacheReplayGainSettings(const CSettings
& settings
);
64 void SetHardwareVolume(float hardwareVolume
);
69 float m_volumeLevel
= VOLUME_MAXIMUM
;
70 ReplayGainSettings m_replayGainSettings
;