14be7fe875758b42939719a1082ae9e6dbf37a1d7Jean-Michel Trivi/*
24be7fe875758b42939719a1082ae9e6dbf37a1d7Jean-Michel Trivi * Copyright (C) 2010 The Android Open Source Project
34be7fe875758b42939719a1082ae9e6dbf37a1d7Jean-Michel Trivi *
44be7fe875758b42939719a1082ae9e6dbf37a1d7Jean-Michel Trivi * Licensed under the Apache License, Version 2.0 (the "License");
54be7fe875758b42939719a1082ae9e6dbf37a1d7Jean-Michel Trivi * you may not use this file except in compliance with the License.
64be7fe875758b42939719a1082ae9e6dbf37a1d7Jean-Michel Trivi * You may obtain a copy of the License at
74be7fe875758b42939719a1082ae9e6dbf37a1d7Jean-Michel Trivi *
84be7fe875758b42939719a1082ae9e6dbf37a1d7Jean-Michel Trivi *      http://www.apache.org/licenses/LICENSE-2.0
94be7fe875758b42939719a1082ae9e6dbf37a1d7Jean-Michel Trivi *
104be7fe875758b42939719a1082ae9e6dbf37a1d7Jean-Michel Trivi * Unless required by applicable law or agreed to in writing, software
114be7fe875758b42939719a1082ae9e6dbf37a1d7Jean-Michel Trivi * distributed under the License is distributed on an "AS IS" BASIS,
124be7fe875758b42939719a1082ae9e6dbf37a1d7Jean-Michel Trivi * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
134be7fe875758b42939719a1082ae9e6dbf37a1d7Jean-Michel Trivi * See the License for the specific language governing permissions and
144be7fe875758b42939719a1082ae9e6dbf37a1d7Jean-Michel Trivi * limitations under the License.
154be7fe875758b42939719a1082ae9e6dbf37a1d7Jean-Michel Trivi */
164be7fe875758b42939719a1082ae9e6dbf37a1d7Jean-Michel Trivi
17172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi/**************************************************************************************************
18172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi * Equalizer functions
19172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi ****************************/
20213c31153b9bda7b5a091f2996da7b655c8ed451Glenn Kastenextern void android_eq_init(audio_session_t sessionId, IEqualizer* ieq);
214be7fe875758b42939719a1082ae9e6dbf37a1d7Jean-Michel Trivi
229bf773df2b8a0cf788f394c326960bc3a5af7c60Chih-Hung Hsiehextern android::status_t android_eq_setParam(const android::sp<android::AudioEffect>& pFx,
234be7fe875758b42939719a1082ae9e6dbf37a1d7Jean-Michel Trivi        int32_t param, int32_t param2, void *pValue);
244be7fe875758b42939719a1082ae9e6dbf37a1d7Jean-Michel Trivi
259bf773df2b8a0cf788f394c326960bc3a5af7c60Chih-Hung Hsiehextern android::status_t android_eq_getParam(const android::sp<android::AudioEffect>& pFx,
264be7fe875758b42939719a1082ae9e6dbf37a1d7Jean-Michel Trivi        int32_t param, int32_t param2, void *pValue);
274be7fe875758b42939719a1082ae9e6dbf37a1d7Jean-Michel Trivi
28172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi/**************************************************************************************************
29172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi * BassBoost functions
30172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi ****************************/
31213c31153b9bda7b5a091f2996da7b655c8ed451Glenn Kastenextern void android_bb_init(audio_session_t sessionId, IBassBoost* ibb);
329cd3c9e7a2395647b92c32f33c06cf9fd546b22fJean-Michel Trivi
339bf773df2b8a0cf788f394c326960bc3a5af7c60Chih-Hung Hsiehextern android::status_t android_bb_setParam(const android::sp<android::AudioEffect>& pFx,
349cd3c9e7a2395647b92c32f33c06cf9fd546b22fJean-Michel Trivi        int32_t param, void *pValue);
359cd3c9e7a2395647b92c32f33c06cf9fd546b22fJean-Michel Trivi
369bf773df2b8a0cf788f394c326960bc3a5af7c60Chih-Hung Hsiehextern android::status_t android_bb_getParam(const android::sp<android::AudioEffect>& pFx,
379cd3c9e7a2395647b92c32f33c06cf9fd546b22fJean-Michel Trivi        int32_t param, void *pValue);
389cd3c9e7a2395647b92c32f33c06cf9fd546b22fJean-Michel Trivi
39172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi/**************************************************************************************************
40172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi * Virtualizer functions
41172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi ****************************/
42213c31153b9bda7b5a091f2996da7b655c8ed451Glenn Kastenextern void android_virt_init(audio_session_t sessionId, IVirtualizer* ivi);
43f4aebfe499998c11b31319afb1c7738d4801f7b1Jean-Michel Trivi
449bf773df2b8a0cf788f394c326960bc3a5af7c60Chih-Hung Hsiehextern android::status_t android_virt_setParam(const android::sp<android::AudioEffect>& pFx,
45f4aebfe499998c11b31319afb1c7738d4801f7b1Jean-Michel Trivi        int32_t param, void *pValue);
46f4aebfe499998c11b31319afb1c7738d4801f7b1Jean-Michel Trivi
479bf773df2b8a0cf788f394c326960bc3a5af7c60Chih-Hung Hsiehextern android::status_t android_virt_getParam(const android::sp<android::AudioEffect>& pFx,
48f4aebfe499998c11b31319afb1c7738d4801f7b1Jean-Michel Trivi        int32_t param, void *pValue);
49f4aebfe499998c11b31319afb1c7738d4801f7b1Jean-Michel Trivi
50172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi/**************************************************************************************************
51172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi * PresetReverb functions
52172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi ****************************/
53172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Triviextern void android_prev_init(IPresetReverb* ipr);
5467bdf8a2fbd1024ab50c4513e1504325475368e0Jean-Michel Trivi
559bf773df2b8a0cf788f394c326960bc3a5af7c60Chih-Hung Hsiehextern android::status_t android_prev_setPreset(const android::sp<android::AudioEffect>& pFx,
56172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi        uint16_t preset);
57f4aebfe499998c11b31319afb1c7738d4801f7b1Jean-Michel Trivi
589bf773df2b8a0cf788f394c326960bc3a5af7c60Chih-Hung Hsiehextern android::status_t android_prev_getPreset(const android::sp<android::AudioEffect>& pFx,
59172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi        uint16_t* preset);
60f5fce95f98037ea4ab341b416c82444af595313dJean-Michel Trivi
61172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi/**************************************************************************************************
62172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi * EnvironmentalReverb functions
63172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi ****************************/
64172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Triviextern void android_erev_init(IEnvironmentalReverb* ier);
6567bdf8a2fbd1024ab50c4513e1504325475368e0Jean-Michel Trivi
669bf773df2b8a0cf788f394c326960bc3a5af7c60Chih-Hung Hsiehextern android::status_t android_erev_setParam(const android::sp<android::AudioEffect>& pFx,
67f5afeef3bb2aafba9b4e7c25ab3b9dcf42ee8d65Jean-Michel Trivi        int32_t param, void *pValue);
68f5afeef3bb2aafba9b4e7c25ab3b9dcf42ee8d65Jean-Michel Trivi
699bf773df2b8a0cf788f394c326960bc3a5af7c60Chih-Hung Hsiehextern android::status_t android_erev_getParam(const android::sp<android::AudioEffect>& pFx,
70f5afeef3bb2aafba9b4e7c25ab3b9dcf42ee8d65Jean-Michel Trivi        int32_t param, void *pValue);
71f5afeef3bb2aafba9b4e7c25ab3b9dcf42ee8d65Jean-Michel Trivi
72172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi/**************************************************************************************************
73677c796097b542e9ee6cf43a59e754f43c2370dcEric Laurent * AEC functions
74677c796097b542e9ee6cf43a59e754f43c2370dcEric Laurent ****************************/
75677c796097b542e9ee6cf43a59e754f43c2370dcEric Laurentextern void android_aec_init(audio_session_t sessionId, IAndroidAcousticEchoCancellation* iaec);
76677c796097b542e9ee6cf43a59e754f43c2370dcEric Laurent
77677c796097b542e9ee6cf43a59e754f43c2370dcEric Laurent/**************************************************************************************************
78677c796097b542e9ee6cf43a59e754f43c2370dcEric Laurent * AGC functions
79677c796097b542e9ee6cf43a59e754f43c2370dcEric Laurent ****************************/
80677c796097b542e9ee6cf43a59e754f43c2370dcEric Laurentextern void android_agc_init(audio_session_t sessionId, IAndroidAutomaticGainControl* iagc);
81677c796097b542e9ee6cf43a59e754f43c2370dcEric Laurent
82677c796097b542e9ee6cf43a59e754f43c2370dcEric Laurent/**************************************************************************************************
83677c796097b542e9ee6cf43a59e754f43c2370dcEric Laurent * NS functions
84677c796097b542e9ee6cf43a59e754f43c2370dcEric Laurent ****************************/
85677c796097b542e9ee6cf43a59e754f43c2370dcEric Laurentextern void android_ns_init(audio_session_t sessionId, IAndroidNoiseSuppression* ins);
86677c796097b542e9ee6cf43a59e754f43c2370dcEric Laurent
87677c796097b542e9ee6cf43a59e754f43c2370dcEric Laurent/**************************************************************************************************
88172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi * Generic Effect functions
89172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi ****************************/
9067bdf8a2fbd1024ab50c4513e1504325475368e0Jean-Michel Triviextern SLresult android_genericFx_queryNumEffects(SLuint32 *pNumSupportedAudioEffects);
9167bdf8a2fbd1024ab50c4513e1504325475368e0Jean-Michel Trivi
925b09aa864215690580b18eb802927e8cc7eb4861Jean-Michel Triviextern SLresult android_genericFx_queryEffect(SLuint32 index, effect_descriptor_t* pDescriptor);
9367bdf8a2fbd1024ab50c4513e1504325475368e0Jean-Michel Trivi
945b09aa864215690580b18eb802927e8cc7eb4861Jean-Michel Triviextern SLresult android_genericFx_createEffect(IAndroidEffect* iae, SLInterfaceID pUuid,
95213c31153b9bda7b5a091f2996da7b655c8ed451Glenn Kasten        audio_session_t sessionId);
9667bdf8a2fbd1024ab50c4513e1504325475368e0Jean-Michel Trivi
975b09aa864215690580b18eb802927e8cc7eb4861Jean-Michel Triviextern SLresult android_genericFx_releaseEffect(IAndroidEffect* iae, SLInterfaceID pUuid);
9867bdf8a2fbd1024ab50c4513e1504325475368e0Jean-Michel Trivi
995b09aa864215690580b18eb802927e8cc7eb4861Jean-Michel Triviextern SLresult android_genericFx_setEnabled(IAndroidEffect* iae, SLInterfaceID pUuid,
1005b09aa864215690580b18eb802927e8cc7eb4861Jean-Michel Trivi        SLboolean enabled);
10167bdf8a2fbd1024ab50c4513e1504325475368e0Jean-Michel Trivi
1025b09aa864215690580b18eb802927e8cc7eb4861Jean-Michel Triviextern SLresult android_genericFx_isEnabled(IAndroidEffect* iae, SLInterfaceID pUuid,
1035b09aa864215690580b18eb802927e8cc7eb4861Jean-Michel Trivi        SLboolean *pEnabled);
10467bdf8a2fbd1024ab50c4513e1504325475368e0Jean-Michel Trivi
1055b09aa864215690580b18eb802927e8cc7eb4861Jean-Michel Triviextern SLresult android_genericFx_sendCommand(IAndroidEffect* iae, SLInterfaceID pUuid,
1065b09aa864215690580b18eb802927e8cc7eb4861Jean-Michel Trivi        SLuint32 command, SLuint32 commandSize, void* pCommandData,
1075b09aa864215690580b18eb802927e8cc7eb4861Jean-Michel Trivi        SLuint32 *replySize, void *pReplyData);
10867bdf8a2fbd1024ab50c4513e1504325475368e0Jean-Michel Trivi
109fef6033d852daec8d88060b252e72f322724dca1Jean-Michel Triviextern bool android_genericFx_hasEffect(IAndroidEffect* iae, SLInterfaceID pUuid);
110fef6033d852daec8d88060b252e72f322724dca1Jean-Michel Trivi
111fef6033d852daec8d88060b252e72f322724dca1Jean-Michel Trivi
112172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi/**************************************************************************************************
113172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi * EffectSend functions
114172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi ****************************/
115ca325fa86f9e52d8300490eee102a3c1188f6bdcJean-Michel Trivi/**
116ca325fa86f9e52d8300490eee102a3c1188f6bdcJean-Michel Trivi * sendLevel is the total energy going to the send bus. This implies that the volume attenuation
117ca325fa86f9e52d8300490eee102a3c1188f6bdcJean-Michel Trivi *   should be combined with the send level for the aux level to follow volume changes.
118ca325fa86f9e52d8300490eee102a3c1188f6bdcJean-Michel Trivi */
119172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Triviextern android::status_t android_fxSend_attach(CAudioPlayer* ap, bool attach,
1209bf773df2b8a0cf788f394c326960bc3a5af7c60Chih-Hung Hsieh        const android::sp<android::AudioEffect>& pFx, SLmillibel sendLevel);
121172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi
122ca325fa86f9e52d8300490eee102a3c1188f6bdcJean-Michel Trivi/**
123ca325fa86f9e52d8300490eee102a3c1188f6bdcJean-Michel Trivi * sendLevel is the total energy going to the send bus. This implies that the volume attenuation
124ca325fa86f9e52d8300490eee102a3c1188f6bdcJean-Michel Trivi *   should be combined with the send level for the aux level to follow volume changes.
125e2e8fa36bd7448b59fbcdf141e0b6d21e5401d91Glenn Kasten *   This one is used by Android-specific APIs, not portable Khronos APIs.
126ca325fa86f9e52d8300490eee102a3c1188f6bdcJean-Michel Trivi */
127fef6033d852daec8d88060b252e72f322724dca1Jean-Michel Triviextern SLresult android_fxSend_attachToAux(CAudioPlayer* ap, SLInterfaceID pUuid,
128fef6033d852daec8d88060b252e72f322724dca1Jean-Michel Trivi        SLboolean attach, SLmillibel sendLevel);
129fef6033d852daec8d88060b252e72f322724dca1Jean-Michel Trivi
130ca325fa86f9e52d8300490eee102a3c1188f6bdcJean-Michel Trivi/**
131ca325fa86f9e52d8300490eee102a3c1188f6bdcJean-Michel Trivi * sendLevel is the total energy going to the send bus. This implies that the volume attenuation
132ca325fa86f9e52d8300490eee102a3c1188f6bdcJean-Michel Trivi *   should be combined with the send level for the aux level to follow volume changes.
133ca325fa86f9e52d8300490eee102a3c1188f6bdcJean-Michel Trivi */
134172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Triviextern android::status_t android_fxSend_setSendLevel(CAudioPlayer* ap, SLmillibel sendLevel);
135172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi
136172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi/**************************************************************************************************
137172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi * Effect-agnostic functions
138172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi ****************************/
1399bf773df2b8a0cf788f394c326960bc3a5af7c60Chih-Hung Hsiehextern android::status_t android_fx_setParam(const android::sp<android::AudioEffect>& pFx,
140172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi        int32_t param, uint32_t paramSizeMax, void *pValue, uint32_t valueSize);
141172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi
1429bf773df2b8a0cf788f394c326960bc3a5af7c60Chih-Hung Hsiehextern android::status_t android_fx_getParam(const android::sp<android::AudioEffect>& pFx,
143172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi        int32_t param, uint32_t paramSizeMax, void *pValue, uint32_t valueSize);
144172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi
145172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Triviextern SLresult android_fx_statusToResult(android::status_t status);
146172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi
147213c31153b9bda7b5a091f2996da7b655c8ed451Glenn Kastenextern bool android_fx_initEffectObj(audio_session_t sessionId,
148213c31153b9bda7b5a091f2996da7b655c8ed451Glenn Kasten        android::sp<android::AudioEffect>& effect,
14900667fcca51d62236b538e6857b7e6b923453569Jean-Michel Trivi        const effect_uuid_t *type);
150172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi
151172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Triviextern bool android_fx_initEffectDescriptor(const SLInterfaceID effectId,
152172e4da556ad3cb1d2a06cfa019903310aa291d5Jean-Michel Trivi        effect_descriptor_t* fxDescrLoc);
153