When I "fixed" my or instead of and issue, I did it in the wrong
direction. But it looked right :) Now it is. Sigh. Long story
how it got there, but it seems good now.
Code a bit more readable. Sadly (and I guess it makes sense), a
enum class XXX is not a class, so you cannot have member functions
for it. I can imagine no way to have a vtable if you are really
representing it as a uint8_t or whatever. So, I put a stateHas
function in the AudioInjector instead. Definite improvement.
So gotta keep track of when finished streaming to network and
locally separately. That means the State needed to be more of a
bitflag and less of an enum.
The initial HRTF reduced overall gain by -6dB to avoid clipping at spectral peaks. With the addition of a peak limiter, this is no longer necessary. Changing to 0dB improves the loudness match between spatialized and unspatialized sounds.
Adds a distance filter to model the frequency-dependent attenuation of sound propagation in open air.
Optimized using SIMD and computing all biquads in parallel. Performance impact is almost zero.
Filter updates are continuously interpolated and clean to -90dB.
Not enabled yet (distance hardcoded to 0.0f)
Since the stereo option is computed from the .wav file, if you call
setOptions later (like the cow.js does), it resets stereo to false.
So, I now just copy the stereo flag into the new options, since the
sound file is the same.
Also, calling AudioClient::outputLocalInjector on the AudioClient
thread now to avoid potential concurrency issues accessing the
vector of injectors.
Probably need to clean up a bit, but wanted to get this out there
for comment on more general issues, etc...
To test, I added a localOnly: true to the cow in the tutorial.
When downsampling 48khz to 24khz, linear interpolation creates aliasing distortion that is quite audible. This change greatly improves the audio quality for all sound assets.