Skip to content
Merged
Changes from all commits
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
10 changes: 6 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,13 @@ 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)
# wasPlay_feed requires c_char_p, so cast data to c_char_p before calling.
# Casting bytes to c_char_p is also fine, as long as the original data is not released.
dataptr = cast(data, c_char_p)
Comment thread
seanbudd marked this conversation as resolved.
try:
wasapi.wasPlay_feed(
self._player,
data,
dataptr,
size if size is not None else len(data),
Comment thread
seanbudd marked this conversation as resolved.
byref(feedId) if onDone else None,
)
Expand Down
Loading