Modifier and Type | Field and Description |
---|---|
int |
channelCount
Number of channels.
|
boolean |
fixedP
Fixed or floating point values.
|
boolean |
littleEndian |
boolean |
planar
Planar or packed samples.
|
int |
sampleRate
Sample rate in Hz (1/s).
|
int |
sampleSize
Sample size in bits.
|
boolean |
signed |
Constructor and Description |
---|
AudioSink.AudioFormat(int sampleRate,
int sampleSize,
int channelCount,
boolean signed,
boolean fixedP,
boolean planar,
boolean littleEndian) |
Modifier and Type | Method and Description |
---|---|
int |
getBytesDuration(int byteCount)
Returns the duration in milliseconds of the given byte count
according to
sampleSize , channelCount and sampleRate . |
int |
getBytesSampleCount(int byteCount)
Returns the sample count of given byte count
according to the
sampleSize , i.e.: |
int |
getDurationsByteSize(int millisecs)
Returns the byte size of the given milliseconds
according to
sampleSize , channelCount and sampleRate . |
int |
getFrameCount(int millisecs,
float frameDuration)
Returns the rounded frame count of the given milliseconds and frame duration.
|
int |
getSamplesByteCount(int sampleCount)
Returns the byte size of given sample count
according to the
sampleSize , i.e.: |
float |
getSamplesDuration(int sampleCount)
Returns the duration in milliseconds of the given sample count per frame and channel
according to the
sampleRate , i.e. |
String |
toString() |
public final int sampleRate
public final int sampleSize
public final int channelCount
public final boolean signed
public final boolean fixedP
sampleSize
32, 'double' has sampleSize
64.public final boolean planar
public final boolean littleEndian
public AudioSink.AudioFormat(int sampleRate, int sampleSize, int channelCount, boolean signed, boolean fixedP, boolean planar, boolean littleEndian)
sampleRate
- sample rate in Hz (1/s)sampleSize
- sample size in bitschannelCount
- number of channelssigned
- true if signed number, false for unsignedfixedP
- true for fixed point value, false for unsigned floating point value with a sampleSize of 32 (float) or 64 (double)planar
- true for planar data package (each channel in own data buffer), false for packed data channels interleaved in one buffer.littleEndian
- true for little-endian, false for big endianpublic final int getDurationsByteSize(int millisecs)
sampleSize
, channelCount
and sampleRate
.
Time -> Byte Count
public final int getBytesDuration(int byteCount)
sampleSize
, channelCount
and sampleRate
.
Byte Count -> Time
public final float getSamplesDuration(int sampleCount)
sampleRate
, i.e.
( 1000f * sampleCount ) / sampleRate
Sample Count -> Time
sampleCount
- sample count per frame and channelpublic final int getFrameCount(int millisecs, float frameDuration)
Math.max( 1, millisecs / frameDuration + 0.5f )
Note: frameDuration
can be derived by sample count per frame and channel
via getSamplesDuration(int)
.
Frame Time -> Frame Count
millisecs
- time in millisecondsframeDuration
- duration per frame in milliseconds.public final int getSamplesByteCount(int sampleCount)
sampleSize
, i.e.:
sampleCount * ( sampleSize / 8 )
Note: To retrieve the byte size for all channels,
you need to pre-multiply sampleCount
with channelCount
.
Sample Count -> Byte Count
sampleCount
- sample countpublic final int getBytesSampleCount(int byteCount)
sampleSize
, i.e.:
( byteCount * 8 ) / sampleSize
Note: If byteCount
covers all channels and you request the sample size per channel,
you need to divide the result by sampleCount
by channelCount
.
Byte Count -> Sample Count
byteCount
- number of bytesCopyright 2010 JogAmp Community.