freesmartphone.org Audio Manager Interface

Description

The Manager interface is used to manage various audio related aspects. It is suited to manage the audio routing or can priorize differnt types of audio streams. For managing different audio device the volume of differnt device control types can be adjusted.

Namespace

org.freesmartphone.Audio.Manager

Methods

Signals

Properties

None

Errors

Methods

SetMode ( s )

Description: Set the current audio mode. Currently there is only a difference between normal and call. Normal means all audio use when not in a phone call and call means all audio within a phone call.

Parameters:*

s: mode The new audio mode to set. Expected values are:

  • “normal” = Normal audio mode
  • “call” = Audio mode when a call is active

GetMode ( ) → s

Description: Get the current audio mode which is used.

Returns:

s: mode See SetMode for a list of expected values.

SetDevice ( s )

Description: Set the current audio output device which is used only within the current mode. If you switch mode then the manager will switch even the output to the last used one in the new mode.

Parameters:*

s: name Set the current audio device to use to play audio. Expected values are:

  • “backspeaker” = The speaker on the back side of your device
  • “frontspeaker” = The speaker on the front side of your device
  • “headset” = The headset if plugged into the headset jack.
  • “bluetooth-sco” = Bluetooth SCO audio device
  • “bluetooth-a2dp” = Bluetooth A2DP audio device

GetDevice ( ) → s

Description: Get the current audio device.

Returns:

s: device The current device used to play audio. For Expected values see SetDevice

PushDevice ( s )

Description: Push a new audio device onto the stack and active it.

Parameters:*

s: device The new active audio device. For a list of expected values see SetDevice

PullDevice ( ) → s

Description: Pull an audio device from the stack and activate the next one.

Returns:

s: device The new active audio device. For a list of expected values see SetDevice

GetAvailableDevices ( s ) → as

Description: Get all available audio outputs for the specified audio mode.

Parameters:*

s: mode Mode to retrieve the possible devices for. See SetMode for a list of expected values.

Returns:

as: outputs List of available output devices. For a list of expected values see SetDevice

GetVolume ( s ) → i

Parameters:*

s: control The control you want to get the volume for.

Returns:

i: volume The volume in percent (0-100).

SetVolume ( si )

Parameters:*

s: control The control you want to set the volume for. Expected values are:

  • “speaker” = The currently active speaker
  • “micrphone” = The currently active microphone

i: volume The volume in percent (0-100).

SetMute ( sb )

Description: Mute current output device.

Parameters:*

s: control The control you want to set the mute state for. See Manager for detailed description of the available controls.

b: mute The mute state of the control. The possible two values are:

  • true: mute the control
  • false: unmute the control
Please note:
  • Muting/unmuting a already muted/unmuted control does not has any effect.
  • Setting a volume of 0/100 for a control has the same effect as muting/unmuting it.

GetMute ( s ) → b

Description: Mute current output device.

Parameters:*

s: control The control you want to set the mute state for. See Control for detailed description of the available controls.

Returns:

b: mute The mute state of the control. The possible two values are:

  • true: mute the control
  • false: unmute the control

RegisterSession ( s ) → s

Description: Registering a audio session with the manager. Everytime a application wants to play audio it has to register a audio session for this so the audio daemon can control the played audio and maybe mutes the stream if another audio source is more important than the current one.

Parameters:*

s: stream The type of the stream the audio is playing on. Expected values are:

  • “media” = Default media playback is happen on this stream.
  • “alert” = High priority system alerts.
  • “ringtone” = Responsible for playing ringtones.
  • “alarm” = Alarm alerts with lower priority than alert.
  • “navigation” = Audio for navigation purpose.

Returns:

s: token A four byte long byte sequence to identify the audio session. The token is needed to release the session after it is over.

ReleaseSession ( s )

Description: Release a audio session from the manager after audio playback is over.

Parameters:*

s: token A four byte long byte sequence to identify the audio session. The token is generated and assigned when calling RegisterSession().

Signals

ModeChanged ( s )

Parameters:

s: mode The new audio mode. See Mode for possible values.

DeviceChanged ( s )

Parameters:

s: device The new audio output device. See SetDevice for a list of expected values.

VolumeChanged ( si )

Parameters:

s: control The control the volume was changed for. See SetVolume for a list of expected values.

i: volume The new volume for the control in percent [0-100].

MuteChanged ( sb )

Parameters:

s: control The control the mute state was changed for. See SetVolume for a list of expected values.

b: mute The new mute state for the control. Possible valus are:

  • true: control was muted
  • false: control was unmuted

Errors

NotSupportedDevice

Description: Raised, if the device to process is unsupported by the used router.

DeviceStackUnderflow

Description: Raised, if there is no more device to pull from the stack.