Skip to content

Add audio::device enumeration #16

@SpinnerX

Description

@SpinnerX

To specify what audio devices are connected and provide a control over which devices you want to use to receive audio inputs and audio outputs to.

An audio::device needs to be implemented for audio::context to get this fully working.

Context for audio::context

Audio context provides an API for enumerating an audio device. The audio device is below an audio context in terms of audio context.

Which means to be able to enumerate for a valid audio device. This has to be done through the audio context.

General Information of an audio::device

When receiving an audio device. Each device will give you the following parameters:

  • device ID
  • Name of Specific Audio Device
  • is_default: bool

Two Types of Devices

audio::playback_device

A playback device is simply an audio device that is expected to send audio outputs to.

audio::capture_device

Unlike playback devices, a capture device is a type of audio device used for receiving audio inputs.

Expected API's for audio::device

Constructing the Audio Device

There are only two ways that are considered valid for object construction of an audio device.

  • Through configuration of specifying the type of audio device connected to your host machine.
  • Using audio::context to enumerate concurrent connected audio devices on your machine.

Example Usage with Audio Context

audio::context test_context;

// enumerating both playback and capture audio devices
std::span<const audio::playback_device> playback_devices = test_context.enumerate_playback_devices();
std::span<const audio::capture_device> capture_devices = test_context.enumerate_capture_devices();

Expected Behavior

Here are a few approaches to verifying your implementation works.

  • Printing out information on the currently enumerated devices
  • If context isn't available, can receive a parameter to specify a playback device automatically and print out that device's information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    📐designTasks that involve the core systems. Highly involve in API design.🚪entry

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions