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 "id3v2frame.h"
31 #include "taglib_export.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
86  {
90  PeakVolume() : bitsRepresentingPeak(0) {}
95  unsigned char bitsRepresentingPeak;
101  };
102 
108 
112  RelativeVolumeFrame(const ByteVector &data);
113 
117  virtual ~RelativeVolumeFrame();
118 
124  virtual String toString() const;
125 
129  List<ChannelType> channels() const;
130 
134  ChannelType channelType() const;
135 
139  void setChannelType(ChannelType t);
140 
141  /*
142  * There was a terrible API goof here, and while this can't be changed to
143  * the way it appears below for binary compaibility reasons, let's at
144  * least pretend that it looks clean.
145  */
146 
147 #ifdef DOXYGEN
148 
160  short volumeAdjustmentIndex(ChannelType type = MasterVolume) const;
161 
172  void setVolumeAdjustmentIndex(short index, ChannelType type = MasterVolume);
173 
187  float volumeAdjustment(ChannelType type = MasterVolume) const;
188 
201  void setVolumeAdjustment(float adjustment, ChannelType type = MasterVolume);
202 
211  PeakVolume peakVolume(ChannelType type = MasterVolume) const;
212 
220  void setPeakVolume(const PeakVolume &peak, ChannelType type = MasterVolume);
221 
222 #else
223 
224  // BIC: Combine each of the following pairs of functions (or maybe just
225  // rework this junk altogether).
226 
227  short volumeAdjustmentIndex(ChannelType type) const;
228  short volumeAdjustmentIndex() const;
229 
230  void setVolumeAdjustmentIndex(short index, ChannelType type);
231  void setVolumeAdjustmentIndex(short index);
232 
233  float volumeAdjustment(ChannelType type) const;
234  float volumeAdjustment() const;
235 
236  void setVolumeAdjustment(float adjustment, ChannelType type);
237  void setVolumeAdjustment(float adjustment);
238 
239  PeakVolume peakVolume(ChannelType type) const;
240  PeakVolume peakVolume() const;
241 
242  void setPeakVolume(const PeakVolume &peak, ChannelType type);
243  void setPeakVolume(const PeakVolume &peak);
244 
245 #endif
246 
250  String identification() const;
251 
257  void setIdentification(const String &s);
258 
259  protected:
260  virtual void parseFields(const ByteVector &data);
261  virtual ByteVector renderFields() const;
262 
263  private:
264  RelativeVolumeFrame(const ByteVector &data, Header *h);
266  RelativeVolumeFrame &operator=(const RelativeVolumeFrame &);
267 
268  class RelativeVolumeFramePrivate;
269  RelativeVolumeFramePrivate *d;
270  };
271 
272  }
273 }
274 #endif