public class PresetReverb extends AudioEffect
EnvironmentalReverb
class.
An application creates a PresetReverb object to instantiate and control a reverb engine in the audio framework.
The methods, parameter types and units exposed by the PresetReverb implementation are directly mapping those defined by the OpenSL ES 1.0.1 Specification (http://www.khronos.org/opensles/) for the SLPresetReverbItf interface. Please refer to this specification for more details.
The PresetReverb is an output mix auxiliary effect and should be created on Audio session 0. In order for a MediaPlayer or AudioTrack to be fed into this effect, 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 MediaPlayer or AudioTrack.
Creating a reverb on the output mix (audio session 0) requires permission
android.Manifest.permission#MODIFY_AUDIO_SETTINGS
See AudioEffect
class for more details on controlling
audio effects.
Modifier and Type | Class and Description |
---|---|
static interface |
PresetReverb.OnParameterChangeListener
The OnParameterChangeListener interface defines a method called by the PresetReverb
when a parameter value has changed.
|
static class |
PresetReverb.Settings
The Settings class regroups all preset reverb parameters.
|
AudioEffect.Descriptor, AudioEffect.OnControlStatusChangeListener, AudioEffect.OnEnableStatusChangeListener
Modifier and Type | Field and Description |
---|---|
static int |
PARAM_PRESET
Preset.
|
static short |
PRESET_LARGEHALL
Reverb preset representing a large-sized hall suitable for a full orchestra
|
static short |
PRESET_LARGEROOM
Reverb preset representing a large-sized room suitable for live performances
|
static short |
PRESET_MEDIUMHALL
Reverb preset representing a medium-sized hall
|
static short |
PRESET_MEDIUMROOM
Reverb preset representing a medium room with a length of ten meters or less
|
static short |
PRESET_NONE
No reverb or reflections
|
static short |
PRESET_PLATE
Reverb preset representing a synthesis of the traditional plate reverb
|
static short |
PRESET_SMALLROOM
Reverb preset representing a small room less than five meters in length
|
ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION, ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL, ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION, ALREADY_EXISTS, CONTENT_TYPE_GAME, CONTENT_TYPE_MOVIE, CONTENT_TYPE_MUSIC, CONTENT_TYPE_VOICE, EFFECT_AUXILIARY, EFFECT_INSERT, EFFECT_PRE_PROCESSING, EFFECT_TYPE_AEC, EFFECT_TYPE_AGC, EFFECT_TYPE_BASS_BOOST, EFFECT_TYPE_ENV_REVERB, EFFECT_TYPE_EQUALIZER, EFFECT_TYPE_NS, EFFECT_TYPE_NULL, EFFECT_TYPE_PRESET_REVERB, EFFECT_TYPE_VIRTUALIZER, ERROR, ERROR_BAD_VALUE, ERROR_DEAD_OBJECT, ERROR_INVALID_OPERATION, ERROR_NO_INIT, ERROR_NO_MEMORY, EXTRA_AUDIO_SESSION, EXTRA_CONTENT_TYPE, EXTRA_PACKAGE_NAME, mListenerLock, mNativeEventHandler, NATIVE_EVENT_CONTROL_STATUS, NATIVE_EVENT_ENABLED_STATUS, NATIVE_EVENT_PARAMETER_CHANGED, STATE_INITIALIZED, STATE_UNINITIALIZED, SUCCESS
Constructor and Description |
---|
PresetReverb(int priority,
int audioSession)
Class constructor.
|
Modifier and Type | Method and Description |
---|---|
short |
getPreset()
Gets current reverb preset.
|
PresetReverb.Settings |
getProperties()
Gets the preset reverb properties.
|
void |
setParameterListener(PresetReverb.OnParameterChangeListener listener)
Registers an OnParameterChangeListener interface.
|
void |
setPreset(short preset)
Enables a preset on the reverb.
|
void |
setProperties(PresetReverb.Settings settings)
Sets the preset reverb properties.
|
byteArrayToInt, byteArrayToInt, byteArrayToShort, byteArrayToShort, checkState, checkStatus, command, concatArrays, finalize, getDescriptor, getEnabled, getId, getParameter, getParameter, getParameter, getParameter, getParameter, getParameter, getParameter, hasControl, intToByteArray, isEffectTypeAvailable, isError, queryEffects, queryPreProcessings, release, setControlStatusListener, setEnabled, setEnableStatusListener, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameterListener, shortToByteArray
public static final int PARAM_PRESET
PresetReverb.OnParameterChangeListener
public static final short PRESET_NONE
public static final short PRESET_SMALLROOM
public static final short PRESET_MEDIUMROOM
public static final short PRESET_LARGEROOM
public static final short PRESET_MEDIUMHALL
public static final short PRESET_LARGEHALL
public static final short PRESET_PLATE
public PresetReverb(int priority, int audioSession) throws IllegalArgumentException, UnsupportedOperationException, RuntimeException
priority
- the priority level requested by the application for controlling the
PresetReverb 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.audioSession
- system wide unique audio session identifier. If audioSession
is not 0, the PresetReverb will be attached to the MediaPlayer or AudioTrack in the
same audio session. Otherwise, the PresetReverb will apply to the output mix.
As the PresetReverb is an auxiliary effect it is recommended to instantiate it on
audio session 0 and to attach it to the MediaPLayer auxiliary output.IllegalArgumentException
UnsupportedOperationException
RuntimeException
public void setPreset(short preset) throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
The reverb PRESET_NONE disables any reverb from the current output but does not free the resources associated with the reverb. For an application to signal to the implementation to free the resources, it must call the release() method.
preset
- this must be one of the the preset constants defined in this class.
e.g. PRESET_SMALLROOM
IllegalStateException
IllegalArgumentException
UnsupportedOperationException
public short getPreset() throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
IllegalStateException
IllegalArgumentException
UnsupportedOperationException
public void setParameterListener(PresetReverb.OnParameterChangeListener listener)
listener
- OnParameterChangeListener interface registeredpublic PresetReverb.Settings getProperties() throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
IllegalStateException
IllegalArgumentException
UnsupportedOperationException
public void setProperties(PresetReverb.Settings settings) throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
settings
- a PresetReverb.Settings object containing the properties to applyIllegalStateException
IllegalArgumentException
UnsupportedOperationException