Class WAVData


  • public final class WAVData
    extends Object
    This class is a holder for WAV (.wav ) file Data returned from the WavLoader, or directly via #loadFromStream(InputStream, int, int, int).
    Author:
    Athomas Goldberg, et.al.
    • Field Detail

      • data

        public final ByteBuffer data
        The audio data
      • format

        public final int format
        the format of the Data. One of:
         AL.AL_FORMAT_MONO8
         AL.AL_FORMAT_MONO16
         AL.AL_FORMAT_STEREO8
         AL.AL_FORMAT_STEREO16
         
      • size

        public final int size
        Size (in bytes) of the data
      • freq

        public final int freq
        The frequency of the data
      • loop

        public final boolean loop
        flag indicating whether or not the sound in the data should loop
    • Constructor Detail

      • WAVData

        public WAVData​(ByteBuffer data,
                       int format,
                       int size,
                       int freq,
                       boolean loop)
    • Method Detail

      • loadFromStream

        public static WAVData loadFromStream​(InputStream aIn,
                                             int byteCount,
                                             int numChannels,
                                             int bits,
                                             int sampleRate,
                                             ByteOrder byteOrder,
                                             boolean loop)
                                      throws IOException
        This method loads a (.wav) file into a WAVData object.
        Parameters:
        aIn - An InputStream for the .WAV stream
        byteCount - byte count of expected wav data to be read
        numChannels -
        bits -
        sampleRate -
        byteOrder -
        Returns:
        a WAVData object containing the audio data
        Throws:
        UnsupportedAudioFileException - if the format of the audio if not supported.
        IOException - If the file can no be found or some other IO error occurs