Simple fix, just make sure we delete the hrtfs associated with the
killedNode. The test is to delete some nodes (agents) and make sure
nothing bad happens to audio mixer, or the audio itself.
Completely deleting hrtfs incorrectly. This seems to be better, we
only want to delete HRTF for the QUuid() stream for the killed node in each
node's list of HRTFs.
It could be past the end of the buffer if you changed sounds, and the
new one is shorter. Won't happen with our current tests, but that could
change, and in general no reason it couldn't happen.
Need to be sure we don't change the _isAvatar or
_isListeningToAudioStream from one thread while processing audio in
another. Also, fixed issue sending NLPacketList.
Turns out there was already a function for that, if you just call
removeHRTFForStream without a 2nd param, it appears to just delete
the audio with uuid of QUuid() which is the avatar's mic. That is
what we want, so cool.
AudioMixer has same issue transitioning from silence to encoded
audio and back, it seems. This makes that go away, but I don't
like it. Better to support a flush function in the encoder but
for now lets do this and be sure it is the entire issue.
Seems they have some state. So if you play a sound, then silence
that doesn't go through the encoder (SilentAudioFrame), then a
sound again, you will hear a click. Now, I just pop a frame of
0s through the encoder at the end of each .wav it plays. Poof!
Started with the horrible screaming when avatar goes away, seems
due to not putting a codec string in the packets. This was an existing
issue, not due to recent changes. Also, some weird indenting was
fixed, etc... Still hear an artifact when audio starts, but only when
a codec was negotiated. Hoping to fix that too.