The bug:

Specific clients hardware causes 3d mixing when utilizing onEditMixedPlaybackVoiceDataEvent to have drastically reduced volume. We have debugged this entirely on our side with known values, and can reproduce on target client machines that remixing is occurring post-onEditMixedPlaybackVoiceDataEvent causing volume reduction on the return values of this function. This is NOT due to client configuration nor setup as far as the plugin is aware; we are strictly configured in a Stereo setup, however the bug shows evidence of non-stereo mixing occurring. Additionally, this does not occur when utilizing the in-client TS3 3d functions; we perform our own 3d mixing and simply feed the sample data out via onEditMixedPlaybackVoiceDataEvent.

In summation, TS3 is performing some sort of mixing after onEditMixedPlaybackVoiceDataEvent which is causing reduced volume on some clients only.

The series of events is as follows, as performed on matching system setups with strictly differently hardware/drivers.

1. we capture the sample data in onEditPlaybackVoiceDataEvent, we then zero the samples returned to perform our own processing. Code as follows:
void ts3plugin_onEditPlaybackVoiceDataEvent(uint64 server, anyID id, short* samples, int sampleCount, int channels) {
	CEngine::getInstance()->getSoundEngine()->onEditPlaybackVoiceDataEvent((ACRE_ID)id, samples, sampleCount, channels);
	maxSample = std::max(maxSample, samples[0]);
2. We mix the samples down through our own X3DAudio; the is initialized with the parameters provided by onEditMixedPlaybackVoiceDataEvent - in our test cases, the channelSpeakerMask provided is 0x00000003, or stereo with SPEAKER_LEFT and SPEAKER_RIGHT.

3. We feed back the 3d positionally mixed audio via onEditMixedPlaybackVoiceDataEvent, code as follows:
void ts3plugin_onEditMixedPlaybackVoiceDataEvent(uint64 serverConnectionHandlerID, short* samples, int sampleCount, int channels, const unsigned int* channelSpeakerArray, unsigned int* channelFillMask) {
	if (CEngine::getInstance()->getSoundSystemOverride())
	if (!CEngine::getInstance()->getGameServer())
	if (!CEngine::getInstance()->getGameServer()->getConnected())
	UINT32 speakerMask = 0;
	if (!((CTS3Client *)(CEngine::getInstance()->getClient()))->getIsX3DInitialized())
		for (int c = 0; c < channels; c++) {
			//LOG("c: %d i: %08x o: %08x", c, channelSpeakerArray[c], this->getChannelMask(channelSpeakerArray[c]));
			speakerMask |= channelSpeakerArray[c];
		LOG("Speaker setup init: %08x [%dx%d] (2CH = %08x, 5.1CH = %08x/%08x, 7.1CH = %08x/%08x)", speakerMask, sampleCount, channels, SPEAKER_STEREO, SPEAKER_5POINT1, SPEAKER_5POINT1_SURROUND, SPEAKER_7POINT1, SPEAKER_7POINT1_SURROUND);
		((CTS3Client *)(CEngine::getInstance()->getClient()))->setIsX3DInitialized(TRUE);
		((CTS3Client *)(CEngine::getInstance()->getClient()))->setSpeakerMask(speakerMask);
		speakerMask = ((CTS3Client *)(CEngine::getInstance()->getClient()))->getSpeakerMask();
	*channelFillMask = (1 << channels) - 1;

	CEngine::getInstance()->getSoundEngine()->onEditMixedPlaybackVoiceDataEvent(samples, sampleCount, channels, speakerMask);
We have checked the above code by feeding known values, such as feeding sine waves at specific volumes out via onEditMixedPlaybackVoiceDataEvent. On these affected clients, the volume is reduced by Teamspeak regardless of us ignoring user speaking data and replacing it with any audio data of our own; this proves that TS3 is in fact performing some sort of processing on the samples after this event.

In the above example and our test cases, we can perform this with 2 side by side systems, one with Asus Realtek and the other with MSI Realtek. Both are configured for Stereo, with virtual surround off. Both return 0x00000003 for their speaker setup and all channel/sample/fill values match between the two clients. One will work correctly (the Asus Realtek), while the MSI Realtek will have drastically reduced volume.

Suspected Causes:
1. TS3 is remixing the channels again after onEditMixedPlaybackVoiceDataEvent with incorrect mixing information. The volume reduction seems indicative of the data from onEditMixedPlaybackVoiceDataEvent being remixed to 5.1 and then back to stereo again, except correct channel summation is not occurring. Meaning, perhaps the audio data is getting split across 2-3 channels per side, and then only a single channel is actually being used to output audio - thus the played audio data is 3 times quieter.

2. TS3 is providing the Plugin SDK with incorrect speaker mask information, and as such the channels are not being filled correctly.


We currently have about 15-20% of users hardware setups affected with this issue; it appears to be hardware specific, as system rebuilds do not solve this issue. Additionally - again, it appears the built-in TS3 3d surround mixing is not affected by this bug, and strictly onEditMixedPlaybackVoiceDataEvent surround samples are. I would investigate what differences are occurring between mixing onEditMixedPlaybackVoiceDataEvent samples and TS3 performing 3d mixing, as it somehow compensates for this issue.