eas_mixer.h 4.5 KB

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