| 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 custom name elements for all routing sources and sinks |
| 9 | // - Creates simulated ALSA elements for custom names |
| 10 | // - Loads values from state file |
| 11 | // - Registers save callbacks |
| 12 | // Must be called after alsa_get_routing_controls() |
| 13 | void custom_names_init(struct alsa_card *card); |
| 14 | |
| 15 | // Get display name for a routing source |
| 16 | // Returns custom name if set, otherwise returns the default name |
| 17 | const char *get_routing_src_display_name(struct routing_src *src); |
| 18 | |
| 19 | // Get display name for a routing sink |
| 20 | // Returns custom name if set, otherwise returns the element name |
| 21 | const char *get_routing_snk_display_name(struct routing_snk *snk); |
| 22 | |
| 23 | // Get formatted default name for a routing source (ignoring custom name) |
| 24 | // If abbreviated is true, DSP/Mix use short form ("1", "A") for routing window |
| 25 | // Returns newly allocated string that must be freed |
| 26 | char *get_src_default_name_formatted(struct routing_src *src, int abbreviated); |
| 27 | |
| 28 | // Get the formatted name to display for a routing source |
| 29 | // Mixer/DSP always show abbreviated form, others show display_name |
| 30 | // Returns newly allocated string that must be freed |
| 31 | char *get_src_display_name_formatted(struct routing_src *src); |
| 32 | |
| 33 | // Get generic hardware name for a routing source (no device-specific names) |
| 34 | // Returns e.g. "Analogue 1", "PCM 1", "Mix A" |
| 35 | // Returns newly allocated string that must be freed |
| 36 | char *get_src_generic_name(struct routing_src *src); |
| 37 | |
| 38 | // Get formatted default name for a routing sink (ignoring custom name) |
| 39 | // If abbreviated is true, Mix/DSP use short form ("1") for routing window |
| 40 | // Returns newly allocated string that must be freed |
| 41 | char *get_snk_default_name_formatted(struct routing_snk *snk, int abbreviated); |
| 42 | |
| 43 | // Get generic hardware name for a routing sink (no device-specific names) |
| 44 | // Returns e.g. "Analogue 1", "PCM 1", "Mixer 1" |
| 45 | // Returns newly allocated string that must be freed |
| 46 | char *get_snk_generic_name(struct routing_snk *snk); |
| 47 | |
| 48 | // Get formatted display name for a routing sink (for UI display) |
| 49 | // Mix/DSP sinks use abbreviated form ("1"), others use display_name |
| 50 | // Returns newly allocated string that must be freed |
| 51 | char *get_snk_display_name_formatted(struct routing_snk *snk); |
| 52 | |
| 53 | // Get mixer output label for mixer window (returns "Mix A" for defaults) |
| 54 | // Returns newly allocated string that must be freed |
| 55 | char *get_mixer_output_label_for_mixer_window(struct routing_src *src); |
| 56 | |
| 57 | // Free custom name callback data for simulated elements |
| 58 | // Called from card_destroy_callback |
| 59 | void custom_names_free_callback_data(void *data); |