HephAudio v3.1.0
A cross-platform C++ library for recording, playing, and processing audio on Windows, Android, Linux, iOS, and macOS.
Loading...
Searching...
No Matches
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(_MSC_VER) || defined(__INTEL_COMPILER))
92
93#include <cstring>
94
95#endif
96
101#if defined(HEPH_SHARED_LIB)
102
103#if defined(_WIN32)
104
105#if defined(HEPH_EXPORTS)
106#define HEPH_API __declspec(dllexport)
107#else
108#define HEPH_API __declspec(dllimport)
109
110#endif
111
112#else
113
114#if defined(HEPH_EXPORTS)
115#define HEPH_API __attribute__((visibility("default")))
116#else
117#define HEPH_API
118#endif
119
120#endif
121
122#else
123
124#define HEPH_API
125
126#endif
127
132#if defined(__GNUC__) || defined(__clang__) || defined(__INTEL_COMPILER)
133#define HEPH_FUNC __PRETTY_FUNCTION__
134#elif defined(_MSVC_LANG)
135#define HEPH_FUNC __FUNCSIG__
136#else
137#define HEPH_FUNC __func__
138#endif
139
140namespace Heph
141{
142 enum Endian : uint8_t
143 {
144 Little = 0x00,
145 Big = 0x01,
146 Unknown = 0xFF
147 };
148
153 extern HEPH_API Endian systemEndian;
154
161 HEPH_API void ChangeEndian(uint8_t* pData, uint8_t dataSize);
162
163 inline constexpr Endian operator!(const Endian& lhs)
164 {
165 switch (lhs)
166 {
167 case Endian::Little:
168 return Endian::Big;
169 case Endian::Big:
170 return Endian::Little;
171 default:
172 return Endian::Unknown;
173 }
174 }
175
180#define HEPH_SYSTEM_ENDIAN Heph::systemEndian
181
186#define HEPH_CHANGE_ENDIAN(pData, dataSize) Heph::ChangeEndian((uint8_t*)(pData), dataSize)
187
188 enum ConvolutionMode
189 {
190 Full = 0,
191 Central = 1,
192 ValidPadding = 2
193 };
194}
void ChangeEndian(uint8_t *pData, uint8_t dataSize)
#define HEPH_API
Definition HephShared.h:124