TagLib 1.6.1 (TagLib: relativevolumeframe.h Source File)

relativevolumeframe.h

Go to the documentation of this file.
00001 /***************************************************************************
00002     copyright            : (C) 2002 - 2008 by Scott Wheeler
00003     email                : wheeler@kde.org
00004  ***************************************************************************/
00005 
00006 /***************************************************************************
00007  *   This library is free software; you can redistribute it and/or modify  *
00008  *   it under the terms of the GNU Lesser General Public License version   *
00009  *   2.1 as published by the Free Software Foundation.                     *
00010  *                                                                         *
00011  *   This library is distributed in the hope that it will be useful, but   *
00012  *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00014  *   Lesser General Public License for more details.                       *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Lesser General Public      *
00017  *   License along with this library; if not, write to the Free Software   *
00018  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
00019  *   USA                                                                   *
00020  *                                                                         *
00021  *   Alternatively, this file is available under the Mozilla Public        *
00022  *   License Version 1.1.  You may obtain a copy of the License at         *
00023  *   http://www.mozilla.org/MPL/                                           *
00024  ***************************************************************************/
00025 
00026 #ifndef TAGLIB_RELATIVEVOLUMEFRAME_H
00027 #define TAGLIB_RELATIVEVOLUMEFRAME_H
00028 
00029 #include "tlist.h"
00030 #include "id3v2frame.h"
00031 #include "taglib_export.h"
00032 
00033 namespace TagLib {
00034 
00035   namespace ID3v2 {
00036 
00038 
00049     class TAGLIB_EXPORT RelativeVolumeFrame : public Frame
00050     {
00051       friend class FrameFactory;
00052 
00053     public:
00054 
00058       enum ChannelType {
00060         Other        = 0x00,
00062         MasterVolume = 0x01,
00064         FrontRight   = 0x02,
00066         FrontLeft    = 0x03,
00068         BackRight    = 0x04,
00070         BackLeft     = 0x05,
00072         FrontCentre  = 0x06,
00074         BackCentre   = 0x07,
00076         Subwoofer    = 0x08
00077       };
00078 
00080 
00085       struct PeakVolume
00086       {
00090         PeakVolume() : bitsRepresentingPeak(0) {}
00095         unsigned char bitsRepresentingPeak;
00100         ByteVector peakVolume;
00101       };
00102 
00107       RelativeVolumeFrame();
00108 
00112       RelativeVolumeFrame(const ByteVector &data);
00113 
00117       virtual ~RelativeVolumeFrame();
00118 
00124       virtual String toString() const;
00125 
00129       List<ChannelType> channels() const;
00130 
00134       ChannelType channelType() const;
00135 
00139       void setChannelType(ChannelType t);
00140 
00141       /*
00142        * There was a terrible API goof here, and while this can't be changed to
00143        * the way it appears below for binary compaibility reasons, let's at
00144        * least pretend that it looks clean.
00145        */
00146 
00147 #ifdef DOXYGEN
00148 
00160       short volumeAdjustmentIndex(ChannelType type = MasterVolume) const;
00161 
00172       void setVolumeAdjustmentIndex(short index, ChannelType type = MasterVolume);
00173 
00187       float volumeAdjustment(ChannelType type = MasterVolume) const;
00188 
00201       void setVolumeAdjustment(float adjustment, ChannelType type = MasterVolume);
00202 
00211       PeakVolume peakVolume(ChannelType type = MasterVolume) const;
00212 
00220       void setPeakVolume(const PeakVolume &peak, ChannelType type = MasterVolume);
00221 
00222 #else
00223 
00224       // BIC: Combine each of the following pairs of functions (or maybe just
00225       // rework this junk altogether).
00226 
00227       short volumeAdjustmentIndex(ChannelType type) const;
00228       short volumeAdjustmentIndex() const;
00229 
00230       void setVolumeAdjustmentIndex(short index, ChannelType type);
00231       void setVolumeAdjustmentIndex(short index);
00232 
00233       float volumeAdjustment(ChannelType type) const;
00234       float volumeAdjustment() const;
00235 
00236       void setVolumeAdjustment(float adjustment, ChannelType type);
00237       void setVolumeAdjustment(float adjustment);
00238 
00239       PeakVolume peakVolume(ChannelType type) const;
00240       PeakVolume peakVolume() const;
00241 
00242       void setPeakVolume(const PeakVolume &peak, ChannelType type);
00243       void setPeakVolume(const PeakVolume &peak);
00244 
00245 #endif
00246 
00250       String identification() const;
00251 
00257       void setIdentification(const String &s);
00258 
00259     protected:
00260       virtual void parseFields(const ByteVector &data);
00261       virtual ByteVector renderFields() const;
00262 
00263     private:
00264       RelativeVolumeFrame(const ByteVector &data, Header *h);
00265       RelativeVolumeFrame(const RelativeVolumeFrame &);
00266       RelativeVolumeFrame &operator=(const RelativeVolumeFrame &);
00267 
00268       class RelativeVolumeFramePrivate;
00269       RelativeVolumeFramePrivate *d;
00270     };
00271 
00272   }
00273 }
00274 #endif