(root)/
Python-3.11.7/
PC/
clinic/
winsound.c.h
       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_CAST(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 *
      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 = {NULL, _keywords, "PlaySound", 0};
      28      PyObject *argsbuf[2];
      29      PyObject *sound;
      30      int flags;
      31  
      32      args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
      33      if (!args) {
      34          goto exit;
      35      }
      36      sound = args[0];
      37      flags = _PyLong_AsInt(args[1]);
      38      if (flags == -1 && PyErr_Occurred()) {
      39          goto exit;
      40      }
      41      return_value = winsound_PlaySound_impl(module, sound, flags);
      42  
      43  exit:
      44      return return_value;
      45  }
      46  
      47  PyDoc_STRVAR(winsound_Beep__doc__,
      48  "Beep($module, /, frequency, duration)\n"
      49  "--\n"
      50  "\n"
      51  "A wrapper around the Windows Beep API.\n"
      52  "\n"
      53  "  frequency\n"
      54  "    Frequency of the sound in hertz.\n"
      55  "    Must be in the range 37 through 32,767.\n"
      56  "  duration\n"
      57  "    How long the sound should play, in milliseconds.");
      58  
      59  #define WINSOUND_BEEP_METHODDEF    \
      60      {"Beep", _PyCFunction_CAST(winsound_Beep), METH_FASTCALL|METH_KEYWORDS, winsound_Beep__doc__},
      61  
      62  static PyObject *
      63  winsound_Beep_impl(PyObject *module, int frequency, int duration);
      64  
      65  static PyObject *
      66  winsound_Beep(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
      67  {
      68      PyObject *return_value = NULL;
      69      static const char * const _keywords[] = {"frequency", "duration", NULL};
      70      static _PyArg_Parser _parser = {NULL, _keywords, "Beep", 0};
      71      PyObject *argsbuf[2];
      72      int frequency;
      73      int duration;
      74  
      75      args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
      76      if (!args) {
      77          goto exit;
      78      }
      79      frequency = _PyLong_AsInt(args[0]);
      80      if (frequency == -1 && PyErr_Occurred()) {
      81          goto exit;
      82      }
      83      duration = _PyLong_AsInt(args[1]);
      84      if (duration == -1 && PyErr_Occurred()) {
      85          goto exit;
      86      }
      87      return_value = winsound_Beep_impl(module, frequency, duration);
      88  
      89  exit:
      90      return return_value;
      91  }
      92  
      93  PyDoc_STRVAR(winsound_MessageBeep__doc__,
      94  "MessageBeep($module, /, type=MB_OK)\n"
      95  "--\n"
      96  "\n"
      97  "Call Windows MessageBeep(x).\n"
      98  "\n"
      99  "x defaults to MB_OK.");
     100  
     101  #define WINSOUND_MESSAGEBEEP_METHODDEF    \
     102      {"MessageBeep", _PyCFunction_CAST(winsound_MessageBeep), METH_FASTCALL|METH_KEYWORDS, winsound_MessageBeep__doc__},
     103  
     104  static PyObject *
     105  winsound_MessageBeep_impl(PyObject *module, int type);
     106  
     107  static PyObject *
     108  winsound_MessageBeep(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
     109  {
     110      PyObject *return_value = NULL;
     111      static const char * const _keywords[] = {"type", NULL};
     112      static _PyArg_Parser _parser = {NULL, _keywords, "MessageBeep", 0};
     113      PyObject *argsbuf[1];
     114      Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
     115      int type = MB_OK;
     116  
     117      args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
     118      if (!args) {
     119          goto exit;
     120      }
     121      if (!noptargs) {
     122          goto skip_optional_pos;
     123      }
     124      type = _PyLong_AsInt(args[0]);
     125      if (type == -1 && PyErr_Occurred()) {
     126          goto exit;
     127      }
     128  skip_optional_pos:
     129      return_value = winsound_MessageBeep_impl(module, type);
     130  
     131  exit:
     132      return return_value;
     133  }
     134  /*[clinic end generated code: output=b7e53fab4f26aeaf input=a9049054013a1b77]*/