Class FlacChannelStreamLine

All Implemented Interfaces:
AutoCloseable, DataLine, Line, SourceDataLine

public class FlacChannelStreamLine extends EncoderChannelStreamLine
Channel stream line for FLAC encoding.
  • Constructor Details

    • FlacChannelStreamLine

      public FlacChannelStreamLine(WritableByteChannel bc, AudioFormat format, boolean ogg, int comprLev, long writeAheadMillis, long timeoutMillis, int bufferSamples, int clientbufBytes) throws IOException, UnsupportedAudioFileException
      Constructs a line for encoding either native FLAC or Ogg FLAC. The clientbufBytes parameter exists because FLAC playing in some web browser stalls if it has less than a certain number of bytes to play, presumably because they wait for a buffer to fill. Recommended value is at least 32000 if the reciever is a web browser, which can corresponds to minutes of audio for highly compressible data (like silence). It can be 0 if receiver is known not to wait for any buffer to fill up.
      Parameters:
      bc - the channel to stream to, which must be non-blocking
      format - audio format of the PCM data written to this line
      ogg - true for Ogg FLAC, false for native FLAC
      comprLev - FLAC compression level
      writeAheadMillis - limit for how much to write ahead of what receiver has played; use Long.MAX_VALUE for unlimited
      timeoutMillis - time to wait when when write-ahead limit is reached
      bufferSamples - size of line buffer in number of sample frames
      clientbufBytes - at least the size of any receiver buffer size
      Throws:
      IOException
      UnsupportedAudioFileException
  • Method Details