diff options
Diffstat (limited to 'media/java')
-rw-r--r-- | media/java/android/media/audiofx/AudioEffect.java | 15 | ||||
-rw-r--r-- | media/java/android/media/audiofx/BassBoost.java | 13 | ||||
-rw-r--r-- | media/java/android/media/audiofx/Equalizer.java | 15 | ||||
-rw-r--r-- | media/java/android/media/audiofx/Virtualizer.java | 16 |
4 files changed, 30 insertions, 29 deletions
diff --git a/media/java/android/media/audiofx/AudioEffect.java b/media/java/android/media/audiofx/AudioEffect.java index 3ac0104..673f9f4 100644 --- a/media/java/android/media/audiofx/AudioEffect.java +++ b/media/java/android/media/audiofx/AudioEffect.java @@ -40,13 +40,11 @@ import java.util.UUID; * <li> {@link android.media.audiofx.PresetReverb}</li> * <li> {@link android.media.audiofx.EnvironmentalReverb}</li> * </ul> - * <p>If the audio effect is to be applied to a specific AudioTrack or MediaPlayer instance, + * <p>To apply the audio effect to a specific AudioTrack or MediaPlayer instance, * the application must specify the audio session ID of that instance when creating the AudioEffect. * (see {@link android.media.MediaPlayer#getAudioSessionId()} for details on audio sessions). - * To apply an effect to the global audio output mix, session 0 must be specified when creating the - * AudioEffect. - * <p>Creating an effect on the output mix (audio session 0) requires permission - * {@link android.Manifest.permission#MODIFY_AUDIO_SETTINGS} + * <p>NOTE: attaching insert effects (equalizer, bass boost, virtualizer) to the global audio output + * mix by use of session 0 is deprecated. * <p>Creating an AudioEffect object will create the corresponding effect engine in the audio * framework if no instance of the same effect type exists in the specified audio session. * If one exists, this instance will be used. @@ -356,10 +354,9 @@ public class AudioEffect { * how much the requesting application needs control of effect * parameters. The normal priority is 0, above normal is a * positive number, below normal a negative number. - * @param audioSession system wide unique audio session identifier. If audioSession - * is not 0, the effect will be attached to the MediaPlayer or - * AudioTrack in the same audio session. Otherwise, the effect - * will apply to the output mix. + * @param audioSession system wide unique audio session identifier. + * The effect will be attached to the MediaPlayer or AudioTrack in + * the same audio session. * * @throws java.lang.IllegalArgumentException * @throws java.lang.UnsupportedOperationException diff --git a/media/java/android/media/audiofx/BassBoost.java b/media/java/android/media/audiofx/BassBoost.java index ca55f0f..91459ed 100644 --- a/media/java/android/media/audiofx/BassBoost.java +++ b/media/java/android/media/audiofx/BassBoost.java @@ -39,9 +39,7 @@ import java.util.StringTokenizer; * for the SLBassBoostItf interface. Please refer to this specification for more details. * <p>To attach the BassBoost to a particular AudioTrack or MediaPlayer, specify the audio session * ID of this AudioTrack or MediaPlayer when constructing the BassBoost. - * If the audio session ID 0 is specified, the BassBoost applies to the main audio output mix. - * <p>Creating a BassBoost on the output mix (audio session 0) requires permission - * {@link android.Manifest.permission#MODIFY_AUDIO_SETTINGS} + * <p>NOTE: attaching a BassBoost to the global audio output mix by use of session 0 is deprecated. * <p>See {@link android.media.MediaPlayer#getAudioSessionId()} for details on audio sessions. * <p>See {@link android.media.audiofx.AudioEffect} class for more details on * controlling audio effects. @@ -89,9 +87,8 @@ public class BassBoost extends AudioEffect { * engine. As the same engine can be shared by several applications, this parameter indicates * how much the requesting application needs control of effect parameters. The normal priority * is 0, above normal is a positive number, below normal a negative number. - * @param audioSession system wide unique audio session identifier. If audioSession - * is not 0, the BassBoost will be attached to the MediaPlayer or AudioTrack in the - * same audio session. Otherwise, the BassBoost will apply to the output mix. + * @param audioSession system wide unique audio session identifier. The BassBoost will be + * attached to the MediaPlayer or AudioTrack in the same audio session. * * @throws java.lang.IllegalStateException * @throws java.lang.IllegalArgumentException @@ -103,6 +100,10 @@ public class BassBoost extends AudioEffect { UnsupportedOperationException, RuntimeException { super(EFFECT_TYPE_BASS_BOOST, EFFECT_TYPE_NULL, priority, audioSession); + if (audioSession == 0) { + Log.w(TAG, "WARNING: attaching a BassBoost to global output mix is deprecated!"); + } + int[] value = new int[1]; checkStatus(getParameter(PARAM_STRENGTH_SUPPORTED, value)); mStrengthSupported = (value[0] != 0); diff --git a/media/java/android/media/audiofx/Equalizer.java b/media/java/android/media/audiofx/Equalizer.java index b3bafa9..7f38955 100644 --- a/media/java/android/media/audiofx/Equalizer.java +++ b/media/java/android/media/audiofx/Equalizer.java @@ -39,10 +39,8 @@ import java.util.StringTokenizer; * mapping those defined by the OpenSL ES 1.0.1 Specification (http://www.khronos.org/opensles/) * for the SLEqualizerItf interface. Please refer to this specification for more details. * <p>To attach the Equalizer to a particular AudioTrack or MediaPlayer, specify the audio session - * ID of this AudioTrack or MediaPlayer when constructing the Equalizer. If the audio session ID 0 - * is specified, the Equalizer applies to the main audio output mix. - * <p>Creating an Equalizer on the output mix (audio session 0) requires permission - * {@link android.Manifest.permission#MODIFY_AUDIO_SETTINGS} + * ID of this AudioTrack or MediaPlayer when constructing the Equalizer. + * <p>NOTE: attaching an Equalizer to the global audio output mix by use of session 0 is deprecated. * <p>See {@link android.media.MediaPlayer#getAudioSessionId()} for details on audio sessions. * <p>See {@link android.media.audiofx.AudioEffect} class for more details on controlling audio * effects. @@ -134,9 +132,8 @@ public class Equalizer extends AudioEffect { * engine. As the same engine can be shared by several applications, this parameter indicates * how much the requesting application needs control of effect parameters. The normal priority * is 0, above normal is a positive number, below normal a negative number. - * @param audioSession system wide unique audio session identifier. If audioSession - * is not 0, the Equalizer will be attached to the MediaPlayer or AudioTrack in the - * same audio session. Otherwise, the Equalizer will apply to the output mix. + * @param audioSession system wide unique audio session identifier. The Equalizer will be + * attached to the MediaPlayer or AudioTrack in the same audio session. * * @throws java.lang.IllegalStateException * @throws java.lang.IllegalArgumentException @@ -148,6 +145,10 @@ public class Equalizer extends AudioEffect { UnsupportedOperationException, RuntimeException { super(EFFECT_TYPE_EQUALIZER, EFFECT_TYPE_NULL, priority, audioSession); + if (audioSession == 0) { + Log.w(TAG, "WARNING: attaching an Equalizer to global output mix is deprecated!"); + } + getNumberOfBands(); mNumPresets = (int)getNumberOfPresets(); diff --git a/media/java/android/media/audiofx/Virtualizer.java b/media/java/android/media/audiofx/Virtualizer.java index a682a45..68a7b88 100644 --- a/media/java/android/media/audiofx/Virtualizer.java +++ b/media/java/android/media/audiofx/Virtualizer.java @@ -40,10 +40,9 @@ import java.util.StringTokenizer; * mapping those defined by the OpenSL ES 1.0.1 Specification (http://www.khronos.org/opensles/) * for the SLVirtualizerItf interface. Please refer to this specification for more details. * <p>To attach the Virtualizer to a particular AudioTrack or MediaPlayer, specify the audio session - * ID of this AudioTrack or MediaPlayer when constructing the Virtualizer. If the audio session ID 0 - * is specified, the Virtualizer applies to the main audio output mix. - * <p>Creating a Virtualizer on the output mix (audio session 0) requires permission - * {@link android.Manifest.permission#MODIFY_AUDIO_SETTINGS} + * ID of this AudioTrack or MediaPlayer when constructing the Virtualizer. + * <p>NOTE: attaching a Virtualizer to the global audio output mix by use of session 0 is + * deprecated. * <p>See {@link android.media.MediaPlayer#getAudioSessionId()} for details on audio sessions. * <p>See {@link android.media.audiofx.AudioEffect} class for more details on controlling * audio effects. @@ -90,9 +89,8 @@ public class Virtualizer extends AudioEffect { * engine. As the same engine can be shared by several applications, this parameter indicates * how much the requesting application needs control of effect parameters. The normal priority * is 0, above normal is a positive number, below normal a negative number. - * @param audioSession system wide unique audio session identifier. If audioSession - * is not 0, the Virtualizer will be attached to the MediaPlayer or AudioTrack in the - * same audio session. Otherwise, the Virtualizer will apply to the output mix. + * @param audioSession system wide unique audio session identifier. The Virtualizer will + * be attached to the MediaPlayer or AudioTrack in the same audio session. * * @throws java.lang.IllegalStateException * @throws java.lang.IllegalArgumentException @@ -104,6 +102,10 @@ public class Virtualizer extends AudioEffect { UnsupportedOperationException, RuntimeException { super(EFFECT_TYPE_VIRTUALIZER, EFFECT_TYPE_NULL, priority, audioSession); + if (audioSession == 0) { + Log.w(TAG, "WARNING: attaching a Virtualizer to global output mix is deprecated!"); + } + int[] value = new int[1]; checkStatus(getParameter(PARAM_STRENGTH_SUPPORTED, value)); mStrengthSupported = (value[0] != 0); |