Class CombinedAudio


  • public class CombinedAudio
    extends java.lang.Object
    Represents a packet of combined audio data from 0 to n Users.
    • Constructor Summary

      Constructors 
      Constructor Description
      CombinedAudio​(java.util.List<User> users, short[] audioData)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] getAudioData​(double volume)
      Provides 20 Milliseconds of combined audio data in 48KHz 16bit stereo signed BigEndian PCM.
      java.util.List<User> getUsers()
      An unmodifiable list of all Users that provided audio that was combined.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CombinedAudio

        public CombinedAudio​(@Nonnull
                             java.util.List<User> users,
                             @Nonnull
                             short[] audioData)
    • Method Detail

      • getUsers

        @Nonnull
        public java.util.List<User> getUsers()
        An unmodifiable list of all Users that provided audio that was combined.
        Basically: This is a list of all users that can be heard in the data returned by getAudioData(double)

        NOTE: If no users were speaking, this list is empty and getAudioData(double) provides silent audio data.

        Returns:
        Never-null list of all users that provided audio.
      • getAudioData

        @Nonnull
        public byte[] getAudioData​(double volume)
        Provides 20 Milliseconds of combined audio data in 48KHz 16bit stereo signed BigEndian PCM.
        Format defined by: AudioReceiveHandler.OUTPUT_FORMAT.

        The output volume of the data can be modified by the provided `volume` parameter. `1.0` is considered to be 100% volume.
        Going above `1.0` can increase the volume further, but you run the risk of audio distortion.

        NOTE: If no users were speaking, this provides silent audio and getUsers() returns an empty list!

        Parameters:
        volume - Value used to modify the "volume" of the returned audio data. 1.0 is normal volume.
        Returns:
        Never-null byte array of PCM data defined by AudioReceiveHandler.OUTPUT_FORMAT