BassBoost
open class BassBoost : AudioEffect
kotlin.Any | ||
↳ | android.media.audiofx.AudioEffect | |
↳ | android.media.audiofx.BassBoost |
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.
An application creates a BassBoost object to instantiate and control a bass boost engine in the audio framework.
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/) for the SLBassBoostItf interface. Please refer to this specification for more details.
To attach the BassBoost to a particular AudioTrack or MediaPlayer, specify the audio session ID of this AudioTrack or MediaPlayer when constructing the BassBoost.
NOTE: attaching a BassBoost to the global audio output mix by use of session 0 is deprecated.
See android.media.MediaPlayer#getAudioSessionId()
for details on audio sessions.
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 BassBoost when a parameter value has changed. |
open |
The Settings class regroups all bass boost parameters. |
Constants | |
---|---|
static Int |
Bass boost effect strength. |
static Int |
Is strength parameter supported by bass boost engine. |
Inherited constants | |
---|---|
Public constructors | |
---|---|
Class constructor. |
Public methods | |
---|---|
open BassBoost.Settings! |
Gets the bass boost properties. |
open Short |
Gets the current strength of the effect. |
open Boolean |
Indicates whether setting strength is supported. |
open Unit |
Registers an OnParameterChangeListener interface. |
open Unit |
setProperties(settings: BassBoost.Settings!) Sets the bass boost properties. |
open Unit |
setStrength(strength: Short) Sets the strength of the bass boost effect. |
Inherited functions | |
---|---|
Inherited properties | |
---|---|
Constants
PARAM_STRENGTH
static val PARAM_STRENGTH: Int
Bass boost effect strength. Parameter ID for android.media.audiofx.BassBoost.OnParameterChangeListener
Value: 1
PARAM_STRENGTH_SUPPORTED
static val PARAM_STRENGTH_SUPPORTED: Int
Is strength parameter supported by bass boost engine. Parameter ID for getParameter().
Value: 0
Public constructors
BassBoost
BassBoost(
priority: Int,
audioSession: Int)
Class constructor.
Parameters | |
---|---|
priority |
Int: the priority level requested by the application for controlling the BassBoost 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. The BassBoost will be attached to the MediaPlayer or AudioTrack in the same audio session. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
|
java.lang.IllegalArgumentException |
|
java.lang.UnsupportedOperationException |
|
java.lang.RuntimeException |
Public methods
getProperties
open fun getProperties(): BassBoost.Settings!
Gets the bass boost properties. This method is useful when a snapshot of current bass boost settings must be saved by the application.
Return | |
---|---|
BassBoost.Settings! |
a BassBoost.Settings object containing all current parameters values |
Exceptions | |
---|---|
java.lang.IllegalStateException |
|
java.lang.IllegalArgumentException |
|
java.lang.UnsupportedOperationException |
getRoundedStrength
open fun getRoundedStrength(): Short
Gets the current strength of the effect.
Return | |
---|---|
Short |
the strength of the effect. The valid range for strength is [0, 1000], where 0 per mille designates the mildest effect and 1000 per mille the strongest |
Exceptions | |
---|---|
java.lang.IllegalStateException |
|
java.lang.IllegalArgumentException |
|
java.lang.UnsupportedOperationException |
getStrengthSupported
open fun getStrengthSupported(): Boolean
Indicates whether setting strength is supported. If this method returns false, only one strength is supported and the setStrength() method always rounds to that value.
Return | |
---|---|
Boolean |
true is strength parameter is supported, false otherwise |
setParameterListener
open fun setParameterListener(listener: BassBoost.OnParameterChangeListener!): Unit
Registers an OnParameterChangeListener interface.
Parameters | |
---|---|
listener |
BassBoost.OnParameterChangeListener!: OnParameterChangeListener interface registered |
setProperties
open fun setProperties(settings: BassBoost.Settings!): Unit
Sets the bass boost properties. This method is useful when bass boost settings have to be applied from a previous backup.
Parameters | |
---|---|
settings |
BassBoost.Settings!: a BassBoost.Settings object containing the properties to apply |
Exceptions | |
---|---|
java.lang.IllegalStateException |
|
java.lang.IllegalArgumentException |
|
java.lang.UnsupportedOperationException |
setStrength
open fun setStrength(strength: Short): Unit
Sets the strength of the bass boost effect. If the implementation does not support per mille accuracy for setting the strength, it is allowed to round the given strength to the nearest supported value. You can use the getRoundedStrength()
method to query the (possibly rounded) value that was actually set.
Parameters | |
---|---|
strength |
Short: strength of the effect. The valid range for strength strength is [0, 1000], where 0 per mille designates the mildest effect and 1000 per mille designates the strongest. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
|
java.lang.IllegalArgumentException |
|
java.lang.UnsupportedOperationException |