| 216 | } |
| 217 | |
| 218 | void SteamAudioMixReturnFX::Execute(AkAudioBuffer* in_pBuffer, AkUInt32 in_uInOffset, AkAudioBuffer* out_pBuffer) |
| 219 | { |
| 220 | AKASSERT(in_pBuffer->uValidFrames == out_pBuffer->MaxFrames()); |
| 221 | AKASSERT(in_uInOffset == 0); |
| 222 | |
| 223 | // -- clear actual output |
| 224 | |
| 225 | for (AkUInt32 i = 0; i < out_pBuffer->NumChannels(); ++i) |
| 226 | { |
| 227 | memset(out_pBuffer->GetChannel(i), 0, out_pBuffer->MaxFrames() * sizeof(float)); |
| 228 | } |
| 229 | |
| 230 | // -- ensure everything is initialized |
| 231 | |
| 232 | if (LazyInit() != AK_Success) |
| 233 | { |
| 234 | out_pBuffer->eState = AK_Fail; |
| 235 | return; |
| 236 | } |
| 237 | |
| 238 | auto& globalState = SteamAudioWwise::GlobalState::Get(); |
| 239 | |
| 240 | auto context = globalState.context.Read(); |
| 241 | auto hrtf = globalState.hrtf.Read(); |
| 242 | |
| 243 | // -- clear input and output |
| 244 | |
| 245 | for (IPLint32 i = 0; i < m_inBuffer.numChannels; ++i) |
| 246 | { |
| 247 | memset(m_inBuffer.data[i], 0, m_inBuffer.numSamples * sizeof(IPLfloat32)); |
| 248 | } |
| 249 | |
| 250 | for (IPLint32 i = 0; i < m_outBuffer.numChannels; ++i) |
| 251 | { |
| 252 | memset(m_outBuffer.data[i], 0, m_outBuffer.numSamples * sizeof(IPLfloat32)); |
| 253 | } |
| 254 | |
| 255 | // -- copy input |
| 256 | |
| 257 | auto numSamplesConsumed = std::min(in_pBuffer->uValidFrames, (AkUInt16) m_inBuffer.numSamples); |
| 258 | for (AkUInt32 i = 0; i < std::min(in_pBuffer->NumChannels(), (AkUInt32) m_inBuffer.numChannels); ++i) |
| 259 | { |
| 260 | memcpy(m_inBuffer.data[i], in_pBuffer->GetChannel(i), numSamplesConsumed * sizeof(IPLfloat32)); |
| 261 | } |
| 262 | |
| 263 | // -- calculate source and listener positions |
| 264 | |
| 265 | bool bUseGamePosition = !SteamAudioWwise::IsRunningInEditor(); |
| 266 | IPLCoordinateSpace3 listenerCoords{}; |
| 267 | |
| 268 | if (!bUseGamePosition) |
| 269 | { |
| 270 | listenerCoords.origin = { 0, 0, 0 }; |
| 271 | listenerCoords.right = { 1, 0, 0 }; |
| 272 | listenerCoords.up = { 0, 1, 0 }; |
| 273 | listenerCoords.ahead = { 0, 0, -1 }; |
| 274 | } |
| 275 | else |
nothing calls this directly
no test coverage detected