Skip to content

Commit b760720

Browse files
Added wav file structures
1 parent 815714e commit b760720

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

src/ml_wavfile.h

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
* Copyright (c) 2024 Marcel Licence
3+
*/
4+
5+
/**
6+
* @file ml_wavfile.h
7+
* @author Marcel Licence
8+
* @data 27.06.2023
9+
*
10+
* @brief Wave file structures etc.
11+
*/
12+
13+
14+
#ifndef ML_WAVFILE_H_
15+
#define ML_WAVFILE_H_
16+
17+
18+
union wav_tag__header_u
19+
{
20+
struct
21+
{
22+
char tag_name[4];
23+
uint32_t tag_data_size;
24+
};
25+
uint8_t wavHdr[8];
26+
};
27+
28+
union wavHeader
29+
{
30+
struct
31+
{
32+
char riff[4]; /*!< 'RIFF' */
33+
uint32_t fileSize; /*!< bytes to write containing all data (header + data) */
34+
char waveType[4]; /*!< 'WAVE' */
35+
36+
char format[4]; /*!< 'fmt ' */
37+
uint32_t lengthOfData; /*!< length of the fmt header (16 bytes) */
38+
uint16_t format_tag; /*!< 0x0001: PCM */
39+
uint16_t numberOfChannels; /*!< 'WAVE' */
40+
uint32_t sampleRate;
41+
uint32_t byteRate;
42+
43+
uint16_t bytesPerSample;
44+
uint16_t bitsPerSample;
45+
wav_tag__header_u nextTag;
46+
};
47+
uint8_t wavHdr[44];
48+
};
49+
50+
union wav_tag__smpl_u
51+
{
52+
struct
53+
{
54+
uint32_t manufacturer; /* 0x08 */
55+
uint32_t product; /* 0x0C */
56+
uint32_t sample_period; /* 0x10 */
57+
uint32_t MIDI_unity_note; /* 0x14 */
58+
uint32_t MIDI_pitch_fraction; /* 0x18 */
59+
uint32_t SMPTE_format;
60+
uint32_t SMPTE_offset;
61+
uint32_t number_of_sample_loops;
62+
uint32_t sample_data;
63+
struct
64+
{
65+
uint32_t ID;
66+
uint32_t type;
67+
uint32_t start;
68+
uint32_t end;
69+
uint32_t fraction;
70+
uint32_t number_of_times_to_play_the_loop;
71+
};
72+
};
73+
uint8_t raw[4 * 15];
74+
};
75+
76+
77+
#endif /* ML_WAVFILE_H_ */

0 commit comments

Comments
 (0)