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 <id3v2frame.h>
00026 
00027 namespace TagLib {
00028 
00029   namespace ID3v2 {
00030 
00032 
00043     class RelativeVolumeFrame : public Frame
00044     {
00045       friend class FrameFactory;
00046 
00047     public:
00048 
00052       enum ChannelType {
00054         Other        = 0x00,
00056         MasterVolume = 0x01,
00058         FrontRight   = 0x02,
00060         FrontLeft    = 0x03,
00062         BackRight    = 0x04,
00064         BackLeft     = 0x05,
00066         FrontCentre  = 0x06,
00068         BackCentre   = 0x07,
00070         Subwoofer    = 0x08
00071       };
00072 
00074 
00079       struct PeakVolume
00080       {
00084         PeakVolume() : bitsRepresentingPeak(0) {}
00089         unsigned char bitsRepresentingPeak;
00094         ByteVector peakVolume;
00095       };
00096 
00101       RelativeVolumeFrame();
00102 
00106       RelativeVolumeFrame(const ByteVector &data);
00107 
00111       virtual ~RelativeVolumeFrame();
00112 
00118       virtual String toString() const;
00119 
00125       ChannelType channelType() const;
00126 
00132       void setChannelType(ChannelType t);
00133 
00142       short volumeAdjustmentIndex() const;
00143 
00152       void setVolumeAdjustmentIndex(short index);
00153 
00164       float volumeAdjustment() const;
00165 
00176       void setVolumeAdjustment(float adjustment);
00177 
00183       PeakVolume peakVolume() const;
00184 
00190       void setPeakVolume(const PeakVolume &peak);
00191 
00192     protected:
00193       virtual void parseFields(const ByteVector &data);
00194       virtual ByteVector renderFields() const;
00195 
00196     private:
00197       RelativeVolumeFrame(const ByteVector &data, Header *h);
00198       RelativeVolumeFrame(const RelativeVolumeFrame &);
00199       RelativeVolumeFrame &operator=(const RelativeVolumeFrame &);
00200 
00201       class RelativeVolumeFramePrivate;
00202       RelativeVolumeFramePrivate *d;
00203     };
00204 
00205   }
00206 }
00207 #endif