Zachary Ware | 73f8cfb | 2015-05-13 01:21:21 -0500 | [diff] [blame] | 1 | /*[clinic input] |
| 2 | preserve |
| 3 | [clinic start generated code]*/ |
| 4 | |
| 5 | PyDoc_STRVAR(winsound_PlaySound__doc__, |
Zachary Ware | c401881 | 2016-09-06 16:32:43 -0500 | [diff] [blame] | 6 | "PlaySound($module, /, sound, flags)\n" |
Zachary Ware | 73f8cfb | 2015-05-13 01:21:21 -0500 | [diff] [blame] | 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 \ |
Victor Stinner | 37e4ef7 | 2016-09-09 20:00:13 -0700 | [diff] [blame] | 17 | {"PlaySound", (PyCFunction)winsound_PlaySound, METH_FASTCALL, winsound_PlaySound__doc__}, |
Zachary Ware | 73f8cfb | 2015-05-13 01:21:21 -0500 | [diff] [blame] | 18 | |
| 19 | static PyObject * |
Zachary Ware | ae8298b | 2016-09-05 16:31:21 -0500 | [diff] [blame] | 20 | winsound_PlaySound_impl(PyObject *module, PyObject *sound, int flags); |
Zachary Ware | 73f8cfb | 2015-05-13 01:21:21 -0500 | [diff] [blame] | 21 | |
| 22 | static PyObject * |
Victor Stinner | 37e4ef7 | 2016-09-09 20:00:13 -0700 | [diff] [blame] | 23 | winsound_PlaySound(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) |
Zachary Ware | 73f8cfb | 2015-05-13 01:21:21 -0500 | [diff] [blame] | 24 | { |
| 25 | PyObject *return_value = NULL; |
Zachary Ware | c401881 | 2016-09-06 16:32:43 -0500 | [diff] [blame] | 26 | static const char * const _keywords[] = {"sound", "flags", NULL}; |
| 27 | static _PyArg_Parser _parser = {"Oi:PlaySound", _keywords, 0}; |
Zachary Ware | ae8298b | 2016-09-05 16:31:21 -0500 | [diff] [blame] | 28 | PyObject *sound; |
Zachary Ware | 73f8cfb | 2015-05-13 01:21:21 -0500 | [diff] [blame] | 29 | int flags; |
| 30 | |
Victor Stinner | 37e4ef7 | 2016-09-09 20:00:13 -0700 | [diff] [blame] | 31 | if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 32 | &sound, &flags)) { |
Zachary Ware | 73f8cfb | 2015-05-13 01:21:21 -0500 | [diff] [blame] | 33 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 34 | } |
Zachary Ware | 73f8cfb | 2015-05-13 01:21:21 -0500 | [diff] [blame] | 35 | return_value = winsound_PlaySound_impl(module, sound, flags); |
| 36 | |
| 37 | exit: |
| 38 | return return_value; |
| 39 | } |
| 40 | |
| 41 | PyDoc_STRVAR(winsound_Beep__doc__, |
Zachary Ware | c401881 | 2016-09-06 16:32:43 -0500 | [diff] [blame] | 42 | "Beep($module, /, frequency, duration)\n" |
Zachary Ware | 73f8cfb | 2015-05-13 01:21:21 -0500 | [diff] [blame] | 43 | "--\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 Stinner | 37e4ef7 | 2016-09-09 20:00:13 -0700 | [diff] [blame] | 54 | {"Beep", (PyCFunction)winsound_Beep, METH_FASTCALL, winsound_Beep__doc__}, |
Zachary Ware | 73f8cfb | 2015-05-13 01:21:21 -0500 | [diff] [blame] | 55 | |
| 56 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 57 | winsound_Beep_impl(PyObject *module, int frequency, int duration); |
Zachary Ware | 73f8cfb | 2015-05-13 01:21:21 -0500 | [diff] [blame] | 58 | |
| 59 | static PyObject * |
Victor Stinner | 37e4ef7 | 2016-09-09 20:00:13 -0700 | [diff] [blame] | 60 | winsound_Beep(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) |
Zachary Ware | 73f8cfb | 2015-05-13 01:21:21 -0500 | [diff] [blame] | 61 | { |
| 62 | PyObject *return_value = NULL; |
Zachary Ware | c401881 | 2016-09-06 16:32:43 -0500 | [diff] [blame] | 63 | static const char * const _keywords[] = {"frequency", "duration", NULL}; |
| 64 | static _PyArg_Parser _parser = {"ii:Beep", _keywords, 0}; |
Zachary Ware | 73f8cfb | 2015-05-13 01:21:21 -0500 | [diff] [blame] | 65 | int frequency; |
| 66 | int duration; |
| 67 | |
Victor Stinner | 37e4ef7 | 2016-09-09 20:00:13 -0700 | [diff] [blame] | 68 | if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 69 | &frequency, &duration)) { |
Zachary Ware | 73f8cfb | 2015-05-13 01:21:21 -0500 | [diff] [blame] | 70 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 71 | } |
Zachary Ware | 73f8cfb | 2015-05-13 01:21:21 -0500 | [diff] [blame] | 72 | return_value = winsound_Beep_impl(module, frequency, duration); |
| 73 | |
| 74 | exit: |
| 75 | return return_value; |
| 76 | } |
| 77 | |
| 78 | PyDoc_STRVAR(winsound_MessageBeep__doc__, |
Zachary Ware | c401881 | 2016-09-06 16:32:43 -0500 | [diff] [blame] | 79 | "MessageBeep($module, /, type=MB_OK)\n" |
Zachary Ware | 73f8cfb | 2015-05-13 01:21:21 -0500 | [diff] [blame] | 80 | "--\n" |
| 81 | "\n" |
| 82 | "Call Windows MessageBeep(x).\n" |
| 83 | "\n" |
| 84 | "x defaults to MB_OK."); |
| 85 | |
| 86 | #define WINSOUND_MESSAGEBEEP_METHODDEF \ |
Victor Stinner | 37e4ef7 | 2016-09-09 20:00:13 -0700 | [diff] [blame] | 87 | {"MessageBeep", (PyCFunction)winsound_MessageBeep, METH_FASTCALL, winsound_MessageBeep__doc__}, |
Zachary Ware | 73f8cfb | 2015-05-13 01:21:21 -0500 | [diff] [blame] | 88 | |
| 89 | static PyObject * |
Zachary Ware | c401881 | 2016-09-06 16:32:43 -0500 | [diff] [blame] | 90 | winsound_MessageBeep_impl(PyObject *module, int type); |
Zachary Ware | 73f8cfb | 2015-05-13 01:21:21 -0500 | [diff] [blame] | 91 | |
| 92 | static PyObject * |
Victor Stinner | 37e4ef7 | 2016-09-09 20:00:13 -0700 | [diff] [blame] | 93 | winsound_MessageBeep(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) |
Zachary Ware | 73f8cfb | 2015-05-13 01:21:21 -0500 | [diff] [blame] | 94 | { |
| 95 | PyObject *return_value = NULL; |
Zachary Ware | c401881 | 2016-09-06 16:32:43 -0500 | [diff] [blame] | 96 | static const char * const _keywords[] = {"type", NULL}; |
| 97 | static _PyArg_Parser _parser = {"|i:MessageBeep", _keywords, 0}; |
| 98 | int type = MB_OK; |
Zachary Ware | 73f8cfb | 2015-05-13 01:21:21 -0500 | [diff] [blame] | 99 | |
Victor Stinner | 37e4ef7 | 2016-09-09 20:00:13 -0700 | [diff] [blame] | 100 | if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, |
Zachary Ware | c401881 | 2016-09-06 16:32:43 -0500 | [diff] [blame] | 101 | &type)) { |
Zachary Ware | 73f8cfb | 2015-05-13 01:21:21 -0500 | [diff] [blame] | 102 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 103 | } |
Zachary Ware | c401881 | 2016-09-06 16:32:43 -0500 | [diff] [blame] | 104 | return_value = winsound_MessageBeep_impl(module, type); |
Zachary Ware | 73f8cfb | 2015-05-13 01:21:21 -0500 | [diff] [blame] | 105 | |
| 106 | exit: |
| 107 | return return_value; |
| 108 | } |
Victor Stinner | 37e4ef7 | 2016-09-09 20:00:13 -0700 | [diff] [blame] | 109 | /*[clinic end generated code: output=bfe16b2b8b490cb1 input=a9049054013a1b77]*/ |