Skip to content

Remove nbr_frames from write_to_device, take Copy enums by value - #85

Merged
HEnquist merged 2 commits into
masterfrom
api-cleanup
Oct 28, 2026
Merged

HEnquist merged 2 commits into
masterfrom
api-cleanup

Conversation

@HEnquist

Copy link
Copy Markdown
Owner

Two breaking API cleanups.

  • AudioRenderClient::write_to_device no longer takes nbr_frames, the slice length gives the frame count. A slice that isn't a whole number of frames still gives DataLengthMismatch. write_to_device_from_deque keeps its frame count.
  • Direction, Role, ShareMode, StreamMode and SampleType are taken by value instead of by reference, in get_device_collection, get_default_device, get_default_device_for_role, is_supported, initialize_client and WaveFormat::new.

Fixes #84

Direction, Role, ShareMode, StreamMode and SampleType are all Copy, but
several methods took them by reference. Newer methods like
get_buffer_size_limits already take TimingMode by value, so this makes
the API consistent.

Affects get_device_collection, get_default_device,
get_default_device_for_role, is_supported, initialize_client and
WaveFormat::new. Callers drop the `&`.
The slice length already gives the number of frames, so the argument
only duplicated it. It has been there since the first commit, copied
from the deque variant, where it is needed since the deque can hold
more than one buffer. write_to_device_from_deque keeps it.

A slice that is not a whole number of frames still gives
DataLengthMismatch, and an empty slice is still a no-op.

Fixes #84
@HEnquist
HEnquist merged commit 8221dca into master Oct 28, 2026
3 checks passed
@HEnquist HEnquist mentioned this pull request Oct 25, 2026
HEnquist added a commit that referenced this pull request Oct 29, 2026
Brings in get_stream_latency from #83, the by value enum arguments and the
frame count free write_to_device from #85, and the Debug derives from #86.
get_stream_latency unwraps the REFERENCE_TIME that the generated binding returns,
and the raw WaveFormat round trip test passes SampleType by value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove nbr_frames in AudioRenderClient::write_to_device()

1 participant