Home | History | Annotate | Download | only in lib_src
      1 /*----------------------------------------------------------------------------
      2  *
      3  * File:
      4  * eas_mixer.h
      5  *
      6  * Contents and purpose:
      7  * This file contains the critical components of the mix engine that
      8  * must be optimized for best performance.
      9  *
     10  * Copyright Sonic Network Inc. 2005
     11 
     12  * Licensed under the Apache License, Version 2.0 (the "License");
     13  * you may not use this file except in compliance with the License.
     14  * You may obtain a copy of the License at
     15  *
     16  *      http://www.apache.org/licenses/LICENSE-2.0
     17  *
     18  * Unless required by applicable law or agreed to in writing, software
     19  * distributed under the License is distributed on an "AS IS" BASIS,
     20  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     21  * See the License for the specific language governing permissions and
     22  * limitations under the License.
     23  *
     24  *----------------------------------------------------------------------------
     25  * Revision Control:
     26  *   $Revision: 706 $
     27  *   $Date: 2007-05-31 17:22:51 -0700 (Thu, 31 May 2007) $
     28  *----------------------------------------------------------------------------
     29 */
     30 
     31 #ifndef _EAS_MIXER_H
     32 #define _EAS_MIXER_H
     33 
     34 //3 dls: This module is in the midst of being converted from a synth
     35 //3 specific module to a general purpose mix engine
     36 
     37 #define MIX_FLAGS_STEREO_SOURCE     1
     38 #define MIX_FLAGS_STEREO_OUTPUT     2
     39 #define NUM_MIXER_GUARD_BITS        4
     40 
     41 #include "eas_effects.h"
     42 
     43 extern void SynthMasterGain( long *pInputBuffer, EAS_PCM *pOutputBuffer, EAS_U16 nGain, EAS_U16 nNumLoopSamples);
     44 
     45 /*----------------------------------------------------------------------------
     46  * EAS_MixEngineInit()
     47  *----------------------------------------------------------------------------
     48  * Purpose:
     49  * Prepares the mix engine for work, allocates buffers, locates effects modules, etc.
     50  *
     51  * Inputs:
     52  * pEASData         - instance data
     53  * pInstData        - pointer to variable to receive instance data handle
     54  *
     55  * Outputs:
     56  *
     57  * Side Effects:
     58  *
     59  *----------------------------------------------------------------------------
     60 */
     61 EAS_RESULT EAS_MixEngineInit (EAS_DATA_HANDLE pEASData);
     62 
     63 /*----------------------------------------------------------------------------
     64  * EAS_MixEnginePrep()
     65  *----------------------------------------------------------------------------
     66  * Purpose:
     67  * Performs prep before synthesize a buffer of audio, such as clearing
     68  * audio buffers, etc.
     69  *
     70  * Inputs:
     71  * psEASData - pointer to overall EAS data structure
     72  *
     73  * Outputs:
     74  *
     75  * Side Effects:
     76  *
     77  *----------------------------------------------------------------------------
     78 */
     79 void EAS_MixEnginePrep (EAS_DATA_HANDLE pEASData, EAS_I32 nNumSamplesToAdd);
     80 
     81 /*----------------------------------------------------------------------------
     82  * EAS_MixEnginePost
     83  *----------------------------------------------------------------------------
     84  * Purpose:
     85  * This routine does the post-processing after all voices have been
     86  * synthesized. It calls any sweeteners and does the final mixdown to
     87  * the output buffer.
     88  *
     89  * Inputs:
     90  *
     91  * Outputs:
     92  *
     93  * Notes:
     94  *----------------------------------------------------------------------------
     95 */
     96 void EAS_MixEnginePost (EAS_DATA_HANDLE pEASData, EAS_I32 nNumSamplesToAdd);
     97 
     98 /*----------------------------------------------------------------------------
     99  * EAS_MixEngineShutdown()
    100  *----------------------------------------------------------------------------
    101  * Purpose:
    102  * Shuts down effects modules and deallocates memory
    103  *
    104  * Inputs:
    105  * pEASData         - instance data
    106  * pInstData        - instance data handle
    107  *
    108  * Outputs:
    109  *
    110  * Side Effects:
    111  *
    112  *----------------------------------------------------------------------------
    113 */
    114 EAS_RESULT EAS_MixEngineShutdown (EAS_DATA_HANDLE pEASData);
    115 
    116 #ifdef UNIFIED_MIXER
    117 /*----------------------------------------------------------------------------
    118  * EAS_MixStream
    119  *----------------------------------------------------------------------------
    120  * Mix a 16-bit stream into a 32-bit buffer
    121  *
    122  * pInputBuffer 16-bit input buffer
    123  * pMixBuffer   32-bit mix buffer
    124  * numSamples   number of samples to mix
    125  * gainLeft     initial gain left or mono
    126  * gainRight    initial gain right
    127  * gainLeft     left gain increment per sample
    128  * gainRight    right gain increment per sample
    129  * flags        bit 0 = stereo source
    130  *              bit 1 = stereo output
    131  *----------------------------------------------------------------------------
    132 */
    133 void EAS_MixStream (EAS_PCM *pInputBuffer, EAS_I32 *pMixBuffer, EAS_I32 numSamples, EAS_I32 gainLeft, EAS_I32 gainRight, EAS_I32 gainIncLeft, EAS_I32 gainIncRight, EAS_I32 flags);
    134 #endif
    135 
    136 #endif /* #ifndef _EAS_MIXER_H */
    137 
    138