Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f496130
Update copyright year
SaschaCowley Dec 17, 2024
3434c9e
Made typing information more rich
SaschaCowley Dec 17, 2024
84d16b4
Moved generation of default output device into _getOutputDevices
SaschaCowley Dec 17, 2024
a850c24
Made settings dialog use _getOutputDevices and save device IDs
SaschaCowley Dec 17, 2024
410d25f
Switch to using endpoint IDs in wasapi.cpp
SaschaCowley Dec 18, 2024
c6eed8b
Renamed deviceName to endpointId in wasapi.cpp
SaschaCowley Dec 18, 2024
9c5dc27
Update wasapi.cpp header
SaschaCowley Dec 18, 2024
e48f5a4
Removed config.conf["speech"]["outputDevice"] in favour of config.con…
SaschaCowley Dec 18, 2024
e249f1e
Pre-commit auto-fix
pre-commit-ci[bot] Dec 18, 2024
b27a8a1
Merge branch 'master' into endpointIds
SaschaCowley Dec 18, 2024
77a0d1e
Pre-commit auto-fix
pre-commit-ci[bot] Dec 18, 2024
c44c642
Changed occurances of speech.outputDevice to audio.outputDevice
SaschaCowley Dec 18, 2024
6736ecf
Merge branch 'endpointIds' of https://github.com/nvaccess/nvda into e…
SaschaCowley Dec 18, 2024
3e7763c
Scafolded test
SaschaCowley Dec 18, 2024
be22c2a
Added tests for friendlyNameToEndpointId
SaschaCowley Dec 19, 2024
95908e1
Handle case where there is no audio section in the config
SaschaCowley Dec 19, 2024
a36e43b
Add tests for config upgrade
SaschaCowley Dec 19, 2024
92f2761
Incremented config version
SaschaCowley Dec 19, 2024
f08dc94
Fixed SAPI5 (again)
SaschaCowley Dec 19, 2024
51b6698
Apply suggestions from code review
SaschaCowley Dec 19, 2024
859625c
Update copyright headers
SaschaCowley Dec 19, 2024
b548135
Apply suggestions from code review
SaschaCowley Jan 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Made typing information more rich
  • Loading branch information
SaschaCowley committed Dec 17, 2024
commit 3434c9e71b779a1f62bf17a044c7b56eb855be18
13 changes: 9 additions & 4 deletions source/nvwave.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.

"""Provides a simple Python interface to playing audio using the Windows multimedia waveOut functions, as well as other useful utilities."""
"""Provides a simple Python interface to playing audio using the Windows Audio Session API (WASAPI), as well as other useful utilities."""

from collections.abc import Generator
import threading
Expand Down Expand Up @@ -100,8 +100,13 @@ class AudioPurpose(Enum):
SOUNDS = auto()


def _getOutputDevices() -> Generator[tuple[str, str]]:
"""Generator, yielding device ID and device Name in device ID order.
class _AudioOutputDevice(typing.NamedTuple):
id: str
friendlyName: str


def _getOutputDevices() -> Generator[_AudioOutputDevice]:
"""Generator, yielding device ID and device Name.
..note: Depending on number of devices being fetched, this may take some time (~3ms)
Comment thread
SaschaCowley marked this conversation as resolved.
Outdated
"""
endpointCollection = AudioUtilities.GetDeviceEnumerator().EnumAudioEndpoints(
Expand All @@ -112,7 +117,7 @@ def _getOutputDevices() -> Generator[tuple[str, str]]:
device = AudioUtilities.CreateDevice(endpointCollection.Item(i))
# This should never be None, but just to be sure
if device is not None:
yield device.id, device.FriendlyName
yield _AudioOutputDevice(device.id, device.FriendlyName)
else:
continue

Expand Down