Author Topic: Sound System - VoiceChat?  (Read 1644 times)

Offline CreativeMD

  • byte
  • *
  • Posts: 19
    • View Profile
Sound System - VoiceChat?
« on: June 30, 2014, 08:49:58 AM »
Hello :),
i'm working on a VoiceChat mod for minecraft. Everything is done so far, but i have problems to play the recorded sound :(. I can't use the java api for playing the sound because the write method of SourceDataLine blocks until everything is played. So now i'm trying to use the paulscode sound libary, but it's not working :(.
I tried almost every combination of:
Code: [Select]
system.rawDataStream(VoiceChat.format, true, name, 0, 0, 0, SoundSystemConfig.ATTENUATION_ROLLOFF, SoundSystemConfig.getDefaultRolloff());
system.feedRawAudioData(name, data);
system.play(name);
But it didn't work at well, sometimes i have the problem that the stream is kind of replayed :O and sometimes the sound is cut off.
So i would be very happy if someone can tell me how this fix this problem.

This is my current handler of the packet:
Code: [Select]
public void executeClient(EntityPlayer player)
{
    if(system == null)
    system = getSoundSystem();

    String name = this.player;
   
    if(!system.playing(name))
    {
    system.rawDataStream(VoiceChat.format, true, name, 0, 0, 0, SoundSystemConfig.ATTENUATION_ROLLOFF, SoundSystemConfig.getDefaultRolloff());
    system.feedRawAudioData(name, data);

    System.out.println("Playing sound");
    }else{
    system.feedRawAudioData(name, data);
    }
}