FFmpegfs Fuse Multi Media Filesystem 2.16
wave.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017-2024 by Norbert Schlia (nschlia@oblivion-software.de)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
17 *
18 * On Debian systems, the complete text of the GNU General Public License
19 * Version 3 can be found in `/usr/share/common-licenses/GPL-3'.
20 */
21
33#ifndef WAVE_H
34#define WAVE_H
35
36#pragma once
37
38#include <stdint.h>
39
40#include <array>
41
42#pragma pack(push, 1)
43
49typedef struct WAV_HEADER
50{
52 std::array<uint8_t, 4> m_riff_header;
63 uint32_t m_wav_size;
64 std::array<uint8_t, 4> m_wave_header;
68 std::array<uint8_t, 4> m_fmt_header;
70 uint16_t m_audio_format;
71 uint16_t m_num_channels;
72 uint32_t m_sample_rate;
73 uint32_t m_byte_rate;
75 uint16_t m_bit_depth;
78
79static_assert(sizeof(WAV_HEADER) == 36);
80
86typedef struct WAV_HEADER_EX
87{
90 uint32_t m_channel_mask;
91 std::array<uint8_t, 16> m_sub_format_guid;
93
94static_assert(sizeof(WAV_HEADER_EX) == 24);
95
101typedef struct WAV_FACT
102{
103 std::array<uint8_t, 4> m_chunk_id;
104 uint32_t m_body_size;
107
108static_assert(sizeof(WAV_FACT) == 12);
109
115typedef struct WAV_LIST_HEADER
116{
117 std::array<uint8_t, 4> m_list_header;
118 uint32_t m_data_bytes;
119 std::array<uint8_t, 4> m_list_type;
121
122static_assert(sizeof(WAV_LIST_HEADER) == 12);
123
128typedef struct WAV_DATA_HEADER
129{
130 std::array<uint8_t, 4> m_data_header;
131 uint32_t m_data_bytes;
132 // Remainder of wave file: actual sound data
133 // uint8_t m_bytes[];
135
136static_assert(sizeof(WAV_DATA_HEADER) == 8);
137
138#pragma pack(pop)
139
140#endif // WAVE_H
WAVE data header structure.
Definition: wave.h:129
std::array< uint8_t, 4 > m_data_header
Contains "data" (0x64617461 big-endian form).
Definition: wave.h:130
uint32_t m_data_bytes
Number of bytes in data. Number of samples * num_channels * bit_depth / 8.
Definition: wave.h:131
WAVE "fact" header structure.
Definition: wave.h:102
std::array< uint8_t, 4 > m_chunk_id
Chunk ID 4 0x66 0x61 0x63 0x74 (i.e. "fact")
Definition: wave.h:103
uint32_t m_number_of_sample_frames
Number of sample frames 4 32-bit unsigned integer.
Definition: wave.h:105
uint32_t m_body_size
Chunk Body Size 4 32-bit unsigned integer.
Definition: wave.h:104
WAVE extended header structure.
Definition: wave.h:87
std::array< uint8_t, 16 > m_sub_format_guid
Sub Format GUID 16 16-byte GUID.
Definition: wave.h:91
uint16_t m_valid_bits_per_sample
Valid Bits Per Sample 2 16-bit unsigned integer.
Definition: wave.h:89
uint32_t m_channel_mask
Channel Mask 4 32-bit unsigned integer.
Definition: wave.h:90
uint16_t m_extension_size
Extension Size 2 16-bit unsigned integer (value 22)
Definition: wave.h:88
WAVE header structure.
Definition: wave.h:50
uint16_t m_sample_alignment
num_channels * bit_depth / 8
Definition: wave.h:74
uint32_t m_sample_rate
8000, 44100, etc.
Definition: wave.h:72
uint32_t m_wav_size
Definition: wave.h:63
std::array< uint8_t, 4 > m_riff_header
RIFF Header: Contains the letters "RIFF" in ASCII form (0x52494646 big-endian form).
Definition: wave.h:52
uint32_t m_byte_rate
Number of bytes per second. sample_rate * num_channels * bit_depth / 8.
Definition: wave.h:73
std::array< uint8_t, 4 > m_wave_header
Contains the letters "WAVE" (0x57415645 big-endian form).
Definition: wave.h:64
std::array< uint8_t, 4 > m_fmt_header
RIFF Format Header: Contains "fmt " including trailing space (0x666d7420 big-endian form).
Definition: wave.h:68
uint32_t m_fmt_chunk_size
Should be 16 for PCM This is the size of the rest of the chunk size which follows this number.
Definition: wave.h:69
uint16_t m_audio_format
Should be 1 for PCM. 3 for IEEE Float.
Definition: wave.h:70
uint16_t m_num_channels
Number of channels 1...n (1: mono, 2: stereo/dual channel;...)
Definition: wave.h:71
uint16_t m_bit_depth
Number of bits per sample: 8 bits = 8, 16 bits = 16, etc.
Definition: wave.h:75
WAVE list header structure.
Definition: wave.h:116
std::array< uint8_t, 4 > m_list_type
Contains "adtl" (0x6164746C)
Definition: wave.h:119
uint32_t m_data_bytes
Number of bytes in list.
Definition: wave.h:118
std::array< uint8_t, 4 > m_list_header
Contains "list" (0x6C696E74)
Definition: wave.h:117
struct WAV_LIST_HEADER WAV_LIST_HEADER
WAVE list header structure.
struct WAV_HEADER WAV_HEADER
WAVE header structure.
struct WAV_DATA_HEADER WAV_DATA_HEADER
WAVE data header structure.
struct WAV_FACT WAV_FACT
WAVE "fact" header structure.
struct WAV_HEADER_EX WAV_HEADER_EX
WAVE extended header structure.