Class VorbisStream

java.lang.Object
net.avadeaux.klipspringer.codec.ExternalEncodedStream
net.avadeaux.klipspringer.codec.VorbisStream
All Implemented Interfaces:
Closeable, AutoCloseable, AudioStream, Device.Player, PcmWriter

public class VorbisStream extends ExternalEncodedStream
Audio stream that sends Vorbis encoded data to a channel. Also doubles as file encoder class when created via fileEncoder.
  • Field Details

    • BIT_LAYOUT

      public static final Device.BitLayout BIT_LAYOUT
      The bit layout for PCM data sent to a Vorbis stream.
  • Constructor Details

    • VorbisStream

      public VorbisStream(PcmFormat format, float quality, double writeaheadSecs, double timeoutSecs, int holdingBytes, WritableByteChannel channel, Executor keepAlivePool, double keepAliveTimeoutSecs) throws IOException
      Creates an Ogg Vorbis stream with the given specifications and destination channel.

      The holdingBytes parameter is used when streaming to recipient that does not begin to process the input until it has accumulated a certain amount of compressed data, causing the recipient to potentially stall when receiving highly compressible sound (such as silence). In particular, web browsers sometimes do this. When streaming to a web browser, a reasonable value to prevent stalling is 49152. When the destination is a file or something else that does not process audio in real time, it can be set to 0.

      If keepAliveExec is non-null, it is used by ExternalEncodedStream.close() to execute a wait loop that terminates when either the recipient has sent callback notification of having played (almost) all the data it has been sent, or no callback is made for keepAliveTimeoutSecs seconds. (See also ExternalEncodedStream.drain().)

      Throws:
      IOException
  • Method Details