phonon works by default when no mesh is provided;

This commit is contained in:
bjorn 2021-04-02 21:22:15 -06:00
parent 618fb2ed2f
commit 6ae0d9f96a
1 changed files with 4 additions and 2 deletions

View File

@ -231,7 +231,7 @@ uint32_t phonon_apply(Source* source, const float* input, float* output, uint32_
float radius = 0.f;
IPLint32 rays = 0;
if (lovrSourceIsEffectEnabled(source, EFFECT_OCCLUSION)) {
if (state.mesh && lovrSourceIsEffectEnabled(source, EFFECT_OCCLUSION)) {
bool transmission = lovrSourceIsEffectEnabled(source, EFFECT_TRANSMISSION);
occlusion = transmission ? IPL_DIRECTOCCLUSION_TRANSMISSIONBYFREQUENCY : IPL_DIRECTOCCLUSION_NOTRANSMISSION;
radius = lovrSourceGetRadius(source);
@ -257,7 +257,7 @@ uint32_t phonon_apply(Source* source, const float* input, float* output, uint32_
IPLHrtfInterpolation interpolation = IPL_HRTFINTERPOLATION_NEAREST;
phonon_iplApplyBinauralEffect(state.binauralEffect[index], state.binauralRenderer, tmp, path.direction, interpolation, blend, out);
if (lovrSourceIsEffectEnabled(source, EFFECT_REVERB)) {
if (state.mesh && lovrSourceIsEffectEnabled(source, EFFECT_REVERB)) {
phonon_iplSetDryAudioForConvolutionEffect(state.convolutionEffect[index], iplSource, in);
}
@ -265,6 +265,8 @@ uint32_t phonon_apply(Source* source, const float* input, float* output, uint32_
}
uint32_t phonon_tail(float* scratch, float* output, uint32_t frames) {
if (!state.mesh) return 0;
IPLAudioBuffer out = { .format = STEREO, .numSamples = frames, .interleavedBuffer = output };
IPLAudioBuffer tmp = {