1 /* 2 * Copyright (C) 2020 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 package android.media; 18 19 import android.media.SharedFileRegion; 20 21 /** 22 * The IEffect interface enables control of the effect module activity and parameters. 23 * 24 * {@hide} 25 */ 26 interface IEffect { 27 /** 28 * Activates the effect module by connecting it to the audio path. 29 * @return a status_t code. 30 */ enable()31 int enable(); 32 33 /** 34 * Deactivates the effect module by disconnecting it from the audio path. 35 * @return a status_t code. 36 */ disable()37 int disable(); 38 39 /** 40 * Sends control, reads or writes parameters. Same behavior as the command() method in the 41 * effect control interface. 42 * Refer to system/audio_effect.h for a description of the valid command codes and their 43 * associated parameter and return messages. The cmdData and response parameters are expected to 44 * contain the respective types in a standard C memory layout. 45 * 46 * TODO(ytai): replace opaque byte arrays with strongly typed parameters. 47 */ command(int cmdCode, in byte[] cmdData, int maxResponseSize, out byte[] response)48 int command(int cmdCode, in byte[] cmdData, int maxResponseSize, out byte[] response); 49 50 /** 51 * Disconnects the IEffect interface from the effect module. 52 * This will also delete the effect module and release the effect engine in the library if this 53 * is the last client disconnected. To release control of the effect module, the application can 54 * disconnect or delete the IEffect interface. 55 */ disconnect()56 void disconnect(); 57 58 /** 59 * returns a pointer to a shared memory area used to pass multiple parameters to the effect 60 * module without multiplying the binder calls. 61 * 62 * TODO(ytai): Explain how this should be used exactly. 63 */ getCblk()64 SharedFileRegion getCblk(); 65 66 // When adding a new method, please review and update 67 // Effects.cpp AudioFlinger::EffectHandle::onTransact() 68 // Effects.cpp IEFFECT_BINDER_METHOD_MACRO_LIST 69 } 70