Class SoundStream

java.lang.Object
icyllis.modernui.audio.SoundStream
All Implemented Interfaces:
AutoCloseable
Direct Known Subclasses:
VorbisPushDecoder

public abstract class SoundStream extends Object implements AutoCloseable
Sound stream provides uncompressed PCM audio samples decoded from an InputStream or a FileChannel. This is the pushing API, no seeking.
  • Field Details

    • mSampleRate

      protected int mSampleRate
    • mChannels

      protected int mChannels
    • mSampleOffset

      protected int mSampleOffset
  • Constructor Details

    • SoundStream

      public SoundStream()
  • Method Details

    • getSampleRate

      public int getSampleRate()
    • getChannels

      public int getChannels()
      Get numbers of channels, either 1 or 2.
      Returns:
      numbers of channels
    • getSampleOffset

      public int getSampleOffset()
      Get sample offset of the start of next frame.
      Returns:
      offset in samples
    • decodeFrame

      @Nullable public abstract FloatBuffer decodeFrame(@Nullable FloatBuffer output) throws IOException
      Throws:
      IOException
    • close

      public abstract void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Throws:
      IOException
    • f_to_s16

      public static short f_to_s16(float s)
    • s16_to_f

      public static float s16_to_f(short s)