am 7864c72b: Merge "Fix issue 3022800." into gingerbread

Merge commit '7864c72b91a21eeb282e2e38d688fbbc3cd3ecb8' into gingerbread-plus-aosp

* commit '7864c72b91a21eeb282e2e38d688fbbc3cd3ecb8':
  Fix issue 3022800.
This commit is contained in:
Eric Laurent
2010-09-23 11:34:40 -07:00
committed by Android Git Automerger
21 changed files with 2380 additions and 2856 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -963,14 +963,17 @@ public class AudioTrack
//-------------------- //--------------------
/** /**
* Attaches an auxiliary effect to the audio track. A typical auxiliary effect is a * Attaches an auxiliary effect to the audio track. A typical auxiliary
* reverberation effect which can be applied on any sound source that directs a certain * effect is a reverberation effect which can be applied on any sound source
* amount of its energy to this effect. This amount is defined by setAuxEffectSendLevel(). * that directs a certain amount of its energy to this effect. This amount
* is defined by setAuxEffectSendLevel().
* {@see #setAuxEffectSendLevel(float)}. * {@see #setAuxEffectSendLevel(float)}.
* <p>After creating an auxiliary effect (e.g. {@link android.media.EnvironmentalReverb}), * <p>After creating an auxiliary effect (e.g.
* retrieve its ID with {@link android.media.AudioEffect#getId()} and use it when calling * {@link android.media.audiofx.EnvironmentalReverb}), retrieve its ID with
* {@link android.media.audiofx.AudioEffect#getId()} and use it when calling
* this method to attach the audio track to the effect. * this method to attach the audio track to the effect.
* <p>To detach the effect from the audio track, call this method with a null effect id. * <p>To detach the effect from the audio track, call this method with a
* null effect id.
* *
* @param effectId system wide unique id of the effect to attach * @param effectId system wide unique id of the effect to attach
* @return error code or success, see {@link #SUCCESS}, * @return error code or success, see {@link #SUCCESS},

View File

@@ -1210,9 +1210,10 @@ public class MediaPlayer
* effect which can be applied on any sound source that directs a certain amount of its * effect which can be applied on any sound source that directs a certain amount of its
* energy to this effect. This amount is defined by setAuxEffectSendLevel(). * energy to this effect. This amount is defined by setAuxEffectSendLevel().
* {@see #setAuxEffectSendLevel(float)}. * {@see #setAuxEffectSendLevel(float)}.
* <p>After creating an auxiliary effect (e.g. {@link android.media.EnvironmentalReverb}), * <p>After creating an auxiliary effect (e.g.
* retrieve its ID with {@link android.media.AudioEffect#getId()} and use it when calling * {@link android.media.audiofx.EnvironmentalReverb}), retrieve its ID with
* this method to attach the player to the effect. * {@link android.media.audiofx.AudioEffect#getId()} and use it when calling this method
* to attach the player to the effect.
* <p>To detach the effect from the player, call this method with a null effect id. * <p>To detach the effect from the player, call this method with a null effect id.
* <p>This method must be called after one of the overloaded <code> setDataSource </code> * <p>This method must be called after one of the overloaded <code> setDataSource </code>
* methods. * methods.

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package android.media; package android.media.audiofx;
import android.annotation.SdkConstant; import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType; import android.annotation.SdkConstant.SdkConstantType;
@@ -29,22 +29,35 @@ import java.nio.ByteBuffer;
import java.util.UUID; import java.util.UUID;
/** /**
* AudioEffect is the base class for implementing audio effect control in Java * AudioEffect is the base class for controlling audio effects provided by the android audio
* applications. * framework.
* <p>Creating an AudioEffect object will create the effect engine in * <p>Applications should not use the AudioEffect class directly but one of its derived classes to
* audio framework if no instance of the same effect type exists in the * control specific effects:
* specified audio session. If one exists, this instance will be used. * <ul>
* <p>The application creating the AudioEffect object (or a derived class) will either * <li> {@link android.media.audiofx.Equalizer}</li>
* receive control of the effect engine or not depending on the priority * <li> {@link android.media.audiofx.Virtualizer}</li>
* parameter. If priority is higher than the priority used by the current effect * <li> {@link android.media.audiofx.BassBoost}</li>
* engine owner, the control will be transfered to the new object. Otherwise * <li> {@link android.media.audiofx.PresetReverb}</li>
* control will remain with the previous object. In this case, the new * <li> {@link android.media.audiofx.EnvironmentalReverb}</li>
* application will be notified of changes in effect engine state or control * </ul>
* ownership by the appropiate listener. * <p>If the audio effect is to be applied to a specific AudioTrack or MediaPlayer instance,
* <p>If the effect is to be applied to a specific AudioTrack or MediaPlayer instance, * the application must specify the audio session ID of that instance when creating the AudioEffect.
* the application must specify the audio session ID of that instance when calling the AudioEffect * (see {@link android.media.MediaPlayer#getAudioSessionId()} for details on audio sessions).
* constructor. * 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>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.
* <p>The application creating the AudioEffect object (or a derived class) will either receive
* control of the effect engine or not depending on the priority parameter. If priority is higher
* than the priority used by the current effect engine owner, the control will be transfered to the
* new object. Otherwise control will remain with the previous object. In this case, the new
* application will be notified of changes in effect engine state or control ownership by the
* appropiate listener.
*/ */
public class AudioEffect { public class AudioEffect {
static { static {
System.loadLibrary("audioeffect_jni"); System.loadLibrary("audioeffect_jni");
@@ -62,32 +75,38 @@ public class AudioEffect {
/** /**
* UUID for environmental reverb effect * UUID for environmental reverb effect
* @hide
*/ */
public static final UUID EFFECT_TYPE_ENV_REVERB = UUID public static final UUID EFFECT_TYPE_ENV_REVERB = UUID
.fromString("c2e5d5f0-94bd-4763-9cac-4e234d06839e"); .fromString("c2e5d5f0-94bd-4763-9cac-4e234d06839e");
/** /**
* UUID for preset reverb effect * UUID for preset reverb effect
* @hide
*/ */
public static final UUID EFFECT_TYPE_PRESET_REVERB = UUID public static final UUID EFFECT_TYPE_PRESET_REVERB = UUID
.fromString("47382d60-ddd8-11db-bf3a-0002a5d5c51b"); .fromString("47382d60-ddd8-11db-bf3a-0002a5d5c51b");
/** /**
* UUID for equalizer effect * UUID for equalizer effect
* @hide
*/ */
public static final UUID EFFECT_TYPE_EQUALIZER = UUID public static final UUID EFFECT_TYPE_EQUALIZER = UUID
.fromString("0bed4300-ddd6-11db-8f34-0002a5d5c51b"); .fromString("0bed4300-ddd6-11db-8f34-0002a5d5c51b");
/** /**
* UUID for bass boost effect * UUID for bass boost effect
* @hide
*/ */
public static final UUID EFFECT_TYPE_BASS_BOOST = UUID public static final UUID EFFECT_TYPE_BASS_BOOST = UUID
.fromString("0634f220-ddd4-11db-a0fc-0002a5d5c51b"); .fromString("0634f220-ddd4-11db-a0fc-0002a5d5c51b");
/** /**
* UUID for virtualizer effect * UUID for virtualizer effect
* @hide
*/ */
public static final UUID EFFECT_TYPE_VIRTUALIZER = UUID public static final UUID EFFECT_TYPE_VIRTUALIZER = UUID
.fromString("37cc2c00-dddd-11db-8577-0002a5d5c51b"); .fromString("37cc2c00-dddd-11db-8577-0002a5d5c51b");
/** /**
* Null effect UUID. Used when the UUID for effect type of * Null effect UUID. Used when the UUID for effect type of
* @hide
*/ */
public static final UUID EFFECT_TYPE_NULL = UUID public static final UUID EFFECT_TYPE_NULL = UUID
.fromString("ec7178ec-e5e1-4432-a3f4-4657e6795210"); .fromString("ec7178ec-e5e1-4432-a3f4-4657e6795210");
@@ -95,10 +114,12 @@ public class AudioEffect {
/** /**
* State of an AudioEffect object that was not successfully initialized upon * State of an AudioEffect object that was not successfully initialized upon
* creation * creation
* @hide
*/ */
public static final int STATE_UNINITIALIZED = 0; public static final int STATE_UNINITIALIZED = 0;
/** /**
* State of an AudioEffect object that is ready to be used. * State of an AudioEffect object that is ready to be used.
* @hide
*/ */
public static final int STATE_INITIALIZED = 1; public static final int STATE_INITIALIZED = 1;
@@ -106,14 +127,17 @@ public class AudioEffect {
// frameworks/base/include/media/AudioEffect.h // frameworks/base/include/media/AudioEffect.h
/** /**
* Event id for engine control ownership change notification. * Event id for engine control ownership change notification.
* @hide
*/ */
public static final int NATIVE_EVENT_CONTROL_STATUS = 0; public static final int NATIVE_EVENT_CONTROL_STATUS = 0;
/** /**
* Event id for engine state change notification. * Event id for engine state change notification.
* @hide
*/ */
public static final int NATIVE_EVENT_ENABLED_STATUS = 1; public static final int NATIVE_EVENT_ENABLED_STATUS = 1;
/** /**
* Event id for engine parameter change notification. * Event id for engine parameter change notification.
* @hide
*/ */
public static final int NATIVE_EVENT_PARAMETER_CHANGED = 2; public static final int NATIVE_EVENT_PARAMETER_CHANGED = 2;
@@ -151,15 +175,17 @@ public class AudioEffect {
public static final int ERROR_DEAD_OBJECT = -7; public static final int ERROR_DEAD_OBJECT = -7;
/** /**
* The effect descriptor contains necessary information to facilitate * The effect descriptor contains information on a particular effect implemented in the
* effects enumeration:<br> * audio framework:<br>
* <ul> * <ul>
* <li>mType: UUID corresponding to the OpenSL ES interface implemented by this effect</li> * <li>type: UUID corresponding to the OpenSL ES interface implemented by this effect</li>
* <li>mUuid: UUID for this particular implementation</li> * <li>uuid: UUID for this particular implementation</li>
* <li>mConnectMode: {@link #EFFECT_INSERT} or {@link #EFFECT_AUXILIARY}</li> * <li>connectMode: {@link #EFFECT_INSERT} or {@link #EFFECT_AUXILIARY}</li>
* <li>mName: human readable effect name</li> * <li>name: human readable effect name</li>
* <li>mImplementor: human readable effect implementor name</li> * <li>implementor: human readable effect implementor name</li>
* </ul> * </ul>
* The method {@link #queryEffects()} returns an array of Descriptors to facilitate effects
* enumeration.
*/ */
public static class Descriptor { public static class Descriptor {
@@ -168,18 +194,39 @@ public class AudioEffect {
public Descriptor(String type, String uuid, String connectMode, public Descriptor(String type, String uuid, String connectMode,
String name, String implementor) { String name, String implementor) {
mType = UUID.fromString(type); this.type = UUID.fromString(type);
mUuid = UUID.fromString(uuid); this.uuid = UUID.fromString(uuid);
mConnectMode = connectMode; this.connectMode = connectMode;
mName = name; this.name = name;
mImplementor = implementor; this.implementor = implementor;
} }
public UUID mType; /**
public UUID mUuid; * Indicates the generic type of the effect (Equalizer, Bass boost ...). The UUID
public String mConnectMode; * corresponds to the OpenSL ES Interface ID for this type of effect.
public String mName; */
public String mImplementor; public UUID type;
/**
* Indicates the particular implementation of the effect in that type. Several effects
* can have the same type but this uuid is unique to a given implementation.
*/
public UUID uuid;
/**
* Indicates if the effect is of insert category {@link #EFFECT_INSERT} or auxiliary
* category {@link #EFFECT_AUXILIARY}. Insert effects (Typically an Equalizer) are applied
* to the entire audio source and usually not shared by several sources. Auxiliary effects
* (typically a reverberator) are applied to part of the signal (wet) and the effect output
* is added to the original signal (dry).
*/
public String connectMode;
/**
* Human readable effect name
*/
public String name;
/**
* Human readable effect implementor name
*/
public String implementor;
}; };
/** /**
@@ -242,10 +289,12 @@ public class AudioEffect {
private OnParameterChangeListener mParameterChangeListener = null; private OnParameterChangeListener mParameterChangeListener = null;
/** /**
* Lock to protect listeners updates against event notifications * Lock to protect listeners updates against event notifications
* @hide
*/ */
public final Object mListenerLock = new Object(); public final Object mListenerLock = new Object();
/** /**
* Handler for events coming from the native code * Handler for events coming from the native code
* @hide
*/ */
public NativeEventHandler mNativeEventHandler = null; public NativeEventHandler mNativeEventHandler = null;
@@ -283,6 +332,7 @@ public class AudioEffect {
* @throws java.lang.IllegalArgumentException * @throws java.lang.IllegalArgumentException
* @throws java.lang.UnsupportedOperationException * @throws java.lang.UnsupportedOperationException
* @throws java.lang.RuntimeException * @throws java.lang.RuntimeException
* @hide
*/ */
public AudioEffect(UUID type, UUID uuid, int priority, int audioSession) public AudioEffect(UUID type, UUID uuid, int priority, int audioSession)
@@ -337,7 +387,7 @@ public class AudioEffect {
/** /**
* Get the effect descriptor. * Get the effect descriptor.
* *
* @see android.media.AudioEffect.Descriptor * @see android.media.audiofx.AudioEffect.Descriptor
* @throws IllegalStateException * @throws IllegalStateException
*/ */
public Descriptor getDescriptor() throws IllegalStateException { public Descriptor getDescriptor() throws IllegalStateException {
@@ -351,7 +401,7 @@ public class AudioEffect {
/** /**
* Query all effects available on the platform. Returns an array of * Query all effects available on the platform. Returns an array of
* {@link android.media.AudioEffect.Descriptor} objects * {@link android.media.audiofx.AudioEffect.Descriptor} objects
* *
* @throws IllegalStateException * @throws IllegalStateException
*/ */
@@ -365,7 +415,11 @@ public class AudioEffect {
// -------------------- // --------------------
/** /**
* Enable or disable effect engine. * Enable or disable the effect.
* Creating an audio effect does not automatically apply this effect on the audio source. It
* creates the resources necessary to process this effect but the audio signal is still bypassed
* through the effect engine. Calling this method will make that the effect is actually applied
* or not to the audio content being played in the corresponding audio session.
* *
* @param enabled the requested enable state * @param enabled the requested enable state
* @return {@link #SUCCESS} in case of success, {@link #ERROR_INVALID_OPERATION} * @return {@link #SUCCESS} in case of success, {@link #ERROR_INVALID_OPERATION}
@@ -392,6 +446,7 @@ public class AudioEffect {
* {@link #ERROR_NO_MEMORY}, {@link #ERROR_INVALID_OPERATION} or * {@link #ERROR_NO_MEMORY}, {@link #ERROR_INVALID_OPERATION} or
* {@link #ERROR_DEAD_OBJECT} in case of failure * {@link #ERROR_DEAD_OBJECT} in case of failure
* @throws IllegalStateException * @throws IllegalStateException
* @hide
*/ */
public int setParameter(byte[] param, byte[] value) public int setParameter(byte[] param, byte[] value)
throws IllegalStateException { throws IllegalStateException {
@@ -403,6 +458,7 @@ public class AudioEffect {
* Set effect parameter. The parameter and its value are integers. * Set effect parameter. The parameter and its value are integers.
* *
* @see #setParameter(byte[], byte[]) * @see #setParameter(byte[], byte[])
* @hide
*/ */
public int setParameter(int param, int value) throws IllegalStateException { public int setParameter(int param, int value) throws IllegalStateException {
byte[] p = intToByteArray(param); byte[] p = intToByteArray(param);
@@ -415,6 +471,7 @@ public class AudioEffect {
* short integer. * short integer.
* *
* @see #setParameter(byte[], byte[]) * @see #setParameter(byte[], byte[])
* @hide
*/ */
public int setParameter(int param, short value) public int setParameter(int param, short value)
throws IllegalStateException { throws IllegalStateException {
@@ -428,6 +485,7 @@ public class AudioEffect {
* array of bytes. * array of bytes.
* *
* @see #setParameter(byte[], byte[]) * @see #setParameter(byte[], byte[])
* @hide
*/ */
public int setParameter(int param, byte[] value) public int setParameter(int param, byte[] value)
throws IllegalStateException { throws IllegalStateException {
@@ -440,6 +498,7 @@ public class AudioEffect {
* the value is also an array of 1 or 2 integers * the value is also an array of 1 or 2 integers
* *
* @see #setParameter(byte[], byte[]) * @see #setParameter(byte[], byte[])
* @hide
*/ */
public int setParameter(int[] param, int[] value) public int setParameter(int[] param, int[] value)
throws IllegalStateException { throws IllegalStateException {
@@ -464,6 +523,7 @@ public class AudioEffect {
* the value is an array of 1 or 2 short integers * the value is an array of 1 or 2 short integers
* *
* @see #setParameter(byte[], byte[]) * @see #setParameter(byte[], byte[])
* @hide
*/ */
public int setParameter(int[] param, short[] value) public int setParameter(int[] param, short[] value)
throws IllegalStateException { throws IllegalStateException {
@@ -489,6 +549,7 @@ public class AudioEffect {
* the value is an array of bytes * the value is an array of bytes
* *
* @see #setParameter(byte[], byte[]) * @see #setParameter(byte[], byte[])
* @hide
*/ */
public int setParameter(int[] param, byte[] value) public int setParameter(int[] param, byte[] value)
throws IllegalStateException { throws IllegalStateException {
@@ -519,6 +580,7 @@ public class AudioEffect {
* returning, value.length is updated with the actual size of the * returning, value.length is updated with the actual size of the
* returned value. * returned value.
* @throws IllegalStateException * @throws IllegalStateException
* @hide
*/ */
public int getParameter(byte[] param, byte[] value) public int getParameter(byte[] param, byte[] value)
throws IllegalStateException { throws IllegalStateException {
@@ -539,6 +601,7 @@ public class AudioEffect {
* array of bytes. * array of bytes.
* *
* @see #getParameter(byte[], byte[]) * @see #getParameter(byte[], byte[])
* @hide
*/ */
public int getParameter(int param, byte[] value) public int getParameter(int param, byte[] value)
throws IllegalStateException { throws IllegalStateException {
@@ -552,6 +615,7 @@ public class AudioEffect {
* array of 1 or 2 integers * array of 1 or 2 integers
* *
* @see #getParameter(byte[], byte[]) * @see #getParameter(byte[], byte[])
* @hide
*/ */
public int getParameter(int param, int[] value) public int getParameter(int param, int[] value)
throws IllegalStateException { throws IllegalStateException {
@@ -576,6 +640,7 @@ public class AudioEffect {
* array of 1 or 2 short integers * array of 1 or 2 short integers
* *
* @see #getParameter(byte[], byte[]) * @see #getParameter(byte[], byte[])
* @hide
*/ */
public int getParameter(int param, short[] value) public int getParameter(int param, short[] value)
throws IllegalStateException { throws IllegalStateException {
@@ -600,6 +665,7 @@ public class AudioEffect {
* the value is also an array of 1 or 2 integers * the value is also an array of 1 or 2 integers
* *
* @see #getParameter(byte[], byte[]) * @see #getParameter(byte[], byte[])
* @hide
*/ */
public int getParameter(int[] param, int[] value) public int getParameter(int[] param, int[] value)
throws IllegalStateException { throws IllegalStateException {
@@ -627,6 +693,7 @@ public class AudioEffect {
* the value is an array of 1 or 2 short integers * the value is an array of 1 or 2 short integers
* *
* @see #getParameter(byte[], byte[]) * @see #getParameter(byte[], byte[])
* @hide
*/ */
public int getParameter(int[] param, short[] value) public int getParameter(int[] param, short[] value)
throws IllegalStateException { throws IllegalStateException {
@@ -654,6 +721,7 @@ public class AudioEffect {
* the value is an array of bytes * the value is an array of bytes
* *
* @see #getParameter(byte[], byte[]) * @see #getParameter(byte[], byte[])
* @hide
*/ */
public int getParameter(int[] param, byte[] value) public int getParameter(int[] param, byte[] value)
throws IllegalStateException { throws IllegalStateException {
@@ -673,6 +741,7 @@ public class AudioEffect {
* Send a command to the effect engine. This method is intended to send * Send a command to the effect engine. This method is intended to send
* proprietary commands to a particular effect implementation. * proprietary commands to a particular effect implementation.
* *
* @hide
*/ */
public int command(int cmdCode, byte[] command, byte[] reply) public int command(int cmdCode, byte[] command, byte[] reply)
throws IllegalStateException { throws IllegalStateException {
@@ -709,7 +778,7 @@ public class AudioEffect {
} }
/** /**
* Returns effect engine enable state * Returns effect enabled state
* *
* @return true if the effect is enabled, false otherwise. * @return true if the effect is enabled, false otherwise.
* @throws IllegalStateException * @throws IllegalStateException
@@ -768,6 +837,7 @@ public class AudioEffect {
* Sets the listener AudioEffect notifies when a parameter is changed. * Sets the listener AudioEffect notifies when a parameter is changed.
* *
* @param listener * @param listener
* @hide
*/ */
public void setParameterListener(OnParameterChangeListener listener) { public void setParameterListener(OnParameterChangeListener listener) {
synchronized (mListenerLock) { synchronized (mListenerLock) {
@@ -828,6 +898,7 @@ public class AudioEffect {
/** /**
* The OnParameterChangeListener interface defines a method called by the AudioEffect * The OnParameterChangeListener interface defines a method called by the AudioEffect
* when a parameter is changed in the effect engine by the controlling application. * when a parameter is changed in the effect engine by the controlling application.
* @hide
*/ */
public interface OnParameterChangeListener { public interface OnParameterChangeListener {
/** /**
@@ -914,8 +985,7 @@ public class AudioEffect {
* {@link #ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION} and * {@link #ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION} and
* {@link #ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION} intents. * {@link #ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION} intents.
* <p>The extra value is of type int and is the audio session ID. * <p>The extra value is of type int and is the audio session ID.
* * @see android.media.MediaPlayer#getAudioSessionId() for details on audio sessions.
* @see android.media.MediaPlayer#setAudioSessionId(int)
*/ */
public static final String EXTRA_AUDIO_SESSION = "android.media.extra.AUDIO_SESSION"; public static final String EXTRA_AUDIO_SESSION = "android.media.extra.AUDIO_SESSION";
@@ -1086,6 +1156,9 @@ public class AudioEffect {
// Utility methods // Utility methods
// ------------------ // ------------------
/**
* @hide
*/
public void checkState(String methodName) throws IllegalStateException { public void checkState(String methodName) throws IllegalStateException {
synchronized (mStateLock) { synchronized (mStateLock) {
if (mState != STATE_INITIALIZED) { if (mState != STATE_INITIALIZED) {
@@ -1095,6 +1168,9 @@ public class AudioEffect {
} }
} }
/**
* @hide
*/
public void checkStatus(int status) { public void checkStatus(int status) {
switch (status) { switch (status) {
case AudioEffect.SUCCESS: case AudioEffect.SUCCESS:
@@ -1110,11 +1186,17 @@ public class AudioEffect {
} }
} }
/**
* @hide
*/
public int byteArrayToInt(byte[] valueBuf) { public int byteArrayToInt(byte[] valueBuf) {
return byteArrayToInt(valueBuf, 0); return byteArrayToInt(valueBuf, 0);
} }
/**
* @hide
*/
public int byteArrayToInt(byte[] valueBuf, int offset) { public int byteArrayToInt(byte[] valueBuf, int offset) {
ByteBuffer converter = ByteBuffer.wrap(valueBuf); ByteBuffer converter = ByteBuffer.wrap(valueBuf);
converter.order(ByteOrder.nativeOrder()); converter.order(ByteOrder.nativeOrder());
@@ -1122,6 +1204,9 @@ public class AudioEffect {
} }
/**
* @hide
*/
public byte[] intToByteArray(int value) { public byte[] intToByteArray(int value) {
ByteBuffer converter = ByteBuffer.allocate(4); ByteBuffer converter = ByteBuffer.allocate(4);
converter.order(ByteOrder.nativeOrder()); converter.order(ByteOrder.nativeOrder());
@@ -1129,10 +1214,16 @@ public class AudioEffect {
return converter.array(); return converter.array();
} }
/**
* @hide
*/
public short byteArrayToShort(byte[] valueBuf) { public short byteArrayToShort(byte[] valueBuf) {
return byteArrayToShort(valueBuf, 0); return byteArrayToShort(valueBuf, 0);
} }
/**
* @hide
*/
public short byteArrayToShort(byte[] valueBuf, int offset) { public short byteArrayToShort(byte[] valueBuf, int offset) {
ByteBuffer converter = ByteBuffer.wrap(valueBuf); ByteBuffer converter = ByteBuffer.wrap(valueBuf);
converter.order(ByteOrder.nativeOrder()); converter.order(ByteOrder.nativeOrder());
@@ -1140,6 +1231,9 @@ public class AudioEffect {
} }
/**
* @hide
*/
public byte[] shortToByteArray(short value) { public byte[] shortToByteArray(short value) {
ByteBuffer converter = ByteBuffer.allocate(2); ByteBuffer converter = ByteBuffer.allocate(2);
converter.order(ByteOrder.nativeOrder()); converter.order(ByteOrder.nativeOrder());
@@ -1148,6 +1242,9 @@ public class AudioEffect {
return converter.array(); return converter.array();
} }
/**
* @hide
*/
public byte[] concatArrays(byte[]... arrays) { public byte[] concatArrays(byte[]... arrays) {
int len = 0; int len = 0;
for (byte[] a : arrays) { for (byte[] a : arrays) {
@@ -1162,5 +1259,4 @@ public class AudioEffect {
} }
return b; return b;
} }
} }

View File

@@ -14,12 +14,12 @@
* limitations under the License. * limitations under the License.
*/ */
package android.media; package android.media.audiofx;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.media.AudioEffect; import android.media.audiofx.AudioEffect;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
@@ -32,15 +32,19 @@ import java.util.StringTokenizer;
/** /**
* Bass boost is an audio effect to boost or amplify low frequencies of the sound. It is comparable * Bass boost is an audio effect to boost or amplify low frequencies of the sound. It is comparable
* to a simple equalizer but limited to one band amplification in the low frequency range. * to a simple equalizer but limited to one band amplification in the low frequency range.
* <p>An application creates a BassBoost object to instantiate and control a bass boost engine * <p>An application creates a BassBoost object to instantiate and control a bass boost engine in
* in the audio framework. * the audio framework.
* <p>The methods, parameter types and units exposed by the BassBoost implementation are directly * <p>The methods, parameter types and units exposed by the BassBoost implementation are directly
* mapping those defined by the OpenSL ES 1.0.1 Specification (http://www.khronos.org/opensles/) * mapping those defined by the OpenSL ES 1.0.1 Specification (http://www.khronos.org/opensles/)
* for the SLBassBoostItf interface. Please refer to this specification for more details. * 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 * <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 * ID of this AudioTrack or MediaPlayer when constructing the BassBoost.
* is specified, the BassBoost applies to the main audio output mix. * If the audio session ID 0 is specified, the BassBoost applies to the main audio output mix.
* <p> See {@link android.media.AudioEffect} class for more details on controlling audio effects. * <p>Creating a BassBoost on the output mix (audio session 0) requires permission
* {@link android.Manifest.permission#MODIFY_AUDIO_SETTINGS}
* <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.
*/ */
public class BassBoost extends AudioEffect { public class BassBoost extends AudioEffect {
@@ -55,7 +59,7 @@ public class BassBoost extends AudioEffect {
public static final int PARAM_STRENGTH_SUPPORTED = 0; public static final int PARAM_STRENGTH_SUPPORTED = 0;
/** /**
* Bass boost effect strength. Parameter ID for * Bass boost effect strength. Parameter ID for
* {@link android.media.BassBoost.OnParameterChangeListener} * {@link android.media.audiofx.BassBoost.OnParameterChangeListener}
*/ */
public static final int PARAM_STRENGTH = 1; public static final int PARAM_STRENGTH = 1;
@@ -155,7 +159,6 @@ public class BassBoost extends AudioEffect {
* BassBoost engine. * BassBoost engine.
* @param effect the BassBoost on which the interface is registered. * @param effect the BassBoost on which the interface is registered.
* @param status status of the set parameter operation. * @param status status of the set parameter operation.
* See {@link android.media.AudioEffect#setParameter(byte[], byte[])}.
* @param param ID of the modified parameter. See {@link #PARAM_STRENGTH} ... * @param param ID of the modified parameter. See {@link #PARAM_STRENGTH} ...
* @param value the new parameter value. * @param value the new parameter value.
*/ */

View File

@@ -14,12 +14,12 @@
* limitations under the License. * limitations under the License.
*/ */
package android.media; package android.media.audiofx;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.media.AudioEffect; import android.media.audiofx.AudioEffect;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
@@ -28,18 +28,18 @@ import java.nio.ByteBuffer;
import java.util.StringTokenizer; import java.util.StringTokenizer;
/** /**
* A sound generated within a room travels in many directions. The listener first hears the * A sound generated within a room travels in many directions. The listener first hears the direct
* direct sound from the source itself. Later, he or she hears discrete echoes caused by sound * sound from the source itself. Later, he or she hears discrete echoes caused by sound bouncing off
* bouncing off nearby walls, the ceiling and the floor. As sound waves arrive after * nearby walls, the ceiling and the floor. As sound waves arrive after undergoing more and more
* undergoing more and more reflections, individual reflections become indistinguishable and * reflections, individual reflections become indistinguishable and the listener hears continuous
* the listener hears continuous reverberation that decays over time. * reverberation that decays over time.
* Reverb is vital for modeling a listener's environment. It can be used in music applications * Reverb is vital for modeling a listener's environment. It can be used in music applications
* to simulate music being played back in various environments, or in games to immerse the * to simulate music being played back in various environments, or in games to immerse the
* listener within the game's environment. * listener within the game's environment.
* The EnvironmentalReverb class allows an application to control each reverb engine property in a * The EnvironmentalReverb class allows an application to control each reverb engine property in a
* global reverb environment and is more suitable for games. For basic control, more suitable for * global reverb environment and is more suitable for games. For basic control, more suitable for
* music applications, it is recommended to use the * music applications, it is recommended to use the
* {@link android.media.PresetReverb} class. * {@link android.media.audiofx.PresetReverb} class.
* <p>An application creates a EnvironmentalReverb object to instantiate and control a reverb engine * <p>An application creates a EnvironmentalReverb object to instantiate and control a reverb engine
* in the audio framework. * in the audio framework.
* <p>The methods, parameter types and units exposed by the EnvironmentalReverb implementation are * <p>The methods, parameter types and units exposed by the EnvironmentalReverb implementation are
@@ -51,7 +51,9 @@ import java.util.StringTokenizer;
* they must be explicitely attached to it and a send level must be specified. Use the effect ID * they must be explicitely attached to it and a send level must be specified. Use the effect ID
* returned by getId() method to designate this particular effect when attaching it to the * returned by getId() method to designate this particular effect when attaching it to the
* MediaPlayer or AudioTrack. * MediaPlayer or AudioTrack.
* <p> See {@link android.media.AudioEffect} class for more details on controlling * <p>Creating a reverb on the output mix (audio session 0) requires permission
* {@link android.Manifest.permission#MODIFY_AUDIO_SETTINGS}
* <p>See {@link android.media.audiofx.AudioEffect} class for more details on controlling
* audio effects. * audio effects.
*/ */
@@ -76,7 +78,7 @@ public class EnvironmentalReverb extends AudioEffect {
public static final int PARAM_DECAY_TIME = 2; public static final int PARAM_DECAY_TIME = 2;
/** /**
* Decay HF ratio. Parameter ID for * Decay HF ratio. Parameter ID for
* {@link android.media.EnvironmentalReverb.OnParameterChangeListener} * {@link android.media.audiofx.EnvironmentalReverb.OnParameterChangeListener}
*/ */
public static final int PARAM_DECAY_HF_RATIO = 3; public static final int PARAM_DECAY_HF_RATIO = 3;
/** /**
@@ -444,7 +446,6 @@ public class EnvironmentalReverb extends AudioEffect {
* EnvironmentalReverb engine. * EnvironmentalReverb engine.
* @param effect the EnvironmentalReverb on which the interface is registered. * @param effect the EnvironmentalReverb on which the interface is registered.
* @param status status of the set parameter operation. * @param status status of the set parameter operation.
* See {@link android.media.AudioEffect#setParameter(byte[], byte[])}.
* @param param ID of the modified parameter. See {@link #PARAM_ROOM_LEVEL} ... * @param param ID of the modified parameter. See {@link #PARAM_ROOM_LEVEL} ...
* @param value the new parameter value. * @param value the new parameter value.
*/ */

View File

@@ -14,12 +14,12 @@
* limitations under the License. * limitations under the License.
*/ */
package android.media; package android.media.audiofx;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.media.AudioEffect; import android.media.audiofx.AudioEffect;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
@@ -41,7 +41,11 @@ import java.util.StringTokenizer;
* <p>To attach the Equalizer to a particular AudioTrack or MediaPlayer, specify the audio session * <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 * 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. * is specified, the Equalizer applies to the main audio output mix.
* <p> See {@link android.media.AudioEffect} class for more details on controlling audio effects. * <p>Creating an Equalizer on the output mix (audio session 0) requires permission
* {@link android.Manifest.permission#MODIFY_AUDIO_SETTINGS}
* <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.
*/ */
public class Equalizer extends AudioEffect { public class Equalizer extends AudioEffect {
@@ -68,7 +72,7 @@ public class Equalizer extends AudioEffect {
public static final int PARAM_CENTER_FREQ = 3; public static final int PARAM_CENTER_FREQ = 3;
/** /**
* Band frequency range. Parameter ID for * Band frequency range. Parameter ID for
* {@link android.media.Equalizer.OnParameterChangeListener} * {@link android.media.audiofx.Equalizer.OnParameterChangeListener}
*/ */
public static final int PARAM_BAND_FREQ_RANGE = 4; public static final int PARAM_BAND_FREQ_RANGE = 4;
/** /**
@@ -380,7 +384,6 @@ public class Equalizer extends AudioEffect {
* Equalizer engine. * Equalizer engine.
* @param effect the Equalizer on which the interface is registered. * @param effect the Equalizer on which the interface is registered.
* @param status status of the set parameter operation. * @param status status of the set parameter operation.
* See {@link android.media.AudioEffect#setParameter(byte[], byte[])}.
* @param param1 ID of the modified parameter. See {@link #PARAM_BAND_LEVEL} ... * @param param1 ID of the modified parameter. See {@link #PARAM_BAND_LEVEL} ...
* @param param2 additional parameter qualifier (e.g the band for band level parameter). * @param param2 additional parameter qualifier (e.g the band for band level parameter).
* @param value the new parameter value. * @param value the new parameter value.

View File

@@ -14,12 +14,12 @@
* limitations under the License. * limitations under the License.
*/ */
package android.media; package android.media.audiofx;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.media.AudioEffect; import android.media.audiofx.AudioEffect;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
@@ -40,7 +40,7 @@ import java.util.StringTokenizer;
* The PresetReverb class allows an application to configure the global reverb using a reverb preset. * The PresetReverb class allows an application to configure the global reverb using a reverb preset.
* This is primarily used for adding some reverb in a music playback context. Applications * This is primarily used for adding some reverb in a music playback context. Applications
* requiring control over a more advanced environmental reverb are advised to use the * requiring control over a more advanced environmental reverb are advised to use the
* {@link android.media.EnvironmentalReverb} class. * {@link android.media.audiofx.EnvironmentalReverb} class.
* <p>An application creates a PresetReverb object to instantiate and control a reverb engine in the * <p>An application creates a PresetReverb object to instantiate and control a reverb engine in the
* audio framework. * audio framework.
* <p>The methods, parameter types and units exposed by the PresetReverb implementation are * <p>The methods, parameter types and units exposed by the PresetReverb implementation are
@@ -52,7 +52,10 @@ import java.util.StringTokenizer;
* they must be explicitely attached to it and a send level must be specified. Use the effect ID * they must be explicitely attached to it and a send level must be specified. Use the effect ID
* returned by getId() method to designate this particular effect when attaching it to the * returned by getId() method to designate this particular effect when attaching it to the
* MediaPlayer or AudioTrack. * MediaPlayer or AudioTrack.
* <p> See {@link android.media.AudioEffect} class for more details on controlling audio effects. * <p>Creating a reverb on the output mix (audio session 0) requires permission
* {@link android.Manifest.permission#MODIFY_AUDIO_SETTINGS}
* <p>See {@link android.media.audiofx.AudioEffect} class for more details on controlling
* audio effects.
*/ */
public class PresetReverb extends AudioEffect { public class PresetReverb extends AudioEffect {
@@ -64,7 +67,7 @@ public class PresetReverb extends AudioEffect {
/** /**
* Preset. Parameter ID for * Preset. Parameter ID for
* {@link android.media.PresetReverb.OnParameterChangeListener} * {@link android.media.audiofx.PresetReverb.OnParameterChangeListener}
*/ */
public static final int PARAM_PRESET = 0; public static final int PARAM_PRESET = 0;
@@ -174,7 +177,6 @@ public class PresetReverb extends AudioEffect {
* PresetReverb engine. * PresetReverb engine.
* @param effect the PresetReverb on which the interface is registered. * @param effect the PresetReverb on which the interface is registered.
* @param status status of the set parameter operation. * @param status status of the set parameter operation.
* See {@link android.media.AudioEffect#setParameter(byte[], byte[])}.
* @param param ID of the modified parameter. See {@link #PARAM_PRESET} ... * @param param ID of the modified parameter. See {@link #PARAM_PRESET} ...
* @param value the new parameter value. * @param value the new parameter value.
*/ */

View File

@@ -14,12 +14,12 @@
* limitations under the License. * limitations under the License.
*/ */
package android.media; package android.media.audiofx;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.media.AudioEffect; import android.media.audiofx.AudioEffect;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
@@ -42,7 +42,11 @@ import java.util.StringTokenizer;
* <p>To attach the Virtualizer to a particular AudioTrack or MediaPlayer, specify the audio session * <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 * 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. * is specified, the Virtualizer applies to the main audio output mix.
* <p> See {@link android.media.AudioEffect} class for more details on controlling audio effects. * <p>Creating a Virtualizer on the output mix (audio session 0) requires permission
* {@link android.Manifest.permission#MODIFY_AUDIO_SETTINGS}
* <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.
*/ */
public class Virtualizer extends AudioEffect { public class Virtualizer extends AudioEffect {
@@ -56,7 +60,7 @@ public class Virtualizer extends AudioEffect {
public static final int PARAM_STRENGTH_SUPPORTED = 0; public static final int PARAM_STRENGTH_SUPPORTED = 0;
/** /**
* Virtualizer effect strength. Parameter ID for * Virtualizer effect strength. Parameter ID for
* {@link android.media.Virtualizer.OnParameterChangeListener} * {@link android.media.audiofx.Virtualizer.OnParameterChangeListener}
*/ */
public static final int PARAM_STRENGTH = 1; public static final int PARAM_STRENGTH = 1;
@@ -156,7 +160,6 @@ public class Virtualizer extends AudioEffect {
* Virtualizer engine. * Virtualizer engine.
* @param effect the Virtualizer on which the interface is registered. * @param effect the Virtualizer on which the interface is registered.
* @param status status of the set parameter operation. * @param status status of the set parameter operation.
* See {@link android.media.AudioEffect#setParameter(byte[], byte[])}.
* @param param ID of the modified parameter. See {@link #PARAM_STRENGTH} ... * @param param ID of the modified parameter. See {@link #PARAM_STRENGTH} ...
* @param value the new parameter value. * @param value the new parameter value.
*/ */

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package android.media; package android.media.audiofx;
import android.util.Log; import android.util.Log;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
@@ -32,8 +32,8 @@ import android.os.Message;
* visualized:<br> * visualized:<br>
* <ul> * <ul>
* <li>If the session is 0, the audio output mix is visualized</li> * <li>If the session is 0, the audio output mix is visualized</li>
* <li>If the session is not 0, the audio from a particular {@link MediaPlayer} or * <li>If the session is not 0, the audio from a particular {@link android.media.MediaPlayer} or
* {@link AudioTrack} * {@link android.media.AudioTrack}
* using this audio session is visualized </li> * using this audio session is visualized </li>
* </ul> * </ul>
* <p>Two types of representation of audio content can be captured: <br> * <p>Two types of representation of audio content can be captured: <br>
@@ -57,6 +57,8 @@ import android.os.Message;
* When data capture is not needed any more, the Visualizer should be disabled. * When data capture is not needed any more, the Visualizer should be disabled.
* <p>It is good practice to call the {@link #release()} method when the Visualizer is not used * <p>It is good practice to call the {@link #release()} method when the Visualizer is not used
* anymore to free up native resources associated to the Visualizer instance. * anymore to free up native resources associated to the Visualizer instance.
* <p>Creating a Visualizer on the output mix (audio session 0) requires permission
* {@link android.Manifest.permission#MODIFY_AUDIO_SETTINGS}
*/ */
public class Visualizer { public class Visualizer {

View File

@@ -0,0 +1,5 @@
<HTML>
<BODY>
Provides classes that manage audio effects implemented in the media framework.
</BODY>
</HTML>

View File

@@ -37,7 +37,7 @@ using namespace android;
#define AUDIOEFFECT_ERROR_DEAD_OBJECT -7 #define AUDIOEFFECT_ERROR_DEAD_OBJECT -7
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
static const char* const kClassPathName = "android/media/AudioEffect"; static const char* const kClassPathName = "android/media/audiofx/AudioEffect";
struct fields_t { struct fields_t {
// these fields provide access from C++ to the... // these fields provide access from C++ to the...
@@ -228,9 +228,9 @@ android_media_AudioEffect_native_init(JNIEnv *env)
return; return;
} }
clazz = env->FindClass("android/media/AudioEffect$Descriptor"); clazz = env->FindClass("android/media/audiofx/AudioEffect$Descriptor");
if (clazz == NULL) { if (clazz == NULL) {
LOGE("Can't find android/media/AudioEffect$Descriptor class"); LOGE("Can't find android/media/audiofx/AudioEffect$Descriptor class");
return; return;
} }
fields.clazzDesc = (jclass)env->NewGlobalRef(clazz); fields.clazzDesc = (jclass)env->NewGlobalRef(clazz);
@@ -241,7 +241,7 @@ android_media_AudioEffect_native_init(JNIEnv *env)
"<init>", "<init>",
"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V"); "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
if (fields.midDescCstor == NULL) { if (fields.midDescCstor == NULL) {
LOGE("Can't find android/media/AudioEffect$Descriptor class constructor"); LOGE("Can't find android/media/audiofx/AudioEffect$Descriptor class constructor");
return; return;
} }
} }

View File

@@ -40,7 +40,7 @@ using namespace android;
#define NATIVE_EVENT_FFT_CAPTURE 1 #define NATIVE_EVENT_FFT_CAPTURE 1
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
static const char* const kClassPathName = "android/media/Visualizer"; static const char* const kClassPathName = "android/media/audiofx/Visualizer";
struct fields_t { struct fields_t {
// these fields provide access from C++ to the... // these fields provide access from C++ to the...

View File

@@ -16,7 +16,7 @@
package com.android.mediaframeworktest.functional; package com.android.mediaframeworktest.functional;
import android.media.Visualizer; import android.media.audiofx.Visualizer;
import android.util.Log; import android.util.Log;
/** /**

View File

@@ -19,12 +19,12 @@ package com.android.mediaframeworktest.functional;
import com.android.mediaframeworktest.MediaFrameworkTest; import com.android.mediaframeworktest.MediaFrameworkTest;
import com.android.mediaframeworktest.MediaNames; import com.android.mediaframeworktest.MediaNames;
import android.content.res.AssetFileDescriptor; import android.content.res.AssetFileDescriptor;
import android.media.AudioEffect; import android.media.audiofx.AudioEffect;
import android.media.AudioFormat; import android.media.AudioFormat;
import android.media.AudioManager; import android.media.AudioManager;
import android.media.AudioTrack; import android.media.AudioTrack;
import android.media.EnvironmentalReverb; import android.media.audiofx.EnvironmentalReverb;
import android.media.Equalizer; import android.media.audiofx.Equalizer;
import android.media.MediaPlayer; import android.media.MediaPlayer;
import android.os.Looper; import android.os.Looper;
@@ -103,14 +103,14 @@ public class MediaAudioEffectTest extends ActivityInstrumentationTestCase2<Media
boolean hasEnvReverb = false; boolean hasEnvReverb = false;
for (int i = 0; i < desc.length; i++) { for (int i = 0; i < desc.length; i++) {
if (desc[i].mType.equals(AudioEffect.EFFECT_TYPE_EQUALIZER)) { if (desc[i].type.equals(AudioEffect.EFFECT_TYPE_EQUALIZER)) {
hasEQ = true; hasEQ = true;
} if (desc[i].mType.equals(AudioEffect.EFFECT_TYPE_BASS_BOOST)) { } if (desc[i].type.equals(AudioEffect.EFFECT_TYPE_BASS_BOOST)) {
hasBassBoost = true; hasBassBoost = true;
} else if (desc[i].mType.equals(AudioEffect.EFFECT_TYPE_VIRTUALIZER)) { } else if (desc[i].type.equals(AudioEffect.EFFECT_TYPE_VIRTUALIZER)) {
hasVirtualizer = true; hasVirtualizer = true;
} }
else if (desc[i].mType.equals(AudioEffect.EFFECT_TYPE_ENV_REVERB)) { else if (desc[i].type.equals(AudioEffect.EFFECT_TYPE_ENV_REVERB)) {
hasEnvReverb = true; hasEnvReverb = true;
} }
} }
@@ -132,7 +132,7 @@ public class MediaAudioEffectTest extends ActivityInstrumentationTestCase2<Media
AudioEffect.Descriptor[] desc = AudioEffect.queryEffects(); AudioEffect.Descriptor[] desc = AudioEffect.queryEffects();
assertTrue(msg+": no effects found", (desc.length != 0)); assertTrue(msg+": no effects found", (desc.length != 0));
try { try {
AudioEffect effect = new AudioEffect(desc[0].mType, AudioEffect effect = new AudioEffect(desc[0].type,
AudioEffect.EFFECT_TYPE_NULL, AudioEffect.EFFECT_TYPE_NULL,
0, 0,
0); 0);
@@ -146,7 +146,7 @@ public class MediaAudioEffectTest extends ActivityInstrumentationTestCase2<Media
effect.release(); effect.release();
} }
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
msg = msg.concat(": Effect not found: "+desc[0].mName); msg = msg.concat(": Effect not found: "+desc[0].name);
result = false; result = false;
} catch (UnsupportedOperationException e) { } catch (UnsupportedOperationException e) {
msg = msg.concat(": Effect library not loaded"); msg = msg.concat(": Effect library not loaded");
@@ -164,13 +164,13 @@ public class MediaAudioEffectTest extends ActivityInstrumentationTestCase2<Media
assertTrue(msg+"no effects found", (desc.length != 0)); assertTrue(msg+"no effects found", (desc.length != 0));
try { try {
AudioEffect effect = new AudioEffect(AudioEffect.EFFECT_TYPE_NULL, AudioEffect effect = new AudioEffect(AudioEffect.EFFECT_TYPE_NULL,
desc[0].mUuid, desc[0].uuid,
0, 0,
0); 0);
assertNotNull(msg + ": could not create AudioEffect", effect); assertNotNull(msg + ": could not create AudioEffect", effect);
effect.release(); effect.release();
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
msg = msg.concat(": Effect not found: "+desc[0].mName); msg = msg.concat(": Effect not found: "+desc[0].name);
result = false; result = false;
} catch (UnsupportedOperationException e) { } catch (UnsupportedOperationException e) {
msg = msg.concat(": Effect library not loaded"); msg = msg.concat(": Effect library not loaded");

View File

@@ -20,10 +20,10 @@ import com.android.mediaframeworktest.MediaFrameworkTest;
import com.android.mediaframeworktest.MediaNames; import com.android.mediaframeworktest.MediaNames;
import android.content.Context; import android.content.Context;
import android.content.res.AssetFileDescriptor; import android.content.res.AssetFileDescriptor;
import android.media.AudioEffect; import android.media.audiofx.AudioEffect;
import android.media.AudioManager; import android.media.AudioManager;
import android.media.BassBoost; import android.media.audiofx.BassBoost;
import android.media.Visualizer; import android.media.audiofx.Visualizer;
import android.media.MediaPlayer; import android.media.MediaPlayer;
import android.os.Looper; import android.os.Looper;

View File

@@ -20,10 +20,10 @@ import com.android.mediaframeworktest.MediaFrameworkTest;
import com.android.mediaframeworktest.MediaNames; import com.android.mediaframeworktest.MediaNames;
import android.content.Context; import android.content.Context;
import android.content.res.AssetFileDescriptor; import android.content.res.AssetFileDescriptor;
import android.media.AudioEffect; import android.media.audiofx.AudioEffect;
import android.media.AudioManager; import android.media.AudioManager;
import android.media.EnvironmentalReverb; import android.media.audiofx.EnvironmentalReverb;
import android.media.Visualizer; import android.media.audiofx.Visualizer;
import android.media.MediaPlayer; import android.media.MediaPlayer;
import android.os.Looper; import android.os.Looper;

View File

@@ -20,10 +20,10 @@ import com.android.mediaframeworktest.MediaFrameworkTest;
import com.android.mediaframeworktest.MediaNames; import com.android.mediaframeworktest.MediaNames;
import android.content.Context; import android.content.Context;
import android.content.res.AssetFileDescriptor; import android.content.res.AssetFileDescriptor;
import android.media.AudioEffect; import android.media.audiofx.AudioEffect;
import android.media.AudioManager; import android.media.AudioManager;
import android.media.Equalizer; import android.media.audiofx.Equalizer;
import android.media.Visualizer; import android.media.audiofx.Visualizer;
import android.media.MediaPlayer; import android.media.MediaPlayer;
import android.os.Looper; import android.os.Looper;

View File

@@ -20,10 +20,10 @@ import com.android.mediaframeworktest.MediaFrameworkTest;
import com.android.mediaframeworktest.MediaNames; import com.android.mediaframeworktest.MediaNames;
import android.content.Context; import android.content.Context;
import android.content.res.AssetFileDescriptor; import android.content.res.AssetFileDescriptor;
import android.media.AudioEffect; import android.media.audiofx.AudioEffect;
import android.media.AudioManager; import android.media.AudioManager;
import android.media.PresetReverb; import android.media.audiofx.PresetReverb;
import android.media.Visualizer; import android.media.audiofx.Visualizer;
import android.media.MediaPlayer; import android.media.MediaPlayer;
import android.os.Looper; import android.os.Looper;

View File

@@ -20,10 +20,10 @@ import com.android.mediaframeworktest.MediaFrameworkTest;
import com.android.mediaframeworktest.MediaNames; import com.android.mediaframeworktest.MediaNames;
import android.content.Context; import android.content.Context;
import android.content.res.AssetFileDescriptor; import android.content.res.AssetFileDescriptor;
import android.media.AudioEffect; import android.media.audiofx.AudioEffect;
import android.media.AudioManager; import android.media.AudioManager;
import android.media.Virtualizer; import android.media.audiofx.Virtualizer;
import android.media.Visualizer; import android.media.audiofx.Visualizer;
import android.media.MediaPlayer; import android.media.MediaPlayer;
import android.os.Looper; import android.os.Looper;

View File

@@ -20,9 +20,9 @@ import com.android.mediaframeworktest.MediaFrameworkTest;
import com.android.mediaframeworktest.MediaNames; import com.android.mediaframeworktest.MediaNames;
import android.content.Context; import android.content.Context;
import android.content.res.AssetFileDescriptor; import android.content.res.AssetFileDescriptor;
import android.media.AudioEffect; import android.media.audiofx.AudioEffect;
import android.media.AudioManager; import android.media.AudioManager;
import android.media.Visualizer; import android.media.audiofx.Visualizer;
import android.media.MediaPlayer; import android.media.MediaPlayer;
import android.os.Looper; import android.os.Looper;