Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e79af27

Browse files
committed
Flesh out PlaySound() docs enough so that SND_ALIAS isn't hopelessly confusing.
If someone knows how to turn the new table of guaranteed-registered system sounds into a LaTeX table, be my guest.
1 parent 121b6eb commit e79af27

2 files changed

Lines changed: 35 additions & 6 deletions

File tree

Doc/lib/libwinsound.tex

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,49 @@ \section{\module{winsound} ---
4040

4141
\begin{datadesc}{SND_FILENAME}
4242
The \var{sound} parameter is the name of a WAV file.
43+
Do not use with \constant{SND_ALIAS}.
4344
\end{datadesc}
4445

4546
\begin{datadesc}{SND_ALIAS}
46-
The \var{sound} parameter should be interpreted as a control panel
47-
sound association name.
47+
The \var{sound} parameter is a sound association name from the registry.
48+
If the registry contains no such name, play the system default sound
49+
unless \constant{SND_NODEFAULT} is also specified.
50+
If no default sound is registered, raise RuntimeError.
51+
Do not use with \constant{SND_FILENAME).
52+
53+
All Win32 systems support at least the following; most systems support
54+
many more:
55+
56+
\begin{verbatim}
57+
PlaySound argument Corresponding Control Panel -> Sounds name
58+
------------------ ------------------------------------------
59+
'SystemAsterisk' Asterisk
60+
'SystemExclamation' Exclamation
61+
'SystemExit' Exit Windows
62+
'SystemHand' Critical Stop
63+
'SystemQuestion' Question
64+
\end{verbatim}
65+
66+
For example,
67+
68+
\begin{verbatim}
69+
# Play Windows exit sound.
70+
winsound.PlaySound("SystemExit", winsound.SND_ALIAS)
71+
72+
# Probably play Windows default sound, if any is registered (because
73+
# "*" probably isn't the registered name of any sound).
74+
winsound.PlaySound("*", winsound.SND_ALIAS)
75+
\end{verbatim}
4876
\end{datadesc}
4977

5078
\begin{datadesc}{SND_LOOP}
5179
Play the sound repeatedly. The \constant{SND_ASYNC} flag must also
52-
be used to avoid blocking.
80+
be used to avoid blocking. Cannot be used with \constant{SND_MEMORY}.
5381
\end{datadesc}
5482

5583
\begin{datadesc}{SND_MEMORY}
5684
The \var{sound} parameter to \function{PlaySound()} is a memory
57-
image of a WAV file.
85+
image of a WAV file, as a string.
5886

5987
\strong{Note:} This module does not support playing from a memory
6088
image asynchronously, so a combination of this flag and
@@ -70,7 +98,8 @@ \section{\module{winsound} ---
7098
\end{datadesc}
7199

72100
\begin{datadesc}{SND_NODEFAULT}
73-
If the specified sound cannot be found, do not play a default beep.
101+
If the specified sound cannot be found, do not play the system default
102+
sound.
74103
\end{datadesc}
75104

76105
\begin{datadesc}{SND_NOSTOP}

PC/winsound.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static char sound_beep_doc[] =
5959
static char sound_module_doc[] =
6060
"PlaySound(sound, flags) - play a sound\n"
6161
"SND_FILENAME - sound is a wav file name\n"
62-
"SND_ALIAS - sound is a control panel sound association name\n"
62+
"SND_ALIAS - sound is a registry sound association name\n"
6363
"SND_LOOP - Play the sound repeatedly; must also specify SND_ASYNC\n"
6464
"SND_MEMORY - sound is a memory image of a wav file\n"
6565
"SND_PURGE - stop all instances of the specified sound\n"

0 commit comments

Comments
 (0)