[videodb] remove unused seasons table from episode_view
[xbmc.git] / xbmc / application / ApplicationVolumeHandling.h
blobd41722708d2bb5c88a5a5dc6b0d6bc299f149f84
1 /*
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.
7 */
9 #pragma once
11 #include "application/IApplicationComponent.h"
13 class CAction;
14 class CApplication;
15 class CSetting;
16 class CSettings;
17 class TiXmlNode;
19 /*!
20 * \brief Class handling application support for audio volume management.
22 class CApplicationVolumeHandling : public IApplicationComponent
24 friend class CApplication;
26 public:
27 // replay gain settings struct for quick access by the player multiple
28 // times per second (saves doing settings lookup)
29 struct ReplayGainSettings
31 int iPreAmp;
32 int iNoGainPreAmp;
33 int iType;
34 bool bAvoidClipping;
37 float GetVolumePercent() const;
38 float GetVolumeRatio() const;
39 bool IsMuted() 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);
55 protected:
56 bool IsMutedInternal() const { return m_muted; }
57 void ShowVolumeBar(const CAction* action = nullptr);
59 void CacheReplayGainSettings(const CSettings& settings);
61 void Mute();
62 void UnMute();
64 void SetHardwareVolume(float hardwareVolume);
66 void VolumeChanged();
68 bool m_muted = false;
69 float m_volumeLevel = VOLUME_MAXIMUM;
70 ReplayGainSettings m_replayGainSettings;