Audioeffect Chinese API

Source: Internet
Author: User
Tags session id

Support for audio Reverb has been added to the Android2.3, which are included in the ANDROID.MEDIA.AUDIOFX package.

I. Overview

Audioeffect is the base class for audio effect control provided by the Android Audio framework (Android sound framework). Developers cannot use this class directly and should use its derived classes. Its derived classes are listed below.

Equalizer
Virtualizer
Bassboost
Presetreverb
Environmentalreverb


When creating Audioeffect, if the audio effect is applied to a specific instance of Audiotrack and MediaPlayer, the application must specify the audio session ID of the instance, If you want to apply the effects of the global audio output Reverb, Session 0 must be established.


To create an audio output reverb (audio Session 0) requires modify_audio_settings permission.


If the effect you want to create does not exist in the audio framework, create the effect directly, and use this effect directly if it already exists. If a high-priority object is to use the effect on a lower-level object, the control is transferred to the object with the higher priority, otherwise it remains on the object. In this case, the new application will be notified by the listener.


Second, nested class


1.audioeffect.descriptor: The effect descriptor contains information that implements a specific effect within the audio frame.
2.audioeffect.oncontrolstatuschangelistener: This interface defines a method that is called by Audioeffect when the control state of an application's audio effect changes.

3.audioeffect.onenablestatuschangelistener: This interface defines the method that is called by Audioeffect when the enabled state of an application's audio effect changes.

Three, constant

String Action_close_audio_effect_control_session Turn off audio effects
String Action_display_audio_effect_control_panel Launches an audio effects Control Panel UI.
String Action_open_audio_effect_control_session Turn on audio effects.
Int Already_exists Internal operating state.
Int Content_type_game The value of Extra_content_type when the type of playback content is game audio.
Int Content_type_movie The value of Extra_content_type when the type of content being played is a movie.
Int Content_type_music The value of Extra_content_type when the type of content being played is music.
Int Content_type_voice The value of Extra_content_type when the type of content being played is voice.
String Effect_auxiliary Effect Connection mode is auxiliary
String Effect_insert Effect connection mode is insert.
Int ERROR Indicates an operation error.
Int Error_bad_value Indicates that an operation failed due to an incorrect parameter.
Int Error_dead_object Indicates that the operation caused by a closed remote object failed.
Int Error_invalid_operation Indicates that the operation caused by an incorrect request state failed.
Int Error_no_init Indicates that an operation failed because of an incorrect object initialization.
Int Error_no_memory Indicates that an operation failed due to insufficient memory.
String Extra_audio_session Contains the audio session ID that uses the effect.
String Extra_content_type Indicates the type of content the application plays.
String Extra_package_name Contains the package name of the calling application.
Int SUCCESS The operation was successful.

Iv. Public methods

 

Audioeffect.descriptor GetDescriptor () Gets the effect descriptor.
Boolean Getenabled () returns the enabled state of the effect.
Int GetId () returns the identifier of the effect
Boolean Hascontrol () checks whether the Audioeffect object has control of the effect engine. Returns true if any.
Static descriptor[] Queryeffects () queries all valid audio effects on the platform.
void Release () releases the local Audioeffect resource.
void Setcontrolstatuslistener (Audioeffect.oncontrolstatuschangelistener Listener) Registers the control status listener for the audio effect. Audioeffect notifies you when the control state changes.
void Setenablestatuslistener (Audioeffect.onenablestatuschangelistener Listener) sets the enabled state listener for audio effects. Audioeffect notifies when status changes are enabled.
Int SetEnabled (Boolean enabled) Enable or disable the effect.

Audioeffect Chinese API

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.