OGLplus  (0.59.0) a C++ wrapper for rendering APIs

c_api.hpp
Go to the documentation of this file.
1 #ifndef OALPLUS_ALC_API_C_API_HPP
9 #define OALPLUS_ALC_API_C_API_HPP
10 
11 #include "api_traits.hpp"
12 #include "config.hpp"
13 #include <eagine/nothing.hpp>
14 #include <eagine/preprocessor.hpp>
15 
16 #ifndef OALPLUS_ALC_STATIC_FUNC
17 #if OALPLUS_HAS_ALC
18 #define OALPLUS_ALC_STATIC_FUNC(NAME) &EAGINE_JOIN(::alc, NAME)
19 #else
20 #define OALPLUS_ALC_STATIC_FUNC(NAME) nullptr
21 #endif
22 #endif
23 
24 namespace eagine::oalp {
25 //------------------------------------------------------------------------------
30 template <typename ApiTraits>
32 public:
33  using this_api = basic_alc_c_api;
34 
36  using api_traits = ApiTraits;
37 
38  static constexpr bool has_api = alc_types::has_api;
39 
42 
45 
47  using enum_type = typename alc_types::enum_type;
48 
50  using char_type = typename alc_types::char_type;
51 
53  using bool_type = typename alc_types::bool_type;
54 
56  using int_type = typename alc_types::int_type;
57 
59  using uint_type = typename alc_types::uint_type;
60 
62  using size_type = typename alc_types::size_type;
63 
66 
67 #ifdef __GNUC__
68  EAGINE_DIAG_PUSH()
69  EAGINE_DIAG_OFF(address)
70 #endif
71 
73  template <
74  typename Signature,
75  c_api_function_ptr<api_traits, nothing_t, Signature> Function>
77  api_traits,
78  nothing_t,
79  Signature,
80  Function,
81  has_api,
82  bool(Function)>;
83 #ifdef __GNUC__
84  EAGINE_DIAG_POP()
85 #endif
86 
89  alc_api_function<enum_type(device_type*), OALPLUS_ALC_STATIC_FUNC(GetError)>
91 
96  OALPLUS_ALC_STATIC_FUNC(GetProcAddress)>
98 
102  enum_type(device_type*, const char_type*),
103  OALPLUS_ALC_STATIC_FUNC(GetEnumValue)>
105 
109  device_type*(const char_type*),
110  OALPLUS_ALC_STATIC_FUNC(OpenDevice)>
112 
116  device_type*(
117  const char_type*,
118  uint_type freq,
120  size_type bufsize),
121  OALPLUS_ALC_STATIC_FUNC(CaptureOpenDevice)>
123 
128  OALPLUS_ALC_STATIC_FUNC(CloseDevice)>
130 
135  OALPLUS_ALC_STATIC_FUNC(CaptureCloseDevice)>
137 
141  const char_type*(device_type*, enum_type),
142  OALPLUS_ALC_STATIC_FUNC(GetString)>
144 
149  OALPLUS_ALC_STATIC_FUNC(GetIntegerv)>
151 
155  bool_type(device_type*, const char_type*),
156  OALPLUS_ALC_STATIC_FUNC(IsExtensionPresent)>
158 
162  context_type*(device_type*, const int_type*),
163  OALPLUS_ALC_STATIC_FUNC(CreateContext)>
165 
168  alc_api_function<void(context_type*), OALPLUS_ALC_STATIC_FUNC(ProcessContext)>
170 
173  alc_api_function<void(context_type*), OALPLUS_ALC_STATIC_FUNC(SuspendContext)>
175 
178  alc_api_function<void(context_type*), OALPLUS_ALC_STATIC_FUNC(DestroyContext)>
180 
185  OALPLUS_ALC_STATIC_FUNC(MakeContextCurrent)>
187 
190  alc_api_function<context_type*(), OALPLUS_ALC_STATIC_FUNC(GetCurrentContext)>
192 
197  OALPLUS_ALC_STATIC_FUNC(GetContextsDevice)>
199 
202  alc_api_function<void(device_type*), OALPLUS_ALC_STATIC_FUNC(CaptureStart)>
204 
207  alc_api_function<void(device_type*), OALPLUS_ALC_STATIC_FUNC(CaptureStop)>
209 
214  OALPLUS_ALC_STATIC_FUNC(CaptureSamples)>
216 
217  basic_alc_c_api(api_traits& traits);
218 };
219 //------------------------------------------------------------------------------
223 //------------------------------------------------------------------------------
224 } // namespace eagine::oalp
225 
226 #endif // OALPLUS_ALC_API_C_API_HPP
alc_api_function< void_ptr_type(device_type *, const char_type *), nullptr > GetProcAddress
Definition: c_api.hpp:97
alc_api_function< void(device_type *), nullptr > CaptureStart
Definition: c_api.hpp:203
alc_api_function< context_type *(device_type *, const int_type *), nullptr > CreateContext
Definition: c_api.hpp:164
std::conditional_t< IsAvailable, std::conditional_t< IsStatic, static_c_api_function< ApiTraits, Tag, Signature, function >, dynamic_c_api_function< ApiTraits, Tag, Signature > >, unimplemented_c_api_function< ApiTraits, Tag, Signature > > opt_c_api_function
Template alias used for switching between static and dynamic function.
Definition: c_api_wrap.hpp:1096
typename alc_types::context_type context_type
Alias for context handle type.
Definition: c_api.hpp:44
alc_api_function< device_type *(const char_type *, uint_type freq, enum_type format, size_type bufsize), nullptr > CaptureOpenDevice
Definition: c_api.hpp:122
Class wrapping the C-functions from the ALC API.
Definition: c_api.hpp:31
typename alc_types::int_type int_type
Alias for signed integer type.
Definition: c_api.hpp:56
void * void_ptr_type
Untyped pointer type.
Definition: config.hpp:33
Class representing "none" / "nothing" values.
Definition: nothing.hpp:17
alc_api_function< context_type *(), nullptr > GetCurrentContext
Definition: c_api.hpp:191
alc_api_function< bool_type(device_type *, const char_type *), nullptr > IsExtensionPresent
Definition: c_api.hpp:157
alc_api_function< bool_type(device_type *), nullptr > CloseDevice
Definition: c_api.hpp:129
alc_api_function< bool_type(device_type *), nullptr > CaptureCloseDevice
Definition: c_api.hpp:136
alc_api_function< void(device_type *), nullptr > CaptureStop
Definition: c_api.hpp:208
typename alc_types::uint_type uint_type
Alias for unsigned integer type.
Definition: c_api.hpp:59
ApiTraits api_traits
Alias for the API traits policy type passed as template argument.
Definition: c_api.hpp:36
alc_api_function< device_type *(context_type *), nullptr > GetContextsDevice
Definition: c_api.hpp:198
alc_api_function< void(device_type *, enum_type, size_type, int_type *), nullptr > GetIntegerv
Definition: c_api.hpp:150
eagine::opt_c_api_function< api_traits, nothing_t, Signature, Function, has_api, bool(Function)> alc_api_function
Alias for ALC C-API function wrapper template.
Definition: c_api.hpp:82
basic_address< false > address
Type alias for non-const memory address values.
Definition: address.hpp:203
static auto format(std::string &&fmt_str) noexcept -> format_string_and_list< 0 >
Function taking a format string, returning an object for variable specification.
Definition: str_format.hpp:118
alc_api_function< const char_type *(device_type *, enum_type), nullptr > GetString
Definition: c_api.hpp:143
typename alc_types::device_type device_type
Alias for device handle type.
Definition: c_api.hpp:41
typename alc_types::void_ptr_type void_ptr_type
Untyped non-const pointer type.
Definition: c_api.hpp:65
alc_api_function< void(context_type *), nullptr > SuspendContext
Definition: c_api.hpp:174
typename alc_types::size_type size_type
Alias for integer type used to store sizes and counts.
Definition: c_api.hpp:62
alc_api_function< bool_type(context_type *), nullptr > MakeContextCurrent
Definition: c_api.hpp:186
typename alc_types::char_type char_type
Alias for string character type.
Definition: c_api.hpp:50
alc_api_function< device_type *(const char_type *), nullptr > OpenDevice
Definition: c_api.hpp:111
typename alc_types::enum_type enum_type
Alias for enumeration type.
Definition: c_api.hpp:47
alc_api_function< enum_type(device_type *, const char_type *), nullptr > GetEnumValue
Definition: c_api.hpp:104
alc_api_function< void(device_type *, void_ptr_type, size_type), nullptr > CaptureSamples
Definition: c_api.hpp:215
AL-related code is placed in this namespace.
Definition: oalplus.hpp:11
typename alc_types::bool_type bool_type
Alias for boolean type.
Definition: c_api.hpp:53
alc_api_function< void(context_type *), nullptr > ProcessContext
Definition: c_api.hpp:169
alc_api_function< void(context_type *), nullptr > DestroyContext
Definition: c_api.hpp:179
alc_api_function< enum_type(device_type *), nullptr > GetError
Definition: c_api.hpp:90

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).