Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - DevTastisch

Pages: [1]
1
Other Support / parallel pcm audio streams minecraft 1.8.9 problem
« on: February 27, 2020, 04:44:48 AM »
Hey,

I am currently working on an Opus codec based voicechat modification for minecraft 1.8.9.
While preparing an audio stream for a player I do the following:

this.sndSystem.rawDataStream(audioFormat, true, audioSourceName, 0f, 0f, 0f, SoundSystemConfig.ATTENUATION_LINEAR, this.voiceChat.getSurroundRange());


When receiving audio data from another client I try to play it with this:

this.sndSystem.feedRawAudioData(audioSourceName, latencyBuffer.get());
this.sndSystem.play(audioSourceName);

And so far this works like a charm, while the client only receives one single audio stream.
But as soon as I start streaming a second audio from another client, that system fails.

It feels like this method call is synchronized. It is clearly to hear, that one audio chunk from stream1 is played, and then one from stream2 and from there it goes in a loop.

I captured my test. At first you can hear a 100hz sin wave for a few seconds. This sounds very clear.
After that you can hear a 1000hz sin wave. This is very clear too. In the End both sounds are combined.

Both sounds do have different source names and are called from different threads. But it is clear to hear that the streams are not merged or something like that. It is more like a race condition between them who can playback the audio chunk first.

I know minecraft 1.8.9 is quite old and there are probably some library updates since release, but I couldn't find any documentation to that so I thought I ask here for some help.

Pages: [1]