feat: comprehensive buffer and period parameter methods #137
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds completes getter and setter methods for buffer and period parameters to the
HwParamsimplementation, including all_nearsetters.Added
Period Time Methods:
get_period_time(&self) -> Result<u32>get_period_time_min(&self) -> Result<u32>get_period_time_max(&self) -> Result<u32>set_period_time(&self, v: u32, dir: ValueOr) -> Result<()>set_period_time_min(&self, v: u32, dir: ValueOr) -> Result<u32>set_period_time_max(&self, v: u32, dir: ValueOr) -> Result<u32>Period Size Methods:
set_period_size_min(&self, v: Frames, dir: ValueOr) -> Result<Frames>set_period_size_max(&self, v: Frames, dir: ValueOr) -> Result<Frames>Periods Methods:
get_periods_min(&self) -> Result<u32>get_periods_max(&self) -> Result<u32>set_periods_near(&self, v: u32, dir: ValueOr) -> Result<u32>set_periods_min(&self, v: u32, dir: ValueOr) -> Result<u32>set_periods_max(&self, v: u32, dir: ValueOr) -> Result<u32>Buffer Time Methods:
get_buffer_time(&self) -> Result<u32>set_buffer_time(&self, v: u32, dir: ValueOr) -> Result<()>set_buffer_time_min(&self, v: u32, dir: ValueOr) -> Result<u32>set_buffer_time_max(&self, v: u32, dir: ValueOr) -> Result<u32>Use Case
These methods provide complete hardware parameter introspection and configuration capabilities, essential for:
_nearmethods)_min/_maxgetters)I'm currently working on improving the buffer and period size configuration in cpal, and this comprehensive parameter API is desired to properly query hardware constraints and select optimal configurations for different audio devices.