1 /* Copyright (c) 2012 The Chromium OS Authors. All rights reserved. 2 * Use of this source code is governed by a BSD-style license that can be 3 * found in the LICENSE file. 4 */ 5 6 #ifndef _CRAS_ALSA_CARD_H 7 #define _CRAS_ALSA_CARD_H 8 9 #include "cras_types.h" 10 11 /* cras_alsa_card represents an alsa sound card. It adds all the devices for 12 * this card to the system when it is created, and removes them when it is 13 * destroyed. It will create an alsa_mixer object that can control the volume 14 * and mute settings for the card. 15 */ 16 17 struct cras_alsa_card; 18 struct cras_device_blocklist; 19 20 /* Creates a cras_alsa_card instance for the given alsa device. Enumerates the 21 * devices for the card and adds them to the system as possible playback or 22 * capture endpoints. 23 * Args: 24 * card_info - Contains the card index, type, and priority. 25 * device_config_dir - The directory of device configs which contains the 26 * volume curves. 27 * blocklist - List of devices that should be ignored. 28 * ucm_suffix - The ucm config name is formed as <card-name>.<suffix> 29 * Returns: 30 * A pointer to the newly created cras_alsa_card which must later be freed 31 * by calling cras_alsa_card_destroy or NULL on error. 32 */ 33 struct cras_alsa_card *cras_alsa_card_create( 34 struct cras_alsa_card_info *info, const char *device_config_dir, 35 struct cras_device_blocklist *blocklist, const char *ucm_suffix); 36 37 /* Destroys a cras_alsa_card that was returned from cras_alsa_card_create. 38 * Args: 39 * alsa_card - The cras_alsa_card pointer returned from 40 * cras_alsa_card_create. 41 */ 42 void cras_alsa_card_destroy(struct cras_alsa_card *alsa_card); 43 44 /* Returns the alsa card index for the given card. 45 * Args: 46 * alsa_card - The cras_alsa_card pointer returned from 47 * cras_alsa_card_create. 48 */ 49 size_t cras_alsa_card_get_index(const struct cras_alsa_card *alsa_card); 50 51 #endif /* _CRAS_ALSA_CARD_H */ 52