public class SoundEffect extends Object
SystemCapability.Multimedia#AUDIO| 限定符和类型 | 类 | 说明 |
|---|---|---|
static class |
SoundEffect.SoundEffectInfo |
Provides sound effect information.
|
| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static String |
SOUND_EFFECT_MODE_AUXILIARY |
Indicates the auxiliary mode.
|
static String |
SOUND_EFFECT_MODE_INSERT |
Indicates the insert mode.
|
static String |
SOUND_EFFECT_MODE_PRE_PROCESSING |
Indicates the preprocessing mode.
|
static UUID |
SOUND_EFFECT_TYPE_AE |
Indicates the ID of the audio equalizer effect.
|
static UUID |
SOUND_EFFECT_TYPE_EC |
Indicates the ID of the echo cancellation effect.
|
static UUID |
SOUND_EFFECT_TYPE_GC |
Indicates the ID of the gain control effect.
|
static UUID |
SOUND_EFFECT_TYPE_INVALID |
Indicates the ID of an invalid sound effect.
|
static UUID |
SOUND_EFFECT_TYPE_NS |
Indicates the ID of the noise reduction effect.
|
| 构造器 | 说明 |
|---|---|
SoundEffect(UUID uid,
UUID type,
int priority,
int sessionId,
String packageName) |
A constructor used to create a
SoundEffect instance. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
static SoundEffect.SoundEffectInfo[] |
acquireEffects() |
Obtains sound effects available on a device.
|
boolean |
getActivated() |
Checks whether a sound effect is activated.
|
int |
getEffectId() |
Obtains the native ID of a sound effect.
|
SoundEffect.SoundEffectInfo |
getEffectInfo() |
Obtains sound effect information.
|
static boolean |
isEffectAvailable(UUID type) |
Checks whether a device supports sound effects of a specified type.
|
boolean |
release() |
Releases sound effect resources.
|
boolean |
setActivated(boolean activated) |
Sets the sound effect status.
|
public static final String SOUND_EFFECT_MODE_AUXILIARY
public static final String SOUND_EFFECT_MODE_INSERT
public static final String SOUND_EFFECT_MODE_PRE_PROCESSING
public static final UUID SOUND_EFFECT_TYPE_AE
public static final UUID SOUND_EFFECT_TYPE_EC
public static final UUID SOUND_EFFECT_TYPE_GC
public static final UUID SOUND_EFFECT_TYPE_INVALID
public static final UUID SOUND_EFFECT_TYPE_NS
public SoundEffect(UUID uid, UUID type, int priority, int sessionId, String packageName) throws UnsupportedOperationException
SoundEffect instance.uid - Indicates a sound effect ID.type - Indicates a sound effect type.priority - Indicates the priority of a sound effect.sessionId - Indicates the ID of an audio recording or playback session.packageName - Indicates an application package name.UnsupportedOperationException - Throws this exception if initialization of this class fails.public static boolean isEffectAvailable(UUID type)
type - Indicates a sound effect type.true if the device supports sound effects of the specified type;
returns false otherwise.public static SoundEffect.SoundEffectInfo[] acquireEffects()
public SoundEffect.SoundEffectInfo getEffectInfo()
SoundEffectInfo object containing the sound effect information.public int getEffectId()
public boolean setActivated(boolean activated)
activated - Specifies whether to activate a sound effect. Value true means the sound effect
will be activated, while false means the opposite.true if the sound effect is activated; returns false otherwise.public boolean getActivated()
true if the sound effect is activated; returns false otherwise.public boolean release()
true if the resources are released; returns false otherwise.