All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
use-case.h
Go to the documentation of this file.
/*
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Copyright (C) 2008-2010 SlimLogic Ltd
* Copyright (C) 2010 Wolfson Microelectronics PLC
* Copyright (C) 2010 Texas Instruments Inc.
*
* Support for the verb/device/modifier core logic and API,
* command line tool and file parser was kindly sponsored by
* Texas Instruments Inc.
* Support for multiple active modifiers and devices,
* transition sequences, multiple client access and user defined use
* cases was kindly sponsored by Wolfson Microelectronics PLC.
*/
#ifndef __ALSA_USE_CASE_H
#define __ALSA_USE_CASE_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* Use Case Verb.
*
* The use case verb is the main device audio action. e.g. the "HiFi" use
* case verb will configure the audio hardware for HiFi Music playback
* and capture.
*/
#define SND_USE_CASE_VERB_INACTIVE "Inactive"
#define SND_USE_CASE_VERB_HIFI "HiFi"
#define SND_USE_CASE_VERB_HIFI_LOW_POWER "HiFi Low Power"
#define SND_USE_CASE_VERB_VOICE "Voice"
#define SND_USE_CASE_VERB_VOICE_LOW_POWER "Voice Low Power"
#define SND_USE_CASE_VERB_VOICECALL "Voice Call"
#define SND_USE_CASE_VERB_IP_VOICECALL "Voice Call IP"
#define SND_USE_CASE_VERB_ANALOG_RADIO "FM Analog Radio"
#define SND_USE_CASE_VERB_DIGITAL_RADIO "FM Digital Radio"
/* add new verbs to end of list */
/*
* Use Case Device.
*
* Physical system devices the render and capture audio. Devices can be OR'ed
* together to support audio on simultaneous devices.
*/
#define SND_USE_CASE_DEV_NONE "None"
#define SND_USE_CASE_DEV_SPEAKER "Speaker"
#define SND_USE_CASE_DEV_LINE "Line"
#define SND_USE_CASE_DEV_HEADPHONES "Headphones"
#define SND_USE_CASE_DEV_HEADSET "Headset"
#define SND_USE_CASE_DEV_HANDSET "Handset"
#define SND_USE_CASE_DEV_BLUETOOTH "Bluetooth"
#define SND_USE_CASE_DEV_EARPIECE "Earpiece"
#define SND_USE_CASE_DEV_SPDIF "SPDIF"
#define SND_USE_CASE_DEV_HDMI "HDMI"
/* add new devices to end of list */
/*
* Use Case Modifiers.
*
* The use case modifier allows runtime configuration changes to deal with
* asynchronous events.
*
* e.g. to record a voice call :-
* 1. Set verb to SND_USE_CASE_VERB_VOICECALL (for voice call)
* 2. Set modifier SND_USE_CASE_MOD_CAPTURE_VOICE when capture required.
* 3. Call snd_use_case_get("CapturePCM") to get ALSA source PCM name
* with captured voice pcm data.
*
* e.g. to play a ring tone when listenin to MP3 Music :-
* 1. Set verb to SND_USE_CASE_VERB_HIFI (for MP3 playback)
* 2. Set modifier to SND_USE_CASE_MOD_PLAY_TONE when incoming call happens.
* 3. Call snd_use_case_get("PlaybackPCM") to get ALSA PCM sink name for
* ringtone pcm data.
*/
#define SND_USE_CASE_MOD_CAPTURE_VOICE "Capture Voice"
#define SND_USE_CASE_MOD_CAPTURE_MUSIC "Capture Music"
#define SND_USE_CASE_MOD_PLAY_MUSIC "Play Music"
#define SND_USE_CASE_MOD_PLAY_VOICE "Play Voice"
#define SND_USE_CASE_MOD_PLAY_TONE "Play Tone"
#define SND_USE_CASE_MOD_ECHO_REF "Echo Reference"
/* add new modifiers to end of list */
#define SND_USE_CASE_TQ_MUSIC "Music"
#define SND_USE_CASE_TQ_VOICE "Voice"
#define SND_USE_CASE_TQ_TONES "Tones"
typedef struct snd_use_case_mgr snd_use_case_mgr_t;
char *snd_use_case_identifier(const char *fmt, ...);
int snd_use_case_free_list(const char *list[], int items);
int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
const char *identifier,
const char **list[]);
int snd_use_case_get(snd_use_case_mgr_t *uc_mgr,
const char *identifier,
const char **value);
int snd_use_case_geti(snd_use_case_mgr_t *uc_mgr,
const char *identifier,
long *value);
int snd_use_case_set(snd_use_case_mgr_t *uc_mgr,
const char *identifier,
const char *value);
int snd_use_case_mgr_open(snd_use_case_mgr_t **uc_mgr, const char *card_name);
int snd_use_case_mgr_reload(snd_use_case_mgr_t *uc_mgr);
int snd_use_case_mgr_close(snd_use_case_mgr_t *uc_mgr);
int snd_use_case_mgr_reset(snd_use_case_mgr_t *uc_mgr);
/*
* helper functions
*/
static __inline__ int snd_use_case_card_list(const char **list[])
{
return snd_use_case_get_list(NULL, NULL, list);
}
static __inline__ int snd_use_case_verb_list(snd_use_case_mgr_t *uc_mgr,
const char **list[])
{
return snd_use_case_get_list(uc_mgr, "_verbs", list);
}
#ifdef __cplusplus
}
#endif
#endif /* __ALSA_USE_CASE_H */
snd_use_case_identifier
char * snd_use_case_identifier(const char *fmt,...)
Create an identifier.
Definition: main.c:105
snd_use_case_free_list
int snd_use_case_free_list(const char *list[], int items)
Free a string list.
Definition: main.c:130
snd_use_case_mgr_reload
int snd_use_case_mgr_reload(snd_use_case_mgr_t *uc_mgr)
Reload and re-parse use case configuration files for sound card.
Definition: main.c:964
snd_use_case_mgr_reset
int snd_use_case_mgr_reset(snd_use_case_mgr_t *uc_mgr)
Reset use case manager verb, device, modifier to deafult settings.
Definition: main.c:1042
snd_use_case_geti
int snd_use_case_geti(snd_use_case_mgr_t *uc_mgr, const char *identifier, long *value)
Get current - integer.
Definition: main.c:1599
snd_use_case_mgr_open
int snd_use_case_mgr_open(snd_use_case_mgr_t **uc_mgr, const char *card_name)
Open and initialise use case core for sound card.
Definition: main.c:920
snd_use_case_mgr_t
struct snd_use_case_mgr snd_use_case_mgr_t
Definition: use-case.h:169
snd_use_case_set
int snd_use_case_set(snd_use_case_mgr_t *uc_mgr, const char *identifier, const char *value)
Set new.
Definition: main.c:1861
snd_use_case_mgr_close
int snd_use_case_mgr_close(snd_use_case_mgr_t *uc_mgr)
Close use case manager.
Definition: main.c:989
snd_use_case_get
int snd_use_case_get(snd_use_case_mgr_t *uc_mgr, const char *identifier, const char **value)
Get current - string.
Definition: main.c:1503
snd_use_case_get_list
int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, const char *identifier, const char **list[])
Obtain a list of entries.
Definition: main.c:1337