Fields Summary |
---|
public static final int | ENCODING_INVALIDInvalid audio data format |
public static final int | ENCODING_DEFAULTDefault audio data format |
public static final int | ENCODING_PCM_16BITAudio data format: PCM 16 bit per sample. Guaranteed to be supported by devices. |
public static final int | ENCODING_PCM_8BITAudio data format: PCM 8 bit per sample. Not guaranteed to be supported by devices. |
public static final int | ENCODING_PCM_FLOATAudio data format: single-precision floating-point per sample |
public static final int | ENCODING_AC3Audio data format: AC-3 compressed |
public static final int | ENCODING_E_AC3Audio data format: E-AC-3 compressed |
public static final int | CHANNEL_CONFIGURATION_INVALID |
public static final int | CHANNEL_CONFIGURATION_DEFAULT |
public static final int | CHANNEL_CONFIGURATION_MONO |
public static final int | CHANNEL_CONFIGURATION_STEREO |
public static final int | CHANNEL_INVALIDInvalid audio channel mask |
public static final int | CHANNEL_OUT_DEFAULTDefault audio channel mask |
public static final int | CHANNEL_OUT_FRONT_LEFT |
public static final int | CHANNEL_OUT_FRONT_RIGHT |
public static final int | CHANNEL_OUT_FRONT_CENTER |
public static final int | CHANNEL_OUT_LOW_FREQUENCY |
public static final int | CHANNEL_OUT_BACK_LEFT |
public static final int | CHANNEL_OUT_BACK_RIGHT |
public static final int | CHANNEL_OUT_FRONT_LEFT_OF_CENTER |
public static final int | CHANNEL_OUT_FRONT_RIGHT_OF_CENTER |
public static final int | CHANNEL_OUT_BACK_CENTER |
public static final int | CHANNEL_OUT_SIDE_LEFT |
public static final int | CHANNEL_OUT_SIDE_RIGHT |
public static final int | CHANNEL_OUT_TOP_CENTER |
public static final int | CHANNEL_OUT_TOP_FRONT_LEFT |
public static final int | CHANNEL_OUT_TOP_FRONT_CENTER |
public static final int | CHANNEL_OUT_TOP_FRONT_RIGHT |
public static final int | CHANNEL_OUT_TOP_BACK_LEFT |
public static final int | CHANNEL_OUT_TOP_BACK_CENTER |
public static final int | CHANNEL_OUT_TOP_BACK_RIGHT |
public static final int | CHANNEL_OUT_MONO |
public static final int | CHANNEL_OUT_STEREO |
public static final int | CHANNEL_OUT_QUAD |
public static final int | CHANNEL_OUT_QUAD_SIDE |
public static final int | CHANNEL_OUT_SURROUND |
public static final int | CHANNEL_OUT_5POINT1 |
public static final int | CHANNEL_OUT_5POINT1_SIDE |
public static final int | CHANNEL_OUT_7POINT1 |
public static final int | CHANNEL_OUT_7POINT1_SURROUND |
public static final int | CHANNEL_IN_DEFAULT |
public static final int | CHANNEL_IN_LEFT |
public static final int | CHANNEL_IN_RIGHT |
public static final int | CHANNEL_IN_FRONT |
public static final int | CHANNEL_IN_BACK |
public static final int | CHANNEL_IN_LEFT_PROCESSED |
public static final int | CHANNEL_IN_RIGHT_PROCESSED |
public static final int | CHANNEL_IN_FRONT_PROCESSED |
public static final int | CHANNEL_IN_BACK_PROCESSED |
public static final int | CHANNEL_IN_PRESSURE |
public static final int | CHANNEL_IN_X_AXIS |
public static final int | CHANNEL_IN_Y_AXIS |
public static final int | CHANNEL_IN_Z_AXIS |
public static final int | CHANNEL_IN_VOICE_UPLINK |
public static final int | CHANNEL_IN_VOICE_DNLINK |
public static final int | CHANNEL_IN_MONO |
public static final int | CHANNEL_IN_STEREO |
public static final int | CHANNEL_IN_FRONT_BACK |
public static final int | AUDIO_FORMAT_HAS_PROPERTY_NONE |
public static final int | AUDIO_FORMAT_HAS_PROPERTY_ENCODING |
public static final int | AUDIO_FORMAT_HAS_PROPERTY_SAMPLE_RATE |
public static final int | AUDIO_FORMAT_HAS_PROPERTY_CHANNEL_MASK |
private int | mEncoding |
private int | mSampleRate |
private int | mChannelMask |
private int | mPropertySetMask |
Methods Summary |
---|
public static int | channelCountFromInChannelMask(int mask)
return Integer.bitCount(mask);
|
public static int | channelCountFromOutChannelMask(int mask)
return Integer.bitCount(mask);
|
public static int | convertChannelOutMaskToNativeMask(int javaMask)
return (javaMask >> 2);
|
public static int | convertNativeChannelMaskToOutMask(int nativeMask)
return (nativeMask << 2);
|
public static int | getBytesPerSample(int audioFormat)
// CHANNEL_IN_ALL is not yet defined; if added then it should match AUDIO_CHANNEL_IN_ALL
switch (audioFormat) {
case ENCODING_PCM_8BIT:
return 1;
case ENCODING_PCM_16BIT:
case ENCODING_DEFAULT:
return 2;
case ENCODING_PCM_FLOAT:
return 4;
case ENCODING_INVALID:
default:
throw new IllegalArgumentException("Bad audio format " + audioFormat);
}
|
public int | getChannelMask()Return the channel mask.
if ((mPropertySetMask & AUDIO_FORMAT_HAS_PROPERTY_CHANNEL_MASK) == 0) {
return CHANNEL_INVALID;
}
return mChannelMask;
|
public int | getEncoding()Return the encoding.
if ((mPropertySetMask & AUDIO_FORMAT_HAS_PROPERTY_ENCODING) == 0) {
return ENCODING_INVALID;
}
return mEncoding;
|
public int | getPropertySetMask()
return mPropertySetMask;
|
public int | getSampleRate()Return the sample rate.
if ((mPropertySetMask & AUDIO_FORMAT_HAS_PROPERTY_SAMPLE_RATE) == 0) {
return 0;
}
return mSampleRate;
|
public static int | inChannelMaskFromOutChannelMask(int outMask)
// CHANNEL_OUT_ALL is not yet defined; if added then it should match AUDIO_CHANNEL_OUT_ALL
if (outMask == CHANNEL_OUT_DEFAULT) {
throw new IllegalArgumentException(
"Illegal CHANNEL_OUT_DEFAULT channel mask for input.");
}
switch (channelCountFromOutChannelMask(outMask)) {
case 1:
return CHANNEL_IN_MONO;
case 2:
return CHANNEL_IN_STEREO;
default:
throw new IllegalArgumentException("Unsupported channel configuration for input.");
}
|
public static boolean | isEncodingLinearPcm(int audioFormat)
switch (audioFormat) {
case ENCODING_PCM_8BIT:
case ENCODING_PCM_16BIT:
case ENCODING_PCM_FLOAT:
case ENCODING_DEFAULT:
return true;
case ENCODING_AC3:
case ENCODING_E_AC3:
return false;
case ENCODING_INVALID:
default:
throw new IllegalArgumentException("Bad audio format " + audioFormat);
}
|
public static boolean | isValidEncoding(int audioFormat)
switch (audioFormat) {
case ENCODING_PCM_8BIT:
case ENCODING_PCM_16BIT:
case ENCODING_PCM_FLOAT:
case ENCODING_AC3:
case ENCODING_E_AC3:
return true;
default:
return false;
}
|
public java.lang.String | toString()
return new String("AudioFormat:"
+ " props=" + mPropertySetMask
+ " enc=" + mEncoding
+ " chan=0x" + Integer.toHexString(mChannelMask)
+ " rate=" + mSampleRate);
|