Skip to content

[FEAT] Provide API to Get Device-Supported Sample Rates #79

@Mioter

Description

@Mioter

Requirements

  • I have searched the existing issues to ensure this feature has not already been requested.
  • I have clearly described the problem and the proposed solution.
  • I have considered alternative solutions.

1. Is your feature request related to a problem? Please describe.

I'm unable to dynamically adjust the output sample rate based on the capabilities of the target audio device, which can lead to compatibility issues and suboptimal audio quality. Currently, there's no way to retrieve the sample rates that a device natively supports through the SoundFlow API.

2. Describe the Solution You'd Like

I would like the library to provide:

  1. A method to get all supported sample rates for a specified audio device
  2. A property in the DeviceInfo class that exposes the list of supported sample rates

This would allow developers to query the device's capabilities and select the most appropriate sample rate for audio output, ensuring better compatibility and performance.

3. Describe Alternatives You've Considered

I've considered using a set of common sample rates (44.1kHz, 48kHz, etc.) and testing each one to see if it works, but this is inefficient and can result in errors or unexpected behavior. Another approach is to hardcode a sample rate, which limits compatibility across different devices.

4. Proposed API (if applicable)

// In DeviceInfo class
public IReadOnlyList<int> SupportedSampleRates { get; }

// Or as a method in the audio device manager
public IEnumerable<int> GetSupportedSampleRates(string deviceId);

5. Benefits

  • Enables dynamic adaptation to different audio hardware capabilities
  • Reduces compatibility issues caused by using unsupported sample rates
  • Improves audio quality by allowing selection of optimal sample rates

6. Potential Drawbacks/Challenges

No response

7. Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or requestin-progressThis issue is actively being worked on; development is currently in progress.

    Projects

    Status

    In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions