Skip to content
Draft
Changes from 1 commit
Commits
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
7 changes: 3 additions & 4 deletions source/nvwave.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
c_void_p,
CFUNCTYPE,
c_float,
string_at,
c_char_p,
cast,
)
from comtypes import HRESULT
from comtypes.hresult import E_INVALIDARG
Expand Down Expand Up @@ -339,12 +340,10 @@ def feed(
# turn off trimming temporarily.
if self._purpose is AudioPurpose.SPEECH and self._isLeadingSilenceInserted:
self.startTrimmingLeadingSilence(False)
if not isinstance(data, bytes):
data = string_at(data, size)
try:
NVDAHelper.localLib.wasPlay_feed(
self._player,
data,
cast(data, c_char_p),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to keep the cast out of the wasPlay_feed call, otherwise it is hard to track issues caused by cast failures.

size if size is not None else len(data),
byref(feedId) if onDone else None,
)
Expand Down
Loading