1801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent/*
2801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent * Copyright (C) 2009 The Android Open Source Project
3801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent *
4801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent * Licensed under the Apache License, Version 2.0 (the "License");
5801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent * you may not use this file except in compliance with the License.
6801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent * You may obtain a copy of the License at
7801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent *
8801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent *      http://www.apache.org/licenses/LICENSE-2.0
9801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent *
10801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent * Unless required by applicable law or agreed to in writing, software
11801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent * distributed under the License is distributed on an "AS IS" BASIS,
12801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent * See the License for the specific language governing permissions and
14801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent * limitations under the License.
15801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent */
16801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
17801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent#ifndef ANDROID_AUDIOEFFECT_H
18801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent#define ANDROID_AUDIOEFFECT_H
19801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
20801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent#include <stdint.h>
21801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent#include <sys/types.h>
22801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
23801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent#include <media/IAudioFlinger.h>
2457dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent#include <media/IAudioPolicyService.h>
25801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent#include <media/IEffect.h>
26801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent#include <media/IEffectClient.h>
27e1315cf0b63b4c14a77046519e6b01f6f60d74b0Eric Laurent#include <hardware/audio_effect.h>
28801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent#include <media/AudioSystem.h>
29801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
30801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent#include <utils/RefBase.h>
31801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent#include <utils/Errors.h>
32801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent#include <binder/IInterface.h>
33801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
34801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
35801a1186eb1d2ce195b15222701865932e08f3dcEric Laurentnamespace android {
36801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
37801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent// ----------------------------------------------------------------------------
38801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
39801a1186eb1d2ce195b15222701865932e08f3dcEric Laurentclass effect_param_cblk_t;
40801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
41801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent// ----------------------------------------------------------------------------
42801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
43801a1186eb1d2ce195b15222701865932e08f3dcEric Laurentclass AudioEffect : public RefBase
44801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent{
45801a1186eb1d2ce195b15222701865932e08f3dcEric Laurentpublic:
46801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
47801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    /*
48801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *  Static methods for effects enumeration.
49801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     */
50801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
51801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    /*
52801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * Returns the number of effects available. This method together
53ffe9c25ce85e1af55d58ec025adc6367d70db7e8Eric Laurent     * with queryEffect() is used to enumerate all effects:
54801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * The enumeration sequence is:
55ffe9c25ce85e1af55d58ec025adc6367d70db7e8Eric Laurent     *      queryNumberEffects(&num_effects);
56ffe9c25ce85e1af55d58ec025adc6367d70db7e8Eric Laurent     *      for (i = 0; i < num_effects; i++)
57ffe9c25ce85e1af55d58ec025adc6367d70db7e8Eric Laurent     *          queryEffect(i,...);
58801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *
59801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * Parameters:
60ffe9c25ce85e1af55d58ec025adc6367d70db7e8Eric Laurent     *      numEffects:    address where the number of effects should be returned.
61801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *
62801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * Returned status (from utils/Errors.h) can be:
63801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *      NO_ERROR   successful operation.
64801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *      PERMISSION_DENIED could not get AudioFlinger interface
65801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *      NO_INIT    effect library failed to initialize
66801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *      BAD_VALUE  invalid numEffects pointer
67801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *
68801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * Returned value
69801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *   *numEffects:     updated with number of effects available
70801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     */
71801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    static status_t queryNumberEffects(uint32_t *numEffects);
72801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
73801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    /*
74ffe9c25ce85e1af55d58ec025adc6367d70db7e8Eric Laurent     * Returns an effect descriptor during effect
75801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * enumeration.
76801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *
77801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * Parameters:
78ffe9c25ce85e1af55d58ec025adc6367d70db7e8Eric Laurent     *      index:      index of the queried effect.
79ffe9c25ce85e1af55d58ec025adc6367d70db7e8Eric Laurent     *      descriptor: address where the effect descriptor should be returned.
80801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *
81801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * Returned status (from utils/Errors.h) can be:
82801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *      NO_ERROR        successful operation.
83801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *      PERMISSION_DENIED could not get AudioFlinger interface
84801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *      NO_INIT         effect library failed to initialize
85ffe9c25ce85e1af55d58ec025adc6367d70db7e8Eric Laurent     *      BAD_VALUE       invalid descriptor pointer or index
86801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *      INVALID_OPERATION  effect list has changed since last execution of queryNumberEffects()
87801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *
88801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * Returned value
89801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *   *descriptor:     updated with effect descriptor
90801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     */
91ffe9c25ce85e1af55d58ec025adc6367d70db7e8Eric Laurent    static status_t queryEffect(uint32_t index, effect_descriptor_t *descriptor);
92801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
93801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
94801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    /*
95801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * Returns the descriptor for the specified effect uuid.
96801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *
97801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * Parameters:
98801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *      uuid:       pointer to effect uuid.
99801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *      descriptor: address where the effect descriptor should be returned.
100801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *
101801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * Returned status (from utils/Errors.h) can be:
102801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *      NO_ERROR        successful operation.
103801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *      PERMISSION_DENIED could not get AudioFlinger interface
104801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *      NO_INIT         effect library failed to initialize
105801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *      BAD_VALUE       invalid uuid or descriptor pointers
106801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *      NAME_NOT_FOUND  no effect with this uuid found
107801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *
108801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * Returned value
109801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *   *descriptor updated with effect descriptor
110801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     */
1115e92a7861196ddae14638d4b7a63fc4892b7ef59Glenn Kasten    static status_t getEffectDescriptor(const effect_uuid_t *uuid,
112f587ba5b991c7cd91e4df093d0d796bd419e5d67Glenn Kasten                                        effect_descriptor_t *descriptor) /*const*/;
113801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
114801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
115801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    /*
11657dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent     * Returns a list of descriptors corresponding to the pre processings enabled by default
11757dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent     * on an AudioRecord with the supplied audio session ID.
11857dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent     *
11957dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent     * Parameters:
12057dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent     *      audioSession:  audio session ID.
12157dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent     *      descriptors: address where the effect descriptors should be returned.
12257dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent     *      count: as input, the maximum number of descriptor than should be returned
12357dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent     *             as output, the number of descriptor returned if status is NO_ERROR or the actual
12457dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent     *             number of enabled pre processings if status is NO_MEMORY
12557dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent     *
12657dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent     * Returned status (from utils/Errors.h) can be:
12757dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent     *      NO_ERROR        successful operation.
12857dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent     *      NO_MEMORY       the number of descriptor to return is more than the maximum number
12957dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent     *                      indicated by count.
13057dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent     *      PERMISSION_DENIED could not get AudioFlinger interface
13157dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent     *      NO_INIT         effect library failed to initialize
13257dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent     *      BAD_VALUE       invalid audio session or descriptor pointers
13357dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent     *
13457dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent     * Returned value
13557dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent     *   *descriptor updated with descriptors of pre processings enabled by default
13657dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent     *   *count      number of descriptors returned if returned status is N_ERROR.
13757dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent     *               total number of pre processing enabled by default if returned status is
13857dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent     *               NO_MEMORY. This happens if the count passed as input is less than the number
13957dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent     *               of descriptors to return
14057dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent     */
14157dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent    static status_t queryDefaultPreProcessing(int audioSession,
14257dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent                                              effect_descriptor_t *descriptors,
14357dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent                                              uint32_t *count);
14457dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent
14557dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent    /*
146801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * Events used by callback function (effect_callback_t).
147801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     */
148801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    enum event_type {
149801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent        EVENT_CONTROL_STATUS_CHANGED = 0,
150801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent        EVENT_ENABLE_STATUS_CHANGED = 1,
151801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent        EVENT_PARAMETER_CHANGED = 2,
152801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent        EVENT_ERROR = 3
153801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    };
154801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
155801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    /* Callback function notifying client application of a change in effect engine state or
156801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * configuration.
157801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * An effect engine can be shared by several applications but only one has the control
158801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * of the engine activity and configuration at a time.
159801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * The EVENT_CONTROL_STATUS_CHANGED event is received when an application loses or
160801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * retrieves the control of the effect engine. Loss of control happens
161801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * if another application requests the use of the engine by creating an AudioEffect for
162801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * the same effect type but with a higher priority. Control is returned when the
163801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * application having the control deletes its AudioEffect object.
164801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * The EVENT_ENABLE_STATUS_CHANGED event is received by all applications not having the
165801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * control of the effect engine when the effect is enabled or disabled.
166801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * The EVENT_PARAMETER_CHANGED event is received by all applications not having the
167801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * control of the effect engine when an effect parameter is changed.
168801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * The EVENT_ERROR event is received when the media server process dies.
169801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *
170801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * Parameters:
171801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *
172801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * event:   type of event notified (see enum AudioEffect::event_type).
173801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * user:    Pointer to context for use by the callback receiver.
174801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * info:    Pointer to optional parameter according to event type:
175801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *  - EVENT_CONTROL_STATUS_CHANGED:  boolean indicating if control is granted (true)
176801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *  or stolen (false).
177801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *  - EVENT_ENABLE_STATUS_CHANGED: boolean indicating if effect is now enabled (true)
178801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *  or disabled (false).
179801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *  - EVENT_PARAMETER_CHANGED: pointer to a effect_param_t structure.
180801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *  - EVENT_ERROR:  status_t indicating the error (DEAD_OBJECT when media server dies).
181801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     */
182801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
183801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    typedef void (*effect_callback_t)(int32_t event, void* user, void *info);
184801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
185801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
186801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    /* Constructor.
187801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * AudioEffect is the base class for creating and controlling an effect engine from
188801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * the application process. Creating an AudioEffect object will create the effect engine
189801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * in the AudioFlinger if no engine of the specified type exists. If one exists, this engine
190801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * will be used. The application creating the AudioEffect object (or a derived class like
191801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * Reverb for instance) will either receive control of the effect engine or not, depending
192801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * on the priority parameter. If priority is higher than the priority used by the current
193801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * effect engine owner, the control will be transfered to the new application. Otherwise
194801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * control will remain to the previous application. In this case, the new application will be
195801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * notified of changes in effect engine state or control ownership by the effect callback.
196801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * After creating the AudioEffect, the application must call the initCheck() method and
197801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * check the creation status before trying to control the effect engine (see initCheck()).
198801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * If the effect is to be applied to an AudioTrack or MediaPlayer only the application
199801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * must specify the audio session ID corresponding to this player.
200801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     */
201801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
202801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    /* Simple Constructor.
203801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     */
204801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    AudioEffect();
205801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
206801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
207801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    /* Constructor.
208801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *
209801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * Parameters:
210801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *
211801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * type:  type of effect created: can be null if uuid is specified. This corresponds to
212801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *        the OpenSL ES interface implemented by this effect.
213801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * uuid:  Uuid of effect created: can be null if type is specified. This uuid corresponds to
214801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *        a particular implementation of an effect type.
215801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * priority:    requested priority for effect control: the priority level corresponds to the
216801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *      value of priority parameter: negative values indicate lower priorities, positive values
217801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *      higher priorities, 0 being the normal priority.
218801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * cbf:         optional callback function (see effect_callback_t)
219801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * user:        pointer to context for use by the callback receiver.
220801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * sessionID:   audio session this effect is associated to. If 0, the effect will be global to
221801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *      the output mix. If not 0, the effect will be applied to all players
222801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *      (AudioTrack or MediaPLayer) within the same audio session.
2237c7f10bd4fda9a084e5e7f0eb3a040dfcbf01745Eric Laurent     * io:  HAL audio output or input stream to which this effect must be attached. Leave at 0 for
224801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *      automatic output selection by AudioFlinger.
225801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     */
226801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
227801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    AudioEffect(const effect_uuid_t *type,
228801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent                const effect_uuid_t *uuid = NULL,
229801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent                  int32_t priority = 0,
230a0d68338a88c2ddb4502f95017b546d603ef1ec7Glenn Kasten                  effect_callback_t cbf = NULL,
231a0d68338a88c2ddb4502f95017b546d603ef1ec7Glenn Kasten                  void* user = NULL,
232801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent                  int sessionId = 0,
2337c7f10bd4fda9a084e5e7f0eb3a040dfcbf01745Eric Laurent                  audio_io_handle_t io = 0
234801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent                  );
235801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
236801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    /* Constructor.
237801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *      Same as above but with type and uuid specified by character strings
238801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     */
239801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    AudioEffect(const char *typeStr,
240801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent                    const char *uuidStr = NULL,
241801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent                    int32_t priority = 0,
242a0d68338a88c2ddb4502f95017b546d603ef1ec7Glenn Kasten                    effect_callback_t cbf = NULL,
243a0d68338a88c2ddb4502f95017b546d603ef1ec7Glenn Kasten                    void* user = NULL,
244801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent                    int sessionId = 0,
2457c7f10bd4fda9a084e5e7f0eb3a040dfcbf01745Eric Laurent                    audio_io_handle_t io = 0
246801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent                    );
247801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
248801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    /* Terminates the AudioEffect and unregisters it from AudioFlinger.
249801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * The effect engine is also destroyed if this AudioEffect was the last controlling
250801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * the engine.
251801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     */
252801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent                        ~AudioEffect();
253801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
254801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    /* Initialize an uninitialized AudioEffect.
255801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    * Returned status (from utils/Errors.h) can be:
256801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    *  - NO_ERROR or ALREADY_EXISTS: successful initialization
257801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    *  - INVALID_OPERATION: AudioEffect is already initialized
258801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    *  - BAD_VALUE: invalid parameter
259801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    *  - NO_INIT: audio flinger or audio hardware not initialized
260801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    * */
261801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent            status_t    set(const effect_uuid_t *type,
262801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent                            const effect_uuid_t *uuid = NULL,
263801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent                            int32_t priority = 0,
264a0d68338a88c2ddb4502f95017b546d603ef1ec7Glenn Kasten                            effect_callback_t cbf = NULL,
265a0d68338a88c2ddb4502f95017b546d603ef1ec7Glenn Kasten                            void* user = NULL,
266801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent                            int sessionId = 0,
2677c7f10bd4fda9a084e5e7f0eb3a040dfcbf01745Eric Laurent                            audio_io_handle_t io = 0
268801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent                            );
269801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
270801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    /* Result of constructing the AudioEffect. This must be checked
271801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * before using any AudioEffect API.
272801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * initCheck() can return:
273801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *  - NO_ERROR:    the effect engine is successfully created and the application has control.
274801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *  - ALREADY_EXISTS: the effect engine is successfully created but the application does not
275801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *              have control.
276801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *  - NO_INIT:     the effect creation failed.
277801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *
278801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     */
279801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent            status_t    initCheck() const;
280801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
281801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
282801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    /* Returns the unique effect Id for the controlled effect engine. This ID is unique
283801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * system wide and is used for instance in the case of auxiliary effects to attach
284801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * the effect to an AudioTrack or MediaPlayer.
285801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *
286801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     */
287801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent            int32_t     id() const { return mId; }
288801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
289e1315cf0b63b4c14a77046519e6b01f6f60d74b0Eric Laurent    /* Returns a descriptor for the effect (see effect_descriptor_t in audio_effect.h).
290801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     */
291801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent            effect_descriptor_t descriptor() const;
292801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
293801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    /* Returns effect control priority of this AudioEffect object.
294801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     */
295801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent            int32_t     priority() const { return mPriority; }
296801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
297801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
298da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurent    /* Enables or disables the effect engine.
299801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *
300801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * Parameters:
301da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurent     *  enabled: requested enable state.
302801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *
303801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * Returned status (from utils/Errors.h) can be:
304801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *  - NO_ERROR: successful operation
305da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurent     *  - INVALID_OPERATION: the application does not have control of the effect engine or the
306da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurent     *  effect is already in the requested state.
307801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     */
308da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurent    virtual status_t    setEnabled(bool enabled);
309da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurent            bool        getEnabled() const;
310801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
311801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    /* Sets a parameter value.
312801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *
313801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * Parameters:
314801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *      param:  pointer to effect_param_t structure containing the parameter
315e1315cf0b63b4c14a77046519e6b01f6f60d74b0Eric Laurent     *          and its value (See audio_effect.h).
316801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * Returned status (from utils/Errors.h) can be:
317801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *  - NO_ERROR: successful operation.
318801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *  - INVALID_OPERATION: the application does not have control of the effect engine.
319801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *  - BAD_VALUE: invalid parameter identifier or value.
320801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *  - DEAD_OBJECT: the effect engine has been deleted.
321801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     */
322da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurent     virtual status_t   setParameter(effect_param_t *param);
323801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
324801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    /* Prepare a new parameter value that will be set by next call to
325801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * setParameterCommit(). This method can be used to set multiple parameters
326801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * in a synchronous manner or to avoid multiple binder calls for each
327801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * parameter.
328801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *
329801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * Parameters:
330801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *      param:  pointer to effect_param_t structure containing the parameter
331e1315cf0b63b4c14a77046519e6b01f6f60d74b0Eric Laurent     *          and its value (See audio_effect.h).
332801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *
333801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * Returned status (from utils/Errors.h) can be:
334801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *  - NO_ERROR: successful operation.
335801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *  - INVALID_OPERATION: the application does not have control of the effect engine.
336801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *  - NO_MEMORY: no more space available in shared memory used for deferred parameter
337801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *  setting.
338801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     */
339da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurent     virtual status_t   setParameterDeferred(effect_param_t *param);
340801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
341801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     /* Commit all parameter values previously prepared by setParameterDeferred().
342801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent      *
343801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent      * Parameters:
344801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent      *     none
345801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent      *
346801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent      * Returned status (from utils/Errors.h) can be:
347801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent      *  - NO_ERROR: successful operation.
348801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent      *  - INVALID_OPERATION: No new parameter values ready for commit.
349801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent      *  - BAD_VALUE: invalid parameter identifier or value: there is no indication
350801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent      *     as to which of the parameters caused this error.
351801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent      *  - DEAD_OBJECT: the effect engine has been deleted.
352801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent      */
353da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurent     virtual status_t   setParameterCommit();
354801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
355801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    /* Gets a parameter value.
356801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *
357801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * Parameters:
358801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *      param:  pointer to effect_param_t structure containing the parameter
359e1315cf0b63b4c14a77046519e6b01f6f60d74b0Eric Laurent     *          and the returned value (See audio_effect.h).
360801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *
361801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     * Returned status (from utils/Errors.h) can be:
362801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *  - NO_ERROR: successful operation.
363801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *  - INVALID_OPERATION: the AudioEffect was not successfully initialized.
364801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *  - BAD_VALUE: invalid parameter identifier.
365801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     *  - DEAD_OBJECT: the effect engine has been deleted.
366801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     */
367da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurent     virtual status_t   getParameter(effect_param_t *param);
368801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
369801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     /* Sends a command and receives a response to/from effect engine.
370e1315cf0b63b4c14a77046519e6b01f6f60d74b0Eric Laurent      *     See audio_effect.h for details on effect command() function, valid command codes
371801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent      *     and formats.
372801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent      */
37325f4395b932fa9859a6e91ba77c5d20d009da64aEric Laurent     virtual status_t command(uint32_t cmdCode,
37425f4395b932fa9859a6e91ba77c5d20d009da64aEric Laurent                              uint32_t cmdSize,
375da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurent                              void *cmdData,
37625f4395b932fa9859a6e91ba77c5d20d009da64aEric Laurent                              uint32_t *replySize,
377da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurent                              void *replyData);
378801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
379801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
380801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     /*
381801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent      * Utility functions.
382801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent      */
383801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
384801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     /* Converts the string passed as first argument to the effect_uuid_t
385801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent      * pointed to by second argument
386801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent      */
387801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     static status_t stringToGuid(const char *str, effect_uuid_t *guid);
388801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     /* Converts the effect_uuid_t pointed to by first argument to the
389801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent      * string passed as second argument
390801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent      */
391801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     static status_t guidToString(const effect_uuid_t *guid, char *str, size_t maxLen);
392801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
393da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurentprotected:
394f5aafb209d01ba2ab6cb55d1a12cfc653e2b4be0Eric Laurent     bool                    mEnabled;           // enable state
395da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurent     int32_t                 mSessionId;         // audio session ID
396da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurent     int32_t                 mPriority;          // priority for effect control
397da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurent     status_t                mStatus;            // effect status
398da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurent     effect_callback_t       mCbf;               // callback function for status, control and
399da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurent                                                 // parameter changes notifications
400da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurent     void*                   mUserData;          // client context for callback function
401da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurent     effect_descriptor_t     mDescriptor;        // effect descriptor
402da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurent     int32_t                 mId;                // system wide unique effect engine instance ID
403f5aafb209d01ba2ab6cb55d1a12cfc653e2b4be0Eric Laurent     Mutex                   mLock;               // Mutex for mEnabled access
404da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurent
4053476de62fb10e76412452ef4c6bd71936c9f7db1Jean-Michel Trivi     // IEffectClient
4063476de62fb10e76412452ef4c6bd71936c9f7db1Jean-Michel Trivi     virtual void controlStatusChanged(bool controlGranted);
4073476de62fb10e76412452ef4c6bd71936c9f7db1Jean-Michel Trivi     virtual void enableStatusChanged(bool enabled);
4083476de62fb10e76412452ef4c6bd71936c9f7db1Jean-Michel Trivi     virtual void commandExecuted(uint32_t cmdCode,
4093476de62fb10e76412452ef4c6bd71936c9f7db1Jean-Michel Trivi             uint32_t cmdSize,
4103476de62fb10e76412452ef4c6bd71936c9f7db1Jean-Michel Trivi             void *pCmdData,
4113476de62fb10e76412452ef4c6bd71936c9f7db1Jean-Michel Trivi             uint32_t replySize,
4123476de62fb10e76412452ef4c6bd71936c9f7db1Jean-Michel Trivi             void *pReplyData);
4133476de62fb10e76412452ef4c6bd71936c9f7db1Jean-Michel Trivi
414801a1186eb1d2ce195b15222701865932e08f3dcEric Laurentprivate:
415801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
416801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent     // Implements the IEffectClient interface
417801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    class EffectClient : public android::BnEffectClient,  public android::IBinder::DeathRecipient
418801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    {
419801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    public:
420801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
421801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent        EffectClient(AudioEffect *effect) : mEffect(effect){}
422801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
423801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent        // IEffectClient
424da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurent        virtual void controlStatusChanged(bool controlGranted) {
425da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurent            mEffect->controlStatusChanged(controlGranted);
426da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurent        }
427da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurent        virtual void enableStatusChanged(bool enabled) {
428da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurent            mEffect->enableStatusChanged(enabled);
429da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurent        }
43025f4395b932fa9859a6e91ba77c5d20d009da64aEric Laurent        virtual void commandExecuted(uint32_t cmdCode,
43125f4395b932fa9859a6e91ba77c5d20d009da64aEric Laurent                                     uint32_t cmdSize,
432da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurent                                     void *pCmdData,
43325f4395b932fa9859a6e91ba77c5d20d009da64aEric Laurent                                     uint32_t replySize,
434da7581b7b61b84f15e8d671c86fd117c322b009eEric Laurent                                     void *pReplyData) {
435801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent            mEffect->commandExecuted(cmdCode, cmdSize, pCmdData, replySize, pReplyData);
436801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent        }
437801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
438801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent        // IBinder::DeathRecipient
439801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent        virtual void binderDied(const wp<IBinder>& who) {mEffect->binderDied();}
440801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
441801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    private:
442801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent        AudioEffect *mEffect;
443801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    };
444801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
445801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    void binderDied();
446801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
447801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    sp<IEffect>             mIEffect;           // IEffect binder interface
448801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    sp<EffectClient>        mIEffectClient;     // IEffectClient implementation
449801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    sp<IMemory>             mCblkMemory;        // shared memory for deferred parameter setting
450801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent    effect_param_cblk_t*    mCblk;              // control block for deferred parameter setting
451801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent};
452801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
453801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
454801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent}; // namespace android
455801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent
456801a1186eb1d2ce195b15222701865932e08f3dcEric Laurent#endif // ANDROID_AUDIOEFFECT_H
457