diff options
author | Andy Hung <hunga@google.com> | 2015-04-30 00:16:16 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-04-30 00:16:16 +0000 |
commit | edcf5e1e05b7c258665476a75af8440b12050ace (patch) | |
tree | 741e860e53d45517cb64738d5daa9cec88cbb85c /media | |
parent | 8fa0eecc4fa569fe89273ddb3234f03bf1c567ec (diff) | |
parent | f17dd0b48c894fda00b1d2068ef54b05221b1d7a (diff) | |
download | frameworks_base-edcf5e1e05b7c258665476a75af8440b12050ace.zip frameworks_base-edcf5e1e05b7c258665476a75af8440b12050ace.tar.gz frameworks_base-edcf5e1e05b7c258665476a75af8440b12050ace.tar.bz2 |
am f17dd0b4: am 1afdbe3b: Merge "Pass PlaybackSettings as class object for AudioTrack JNI" into mnc-dev
* commit 'f17dd0b48c894fda00b1d2068ef54b05221b1d7a':
Pass PlaybackSettings as class object for AudioTrack JNI
Diffstat (limited to 'media')
-rw-r--r-- | media/java/android/media/AudioTrack.java | 34 |
1 files changed, 4 insertions, 30 deletions
diff --git a/media/java/android/media/AudioTrack.java b/media/java/android/media/AudioTrack.java index 6f1fd24..cb05cc5 100644 --- a/media/java/android/media/AudioTrack.java +++ b/media/java/android/media/AudioTrack.java @@ -920,13 +920,7 @@ public class AudioTrack * @throws IllegalStateException if track is not initialized. */ public @NonNull PlaybackSettings getPlaybackSettings() { - float[] floatArray = new float[2]; - int[] intArray = new int[2]; - native_get_playback_settings(floatArray, intArray); - return new PlaybackSettings() - .setSpeed(floatArray[0]) - .setPitch(floatArray[1]) - .setAudioFallbackMode(intArray[0]); + return native_get_playback_settings(); } /** @@ -1340,21 +1334,7 @@ public class AudioTrack if (settings == null) { throw new IllegalArgumentException("settings is null"); } - float[] floatArray; - int[] intArray; - try { - floatArray = new float[] { - settings.getSpeed(), - settings.getPitch(), - }; - intArray = new int[] { - settings.getAudioFallbackMode(), - PlaybackSettings.AUDIO_STRETCH_MODE_DEFAULT, - }; - } catch (IllegalStateException e) { - throw new IllegalArgumentException(e); - } - native_set_playback_settings(floatArray, intArray); + native_set_playback_settings(settings); } @@ -2353,14 +2333,8 @@ public class AudioTrack private native final int native_set_playback_rate(int sampleRateInHz); private native final int native_get_playback_rate(); - // floatArray must be a non-null array of length >= 2 - // [0] is speed - // [1] is pitch - // intArray must be a non-null array of length >= 2 - // [0] is audio fallback mode - // [1] is audio stretch mode - private native final void native_set_playback_settings(float[] floatArray, int[] intArray); - private native final void native_get_playback_settings(float[] floatArray, int[] intArray); + private native final void native_set_playback_settings(@NonNull PlaybackSettings settings); + private native final @NonNull PlaybackSettings native_get_playback_settings(); private native final int native_set_marker_pos(int marker); private native final int native_get_marker_pos(); |