Class OggSpeexWriter

java.lang.Object
javaforce.codec.speex.AudioFileWriter
javaforce.codec.speex.OggSpeexWriter

public class OggSpeexWriter extends AudioFileWriter
Ogg Speex Writer
Version:
$Revision$
Author:
Marc Gimpel, Wimba S.A. (mgimpel@horizonwimba.com)
  • Field Details

    • PACKETS_PER_OGG_PAGE

      public static final int PACKETS_PER_OGG_PAGE
      Number of packets in an Ogg page (must be less than 255)
      See Also:
  • Constructor Details

    • OggSpeexWriter

      public OggSpeexWriter()
      Builds an Ogg Speex Writer.
    • OggSpeexWriter

      public OggSpeexWriter(int mode, int sampleRate, int channels, int nframes, boolean vbr)
      Builds an Ogg Speex Writer.
      Parameters:
      mode - the mode of the encoder (0=NB, 1=WB, 2=UWB).
      sampleRate - the number of samples per second.
      channels - the number of audio channels (1=mono, 2=stereo, ...).
      nframes - the number of frames per speex packet.
      vbr -
  • Method Details

    • setSerialNumber

      public void setSerialNumber(int serialNumber)
      Sets the Stream Serial Number. Must not be changed mid stream.
      Parameters:
      serialNumber -
    • close

      public void close() throws IOException
      Closes the output file.
      Specified by:
      close in class AudioFileWriter
      Throws:
      IOException - if there was an exception closing the Audio Writer.
    • open

      public void open(File file) throws IOException
      Open the output file.
      Specified by:
      open in class AudioFileWriter
      Parameters:
      file - - file to open.
      Throws:
      IOException - if there was an exception opening the Audio Writer.
    • open

      public void open(String filename) throws IOException
      Open the output file.
      Specified by:
      open in class AudioFileWriter
      Parameters:
      filename - - file to open.
      Throws:
      IOException - if there was an exception opening the Audio Writer.
    • writeHeader

      public void writeHeader(String comment) throws IOException
      Writes the header pages that start the Ogg Speex file. Prepares file for data to be written.
      Specified by:
      writeHeader in class AudioFileWriter
      Parameters:
      comment - description to be included in the header.
      Throws:
      IOException
    • writePacket

      public void writePacket(byte[] data, int offset, int len) throws IOException
      Writes a packet of audio.
      Specified by:
      writePacket in class AudioFileWriter
      Parameters:
      data - - audio data.
      offset - - the offset from which to start reading the data.
      len - - the length of data to read.
      Throws:
      IOException