Guiliani  Version 2.6 revision 7293 (documentation build 12)
WaveLoader.h
1#ifndef __WAVELOADER_H__
2#define __WAVELOADER_H__
3
4#include "eC_Types.h"
5#include "GUITrace.h"
6
7// some magic bytes within wavefiles
8#define WAVE_FILETYPE_RIFF "RIFF"
9#define WAVE_DATATYPE_WAVE "WAVE"
10#define WAVE_CHUNKID_FMT "fmt "
11#define WAVE_CHUNKID_DATA "data"
12
13// namespace for fileloaders
14namespace FileLoader
15{
20 {
21 public:
24 {
25 eC_Short sFormatTag;
26 eC_UShort usChannels;
29 eC_UShort usBlockAlign;
30 eC_UShort usBitsPerSample;
31 };
32
35 {
36 eC_UInt uiDataSize;
37 eC_UByte *pubData;
38 eC_Bool bAllocated;
39 };
40
41 private:
43 struct WaveHeader_t
44 {
45 char ubIdRiff[4];
46 eC_UInt uiFileSize;
47 char ubIdWave[4];
48 };
49
51 struct Chunk_t
52 {
53 char ubChunkID[4];
54 eC_UInt uiChunkSize;
55 };
56
57 public:
60
63
71 eC_Bool Load(
72 const eC_String &pkPath,
73 FormatChunk_t& kWaveFormat,
74 DataChunk_t& kDataChunk);
75
76 private:
78 enum { BUFFER_SIZE = 1024 };
79
80 private:
81 eC_Bool CompareU32(const eC_UByte* pkData, const char* pkValue) const;
82 };
83}
84
85#endif
Definition: WaveLoader.h:20
eC_Bool Load(const eC_String &pkPath, FormatChunk_t &kWaveFormat, DataChunk_t &kDataChunk)
WaveLoader()
Default constructor.
~WaveLoader()
Default destructor.
Definition: WaveLoader.h:62
Structure of data chunk of wave-file.
Definition: WaveLoader.h:35
eC_UByte * pubData
sound data
Definition: WaveLoader.h:37
eC_Bool bAllocated
true if memory was allocated
Definition: WaveLoader.h:38
eC_UInt uiDataSize
Size of sound data.
Definition: WaveLoader.h:36
Structure of format chunk of wave-file.
Definition: WaveLoader.h:24
eC_UShort usBitsPerSample
Number of bits per sample.
Definition: WaveLoader.h:30
eC_UInt uiAvgBytesPerSec
Number of bytes per second.
Definition: WaveLoader.h:28
eC_Short sFormatTag
Format of data (1 is non-compressed data)
Definition: WaveLoader.h:25
eC_UShort usBlockAlign
Size of sample in bytes.
Definition: WaveLoader.h:29
eC_UInt uiSamplesPerSec
Samplerate of file.
Definition: WaveLoader.h:27
eC_UShort usChannels
Number of channels.
Definition: WaveLoader.h:26