blob: 4bde112f2684541798c2b105d1a33bd3f8ce8e0c [file] [log] [blame]
Mikhail Naganov4a3d5c22016-08-15 13:47:42 -07001/*
2 * Copyright (C) 2016 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#ifndef ANDROID_HARDWARE_EFFECT_HAL_INTERFACE_H
18#define ANDROID_HARDWARE_EFFECT_HAL_INTERFACE_H
19
20#include <hardware/audio_effect.h>
21#include <utils/Errors.h>
22#include <utils/RefBase.h>
23
24namespace android {
25
Mikhail Naganove4f1f632016-08-31 11:35:10 -070026class EffectHalInterface : public RefBase
Mikhail Naganov4a3d5c22016-08-15 13:47:42 -070027{
28 public:
Mikhail Naganov4a3d5c22016-08-15 13:47:42 -070029 // Effect process function. Takes input samples as specified
30 // in input buffer descriptor and output processed samples as specified
31 // in output buffer descriptor.
32 virtual status_t process(audio_buffer_t *inBuffer, audio_buffer_t *outBuffer) = 0;
33
34 // Process reverse stream function. This function is used to pass
35 // a reference stream to the effect engine.
36 virtual status_t processReverse(audio_buffer_t *inBuffer, audio_buffer_t *outBuffer) = 0;
37
38 // Send a command and receive a response to/from effect engine.
39 virtual status_t command(uint32_t cmdCode, uint32_t cmdSize, void *pCmdData,
40 uint32_t *replySize, void *pReplyData) = 0;
41
42 // Returns the effect descriptor.
43 virtual status_t getDescriptor(effect_descriptor_t *pDescriptor) = 0;
44
45 protected:
46 // Subclasses can not be constructed directly by clients.
47 EffectHalInterface() {}
Mikhail Naganov1dc98672016-08-18 17:50:29 -070048
49 // The destructor automatically releases the effect.
50 virtual ~EffectHalInterface() {}
Mikhail Naganov4a3d5c22016-08-15 13:47:42 -070051};
52
53} // namespace android
54
55#endif // ANDROID_HARDWARE_EFFECT_HAL_INTERFACE_H