• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef _IO_WAV_WAVFMTCHUNKHEADER_H_
17 #define _IO_WAV_WAVFMTCHUNKHEADER_H_
18 
19 #include "WavChunkHeader.h"
20 
21 class InputStream;
22 
23 namespace parselib {
24 
25 /**
26  * Encapsulates a WAV file 'fmt ' chunk.
27  */
28 class WavFmtChunkHeader : public WavChunkHeader {
29 public:
30     static const RiffID RIFFID_FMT;
31 
32     // Microsoft Encoding IDs
33     static const short ENCODING_PCM = 1;
34     static const short ENCODING_ADPCM = 2; // Microsoft ADPCM Format
35     static const short ENCODING_IEEE_FLOAT = 3; // samples from -1.0 -> 1.0
36 
37     RiffInt16 mEncodingId;  /** Microsoft WAV encoding ID (see above) */
38     RiffInt16 mNumChannels;
39     RiffInt32 mSampleRate;
40     RiffInt32 mAveBytesPerSecond;
41     RiffInt16 mBlockAlign;
42     RiffInt16 mSampleSize;
43     RiffInt16 mExtraBytes;
44 
45     WavFmtChunkHeader();
46 
47     WavFmtChunkHeader(RiffID tag);
48 
49     void normalize();
50 
51     void read(InputStream *stream);
52 };
53 
54 } // namespace parselib
55 
56 #endif // _IO_WAV_WAVFMTCHUNKHEADER_H_
57