Blender
V4.5
intern
audaspace
intern
AUD_PyInit.cpp
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2009-2011 Jörg Hermann Müller
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9
#include "
AUD_PyInit.h
"
10
11
#include <AUD_Sound.h>
12
#include <python/PyAPI.h>
13
#include <python/PySound.h>
14
15
extern
void
*
BKE_sound_get_factory
(
void
*sound);
16
17
static
PyObject *
AUD_getSoundFromPointer
(PyObject *self, PyObject *args)
18
{
19
PyObject *lptr = NULL;
20
21
if
(PyArg_Parse(args,
"O:_sound_from_pointer"
, &lptr)) {
22
if
(lptr) {
23
AUD_Sound *sound =
BKE_sound_get_factory
(PyLong_AsVoidPtr(lptr));
24
25
if
(sound) {
26
Sound *obj = (Sound *)Sound_empty();
27
if
(obj) {
28
obj->sound = AUD_Sound_copy(sound);
29
return
(PyObject *)obj;
30
}
31
}
32
}
33
}
34
35
Py_RETURN_NONE;
36
}
37
38
static
PyMethodDef
meth_sound_from_pointer
[] = {
39
{
"_sound_from_pointer"
,
40
(PyCFunction)
AUD_getSoundFromPointer
,
41
METH_O,
42
"_sound_from_pointer(pointer)\n\n"
43
"Returns the corresponding :class:`Factory` object.\n\n"
44
":arg pointer: The pointer to the bSound object as long.\n"
45
":type pointer: long\n"
46
":return: The corresponding :class:`Factory` object.\n"
47
":rtype: :class:`Factory`"
}};
48
49
PyObject *
AUD_initPython
(
void
)
50
{
51
PyObject *module = PyInit_aud();
52
if
(module == NULL) {
53
printf
(
"Unable to initialise audio\n"
);
54
return
NULL;
55
}
56
57
PyModule_AddObject(
58
module,
"_sound_from_pointer"
, (PyObject *)PyCFunction_New(
meth_sound_from_pointer
, NULL));
59
PyDict_SetItemString(PyImport_GetModuleDict(),
"aud"
, module);
60
61
return
module
;
62
}
meth_sound_from_pointer
static PyMethodDef meth_sound_from_pointer[]
Definition
AUD_PyInit.cpp:38
AUD_initPython
PyObject * AUD_initPython(void)
Definition
AUD_PyInit.cpp:49
AUD_getSoundFromPointer
static PyObject * AUD_getSoundFromPointer(PyObject *self, PyObject *args)
Definition
AUD_PyInit.cpp:17
AUD_PyInit.h
BKE_sound_get_factory
void * BKE_sound_get_factory(void *sound)
printf
#define printf(...)
Definition
gpu_glsl_cpp_stubs.hh:32
Generated on
for Blender by
doxygen
1.18.0