Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

qwavlibsndfilewavedata.h

00001 /***************************************************************************
00002                           libsndfilewavedata.h  -  description
00003                              -------------------
00004     begin                : Wed Dec 18 2002
00005     copyright            : (C) 2002 by Peter Eschler
00006     email                : eschler@users.sourceforge.net
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU Library General Public License as       *
00013  *   published by  the Free Software Foundation; either version 2 of the   *
00014  *   License, or (at your option) any later version.                       *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef QwavLIBSNDFILEWAVEDATA_H
00019 #define QwavLIBSNDFILEWAVEDATA_H
00020 
00021 
00022 //---------------------------------------------------------------------------
00023 // Includes: project
00024 //---------------------------------------------------------------------------
00025 
00026 #include "qwavdefines.h"
00027 #include "qwavwavedatainterface.h"
00028 
00029 Qwav_BEGIN_NAMESPACE
00030 
00031 //---------------------------------------------------------------------------
00032 // Class: QwavLibSndfileWaveData
00033 //---------------------------------------------------------------------------
00034 
00041 class QWAV_EXPORTIMPORT QwavLibSndfileWaveData : public QwavWaveDataInterface  
00042 {
00043 
00044 public: 
00045     QwavLibSndfileWaveData();
00046     QwavLibSndfileWaveData(const string& filename)
00047         throw(FileOpenError, FileReadError); 
00048 
00049     virtual ~QwavLibSndfileWaveData();
00050 
00051     inline float       sampleRate  (void) const;
00052     inline long        nrOfSamples (void) const;
00053     inline uint        nrOfChannels(void) const;
00054     inline const Float& operator[] (uint index) const;
00055 //    inline QwavPeakVector& getPeaks       (void);
00056 
00057     bool   readFile (const string& filename ) 
00058       throw(FileOpenError, FileReadError);
00059 
00060     bool   writeFile(const string& filename)
00061       throw(FileOpenError,FileReadError);      
00062     
00063     QwavPeakInfo           getPeak(QwavPeakInterpolator* s,
00064                                int   pixel,
00065                                int   nPixels,
00066                                Float zoomFac=1.0,
00067                                uint  channel=1) const;
00068 
00069     inline bool isOpen() const;
00070 
00071 protected:
00075     QwavLibSndfileWaveData(const QwavLibSndfileWaveData&);
00076 
00080     const QwavLibSndfileWaveData& operator=(const QwavLibSndfileWaveData&); 
00081 
00082 private:
00083     float      _sampleRate;
00084     int        _nrSamples;
00085     int        _nrChannels;  
00086 
00087     bool       _isOpen;
00088 
00089     Float*     _data;
00090     QwavPeakVector _peaks;
00091 };
00092 
00093 
00094 //---------------------------------------------------------------------------
00095 // Method: getSampleRate
00096 //---------------------------------------------------------------------------
00097 
00098 float QwavLibSndfileWaveData::sampleRate() const
00099 {
00100     return _sampleRate;
00101 }
00102 
00103 
00104 //---------------------------------------------------------------------------
00105 // Method: getNrOfSamples
00106 //---------------------------------------------------------------------------
00107 
00108 long QwavLibSndfileWaveData::nrOfSamples() const
00109 {
00110     return _nrSamples;
00111 }
00112 
00113 
00114 //---------------------------------------------------------------------------
00115 // Method: getNrOfChannels
00116 //---------------------------------------------------------------------------
00117 
00118 uint  QwavLibSndfileWaveData::nrOfChannels() const
00119 {
00120     return _nrChannels;
00121 }
00122 
00123 //---------------------------------------------------------------------------
00124 // Method: operator[]
00125 //---------------------------------------------------------------------------
00126 
00140 const Float& QwavLibSndfileWaveData::operator[] (uint index) const
00141 {    
00142     return _data[index];
00143 }
00144 
00145 
00146 //---------------------------------------------------------------------------
00147 // Method: isOpen
00148 //---------------------------------------------------------------------------
00149 
00152 bool QwavLibSndfileWaveData::isOpen() const
00153 {
00154     return _isOpen;
00155 }
00156 
00157 Qwav_END_NAMESPACE
00158 
00159 #endif // QwavLIBSNDFILEWAVEDATA_H

Generated on Mon Jan 20 00:24:54 2003 for Qwav by doxygen1.2.16