-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathBackends.cpp
More file actions
71 lines (52 loc) · 1.23 KB
/
Backends.cpp
File metadata and controls
71 lines (52 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include "../funcs.h"
#include "../utils.h"
#include "../template/args.h"
static const struct luaL_Reg backend_funcs[] = {
#if AF_API_VERSION >= 32
{
"af_get_available_backends", [](lua_State * L)
{
lua_settop(L, 0); // (clear)
int backends = 0;
af_err err = af_get_available_backends(&backends);
lua_pushinteger(L, err);// err
lua_pushinteger(L, backends); // err, backends
return 2;
}
}, {
"af_get_backend_count", [](lua_State * L)
{
lua_settop(L, 0); // (clear)
unsigned num = 1;
af_err err = af_get_backend_count(&num);
lua_pushinteger(L, err);// err
lua_pushinteger(L, num);// err, num
return 2;
}
}, {
"af_get_backend_id", [](lua_State * L)
{
lua_settop(L, 1); // arr
af_backend backend = (af_backend)0;
af_err err = af_get_backend_id(&backend, GetArray(L, 1));
lua_pushinteger(L, err);// arr, err
lua_pushinteger(L, backend);// arr, err, backend
return 2;
}
}, {
"af_set_backend", [](lua_State * L)
{
lua_settop(L, 1); // bknd
af_err err = af_set_backend(Arg<af_backend>(L, 1));
lua_pushinteger(L, err);// bknd, err
return 1;
}
},
#endif
{ NULL, NULL }
};
int Backends (lua_State * L)
{
luaL_register(L, NULL, backend_funcs);
return 0;
}