Loading api/current.txt +8 −8 Original line number Original line Diff line number Diff line Loading @@ -23484,11 +23484,11 @@ package android.media { method public void release(); method public void release(); method public void removeOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener); method public void removeOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener); method @Deprecated public void removeOnRoutingChangedListener(android.media.AudioRecord.OnRoutingChangedListener); method @Deprecated public void removeOnRoutingChangedListener(android.media.AudioRecord.OnRoutingChangedListener); method public boolean setMicrophoneDirection(int); method public boolean setMicrophoneFieldDimension(@FloatRange(from=-1.0, to=1.0) float); method public int setNotificationMarkerPosition(int); method public int setNotificationMarkerPosition(int); method public int setPositionNotificationPeriod(int); method public int setPositionNotificationPeriod(int); method public boolean setPreferredDevice(android.media.AudioDeviceInfo); method public boolean setPreferredDevice(android.media.AudioDeviceInfo); method public boolean setPreferredMicrophoneDirection(int); method public boolean setPreferredMicrophoneFieldDimension(@FloatRange(from=-1.0, to=1.0) float); method public void setRecordPositionUpdateListener(android.media.AudioRecord.OnRecordPositionUpdateListener); method public void setRecordPositionUpdateListener(android.media.AudioRecord.OnRecordPositionUpdateListener); method public void setRecordPositionUpdateListener(android.media.AudioRecord.OnRecordPositionUpdateListener, android.os.Handler); method public void setRecordPositionUpdateListener(android.media.AudioRecord.OnRecordPositionUpdateListener, android.os.Handler); method public void startRecording() throws java.lang.IllegalStateException; method public void startRecording() throws java.lang.IllegalStateException; Loading Loading @@ -25787,8 +25787,6 @@ package android.media { method public void setLocation(float, float); method public void setLocation(float, float); method public void setMaxDuration(int) throws java.lang.IllegalArgumentException; method public void setMaxDuration(int) throws java.lang.IllegalArgumentException; method public void setMaxFileSize(long) throws java.lang.IllegalArgumentException; method public void setMaxFileSize(long) throws java.lang.IllegalArgumentException; method public boolean setMicrophoneDirection(int); method public boolean setMicrophoneFieldDimension(@FloatRange(from=-1.0, to=1.0) float); method public void setNextOutputFile(java.io.FileDescriptor) throws java.io.IOException; method public void setNextOutputFile(java.io.FileDescriptor) throws java.io.IOException; method public void setNextOutputFile(java.io.File) throws java.io.IOException; method public void setNextOutputFile(java.io.File) throws java.io.IOException; method public void setOnErrorListener(android.media.MediaRecorder.OnErrorListener); method public void setOnErrorListener(android.media.MediaRecorder.OnErrorListener); Loading @@ -25799,6 +25797,8 @@ package android.media { method public void setOutputFile(String) throws java.lang.IllegalStateException; method public void setOutputFile(String) throws java.lang.IllegalStateException; method public void setOutputFormat(int) throws java.lang.IllegalStateException; method public void setOutputFormat(int) throws java.lang.IllegalStateException; method public boolean setPreferredDevice(android.media.AudioDeviceInfo); method public boolean setPreferredDevice(android.media.AudioDeviceInfo); method public boolean setPreferredMicrophoneDirection(int); method public boolean setPreferredMicrophoneFieldDimension(@FloatRange(from=-1.0, to=1.0) float); method public void setPreviewDisplay(android.view.Surface); method public void setPreviewDisplay(android.view.Surface); method public void setProfile(android.media.CamcorderProfile); method public void setProfile(android.media.CamcorderProfile); method public void setVideoEncoder(int) throws java.lang.IllegalStateException; method public void setVideoEncoder(int) throws java.lang.IllegalStateException; Loading Loading @@ -26142,11 +26142,11 @@ package android.media { } } public interface MicrophoneDirection { public interface MicrophoneDirection { method public boolean setMicrophoneDirection(int); method public boolean setPreferredMicrophoneDirection(int); method public boolean setMicrophoneFieldDimension(@FloatRange(from=-1.0, to=1.0) float); method public boolean setPreferredMicrophoneFieldDimension(@FloatRange(from=-1.0, to=1.0) float); field public static final int MIC_DIRECTION_BACK = 2; // 0x2 field public static final int MIC_DIRECTION_AWAY_FROM_USER = 2; // 0x2 field public static final int MIC_DIRECTION_EXTERNAL = 3; // 0x3 field public static final int MIC_DIRECTION_EXTERNAL = 3; // 0x3 field public static final int MIC_DIRECTION_FRONT = 1; // 0x1 field public static final int MIC_DIRECTION_TOWARDS_USER = 1; // 0x1 field public static final int MIC_DIRECTION_UNSPECIFIED = 0; // 0x0 field public static final int MIC_DIRECTION_UNSPECIFIED = 0; // 0x0 } } core/jni/android_media_AudioRecord.cpp +13 −13 Original line number Original line Diff line number Diff line Loading @@ -821,18 +821,18 @@ static jint android_media_AudioRecord_get_active_microphones(JNIEnv *env, return jStatus; return jStatus; } } static int android_media_AudioRecord_set_microphone_direction(JNIEnv *env, jobject thiz, static int android_media_AudioRecord_set_preferred_microphone_direction( jint direction) { JNIEnv *env, jobject thiz, jint direction) { sp<AudioRecord> lpRecorder = getAudioRecord(env, thiz); sp<AudioRecord> lpRecorder = getAudioRecord(env, thiz); if (lpRecorder == NULL) { if (lpRecorder == NULL) { jniThrowException(env, "java/lang/IllegalStateException", jniThrowException(env, "java/lang/IllegalStateException", "Unable to retrieve AudioRecord pointer for setMicrophoneDirection()"); "Unable to retrieve AudioRecord pointer for setPreferredMicrophoneDirection()"); return (jint)AUDIO_JAVA_ERROR; return (jint)AUDIO_JAVA_ERROR; } } jint jStatus = AUDIO_JAVA_SUCCESS; jint jStatus = AUDIO_JAVA_SUCCESS; status_t status = status_t status = lpRecorder->setPreferredMicrophoneDirection( lpRecorder->setMicrophoneDirection(static_cast<audio_microphone_direction_t>(direction)); static_cast<audio_microphone_direction_t>(direction)); if (status != NO_ERROR) { if (status != NO_ERROR) { jStatus = nativeToJavaStatus(status); jStatus = nativeToJavaStatus(status); } } Loading @@ -840,17 +840,17 @@ static int android_media_AudioRecord_set_microphone_direction(JNIEnv *env, jobje return jStatus; return jStatus; } } static int android_media_AudioRecord_set_microphone_field_dimension(JNIEnv *env, jobject thiz, static int android_media_AudioRecord_set_preferred_microphone_field_dimension( jfloat zoom) { JNIEnv *env, jobject thiz, jfloat zoom) { sp<AudioRecord> lpRecorder = getAudioRecord(env, thiz); sp<AudioRecord> lpRecorder = getAudioRecord(env, thiz); if (lpRecorder == NULL) { if (lpRecorder == NULL) { jniThrowException(env, "java/lang/IllegalStateException", jniThrowException(env, "java/lang/IllegalStateException", "Unable to retrieve AudioRecord pointer for setMicrophoneFieldDimension()"); "Unable to retrieve AudioRecord pointer for setPreferredMicrophoneFieldDimension()"); return (jint)AUDIO_JAVA_ERROR; return (jint)AUDIO_JAVA_ERROR; } } jint jStatus = AUDIO_JAVA_SUCCESS; jint jStatus = AUDIO_JAVA_SUCCESS; status_t status = lpRecorder->setMicrophoneFieldDimension(zoom); status_t status = lpRecorder->setPreferredMicrophoneFieldDimension(zoom); if (status != NO_ERROR) { if (status != NO_ERROR) { jStatus = nativeToJavaStatus(status); jStatus = nativeToJavaStatus(status); } } Loading Loading @@ -913,10 +913,10 @@ static const JNINativeMethod gMethods[] = { {"native_get_active_microphones", "(Ljava/util/ArrayList;)I", {"native_get_active_microphones", "(Ljava/util/ArrayList;)I", (void *)android_media_AudioRecord_get_active_microphones}, (void *)android_media_AudioRecord_get_active_microphones}, {"native_getPortId", "()I", (void *)android_media_AudioRecord_get_port_id}, {"native_getPortId", "()I", (void *)android_media_AudioRecord_get_port_id}, {"native_set_microphone_direction", "(I)I", {"native_set_preferred_microphone_direction", "(I)I", (void *)android_media_AudioRecord_set_microphone_direction}, (void *)android_media_AudioRecord_set_preferred_microphone_direction}, {"native_set_microphone_field_dimension", "(F)I", {"native_set_preferred_microphone_field_dimension", "(F)I", (void *)android_media_AudioRecord_set_microphone_field_dimension}, (void *)android_media_AudioRecord_set_preferred_microphone_field_dimension}, }; }; // field names found in android/media/AudioRecord.java // field names found in android/media/AudioRecord.java Loading media/java/android/media/AudioRecord.java +7 −6 Original line number Original line Diff line number Diff line Loading @@ -1798,8 +1798,8 @@ public class AudioRecord implements AudioRouting, MicrophoneDirection, * * * @return true if sucessful. * @return true if sucessful. */ */ public boolean setMicrophoneDirection(@DirectionMode int direction) { public boolean setPreferredMicrophoneDirection(@DirectionMode int direction) { return native_set_microphone_direction(direction) == AudioSystem.SUCCESS; return native_set_preferred_microphone_direction(direction) == AudioSystem.SUCCESS; } } /** /** Loading @@ -1810,10 +1810,11 @@ public class AudioRecord implements AudioRouting, MicrophoneDirection, * though 0 (no zoom) to 1 (maximum zoom). * though 0 (no zoom) to 1 (maximum zoom). * @return true if sucessful. * @return true if sucessful. */ */ public boolean setMicrophoneFieldDimension(@FloatRange(from = -1.0, to = 1.0) float zoom) { public boolean setPreferredMicrophoneFieldDimension( @FloatRange(from = -1.0, to = 1.0) float zoom) { Preconditions.checkArgument( Preconditions.checkArgument( zoom >= -1 && zoom <= 1, "Argument must fall between -1 & 1 (inclusive)"); zoom >= -1 && zoom <= 1, "Argument must fall between -1 & 1 (inclusive)"); return native_set_microphone_field_dimension(zoom) == AudioSystem.SUCCESS; return native_set_preferred_microphone_field_dimension(zoom) == AudioSystem.SUCCESS; } } //--------------------------------------------------------- //--------------------------------------------------------- Loading Loading @@ -1969,8 +1970,8 @@ public class AudioRecord implements AudioRouting, MicrophoneDirection, private native int native_getPortId(); private native int native_getPortId(); private native int native_set_microphone_direction(int direction); private native int native_set_preferred_microphone_direction(int direction); private native int native_set_microphone_field_dimension(float zoom); private native int native_set_preferred_microphone_field_dimension(float zoom); //--------------------------------------------------------- //--------------------------------------------------------- // Utility methods // Utility methods Loading media/java/android/media/MediaRecorder.java +7 −6 Original line number Original line Diff line number Diff line Loading @@ -1537,8 +1537,8 @@ public class MediaRecorder implements AudioRouting, * @param direction Direction constant. * @param direction Direction constant. * @return true if sucessful. * @return true if sucessful. */ */ public boolean setMicrophoneDirection(@DirectionMode int direction) { public boolean setPreferredMicrophoneDirection(@DirectionMode int direction) { return native_setMicrophoneDirection(direction) == 0; return native_setPreferredMicrophoneDirection(direction) == 0; } } /** /** Loading @@ -1549,14 +1549,15 @@ public class MediaRecorder implements AudioRouting, * though 0 (no zoom) to 1 (maximum zoom). * though 0 (no zoom) to 1 (maximum zoom). * @return true if sucessful. * @return true if sucessful. */ */ public boolean setMicrophoneFieldDimension(@FloatRange(from = -1.0, to = 1.0) float zoom) { public boolean setPreferredMicrophoneFieldDimension( @FloatRange(from = -1.0, to = 1.0) float zoom) { Preconditions.checkArgument( Preconditions.checkArgument( zoom >= -1 && zoom <= 1, "Argument must fall between -1 & 1 (inclusive)"); zoom >= -1 && zoom <= 1, "Argument must fall between -1 & 1 (inclusive)"); return native_setMicrophoneFieldDimension(zoom) == 0; return native_setPreferredMicrophoneFieldDimension(zoom) == 0; } } private native int native_setMicrophoneDirection(int direction); private native int native_setPreferredMicrophoneDirection(int direction); private native int native_setMicrophoneFieldDimension(float zoom); private native int native_setPreferredMicrophoneFieldDimension(float zoom); //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Implementation of AudioRecordingMonitor interface // Implementation of AudioRecordingMonitor interface Loading media/java/android/media/MicrophoneDirection.java +21 −8 Original line number Original line Diff line number Diff line Loading @@ -32,13 +32,21 @@ public interface MicrophoneDirection { */ */ int MIC_DIRECTION_UNSPECIFIED = 0; int MIC_DIRECTION_UNSPECIFIED = 0; /** /** * Optimize capture for audio coming from the screen-side of the device. * Optimize capture for audio coming from the side of the device facing the user. * In the typical case, a device with a single screen, screen-side camera/microphone and * non-screen-side camera/microphone, this will be the screen side (as in a "selfie"). * For a different device geometry, it is the side for which the expectation is to be * facing the user. */ */ int MIC_DIRECTION_FRONT = 1; int MIC_DIRECTION_TOWARDS_USER = 1; /** /** * Optimize capture for audio coming from the side of the device opposite the screen. * Optimize capture for audio coming from the side of the device pointing away from the user. * In the typical case, a device with a single screen, screen-side camera/microphone and * non-screen-side camera/microphone, this will be the non-screen side. * For a different device geometry, it is the side for which the expectation is to be * facing away from the user. This is the "taking a video of something else" case. */ */ int MIC_DIRECTION_BACK = 2; int MIC_DIRECTION_AWAY_FROM_USER = 2; /** /** * Optimize capture for audio coming from an off-device microphone. * Optimize capture for audio coming from an off-device microphone. */ */ Loading @@ -47,8 +55,8 @@ public interface MicrophoneDirection { /** @hide */ /** @hide */ /*public*/ @IntDef({ /*public*/ @IntDef({ MIC_DIRECTION_UNSPECIFIED, MIC_DIRECTION_UNSPECIFIED, MIC_DIRECTION_FRONT, MIC_DIRECTION_TOWARDS_USER, MIC_DIRECTION_BACK, MIC_DIRECTION_AWAY_FROM_USER, MIC_DIRECTION_EXTERNAL MIC_DIRECTION_EXTERNAL }) }) @Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE) Loading @@ -58,18 +66,23 @@ public interface MicrophoneDirection { * which side of the device to optimize capture from. Typically used in conjunction with * which side of the device to optimize capture from. Typically used in conjunction with * the camera capturing video. * the camera capturing video. * * * Usage would include specifying the audio capture to follow camera being used to capture * video. * @param direction Direction constant. * @param direction Direction constant. * @return true if sucessful. * @return true if sucessful. */ */ boolean setMicrophoneDirection(@DirectionMode int direction); boolean setPreferredMicrophoneDirection(@DirectionMode int direction); /** /** * Specifies the zoom factor (i.e. the field dimension) for the selected microphone * Specifies the zoom factor (i.e. the field dimension) for the selected microphone * (for processing). The selected microphone is determined by the use-case for the stream. * (for processing). The selected microphone is determined by the use-case for the stream. * * * Usage would include specifying the audio focus to follow the zoom specified for the camera * being used to capture video. * * @param zoom the desired field dimension of microphone capture. Range is from -1 (wide angle), * @param zoom the desired field dimension of microphone capture. Range is from -1 (wide angle), * though 0 (no zoom) to 1 (maximum zoom). * though 0 (no zoom) to 1 (maximum zoom). * @return true if sucessful. * @return true if sucessful. */ */ boolean setMicrophoneFieldDimension(@FloatRange(from = -1.0, to = 1.0) float zoom); boolean setPreferredMicrophoneFieldDimension(@FloatRange(from = -1.0, to = 1.0) float zoom); } } Loading
api/current.txt +8 −8 Original line number Original line Diff line number Diff line Loading @@ -23484,11 +23484,11 @@ package android.media { method public void release(); method public void release(); method public void removeOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener); method public void removeOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener); method @Deprecated public void removeOnRoutingChangedListener(android.media.AudioRecord.OnRoutingChangedListener); method @Deprecated public void removeOnRoutingChangedListener(android.media.AudioRecord.OnRoutingChangedListener); method public boolean setMicrophoneDirection(int); method public boolean setMicrophoneFieldDimension(@FloatRange(from=-1.0, to=1.0) float); method public int setNotificationMarkerPosition(int); method public int setNotificationMarkerPosition(int); method public int setPositionNotificationPeriod(int); method public int setPositionNotificationPeriod(int); method public boolean setPreferredDevice(android.media.AudioDeviceInfo); method public boolean setPreferredDevice(android.media.AudioDeviceInfo); method public boolean setPreferredMicrophoneDirection(int); method public boolean setPreferredMicrophoneFieldDimension(@FloatRange(from=-1.0, to=1.0) float); method public void setRecordPositionUpdateListener(android.media.AudioRecord.OnRecordPositionUpdateListener); method public void setRecordPositionUpdateListener(android.media.AudioRecord.OnRecordPositionUpdateListener); method public void setRecordPositionUpdateListener(android.media.AudioRecord.OnRecordPositionUpdateListener, android.os.Handler); method public void setRecordPositionUpdateListener(android.media.AudioRecord.OnRecordPositionUpdateListener, android.os.Handler); method public void startRecording() throws java.lang.IllegalStateException; method public void startRecording() throws java.lang.IllegalStateException; Loading Loading @@ -25787,8 +25787,6 @@ package android.media { method public void setLocation(float, float); method public void setLocation(float, float); method public void setMaxDuration(int) throws java.lang.IllegalArgumentException; method public void setMaxDuration(int) throws java.lang.IllegalArgumentException; method public void setMaxFileSize(long) throws java.lang.IllegalArgumentException; method public void setMaxFileSize(long) throws java.lang.IllegalArgumentException; method public boolean setMicrophoneDirection(int); method public boolean setMicrophoneFieldDimension(@FloatRange(from=-1.0, to=1.0) float); method public void setNextOutputFile(java.io.FileDescriptor) throws java.io.IOException; method public void setNextOutputFile(java.io.FileDescriptor) throws java.io.IOException; method public void setNextOutputFile(java.io.File) throws java.io.IOException; method public void setNextOutputFile(java.io.File) throws java.io.IOException; method public void setOnErrorListener(android.media.MediaRecorder.OnErrorListener); method public void setOnErrorListener(android.media.MediaRecorder.OnErrorListener); Loading @@ -25799,6 +25797,8 @@ package android.media { method public void setOutputFile(String) throws java.lang.IllegalStateException; method public void setOutputFile(String) throws java.lang.IllegalStateException; method public void setOutputFormat(int) throws java.lang.IllegalStateException; method public void setOutputFormat(int) throws java.lang.IllegalStateException; method public boolean setPreferredDevice(android.media.AudioDeviceInfo); method public boolean setPreferredDevice(android.media.AudioDeviceInfo); method public boolean setPreferredMicrophoneDirection(int); method public boolean setPreferredMicrophoneFieldDimension(@FloatRange(from=-1.0, to=1.0) float); method public void setPreviewDisplay(android.view.Surface); method public void setPreviewDisplay(android.view.Surface); method public void setProfile(android.media.CamcorderProfile); method public void setProfile(android.media.CamcorderProfile); method public void setVideoEncoder(int) throws java.lang.IllegalStateException; method public void setVideoEncoder(int) throws java.lang.IllegalStateException; Loading Loading @@ -26142,11 +26142,11 @@ package android.media { } } public interface MicrophoneDirection { public interface MicrophoneDirection { method public boolean setMicrophoneDirection(int); method public boolean setPreferredMicrophoneDirection(int); method public boolean setMicrophoneFieldDimension(@FloatRange(from=-1.0, to=1.0) float); method public boolean setPreferredMicrophoneFieldDimension(@FloatRange(from=-1.0, to=1.0) float); field public static final int MIC_DIRECTION_BACK = 2; // 0x2 field public static final int MIC_DIRECTION_AWAY_FROM_USER = 2; // 0x2 field public static final int MIC_DIRECTION_EXTERNAL = 3; // 0x3 field public static final int MIC_DIRECTION_EXTERNAL = 3; // 0x3 field public static final int MIC_DIRECTION_FRONT = 1; // 0x1 field public static final int MIC_DIRECTION_TOWARDS_USER = 1; // 0x1 field public static final int MIC_DIRECTION_UNSPECIFIED = 0; // 0x0 field public static final int MIC_DIRECTION_UNSPECIFIED = 0; // 0x0 } }
core/jni/android_media_AudioRecord.cpp +13 −13 Original line number Original line Diff line number Diff line Loading @@ -821,18 +821,18 @@ static jint android_media_AudioRecord_get_active_microphones(JNIEnv *env, return jStatus; return jStatus; } } static int android_media_AudioRecord_set_microphone_direction(JNIEnv *env, jobject thiz, static int android_media_AudioRecord_set_preferred_microphone_direction( jint direction) { JNIEnv *env, jobject thiz, jint direction) { sp<AudioRecord> lpRecorder = getAudioRecord(env, thiz); sp<AudioRecord> lpRecorder = getAudioRecord(env, thiz); if (lpRecorder == NULL) { if (lpRecorder == NULL) { jniThrowException(env, "java/lang/IllegalStateException", jniThrowException(env, "java/lang/IllegalStateException", "Unable to retrieve AudioRecord pointer for setMicrophoneDirection()"); "Unable to retrieve AudioRecord pointer for setPreferredMicrophoneDirection()"); return (jint)AUDIO_JAVA_ERROR; return (jint)AUDIO_JAVA_ERROR; } } jint jStatus = AUDIO_JAVA_SUCCESS; jint jStatus = AUDIO_JAVA_SUCCESS; status_t status = status_t status = lpRecorder->setPreferredMicrophoneDirection( lpRecorder->setMicrophoneDirection(static_cast<audio_microphone_direction_t>(direction)); static_cast<audio_microphone_direction_t>(direction)); if (status != NO_ERROR) { if (status != NO_ERROR) { jStatus = nativeToJavaStatus(status); jStatus = nativeToJavaStatus(status); } } Loading @@ -840,17 +840,17 @@ static int android_media_AudioRecord_set_microphone_direction(JNIEnv *env, jobje return jStatus; return jStatus; } } static int android_media_AudioRecord_set_microphone_field_dimension(JNIEnv *env, jobject thiz, static int android_media_AudioRecord_set_preferred_microphone_field_dimension( jfloat zoom) { JNIEnv *env, jobject thiz, jfloat zoom) { sp<AudioRecord> lpRecorder = getAudioRecord(env, thiz); sp<AudioRecord> lpRecorder = getAudioRecord(env, thiz); if (lpRecorder == NULL) { if (lpRecorder == NULL) { jniThrowException(env, "java/lang/IllegalStateException", jniThrowException(env, "java/lang/IllegalStateException", "Unable to retrieve AudioRecord pointer for setMicrophoneFieldDimension()"); "Unable to retrieve AudioRecord pointer for setPreferredMicrophoneFieldDimension()"); return (jint)AUDIO_JAVA_ERROR; return (jint)AUDIO_JAVA_ERROR; } } jint jStatus = AUDIO_JAVA_SUCCESS; jint jStatus = AUDIO_JAVA_SUCCESS; status_t status = lpRecorder->setMicrophoneFieldDimension(zoom); status_t status = lpRecorder->setPreferredMicrophoneFieldDimension(zoom); if (status != NO_ERROR) { if (status != NO_ERROR) { jStatus = nativeToJavaStatus(status); jStatus = nativeToJavaStatus(status); } } Loading Loading @@ -913,10 +913,10 @@ static const JNINativeMethod gMethods[] = { {"native_get_active_microphones", "(Ljava/util/ArrayList;)I", {"native_get_active_microphones", "(Ljava/util/ArrayList;)I", (void *)android_media_AudioRecord_get_active_microphones}, (void *)android_media_AudioRecord_get_active_microphones}, {"native_getPortId", "()I", (void *)android_media_AudioRecord_get_port_id}, {"native_getPortId", "()I", (void *)android_media_AudioRecord_get_port_id}, {"native_set_microphone_direction", "(I)I", {"native_set_preferred_microphone_direction", "(I)I", (void *)android_media_AudioRecord_set_microphone_direction}, (void *)android_media_AudioRecord_set_preferred_microphone_direction}, {"native_set_microphone_field_dimension", "(F)I", {"native_set_preferred_microphone_field_dimension", "(F)I", (void *)android_media_AudioRecord_set_microphone_field_dimension}, (void *)android_media_AudioRecord_set_preferred_microphone_field_dimension}, }; }; // field names found in android/media/AudioRecord.java // field names found in android/media/AudioRecord.java Loading
media/java/android/media/AudioRecord.java +7 −6 Original line number Original line Diff line number Diff line Loading @@ -1798,8 +1798,8 @@ public class AudioRecord implements AudioRouting, MicrophoneDirection, * * * @return true if sucessful. * @return true if sucessful. */ */ public boolean setMicrophoneDirection(@DirectionMode int direction) { public boolean setPreferredMicrophoneDirection(@DirectionMode int direction) { return native_set_microphone_direction(direction) == AudioSystem.SUCCESS; return native_set_preferred_microphone_direction(direction) == AudioSystem.SUCCESS; } } /** /** Loading @@ -1810,10 +1810,11 @@ public class AudioRecord implements AudioRouting, MicrophoneDirection, * though 0 (no zoom) to 1 (maximum zoom). * though 0 (no zoom) to 1 (maximum zoom). * @return true if sucessful. * @return true if sucessful. */ */ public boolean setMicrophoneFieldDimension(@FloatRange(from = -1.0, to = 1.0) float zoom) { public boolean setPreferredMicrophoneFieldDimension( @FloatRange(from = -1.0, to = 1.0) float zoom) { Preconditions.checkArgument( Preconditions.checkArgument( zoom >= -1 && zoom <= 1, "Argument must fall between -1 & 1 (inclusive)"); zoom >= -1 && zoom <= 1, "Argument must fall between -1 & 1 (inclusive)"); return native_set_microphone_field_dimension(zoom) == AudioSystem.SUCCESS; return native_set_preferred_microphone_field_dimension(zoom) == AudioSystem.SUCCESS; } } //--------------------------------------------------------- //--------------------------------------------------------- Loading Loading @@ -1969,8 +1970,8 @@ public class AudioRecord implements AudioRouting, MicrophoneDirection, private native int native_getPortId(); private native int native_getPortId(); private native int native_set_microphone_direction(int direction); private native int native_set_preferred_microphone_direction(int direction); private native int native_set_microphone_field_dimension(float zoom); private native int native_set_preferred_microphone_field_dimension(float zoom); //--------------------------------------------------------- //--------------------------------------------------------- // Utility methods // Utility methods Loading
media/java/android/media/MediaRecorder.java +7 −6 Original line number Original line Diff line number Diff line Loading @@ -1537,8 +1537,8 @@ public class MediaRecorder implements AudioRouting, * @param direction Direction constant. * @param direction Direction constant. * @return true if sucessful. * @return true if sucessful. */ */ public boolean setMicrophoneDirection(@DirectionMode int direction) { public boolean setPreferredMicrophoneDirection(@DirectionMode int direction) { return native_setMicrophoneDirection(direction) == 0; return native_setPreferredMicrophoneDirection(direction) == 0; } } /** /** Loading @@ -1549,14 +1549,15 @@ public class MediaRecorder implements AudioRouting, * though 0 (no zoom) to 1 (maximum zoom). * though 0 (no zoom) to 1 (maximum zoom). * @return true if sucessful. * @return true if sucessful. */ */ public boolean setMicrophoneFieldDimension(@FloatRange(from = -1.0, to = 1.0) float zoom) { public boolean setPreferredMicrophoneFieldDimension( @FloatRange(from = -1.0, to = 1.0) float zoom) { Preconditions.checkArgument( Preconditions.checkArgument( zoom >= -1 && zoom <= 1, "Argument must fall between -1 & 1 (inclusive)"); zoom >= -1 && zoom <= 1, "Argument must fall between -1 & 1 (inclusive)"); return native_setMicrophoneFieldDimension(zoom) == 0; return native_setPreferredMicrophoneFieldDimension(zoom) == 0; } } private native int native_setMicrophoneDirection(int direction); private native int native_setPreferredMicrophoneDirection(int direction); private native int native_setMicrophoneFieldDimension(float zoom); private native int native_setPreferredMicrophoneFieldDimension(float zoom); //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Implementation of AudioRecordingMonitor interface // Implementation of AudioRecordingMonitor interface Loading
media/java/android/media/MicrophoneDirection.java +21 −8 Original line number Original line Diff line number Diff line Loading @@ -32,13 +32,21 @@ public interface MicrophoneDirection { */ */ int MIC_DIRECTION_UNSPECIFIED = 0; int MIC_DIRECTION_UNSPECIFIED = 0; /** /** * Optimize capture for audio coming from the screen-side of the device. * Optimize capture for audio coming from the side of the device facing the user. * In the typical case, a device with a single screen, screen-side camera/microphone and * non-screen-side camera/microphone, this will be the screen side (as in a "selfie"). * For a different device geometry, it is the side for which the expectation is to be * facing the user. */ */ int MIC_DIRECTION_FRONT = 1; int MIC_DIRECTION_TOWARDS_USER = 1; /** /** * Optimize capture for audio coming from the side of the device opposite the screen. * Optimize capture for audio coming from the side of the device pointing away from the user. * In the typical case, a device with a single screen, screen-side camera/microphone and * non-screen-side camera/microphone, this will be the non-screen side. * For a different device geometry, it is the side for which the expectation is to be * facing away from the user. This is the "taking a video of something else" case. */ */ int MIC_DIRECTION_BACK = 2; int MIC_DIRECTION_AWAY_FROM_USER = 2; /** /** * Optimize capture for audio coming from an off-device microphone. * Optimize capture for audio coming from an off-device microphone. */ */ Loading @@ -47,8 +55,8 @@ public interface MicrophoneDirection { /** @hide */ /** @hide */ /*public*/ @IntDef({ /*public*/ @IntDef({ MIC_DIRECTION_UNSPECIFIED, MIC_DIRECTION_UNSPECIFIED, MIC_DIRECTION_FRONT, MIC_DIRECTION_TOWARDS_USER, MIC_DIRECTION_BACK, MIC_DIRECTION_AWAY_FROM_USER, MIC_DIRECTION_EXTERNAL MIC_DIRECTION_EXTERNAL }) }) @Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE) Loading @@ -58,18 +66,23 @@ public interface MicrophoneDirection { * which side of the device to optimize capture from. Typically used in conjunction with * which side of the device to optimize capture from. Typically used in conjunction with * the camera capturing video. * the camera capturing video. * * * Usage would include specifying the audio capture to follow camera being used to capture * video. * @param direction Direction constant. * @param direction Direction constant. * @return true if sucessful. * @return true if sucessful. */ */ boolean setMicrophoneDirection(@DirectionMode int direction); boolean setPreferredMicrophoneDirection(@DirectionMode int direction); /** /** * Specifies the zoom factor (i.e. the field dimension) for the selected microphone * Specifies the zoom factor (i.e. the field dimension) for the selected microphone * (for processing). The selected microphone is determined by the use-case for the stream. * (for processing). The selected microphone is determined by the use-case for the stream. * * * Usage would include specifying the audio focus to follow the zoom specified for the camera * being used to capture video. * * @param zoom the desired field dimension of microphone capture. Range is from -1 (wide angle), * @param zoom the desired field dimension of microphone capture. Range is from -1 (wide angle), * though 0 (no zoom) to 1 (maximum zoom). * though 0 (no zoom) to 1 (maximum zoom). * @return true if sucessful. * @return true if sucessful. */ */ boolean setMicrophoneFieldDimension(@FloatRange(from = -1.0, to = 1.0) float zoom); boolean setPreferredMicrophoneFieldDimension(@FloatRange(from = -1.0, to = 1.0) float zoom); } }