blob: 8992f937df17774a9e1a4a6d08caddd1aea99122 [file] [log] [blame]
jpadmanafaca05e2013-06-04 16:03:29 +05301/*
2 * Copyright (C) 2013 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#include <hardware/audio.h>
18#include <hardware/audio_effect.h>
19namespace android {
20enum {
21 SUB_FX_HOST, // Index of HOST in the descriptor and handle arrays
22 // of the Proxy context
23 SUB_FX_OFFLOAD, // Index of OFFLOAD in the descriptor and handle arrays
24 // of the Proxy context
25 SUB_FX_COUNT // The number of sub effects for a Proxy(1 HW, 1 SW)
26};
27#if __cplusplus
28extern "C" {
29#endif
30
31int EffectProxyCreate(const effect_uuid_t *uuid,
32 int32_t sessionId,
33 int32_t ioId,
34 effect_handle_t *pHandle);
35int EffectProxyRelease(effect_handle_t handle);
36int EffectProxyGetDescriptor(const effect_uuid_t *uuid,
37 effect_descriptor_t *pDescriptor);
38/* Effect Control Interface Implementation: Process */
39int Effect_process(effect_handle_t self,
40 audio_buffer_t *inBuffer,
41 audio_buffer_t *outBuffer);
42
43/* Effect Control Interface Implementation: Command */
44int Effect_command(effect_handle_t self,
45 uint32_t cmdCode,
46 uint32_t cmdSize,
47 void *pCmdData,
48 uint32_t *replySize,
49 void *pReplyData);
50int Effect_getDescriptor(effect_handle_t self,
51 effect_descriptor_t *pDescriptor);
52
53const struct effect_interface_s gEffectInterface = {
54 Effect_process,
55 Effect_command,
56 Effect_getDescriptor,
57 NULL,
58};
59
60struct EffectContext {
61 const struct effect_interface_s *common_itfe; // Holds the itfe of the Proxy
62 effect_descriptor_t* desc; // Points to the sub effect descriptors
63 effect_handle_t eHandle[SUB_FX_COUNT]; // The effect handles of the sub effects
64 int index; // The index that is currently active - HOST or OFFLOAD
65 int32_t sessionId; // The sessiond in which the effect is created.
66 // Stored in context to pass on to sub effect creation
67 int32_t ioId; // The ioId in which the effect is created.
68 // Stored in context to pass on to sub effect creation
69 effect_uuid_t uuid; // UUID of the Proxy
70};
71
72#if __cplusplus
73} // extern "C"
74#endif
75} //namespace android