1 /*
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 
17 #include "sles_allinclusive.h"
18 //#include "math.h"
19 //#include "utils/RefBase.h"
20 
21 #include <system/audio.h>
22 
android_outputMix_create(COutputMix * om)23 SLresult android_outputMix_create(COutputMix *om) {
24     SL_LOGV("Create outputMix=%p", om);
25     return SL_RESULT_SUCCESS;
26 }
27 
28 
android_outputMix_realize(COutputMix * om,SLboolean async)29 SLresult android_outputMix_realize(COutputMix *om, SLboolean async) {
30     SLresult result = SL_RESULT_SUCCESS;
31     SL_LOGV("Realize outputMix=%p", om);
32 
33     // initialize effects
34     // initialize EQ
35     if (memcmp(SL_IID_EQUALIZER, &om->mEqualizer.mEqDescriptor.type,
36             sizeof(effect_uuid_t)) == 0) {
37         android_eq_init(AUDIO_SESSION_OUTPUT_MIX /*sessionId*/, &om->mEqualizer);
38     }
39     // initialize BassBoost
40     if (memcmp(SL_IID_BASSBOOST, &om->mBassBoost.mBassBoostDescriptor.type,
41             sizeof(effect_uuid_t)) == 0) {
42         android_bb_init(AUDIO_SESSION_OUTPUT_MIX /*sessionId*/, &om->mBassBoost);
43     }
44     // initialize PresetReverb
45     if (memcmp(SL_IID_PRESETREVERB, &om->mPresetReverb.mPresetReverbDescriptor.type,
46             sizeof(effect_uuid_t)) == 0) {
47         android_prev_init(&om->mPresetReverb);
48     }
49     // initialize EnvironmentalReverb
50     if (memcmp(SL_IID_ENVIRONMENTALREVERB,
51             &om->mEnvironmentalReverb.mEnvironmentalReverbDescriptor.type,
52             sizeof(effect_uuid_t)) == 0) {
53         android_erev_init(&om->mEnvironmentalReverb);
54     }
55     // initialize Virtualizer
56     if (memcmp(SL_IID_VIRTUALIZER, &om->mVirtualizer.mVirtualizerDescriptor.type,
57             sizeof(effect_uuid_t)) == 0) {
58         android_virt_init(AUDIO_SESSION_OUTPUT_MIX /*sessionId*/,
59                 &om->mVirtualizer);
60     }
61 
62     return result;
63 }
64 
65 
android_outputMix_destroy(COutputMix * om)66 SLresult android_outputMix_destroy(COutputMix *om) {
67     SL_LOGV("Destroy outputMix=%p", om);
68     return SL_RESULT_SUCCESS;
69 }
70