|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgame.sound.CSoundFrameData
public class CSoundFrameData
Encapsulates frame data storage in a byte array. Supports mono/stereo, 8/16 bits, 22050/44100 Hz, little/big endian signed sound signals. Note: CSoundFrameData is not synchronized.
Field Summary | |
---|---|
private static int |
BYTES_PER_FRAME
|
private static int |
BYTES_PER_SAMPLE
|
private static int |
HIGH_BYTE
|
private static boolean |
IS_BIG_ENDIAN
|
private static boolean |
IS_SIGNED
|
private static int |
LOW_BYTE
|
private byte[] |
m_aFrameData
|
private int |
m_index
|
private static int |
MAX_AMPLITUDE
|
private static int |
NB_CHANNELS
|
Constructor Summary | |
---|---|
CSoundFrameData(int nbFrames)
Constructor, inits data array and checks sound player is signed. |
Method Summary | |
---|---|
private void |
checkSampleValue(int iSample)
Do a bit of bound checking if assertions are enabled. |
byte[] |
getByteArray()
Get the stored data. |
void |
putFrame(int iSample)
Inputs a mono sound frame. |
void |
putFrame(int iSample,
float fPanning)
Inputs a panned stereo (if applicable) sound frame. |
void |
putFrame(int iLeftSample,
int iRightSample)
Inputs a stereo (if applicable) sound frame. |
private void |
storeMonoFrame(int iSample)
Stores a mono frame in the byte array. |
private void |
storeStereoFrame(int iLeftSample,
int iRightSample)
Stores a stereo frame in the byte array. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final boolean IS_SIGNED
private static final boolean IS_BIG_ENDIAN
private static final int BYTES_PER_FRAME
private static final int MAX_AMPLITUDE
private static final int BYTES_PER_SAMPLE
private static final int NB_CHANNELS
private static final int LOW_BYTE
private static final int HIGH_BYTE
private byte[] m_aFrameData
private int m_index
Constructor Detail |
---|
public CSoundFrameData(int nbFrames)
nbFrames
- : exact number of frames that WILL be converted in bytes and stored.Method Detail |
---|
public final void putFrame(int iLeftSample, int iRightSample)
iLeftSample
and iRightSample
are blended.
Property : if left and right samples are within allowed bounds, blended sample value will be allowed too.
iLeftSample
- : the left sample value to be stored.iRightSample
- : the right sample value to be stored.public final void putFrame(int iSample, float fPanning)
iSample
- : the sample value to be panned and stored.fPanning
- : value of 0 means left speaker only, 1 means right speaker only.public final void putFrame(int iSample)
iSample
- : the mono sample value to be stored.public final byte[] getByteArray()
private final void checkSampleValue(int iSample)
iSample
- : the sample value to bound check.private final void storeMonoFrame(int iSample)
iSample
- : the sample value to convert in byte(s) and store.private final void storeStereoFrame(int iLeftSample, int iRightSample)
iLeftSample
- : the left sample value to convert in byte(s) and store.iRightSample
- : the right sample value to convert in byte(s) and store.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |