Package ej.audio.sink

Class TcpAudioSender

java.lang.Object
ej.audio.sink.TcpAudioSender

public class TcpAudioSender extends Object
Streams decoded PCM audio frames to a remote TCP server.

Used to bypass the physical audio loopback during simulator testing: the decoded PCM bytes that are written to a SourceDataLine are also forwarded directly to a remote server for audio quality analysis.

  • Constructor Details

    • TcpAudioSender

      public TcpAudioSender(String host, int port) throws IOException
      Creates a TcpAudioSender connected to the given host and port.
      Parameters:
      host - the TCP server IP address or hostname.
      port - the TCP server port.
      Throws:
      IOException - if the connection cannot be established.
  • Method Details

    • send

      public void send(byte[] data, int offset, int length)
      Sends the given PCM audio bytes to the TCP server.
      Parameters:
      data - the buffer containing the audio data.
      offset - the start offset in the buffer.
      length - the number of bytes to send.
    • close

      public void close()
      Closes the TCP connection, signaling end-of-stream to the remote server.