SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Toggle main menu visibility
Loading...
Searching...
No Matches
XWV.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <filesystem>
4
#include <span>
5
#include <vector>
6
7
#include <
sourcepp/parser/Binary.h
>
8
9
namespace
sndpp
{
10
11
class
XWV
{
12
public
:
13
enum class
Version
: uint32_t {
14
V0
= 20,
// This is actually just header size, but it's a good identifier
15
V1
=
sourcepp::parser::binary::makeFourCC
(
"XWV1"
),
// Seemingly not present in any actual releases but present in the 2006 SDK release
16
V4
=
sourcepp::parser::binary::makeFourCC
(
"XWV "
),
// Used on X360 and PS3 with no variation
17
};
18
19
enum class
Format
: uint8_t {
20
PCM
= 0,
// PCM16LE (v0+)
21
XMA
= 1,
// Xbox IMA-ADPCM (v0+)
22
XMA2
= 2,
// XMA2 (v4+) - note this slot is technically ADPCM, but it doesn't work in any official release, so it's been repurposed and XMA is remapped to XMA2 when parsing v4
23
MP3
= 3,
// MP3 (v4+)
24
};
25
26
enum class
Frequency
: uint8_t {
27
HZ_11025
= 0,
28
HZ_22050
= 1,
29
HZ_44100
= 2,
30
};
31
32
explicit
XWV
(std::span<const std::byte> xwvData);
33
34
explicit
XWV
(
const
std::filesystem::path& xwvPath);
35
36
explicit
operator
bool()
const
;
37
38
[[nodiscard]]
Version
getVersion
()
const
;
39
40
[[nodiscard]]
const
std::vector<std::byte>&
getAudioDataRaw
()
const
;
41
42
[[nodiscard]]
const
std::vector<std::byte>&
getStaticData
()
const
;
43
44
[[nodiscard]]
const
std::vector<std::byte>&
getValveData
()
const
;
45
46
[[nodiscard]]
const
std::vector<std::byte>&
getSeekTableData
()
const
;
47
48
[[nodiscard]] uint32_t
getDecodedSampleCount
()
const
;
49
50
[[nodiscard]] int32_t
getLoopStart
()
const
;
51
52
[[nodiscard]] uint16_t
getLoopBlock
()
const
;
53
54
[[nodiscard]] uint16_t
getLeadingSampleCount
()
const
;
55
56
[[nodiscard]] uint16_t
getTrailingSampleCount
()
const
;
57
58
[[nodiscard]]
Format
getFormat
()
const
;
59
60
[[nodiscard]] uint8_t
getBitsPerSample
()
const
;
61
62
[[nodiscard]]
Frequency
getFrequency
()
const
;
63
64
[[nodiscard]] uint8_t
getChannelCount
()
const
;
65
66
[[nodiscard]] uint8_t
getQuality
()
const
;
67
68
protected
:
69
std::vector<std::byte>
audioData
;
70
std::vector<std::byte>
staticData
;
71
std::vector<std::byte>
valveData
;
72
std::vector<std::byte>
seekTable
;
73
74
Version
version
;
75
uint32_t
decodedSampleCount
;
76
int32_t
loopStart
;
77
uint16_t
loopBlock
;
78
uint16_t
leadingSampleCount
;
79
uint16_t
trailingSampleCount
;
80
Format
format
;
81
uint8_t
bitsPerSample
;
82
Frequency
frequency
;
83
uint8_t
channelCount
;
84
uint8_t
quality
;
85
86
bool
opened
=
false
;
87
};
88
89
}
// namespace sndpp
Binary.h
sndpp::XWV::opened
bool opened
Definition
XWV.h:86
sndpp::XWV::getStaticData
const std::vector< std::byte > & getStaticData() const
Definition
XWV.cpp:152
sndpp::XWV::Format
Format
Definition
XWV.h:19
sndpp::XWV::Format::PCM
@ PCM
Definition
XWV.h:20
sndpp::XWV::Format::MP3
@ MP3
Definition
XWV.h:23
sndpp::XWV::Format::XMA
@ XMA
Definition
XWV.h:21
sndpp::XWV::Format::XMA2
@ XMA2
Definition
XWV.h:22
sndpp::XWV::getValveData
const std::vector< std::byte > & getValveData() const
Definition
XWV.cpp:156
sndpp::XWV::valveData
std::vector< std::byte > valveData
Definition
XWV.h:71
sndpp::XWV::getQuality
uint8_t getQuality() const
Definition
XWV.cpp:200
sndpp::XWV::getFormat
Format getFormat() const
Definition
XWV.cpp:184
sndpp::XWV::format
Format format
Definition
XWV.h:80
sndpp::XWV::bitsPerSample
uint8_t bitsPerSample
Definition
XWV.h:81
sndpp::XWV::Frequency
Frequency
Definition
XWV.h:26
sndpp::XWV::Frequency::HZ_44100
@ HZ_44100
Definition
XWV.h:29
sndpp::XWV::Frequency::HZ_11025
@ HZ_11025
Definition
XWV.h:27
sndpp::XWV::Frequency::HZ_22050
@ HZ_22050
Definition
XWV.h:28
sndpp::XWV::Version
Version
Definition
XWV.h:13
sndpp::XWV::Version::V0
@ V0
Definition
XWV.h:14
sndpp::XWV::Version::V4
@ V4
Definition
XWV.h:16
sndpp::XWV::Version::V1
@ V1
Definition
XWV.h:15
sndpp::XWV::audioData
std::vector< std::byte > audioData
Definition
XWV.h:69
sndpp::XWV::getSeekTableData
const std::vector< std::byte > & getSeekTableData() const
Definition
XWV.cpp:160
sndpp::XWV::loopBlock
uint16_t loopBlock
Definition
XWV.h:77
sndpp::XWV::getLoopStart
int32_t getLoopStart() const
Definition
XWV.cpp:168
sndpp::XWV::getChannelCount
uint8_t getChannelCount() const
Definition
XWV.cpp:196
sndpp::XWV::getAudioDataRaw
const std::vector< std::byte > & getAudioDataRaw() const
Definition
XWV.cpp:148
sndpp::XWV::getLoopBlock
uint16_t getLoopBlock() const
Definition
XWV.cpp:172
sndpp::XWV::getFrequency
Frequency getFrequency() const
Definition
XWV.cpp:192
sndpp::XWV::trailingSampleCount
uint16_t trailingSampleCount
Definition
XWV.h:79
sndpp::XWV::getVersion
Version getVersion() const
Definition
XWV.cpp:144
sndpp::XWV::quality
uint8_t quality
Definition
XWV.h:84
sndpp::XWV::decodedSampleCount
uint32_t decodedSampleCount
Definition
XWV.h:75
sndpp::XWV::channelCount
uint8_t channelCount
Definition
XWV.h:83
sndpp::XWV::seekTable
std::vector< std::byte > seekTable
Definition
XWV.h:72
sndpp::XWV::leadingSampleCount
uint16_t leadingSampleCount
Definition
XWV.h:78
sndpp::XWV::version
Version version
Definition
XWV.h:74
sndpp::XWV::XWV
XWV(std::span< const std::byte > xwvData)
Definition
XWV.cpp:22
sndpp::XWV::getBitsPerSample
uint8_t getBitsPerSample() const
Definition
XWV.cpp:188
sndpp::XWV::getLeadingSampleCount
uint16_t getLeadingSampleCount() const
Definition
XWV.cpp:176
sndpp::XWV::staticData
std::vector< std::byte > staticData
Definition
XWV.h:70
sndpp::XWV::getTrailingSampleCount
uint16_t getTrailingSampleCount() const
Definition
XWV.cpp:180
sndpp::XWV::frequency
Frequency frequency
Definition
XWV.h:82
sndpp::XWV::loopStart
int32_t loopStart
Definition
XWV.h:76
sndpp::XWV::getDecodedSampleCount
uint32_t getDecodedSampleCount() const
Definition
XWV.cpp:164
sndpp
Definition
RIFF.h:10
sourcepp::parser::binary::makeFourCC
consteval uint32_t makeFourCC(const char fourCC[4])
Creates a FourCC identifier from a string of 4 characters.
Definition
Binary.h:20
include
sndpp
XWV.h
Generated on
for SourcePP by
1.17.0