Audio Device Switch for specific users

Hi all,

I started to develop a new plugin to select another playback profile for a single user. Currently its just a non functional prototype. I am not a good c programmer, so I need some help to develop the necessary methods. :slight_smile:

Here is the project: GitHub - jonasesser/ts-audio-device-switch: This plugin adds a new Option to switch the audio device for a specific user. The idea was born on the roleplay GTA V server StateV. Where a small group of outlaws teamed up with the Teufel company to work together to counter music copyright issues.

Currently i am stucking at the main part. Maybe someone can help or provide example code for redirecting the audiostream to another playback profile:

*TODO Device Switch
1. Check ClientID
2. Select Playback Device
*/
void ts3plugin_onEditPostProcessVoiceDataEvent(uint64 serverConnectionHandlerID, anyID clientID, short* samples, int sampleCount, int channels, const unsigned int* channelSpeakerArray, unsigned int* channelFillMask) {
	    if (clientID == copyrightClaimClients[0]) {
		//Client is in copyright claim list. Redirect audio to selected playback profile.
		//ts3Functions.logMessage("PostProcessVoiceDataEvent", LogLevel_INFO, "ts- 
   audio-device-switch", serverConnectionHandlerID);
	    }
}

Any advice or contribution is very welcome!

Thanks,
Jonas

1 Like

The first prototype is now working. However, implemented differently than planned:

/*TODO Device Switch
1. Check ClientID
2. Select Playback Device
*/
void ts3plugin_onEditPostProcessVoiceDataEvent(uint64 serverConnectionHandlerID, anyID clientID, short* samples, int sampleCount, int channels, const unsigned int* channelSpeakerArray, unsigned int* channelFillMask) {
	if (clientID == copyrightClaimClients[0]) {
		//Client is in copyright claim list. Redirect audio to selected playback profile.
		//ts3Functions.logMessage("Teufelswerk PostProcessVoiceDataEvent", LogLevel_INFO, "ts-audio-device-switch", serverConnectionHandlerID);
		//Reroute the sound
		if (*channelFillMask != 0)
		{
			*channelFillMask = SPEAKER_FRONT_CENTER;
		}
	}
}

Explanation: The prototype does not really change the audio device but switches the Teamspeak sound of the selected user to the center box. This means that the sound is no longer sent to the stream. By upscaling and switching from surround to mono it is then possible that the streamer himself can still enjoy the sound.

Is it possible to change a client/user name or just highlight the name? Donβ€˜t find a function in the sdk for this functionality.