ALSA project - the C library reference
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
use-case.h
Go to the documentation of this file.
1 
10 /*
11  *
12  * This library is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU Lesser General Public License as
14  * published by the Free Software Foundation; either version 2.1 of
15  * the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with this library; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25  *
26  * Copyright (C) 2008-2010 SlimLogic Ltd
27  * Copyright (C) 2010 Wolfson Microelectronics PLC
28  * Copyright (C) 2010 Texas Instruments Inc.
29  *
30  * Support for the verb/device/modifier core logic and API,
31  * command line tool and file parser was kindly sponsored by
32  * Texas Instruments Inc.
33  * Support for multiple active modifiers and devices,
34  * transition sequences, multiple client access and user defined use
35  * cases was kindly sponsored by Wolfson Microelectronics PLC.
36  */
37 
38 #ifndef __ALSA_USE_CASE_H
39 #define __ALSA_USE_CASE_H
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
92 /*
93  * Use Case Verb.
94  *
95  * The use case verb is the main device audio action. e.g. the "HiFi" use
96  * case verb will configure the audio hardware for HiFi Music playback
97  * and capture.
98  */
99 #define SND_USE_CASE_VERB_INACTIVE "Inactive"
100 #define SND_USE_CASE_VERB_HIFI "HiFi"
101 #define SND_USE_CASE_VERB_HIFI_LOW_POWER "HiFi Low Power"
102 #define SND_USE_CASE_VERB_VOICE "Voice"
103 #define SND_USE_CASE_VERB_VOICE_LOW_POWER "Voice Low Power"
104 #define SND_USE_CASE_VERB_VOICECALL "Voice Call"
105 #define SND_USE_CASE_VERB_IP_VOICECALL "Voice Call IP"
106 #define SND_USE_CASE_VERB_ANALOG_RADIO "FM Analog Radio"
107 #define SND_USE_CASE_VERB_DIGITAL_RADIO "FM Digital Radio"
108 /* add new verbs to end of list */
109 
110 
111 /*
112  * Use Case Device.
113  *
114  * Physical system devices the render and capture audio. Devices can be OR'ed
115  * together to support audio on simultaneous devices.
116  */
117 #define SND_USE_CASE_DEV_NONE "None"
118 #define SND_USE_CASE_DEV_SPEAKER "Speaker"
119 #define SND_USE_CASE_DEV_LINE "Line"
120 #define SND_USE_CASE_DEV_HEADPHONES "Headphones"
121 #define SND_USE_CASE_DEV_HEADSET "Headset"
122 #define SND_USE_CASE_DEV_HANDSET "Handset"
123 #define SND_USE_CASE_DEV_BLUETOOTH "Bluetooth"
124 #define SND_USE_CASE_DEV_EARPIECE "Earpiece"
125 #define SND_USE_CASE_DEV_SPDIF "SPDIF"
126 #define SND_USE_CASE_DEV_HDMI "HDMI"
127 /* add new devices to end of list */
128 
129 
130 /*
131  * Use Case Modifiers.
132  *
133  * The use case modifier allows runtime configuration changes to deal with
134  * asynchronous events.
135  *
136  * e.g. to record a voice call :-
137  * 1. Set verb to SND_USE_CASE_VERB_VOICECALL (for voice call)
138  * 2. Set modifier SND_USE_CASE_MOD_CAPTURE_VOICE when capture required.
139  * 3. Call snd_use_case_get("CapturePCM") to get ALSA source PCM name
140  * with captured voice pcm data.
141  *
142  * e.g. to play a ring tone when listenin to MP3 Music :-
143  * 1. Set verb to SND_USE_CASE_VERB_HIFI (for MP3 playback)
144  * 2. Set modifier to SND_USE_CASE_MOD_PLAY_TONE when incoming call happens.
145  * 3. Call snd_use_case_get("PlaybackPCM") to get ALSA PCM sink name for
146  * ringtone pcm data.
147  */
148 #define SND_USE_CASE_MOD_CAPTURE_VOICE "Capture Voice"
149 #define SND_USE_CASE_MOD_CAPTURE_MUSIC "Capture Music"
150 #define SND_USE_CASE_MOD_PLAY_MUSIC "Play Music"
151 #define SND_USE_CASE_MOD_PLAY_VOICE "Play Voice"
152 #define SND_USE_CASE_MOD_PLAY_TONE "Play Tone"
153 #define SND_USE_CASE_MOD_ECHO_REF "Echo Reference"
154 /* add new modifiers to end of list */
155 
156 
165 #define SND_USE_CASE_TQ_MUSIC "Music"
166 #define SND_USE_CASE_TQ_VOICE "Voice"
167 #define SND_USE_CASE_TQ_TONES "Tones"
168 
170 typedef struct snd_use_case_mgr snd_use_case_mgr_t;
171 
178 char *snd_use_case_identifier(const char *fmt, ...);
179 
186 int snd_use_case_free_list(const char *list[], int items);
187 
214 int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
215  const char *identifier,
216  const char **list[]);
217 
218 
272 int snd_use_case_get(snd_use_case_mgr_t *uc_mgr,
273  const char *identifier,
274  const char **value);
275 
287 int snd_use_case_geti(snd_use_case_mgr_t *uc_mgr,
288  const char *identifier,
289  long *value);
290 
313 int snd_use_case_set(snd_use_case_mgr_t *uc_mgr,
314  const char *identifier,
315  const char *value);
316 
323 int snd_use_case_mgr_open(snd_use_case_mgr_t **uc_mgr, const char *card_name);
324 
325 
331 int snd_use_case_mgr_reload(snd_use_case_mgr_t *uc_mgr);
332 
338 int snd_use_case_mgr_close(snd_use_case_mgr_t *uc_mgr);
339 
345 int snd_use_case_mgr_reset(snd_use_case_mgr_t *uc_mgr);
346 
347 /*
348  * helper functions
349  */
350 
356 static inline int snd_use_case_card_list(const char **list[])
357 {
358  return snd_use_case_get_list(NULL, NULL, list);
359 }
360 
367 static inline int snd_use_case_verb_list(snd_use_case_mgr_t *uc_mgr,
368  const char **list[])
369 {
370  return snd_use_case_get_list(uc_mgr, "_verbs", list);
371 }
372 
377 #ifdef __cplusplus
378 }
379 #endif
380 
381 #endif /* __ALSA_USE_CASE_H */

Generated for ALSA project - the C library reference by doxygen 1.8.1.2