blob: 9cc006f5daea4ebd4ba59899384c109fb44a62c2 [file] [log] [blame]
// Copyright 2022 The Fuchsia Authors.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.audio.controller;
using fuchsia.audio.device;
using fuchsia.hardware.audio.signalprocessing;
using fuchsia.hardware.audio;
using fuchsia.io;
using zx;
/// Identifies an audio device.
type DeviceSelector = flexible union {
/// Driver node in devfs, e.g. `/dev/class/audio-input/3d99d780`.
1: devfs struct {
/// ID of device.
id fuchsia.io.Name;
/// Device type.
device_type fuchsia.audio.device.DeviceType;
};
/// A device available through the `fuchsia.audio.device/Registry` protocol.
2: registry fuchsia.audio.device.TokenId;
};
/// Identifies a device ring buffer for playing/recording.
type DeviceRingBuffer = struct {
/// The device that has a ring buffer.
selector DeviceSelector;
/// The ID of an ENDPOINT (with type RING_BUFFER) signal processing element
/// of the desired ring buffer.
///
/// For Dai and StreamConfig devices, this should be
/// `fuchsia.audio.device.DEFAULT_RING_BUFFER_ELEMENT_ID`.
ring_buffer_element_id fuchsia.hardware.audio.signalprocessing.ElementId;
};
/// Enumerate, query, and control audio devices from clients.
@discoverable
open protocol DeviceControl {
/// Sets the gain of the stream in decibels.
flexible DeviceSetGainState(resource table {
/// Id of the device to set the gain state.
///
/// Required.
1: device DeviceSelector;
/// Desired gain state.
///
/// Required.
2: gain_state fuchsia.hardware.audio.GainState;
}) -> () error zx.Status;
};