Ardour  9.0-pre0-582-g084a23a80d
loudness_settings.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 Robin Gareus <robin@gareus.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef _gtkardour_loudness_settings_h_
20 #define _gtkardour_loudness_settings_h_
21 
22 #include <cstddef>
23 #include <stdexcept>
24 #include <string>
25 #include <vector>
26 
27 class XMLNode;
28 
30 {
31  enum {
37  LR_LAST
38  };
39 
40  std::string label;
41  bool enable[LR_LAST];
42  float level[LR_LAST];
43  float LUFS_range[2];
44  bool report;
45  bool user;
46 };
47 
49 {
51  ALoudnessPreset (std::string const&, bool enable[LR_LAST], float level[LR_LAST]);
53 
54  XMLNode& state () const;
55  bool operator==(ALoudnessPreset const&) const;
56 };
57 
59 {
60 public:
61  ALoudnessPresets (bool built_in_only);
63 
64  std::vector<ALoudnessPreset> const& presets () const {
65  return _p;
66  }
67 
68  bool push_back (CLoudnessPreset const&);
69  bool erase (CLoudnessPreset const&);
70  bool erase (size_t);
71 
72  CLoudnessPreset const&
73  operator[] (size_t which) const {
74  if (which >= _p.size ()) {
75  throw std::out_of_range ("preset index is out of range");
76  }
77  return _p[which];
78  }
79 
81  operator[] (size_t which) {
82  if (which >= _p.size ()) {
83  throw std::out_of_range ("preset index is out of range");
84  }
85  return _p[which];
86  }
87 
88  size_t n_presets () const {
89  return _p.size ();
90  }
91 
93 
94 private:
95  std::vector <ALoudnessPreset> _p;
96  bool _save;
97 };
98 
99 #endif
bool erase(CLoudnessPreset const &)
bool erase(size_t)
CLoudnessPreset const & operator[](size_t which) const
ALoudnessPresets(bool built_in_only)
std::vector< ALoudnessPreset > const & presets() const
std::vector< ALoudnessPreset > _p
bool find_preset(CLoudnessPreset &) const
bool push_back(CLoudnessPreset const &)
size_t n_presets() const
Definition: xml++.h:114
XMLNode & state() const
ALoudnessPreset(XMLNode const &)
bool operator==(ALoudnessPreset const &) const
ALoudnessPreset(CLoudnessPreset const &c)
ALoudnessPreset(std::string const &, bool enable[LR_LAST], float level[LR_LAST])
bool enable[LR_LAST]
float level[LR_LAST]