ALSA project - the C library reference
/usr/src/RPM/BUILD/libalsa-1.0.27/include/use-case.h
Go to the documentation of this file.
00001 
00010 /*
00011  *
00012  *  This library is free software; you can redistribute it and/or modify
00013  *  it under the terms of the GNU Lesser General Public License as
00014  *  published by the Free Software Foundation; either version 2.1 of
00015  *  the License, or (at your option) any later version.
00016  *
00017  *  This program is distributed in the hope that it will be useful,
00018  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  *  GNU Lesser General Public License for more details.
00021  *
00022  *  You should have received a copy of the GNU Lesser General Public
00023  *  License along with this library; if not, write to the Free Software
00024  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00025  *
00026  *  Copyright (C) 2008-2010 SlimLogic Ltd
00027  *  Copyright (C) 2010 Wolfson Microelectronics PLC
00028  *  Copyright (C) 2010 Texas Instruments Inc.
00029  *
00030  *  Support for the verb/device/modifier core logic and API,
00031  *  command line tool and file parser was kindly sponsored by
00032  *  Texas Instruments Inc.
00033  *  Support for multiple active modifiers and devices,
00034  *  transition sequences, multiple client access and user defined use
00035  *  cases was kindly sponsored by Wolfson Microelectronics PLC.
00036  */
00037 
00038 #ifndef __ALSA_USE_CASE_H
00039 #define __ALSA_USE_CASE_H
00040 
00041 #ifdef __cplusplus
00042 extern "C" {
00043 #endif
00044 
00093 /*
00094  * Use Case Verb.
00095  *
00096  * The use case verb is the main device audio action. e.g. the "HiFi" use
00097  * case verb will configure the audio hardware for HiFi Music playback
00098  * and capture.
00099  */
00100 #define SND_USE_CASE_VERB_INACTIVE              "Inactive"              
00101 #define SND_USE_CASE_VERB_HIFI                  "HiFi"                  
00102 #define SND_USE_CASE_VERB_HIFI_LOW_POWER        "HiFi Low Power"        
00103 #define SND_USE_CASE_VERB_VOICE                 "Voice"                 
00104 #define SND_USE_CASE_VERB_VOICE_LOW_POWER       "Voice Low Power"       
00105 #define SND_USE_CASE_VERB_VOICECALL             "Voice Call"            
00106 #define SND_USE_CASE_VERB_IP_VOICECALL          "Voice Call IP"         
00107 #define SND_USE_CASE_VERB_ANALOG_RADIO          "FM Analog Radio"       
00108 #define SND_USE_CASE_VERB_DIGITAL_RADIO         "FM Digital Radio"      
00109 /* add new verbs to end of list */
00110 
00111 
00112 /*
00113  * Use Case Device.
00114  *
00115  * Physical system devices the render and capture audio. Devices can be OR'ed
00116  * together to support audio on simultaneous devices.
00117  */
00118 #define SND_USE_CASE_DEV_NONE           "None"          
00119 #define SND_USE_CASE_DEV_SPEAKER        "Speaker"       
00120 #define SND_USE_CASE_DEV_LINE           "Line"          
00121 #define SND_USE_CASE_DEV_HEADPHONES     "Headphones"    
00122 #define SND_USE_CASE_DEV_HEADSET        "Headset"       
00123 #define SND_USE_CASE_DEV_HANDSET        "Handset"       
00124 #define SND_USE_CASE_DEV_BLUETOOTH      "Bluetooth"     
00125 #define SND_USE_CASE_DEV_EARPIECE       "Earpiece"      
00126 #define SND_USE_CASE_DEV_SPDIF          "SPDIF"         
00127 #define SND_USE_CASE_DEV_HDMI           "HDMI"          
00128 /* add new devices to end of list */
00129 
00130 
00131 /*
00132  * Use Case Modifiers.
00133  *
00134  * The use case modifier allows runtime configuration changes to deal with
00135  * asynchronous events.
00136  *
00137  * e.g. to record a voice call :-
00138  *  1. Set verb to SND_USE_CASE_VERB_VOICECALL (for voice call)
00139  *  2. Set modifier SND_USE_CASE_MOD_CAPTURE_VOICE when capture required.
00140  *  3. Call snd_use_case_get("CapturePCM") to get ALSA source PCM name
00141  *     with captured voice pcm data.
00142  *
00143  * e.g. to play a ring tone when listenin to MP3 Music :-
00144  *  1. Set verb to SND_USE_CASE_VERB_HIFI (for MP3 playback)
00145  *  2. Set modifier to SND_USE_CASE_MOD_PLAY_TONE when incoming call happens.
00146  *  3. Call snd_use_case_get("PlaybackPCM") to get ALSA PCM sink name for
00147  *     ringtone pcm data.
00148  */
00149 #define SND_USE_CASE_MOD_CAPTURE_VOICE          "Capture Voice"         
00150 #define SND_USE_CASE_MOD_CAPTURE_MUSIC          "Capture Music"         
00151 #define SND_USE_CASE_MOD_PLAY_MUSIC             "Play Music"            
00152 #define SND_USE_CASE_MOD_PLAY_VOICE             "Play Voice"            
00153 #define SND_USE_CASE_MOD_PLAY_TONE              "Play Tone"             
00154 #define SND_USE_CASE_MOD_ECHO_REF               "Echo Reference"        
00155 /* add new modifiers to end of list */
00156 
00157 
00166 #define SND_USE_CASE_TQ_MUSIC           "Music"         
00167 #define SND_USE_CASE_TQ_VOICE           "Voice"         
00168 #define SND_USE_CASE_TQ_TONES           "Tones"         
00171 typedef struct snd_use_case_mgr snd_use_case_mgr_t;
00172 
00179 char *snd_use_case_identifier(const char *fmt, ...);
00180 
00187 int snd_use_case_free_list(const char *list[], int items);
00188 
00215 int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
00216                           const char *identifier,
00217                           const char **list[]);
00218 
00219 
00273 int snd_use_case_get(snd_use_case_mgr_t *uc_mgr,
00274                      const char *identifier,
00275                      const char **value);
00276 
00288 int snd_use_case_geti(snd_use_case_mgr_t *uc_mgr,
00289                       const char *identifier,
00290                       long *value);
00291 
00314 int snd_use_case_set(snd_use_case_mgr_t *uc_mgr,
00315                      const char *identifier,
00316                      const char *value);
00317 
00324 int snd_use_case_mgr_open(snd_use_case_mgr_t **uc_mgr, const char *card_name);
00325 
00326 
00332 int snd_use_case_mgr_reload(snd_use_case_mgr_t *uc_mgr);
00333 
00339 int snd_use_case_mgr_close(snd_use_case_mgr_t *uc_mgr);
00340 
00346 int snd_use_case_mgr_reset(snd_use_case_mgr_t *uc_mgr);
00347 
00348 /*
00349  * helper functions
00350  */
00351 
00357 static __inline__ int snd_use_case_card_list(const char **list[])
00358 {
00359         return snd_use_case_get_list(NULL, NULL, list);
00360 }
00361 
00368 static __inline__ int snd_use_case_verb_list(snd_use_case_mgr_t *uc_mgr,
00369                                          const char **list[])
00370 {
00371         return snd_use_case_get_list(uc_mgr, "_verbs", list);
00372 }
00373 
00378 #ifdef __cplusplus
00379 }
00380 #endif
00381 
00382 #endif /* __ALSA_USE_CASE_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines