public class EnvironmentalReverb extends AudioEffect
PresetReverb
class.
An application creates a EnvironmentalReverb object to instantiate and control a reverb engine in the audio framework.
The methods, parameter types and units exposed by the EnvironmentalReverb implementation are directly mapping those defined by the OpenSL ES 1.0.1 Specification (http://www.khronos.org/opensles/) for the SLEnvironmentalReverbItf interface. Please refer to this specification for more details.
The EnvironmentalReverb 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 |
EnvironmentalReverb.OnParameterChangeListener
The OnParameterChangeListener interface defines a method called by the EnvironmentalReverb
when a parameter value has changed.
|
static class |
EnvironmentalReverb.Settings
The Settings class regroups all environmental reverb parameters.
|
AudioEffect.Descriptor, AudioEffect.OnControlStatusChangeListener, AudioEffect.OnEnableStatusChangeListener
Modifier and Type | Field and Description |
---|---|
static int |
PARAM_DECAY_HF_RATIO
Decay HF ratio.
|
static int |
PARAM_DECAY_TIME
Decay time.
|
static int |
PARAM_DENSITY
Density.
|
static int |
PARAM_DIFFUSION
Diffusion.
|
static int |
PARAM_REFLECTIONS_DELAY
Early reflections delay.
|
static int |
PARAM_REFLECTIONS_LEVEL
Early reflections level.
|
static int |
PARAM_REVERB_DELAY
Reverb delay.
|
static int |
PARAM_REVERB_LEVEL
Reverb level.
|
static int |
PARAM_ROOM_HF_LEVEL
Room HF level.
|
static int |
PARAM_ROOM_LEVEL
Room level.
|
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 |
---|
EnvironmentalReverb(int priority,
int audioSession)
Class constructor.
|
Modifier and Type | Method and Description |
---|---|
short |
getDecayHFRatio()
Gets the ratio of high frequency decay time (at 5 kHz) relative to low frequencies.
|
int |
getDecayTime()
Gets the decay time.
|
short |
getDensity()
Gets the density level.
|
short |
getDiffusion()
Gets diffusion level.
|
EnvironmentalReverb.Settings |
getProperties()
Gets the environmental reverb properties.
|
int |
getReflectionsDelay()
Gets the reflections delay.
|
short |
getReflectionsLevel()
Gets the volume level of the early reflections.
|
int |
getReverbDelay()
Gets the reverb delay.
|
short |
getReverbLevel()
Gets the reverb level.
|
short |
getRoomHFLevel()
Gets the room HF level.
|
short |
getRoomLevel()
Gets the master volume level of the environmental reverb effect.
|
void |
setDecayHFRatio(short decayHFRatio)
Sets the ratio of high frequency decay time (at 5 kHz) relative to the decay time at low
frequencies.
|
void |
setDecayTime(int decayTime)
Sets the time taken for the level of reverberation to decay by 60 dB.
|
void |
setDensity(short density)
Controls the modal density of the late reverberation decay.
|
void |
setDiffusion(short diffusion)
Sets the echo density in the late reverberation decay.
|
void |
setParameterListener(EnvironmentalReverb.OnParameterChangeListener listener)
Registers an OnParameterChangeListener interface.
|
void |
setProperties(EnvironmentalReverb.Settings settings)
Sets the environmental reverb properties.
|
void |
setReflectionsDelay(int reflectionsDelay)
Sets the delay time for the early reflections.
|
void |
setReflectionsLevel(short reflectionsLevel)
Sets the volume level of the early reflections.
|
void |
setReverbDelay(int reverbDelay)
Sets the time between the first reflection and the reverberation.
|
void |
setReverbLevel(short reverbLevel)
Sets the volume level of the late reverberation.
|
void |
setRoomHFLevel(short roomHF)
Sets the volume level at 5 kHz relative to the volume level at low frequencies of the
overall reverb effect.
|
void |
setRoomLevel(short room)
Sets the master volume level of the environmental reverb effect.
|
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_ROOM_LEVEL
public static final int PARAM_ROOM_HF_LEVEL
public static final int PARAM_DECAY_TIME
public static final int PARAM_DECAY_HF_RATIO
EnvironmentalReverb.OnParameterChangeListener
public static final int PARAM_REFLECTIONS_LEVEL
public static final int PARAM_REFLECTIONS_DELAY
public static final int PARAM_REVERB_LEVEL
public static final int PARAM_REVERB_DELAY
public static final int PARAM_DIFFUSION
public static final int PARAM_DENSITY
public EnvironmentalReverb(int priority, int audioSession) throws IllegalArgumentException, UnsupportedOperationException, RuntimeException
priority
- the priority level requested by the application for controlling the
EnvironmentalReverb 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 EnvironmentalReverb will be attached to the MediaPlayer or AudioTrack in the
same audio session. Otherwise, the EnvironmentalReverb will apply to the output mix.
As the EnvironmentalReverb 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 setRoomLevel(short room) throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
room
- room level in millibels. The valid range is [-9000, 0].IllegalStateException
IllegalArgumentException
UnsupportedOperationException
public short getRoomLevel() throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
IllegalStateException
IllegalArgumentException
UnsupportedOperationException
public void setRoomHFLevel(short roomHF) throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
This controls a low-pass filter that will reduce the level of the high-frequency.
roomHF
- high frequency attenuation level in millibels. The valid range is [-9000, 0].IllegalStateException
IllegalArgumentException
UnsupportedOperationException
public short getRoomHFLevel() throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
IllegalStateException
IllegalArgumentException
UnsupportedOperationException
public void setDecayTime(int decayTime) throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
decayTime
- decay time in milliseconds. The valid range is [100, 20000].IllegalStateException
IllegalArgumentException
UnsupportedOperationException
public int getDecayTime() throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
IllegalStateException
IllegalArgumentException
UnsupportedOperationException
public void setDecayHFRatio(short decayHFRatio) throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
decayHFRatio
- high frequency decay ratio using a permille scale. The valid range is
[100, 2000]. A ratio of 1000 indicates that all frequencies decay at the same rate.IllegalStateException
IllegalArgumentException
UnsupportedOperationException
public short getDecayHFRatio() throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
setDecayHFRatio(short)
for units.IllegalStateException
IllegalArgumentException
UnsupportedOperationException
public void setReflectionsLevel(short reflectionsLevel) throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
This level is combined with the overall room level
(set using setRoomLevel(short)
).
reflectionsLevel
- reflection level in millibels. The valid range is [-9000, 1000].IllegalStateException
IllegalArgumentException
UnsupportedOperationException
public short getReflectionsLevel() throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
IllegalStateException
IllegalArgumentException
UnsupportedOperationException
public void setReflectionsDelay(int reflectionsDelay) throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
This method sets the time between when the direct path is heard and when the first reflection is heard.
reflectionsDelay
- reflections delay in milliseconds. The valid range is [0, 300].IllegalStateException
IllegalArgumentException
UnsupportedOperationException
public int getReflectionsDelay() throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
IllegalStateException
IllegalArgumentException
UnsupportedOperationException
public void setReverbLevel(short reverbLevel) throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
This level is combined with the overall room level (set using setRoomLevel(short)
).
reverbLevel
- reverb level in millibels. The valid range is [-9000, 2000].IllegalStateException
IllegalArgumentException
UnsupportedOperationException
public short getReverbLevel() throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
IllegalStateException
IllegalArgumentException
UnsupportedOperationException
public void setReverbDelay(int reverbDelay) throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
reverbDelay
- reverb delay in milliseconds. The valid range is [0, 100].IllegalStateException
IllegalArgumentException
UnsupportedOperationException
public int getReverbDelay() throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
IllegalStateException
IllegalArgumentException
UnsupportedOperationException
public void setDiffusion(short diffusion) throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
The scale should approximately map linearly to the perceived change in reverberation.
diffusion
- diffusion specified using a permille scale. The diffusion valid range is
[0, 1000]. A value of 1000 o/oo indicates a smooth reverberation decay.
Values below this level give a more grainy character.IllegalStateException
IllegalArgumentException
UnsupportedOperationException
public short getDiffusion() throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
setDiffusion(short)
for units.IllegalStateException
IllegalArgumentException
UnsupportedOperationException
public void setDensity(short density) throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
The scale should approximately map linearly to the perceived change in reverberation. A lower density creates a hollow sound that is useful for simulating small reverberation spaces such as bathrooms.
density
- density specified using a permille scale. The valid range is [0, 1000].
A value of 1000 o/oo indicates a natural sounding reverberation. Values below this level
produce a more colored effect.IllegalStateException
IllegalArgumentException
UnsupportedOperationException
public short getDensity() throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
setDiffusion(short)
for units.IllegalStateException
IllegalArgumentException
UnsupportedOperationException
public void setParameterListener(EnvironmentalReverb.OnParameterChangeListener listener)
listener
- OnParameterChangeListener interface registeredpublic EnvironmentalReverb.Settings getProperties() throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
IllegalStateException
IllegalArgumentException
UnsupportedOperationException
public void setProperties(EnvironmentalReverb.Settings settings) throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
settings
- a EnvironmentalReverb.Settings object containing the properties to applyIllegalStateException
IllegalArgumentException
UnsupportedOperationException