1#ifndef SOUND_CHEF_COMMON
2#define SOUND_CHEF_COMMON
4#ifdef sound_chef_shared_EXPORTS
15 #define SC_CALL __stdcall
21 #define SC_DLL_IMPORT __declspec(dllimport)
22 #define SC_DLL_EXPORT __declspec(dllexport)
23 #define SC_DLL_PRIVATE static
24#elif defined(__APPLE__) || defined(__ANDROID__) || defined(__linux__)
25 #define SC_DLL_IMPORT __attribute__((visibility("default")))
26 #define SC_DLL_EXPORT __attribute__((visibility("default")))
27 #define SC_DLL_PRIVATE __attribute__((visibility("hidden")))
31 #define SC_DLL_PRIVATE
35 #define SC_API SC_DLL_EXPORT SC_CALL
36 #define SC_CLASS SC_DLL_EXPORT
38 #define SC_API SC_CALL
42#define SC_CHECK(condition, result) \
43 if ((condition) == MA_FALSE) \
45#define SC_CHECK_RESULT(result) \
46 if ((result) != MA_SUCCESS) \
48#define SC_CHECK_ARG(condition) \
49 if ((condition) == MA_FALSE) \
50 return MA_INVALID_ARGS
51#define SC_CHECK_MEM(ptr) \
53 return MA_OUT_OF_MEMORY
54#define SC_CHECK_MEM_FREE(ptr, freePtr) \
57 ma_free((freePtr), NULL); \
58 return MA_OUT_OF_MEMORY; \
60#define SC_CHECK_AND_GOTO(condition, dest) \
61 if ((condition) == MA_FALSE) \
64#define SC_ZERO_OBJECT(p) memset((p), 0, sizeof(*(p)))
66#define SC_COUNTOF(x) (sizeof(x) / sizeof(x[0]))
67#define SC_MAX(x, y) (((x) > (y)) ? (x) : (y))
68#define SC_MIN(x, y) (((x) < (y)) ? (x) : (y))
69#define SC_ABS(x) (((x) > 0) ? (x) : -(x))
70#define SC_CLAMP(x, lo, hi) (ma_max(lo, ma_min(x, hi)))
71#define SC_OFFSET_PTR(p, offset) (((ma_uint8*)(p)) + (offset))
72#define SC_ALIGN(x, a) (((x) + ((a)-1)) & ~((a)-1))
73#define SC_ALIGN_64(x) ma_align(x, 8)
80#define SC_VERSION_MAJOR 0
81#define SC_VERSION_MINOR 1
82#define SC_VERSION_PATCH 0
83#define SC_VERSION_STRING MA_XSTRINGIFY(SC_VERSION_MAJOR) "." MA_XSTRINGIFY(SC_VERSION_MINOR) "." MA_XSTRINGIFY(SC_VERSION_PATCH)
85#define SC_PRODUCT_NAME "Sound Chef"
87typedef ma_bool32 sc_bool;
88typedef ma_result sc_result;
103typedef enum sc_sound_mode
105 SC_SOUND_MODE_DEFAULT = 0x00000000,
106 SC_SOUND_MODE_DECODE = 0x00000001,
107 SC_SOUND_MODE_ASYNC = 0x00000002,
108 SC_SOUND_MODE_STREAM = 0x00000004,
111typedef enum sc_dsp_type
116 SC_DSP_TYPE_HIGHPASS,
121typedef enum sc_dsp_index
123 SC_DSP_INDEX_TAIL = -2,
124 SC_DSP_INDEX_HEAD = -1
127typedef enum sc_encoding_format
129 sc_encoding_format_unknown = 0,
130 sc_encoding_format_wav,
131 sc_encoding_format_adpcm = 10,
132 sc_encoding_format_vorbis,
133 sc_encoding_format_opus
136typedef sc_result(SC_CALL* SC_DSP_CREATE_CALLBACK)(
sc_dsp_state* dspState);
137typedef sc_result(SC_CALL* SC_DSP_RELEASE_CALLBACK)(
sc_dsp_state* dspState);
138typedef sc_result(SC_CALL* SC_DSP_SET_PARAM_FLOAT_CALLBACK)(
sc_dsp_state* dspState,
int index,
float value);
139typedef sc_result(SC_CALL* SC_DSP_GET_PARAM_FLOAT_CALLBACK)(
sc_dsp_state* dspState,
int index,
float* value);
143 SC_DSP_CREATE_CALLBACK create;
144 SC_DSP_RELEASE_CALLBACK release;
145 SC_DSP_SET_PARAM_FLOAT_CALLBACK setFloat;
146 SC_DSP_GET_PARAM_FLOAT_CALLBACK getFloat;
191 ma_decoder* memoryDecoder;
228 ma_resource_manager resourceManager;
Definition sound_chef_common.h:167
Definition sound_chef_dsp.h:34
Holds instance data for a single sc_dsp.
Definition sound_chef_common.h:160
Definition sound_chef_common.h:142
ma_node with an additional enum descriptor.
Definition sound_chef_common.h:179
Groups nodes/DSPs together into one.
Definition sound_chef_common.h:205
Definition sound_chef_common.h:188
Object that manages the node graph, sounds, output etc.
Definition sound_chef_common.h:226