Android Programming Press on the image to return to the main documentation page.

EQlib

Written by Steve Laming

List of types:

EQlib

EQlib


Permissions:

android.permission.MODIFY_AUDIO_SETTINGS

Events:

None

Members:


  Enable (enable As BooleanAs Int

  GetBand (frequency As IntAs Short

  GetBandFreqRange (band As ShortAs Int()

  GetBandLevel (band As ShortAs Short

  GetBandLevelRange As Short()

  GetCenterFreq (band As ShortAs Int

  GetCurrentPreset As Short

  GetEnabled As Boolean

  GetNumberOfBands As Short

  GetNumberOfPresets As Short

  GetPresetName (preset As ShortAs String

  GetProperties As String

  HasControl As Boolean

  Initialize As Boolean

  IsAvailable As Boolean

  IsInitialized As Boolean

  Release

  SetBandLevel (band As Short, level As Short)

  SetProperties (settingsStr As String)

  UsePreset (preset As Short)

Members description:

Enable (enable As BooleanAs Int
Enables or disables the Audio effect engine.
GetBand (frequency As IntAs Short
Gets the band that has the most effect on the given frequency.

 
Dim EQ As EQlib
 
Dim band As Short
 
Dim freq as Int
 freq = 
1000
 EQ.Initialize
 
If EQ.IsInitialized Then
      EQ.Enable(True)
      band = EQ.GetBand(freq) 
 
End If
 
GetBandFreqRange (band As ShortAs Int()
Gets the frequency range of the given frequency band.

 
Dim EQ As EQlib
 EQ.Initialize
 
If EQ.IsInitialized Then
      EQ.Enable(True)
      
Dim BandFreqRange() As Int
      BandFreqRange=EQ.GetBandFreqRange
      
For i = 0 To BandFreqRange.Length-1
          Log(BandFreqRange(i))
      
Next
 
End If
 
GetBandLevel (band As ShortAs Short
Gets the Level set for the given Equalizer band.

 
Dim EQ As EQlib
 
Dim Level As Short
 EQ.Initialize
 
If EQ.IsInitialized Then
      EQ.Enable(True)
      Level = EQ.GetBandLevel(band) 
 
End If
 
GetBandLevelRange As Short()
Gets the level range for use by setBandLevel(short band, short level).

 
Dim EQ As EQlib
 EQ.Initialize
 
If EQ.IsInitialized Then
      EQ.Enable(True)
      
Dim FRange() As Short
      FRange=EQ.GetBandLevelRange
      
For i = 0 To FRange.Length-1
          Log(FRange(i))
      
Next
 
End If
 
GetCenterFreq (band As ShortAs Int
Gets the center frequency of the given band.

 
Dim EQ As EQlib
 
Dim Freq AS Int
 EQ.Initialize
 
If EQ.IsInitialized Then
      EQ.Enable(True)
      Freq = EQ.GetCenterFreq(band) 
 
End If
 
GetCurrentPreset As Short
Gets current preset.

 
Dim EQ As EQlib
 EQ.Initialize
 
If EQ.IsInitialized Then
      EQ.Enable(True)
      EQ.GetCurrentPreset
 
End If
 
GetEnabled As Boolean
Gets the Enabled status of the Audio effect engine.
GetNumberOfBands As Short
Gets the number of frequency bands supported by the Equalizer engine.

 
Dim EQ AS SLEqualizer
 EQ.Initialize
 
If EQ.IsInitialized Then
      EQ.Enable(True)
      NoBands=EQ.GetNumberOfBands
 
End if
 
GetNumberOfPresets As Short
Gets the total number of presets the Equalizer supports.

 
Dim EQ As EQlib
 EQ.Initialize
 
If EQ.IsInitialized Then
      EQ.Enable(True)
      NoPres=EQ.GetNumberOfPresets
      
For i = 0 To NoPres-1
          Log(EQ.GetPresetName(i))
      
Next
 
End if
 
GetPresetName (preset As ShortAs String
Gets the preset name based on the index.

 
Dim EQ As EQlib
 EQ.Initialize
 
If EQ.IsInitialized Then
      EQ.Enable(True)
      NoPres=EQ.GetNumberOfPresets
      
For i = 0 To NoPres-1
          Log(EQ.GetPresetName(i))
      
Next
 
End if
 
GetProperties As String
Gets the Equalizer properties.

 
Dim EQ As EQlib
 EQ.Initialize
 EQ.Enable(True)
 EqSett= EQ.GetProperties
 EQ.SetProperties(EqSett)
 
HasControl As Boolean
Checks if this AudioEffect object is controlling the effect engine
Initialize As Boolean
Checks whether the Equalizer is available and Initializes the object,
only for all output and not for specific media players.
For backwards compatibility, the library will not throw an exception
on failure to initialize the Equalizer, but will return true or false
and set the IsInitialized flag appropriately if it fails for any reason.
check either of these before running the other methods as if the equalizer
is not initialized, you will get a runtime error.
Dim EQ As EQlib
 EQ.Initialize
 
If EQ.IsInitialized Then
      EQ.Enable(True)
      NoPres=EQ.GetNumberOfPresets
      
For i = 0 To NoPres-1
          Log(EQ.GetPresetName(i))
      
Next
 
End if
 
IsAvailable As Boolean
Returns the availability of the Equalizer object, it must be available for
the devices API level (9 or later)
IsInitialized As Boolean
Returns the status of the Equalizer object, it must be available for
the devices API level and initialized

 
Dim EQ As EQlib
 EQ.Initialize
 
If EQ.IsInitialized Then
      EQ.Enable(True)
      
'Setup EQ Parameters
 End if
 
Release
Releases the native AudioEffect resources.
It is a good practice to release the effect engine when not
in use as control can be returned to other
applications or the native resources released.
SetBandLevel (band As Short, level As Short)
Sets the given Equalizer band to the given Level.

 
Dim EQ As EQlib
 
Dim band,level As Short
 EQ.Initialize
 
If EQ.IsInitialized Then
      EQ.Enable(True)
      EQ.SetBandLevel(band,level) 
 
End If
 
SetProperties (settingsStr As String)
Sets the Equalizer properties.

 
Dim EQ As EQlib
 EQ.Initialize
 EQ.Enable(True)
 EqSett= EQ.GetProperties
 EQ.SetProperties(EqSett)
 
UsePreset (preset As Short)
Sets the Equalizer according to the given preset.

 
Dim EQ As EQlib
 EQ.Initialize
 
If EQ.IsInitialized Then
      EQ.Enable(True)
      EQ.UsePreset(preset)
 
End If
 

Top