blob: 64a3212912e856960988dd510634471aefd5dcc3 [file] [log] [blame]
Eric Laurent135ad072010-05-21 06:05:13 -07001/*
2 * Copyright (C) 2010 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
Eric Laurentffe9c252010-06-23 17:38:20 -070017#ifndef ANDROID_EFFECTSFACTORYAPI_H_
18#define ANDROID_EFFECTSFACTORYAPI_H_
Eric Laurent135ad072010-05-21 06:05:13 -070019
20#include <errno.h>
21#include <stdint.h>
22#include <sys/types.h>
Eric Laurente1315cf2011-05-17 19:16:02 -070023#include <hardware/audio_effect.h>
Eric Laurent135ad072010-05-21 06:05:13 -070024
25#if __cplusplus
26extern "C" {
27#endif
28
29/////////////////////////////////////////////////
30// Effect factory interface
31/////////////////////////////////////////////////
32
33////////////////////////////////////////////////////////////////////////////////
34//
35// Function: EffectQueryNumberEffects
36//
Eric Laurentbe916aa2010-06-01 23:49:17 -070037// Description: Returns the number of different effects in all loaded libraries.
Eric Laurent135ad072010-05-21 06:05:13 -070038// Each effect must have a different effect uuid (see
Eric Laurentffe9c252010-06-23 17:38:20 -070039// effect_descriptor_t). This function together with EffectQueryEffect()
Eric Laurent135ad072010-05-21 06:05:13 -070040// is used to enumerate all effects present in all loaded libraries.
41// Each time EffectQueryNumberEffects() is called, the factory must
42// reset the index of the effect descriptor returned by next call to
Eric Laurentffe9c252010-06-23 17:38:20 -070043// EffectQueryEffect() to restart enumeration from the beginning.
Eric Laurent135ad072010-05-21 06:05:13 -070044//
45// Input/Output:
46// pNumEffects: address where the number of effects should be returned.
47//
48// Output:
49// returned value: 0 successful operation.
50// -ENODEV factory failed to initialize
51// -EINVAL invalid pNumEffects
52// *pNumEffects: updated with number of effects in factory
53//
54////////////////////////////////////////////////////////////////////////////////
Eric Laurentbe916aa2010-06-01 23:49:17 -070055int EffectQueryNumberEffects(uint32_t *pNumEffects);
Eric Laurent135ad072010-05-21 06:05:13 -070056
57////////////////////////////////////////////////////////////////////////////////
58//
Eric Laurentffe9c252010-06-23 17:38:20 -070059// Function: EffectQueryEffect
Eric Laurent135ad072010-05-21 06:05:13 -070060//
61// Description: Returns a descriptor of the next available effect.
62// See effect_descriptor_t for a details on effect descriptor.
Eric Laurentffe9c252010-06-23 17:38:20 -070063// This function together with EffectQueryNumberEffects() is used to enumerate all
Eric Laurent135ad072010-05-21 06:05:13 -070064// effects present in all loaded libraries. The enumeration sequence is:
65// EffectQueryNumberEffects(&num_effects);
Eric Laurentffe9c252010-06-23 17:38:20 -070066// for (i = 0; i < num_effects; i++)
67// EffectQueryEffect(i,...);
Eric Laurent135ad072010-05-21 06:05:13 -070068//
69// Input/Output:
70// pDescriptor: address where to return the effect descriptor.
71//
72// Output:
73// returned value: 0 successful operation.
Eric Laurentffe9c252010-06-23 17:38:20 -070074// -ENOENT no more effect available
Eric Laurent135ad072010-05-21 06:05:13 -070075// -ENODEV factory failed to initialize
76// -EINVAL invalid pDescriptor
Glenn Kasten85ab62c2012-11-01 11:11:38 -070077// -ENOSYS effect list has changed since last execution of
78// EffectQueryNumberEffects()
Eric Laurent135ad072010-05-21 06:05:13 -070079// *pDescriptor: updated with the effect descriptor.
80//
81////////////////////////////////////////////////////////////////////////////////
Eric Laurentffe9c252010-06-23 17:38:20 -070082int EffectQueryEffect(uint32_t index, effect_descriptor_t *pDescriptor);
Eric Laurent135ad072010-05-21 06:05:13 -070083
84////////////////////////////////////////////////////////////////////////////////
85//
86// Function: EffectCreate
87//
88// Description: Creates an effect engine of the specified type and returns an
89// effect control interface on this engine. The function will allocate the
90// resources for an instance of the requested effect engine and return
Glenn Kasten99e53b82012-01-19 08:59:58 -080091// a handle on the effect control interface.
Eric Laurent135ad072010-05-21 06:05:13 -070092//
93// Input:
94// pEffectUuid: pointer to the effect uuid.
Glenn Kasten85ab62c2012-11-01 11:11:38 -070095// sessionId: audio session to which this effect instance will be attached. All effects
96// created with the same session ID are connected in series and process the same signal
97// stream. Knowing that two effects are part of the same effect chain can help the
98// library implement some kind of optimizations.
99// ioId: identifies the output or input stream this effect is directed to at audio HAL.
100// For future use especially with tunneled HW accelerated effects
Eric Laurent135ad072010-05-21 06:05:13 -0700101//
102// Input/Output:
Eric Laurente1315cf2011-05-17 19:16:02 -0700103// pHandle: address where to return the effect handle.
Eric Laurent135ad072010-05-21 06:05:13 -0700104//
105// Output:
106// returned value: 0 successful operation.
107// -ENODEV factory failed to initialize
Eric Laurente1315cf2011-05-17 19:16:02 -0700108// -EINVAL invalid pEffectUuid or pHandle
Eric Laurentbe916aa2010-06-01 23:49:17 -0700109// -ENOENT no effect with this uuid found
Eric Laurente1315cf2011-05-17 19:16:02 -0700110// *pHandle: updated with the effect handle.
Eric Laurent135ad072010-05-21 06:05:13 -0700111//
112////////////////////////////////////////////////////////////////////////////////
Glenn Kasten85ab62c2012-11-01 11:11:38 -0700113int EffectCreate(const effect_uuid_t *pEffectUuid, int32_t sessionId, int32_t ioId,
114 effect_handle_t *pHandle);
Eric Laurent135ad072010-05-21 06:05:13 -0700115
116////////////////////////////////////////////////////////////////////////////////
117//
118// Function: EffectRelease
119//
Glenn Kasten99e53b82012-01-19 08:59:58 -0800120// Description: Releases the effect engine whose handle is given as argument.
Eric Laurent135ad072010-05-21 06:05:13 -0700121// All resources allocated to this particular instance of the effect are
122// released.
123//
124// Input:
Glenn Kasten99e53b82012-01-19 08:59:58 -0800125// handle: handle on the effect interface to be released.
Eric Laurent135ad072010-05-21 06:05:13 -0700126//
127// Output:
128// returned value: 0 successful operation.
129// -ENODEV factory failed to initialize
Glenn Kasten99e53b82012-01-19 08:59:58 -0800130// -EINVAL invalid interface handle
Eric Laurent135ad072010-05-21 06:05:13 -0700131//
132////////////////////////////////////////////////////////////////////////////////
Eric Laurente1315cf2011-05-17 19:16:02 -0700133int EffectRelease(effect_handle_t handle);
Eric Laurent135ad072010-05-21 06:05:13 -0700134
135////////////////////////////////////////////////////////////////////////////////
136//
Eric Laurent135ad072010-05-21 06:05:13 -0700137// Function: EffectGetDescriptor
138//
139// Description: Returns the descriptor of the effect which uuid is pointed
140// to by first argument.
141//
142// Input:
143// pEffectUuid: pointer to the effect uuid.
144//
145// Input/Output:
146// pDescriptor: address where to return the effect descriptor.
147//
148// Output:
149// returned value: 0 successful operation.
150// -ENODEV factory failed to initialize
151// -EINVAL invalid pEffectUuid or pDescriptor
Eric Laurentbe916aa2010-06-01 23:49:17 -0700152// -ENOENT no effect with this uuid found
Eric Laurent135ad072010-05-21 06:05:13 -0700153// *pDescriptor: updated with the effect descriptor.
154//
155////////////////////////////////////////////////////////////////////////////////
Glenn Kasten5e92a782012-01-30 07:40:52 -0800156int EffectGetDescriptor(const effect_uuid_t *pEffectUuid, effect_descriptor_t *pDescriptor);
Eric Laurent135ad072010-05-21 06:05:13 -0700157
158////////////////////////////////////////////////////////////////////////////////
159//
160// Function: EffectIsNullUuid
161//
162// Description: Helper function to compare effect uuid to EFFECT_UUID_NULL
163//
164// Input:
165// pEffectUuid: pointer to effect uuid to compare to EFFECT_UUID_NULL.
166//
167// Output:
168// returned value: 0 if uuid is different from EFFECT_UUID_NULL.
169// 1 if uuid is equal to EFFECT_UUID_NULL.
170//
171////////////////////////////////////////////////////////////////////////////////
Glenn Kasten5e92a782012-01-30 07:40:52 -0800172int EffectIsNullUuid(const effect_uuid_t *pEffectUuid);
Eric Laurent135ad072010-05-21 06:05:13 -0700173
Marco Nelissend89eadd2014-10-07 13:28:44 -0700174int EffectDumpEffects(int fd);
175
Eric Laurent135ad072010-05-21 06:05:13 -0700176#if __cplusplus
177} // extern "C"
178#endif
179
180
Eric Laurentffe9c252010-06-23 17:38:20 -0700181#endif /*ANDROID_EFFECTSFACTORYAPI_H_*/