Interface IAudioManager
interface IAudioManager
Extends com.amazon.apmf.IStandard
Interface for encapsulating the Audio Manager module
Methods
setVolume()
Set volume of specified volume type. If the volume is out of range, it will be clamped.voidsetVolume(VolumeType*volType,i32volume)
Parameters
volType
VolumeType* — Required
type of volume to set (Music / Notification / etc.)
volume
i32 — Required
percentage (range: 0 to 100).
Needs privilege “com.amazon.audio.privilege.settings.control”
setActiveVolume()
Set volume of active stream. If the volume is out of range, it will be clamped.voidsetActiveVolume(i32volume)
Parameters
volume
i32 — Required
(range: 0 to 100).
Needs privilege “com.amazon.audio.privilege.settings.control”
updateVolume()
Update volume of a specific type (for e.g. Music / Notification etc.).voidupdateVolume(VolumeType*volType,VolumeUpdate*update)
Parameters
volType
VolumeType* — Required
volume type to update (Music / Notification / etc.)
update
VolumeUpdate* — Required
volume adjustment up/down
Needs privilege “com.amazon.audio.privilege.settings.control”
updateActiveVolume()
Update volume of active stream. If there is no active stream, audio server will set volume for fallback type.voidupdateActiveVolume(VolumeUpdate*update,VolumeType*fallbackType)
Parameters
update
VolumeUpdate* — Required
volume up/down
fallbackType
VolumeType* — Required
audio volume type to set if playback is not active
Needs privilege “com.amazon.audio.privilege.settings.control”
getVolume()
Get volume of a specific type (for e.g. Music / Notification etc.).i32getVolume(VolumeType*volType)
Parameters
volType
VolumeType* — Required
volume type (Music / Notification / etc.)
Returns
i32
volume (range: 0 to 100).
Needs privilege “com.amazon.audio.privilege.settings.control”
enableAllMicrophones()
void enableAllMicrophones()
Enable the microphones for audio record.
If not enabled, the captured audio will be silence.
Needs privilege “com.amazon.audio.privilege.settings.control”
disableAllMicrophones()
void disableAllMicrophones()
Disable the microphones for audio record.
The apps will receive silence audio. If telephony call is
started the uplink audio will be muted.
Needs privilege “com.amazon.audio.privilege.settings.control”
isAnyMicrophoneEnabled()
bool isAnyMicrophoneEnabled()
Check if microphones are enabled for recording
Returns
bool
true if enabled, false otherwise.
setTelephonyMute()
Mute/Unmute the telephony uplink. Telephony uplink will be muted/unmuted.voidsetTelephonyMute(IAudioDevice*device,boolmute)
Parameters
device
IAudioDevice* — Required
telephony device to set mute state
mute
bool — Required
if true and unmute otherwise
Needs privilege “com.amazon.audio.privilege.settings.control”
getTelephonyMute()
Check if telephony uplink is muted.boolgetTelephonyMute(IAudioDevice*device)
Parameters
device
IAudioDevice* — Required
telephony device to get mute state
Returns
bool
telephony mute status
setMute()
Set mute for audio volume type. Mute when true, audio output for volume type will be silenced regardless of individual stream volumes.voidsetMute(VolumeType*volType,boolmute)
Parameters
volType
VolumeType* — Required
volume type (Music / Notification / etc.)
mute
bool — Required
true to mute, false to unmute.
Needs privilege “com.amazon.audio.privilege.settings.control”
getMute()
Query current mute for audio volume type.boolgetMute(VolumeType*volType)
Parameters
volType
VolumeType* — Required
volume type (Music / Notification / etc.)
Returns
bool
mute status of specified volume type.
setGlobalVolumeMute()
Set global volume mute. Global mute when true, audio output will be silenced regardless of individual stream volumes.voidsetGlobalVolumeMute(boolmute)
Parameters
mute
bool — Required
true to mute, false to unmute.
Needs privilege “com.amazon.audio.privilege.settings.control”
getGlobalVolumeMute()
bool getGlobalVolumeMute()
Query current global volume mute.
Returns
bool
global volume mute.
getAudioUsageStatistics()
Query audio usage statistics: active status and related durationvoidgetAudioUsageStatistics(AudioUsage*usage, outbool*active, outcom.amazon.apmf.RealTimeDuration*pastDurationMs)
Parameters
usage
AudioUsage* — Required
usage type
active (out)
bool* — Required
set to true if this usage is active now, that is, at least one audio
stream with such usage is streaming, false or otherwise
pastDurationMs (out)
com.amazon.apmf.RealTimeDuration* — Required
duration in milliseconds since audio usage was active/inactive
startTelephony()
Start telephony call from the specified device On some specific platforms, it is possible to support multiple telephony sources such as a HFP device, a voice call modem etc. In such case, the client can actually query the list of devices using the getAllAudioDevices API and select a specific devicevoidstartTelephony(IAudioDevice*device,TelephonyMode*mode)
Parameters
device
IAudioDevice* — Required
telephony device information.
mode
TelephonyMode* — Required
telephony mode
stopTelephony()
Stop telephony call from the specified devicevoidstopTelephony(IAudioDevice*device)
Parameters
device
IAudioDevice* — Required
telephony device information.
connect()
Connect an audio devicevoidconnect(IAudioDevice*device)
Parameters
device
IAudioDevice* — Required
device information such as type, name.
disconnect()
Disconnect an audio devicevoiddisconnect(IAudioDevice*device)
Parameters
device
IAudioDevice* — Required
device information such as type, name.
isConnected()
Get an audio device connect/disconnect state.boolisConnected(IAudioDevice*device)
Parameters
device
IAudioDevice* — Required
device information such as type, name.
Returns
bool
true if connected, false otherwise.
getAllAudioDevices()
Get the list of connected audio devices of given role To get a list of all the supported roles, specify AudioRole::SOURCE_SINK.IAudioDeviceInfo*[]getAllAudioDevices(AudioRole*role)
Parameters
role
AudioRole* — Required
audio device role sink/source or both.
Returns
IAudioDeviceInfo*[]
list of device info array of the available devices of requested role.
setMaxVolume()
Set max volume limit. Clients can use this API to set maximum limit on all types of volume levels. By default the maximum volume limit is 100, using this API it can be set to 0 - 100. If the volume is out of range, it will be clamped.voidsetMaxVolume(i32maxVolume)
Parameters
maxVolume
i32 — Required
max limit in percentage for the final volume applies on a stream.
Needs privilege “com.amazon.audio.privilege.settings.control”
getMaxVolume()
i32 getMaxVolume()
Get max volume limit
Retrieve previously set max volume limit using setMaxVolume() api or
system default, value 0 - 100.
Returns
i32
current max volume limit.
setSinkFormatsSelectionPolicy()
Set audio sink formats selection policyvoidsetSinkFormatsSelectionPolicy(SinkFormatsSelectionPolicy*policy)
Parameters
policy
SinkFormatsSelectionPolicy* — Required
policy to select supported audio formats for a sink device
getSinkFormatsSelectionPolicy()
SinkFormatsSelectionPolicy getSinkFormatsSelectionPolicy()
Get the current audio sink mode formats selection policy
Returns
SinkFormatsSelectionPolicy
current sink formats selection policy
getSupportedSinkFormatsSelectionPolicies()
Get the list of all supported sink formats selection policiesSinkFormatsSelectionPolicy[]getSupportedSinkFormatsSelectionPolicies()
Returns
SinkFormatsSelectionPolicy[]
list of policies
getSupportedPlaybackConfigurations()
query audio pipeline for a list of supported audio configurations for playback.AudioConfig[]getSupportedPlaybackConfigurations(AudioAttributes*attributes,AudioDeviceType*deviceType)
Parameters
attributes
AudioAttributes* — Required
audio stream attributes
deviceType
AudioDeviceType* — Required
target device type
Returns
AudioConfig[]
list of audio playback configurations for the specified attributes and device type.
If the device type is not specified i.e. nullptr, return supported configurations for the
playback devices applicable for specified attributes.
addAudioEventListener()
Registers a listener to be notified of volume updates.com.amazon.apmf.ISubscription*addAudioEventListener(IAudioEventListener*callback)
Parameters
callback
IAudioEventListener* — Required
pointer to listener
Returns
com.amazon.apmf.ISubscription*
ISubscription pointer to be used to unsubscribe to the listener

