Beatmup
wav_utilities.h
Go to the documentation of this file.
1
/*
2
Beatmup image and signal processing library
3
Copyright (C) 2019, lnstadrum
4
5
This program is free software: you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
9
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
14
15
You should have received a copy of the GNU General Public License
16
along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
#pragma once
20
#include <cstdint>
21
#include "../exception.h"
22
23
namespace
Beatmup
{
24
namespace
Audio {
25
26
/**
27
WAV files reading and writing
28
*/
29
namespace
WAV {
30
31
/**
32
WAV file header
33
*/
34
class
Header
{
35
public
:
36
uint32_t
37
m_RIFF
,
// "RIFF"
38
chunkSize
,
// file size minus 8,
39
m_WAVE
,
// "WAVE"
40
m_fmt_
,
// "fmt "
41
__16
;
42
uint16_t
43
audioFormat
,
44
numChannels
;
// number of channels
45
uint32_t
46
sampleRate
,
// sampling frequency
47
byteRate
;
48
uint16_t
49
blockAlign
,
50
bitsPerSample
;
// bps
51
uint32_t
52
m_data
,
53
dataSizeBytes
;
// remaining size in bytes
54
55
static
const
uint32_t
56
__RIFF
= 1179011410,
57
__WAVE
= 1163280727,
58
__fmt_
= 544501094,
59
__data
= 1635017060;
60
61
void
set
(uint32_t
sampleRate
, uint16_t
bitsPerSample
, uint16_t channelCount, uint32_t dataSize);
62
};
63
64
65
/**
66
Communicates an error related to a WAV file content
67
*/
68
class
InvalidWavFile
:
public
Exception
{
69
public
:
70
InvalidWavFile
(
const
char
*
message
) :
Exception
(
message
) {};
71
static
void
check
(
Header
& header);
72
};
73
}
74
}
75
}
Beatmup::Audio::WAV::Header
WAV file header.
Definition:
wav_utilities.h:34
Beatmup::Audio::WAV::Header::__RIFF
static const uint32_t __RIFF
Definition:
wav_utilities.h:56
Beatmup::Audio::WAV::Header::m_fmt_
uint32_t m_fmt_
Definition:
wav_utilities.h:40
Beatmup::Audio::WAV::Header::byteRate
uint32_t byteRate
Definition:
wav_utilities.h:47
Beatmup::Audio::WAV::Header::dataSizeBytes
uint32_t dataSizeBytes
Definition:
wav_utilities.h:53
Beatmup::Audio::WAV::Header::m_data
uint32_t m_data
Definition:
wav_utilities.h:52
Beatmup::Audio::WAV::Header::chunkSize
uint32_t chunkSize
Definition:
wav_utilities.h:38
Beatmup::Audio::WAV::Header::sampleRate
uint32_t sampleRate
Definition:
wav_utilities.h:46
Beatmup::Audio::WAV::Header::m_RIFF
uint32_t m_RIFF
Definition:
wav_utilities.h:37
Beatmup::Audio::WAV::Header::blockAlign
uint16_t blockAlign
Definition:
wav_utilities.h:49
Beatmup::Audio::WAV::Header::__16
uint32_t __16
Definition:
wav_utilities.h:41
Beatmup::Audio::WAV::Header::__fmt_
static const uint32_t __fmt_
Definition:
wav_utilities.h:58
Beatmup::Audio::WAV::Header::__WAVE
static const uint32_t __WAVE
Definition:
wav_utilities.h:57
Beatmup::Audio::WAV::Header::audioFormat
uint16_t audioFormat
Definition:
wav_utilities.h:43
Beatmup::Audio::WAV::Header::m_WAVE
uint32_t m_WAVE
Definition:
wav_utilities.h:39
Beatmup::Audio::WAV::Header::set
void set(uint32_t sampleRate, uint16_t bitsPerSample, uint16_t channelCount, uint32_t dataSize)
Definition:
wav_utilities.cpp:24
Beatmup::Audio::WAV::Header::bitsPerSample
uint16_t bitsPerSample
Definition:
wav_utilities.h:50
Beatmup::Audio::WAV::Header::numChannels
uint16_t numChannels
Definition:
wav_utilities.h:44
Beatmup::Audio::WAV::Header::__data
static const uint32_t __data
Definition:
wav_utilities.h:59
Beatmup::Audio::WAV::InvalidWavFile
Communicates an error related to a WAV file content.
Definition:
wav_utilities.h:68
Beatmup::Audio::WAV::InvalidWavFile::check
static void check(Header &header)
Definition:
wav_utilities.cpp:42
Beatmup::Audio::WAV::InvalidWavFile::InvalidWavFile
InvalidWavFile(const char *message)
Definition:
wav_utilities.h:70
Beatmup::Exception
Base class for all exceptions.
Definition:
exception.h:37
Beatmup::Exception::message
std::string message
Definition:
exception.h:39
Beatmup
Definition:
basic_types.h:22
core
audio
wav_utilities.h
Generated on Tue Nov 21 2023 13:54:26 for Beatmup by
1.9.1