Add Russian translation provided by Валерий Крувялис <valkru@mail.ru>
[xiph-mirror.git] / ao-python / src / aomodule.h
blob688f578ad60971532f179e724046dafc006a8488
1 #ifndef __AO_MODULE_H__
2 #define __AO_MODULE_H__
4 #include <Python.h>
5 #include <ao/ao.h>
7 #define OPTSIZE 1024
9 typedef struct {
10 PyObject_HEAD
11 ao_device *dev;
12 int driver_id;
13 } ao_Object;
15 static PyObject *Py_aoError;
17 static ao_option * dict_to_options(PyObject *);
19 static PyObject *py_ao_new(PyObject *, PyObject *, PyObject *);
21 static void py_ao_dealloc(ao_Object *);
22 static PyObject* py_ao_getattr(PyObject *, char *);
24 static char py_ao_play_doc[] =
25 "Play the contents of a given audio buffer.\n\
26 \n\
27 Arguments:\n\
28 buff : Buffer or string containing audio data\n\
29 n : Number of bytes to play (defaults to len(buff))";
31 static PyObject *py_ao_play(PyObject *, PyObject *);
33 static char py_ao_driver_id_doc[] =
34 "Return the integer identifier for the driver with the given name (or object).";
35 static PyObject *py_ao_driver_id(PyObject *, PyObject *);
37 static char py_ao_driver_info_doc[] =
38 "Return a dictionary of information about a driver.\n\
39 \n\
40 It can either be called as a member function of an AudioDevice object:\n\
41 x.driver_info()\n\
42 or as a standalone function which takes the integer id of the driver:\n\
43 driver_info(1)";
44 static PyObject *py_ao_driver_info(PyObject *, PyObject *);
46 static char py_ao_is_big_endian_doc[] =
47 "Returns the endianness of the current host.";
48 static PyObject *py_ao_is_big_endian(PyObject *, PyObject *);
50 static char py_ao_doc[] =
51 "AudioDevice(driverid, bits=16, rate=44100, channels=2, byte_format=1, options=[], filename='', overwrite=0)\n\
52 OR\
53 AudioDevice(drivername, bits=16, rate=44100, channels=2, byte_format=1, options=[], filename='', overwrite=0)\n\
54 \n\
55 An AudioDevice object is an interface to a sound device. You can either pass\n\
56 an id of a specific type of device or the name of that device type.\n\
57 If filename is passed, the module will try to open an output file as the\n\
58 audio device. In this case, overwrite indicates whether to overwrite an\n\
59 existing file\n";
61 static PyObject *py_ao_default_driver_id(PyObject *self, PyObject *args);
62 static char py_ao_default_driver_id_doc[] ="Returns the ID number of the default live output driver.\n\
63 \n\
64 If the configuration files specify a default driver, its ID is returned,\n\
65 otherwise the library tries to pick a live output driver that will work\n\
66 on the host platform.\n\
67 \n\
68 Return values:\n\
69 . a non-negative value is the ID number of the default driver\n\
70 . -1 indicates failure to find a usable audio output device\n\
71 \n\
72 Notes:\n\
73 If no default device is available, you may still use the \n\
74 null device to test your application.";
77 static PyTypeObject ao_Type = {
78 PyObject_HEAD_INIT(&PyType_Type)
80 "AudioDevice",
81 sizeof(ao_Object),
84 /* Standard Methods */
85 (destructor) py_ao_dealloc,
86 (printfunc) 0,
87 (getattrfunc) py_ao_getattr,
88 (setattrfunc) 0,
89 (cmpfunc) 0,
90 (reprfunc) 0,
102 py_ao_doc,
106 struct PyMethodDef ao_Object_methods[] = {
107 {"driver_info", py_ao_driver_info,
108 METH_VARARGS, py_ao_driver_info_doc},
109 {"play", py_ao_play,
110 METH_VARARGS, py_ao_play_doc},
111 {NULL, NULL},
114 struct PyMethodDef ao_methods[] = {
115 {"AudioDevice", (PyCFunction) py_ao_new,
116 METH_VARARGS|METH_KEYWORDS, py_ao_doc},
117 {"driver_id", py_ao_driver_id,
118 METH_VARARGS, py_ao_driver_id_doc},
119 {"driver_info", py_ao_driver_info,
120 METH_VARARGS, py_ao_driver_info_doc},
121 {"is_big_endian", py_ao_is_big_endian,
122 METH_VARARGS, py_ao_is_big_endian_doc},
123 {"default_driver_id", py_ao_default_driver_id,
124 METH_NOARGS, py_ao_default_driver_id_doc},
125 {NULL, NULL}
128 static char docstring[] =
129 "A Python wrapper for the ao library using in the ogg project.";
132 #endif /* __AO_MODULE_H__ */