AudioManager.SetPreferredMixerAttributes Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Configures the mixer attributes for a particular AudioAttributes
over a given
AudioDeviceInfo
.
[Android.Runtime.Register("setPreferredMixerAttributes", "(Landroid/media/AudioAttributes;Landroid/media/AudioDeviceInfo;Landroid/media/AudioMixerAttributes;)Z", "GetSetPreferredMixerAttributes_Landroid_media_AudioAttributes_Landroid_media_AudioDeviceInfo_Landroid_media_AudioMixerAttributes_Handler", ApiSince=34)]
[Android.Runtime.RequiresPermission("android.permission.MODIFY_AUDIO_SETTINGS")]
public virtual bool SetPreferredMixerAttributes (Android.Media.AudioAttributes attributes, Android.Media.AudioDeviceInfo device, Android.Media.AudioMixerAttributes mixerAttributes);
[<Android.Runtime.Register("setPreferredMixerAttributes", "(Landroid/media/AudioAttributes;Landroid/media/AudioDeviceInfo;Landroid/media/AudioMixerAttributes;)Z", "GetSetPreferredMixerAttributes_Landroid_media_AudioAttributes_Landroid_media_AudioDeviceInfo_Landroid_media_AudioMixerAttributes_Handler", ApiSince=34)>]
[<Android.Runtime.RequiresPermission("android.permission.MODIFY_AUDIO_SETTINGS")>]
abstract member SetPreferredMixerAttributes : Android.Media.AudioAttributes * Android.Media.AudioDeviceInfo * Android.Media.AudioMixerAttributes -> bool
override this.SetPreferredMixerAttributes : Android.Media.AudioAttributes * Android.Media.AudioDeviceInfo * Android.Media.AudioMixerAttributes -> bool
Parameters
- attributes
- AudioAttributes
the AudioAttributes
whose mixer attributes should be set.
Currently, only AudioAttributes#USAGE_MEDIA
is supported. When
playing audio targeted at the given device, use the same attributes for
playback.
- device
- AudioDeviceInfo
the device to be routed. Currently, only USB device will be allowed.
- mixerAttributes
- AudioMixerAttributes
the preferred mixer attributes. When playing audio targeted at the
given device, use the same AudioFormat
for both playback
and the mixer attributes.
Returns
true only if the preferred mixer attributes are set successfully.
- Attributes
Remarks
Configures the mixer attributes for a particular AudioAttributes
over a given AudioDeviceInfo
.
Call #getSupportedMixerAttributes(AudioDeviceInfo)
to determine which mixer attributes can be used with the given device.
The ownership of preferred mixer attributes is recognized by uid. When a playback from the same uid is routed to the given audio device when calling this API, the output mixer/stream will be configured with the values previously set via this API.
Use #clearPreferredMixerAttributes(AudioAttributes, AudioDeviceInfo)
to cancel setting mixer attributes for this AudioAttributes
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.