TagLib  2.2.1
relativevolumeframe.h
Go to the documentation of this file.
1 /***************************************************************************
2  copyright : (C) 2002 - 2008 by Scott Wheeler
3  email : wheeler@kde.org
4  ***************************************************************************/
5 
6 /***************************************************************************
7  * This library is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU Lesser General Public License version *
9  * 2.1 as published by the Free Software Foundation. *
10  * *
11  * This library is distributed in the hope that it will be useful, but *
12  * WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14  * Lesser General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU Lesser General Public *
17  * License along with this library; if not, write to the Free Software *
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
19  * 02110-1301 USA *
20  * *
21  * Alternatively, this file is available under the Mozilla Public *
22  * License Version 1.1. You may obtain a copy of the License at *
23  * http://www.mozilla.org/MPL/ *
24  ***************************************************************************/
25 
26 #ifndef TAGLIB_RELATIVEVOLUMEFRAME_H
27 #define TAGLIB_RELATIVEVOLUMEFRAME_H
28 
29 #include "tlist.h"
30 #include "taglib_export.h"
31 #include "id3v2frame.h"
32 
33 namespace TagLib {
34 
35  namespace ID3v2 {
36 
38 
50  {
51  friend class FrameFactory;
52 
53  public:
54 
58  enum ChannelType {
60  Other = 0x00,
62  MasterVolume = 0x01,
64  FrontRight = 0x02,
66  FrontLeft = 0x03,
68  BackRight = 0x04,
70  BackLeft = 0x05,
72  FrontCentre = 0x06,
74  BackCentre = 0x07,
76  Subwoofer = 0x08
77  };
78 
80 
85  struct PeakVolume {
90  unsigned char bitsRepresentingPeak { 0 };
96  };
97 
103 
107  RelativeVolumeFrame(const ByteVector &data);
108 
112  ~RelativeVolumeFrame() override;
113 
114  RelativeVolumeFrame(const RelativeVolumeFrame &) = delete;
115  RelativeVolumeFrame &operator=(const RelativeVolumeFrame &) = delete;
116 
122  String toString() const override;
123 
127  List<ChannelType> channels() const;
128 
140  short volumeAdjustmentIndex(ChannelType type = MasterVolume) const;
141 
152  void setVolumeAdjustmentIndex(short index, ChannelType type = MasterVolume);
153 
167  float volumeAdjustment(ChannelType type = MasterVolume) const;
168 
181  void setVolumeAdjustment(float adjustment, ChannelType type = MasterVolume);
182 
191  PeakVolume peakVolume(ChannelType type = MasterVolume) const;
192 
200  void setPeakVolume(const PeakVolume &peak, ChannelType type = MasterVolume);
201 
205  String identification() const;
206 
212  void setIdentification(const String &s);
213 
214  protected:
215  void parseFields(const ByteVector &data) override;
216  ByteVector renderFields() const override;
217 
218  private:
219  RelativeVolumeFrame(const ByteVector &data, Header *h);
220 
221  class RelativeVolumeFramePrivate;
223  std::unique_ptr<RelativeVolumeFramePrivate> d;
224  };
225 
226  } // namespace ID3v2
227 } // namespace TagLib
228 #endif
A generic, implicitly shared list.
Definition: tlist.h:53
ByteVector peakVolume
Definition: relativevolumeframe.h:95
An implementation of ID3v2 headers.
Definition: id3v2header.h:48
A wide string class suitable for unicode.
Definition: tstring.h:82
A byte vector.
Definition: tbytevector.h:45
An ID3v2 relative volume adjustment frame implementation.
Definition: relativevolumeframe.h:49
A factory for creating ID3v2 frames during parsing.
Definition: id3v2framefactory.h:67
Struct that stores the relevant values for ID3v2 peak volume.
Definition: relativevolumeframe.h:85
#define TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
Definition: taglib_export.h:55
ID3v2 frame implementation.
Definition: id3v2frame.h:56
#define TAGLIB_EXPORT
Definition: taglib_export.h:40
ChannelType
Definition: relativevolumeframe.h:58
A namespace for all TagLib related classes and functions.
Definition: apefile.h:41