kwave  18.07.70
WavFileFormat.h
Go to the documentation of this file.
1 /***************************************************************************
2  WavFileFormat.h - format of a wav file
3  -------------------
4  begin : Mar 05 2002
5  copyright : (C) 2002 by Thomas Eschenbacher
6  email : Thomas Eschenbacher <thomas.eschenbacher@gmx.de>
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef WAV_FILE_FORMAT_H
19 #define WAV_FILE_FORMAT_H
20 
21 #include <QList>
22 
23 #include "libkwave/Compression.h"
24 
25 namespace Kwave
26 {
27 
28  typedef enum /* Here is the list of known format tags */
29  {
30  WAVE_FORMAT_UNKNOWN = 0x0000, /* Microsoft Corporation */
31  WAVE_FORMAT_PCM = 0x0001, /* Microsoft PCM format */
32 
33  WAVE_FORMAT_MS_ADPCM = 0x0002, /* Microsoft ADPCM */
34  WAVE_FORMAT_IEEE_FLOAT = 0x0003, /* Micrososft 32 bit float format */
35 
36  WAVE_FORMAT_IBM_CVSD = 0x0005, /* IBM Corporation */
37  WAVE_FORMAT_ALAW = 0x0006, /* Microsoft Corporation */
38  WAVE_FORMAT_MULAW = 0x0007, /* Microsoft Corporation */
39  WAVE_FORMAT_OKI_ADPCM = 0x0010, /* OKI */
40  WAVE_FORMAT_IMA_ADPCM = 0x0011, /* Intel Corporation */
41  WAVE_FORMAT_MEDIASPACE_ADPCM = 0x0012, /* Videologic */
42  WAVE_FORMAT_SIERRA_ADPCM = 0x0013, /* Sierra Semiconductor Corp */
43  WAVE_FORMAT_G723_ADPCM = 0x0014, /* Antex Electronics Corporation */
44  WAVE_FORMAT_DIGISTD = 0x0015, /* DSP Solutions, Inc. */
45  WAVE_FORMAT_DIGIFIX = 0x0016, /* DSP Solutions, Inc. */
46  WAVE_FORMAT_DIALOGIC_OKI_ADPCM = 0x0017, /* Dialogic Corporation */
47  WAVE_FORMAT_MEDIAVISION_ADPCM = 0x0018, /* Media Vision, Inc. */
48 
49  WAVE_FORMAT_YAMAHA_ADPCM = 0x0020, /* Yamaha Corporation of America */
50  WAVE_FORMAT_SONARC = 0x0021, /* Speech Compression */
51  WAVE_FORMAT_DSPGROUP_TRUESPEECH = 0x0022, /* DSP Group, Inc */
52  WAVE_FORMAT_ECHOSC1 = 0x0023, /* Echo Speech Corporation */
53  WAVE_FORMAT_AUDIOFILE_AF18 = 0x0024, /* Audiofile, Inc. */
54  WAVE_FORMAT_APTX = 0x0025, /* Audio Processing Technology */
55  WAVE_FORMAT_AUDIOFILE_AF10 = 0x0026, /* Audiofile, Inc. */
56 
57  WAVE_FORMAT_DOLBY_AC2 = 0x0030, /* Dolby Laboratories */
58  WAVE_FORMAT_GSM610 = 0x0031, /* Microsoft Corporation */
59  WAVE_FORMAT_MSNAUDIO = 0x0032, /* Microsoft Corporation */
60  WAVE_FORMAT_ANTEX_ADPCME = 0x0033, /* Antex Electronics Corporation */
61  WAVE_FORMAT_CONTROL_RES_VQLPC = 0x0034, /* Control Resources Limited */
62  WAVE_FORMAT_DIGIREAL = 0x0035, /* DSP Solutions, Inc. */
63  WAVE_FORMAT_DIGIADPCM = 0x0036, /* DSP Solutions, Inc. */
64  WAVE_FORMAT_CONTROL_RES_CR10 = 0x0037, /* Control Resources Limited */
65  WAVE_FORMAT_NMS_VBXADPCM = 0x0038, /* Natural MicroSystems */
66  WAVE_FORMAT_ROCKWELL_ADPCM = 0x003B, /* Rockwell International */
67  WAVE_FORMAT_ROCKWELL_DIGITALK = 0x003C, /* Rockwell International */
68 
69  WAVE_FORMAT_G721_ADPCM = 0x0040, /* Antex Electronics Corporation */
70  WAVE_FORMAT_MPEG = 0x0050, /* Microsoft Corporation */
71 
72  WAVE_FORMAT_MPEGLAYER3 = 0x0055, /* MPEG 3 Layer 1 */
73 
74  WAVE_FORMAT_IBM_MULAW = 0x0101, /* IBM mu-law format */
75  WAVE_FORMAT_IBM_ALAW = 0x0102, /* IBM a-law format */
76  WAVE_FORMAT_IBM_ADPCM = 0x0103, /* IBM AVC Adaptive Differential PCM format */
77 
78  WAVE_FORMAT_CREATIVE_ADPCM = 0x0200, /* Creative Labs, Inc */
79 
80  WAVE_FORMAT_FM_TOWNS_SND = 0x0300, /* Fujitsu Corp. */
81  WAVE_FORMAT_OLIGSM = 0x1000, /* Ing C. Olivetti & C., S.p.A. */
82  WAVE_FORMAT_OLIADPCM = 0x1001, /* Ing C. Olivetti & C., S.p.A. */
83  WAVE_FORMAT_OLICELP = 0x1002, /* Ing C. Olivetti & C., S.p.A. */
84  WAVE_FORMAT_OLISBC = 0x1003, /* Ing C. Olivetti & C., S.p.A. */
85  WAVE_FORMAT_OLIOPR = 0x1004, /* Ing C. Olivetti & C., S.p.A. */
86 
88  } wav_format_id;
89 
90  // header format for writing primitive canonical wav files
91  typedef struct {
92  qint8 riffid[4];
93  quint32 filelength;
94  qint8 wavid[4];
95  qint8 fmtid[4];
96  quint32 fmtlength;
97  qint16 mode;
98  qint16 channels;
99  quint32 rate;
100  quint32 AvgBytesPerSec;
101  qint16 BlockAlign;
103  } wav_header_t;
104 
105  //typedef struct {
106  // qint16 mode; // Format tag: 1 = PCM
107  // qint16 channels;
108  // quint32 rate;
109  // quint32 AvgBytesPerSec; // sample rate * block align
110  // qint16 BlockAlign; // channels * bits/sample / 8
111  // qint16 bitspersample;
112  //} wav_fmt_header_t;
113 
114  typedef struct {
115  qint16 format;
116  qint16 channels;
117  quint32 samplerate;
118  quint32 bytespersec;
119  qint16 blockalign;
120  qint16 bitwidth;
122 
123 // typedef struct {
124 // qint16 format;
125 // qint16 channels;
126 // quint32 samplerate;
127 // quint32 bytespersec;
128 // qint16 blockalign;
129 // qint16 bitwidth;
130 // qint16 extrabytes;
131 // qint16 dummy;
132 // } wav_fmt_size20_header_t;
133 
134 // typedef struct {
135 // qint16 format;
136 // qint16 channels;
137 // quint32 samplerate;
138 // quint32 bytespersec;
139 // qint16 blockalign;
140 // qint16 bitwidth;
141 // qint16 extrabytes;
142 // qint16 samplesperblock;
143 // qint16 numcoeffs;
144 // struct {
145 // qint16 coeff1;
146 // qint16 coeff2;
147 // }
148 // coeffs [7];
149 // } ms_adpcm_wav_header_t;
150 
151 // typedef struct {
152 // qint16 format;
153 // qint16 channels;
154 // quint32 samplerate;
155 // quint32 bytespersec;
156 // qint16 blockalign;
157 // qint16 bitwidth;
158 // qint16 extrabytes;
159 // qint16 samplesperblock;
160 // } ima_adpcm_wav_header_t;
161 
162 // typedef struct {
163 // quint32 esf_field1;
164 // qint16 esf_field2;
165 // qint16 esf_field3;
166 // quint8 esf_field4 [8];
167 // } ext_subformat_t;
168 
169 // typedef struct {
170 // qint16 format;
171 // qint16 channels;
172 // quint32 samplerate;
173 // quint32 bytespersec;
174 // qint16 blockalign;
175 // qint16 bitwidth;
176 // qint16 extrabytes;
177 // qint16 validbits;
178 // quint32 channelmask;
179 // Kwave::ext_subformat_t esf;
180 // } extensible_wav_header_t;
181 
182  typedef union {
183 // qint16 format;
185 // Kwave::ima_adpcm_wav_header_t ima;
186 // Kwave::ms_adpcm_wav_header_t msadpcm;
187 // Kwave::extensible_wav_header_t ext;
188 // Kwave::wav_fmt_size20_header_t size20;
189  quint8 padding[512];
191 
192 // typedef struct {
193 // quint32 samples;
194 // } fact_chunk_t;
195 
199  QList<Kwave::Compression::Type> audiofileCompressionTypes();
200 
201 }
202 
203 /* defined in RFC 2361 and other places */
204 #define REGISTER_MIME_TYPES \
205  addMimeType( \
206  "audio/x-wav, audio/vnd.wave, audio/wav", \
207  i18n("WAV audio"), \
208  "*.wav" \
209  );
210 
211 #define REGISTER_COMPRESSION_TYPES \
212  foreach (Kwave::Compression::Type c, Kwave::audiofileCompressionTypes()) \
213  addCompression(c);
214 
215 #endif /* WAV_FILE_FORMAT_H */
216 
217 //***************************************************************************
218 //***************************************************************************
Definition: App.h:33
Kwave::min_wav_header_t min
QList< Kwave::Compression::Type > audiofileCompressionTypes()