Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
824912eb
Commit
824912eb
authored
Jun 01, 2010
by
Brian Curtin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #8618. Ask the Windows mixer API if there are any playback devices
configured before attempting to test PlaySound.
parent
4f0108b0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
Lib/test/test_winsound.py
Lib/test/test_winsound.py
+6
-0
No files found.
Lib/test/test_winsound.py
View file @
824912eb
...
...
@@ -5,6 +5,7 @@ from test import test_support
import
time
import
os
import
subprocess
import
ctypes
winsound
=
test_support
.
import_module
(
'winsound'
)
import
_winreg
...
...
@@ -12,6 +13,11 @@ import _winreg
def
has_sound
(
sound
):
"""Find out if a particular event is configured with a default sound"""
try
:
# Ask the mixer API for the number of devices it knows about.
# When there are no devices, PlaySound will fail.
if
ctypes
.
windll
.
winmm
.
mixerGetNumDevs
()
is
0
:
return
False
key
=
_winreg
.
OpenKeyEx
(
_winreg
.
HKEY_CURRENT_USER
,
"AppEvents
\
Schemes
\
Apps
\
.De
f
ault
\
{
0
}
\
.De
f
ault"
.
format
(
sound
))
value
=
_winreg
.
EnumValue
(
key
,
0
)[
1
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment