Class SoundSample

java.lang.Object
icyllis.modernui.audio.SoundSample
All Implemented Interfaces:
AutoCloseable
Direct Known Subclasses:
VorbisPullDecoder

public abstract class SoundSample extends Object implements AutoCloseable
Sampled sound provides uncompressed PCM audio samples decoded from an InputStream or a FileChannel. This is the pulling API.
  • Field Details

    • mSampleRate

      protected int mSampleRate
    • mChannels

      protected int mChannels
    • mTotalSamples

      protected int mTotalSamples
  • Constructor Details

    • SoundSample

      public SoundSample()
  • Method Details

    • getSampleRate

      public int getSampleRate()
    • getChannels

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

      public int getTotalSamples()
      Get numbers of samples in one channel.
      Returns:
      total samples
    • getTotalLength

      public float getTotalLength()
      Get the length of the sound in seconds.
      Returns:
      total length
    • seek

      public abstract boolean seek(int sampleOffset)
      Returns:
      success or not
    • getSamplesShortInterleaved

      public abstract int getSamplesShortInterleaved(ShortBuffer pcmBuffer)
      Returns:
      samples per channel
    • close

      public abstract void close()
      Specified by:
      close in interface AutoCloseable