voice.h revision 75a2e1d2119c21c043362d53208f4c46d8c556a6
14b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava/* 24b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava * Copyright (C) 2014 The Android Open Source Project 34b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava * 44b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava * Licensed under the Apache License, Version 2.0 (the "License"); 54b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava * you may not use this file except in compliance with the License. 64b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava * You may obtain a copy of the License at 74b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava * 84b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava * http://www.apache.org/licenses/LICENSE-2.0 94b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava * 104b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava * Unless required by applicable law or agreed to in writing, software 114b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava * distributed under the License is distributed on an "AS IS" BASIS, 124b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 134b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava * See the License for the specific language governing permissions and 144b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava * limitations under the License. 154b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava */ 164b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava 174b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava#ifndef VOICE_H 184b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava#define VOICE_H 194b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava 204b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava#define BASE_SESS_IDX 0 214b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava#define VOICE_SESS_IDX (BASE_SESS_IDX) 224b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava 234b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava#ifdef MULTI_VOICE_SESSION_ENABLED 244b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava#define MAX_VOICE_SESSIONS 5 254b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava#else 264b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava#define MAX_VOICE_SESSIONS 1 274b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava#endif 284b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava 294b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava#define BASE_CALL_STATE 1 304b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava#define CALL_INACTIVE (BASE_CALL_STATE) 314b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava#define CALL_ACTIVE (BASE_CALL_STATE + 1) 324b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava 334b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava#define VOICE_VSID 0x10C01000 344b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava 354b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava#define AUDIO_PARAMETER_KEY_INCALLMUSIC "incall_music_enabled" 364b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava#define AUDIO_PARAMETER_VALUE_TRUE "true" 374b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava 384b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastavastruct audio_device; 394b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastavastruct str_parms; 404b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastavastruct stream_in; 414b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastavastruct stream_out; 4208dbcfc116e62f5b4007cade7311430ea235a09eRavi Kumar Alamandatypedef int audio_usecase_t; 434b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava 444b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastavastruct call_state { 454b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava int current; 464b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava int new; 474b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava}; 484b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava 494b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastavastruct voice_session { 504b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava struct pcm *pcm_rx; 514b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava struct pcm *pcm_tx; 524b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava struct call_state state; 534b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava uint32_t vsid; 544b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava}; 554b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava 564b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastavastruct voice { 574b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava struct voice_session session[MAX_VOICE_SESSIONS]; 584b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava int tty_mode; 599d0d3f1537b5d157a2c31e0744303524b846446eEric Laurent bool hac; 604b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava bool mic_mute; 614b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava float volume; 62f1819247a21f755757a28ea313678faff73ef349Ravi Kumar Alamanda bool in_call; 634b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava}; 644b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava 654b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastavaenum { 664b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava INCALL_REC_NONE = -1, 674b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava INCALL_REC_UPLINK, 684b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava INCALL_REC_DOWNLINK, 694b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava INCALL_REC_UPLINK_AND_DOWNLINK, 704b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava}; 714b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava 7275a2e1d2119c21c043362d53208f4c46d8c556a6Eric Laurentint voice_start_usecase(struct audio_device *adev, audio_usecase_t usecase_id); 7308dbcfc116e62f5b4007cade7311430ea235a09eRavi Kumar Alamandaint voice_stop_usecase(struct audio_device *adev, audio_usecase_t usecase_id); 7408dbcfc116e62f5b4007cade7311430ea235a09eRavi Kumar Alamanda 7575a2e1d2119c21c043362d53208f4c46d8c556a6Eric Laurentint voice_start_call(struct audio_device *adev); 764b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastavaint voice_stop_call(struct audio_device *adev); 774b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastavaint voice_set_parameters(struct audio_device *adev, struct str_parms *parms); 784b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastavavoid voice_get_parameters(struct audio_device *adev, struct str_parms *query, 794b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava struct str_parms *reply); 804b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastavavoid voice_init(struct audio_device *adev); 814b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastavabool voice_is_in_call(struct audio_device *adev); 824b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastavabool voice_is_in_call_rec_stream(struct stream_in *in); 834b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastavaint voice_set_mic_mute(struct audio_device *dev, bool state); 844b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastavabool voice_get_mic_mute(struct audio_device *dev); 854b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastavaint voice_set_volume(struct audio_device *adev, float volume); 864b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastavaint voice_check_and_set_incall_rec_usecase(struct audio_device *adev, 874b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava struct stream_in *in); 884b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastavaint voice_check_and_set_incall_music_usecase(struct audio_device *adev, 894b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava struct stream_out *out); 904b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastavaint voice_check_and_stop_incall_rec_usecase(struct audio_device *adev, 914b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava struct stream_in *in); 924b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastavavoid voice_update_devices_for_all_voice_usecases(struct audio_device *adev); 934b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava#endif //VOICE_H 94