00001 /*************************************************************************** 00002 ** 00003 ** This file is part of GeopsyCore. 00004 ** 00005 ** This library is free software; you can redistribute it and/or 00006 ** modify it under the terms of the GNU Lesser General Public 00007 ** License as published by the Free Software Foundation; either 00008 ** version 2.1 of the License, or (at your option) any later version. 00009 ** 00010 ** This file is distributed in the hope that it will be useful, but WITHOUT 00011 ** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 ** FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 00013 ** License for more details. 00014 ** 00015 ** You should have received a copy of the GNU Lesser General Public 00016 ** License along with this library; if not, write to the Free Software 00017 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 ** 00019 ** See http://www.geopsy.org for more information. 00020 ** 00021 ** Created : 2009-08-26 00022 ** Authors : 00023 ** Marc Wathelet 00024 ** Marc Wathelet (LGIT, Grenoble, France) 00025 ** 00026 ***************************************************************************/ 00027 00028 #ifndef WAVEHEADER_H 00029 #define WAVEHEADER_H 00030 00031 #include <QGpCoreTools.h> 00032 #include "GeopsyCoreDLLExport.h" 00033 00034 namespace GeopsyCore { 00035 00036 #pragma pack(1) // set alignment to 1 byte boundary 00037 00038 struct GEOPSYCORE_EXPORT WaveHeader 00039 { 00040 // The canonical WAVE format starts with the RIFF header: 00041 char chunkID[ 4 ]; // Contains the letters "RIFF" in ASCII form 00042 qint32 chunkSize; // 36 + subChunk2Size, This is the size of the rest of the chunk 00043 char format[ 4 ]; // Contains the letters "WAVE" 00044 // The "WAVE" format consists of two subchunks: "fmt " and "data": 00045 // The "fmt " subchunk describes the sound data's format: 00046 char subchunk1ID[ 4 ]; // Contains the letters "fmt " 00047 qint32 subchunk1Size; /* 16 for PCM. This is the size of the 00048 rest of the subchunk which follows this number. */ 00049 qint16 audioFormat; /* PCM=1 (i.e. Linear quantization) 00050 Values other than 1 indicate some 00051 form of compression. */ 00052 qint16 numChannels; // Mono=1, Stereo=2, etc. 00053 qint32 sampleRate; // 8000, 44100, etc. 00054 qint32 byteRate; //==sampleRate * numChannels * bitsPerSample/8 00055 qint16 blockAlign; /*==NumChannels * BitsPerSample/8 00056 The number of bytes for one sample including 00057 all channels. I wonder what happens when 00058 this number isn't an integer? */ 00059 qint16 bitsPerSample; // 8 bits=8, 16 bits=16, etc. 00060 // The "data" subchunk contains the size of the data and the actual sound: 00061 char subchunk2ID[ 4 ]; // Contains the letters "data" 00062 qint32 subchunk2Size; /*==NumSamples * NumChannels * BitsPerSample/8 00063 This is the number of bytes in the data. 00064 You can also think of this as the size 00065 of the read of the subchunk following this 00066 number. */ 00067 }; 00068 00069 #pragma pack() // restore original alignment 00070 00071 } // namespace GeopsyCore 00072 00073 #endif // WAVEHEADER_H