HephAudio
v3.0.6
A cross-platform C++ library for recording, playing, and processing audio on Windows, Android, Linux, iOS, and macOS.
Loading...
Searching...
No Matches
HephCommon
HeaderFiles
HephShared.h
Go to the documentation of this file.
1
#pragma once
2
#include <cinttypes>
3
40
#define HEPH_STRINGIFY(x) #x
41
45
#define HEPH_TOSTRING(x) HEPH_STRINGIFY(x)
46
47
#if defined(_MSVC_LANG)
48
49
#define CPP_VERSION _MSVC_LANG
50
51
#else
52
53
#define CPP_VERSION __cplusplus
54
55
#endif
56
57
#define CPP_VERSION_PRE_98 (1L)
58
#define CPP_VERSION_98 (199711L)
59
#define CPP_VERSION_11 (201103L)
60
#define CPP_VERSION_14 (201402L)
61
#define CPP_VERSION_17 (201703L)
62
#define CPP_VERSION_20 (202002L)
63
#define CPP_VERSION_23 (202101L)
64
65
#if CPP_VERSION < CPP_VERSION_17
66
#error C++ 17 or above is required
67
#endif
68
69
#if defined(_MSC_VER) || (defined(__INTEL_COMPILER) && defined(_WIN32))
70
71
#if defined(_M_X64) || defined(_WIN64)
72
#define HEPH_ENV_64_BIT
73
#else
74
#define HEPH_ENV_32_BIT
75
#endif
76
77
#elif defined(__clang__) || defined(__INTEL_COMPILER) || defined(__GNUC__)
78
79
#if defined(__x86_64__) || defined(__ppc64__) || defined(__aarch64__)
80
#define HEPH_ENV_64_BIT
81
#else
82
#define HEPH_ENV_32_BIT
83
#endif
84
85
#else
86
87
#error unsupported environment
88
89
#endif
90
91
#if defined(_MSVC_LANG) || defined(__INTEL_COMPILER) || defined(__MINGW64__) || defined(__MINGW32__)
92
#define heph_aligned_malloc(size, alignment) _aligned_malloc(size, alignment)
93
#define heph_aligned_free _aligned_free
94
#else
95
#define heph_aligned_malloc(size, alignment) aligned_alloc(alignment, size)
96
#define heph_aligned_free free
97
#endif
98
99
#if (!defined(_MSC_VER) || defined(__INTEL_COMPILER))
100
101
#include <cstring>
102
103
#endif
104
109
#if defined(HEPH_SHARED_LIB)
110
111
#if defined(_WIN32)
112
113
#if defined(HEPH_EXPORTS)
114
#define HEPH_API __declspec(dllexport)
115
#else
116
#define HEPH_API __declspec(dllimport)
117
118
#endif
119
120
#else
121
122
#if defined(HEPH_EXPORTS)
123
#define HEPH_API __attribute__((visibility("default")))
124
#else
125
#define HEPH_API
126
#endif
127
128
#endif
129
130
#else
131
132
#define HEPH_API
133
134
#endif
135
140
#if defined(__GNUC__) || defined(__clang__) || defined(__INTEL_COMPILER)
141
#define HEPH_FUNC __PRETTY_FUNCTION__
142
#elif defined(_MSVC_LANG)
143
#define HEPH_FUNC __FUNCSIG__
144
#else
145
#define HEPH_FUNC __func__
146
#endif
147
148
namespace
Heph
149
{
150
enum
Endian : uint8_t
151
{
152
Little = 0x00,
153
Big = 0x01,
154
Unknown = 0xFF
155
};
156
161
extern
HEPH_API
Endian systemEndian;
162
169
HEPH_API
void
ChangeEndian
(uint8_t* pData, uint8_t dataSize);
170
171
inline
constexpr
Endian operator!(
const
Endian& lhs)
172
{
173
switch
(lhs)
174
{
175
case
Endian::Little:
176
return
Endian::Big;
177
case
Endian::Big:
178
return
Endian::Little;
179
default
:
180
return
Endian::Unknown;
181
}
182
}
183
188
#define HEPH_SYSTEM_ENDIAN Heph::systemEndian
189
194
#define HEPH_CHANGE_ENDIAN(pData, dataSize) Heph::ChangeEndian((uint8_t*)(pData), dataSize)
195
196
enum
ConvolutionMode
197
{
198
Full = 0,
199
Central = 1,
200
ValidPadding = 2
201
};
202
}
Heph::ChangeEndian
void ChangeEndian(uint8_t *pData, uint8_t dataSize)
HEPH_API
#define HEPH_API
Definition
HephShared.h:132
Generated by
1.11.0