jmri.jmrit.sound
Class WavBuffer

java.lang.Object
  extended by jmri.jmrit.sound.WavBuffer

public class WavBuffer
extends Object

Wrap a byte array to provide WAV file functionality

Author:
Bob Jacobsen Copyright (C) 2006

Constructor Summary
WavBuffer(byte[] content)
          Create from already existing byte array.
WavBuffer(File file)
          Create from contents of file.
 
Method Summary
 int findHeader(int i1, int i2, int i3, int i4)
          Find a specific header in the .wav fragment
 boolean getBigEndian()
           
 byte[] getByteArray()
           
 int getChannels()
           
 int getDataEnd()
          Offset to the last data byte in the buffer.
 int getDataSize()
          Size of the data segment in bytes
 int getDataStart()
          Offset to the first data byte in the buffer
 float getSampleRate()
           
 int getSampleSizeInBits()
           
 boolean getSigned()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WavBuffer

public WavBuffer(byte[] content)
Create from already existing byte array. The array is expected to be in .wav format, starting with a RIFF header.


WavBuffer

public WavBuffer(File file)
          throws IOException
Create from contents of file. The file contents are expected to be in .wav format, starting with a RIFF header.

Throws:
IOException
Method Detail

findHeader

public int findHeader(int i1,
                      int i2,
                      int i3,
                      int i4)
Find a specific header in the .wav fragment

Returns:
offset of the 1st byte of the header in the buffer

getSampleRate

public float getSampleRate()

getSampleSizeInBits

public int getSampleSizeInBits()

getChannels

public int getChannels()

getBigEndian

public boolean getBigEndian()

getSigned

public boolean getSigned()

getDataStart

public int getDataStart()
Offset to the first data byte in the buffer


getDataSize

public int getDataSize()
Size of the data segment in bytes


getDataEnd

public int getDataEnd()
Offset to the last data byte in the buffer. One more than this points to the next header.


getByteArray

public byte[] getByteArray()


Copyright © 1997 - 2011 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads