Class AudioData

All Implemented Interfaces:
Direct Known Subclasses:
AndroidAudioData, AudioBuffer, AudioStream

public abstract class AudioData extends NativeObject
AudioData is an abstract representation of audio data. There are two ways to handle audio data, short audio files are to be stored entirely in memory, while long audio files (music) are streamed from the hard drive as they are played.
  • Field Details

    • sampleRate

      protected int sampleRate
    • channels

      protected int channels
    • bitsPerSample

      protected int bitsPerSample
  • Constructor Details

    • AudioData

      public AudioData()
    • AudioData

      protected AudioData(int id)
  • Method Details

    • getDataType

      public abstract AudioData.DataType getDataType()
      The data type, either Buffer or Stream.
    • getDuration

      public abstract float getDuration()
      the duration in seconds of the audio clip.
    • getBitsPerSample

      public int getBitsPerSample()
      Bits per single sample from a channel.
    • getChannels

      public int getChannels()
      Number of channels. 1 for mono, 2 for stereo, etc.
    • getSampleRate

      public int getSampleRate()
      The sample rate, or how many samples per second.
    • setupFormat

      public void setupFormat(int channels, int bitsPerSample, int sampleRate)
      Sets the format of the audio data.
      channels - # of channels, 1 = mono, 2 = stereo
      bitsPerSample - Bits per sample, e.g 8 bits, 16 bits.
      sampleRate - Sample rate, 44100, 22050, etc.