TagLib 1.4 (TagLib: relativevolumeframe.h Source File)

relativevolumeframe.h

Go to the documentation of this file.
00001 /***************************************************************************
00002     copyright            : (C) 2004 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 
00022 #ifndef TAGLIB_RELATIVEVOLUMEFRAME_H
00023 #define TAGLIB_RELATIVEVOLUMEFRAME_H
00024 
00025 #include <tlist.h>
00026 #include <id3v2frame.h>
00027 
00028 namespace TagLib {
00029 
00030   namespace ID3v2 {
00031 
00033 
00044     class RelativeVolumeFrame : public Frame
00045     {
00046       friend class FrameFactory;
00047 
00048     public:
00049 
00053       enum ChannelType {
00055         Other        = 0x00,
00057         MasterVolume = 0x01,
00059         FrontRight   = 0x02,
00061         FrontLeft    = 0x03,
00063         BackRight    = 0x04,
00065         BackLeft     = 0x05,
00067         FrontCentre  = 0x06,
00069         BackCentre   = 0x07,
00071         Subwoofer    = 0x08
00072       };
00073 
00075 
00080       struct PeakVolume
00081       {
00085         PeakVolume() : bitsRepresentingPeak(0) {}
00090         unsigned char bitsRepresentingPeak;
00095         ByteVector peakVolume;
00096       };
00097 
00102       RelativeVolumeFrame();
00103 
00107       RelativeVolumeFrame(const ByteVector &data);
00108 
00112       virtual ~RelativeVolumeFrame();
00113 
00119       virtual String toString() const;
00120 
00124       List<ChannelType> channels() const;
00125 
00129       ChannelType channelType() const;
00130 
00134       void setChannelType(ChannelType t);
00135 
00136       /*
00137        * There was a terrible API goof here, and while this can't be changed to
00138        * the way it appears below for binary compaibility reasons, let's at
00139        * least pretend that it looks clean.
00140        */
00141 
00142 #ifdef DOXYGEN
00143 
00155       short volumeAdjustmentIndex(ChannelType type = MasterVolume) const;
00156 
00167       void setVolumeAdjustmentIndex(short index, ChannelType type = MasterVolume);
00168 
00182       float volumeAdjustment(ChannelType type = MasterVolume) const;
00183 
00196       void setVolumeAdjustment(float adjustment, ChannelType type = MasterVolume);
00197 
00206       PeakVolume peakVolume(ChannelType type = MasterVolume) const;
00207 
00215       void setPeakVolume(const PeakVolume &peak, ChannelType type = MasterVolume);
00216 
00217 #else
00218 
00219       // BIC: Combine each of the following pairs of functions (or maybe just
00220       // rework this junk altogether).
00221 
00222       short volumeAdjustmentIndex(ChannelType type) const;
00223       short volumeAdjustmentIndex() const;
00224 
00225       void setVolumeAdjustmentIndex(short index, ChannelType type);
00226       void setVolumeAdjustmentIndex(short index);
00227 
00228       float volumeAdjustment(ChannelType type) const;
00229       float volumeAdjustment() const;
00230 
00231       void setVolumeAdjustment(float adjustment, ChannelType type);
00232       void setVolumeAdjustment(float adjustment);
00233 
00234       PeakVolume peakVolume(ChannelType type) const;
00235       PeakVolume peakVolume() const;
00236 
00237       void setPeakVolume(const PeakVolume &peak, ChannelType type);
00238       void setPeakVolume(const PeakVolume &peak);
00239 
00240 #endif
00241 
00242     protected:
00243       virtual void parseFields(const ByteVector &data);
00244       virtual ByteVector renderFields() const;
00245 
00246     private:
00247       RelativeVolumeFrame(const ByteVector &data, Header *h);
00248       RelativeVolumeFrame(const RelativeVolumeFrame &);
00249       RelativeVolumeFrame &operator=(const RelativeVolumeFrame &);
00250 
00251       class RelativeVolumeFramePrivate;
00252       RelativeVolumeFramePrivate *d;
00253     };
00254 
00255   }
00256 }
00257 #endif