SilentEye 0.4.1

modules/seformatwav/audiowav.h

Go to the documentation of this file.
00001 //  This file is part of SilentEye.
00002 //
00003 //  SilentEye is free software: you can redistribute it and/or modify
00004 //  it under the terms of the GNU General Public License as published by
00005 //  the Free Software Foundation, either version 3 of the License, or
00006 //  (at your option) any later version.
00007 //
00008 //  SilentEye is distributed in the hope that it will be useful,
00009 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 //  GNU General Public License for more details.
00012 //
00013 //  You should have received a copy of the GNU General Public License
00014 //  along with SilentEye.  If not, see <http://www.gnu.org/licenses/>.
00015 
00016 #ifndef AUDIOWAV_H_
00017 #define AUDIOWAV_H_
00018 
00019 #include <audio.h>
00020 #include <encodeddata.h>
00021 #include <logger.h>
00022 
00023 using namespace SilentEyeFramework;
00024 
00025 namespace SEFormatWAV {
00026 
00028     class AudioWav : public Audio
00029     {
00030     public:
00031         enum HeaderPosition{BEGINNING=1, ENDING=2};
00032         enum DataDistribution{INLINE=1, EQUI=2};
00033 
00034     private:
00035         quint16 m_nbBitsUsed;
00036         quint16 m_nbChannelUsed;
00037         HeaderPosition m_headerPosition;
00038         DataDistribution m_distribution;
00039 
00040         QPointer<Logger> m_logger;
00041 
00042     public:
00043         AudioWav(const QString&);
00044         AudioWav(const Audio&);
00045         AudioWav(Audio*);
00046         ~AudioWav();
00047 
00048     private:
00049         void init();
00050 
00051     public:
00052         quint16 nbBitsUsed() const;
00053         void setNbBitsUsed(const quint16);
00054 
00055         quint16 nbChannelUsed() const;
00056         void setNbChannelUsed(const quint16);
00057 
00058         void setDistribution(DataDistribution);
00059         void setHeaderPosition(HeaderPosition);
00060 
00061         quint32 capacity() const;
00062 
00063         bool loadData();
00064         bool saveToDir(QString&);
00065 
00066     protected:
00067         int computeHeaderSampleSize() const;
00068         qint32 computeDistributionStep(quint32) const;
00069         bool writeSampleChannel(QDataStream&, quint32);
00070     };
00071 
00072 }
00073 
00074 #endif