blob: 52d25b2434a1c0491aa92db7d4cb917d56483dda [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__,
Zachary Warec4018812016-09-06 16:32:43 -05006"PlaySound($module, /, sound, flags)\n"
Zachary Ware73f8cfb2015-05-13 01:21:21 -05007"--\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 \
Victor Stinner37e4ef72016-09-09 20:00:13 -070017 {"PlaySound", (PyCFunction)winsound_PlaySound, METH_FASTCALL, winsound_PlaySound__doc__},
Zachary Ware73f8cfb2015-05-13 01:21:21 -050018
19static PyObject *
Zachary Wareae8298b2016-09-05 16:31:21 -050020winsound_PlaySound_impl(PyObject *module, PyObject *sound, int flags);
Zachary Ware73f8cfb2015-05-13 01:21:21 -050021
22static PyObject *
Victor Stinner37e4ef72016-09-09 20:00:13 -070023winsound_PlaySound(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
Zachary Ware73f8cfb2015-05-13 01:21:21 -050024{
25 PyObject *return_value = NULL;
Zachary Warec4018812016-09-06 16:32:43 -050026 static const char * const _keywords[] = {"sound", "flags", NULL};
27 static _PyArg_Parser _parser = {"Oi:PlaySound", _keywords, 0};
Zachary Wareae8298b2016-09-05 16:31:21 -050028 PyObject *sound;
Zachary Ware73f8cfb2015-05-13 01:21:21 -050029 int flags;
30
Victor Stinner37e4ef72016-09-09 20:00:13 -070031 if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030032 &sound, &flags)) {
Zachary Ware73f8cfb2015-05-13 01:21:21 -050033 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030034 }
Zachary Ware73f8cfb2015-05-13 01:21:21 -050035 return_value = winsound_PlaySound_impl(module, sound, flags);
36
37exit:
38 return return_value;
39}
40
41PyDoc_STRVAR(winsound_Beep__doc__,
Zachary Warec4018812016-09-06 16:32:43 -050042"Beep($module, /, frequency, duration)\n"
Zachary Ware73f8cfb2015-05-13 01:21:21 -050043"--\n"
44"\n"
45"A wrapper around the Windows Beep API.\n"
46"\n"
47" frequency\n"
48" Frequency of the sound in hertz.\n"
49" Must be in the range 37 through 32,767.\n"
50" duration\n"
51" How long the sound should play, in milliseconds.");
52
53#define WINSOUND_BEEP_METHODDEF \
Victor Stinner37e4ef72016-09-09 20:00:13 -070054 {"Beep", (PyCFunction)winsound_Beep, METH_FASTCALL, winsound_Beep__doc__},
Zachary Ware73f8cfb2015-05-13 01:21:21 -050055
56static PyObject *
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +030057winsound_Beep_impl(PyObject *module, int frequency, int duration);
Zachary Ware73f8cfb2015-05-13 01:21:21 -050058
59static PyObject *
Victor Stinner37e4ef72016-09-09 20:00:13 -070060winsound_Beep(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
Zachary Ware73f8cfb2015-05-13 01:21:21 -050061{
62 PyObject *return_value = NULL;
Zachary Warec4018812016-09-06 16:32:43 -050063 static const char * const _keywords[] = {"frequency", "duration", NULL};
64 static _PyArg_Parser _parser = {"ii:Beep", _keywords, 0};
Zachary Ware73f8cfb2015-05-13 01:21:21 -050065 int frequency;
66 int duration;
67
Victor Stinner37e4ef72016-09-09 20:00:13 -070068 if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030069 &frequency, &duration)) {
Zachary Ware73f8cfb2015-05-13 01:21:21 -050070 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030071 }
Zachary Ware73f8cfb2015-05-13 01:21:21 -050072 return_value = winsound_Beep_impl(module, frequency, duration);
73
74exit:
75 return return_value;
76}
77
78PyDoc_STRVAR(winsound_MessageBeep__doc__,
Zachary Warec4018812016-09-06 16:32:43 -050079"MessageBeep($module, /, type=MB_OK)\n"
Zachary Ware73f8cfb2015-05-13 01:21:21 -050080"--\n"
81"\n"
82"Call Windows MessageBeep(x).\n"
83"\n"
84"x defaults to MB_OK.");
85
86#define WINSOUND_MESSAGEBEEP_METHODDEF \
Victor Stinner37e4ef72016-09-09 20:00:13 -070087 {"MessageBeep", (PyCFunction)winsound_MessageBeep, METH_FASTCALL, winsound_MessageBeep__doc__},
Zachary Ware73f8cfb2015-05-13 01:21:21 -050088
89static PyObject *
Zachary Warec4018812016-09-06 16:32:43 -050090winsound_MessageBeep_impl(PyObject *module, int type);
Zachary Ware73f8cfb2015-05-13 01:21:21 -050091
92static PyObject *
Victor Stinner37e4ef72016-09-09 20:00:13 -070093winsound_MessageBeep(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
Zachary Ware73f8cfb2015-05-13 01:21:21 -050094{
95 PyObject *return_value = NULL;
Zachary Warec4018812016-09-06 16:32:43 -050096 static const char * const _keywords[] = {"type", NULL};
97 static _PyArg_Parser _parser = {"|i:MessageBeep", _keywords, 0};
98 int type = MB_OK;
Zachary Ware73f8cfb2015-05-13 01:21:21 -050099
Victor Stinner37e4ef72016-09-09 20:00:13 -0700100 if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
Zachary Warec4018812016-09-06 16:32:43 -0500101 &type)) {
Zachary Ware73f8cfb2015-05-13 01:21:21 -0500102 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +0300103 }
Zachary Warec4018812016-09-06 16:32:43 -0500104 return_value = winsound_MessageBeep_impl(module, type);
Zachary Ware73f8cfb2015-05-13 01:21:21 -0500105
106exit:
107 return return_value;
108}
Victor Stinner37e4ef72016-09-09 20:00:13 -0700109/*[clinic end generated code: output=bfe16b2b8b490cb1 input=a9049054013a1b77]*/