blob: e649363fe2913ae2fae08f0731c91943a80de8af [file] [log] [blame]
Zachary Ware73f8cfb2015-05-13 01:21:21 -05001/*[clinic input]
2preserve
3[clinic start generated code]*/
4
5PyDoc_STRVAR(winsound_PlaySound__doc__,
6"PlaySound($module, sound, flags, /)\n"
7"--\n"
8"\n"
9"A wrapper around the Windows PlaySound API.\n"
10"\n"
11" sound\n"
12" The sound to play; a filename, data, or None.\n"
13" flags\n"
14" Flag values, ored together. See module documentation.");
15
16#define WINSOUND_PLAYSOUND_METHODDEF \
17 {"PlaySound", (PyCFunction)winsound_PlaySound, METH_VARARGS, winsound_PlaySound__doc__},
18
19static PyObject *
20winsound_PlaySound_impl(PyModuleDef *module, Py_UNICODE *sound, int flags);
21
22static PyObject *
23winsound_PlaySound(PyModuleDef *module, PyObject *args)
24{
25 PyObject *return_value = NULL;
26 Py_UNICODE *sound;
27 int flags;
28
Zachary Ware77772c02015-05-13 10:58:35 -050029 if (!PyArg_ParseTuple(args, "Zi:PlaySound",
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030030 &sound, &flags)) {
Zachary Ware73f8cfb2015-05-13 01:21:21 -050031 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030032 }
Zachary Ware73f8cfb2015-05-13 01:21:21 -050033 return_value = winsound_PlaySound_impl(module, sound, flags);
34
35exit:
36 return return_value;
37}
38
39PyDoc_STRVAR(winsound_Beep__doc__,
40"Beep($module, frequency, duration, /)\n"
41"--\n"
42"\n"
43"A wrapper around the Windows Beep API.\n"
44"\n"
45" frequency\n"
46" Frequency of the sound in hertz.\n"
47" Must be in the range 37 through 32,767.\n"
48" duration\n"
49" How long the sound should play, in milliseconds.");
50
51#define WINSOUND_BEEP_METHODDEF \
52 {"Beep", (PyCFunction)winsound_Beep, METH_VARARGS, winsound_Beep__doc__},
53
54static PyObject *
55winsound_Beep_impl(PyModuleDef *module, int frequency, int duration);
56
57static PyObject *
58winsound_Beep(PyModuleDef *module, PyObject *args)
59{
60 PyObject *return_value = NULL;
61 int frequency;
62 int duration;
63
Zachary Ware77772c02015-05-13 10:58:35 -050064 if (!PyArg_ParseTuple(args, "ii:Beep",
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030065 &frequency, &duration)) {
Zachary Ware73f8cfb2015-05-13 01:21:21 -050066 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030067 }
Zachary Ware73f8cfb2015-05-13 01:21:21 -050068 return_value = winsound_Beep_impl(module, frequency, duration);
69
70exit:
71 return return_value;
72}
73
74PyDoc_STRVAR(winsound_MessageBeep__doc__,
75"MessageBeep($module, x=MB_OK, /)\n"
76"--\n"
77"\n"
78"Call Windows MessageBeep(x).\n"
79"\n"
80"x defaults to MB_OK.");
81
82#define WINSOUND_MESSAGEBEEP_METHODDEF \
83 {"MessageBeep", (PyCFunction)winsound_MessageBeep, METH_VARARGS, winsound_MessageBeep__doc__},
84
85static PyObject *
86winsound_MessageBeep_impl(PyModuleDef *module, int x);
87
88static PyObject *
89winsound_MessageBeep(PyModuleDef *module, PyObject *args)
90{
91 PyObject *return_value = NULL;
92 int x = MB_OK;
93
Zachary Ware77772c02015-05-13 10:58:35 -050094 if (!PyArg_ParseTuple(args, "|i:MessageBeep",
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030095 &x)) {
Zachary Ware73f8cfb2015-05-13 01:21:21 -050096 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030097 }
Zachary Ware73f8cfb2015-05-13 01:21:21 -050098 return_value = winsound_MessageBeep_impl(module, x);
99
100exit:
101 return return_value;
102}
Serhiy Storchaka5dee6552016-06-09 16:16:06 +0300103/*[clinic end generated code: output=a5f53e42d4396bb4 input=a9049054013a1b77]*/