Vineeta Srivastava | 4b89e37 | 2014-06-19 14:21:42 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef VOICE_H |
| 18 | #define VOICE_H |
| 19 | |
| 20 | #define BASE_SESS_IDX 0 |
| 21 | #define VOICE_SESS_IDX (BASE_SESS_IDX) |
| 22 | |
| 23 | #ifdef MULTI_VOICE_SESSION_ENABLED |
| 24 | #define MAX_VOICE_SESSIONS 5 |
| 25 | #else |
| 26 | #define MAX_VOICE_SESSIONS 1 |
| 27 | #endif |
| 28 | |
| 29 | #define BASE_CALL_STATE 1 |
| 30 | #define CALL_INACTIVE (BASE_CALL_STATE) |
| 31 | #define CALL_ACTIVE (BASE_CALL_STATE + 1) |
| 32 | |
| 33 | #define VOICE_VSID 0x10C01000 |
| 34 | |
| 35 | #define AUDIO_PARAMETER_KEY_INCALLMUSIC "incall_music_enabled" |
| 36 | #define AUDIO_PARAMETER_VALUE_TRUE "true" |
| 37 | |
| 38 | struct audio_device; |
| 39 | struct str_parms; |
| 40 | struct stream_in; |
| 41 | struct stream_out; |
| 42 | |
| 43 | struct call_state { |
| 44 | int current; |
| 45 | int new; |
| 46 | }; |
| 47 | |
| 48 | struct voice_session { |
| 49 | struct pcm *pcm_rx; |
| 50 | struct pcm *pcm_tx; |
| 51 | struct call_state state; |
| 52 | uint32_t vsid; |
| 53 | }; |
| 54 | |
| 55 | struct voice { |
| 56 | struct voice_session session[MAX_VOICE_SESSIONS]; |
| 57 | int tty_mode; |
| 58 | bool mic_mute; |
| 59 | float volume; |
| 60 | bool voice_device_set; |
| 61 | }; |
| 62 | |
| 63 | enum { |
| 64 | INCALL_REC_NONE = -1, |
| 65 | INCALL_REC_UPLINK, |
| 66 | INCALL_REC_DOWNLINK, |
| 67 | INCALL_REC_UPLINK_AND_DOWNLINK, |
| 68 | }; |
| 69 | |
| 70 | int voice_start_call(struct audio_device *adev); |
| 71 | int voice_stop_call(struct audio_device *adev); |
| 72 | int voice_set_parameters(struct audio_device *adev, struct str_parms *parms); |
| 73 | void voice_get_parameters(struct audio_device *adev, struct str_parms *query, |
| 74 | struct str_parms *reply); |
| 75 | void voice_init(struct audio_device *adev); |
| 76 | bool voice_is_in_call(struct audio_device *adev); |
| 77 | bool voice_is_in_call_rec_stream(struct stream_in *in); |
| 78 | int voice_set_mic_mute(struct audio_device *dev, bool state); |
| 79 | bool voice_get_mic_mute(struct audio_device *dev); |
| 80 | int voice_set_volume(struct audio_device *adev, float volume); |
| 81 | int voice_check_and_set_incall_rec_usecase(struct audio_device *adev, |
| 82 | struct stream_in *in); |
| 83 | int voice_check_and_set_incall_music_usecase(struct audio_device *adev, |
| 84 | struct stream_out *out); |
| 85 | int voice_check_and_stop_incall_rec_usecase(struct audio_device *adev, |
| 86 | struct stream_in *in); |
| 87 | void voice_update_devices_for_all_voice_usecases(struct audio_device *adev); |
| 88 | #endif //VOICE_H |