Sound Bakery  v0.1.0
Open-source audio middleware for games
Loading...
Searching...
No Matches
api_macros.h
1#pragma once
2
3#define SB_CHECK_SYS() \
4 { \
5 ATLAS_SYSTEM* atlasSystem = Atlas_System_GetInstance(); \
6 if (!atlasSystem) \
7 { \
8 return FMOD_ERR_STUDIO_UNINITIALIZED; \
9 } \
10 FMOD_SYSTEM* fmodSystem = nullptr; \
11 Atlas_System_GetCoreSystem(&fmodSystem); \
12 if (!fmodSystem) \
13 { \
14 return FMOD_ERR_UNINITIALIZED; \
15 } \
16 }
17
18#define SB_CHECK_PTR(ptr) \
19 if (!ptr) \
20 { \
21 return FMOD_ERR_INVALID_PARAM; \
22 }
23
24#define SB_CHECK_GOBJ(gameObject) \
25 { \
26 if (!gameObject) \
27 { \
28 ATLAS_SYSTEM* system = Atlas_System_GetInstance(); \
29 std::optional<ATLAS_GAMEOBJECT*> defaultGameObject = system->GetListenerGameObject(); \
30 gameObject = defaultGameObject ? defaultGameObject.value() : nullptr; \
31 if (!gameObject) \
32 { \
33 return FMOD_ERR_INTERNAL; \
34 } \
35 } \
36 }
37
38#define SB_CHECK(x, err) \
39 { \
40 if (!x) \
41 { \
42 return err; \
43 } \
44 }