blob: 7f8b25baa34682aacb3f32aa6bef3157d5d647e5 [file] [log] [blame]
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -07001/*
2 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
3 * Not a contribution.
4 *
5 * Copyright (C) 2013 The Android Open Source Project
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19
20#ifndef VOICE_H
21#define VOICE_H
22
23#define BASE_SESS_IDX 0
24#define VOICE_SESS_IDX (BASE_SESS_IDX)
25
26#ifdef MULTI_VOICE_SESSION_ENABLED
27#define MAX_VOICE_SESSIONS 4
28#else
29#define MAX_VOICE_SESSIONS 1
30#endif
31
32#define BASE_CALL_STATE 1
33#define CALL_INACTIVE (BASE_CALL_STATE)
34#define CALL_ACTIVE (BASE_CALL_STATE + 1)
35
36#define VOICE_VSID 0x10C01000
37
38struct audio_device;
39struct str_parms;
Shiv Maliyappanahallida107642013-10-17 11:16:13 -070040struct stream_in;
Shiv Maliyappanahallif3b9a422013-10-22 16:38:08 -070041struct stream_out;
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -070042
43struct call_state {
44 int current;
45 int new;
46};
47
48struct voice_session {
49 struct pcm *pcm_rx;
50 struct pcm *pcm_tx;
51 struct call_state state;
52 uint32_t vsid;
53};
54
55struct voice {
56 struct voice_session session[MAX_VOICE_SESSIONS];
57 int tty_mode;
58 bool mic_mute;
59 float volume;
60};
61
62int voice_start_call(struct audio_device *adev);
63int voice_stop_call(struct audio_device *adev);
64int voice_set_parameters(struct audio_device *adev, struct str_parms *parms);
65void voice_init(struct audio_device *adev);
66bool voice_is_in_call(struct audio_device *adev);
67int voice_set_mic_mute(struct audio_device *dev, bool state);
68bool voice_get_mic_mute(struct audio_device *dev);
69int voice_set_volume(struct audio_device *adev, float volume);
Shiv Maliyappanahallida107642013-10-17 11:16:13 -070070int voice_check_and_set_incall_rec_usecase(struct audio_device *adev,
Shiv Maliyappanahallif3b9a422013-10-22 16:38:08 -070071 struct stream_in *in);
72int voice_check_and_set_incall_music_usecase(struct audio_device *adev,
73 struct stream_out *out);
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -070074#endif //VOICE_H