Package icyllis.modernui.audio

# 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 Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected int`
  `mChannels`
  `protected int`
  `mSampleRate`
  `protected int`
  `mTotalSamples`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SoundSample()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract void`
  `close()`
  `int`
  `getChannels()`
  Get numbers of channels, either 1 or 2.
  `int`
  `getSampleRate()`
  `abstract int`
  `getSamplesShortInterleaved(ShortBuffer pcmBuffer)`
  `float`
  `getTotalLength()`
  Get the length of the sound in seconds.
  `int`
  `getTotalSamples()`
  Get numbers of samples in one channel.
  `abstract boolean`
  `seek(int sampleOffset)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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`