| 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 | // Initialise port enable/disable elements for all routing sources and sinks |
| 9 | // - Creates simulated ALSA boolean elements for port enable state |
| 10 | // - Loads values from state file (defaults to enabled) |
| 11 | // - Registers save callbacks |
| 12 | // Must be called after custom_names_init() |
| 13 | void port_enable_init(struct alsa_card *card); |
| 14 | |
| 15 | // Check if a routing source is enabled |
| 16 | // Returns 1 if enabled, 0 if disabled |
| 17 | int is_routing_src_enabled(struct routing_src *src); |
| 18 | |
| 19 | // Check if a routing sink is enabled |
| 20 | // Returns 1 if enabled, 0 if disabled |
| 21 | int is_routing_snk_enabled(struct routing_snk *snk); |
| 22 | |
| 23 | // Get the enable element for a routing source |
| 24 | // Returns NULL if not available |
| 25 | struct alsa_elem *get_src_enable_elem(struct routing_src *src); |
| 26 | |
| 27 | // Get the enable element for a routing sink |
| 28 | // Returns NULL if not available |
| 29 | struct alsa_elem *get_snk_enable_elem(struct routing_snk *snk); |
| 30 | |
| 31 | // Check if all sources of a given category are disabled |
| 32 | // Returns 1 if all disabled, 0 if at least one is enabled |
| 33 | int all_sources_disabled(struct alsa_card *card, int port_category); |
| 34 | |
| 35 | // Check if all sinks of a given category are disabled |
| 36 | // Returns 1 if all disabled, 0 if at least one is enabled |
| 37 | int all_sinks_disabled(struct alsa_card *card, int port_category); |
| 38 | |
| 39 | // Update visibility of routing section grids based on port enable states |
| 40 | void update_routing_section_visibility(struct alsa_card *card); |
| 41 | |
| 42 | // Schedule a UI update for a card (runs at idle) |
| 43 | // Use PENDING_UI_UPDATE_* flags from alsa.h |
| 44 | void schedule_ui_update(struct alsa_card *card, int flags); |
| 45 | |
| 46 | // Free port enable callback data (for use as GDestroyNotify) |
| 47 | void port_enable_free_callback_data(void *data); |