diff options
author | Andy Hung <hunga@google.com> | 2015-04-30 00:27:27 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-04-30 00:27:27 +0000 |
commit | 6344c67e2b72842c24178d63e1246d7bd65d65a9 (patch) | |
tree | 8431f2599da33e726246cc56b51b5964a0c88f21 /media | |
parent | ee4bd11c4cfc7a2a78ace23da42c1de59545f3bf (diff) | |
parent | edcf5e1e05b7c258665476a75af8440b12050ace (diff) | |
download | frameworks_base-6344c67e2b72842c24178d63e1246d7bd65d65a9.zip frameworks_base-6344c67e2b72842c24178d63e1246d7bd65d65a9.tar.gz frameworks_base-6344c67e2b72842c24178d63e1246d7bd65d65a9.tar.bz2 |
am edcf5e1e: am f17dd0b4: am 1afdbe3b: Merge "Pass PlaybackSettings as class object for AudioTrack JNI" into mnc-dev
* commit 'edcf5e1e05b7c258665476a75af8440b12050ace':
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(); |