Android development-AudioManager (audio manager) details, androidre Manager
Introduction to AudioManager:
The AudioManager class provides access volume and mode Control for the vibrator. Use Context. getSystemService (Context. AUDIO_SERVICE) to obtain an instance of this class.
Public method:
Public Methods |
Int |
AbandonAudioFocus (AudioManager. OnAudioFocusChangeListenerl) Discard the audio focus. |
Void |
AdjustStreamVolume (int streamType, int direction, int flags) Adjust the voice of the specified type on the phone. |
Void |
AdjustSuggestedStreamVolume (int, int suggestedStreamType intflags) Adjust the volume of the most relevant stream, or specify the rollback stream. |
Void |
AdjustVolume (int, intflags) Adjust the volume of the most relevant data stream. |
Int |
GetMode () Returns the current audio mode. |
String |
GetParameters (String keys) Set a varavisible value for the audio hardware. |
Int |
GetRingerMode () Returns the current ringtone mode. |
Int |
GetRouting (int mode) This method is not in favor. Do not directly query audio routes. Use the isSpeakerphoneOn (), isw.tha2dpon isw.thscoon (), (), and isWiredHeadsetOn () methods. |
Int |
GetStreamMaxVolume (int streamType) Returns the maximum volume index of a specific stream. |
Int |
GetStreamVolume (int streamType) Returns the current volume index of a specific data stream. |
Int |
GetVibrateSetting (int vibrateType) Returns whether the user's vibration is set to the vibration type. |
Boolean |
Isw.tha2dpon () Check whether the A2DP Bluetooth headset audio route is enabled or disabled. |
Boolean |
IsBluetoothScoAvailableOffCall () Shows whether the current platform supports using SCO to close call cases. |
Boolean |
Isw.thscoon () Check whether the communication uses the Bluetooth SCO. |
Boolean |
IsMicrophoneMute () Check whether the microphone is on or off. |
Boolean |
IsMusicActive () Check whether music is active. |
Boolean |
IsSpeakerphoneOn () Check whether the speaker is turned on or off. |
Boolean |
IsWiredHeadsetOn () Check whether headphones are inserted |
Void |
LoadSoundEffects () Load the sound effect. |
Void |
PlaySoundEffect (int volume tType, float volume) Playing sound effect (press the button to enable/disable the cap ...) |
Void |
PlaySoundEffect (int effectType) Playing sound effect (press the button to enable/disable the cap ...) |
Void |
RegisterMediaButtonEventReceiver (ComponentName eventReceiver) Register a unique receiver for the MEDIA_BUTTON intent of a component. |
Int |
RequestAudioFocus (AudioManager. OnAudioFocusChangeListener l, int streamType, int durationHint) The focus of the Request audio. |
Void |
Setinclutha2dpon (booleanon) This method is not in favor. Do not use. |
Void |
Setincluthscoon (booleanon) You must use a Bluetooth SCO headset for communication. |
Void |
SetMicrophoneMute (booleanon) Set whether to mute the microphone. |
Void |
SetMode (int mode) Set the sound mode. |
Void |
SetParameters (String keyValuePairs) Set a variable value for the number of audio hardware. |
Void |
SetRingerMode (int ringerMode) Set the phone ringtone mode. |
Void |
SetRouting (int mode, int routes, int mask) This method is not in favor. If you do not set the audio route, use the setSpeakerphoneOn () and setdomainthscoon () methods directly. |
Void |
SetSpeakerphoneOn (boolean on) Set the speaker to turn on or off. |
Void |
SetStreamMute (int streamType, booleanstate) Set the voice of the specified type to mute. |
Void |
SetStreamSolo (int streamType, boolean state) Solo or to cancel a specific stream. |
Void |
SetStreamVolume (int streamType, int index, int flags) Directly set the volume of the specified type of mobile phone. |
Void |
SetVibrateSetting (int vibrateType, int vibrateSetting) Set the vibration type that should be vibrating. |
Void |
SetWiredHeadsetOn (boolean on) This method is not in favor. Do not use. |
Boolean |
ShouldVibrate (int vibrateType) Returns whether the specified type should be based on the user vibration settings and the current vibrator mode. |
Void |
Startbluw.thsco () Start the Bluetooth SCO audio connection. |
Void |
StopBluetoothSco () Stop the Bluetooth SCO audio connection. |
Void |
UnloadSoundEffects () Uninstall sound effects. |
Void |
UnregisterMediaButtonEventReceiver (ComponentName eventReceiver) Cancel the receiver of MEDIA_BUTTON intent. |
Common Methods:
Void adjustStreamVolume (int streamType, int direction, int flags)
Adjust the voice of the specified type on the phone. The first parameter streamType specifies the sound type. This parameter can be set to the following values.
L int STREAM_ALARM: the sound of an alarm on the phone.
L int STREAM_DTMF: DTMF tone.
L int STREAM_MUSIC: the voice of mobile phone music.
L int STREAM_NOTIFICATION: The sound prompted by the system.
L int STREAM_RING The: The sound of The phone ringtone.
L int STREAM_SYSTEM: the voice of the mobile phone system.
L int STREAM_VOICE_CALL: Voice call.
The second parameter specifies whether to increase or decrease the sound. This parameter can be set to the following values:
ADJUST_LOWER volume reduction
ADJUST_RAISE increases the volume
ADJUST_SAME remains unchanged, which is mainly used to show the current volume to the user
The third parameter is the identifier when the sound is adjusted. For example, if FLAG_SHOW_UI is specified, the volume progress bar is displayed when the sound is adjusted.
Void setMicrophoneMute (booleanon)
Set whether to mute the microphone. Set to true to mute the microphone; false to disable mute.
Void setMode (intmode)
Set the sound mode. Configurable values include NORMAL, RINGTONE, and IN_CALL.
Void setRingerMode (intringerMode)
Set the phone ringtone mode. The following attribute values are supported.
L int RINGER_MODE_NORMAL: A normal ringtone.
L int RINGER_MODE_SILENT: mute the ringtone.
L int RINGER_MODE_VIBRATE: the mobile phone vibrates.
Void setSpeakerphoneOn (booleanon)
Set the speaker to turn on or off. Set to true to enable hands-free calls; false to disable hands-free calls.
Void setStreamMute (intstreamType, booleanstate)
Set the voice of the specified type to mute. The streamType parameter has the same meaning as the first parameter in the adjustStreamVolume method.
Void setStreamVolume (int streamType, int index, int flags)
Directly set the volume of the specified type of mobile phone. The streamType parameter has the same meaning as the first parameter in the adjustStreamVolume method.
How does realtek hd audio manager set sound in the headset?
Click the small horn in the lower-right corner, find the Front pink in option in the property bar, and tick it. debugging is OK.
Realtek HD high definition audio manager
Click realtek audio configuration. Find the audio I/O option. On the rear panel of the simulation, there is a connector setting item (a bit like a wrench icon). Just Tick all the items 1 and 2, that is to say, disabling the front-panel detection and the rear-panel output should not be checked for 3rd items. It can be solved.