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