• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*[clinic input]
2 preserve
3 [clinic start generated code]*/
4 
5 PyDoc_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_FASTCALL|METH_KEYWORDS, winsound_PlaySound__doc__},
18 
19 static PyObject *
20 winsound_PlaySound_impl(PyObject *module, PyObject *sound, int flags);
21 
22 static PyObject *
winsound_PlaySound(PyObject * module,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)23 winsound_PlaySound(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
24 {
25     PyObject *return_value = NULL;
26     static const char * const _keywords[] = {"sound", "flags", NULL};
27     static _PyArg_Parser _parser = {"Oi:PlaySound", _keywords, 0};
28     PyObject *sound;
29     int flags;
30 
31     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
32         &sound, &flags)) {
33         goto exit;
34     }
35     return_value = winsound_PlaySound_impl(module, sound, flags);
36 
37 exit:
38     return return_value;
39 }
40 
41 PyDoc_STRVAR(winsound_Beep__doc__,
42 "Beep($module, /, frequency, duration)\n"
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    \
54     {"Beep", (PyCFunction)winsound_Beep, METH_FASTCALL|METH_KEYWORDS, winsound_Beep__doc__},
55 
56 static PyObject *
57 winsound_Beep_impl(PyObject *module, int frequency, int duration);
58 
59 static PyObject *
winsound_Beep(PyObject * module,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)60 winsound_Beep(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
61 {
62     PyObject *return_value = NULL;
63     static const char * const _keywords[] = {"frequency", "duration", NULL};
64     static _PyArg_Parser _parser = {"ii:Beep", _keywords, 0};
65     int frequency;
66     int duration;
67 
68     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
69         &frequency, &duration)) {
70         goto exit;
71     }
72     return_value = winsound_Beep_impl(module, frequency, duration);
73 
74 exit:
75     return return_value;
76 }
77 
78 PyDoc_STRVAR(winsound_MessageBeep__doc__,
79 "MessageBeep($module, /, type=MB_OK)\n"
80 "--\n"
81 "\n"
82 "Call Windows MessageBeep(x).\n"
83 "\n"
84 "x defaults to MB_OK.");
85 
86 #define WINSOUND_MESSAGEBEEP_METHODDEF    \
87     {"MessageBeep", (PyCFunction)winsound_MessageBeep, METH_FASTCALL|METH_KEYWORDS, winsound_MessageBeep__doc__},
88 
89 static PyObject *
90 winsound_MessageBeep_impl(PyObject *module, int type);
91 
92 static PyObject *
winsound_MessageBeep(PyObject * module,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)93 winsound_MessageBeep(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
94 {
95     PyObject *return_value = NULL;
96     static const char * const _keywords[] = {"type", NULL};
97     static _PyArg_Parser _parser = {"|i:MessageBeep", _keywords, 0};
98     int type = MB_OK;
99 
100     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
101         &type)) {
102         goto exit;
103     }
104     return_value = winsound_MessageBeep_impl(module, type);
105 
106 exit:
107     return return_value;
108 }
109 /*[clinic end generated code: output=beeee8be95667b7d input=a9049054013a1b77]*/
110