| 103 | } |
| 104 | |
| 105 | IPLAudioEffectState CAmbisonicsDecodeEffect::apply(IPLAmbisonicsDecodeEffectParams* params, |
| 106 | IPLAudioBuffer* in, |
| 107 | IPLAudioBuffer* out) |
| 108 | { |
| 109 | auto _effect = mHandle.get(); |
| 110 | if (!_effect) |
| 111 | return IPL_AUDIOEFFECTSTATE_TAILCOMPLETE; |
| 112 | |
| 113 | auto _hrtf = (params->hrtf) ? reinterpret_cast<CHRTF*>(params->hrtf)->mHandle.get() : nullptr; |
| 114 | if (params->binaural && !_hrtf) |
| 115 | return IPL_AUDIOEFFECTSTATE_TAILCOMPLETE; |
| 116 | |
| 117 | AudioBuffer _in(in->numChannels, in->numSamples, in->data); |
| 118 | AudioBuffer _out(out->numChannels, out->numSamples, out->data); |
| 119 | |
| 120 | AmbisonicsDecodeEffectParams _params{}; |
| 121 | _params.order = params->order; |
| 122 | _params.orientation = reinterpret_cast<const CoordinateSpace3f*>(¶ms->orientation); |
| 123 | _params.binaural = (params->binaural == IPL_TRUE); |
| 124 | _params.hrtf = _hrtf.get(); |
| 125 | |
| 126 | return static_cast<IPLAudioEffectState>(_effect->apply(_params, _in, _out)); |
| 127 | } |
| 128 | |
| 129 | |
| 130 | // -------------------------------------------------------------------------------------------------------------------- |