i6engine  1.0
WavFile.h
Go to the documentation of this file.
1 /*
2  * i6engine
3  * Copyright (2016) Daniel Bonrath, Michael Baer, All rights reserved.
4  *
5  * This file is part of i6engine; i6engine is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
25 #ifndef __I6ENGINE_MODULES_WAVFILE_H__
26 #define __I6ENGINE_MODULES_WAVFILE_H__
27 
28 #include <cstdint>
29 
30 #include "boost/shared_ptr.hpp"
31 
32 namespace i6e {
33 namespace modules {
34 
38  typedef struct WavFile {
39  uint8_t Chunk_ID[4];
40  uint32_t ChunkSize;
41  uint8_t Format[4];
42 
43  uint8_t SubChunk1ID[4];
44  uint32_t SubChunk1Size;
45  uint16_t AudioFormat;
46  uint16_t NumberOfChanels;
47  uint32_t SampleRate;
48  uint32_t ByteRate;
49  uint16_t BlockAlignment;
50  uint16_t BitsPerSample;
51 
52  uint8_t SubChunk2ID[4];
53  uint32_t SubChunk2Size;
54 
55  //Everything else is data. We note it's offset
56  char * data = nullptr;
57 
58  WavFile() {
59  }
60 
62  delete data;
63  }
64  } WavFile;
65 
69  boost::shared_ptr<WavFile> loadWavFile(const std::string & file);
70 
71 } /* namespace modules */
72 } /* namespace i6e */
73 
74 #endif /* __I6ENGINE_MODULES_WAVFILE_H__ */
75 
uint32_t SubChunk1Size
Definition: WavFile.h:44
boost::shared_ptr< WavFile > loadWavFile(const std::string &file)
loads a wav file
struct i6e::modules::WavFile WavFile
parsed wave file
uint32_t SubChunk2Size
Definition: WavFile.h:53
uint32_t ChunkSize
Definition: WavFile.h:40
uint16_t BlockAlignment
Definition: WavFile.h:49
uint16_t BitsPerSample
Definition: WavFile.h:50
uint32_t SampleRate
Definition: WavFile.h:47
uint8_t Format[4]
Definition: WavFile.h:41
uint32_t ByteRate
Definition: WavFile.h:48
uint8_t SubChunk2ID[4]
Definition: WavFile.h:52
uint8_t Chunk_ID[4]
Definition: WavFile.h:39
uint16_t AudioFormat
Definition: WavFile.h:45
uint8_t SubChunk1ID[4]
Definition: WavFile.h:43
uint16_t NumberOfChanels
Definition: WavFile.h:46
parsed wave file
Definition: WavFile.h:38