| 1 | // SPDX-FileCopyrightText: 2022-2025 Geoffrey D. Bennett <[email protected]> |
| 2 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include "alsa.h" |
| 7 | |
| 8 | // Types of optional controls |
| 9 | typedef enum { |
| 10 | OPTIONAL_CONTROL_NAME, |
| 11 | } OptionalControlType; |
| 12 | |
| 13 | // Definition of an optional control |
| 14 | // Config key uses alsa_name (ALSA-style naming) |
| 15 | struct optional_control_def { |
| 16 | const char *alsa_name; // ALSA element name (e.g., "Name") |
| 17 | int alsa_type; // SND_CTL_ELEM_TYPE_* |
| 18 | size_t max_size; // For BYTES: max string length |
| 19 | const char *default_value; // Default string value |
| 20 | OptionalControlType type; // Type of optional control |
| 21 | }; |
| 22 | |
| 23 | // Table of optional control definitions |
| 24 | extern const struct optional_control_def optional_controls[]; |
| 25 | |
| 26 | // Initialise optional controls for a card |
| 27 | // - Checks which controls exist |
| 28 | // - Creates simulated elements for missing controls |
| 29 | // - Loads values from state file |
| 30 | // - Registers save callbacks |
| 31 | void optional_controls_init(struct alsa_card *card); |
| 32 | |
| 33 | // Get the Name element for a card (may be simulated) |
| 34 | // Returns NULL if not available |
| 35 | struct alsa_elem *optional_controls_get_name_elem(struct alsa_card *card); |
| 36 | |
| 37 | // Free optional control callback data (for use as GDestroyNotify) |
| 38 | void optional_controls_free_callback_data(void *data); |