source: trunk/essentials/dev-lang/python/Doc/lib/libwinsound.tex@ 3398

Last change on this file since 3398 was 3225, checked in by bird, 19 years ago

Python 2.5

File size: 4.8 KB
Line 
1\section{\module{winsound} ---
2 Sound-playing interface for Windows}
3
4\declaremodule{builtin}{winsound}
5 \platform{Windows}
6\modulesynopsis{Access to the sound-playing machinery for Windows.}
7\moduleauthor{Toby Dickenson}{[email protected]}
8\sectionauthor{Fred L. Drake, Jr.}{[email protected]}
9
10\versionadded{1.5.2}
11
12The \module{winsound} module provides access to the basic
13sound-playing machinery provided by Windows platforms. It includes
14functions and several constants.
15
16
17\begin{funcdesc}{Beep}{frequency, duration}
18 Beep the PC's speaker.
19 The \var{frequency} parameter specifies frequency, in hertz, of the
20 sound, and must be in the range 37 through 32,767.
21 The \var{duration} parameter specifies the number of milliseconds the
22 sound should last. If the system is not
23 able to beep the speaker, \exception{RuntimeError} is raised.
24 \note{Under Windows 95 and 98, the Windows \cfunction{Beep()}
25 function exists but is useless (it ignores its arguments). In that
26 case Python simulates it via direct port manipulation (added in version
27 2.1). It's unknown whether that will work on all systems.}
28 \versionadded{1.6}
29\end{funcdesc}
30
31\begin{funcdesc}{PlaySound}{sound, flags}
32 Call the underlying \cfunction{PlaySound()} function from the
33 Platform API. The \var{sound} parameter may be a filename, audio
34 data as a string, or \code{None}. Its interpretation depends on the
35 value of \var{flags}, which can be a bit-wise ORed combination of
36 the constants described below. If the system indicates an error,
37 \exception{RuntimeError} is raised.
38\end{funcdesc}
39
40\begin{funcdesc}{MessageBeep}{\optional{type=\code{MB_OK}}}
41 Call the underlying \cfunction{MessageBeep()} function from the
42 Platform API. This plays a sound as specified in the registry. The
43 \var{type} argument specifies which sound to play; possible values
44 are \code{-1}, \code{MB_ICONASTERISK}, \code{MB_ICONEXCLAMATION},
45 \code{MB_ICONHAND}, \code{MB_ICONQUESTION}, and \code{MB_OK}, all
46 described below. The value \code{-1} produces a ``simple beep'';
47 this is the final fallback if a sound cannot be played otherwise.
48 \versionadded{2.3}
49\end{funcdesc}