1#ifndef SOUND_CHEF_COMMON
2#define SOUND_CHEF_COMMON
4#ifdef sound_chef_shared_EXPORTS
17 #define SC_CALL __stdcall
23 #define SC_DLL_IMPORT __declspec(dllimport)
24 #define SC_DLL_EXPORT __declspec(dllexport)
25 #define SC_DLL_PRIVATE static
26#elif defined(__APPLE__) || defined(__ANDROID__) || defined(__linux__)
27 #define SC_DLL_IMPORT __attribute__((visibility("default")))
28 #define SC_DLL_EXPORT __attribute__((visibility("default")))
29 #define SC_DLL_PRIVATE __attribute__((visibility("hidden")))
33 #define SC_DLL_PRIVATE
37 #define SC_API SC_DLL_EXPORT SC_CALL
38 #define SC_CLASS SC_DLL_EXPORT
40 #define SC_API SC_CALL
44#define SC_CHECK(condition, result) \
45 if ((condition) == MA_FALSE) \
47#define SC_CHECK_RESULT(result) \
48 if ((result) != MA_SUCCESS) \
50#define SC_CHECK_ARG(condition) \
51 if ((condition) == MA_FALSE) \
52 return MA_INVALID_ARGS
53#define SC_CHECK_MEM(ptr) \
55 return MA_OUT_OF_MEMORY
56#define SC_CHECK_MEM_FREE(ptr, freePtr) \
59 ma_free((freePtr), NULL); \
60 return MA_OUT_OF_MEMORY; \
62#define SC_CHECK_AND_GOTO(condition, dest) \
63 if ((condition) == MA_FALSE) \
66#define SC_ZERO_OBJECT(p) memset((p), 0, sizeof(*(p)))
68#define SC_COUNTOF(x) (sizeof(x) / sizeof(x[0]))
69#define SC_MAX(x, y) (((x) > (y)) ? (x) : (y))
70#define SC_MIN(x, y) (((x) < (y)) ? (x) : (y))
71#define SC_ABS(x) (((x) > 0) ? (x) : -(x))
72#define SC_CLAMP(x, lo, hi) (ma_max(lo, ma_min(x, hi)))
73#define SC_OFFSET_PTR(p, offset) (((ma_uint8*)(p)) + (offset))
74#define SC_ALIGN(x, a) (((x) + ((a)-1)) & ~((a)-1))
75#define SC_ALIGN_64(x) ma_align(x, 8)
82#include "sound_chef/sound_chef_version.h"
84typedef ma_bool32 sc_bool;
85typedef 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,
122typedef enum sc_dsp_index
124 SC_DSP_INDEX_TAIL = -2,
125 SC_DSP_INDEX_HEAD = -1
128typedef enum sc_encoding_format
130 sc_encoding_format_unknown = 0,
131 sc_encoding_format_wav,
132 sc_encoding_format_adpcm = 10,
133 sc_encoding_format_vorbis,
134 sc_encoding_format_opus
137typedef sc_result(SC_CALL* SC_DSP_CREATE_CALLBACK)(
sc_dsp_state* dspState);
138typedef sc_result(SC_CALL* SC_DSP_RELEASE_CALLBACK)(
sc_dsp_state* dspState);
139typedef sc_result(SC_CALL* SC_DSP_SET_PARAM_FLOAT_CALLBACK)(
sc_dsp_state* dspState,
int index,
float value);
140typedef sc_result(SC_CALL* SC_DSP_GET_PARAM_FLOAT_CALLBACK)(
sc_dsp_state* dspState,
int index,
float* value);
144 SC_DSP_CREATE_CALLBACK create;
145 SC_DSP_RELEASE_CALLBACK release;
146 SC_DSP_SET_PARAM_FLOAT_CALLBACK setFloat;
147 SC_DSP_GET_PARAM_FLOAT_CALLBACK getFloat;
171 clap_plugin_factory_t* clapFactory;
185 clap_plugin_factory_t* clapFactory;
194 ma_decoder* memoryDecoder;
219 ma_handle dynamicLibraryHandle;
220 clap_plugin_entry_t* clapEntry;
221 clap_plugin_factory_t* pluginFactory;
241 ma_resource_manager resourceManager;
244 clap_host_t clapHost;
256 const char* pluginPath;
Holds a DLL handle and plugin entry for a CLAP plugin.
Definition sound_chef_common.h:218
Definition sound_chef_common.h:168
Definition sound_chef_dsp.h:34
Holds instance data for a single sc_dsp.
Definition sound_chef_common.h:161
Definition sound_chef_common.h:143
ma_node with an additional enum descriptor.
Definition sound_chef_common.h:181
Groups nodes/DSPs together into one.
Definition sound_chef_common.h:208
Definition sound_chef_common.h:191
Configuration for initializing the sc_system.
Definition sound_chef_common.h:255
Object that manages the node graph, sounds, output etc.
Definition sound_chef_common.h:239