Added in API level 9

PresetReverb

open class PresetReverb : AudioEffect
kotlin.Any
   ↳ android.media.audiofx.AudioEffect
   ↳ android.media.audiofx.PresetReverb

A sound generated within a room travels in many directions. The listener first hears the direct sound from the source itself. Later, he or she hears discrete echoes caused by sound bouncing off nearby walls, the ceiling and the floor. As sound waves arrive after undergoing more and more reflections, individual reflections become indistinguishable and the listener hears continuous reverberation that decays over time. 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 listener within the game's environment. 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 requiring control over a more advanced environmental reverb are advised to use the android.media.audiofx.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 android.media.audiofx.AudioEffect class for more details on controlling audio effects.

Summary

Nested classes
abstract

The OnParameterChangeListener interface defines a method called by the PresetReverb when a parameter value has changed.

open

The Settings class regroups all preset reverb parameters.

Constants
static Int

Preset.

static Short

Reverb preset representing a large-sized hall suitable for a full orchestra

static Short

Reverb preset representing a large-sized room suitable for live performances

static Short

Reverb preset representing a medium-sized hall

static Short

Reverb preset representing a medium room with a length of ten meters or less

static Short

No reverb or reflections

static Short

Reverb preset representing a synthesis of the traditional plate reverb

static Short

Reverb preset representing a small room less than five meters in length

Inherited constants
Public constructors
PresetReverb(priority: Int, audioSession: Int)

Class constructor.

Public methods
open Short

Gets current reverb preset.

open PresetReverb.Settings!

Gets the preset reverb properties.

open Unit

Registers an OnParameterChangeListener interface.

open Unit
setPreset(preset: Short)

Enables a preset on the reverb.

open Unit

Sets the preset reverb properties.

Inherited functions
Inherited properties

Constants

PARAM_PRESET

Added in API level 9
static val PARAM_PRESET: Int

Preset. Parameter ID for android.media.audiofx.PresetReverb.OnParameterChangeListener

Value: 0

PRESET_LARGEHALL

Added in API level 9
static val PRESET_LARGEHALL: Short

Reverb preset representing a large-sized hall suitable for a full orchestra

Value: 5

PRESET_LARGEROOM

Added in API level 9
static val PRESET_LARGEROOM: Short

Reverb preset representing a large-sized room suitable for live performances

Value: 3

PRESET_MEDIUMHALL

Added in API level 9
static val PRESET_MEDIUMHALL: Short

Reverb preset representing a medium-sized hall

Value: 4

PRESET_MEDIUMROOM

Added in API level 9
static val PRESET_MEDIUMROOM: Short

Reverb preset representing a medium room with a length of ten meters or less

Value: 2

PRESET_NONE

Added in API level 9
static val PRESET_NONE: Short

No reverb or reflections

Value: 0

PRESET_PLATE

Added in API level 9
static val PRESET_PLATE: Short

Reverb preset representing a synthesis of the traditional plate reverb

Value: 6

PRESET_SMALLROOM

Added in API level 9
static val PRESET_SMALLROOM: Short

Reverb preset representing a small room less than five meters in length

Value: 1

Public constructors

PresetReverb

Added in API level 9
PresetReverb(
    priority: Int,
    audioSession: Int)

Class constructor.

Parameters
priority Int: 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 Int: 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.
Exceptions
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException
java.lang.RuntimeException

Public methods

getPreset

Added in API level 9
open fun getPreset(): Short

Gets current reverb preset.

Return
Short the preset that is set at the moment.
Exceptions
java.lang.IllegalStateException
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException

getProperties

Added in API level 9
open fun getProperties(): PresetReverb.Settings!

Gets the preset reverb properties. This method is useful when a snapshot of current preset reverb settings must be saved by the application.

Return
PresetReverb.Settings! a PresetReverb.Settings object containing all current parameters values
Exceptions
java.lang.IllegalStateException
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException

setParameterListener

Added in API level 9
open fun setParameterListener(listener: PresetReverb.OnParameterChangeListener!): Unit

Registers an OnParameterChangeListener interface.

Parameters
listener PresetReverb.OnParameterChangeListener!: OnParameterChangeListener interface registered

setPreset

Added in API level 9
open fun setPreset(preset: Short): Unit

Enables a preset on the reverb.

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.

Parameters
preset Short: this must be one of the the preset constants defined in this class. e.g. PRESET_SMALLROOM
Exceptions
java.lang.IllegalStateException
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException

setProperties

Added in API level 9
open fun setProperties(settings: PresetReverb.Settings!): Unit

Sets the preset reverb properties. This method is useful when preset reverb settings have to be applied from a previous backup.

Parameters
settings PresetReverb.Settings!: a PresetReverb.Settings object containing the properties to apply
Exceptions
java.lang.IllegalStateException
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException