summaryrefslogtreecommitdiffstats
path: root/Doc/lib/libwinsound.tex
blob: 153088dd7078401636d2447860c7031f32326ada (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
\section{\module{winsound} ---
         Sound-playing interface for Windows}

\declaremodule{builtin}{winsound}
  \platform{Windows}
\modulesynopsis{Access to the sound-playing machinery for Windows.}
\moduleauthor{Toby Dickenson}{htrd90@zepler.org}
\sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org}

\versionadded{1.5.2}

The \module{winsound} module provides access to the basic
sound-playing machinery provided by Windows platforms.  It includes
two functions and several constants.


\begin{funcdesc}{Beep}{frequency, duration}
  Beep the PC's speaker.
  The \var{frequency} parameter specifies frequency, in hertz, of the
  sound, and must be in the range 37 through 32,767 (\code{0x25}
  through \code{0x7fff}).  The \var{duration} parameter specifies the
  number of milliseconds the sound should last.  If the system is not
  able to beep the speaker, \exception{RuntimeError} is raised.
  \versionadded{1.5.3} % XXX fix this version number when release is scheduled!
\end{funcdesc}

\begin{funcdesc}{PlaySound}{sound, flags}
  Call the underlying \cfunction{PlaySound()} function from the
  Platform API.  The \var{sound} parameter may be a filename, audio
  data as a string, or \code{None}.  Its interpretation depends on the
  value of \var{flags}, which can be a bit-wise ORed combination of
  the constants described below.  If the system indicates an error,
  \exception{RuntimeError} is raised.
\end{funcdesc}


\begin{datadesc}{SND_FILENAME}
  The \var{sound} parameter is the name of a WAV file.
\end{datadesc}

\begin{datadesc}{SND_ALIAS}
  The \var{sound} parameter should be interpreted as a control panel
  sound association name.
\end{datadesc}

\begin{datadesc}{SND_LOOP}
  Play the sound repeatedly.  The \constant{SND_ASYNC} flag must also
  be used to avoid blocking.
\end{datadesc}

\begin{datadesc}{SND_MEMORY}
  The \var{sound} parameter to \function{PlaySound()} is a memory
  image of a WAV file.

  \strong{Note:}  This module does not support playing from a memory
  image asynchonously, so a combination of this flag and
  \constant{SND_ASYNC} will raise a \exception{RuntimeError}.
\end{datadesc}

\begin{datadesc}{SND_PURGE}
  Stop playing all instances of the specified sound.
\end{datadesc}

\begin{datadesc}{SND_ASYNC}
  Return immediately, allowing sounds to play asynchronously.
\end{datadesc}

\begin{datadesc}{SND_NODEFAULT}
  If the specified sound cannot be found, do not play a default beep.
\end{datadesc}

\begin{datadesc}{SND_NOSTOP}
  Do not interrupt sounds currently playing.
\end{datadesc}

\begin{datadesc}{SND_NOWAIT}
  Return immediately if the sound driver is busy.
\end{datadesc}