|
Packit |
4a16fb |
/**
|
|
Packit |
4a16fb |
* \file include/use-case.h
|
|
Packit |
4a16fb |
* \brief use case interface for the ALSA driver
|
|
Packit |
4a16fb |
* \author Liam Girdwood <lrg@slimlogic.co.uk>
|
|
Packit |
4a16fb |
* \author Stefan Schmidt <stefan@slimlogic.co.uk>
|
|
Packit |
4a16fb |
* \author Jaroslav Kysela <perex@perex.cz>
|
|
Packit |
4a16fb |
* \author Justin Xu <justinx@slimlogic.co.uk>
|
|
Packit |
4a16fb |
* \date 2008-2010
|
|
Packit |
4a16fb |
*/
|
|
Packit |
4a16fb |
/*
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* This library is free software; you can redistribute it and/or modify
|
|
Packit |
4a16fb |
* it under the terms of the GNU Lesser General Public License as
|
|
Packit |
4a16fb |
* published by the Free Software Foundation; either version 2.1 of
|
|
Packit |
4a16fb |
* the License, or (at your option) any later version.
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* This program is distributed in the hope that it will be useful,
|
|
Packit |
4a16fb |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
4a16fb |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit |
4a16fb |
* GNU Lesser General Public License for more details.
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit |
4a16fb |
* License along with this library; if not, write to the Free Software
|
|
Packit |
4a16fb |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* Copyright (C) 2008-2010 SlimLogic Ltd
|
|
Packit |
4a16fb |
* Copyright (C) 2010 Wolfson Microelectronics PLC
|
|
Packit |
4a16fb |
* Copyright (C) 2010 Texas Instruments Inc.
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* Support for the verb/device/modifier core logic and API,
|
|
Packit |
4a16fb |
* command line tool and file parser was kindly sponsored by
|
|
Packit |
4a16fb |
* Texas Instruments Inc.
|
|
Packit |
4a16fb |
* Support for multiple active modifiers and devices,
|
|
Packit |
4a16fb |
* transition sequences, multiple client access and user defined use
|
|
Packit |
4a16fb |
* cases was kindly sponsored by Wolfson Microelectronics PLC.
|
|
Packit |
4a16fb |
*/
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
#ifndef __ALSA_USE_CASE_H
|
|
Packit |
4a16fb |
#define __ALSA_USE_CASE_H
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
#ifdef __cplusplus
|
|
Packit |
4a16fb |
extern "C" {
|
|
Packit |
4a16fb |
#endif
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
#include <alsa/asoundlib.h>
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
/**
|
|
Packit |
4a16fb |
* \defgroup ucm Use Case Interface
|
|
Packit |
4a16fb |
* The ALSA Use Case manager interface.
|
|
Packit |
4a16fb |
* See \ref Usecase page for more details.
|
|
Packit |
4a16fb |
* \{
|
|
Packit |
4a16fb |
*/
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
/*! \page Usecase ALSA Use Case Interface
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* The use case manager works by configuring the sound card ALSA kcontrols to
|
|
Packit |
4a16fb |
* change the hardware digital and analog audio routing to match the requested
|
|
Packit |
4a16fb |
* device use case. The use case manager kcontrol configurations are stored in
|
|
Packit |
4a16fb |
* easy to modify text files.
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* An audio use case can be defined by a verb and device parameter. The verb
|
|
Packit |
4a16fb |
* describes the use case action i.e. a phone call, listening to music, recording
|
|
Packit |
4a16fb |
* a conversation etc. The device describes the physical audio capture and playback
|
|
Packit |
4a16fb |
* hardware i.e. headphones, phone handset, bluetooth headset, etc.
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* It's intended clients will mostly only need to set the use case verb and
|
|
Packit |
4a16fb |
* device for each system use case change (as the verb and device parameters
|
|
Packit |
4a16fb |
* cover most audio use cases).
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* However there are times when a use case has to be modified at runtime. e.g.
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* + Incoming phone call when the device is playing music
|
|
Packit |
4a16fb |
* + Recording sections of a phone call
|
|
Packit |
4a16fb |
* + Playing tones during a call.
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* In order to allow asynchronous runtime use case adaptations, we have a third
|
|
Packit |
4a16fb |
* optional modifier parameter that can be used to further configure
|
|
Packit |
4a16fb |
* the use case during live audio runtime.
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* This interface allows clients to :-
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* + Query the supported use case verbs, devices and modifiers for the machine.
|
|
Packit |
4a16fb |
* + Set and Get use case verbs, devices and modifiers for the machine.
|
|
Packit |
4a16fb |
* + Get the ALSA PCM playback and capture device PCMs for use case verb,
|
|
Packit |
4a16fb |
* use case device and modifier.
|
|
Packit |
4a16fb |
* + Get the TQ parameter for each use case verb, use case device and
|
|
Packit |
4a16fb |
* modifier.
|
|
Packit |
4a16fb |
* + Get the ALSA master playback and capture volume/switch kcontrols
|
|
Packit |
4a16fb |
* or mixer elements for each use case.
|
|
Packit |
4a16fb |
*/
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
/*
|
|
Packit |
4a16fb |
* Use Case Verb.
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* The use case verb is the main device audio action. e.g. the "HiFi" use
|
|
Packit |
4a16fb |
* case verb will configure the audio hardware for HiFi Music playback
|
|
Packit |
4a16fb |
* and capture.
|
|
Packit |
4a16fb |
*/
|
|
Packit |
4a16fb |
#define SND_USE_CASE_VERB_INACTIVE "Inactive" /**< Inactive Verb */
|
|
Packit |
4a16fb |
#define SND_USE_CASE_VERB_HIFI "HiFi" /**< HiFi Verb */
|
|
Packit |
4a16fb |
#define SND_USE_CASE_VERB_HIFI_LOW_POWER "HiFi Low Power" /**< HiFi Low Power Verb */
|
|
Packit |
4a16fb |
#define SND_USE_CASE_VERB_VOICE "Voice" /**< Voice Verb */
|
|
Packit |
4a16fb |
#define SND_USE_CASE_VERB_VOICE_LOW_POWER "Voice Low Power" /**< Voice Low Power Verb */
|
|
Packit |
4a16fb |
#define SND_USE_CASE_VERB_VOICECALL "Voice Call" /**< Voice Call Verb */
|
|
Packit |
4a16fb |
#define SND_USE_CASE_VERB_IP_VOICECALL "Voice Call IP" /**< Voice Call IP Verb */
|
|
Packit |
4a16fb |
#define SND_USE_CASE_VERB_ANALOG_RADIO "FM Analog Radio" /**< FM Analog Radio Verb */
|
|
Packit |
4a16fb |
#define SND_USE_CASE_VERB_DIGITAL_RADIO "FM Digital Radio" /**< FM Digital Radio Verb */
|
|
Packit |
4a16fb |
/* add new verbs to end of list */
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
/*
|
|
Packit |
4a16fb |
* Use Case Device.
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* Physical system devices the render and capture audio. Devices can be OR'ed
|
|
Packit |
4a16fb |
* together to support audio on simultaneous devices.
|
|
Packit |
4a16fb |
*/
|
|
Packit |
4a16fb |
#define SND_USE_CASE_DEV_NONE "None" /**< None Device */
|
|
Packit |
4a16fb |
#define SND_USE_CASE_DEV_SPEAKER "Speaker" /**< Speaker Device */
|
|
Packit |
4a16fb |
#define SND_USE_CASE_DEV_LINE "Line" /**< Line Device */
|
|
Packit |
4a16fb |
#define SND_USE_CASE_DEV_HEADPHONES "Headphones" /**< Headphones Device */
|
|
Packit |
4a16fb |
#define SND_USE_CASE_DEV_HEADSET "Headset" /**< Headset Device */
|
|
Packit |
4a16fb |
#define SND_USE_CASE_DEV_HANDSET "Handset" /**< Handset Device */
|
|
Packit |
4a16fb |
#define SND_USE_CASE_DEV_BLUETOOTH "Bluetooth" /**< Bluetooth Device */
|
|
Packit |
4a16fb |
#define SND_USE_CASE_DEV_EARPIECE "Earpiece" /**< Earpiece Device */
|
|
Packit |
4a16fb |
#define SND_USE_CASE_DEV_SPDIF "SPDIF" /**< SPDIF Device */
|
|
Packit |
4a16fb |
#define SND_USE_CASE_DEV_HDMI "HDMI" /**< HDMI Device */
|
|
Packit |
4a16fb |
/* add new devices to end of list */
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
/*
|
|
Packit |
4a16fb |
* Use Case Modifiers.
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* The use case modifier allows runtime configuration changes to deal with
|
|
Packit |
4a16fb |
* asynchronous events.
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* e.g. to record a voice call :-
|
|
Packit |
4a16fb |
* 1. Set verb to SND_USE_CASE_VERB_VOICECALL (for voice call)
|
|
Packit |
4a16fb |
* 2. Set modifier SND_USE_CASE_MOD_CAPTURE_VOICE when capture required.
|
|
Packit |
4a16fb |
* 3. Call snd_use_case_get("CapturePCM") to get ALSA source PCM name
|
|
Packit |
4a16fb |
* with captured voice pcm data.
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* e.g. to play a ring tone when listenin to MP3 Music :-
|
|
Packit |
4a16fb |
* 1. Set verb to SND_USE_CASE_VERB_HIFI (for MP3 playback)
|
|
Packit |
4a16fb |
* 2. Set modifier to SND_USE_CASE_MOD_PLAY_TONE when incoming call happens.
|
|
Packit |
4a16fb |
* 3. Call snd_use_case_get("PlaybackPCM") to get ALSA PCM sink name for
|
|
Packit |
4a16fb |
* ringtone pcm data.
|
|
Packit |
4a16fb |
*/
|
|
Packit |
4a16fb |
#define SND_USE_CASE_MOD_CAPTURE_VOICE "Capture Voice" /**< Capture Voice Modifier */
|
|
Packit |
4a16fb |
#define SND_USE_CASE_MOD_CAPTURE_MUSIC "Capture Music" /**< Capture Music Modifier */
|
|
Packit |
4a16fb |
#define SND_USE_CASE_MOD_PLAY_MUSIC "Play Music" /**< Play Music Modifier */
|
|
Packit |
4a16fb |
#define SND_USE_CASE_MOD_PLAY_VOICE "Play Voice" /**< Play Voice Modifier */
|
|
Packit |
4a16fb |
#define SND_USE_CASE_MOD_PLAY_TONE "Play Tone" /**< Play Tone Modifier */
|
|
Packit |
4a16fb |
#define SND_USE_CASE_MOD_ECHO_REF "Echo Reference" /**< Echo Reference Modifier */
|
|
Packit |
4a16fb |
/* add new modifiers to end of list */
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
/**
|
|
Packit |
4a16fb |
* TQ - Tone Quality
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* The interface allows clients to determine the audio TQ required for each
|
|
Packit |
4a16fb |
* use case verb and modifier. It's intended as an optional hint to the
|
|
Packit |
4a16fb |
* audio driver in order to lower power consumption.
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
*/
|
|
Packit |
4a16fb |
#define SND_USE_CASE_TQ_MUSIC "Music" /**< Music Tone Quality */
|
|
Packit |
4a16fb |
#define SND_USE_CASE_TQ_VOICE "Voice" /**< Voice Tone Quality */
|
|
Packit |
4a16fb |
#define SND_USE_CASE_TQ_TONES "Tones" /**< Tones Tone Quality */
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
/** use case container */
|
|
Packit |
4a16fb |
typedef struct snd_use_case_mgr snd_use_case_mgr_t;
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
/**
|
|
Packit |
4a16fb |
* \brief Create an identifier
|
|
Packit |
4a16fb |
* \param fmt Format (sprintf like)
|
|
Packit |
4a16fb |
* \param ... Optional arguments for sprintf like format
|
|
Packit |
4a16fb |
* \return Allocated string identifier or NULL on error
|
|
Packit |
4a16fb |
*/
|
|
Packit |
4a16fb |
char *snd_use_case_identifier(const char *fmt, ...);
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
/**
|
|
Packit |
4a16fb |
* \brief Free a string list
|
|
Packit |
4a16fb |
* \param list The string list to free
|
|
Packit |
4a16fb |
* \param items Count of strings
|
|
Packit |
4a16fb |
* \return Zero if success, otherwise a negative error code
|
|
Packit |
4a16fb |
*/
|
|
Packit |
4a16fb |
int snd_use_case_free_list(const char *list[], int items);
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
/**
|
|
Packit |
4a16fb |
* \brief Obtain a list of entries
|
|
Packit |
4a16fb |
* \param uc_mgr Use case manager (may be NULL - card list)
|
|
Packit |
4a16fb |
* \param identifier (may be NULL - card list)
|
|
Packit |
4a16fb |
* \param list Returned allocated list
|
|
Packit |
4a16fb |
* \return Number of list entries if success, otherwise a negative error code
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* Defined identifiers:
|
|
Packit |
4a16fb |
* - NULL - get card list
|
|
Packit |
4a16fb |
* (in pair cardname+comment)
|
|
Packit |
4a16fb |
* - _verbs - get verb list
|
|
Packit |
4a16fb |
* (in pair verb+comment)
|
|
Packit |
4a16fb |
* - _devices[/{verb}] - get list of supported devices
|
|
Packit |
4a16fb |
* (in pair device+comment)
|
|
Packit |
4a16fb |
* - _modifiers[/{verb}] - get list of supported modifiers
|
|
Packit |
4a16fb |
* (in pair modifier+comment)
|
|
Packit |
4a16fb |
* - TQ[/{verb}] - get list of TQ identifiers
|
|
Packit |
4a16fb |
* - _enadevs - get list of enabled devices
|
|
Packit |
4a16fb |
* - _enamods - get list of enabled modifiers
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* - _supporteddevs/{modifier}|{device}[/{verb}] - list of supported devices
|
|
Packit |
4a16fb |
* - _conflictingdevs/{modifier}|{device}[/{verb}] - list of conflicting devices
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* Note that at most one of the supported/conflicting devs lists has
|
|
Packit |
4a16fb |
* any entries, and when neither is present, all devices are supported.
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
*/
|
|
Packit |
4a16fb |
int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
|
|
Packit |
4a16fb |
const char *identifier,
|
|
Packit |
4a16fb |
const char **list[]);
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
/**
|
|
Packit |
4a16fb |
* \brief Get current - string
|
|
Packit |
4a16fb |
* \param uc_mgr Use case manager
|
|
Packit |
4a16fb |
* \param identifier
|
|
Packit |
4a16fb |
* \param value Value pointer
|
|
Packit |
4a16fb |
* \return Zero if success, otherwise a negative error code
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* Note: The returned string is dynamically allocated, use free() to
|
|
Packit |
4a16fb |
* deallocate this string. (Yes, the value parameter shouldn't be marked as
|
|
Packit |
4a16fb |
* "const", but it's too late to fix it, sorry about that.)
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* Known identifiers:
|
|
Packit |
4a16fb |
* - NULL - return current card
|
|
Packit |
4a16fb |
* - _verb - return current verb
|
|
Packit |
4a16fb |
* - _file - return configuration file loaded for current card
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* - [=]{NAME}[/[{modifier}|{/device}][/{verb}]]
|
|
Packit |
4a16fb |
* - value identifier {NAME}
|
|
Packit |
4a16fb |
* - Search starts at given modifier or device if any,
|
|
Packit |
4a16fb |
* else at a verb
|
|
Packit |
4a16fb |
* - Search starts at given verb if any,
|
|
Packit |
4a16fb |
* else current verb
|
|
Packit |
4a16fb |
* - Searches modifier/device, then verb, then defaults
|
|
Packit |
4a16fb |
* - Specify a leading "=" to search only the exact
|
|
Packit |
4a16fb |
* device/modifier/verb specified, and not search
|
|
Packit |
4a16fb |
* through each object in turn.
|
|
Packit |
4a16fb |
* - Examples:
|
|
Packit |
4a16fb |
* - "PlaybackPCM/Play Music"
|
|
Packit |
4a16fb |
* - "CapturePCM/SPDIF"
|
|
Packit |
4a16fb |
* - From ValueDefaults only:
|
|
Packit |
4a16fb |
* "=Variable"
|
|
Packit |
4a16fb |
* - From current active verb:
|
|
Packit |
4a16fb |
* "=Variable//"
|
|
Packit |
4a16fb |
* - From verb "Verb":
|
|
Packit |
4a16fb |
* "=Variable//Verb"
|
|
Packit |
4a16fb |
* - From "Modifier" in current active verb:
|
|
Packit |
4a16fb |
* "=Variable/Modifier/"
|
|
Packit |
4a16fb |
* - From "Modifier" in "Verb":
|
|
Packit |
4a16fb |
* "=Variable/Modifier/Verb"
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* Recommended names for values:
|
|
Packit |
4a16fb |
* - TQ
|
|
Packit |
4a16fb |
* - Tone Quality
|
|
Packit |
4a16fb |
* - PlaybackPCM
|
|
Packit |
4a16fb |
* - full PCM playback device name
|
|
Packit |
4a16fb |
* - PlaybackPCMIsDummy
|
|
Packit |
4a16fb |
* - Valid values: "yes" and "no". If set to "yes", the PCM named by the
|
|
Packit |
4a16fb |
* PlaybackPCM value is a dummy device, meaning that opening it enables
|
|
Packit |
4a16fb |
* an audio path in the hardware, but writing to the PCM device has no
|
|
Packit |
4a16fb |
* effect.
|
|
Packit |
4a16fb |
* - CapturePCM
|
|
Packit |
4a16fb |
* - full PCM capture device name
|
|
Packit |
4a16fb |
* - CapturePCMIsDummy
|
|
Packit |
4a16fb |
* - Valid values: "yes" and "no". If set to "yes", the PCM named by the
|
|
Packit |
4a16fb |
* CapturePCM value is a dummy device, meaning that opening it enables
|
|
Packit |
4a16fb |
* an audio path in the hardware, but reading from the PCM device has no
|
|
Packit |
4a16fb |
* effect.
|
|
Packit |
4a16fb |
* - PlaybackRate
|
|
Packit |
4a16fb |
* - playback device sample rate
|
|
Packit |
4a16fb |
* - PlaybackChannels
|
|
Packit |
4a16fb |
* - playback device channel count
|
|
Packit |
4a16fb |
* - PlaybackCTL
|
|
Packit |
4a16fb |
* - playback control device name
|
|
Packit |
4a16fb |
* - PlaybackVolume
|
|
Packit |
4a16fb |
* - playback control volume identifier string
|
|
Packit |
4a16fb |
* - can be parsed using snd_use_case_parse_ctl_elem_id()
|
|
Packit |
4a16fb |
* - PlaybackSwitch
|
|
Packit |
4a16fb |
* - playback control switch identifier string
|
|
Packit |
4a16fb |
* - can be parsed using snd_use_case_parse_ctl_elem_id()
|
|
Packit |
4a16fb |
* - PlaybackPriority
|
|
Packit |
4a16fb |
* - priority value (1-10000), default value is 100, higher value means lower priority
|
|
Packit |
4a16fb |
* - CaptureRate
|
|
Packit |
4a16fb |
* - capture device sample rate
|
|
Packit |
4a16fb |
* - CaptureChannels
|
|
Packit |
4a16fb |
* - capture device channel count
|
|
Packit |
4a16fb |
* - CaptureCTL
|
|
Packit |
4a16fb |
* - capture control device name
|
|
Packit |
4a16fb |
* - CaptureVolume
|
|
Packit |
4a16fb |
* - capture control volume identifier string
|
|
Packit |
4a16fb |
* - can be parsed using snd_use_case_parse_ctl_elem_id()
|
|
Packit |
4a16fb |
* - CaptureSwitch
|
|
Packit |
4a16fb |
* - capture control switch identifier string
|
|
Packit |
4a16fb |
* - can be parsed using snd_use_case_parse_ctl_elem_id()
|
|
Packit |
4a16fb |
* - CapturePriority
|
|
Packit |
4a16fb |
* - priority value (1-10000), default value is 100, higher value means lower priority
|
|
Packit |
4a16fb |
* - PlaybackMixer
|
|
Packit |
4a16fb |
* - name of playback mixer
|
|
Packit |
4a16fb |
* - PlaybackMixerElem
|
|
Packit |
4a16fb |
* - mixer element playback identifier
|
|
Packit |
4a16fb |
* - can be parsed using snd_use_case_parse_selem_id()
|
|
Packit |
4a16fb |
* - PlaybackMasterElem
|
|
Packit |
4a16fb |
* - mixer element playback identifier for the master control
|
|
Packit |
4a16fb |
* - PlaybackMasterType
|
|
Packit |
4a16fb |
* - type of the master volume control
|
|
Packit |
4a16fb |
* - Valid values: "soft" (software attenuation)
|
|
Packit |
4a16fb |
* - CaptureMixer
|
|
Packit |
4a16fb |
* - name of capture mixer
|
|
Packit |
4a16fb |
* - CaptureMixerElem
|
|
Packit |
4a16fb |
* - mixer element capture identifier
|
|
Packit |
4a16fb |
* - can be parsed using snd_use_case_parse_selem_id()
|
|
Packit |
4a16fb |
* - CaptureMasterElem
|
|
Packit |
4a16fb |
* - mixer element playback identifier for the master control
|
|
Packit |
4a16fb |
* - CaptureMasterType
|
|
Packit |
4a16fb |
* - type of the master volume control
|
|
Packit |
4a16fb |
* - Valid values: "soft" (software attenuation)
|
|
Packit |
4a16fb |
* - EDIDFile
|
|
Packit |
4a16fb |
* - Path to EDID file for HDMI devices
|
|
Packit |
4a16fb |
* - JackControl, JackDev, JackHWMute
|
|
Packit |
4a16fb |
* - Jack information for a device. The jack status can be reported via
|
|
Packit |
4a16fb |
* a kcontrol and/or via an input device. **JackControl** is the
|
|
Packit |
4a16fb |
* kcontrol name of the jack, and **JackDev** is the input device id of
|
|
Packit |
4a16fb |
* the jack (if the full input device path is /dev/input/by-id/foo, the
|
|
Packit |
4a16fb |
* JackDev value should be "foo"). UCM configuration files should
|
|
Packit |
4a16fb |
* contain both JackControl and JackDev when possible, because
|
|
Packit |
4a16fb |
* applications are likely to support only one or the other.
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* If **JackHWMute** is set, it indicates that when the jack is plugged
|
|
Packit |
4a16fb |
* in, the hardware automatically mutes some other device(s). The
|
|
Packit |
4a16fb |
* JackHWMute value is a space-separated list of device names (this
|
|
Packit |
4a16fb |
* isn't compatible with device names with spaces in them, so don't use
|
|
Packit |
4a16fb |
* such device names!). Note that JackHWMute should be used only when
|
|
Packit |
4a16fb |
* the hardware enforces the automatic muting. If the hardware doesn't
|
|
Packit |
4a16fb |
* enforce any muting, it may still be tempting to set JackHWMute to
|
|
Packit |
4a16fb |
* trick upper software layers to e.g. automatically mute speakers when
|
|
Packit |
4a16fb |
* headphones are plugged in, but that's application policy
|
|
Packit |
4a16fb |
* configuration that doesn't belong to UCM configuration files.
|
|
Packit |
4a16fb |
* - MinBufferLevel
|
|
Packit |
4a16fb |
* - This is used on platform where reported buffer level is not accurate.
|
|
Packit |
4a16fb |
* E.g. "512", which holds 512 samples in device buffer. Note: this will
|
|
Packit |
4a16fb |
* increase latency.
|
|
Packit |
4a16fb |
*/
|
|
Packit |
4a16fb |
int snd_use_case_get(snd_use_case_mgr_t *uc_mgr,
|
|
Packit |
4a16fb |
const char *identifier,
|
|
Packit |
4a16fb |
const char **value);
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
/**
|
|
Packit |
4a16fb |
* \brief Get current - integer
|
|
Packit |
4a16fb |
* \param uc_mgr Use case manager
|
|
Packit |
4a16fb |
* \param identifier
|
|
Packit |
4a16fb |
* \param value result
|
|
Packit |
4a16fb |
* \return Zero if success, otherwise a negative error code
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* Known identifiers:
|
|
Packit |
4a16fb |
* - _devstatus/{device} - return status for given device
|
|
Packit |
4a16fb |
* - _modstatus/{modifier} - return status for given modifier
|
|
Packit |
4a16fb |
*/
|
|
Packit |
4a16fb |
int snd_use_case_geti(snd_use_case_mgr_t *uc_mgr,
|
|
Packit |
4a16fb |
const char *identifier,
|
|
Packit |
4a16fb |
long *value);
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
/**
|
|
Packit |
4a16fb |
* \brief Set new
|
|
Packit |
4a16fb |
* \param uc_mgr Use case manager
|
|
Packit |
4a16fb |
* \param identifier
|
|
Packit |
4a16fb |
* \param value Value
|
|
Packit |
4a16fb |
* \return Zero if success, otherwise a negative error code
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* Known identifiers:
|
|
Packit |
4a16fb |
* - _verb - set current verb = value
|
|
Packit |
4a16fb |
* - _enadev - enable given device = value
|
|
Packit |
4a16fb |
* - _disdev - disable given device = value
|
|
Packit |
4a16fb |
* - _swdev/{old_device} - new_device = value
|
|
Packit |
4a16fb |
* - disable old_device and then enable new_device
|
|
Packit |
4a16fb |
* - if old_device is not enabled just return
|
|
Packit |
4a16fb |
* - check transmit sequence firstly
|
|
Packit |
4a16fb |
* - _enamod - enable given modifier = value
|
|
Packit |
4a16fb |
* - _dismod - disable given modifier = value
|
|
Packit |
4a16fb |
* - _swmod/{old_modifier} - new_modifier = value
|
|
Packit |
4a16fb |
* - disable old_modifier and then enable new_modifier
|
|
Packit |
4a16fb |
* - if old_modifier is not enabled just return
|
|
Packit |
4a16fb |
* - check transmit sequence firstly
|
|
Packit |
4a16fb |
*/
|
|
Packit |
4a16fb |
int snd_use_case_set(snd_use_case_mgr_t *uc_mgr,
|
|
Packit |
4a16fb |
const char *identifier,
|
|
Packit |
4a16fb |
const char *value);
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
/**
|
|
Packit |
4a16fb |
* \brief Open and initialise use case core for sound card
|
|
Packit |
4a16fb |
* \param uc_mgr Returned use case manager pointer
|
|
Packit |
4a16fb |
* \param card_name Sound card name.
|
|
Packit |
4a16fb |
* \return zero if success, otherwise a negative error code
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* By default only first card is used when the driver card
|
|
Packit |
4a16fb |
* name or long name is passed in the card_name argument.
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* The "strict:" prefix in the card_name defines that
|
|
Packit |
4a16fb |
* there is no driver name / long name matching. The straight
|
|
Packit |
4a16fb |
* configuration is used.
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* The "hw:" prefix in the card_name will load the configuration
|
|
Packit |
4a16fb |
* for the ALSA card specified by the card index (value) or
|
|
Packit |
4a16fb |
* the card string identificator.
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* The sound card might be also composed from several physical
|
|
Packit |
4a16fb |
* sound cards (for the default and strict card_name).
|
|
Packit |
4a16fb |
* The application cannot expect that the device names will refer
|
|
Packit |
4a16fb |
* only one ALSA sound card in this case.
|
|
Packit |
4a16fb |
*/
|
|
Packit |
4a16fb |
int snd_use_case_mgr_open(snd_use_case_mgr_t **uc_mgr,
|
|
Packit |
4a16fb |
const char *card_name);
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
/**
|
|
Packit |
4a16fb |
* \brief Reload and re-parse use case configuration files for sound card.
|
|
Packit |
4a16fb |
* \param uc_mgr Use case manager
|
|
Packit |
4a16fb |
* \return zero if success, otherwise a negative error code
|
|
Packit |
4a16fb |
*/
|
|
Packit |
4a16fb |
int snd_use_case_mgr_reload(snd_use_case_mgr_t *uc_mgr);
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
/**
|
|
Packit |
4a16fb |
* \brief Close use case manager
|
|
Packit |
4a16fb |
* \param uc_mgr Use case manager
|
|
Packit |
4a16fb |
* \return zero if success, otherwise a negative error code
|
|
Packit |
4a16fb |
*/
|
|
Packit |
4a16fb |
int snd_use_case_mgr_close(snd_use_case_mgr_t *uc_mgr);
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
/**
|
|
Packit |
4a16fb |
* \brief Reset use case manager verb, device, modifier to deafult settings.
|
|
Packit |
4a16fb |
* \param uc_mgr Use case manager
|
|
Packit |
4a16fb |
* \return zero if success, otherwise a negative error code
|
|
Packit |
4a16fb |
*/
|
|
Packit |
4a16fb |
int snd_use_case_mgr_reset(snd_use_case_mgr_t *uc_mgr);
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
/*
|
|
Packit |
4a16fb |
* helper functions
|
|
Packit |
4a16fb |
*/
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
/**
|
|
Packit |
4a16fb |
* \brief Obtain a list of cards
|
|
Packit |
4a16fb |
* \param list Returned allocated list
|
|
Packit |
4a16fb |
* \return Number of list entries if success, otherwise a negative error code
|
|
Packit |
4a16fb |
*/
|
|
Packit |
4a16fb |
static __inline__ int snd_use_case_card_list(const char **list[])
|
|
Packit |
4a16fb |
{
|
|
Packit |
4a16fb |
return snd_use_case_get_list(NULL, NULL, list);
|
|
Packit |
4a16fb |
}
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
/**
|
|
Packit |
4a16fb |
* \brief Obtain a list of verbs
|
|
Packit |
4a16fb |
* \param uc_mgr Use case manager
|
|
Packit |
4a16fb |
* \param list Returned list of verbs
|
|
Packit |
4a16fb |
* \return Number of list entries if success, otherwise a negative error code
|
|
Packit |
4a16fb |
*/
|
|
Packit |
4a16fb |
static __inline__ int snd_use_case_verb_list(snd_use_case_mgr_t *uc_mgr,
|
|
Packit |
4a16fb |
const char **list[])
|
|
Packit |
4a16fb |
{
|
|
Packit |
4a16fb |
return snd_use_case_get_list(uc_mgr, "_verbs", list);
|
|
Packit |
4a16fb |
}
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
/**
|
|
Packit |
4a16fb |
* \brief Parse control element identifier
|
|
Packit |
4a16fb |
* \param elem_id Element identifier
|
|
Packit |
4a16fb |
* \param ucm_id Use case identifier
|
|
Packit |
4a16fb |
* \param value String value to be parsed
|
|
Packit |
4a16fb |
* \return Zero if success, otherwise a negative error code
|
|
Packit |
4a16fb |
*/
|
|
Packit |
4a16fb |
int snd_use_case_parse_ctl_elem_id(snd_ctl_elem_id_t *dst,
|
|
Packit |
4a16fb |
const char *ucm_id,
|
|
Packit |
4a16fb |
const char *value);
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
/**
|
|
Packit |
4a16fb |
* \brief Parse mixer element identifier
|
|
Packit |
4a16fb |
* \param dst Simple mixer element identifier
|
|
Packit |
4a16fb |
* \param ucm_id Use case identifier
|
|
Packit |
4a16fb |
* \param value String value to be parsed
|
|
Packit |
4a16fb |
* \return Zero if success, otherwise a negative error code
|
|
Packit |
4a16fb |
*/
|
|
Packit |
4a16fb |
int snd_use_case_parse_selem_id(snd_mixer_selem_id_t *dst,
|
|
Packit |
4a16fb |
const char *ucm_id,
|
|
Packit |
4a16fb |
const char *value);
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
/**
|
|
Packit |
4a16fb |
* \}
|
|
Packit |
4a16fb |
*/
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
#ifdef __cplusplus
|
|
Packit |
4a16fb |
}
|
|
Packit |
4a16fb |
#endif
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
#endif /* __ALSA_USE_CASE_H */
|