11#include "SwitchboardVersion.hpp"
12#include "Platform.hpp"
26static_assert(
sizeof(char) == 1);
27static_assert(
sizeof(short) == 2);
28static_assert(
sizeof(int) == 4);
29static_assert(
sizeof(
long long) == 8);
33using uint8 =
unsigned char;
35using uint16 =
unsigned short;
36using int64 =
long long;
37using uint64 =
unsigned long long;
38using uint =
unsigned int;
42namespace switchboard::constants {
44static constexpr uint DEFAULT_SAMPLERATE = 44100;
45static constexpr uint MAX_SAMPLERATE = 48000;
46static constexpr uint MAX_BUFFER_DURATION_MS = 1000;
47static constexpr uint MAX_NUMBER_OF_FRAMES = MAX_SAMPLERATE * MAX_BUFFER_DURATION_MS / 1000;
49static constexpr uint LEGACY_MAX_NUMBER_OF_FRAMES = 4096;
51static constexpr uint NUM_CHANNELS_UNDEFINED = 0;
52static constexpr uint MONO = 1;
53static constexpr uint STEREO = 2;
54static constexpr uint QUAD = 4;
56static constexpr uint LEFT = 0;
57static constexpr uint RIGHT = 1;
59static constexpr uint SAMPLE_RATE_UNDEFINED = 0;
60static constexpr uint SAMPLE_RATE_8KHz = 8000;
61static constexpr uint SAMPLE_RATE_10KHz = 10000;
62static constexpr uint SAMPLE_RATE_16KHz = 16000;
63static constexpr uint SAMPLE_RATE_24KHz = 24000;
64static constexpr uint SAMPLE_RATE_44_1KHz = 44100;
65static constexpr uint SAMPLE_RATE_48KHz = 48000;
72#if defined(SWITCHBOARD_WEB)
73#include <emscripten.h>
74#define SB_WASM EMSCRIPTEN_KEEPALIVE
75#define SB_WASM_EXPORT(CLASS_NAME) \
76 SB_WASM static size_t getObjectSize() { \
77 return sizeof(CLASS_NAME); \
81#define SB_WASM_EXPORT(CLASS_NAME)
84#if NETWORKING_ENABLED && SWITCHBOARD_LICENSE_VALIDATION_ENABLED
85#define LICENSE_VALIDATION_ENABLED true
87#define LICENSE_VALIDATION_ENABLED false
91#define M_PI 3.1415926535897932384626433832
95#define M_PI_2 M_PI / 2
98#if defined(__has_cpp_attribute) && __has_cpp_attribute(clang::nonblocking)
99#define NONBLOCKING [[clang::nonblocking]]