xbmc
ReplayGain.h
1 /*
2  * Copyright (C) 2005-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include <string>
12 
13 #define REPLAY_GAIN_NO_PEAK -1.0f
14 #define REPLAY_GAIN_NO_GAIN -1000.0f
15 
17 {
18 public:
19  enum Type {
20  NONE = 0,
21  ALBUM,
22  TRACK
23  };
24 public:
25  class Info
26  {
27  public:
28  void SetGain(float aGain);
29  void SetGain(const std::string& aStrGain);
30  float Gain() const;
31  void SetPeak(const std::string& aStrPeak);
32  void SetPeak(float aPeak);
33  float Peak() const;
34  bool HasGain() const;
35  bool HasPeak() const;
36  bool Valid() const;
37  private:
38  float m_gain = REPLAY_GAIN_NO_GAIN; // measured in milliBels
39  float m_peak = REPLAY_GAIN_NO_PEAK; // 1.0 == full digital scale
40  };
41  const Info& Get(Type aType) const;
42  void Set(Type aType, const Info& aInfo);
43  void ParseGain(Type aType, const std::string& aStrGain);
44  void SetGain(Type aType, float aGain);
45  void ParsePeak(Type aType, const std::string& aStrPeak);
46  void SetPeak(Type aType, float aPeak);
47  std::string Get() const;
48  void Set(const std::string& strReplayGain);
49 private:
50  Info m_data[TRACK];
51 };
Definition: ReplayGain.h:25
Definition: ReplayGain.h:16