1/* 2 * Copyright (C) 2008 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package android.media; 18 19/** 20 * The AudioFormat class is used to access a number of audio format and 21 * channel configuration constants. They are for instance used 22 * in __link AudioTrack} and __link AudioRecord}. 23 * 24 */ 25public class AudioFormat { 26 27 //--------------------------------------------------------- 28 // Constants 29 //-------------------- 30 /** Invalid audio data format */ 31 public static final int ENCODING_INVALID = 0; 32 /** Default audio data format */ 33 public static final int ENCODING_DEFAULT = 1; 34 /** Audio data format: PCM 16 bit per sample */ 35 public static final int ENCODING_PCM_16BIT = 2; // accessed by native code 36 /** Audio data format: PCM 8 bit per sample */ 37 public static final int ENCODING_PCM_8BIT = 3; // accessed by native code 38 39 /** Invalid audio channel configuration */ 40 /** @deprecated use CHANNEL_INVALID instead */ 41 @Deprecated public static final int CHANNEL_CONFIGURATION_INVALID = 0; 42 /** Default audio channel configuration */ 43 /** @deprecated use CHANNEL_OUT_DEFAULT or CHANNEL_IN_DEFAULT instead */ 44 @Deprecated public static final int CHANNEL_CONFIGURATION_DEFAULT = 1; 45 /** Mono audio configuration */ 46 /** @deprecated use CHANNEL_OUT_MONO or CHANNEL_IN_MONO instead */ 47 @Deprecated public static final int CHANNEL_CONFIGURATION_MONO = 2; 48 /** Stereo (2 channel) audio configuration */ 49 /** @deprecated use CHANNEL_OUT_STEREO or CHANNEL_IN_STEREO instead */ 50 @Deprecated public static final int CHANNEL_CONFIGURATION_STEREO = 3; 51 52 /** Invalid audio channel mask */ 53 public static final int CHANNEL_INVALID = 0; 54 /** Default audio channel mask */ 55 public static final int CHANNEL_OUT_DEFAULT = 1; 56 57 // Channel mask definitions must be kept in sync with native values in include/media/AudioSystem.h 58 public static final int CHANNEL_OUT_FRONT_LEFT = 0x4; 59 public static final int CHANNEL_OUT_FRONT_RIGHT = 0x8; 60 public static final int CHANNEL_OUT_FRONT_CENTER = 0x10; 61 public static final int CHANNEL_OUT_LOW_FREQUENCY = 0x20; 62 public static final int CHANNEL_OUT_BACK_LEFT = 0x40; 63 public static final int CHANNEL_OUT_BACK_RIGHT = 0x80; 64 public static final int CHANNEL_OUT_FRONT_LEFT_OF_CENTER = 0x100; 65 public static final int CHANNEL_OUT_FRONT_RIGHT_OF_CENTER = 0x200; 66 public static final int CHANNEL_OUT_BACK_CENTER = 0x400; 67 public static final int CHANNEL_OUT_MONO = CHANNEL_OUT_FRONT_LEFT; 68 public static final int CHANNEL_OUT_STEREO = (CHANNEL_OUT_FRONT_LEFT | CHANNEL_OUT_FRONT_RIGHT); 69 public static final int CHANNEL_OUT_QUAD = (CHANNEL_OUT_FRONT_LEFT | CHANNEL_OUT_FRONT_RIGHT | 70 CHANNEL_OUT_BACK_LEFT | CHANNEL_OUT_BACK_RIGHT); 71 public static final int CHANNEL_OUT_SURROUND = (CHANNEL_OUT_FRONT_LEFT | CHANNEL_OUT_FRONT_RIGHT | 72 CHANNEL_OUT_FRONT_CENTER | CHANNEL_OUT_BACK_CENTER); 73 public static final int CHANNEL_OUT_5POINT1 = (CHANNEL_OUT_FRONT_LEFT | CHANNEL_OUT_FRONT_RIGHT | 74 CHANNEL_OUT_FRONT_CENTER | CHANNEL_OUT_LOW_FREQUENCY | CHANNEL_OUT_BACK_LEFT | CHANNEL_OUT_BACK_RIGHT); 75 public static final int CHANNEL_OUT_7POINT1 = (CHANNEL_OUT_FRONT_LEFT | CHANNEL_OUT_FRONT_RIGHT | 76 CHANNEL_OUT_FRONT_CENTER | CHANNEL_OUT_LOW_FREQUENCY | CHANNEL_OUT_BACK_LEFT | CHANNEL_OUT_BACK_RIGHT | 77 CHANNEL_OUT_FRONT_LEFT_OF_CENTER | CHANNEL_OUT_FRONT_RIGHT_OF_CENTER); 78 79 public static final int CHANNEL_IN_DEFAULT = 1; 80 public static final int CHANNEL_IN_LEFT = 0x4; 81 public static final int CHANNEL_IN_RIGHT = 0x8; 82 public static final int CHANNEL_IN_FRONT = 0x10; 83 public static final int CHANNEL_IN_BACK = 0x20; 84 public static final int CHANNEL_IN_LEFT_PROCESSED = 0x40; 85 public static final int CHANNEL_IN_RIGHT_PROCESSED = 0x80; 86 public static final int CHANNEL_IN_FRONT_PROCESSED = 0x100; 87 public static final int CHANNEL_IN_BACK_PROCESSED = 0x200; 88 public static final int CHANNEL_IN_PRESSURE = 0x400; 89 public static final int CHANNEL_IN_X_AXIS = 0x800; 90 public static final int CHANNEL_IN_Y_AXIS = 0x1000; 91 public static final int CHANNEL_IN_Z_AXIS = 0x2000; 92 public static final int CHANNEL_IN_VOICE_UPLINK = 0x4000; 93 public static final int CHANNEL_IN_VOICE_DNLINK = 0x8000; 94 public static final int CHANNEL_IN_MONO = CHANNEL_IN_FRONT; 95 public static final int CHANNEL_IN_STEREO = (CHANNEL_IN_LEFT | CHANNEL_IN_RIGHT); 96 97} 98