xref: /aosp_15_r20/frameworks/wilhelm/src/desktop/OutputMixExt.h (revision bebae9c0e76121f8312ccb50385c080b3a0b023c)
1*bebae9c0SAndroid Build Coastguard Worker /*
2*bebae9c0SAndroid Build Coastguard Worker  * Copyright (C) 2010 The Android Open Source Project
3*bebae9c0SAndroid Build Coastguard Worker  *
4*bebae9c0SAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
5*bebae9c0SAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
6*bebae9c0SAndroid Build Coastguard Worker  * You may obtain a copy of the License at
7*bebae9c0SAndroid Build Coastguard Worker  *
8*bebae9c0SAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
9*bebae9c0SAndroid Build Coastguard Worker  *
10*bebae9c0SAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
11*bebae9c0SAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
12*bebae9c0SAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*bebae9c0SAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
14*bebae9c0SAndroid Build Coastguard Worker  * limitations under the License.
15*bebae9c0SAndroid Build Coastguard Worker  */
16*bebae9c0SAndroid Build Coastguard Worker 
17*bebae9c0SAndroid Build Coastguard Worker /** \file OutputMixExt.h OutputMixExt interface */
18*bebae9c0SAndroid Build Coastguard Worker 
19*bebae9c0SAndroid Build Coastguard Worker #ifdef __cplusplus
20*bebae9c0SAndroid Build Coastguard Worker extern "C" {
21*bebae9c0SAndroid Build Coastguard Worker #endif
22*bebae9c0SAndroid Build Coastguard Worker extern const SLInterfaceID SL_IID_OUTPUTMIXEXT;
23*bebae9c0SAndroid Build Coastguard Worker #ifdef __cplusplus
24*bebae9c0SAndroid Build Coastguard Worker }
25*bebae9c0SAndroid Build Coastguard Worker #endif
26*bebae9c0SAndroid Build Coastguard Worker 
27*bebae9c0SAndroid Build Coastguard Worker typedef const struct SLOutputMixExtItf_ * const * SLOutputMixExtItf;
28*bebae9c0SAndroid Build Coastguard Worker 
29*bebae9c0SAndroid Build Coastguard Worker /** \brief v-table for IOutputMixExt */
30*bebae9c0SAndroid Build Coastguard Worker 
31*bebae9c0SAndroid Build Coastguard Worker struct SLOutputMixExtItf_ {
32*bebae9c0SAndroid Build Coastguard Worker     void (*FillBuffer)(SLOutputMixExtItf self, void *pBuffer, SLuint32 size);
33*bebae9c0SAndroid Build Coastguard Worker };
34*bebae9c0SAndroid Build Coastguard Worker 
35*bebae9c0SAndroid Build Coastguard Worker /** \brief Track describes each PCM input source to OutputMix */
36*bebae9c0SAndroid Build Coastguard Worker 
37*bebae9c0SAndroid Build Coastguard Worker typedef struct {
38*bebae9c0SAndroid Build Coastguard Worker     struct BufferQueue_interface *mBufferQueue;
39*bebae9c0SAndroid Build Coastguard Worker     CAudioPlayer *mAudioPlayer; ///< Mixer examines this track if non-NULL
40*bebae9c0SAndroid Build Coastguard Worker     const void *mReader;    ///< Pointer to next frame in BufferHeader.mBuffer
41*bebae9c0SAndroid Build Coastguard Worker     SLuint32 mAvail;        ///< Number of available bytes in the current buffer
42*bebae9c0SAndroid Build Coastguard Worker     float mGains[STEREO_CHANNELS]; ///< Copied from CAudioPlayer::mGains
43*bebae9c0SAndroid Build Coastguard Worker     SLuint32 mFramesMixed;  ///< Number of sample frames mixed from track; reset periodically
44*bebae9c0SAndroid Build Coastguard Worker } Track;
45*bebae9c0SAndroid Build Coastguard Worker 
46*bebae9c0SAndroid Build Coastguard Worker extern SLresult IOutputMixExt_checkAudioPlayerSourceSink(CAudioPlayer *thiz);
47*bebae9c0SAndroid Build Coastguard Worker extern void audioPlayerGainUpdate(CAudioPlayer *thiz);
48*bebae9c0SAndroid Build Coastguard Worker extern void IOutputMixExt_FillBuffer(SLOutputMixExtItf self, void *pBuffer, SLuint32 size);
49