AudioNodeEngineGeneric.h (2175B)
1 /* -*- mode: c++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* this source code form is subject to the terms of the mozilla public 3 * license, v. 2.0. if a copy of the mpl was not distributed with this file, 4 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 #ifndef MOZILLA_AUDIONODEENGINEGENERIC_H_ 7 #define MOZILLA_AUDIONODEENGINEGENERIC_H_ 8 9 #include "AudioNodeEngine.h" 10 #include "xsimd/xsimd.hpp" 11 12 namespace mozilla { 13 14 template <class Arch> 15 struct Engine { 16 static void AudioBufferAddWithScale(const float* aInput, float aScale, 17 float* aOutput, uint32_t aSize); 18 19 static void AudioBlockCopyChannelWithScale(const float* aInput, float aScale, 20 float* aOutput); 21 22 static void AudioBlockCopyChannelWithScale( 23 const float aInput[WEBAUDIO_BLOCK_SIZE], 24 const float aScale[WEBAUDIO_BLOCK_SIZE], 25 float aOutput[WEBAUDIO_BLOCK_SIZE]); 26 27 static void AudioBufferInPlaceScale(float* aBlock, float aScale, 28 uint32_t aSize); 29 30 static void AudioBufferInPlaceScale(float* aBlock, float* aScale, 31 uint32_t aSize); 32 33 static void AudioBlockPanStereoToStereo( 34 const float aInputL[WEBAUDIO_BLOCK_SIZE], 35 const float aInputR[WEBAUDIO_BLOCK_SIZE], float aGainL, float aGainR, 36 bool aIsOnTheLeft, float aOutputL[WEBAUDIO_BLOCK_SIZE], 37 float aOutputR[WEBAUDIO_BLOCK_SIZE]); 38 39 static void BufferComplexMultiply(const float* aInput, const float* aScale, 40 float* aOutput, uint32_t aSize); 41 42 static float AudioBufferSumOfSquares(const float* aInput, uint32_t aLength); 43 44 static void NaNToZeroInPlace(float* aSamples, size_t aCount); 45 46 static void AudioBlockPanStereoToStereo( 47 const float aInputL[WEBAUDIO_BLOCK_SIZE], 48 const float aInputR[WEBAUDIO_BLOCK_SIZE], 49 const float aGainL[WEBAUDIO_BLOCK_SIZE], 50 const float aGainR[WEBAUDIO_BLOCK_SIZE], 51 const bool aIsOnTheLeft[WEBAUDIO_BLOCK_SIZE], 52 float aOutputL[WEBAUDIO_BLOCK_SIZE], float aOutputR[WEBAUDIO_BLOCK_SIZE]); 53 }; 54 55 } // namespace mozilla 56 57 #endif