You.i Engine
CYIAudioVolumeBridge Class Referenceabstract

Detailed Description

Volume bridge which supports the manipulation of the platform's audio volume settings.

The CYIAudioVolumeBridge available on iOS & tvOS is usually used in conjunction with the MPVolumeView, which is a class in the iOS SDK responsible for media playback. This view is required to manipulate the volume directly. The bridge, however, can still be used to read and monitor the volume directly.

Note
The CYIAudioVolumeBridge is available on Android, iOS, tvOS, and Tizen platforms.

#include <platform/YiAudioVolumeBridge.h>

Public Member Functions

virtual ~CYIAudioVolumeBridge ()
 
virtual bool AdjustVolume (float fPercentage)=0
 
virtual bool SetMuteEnabled (bool bEnabled)=0
 
virtual bool GetVolume (float &fPercentage)=0
 
virtual void StartObservingVolumeChanges ()=0
 
virtual void StopObservingVolumeChanges ()=0
 

Public Attributes

CYISignal PlatformVolumeChanged
 

Constructor & Destructor Documentation

virtual CYIAudioVolumeBridge::~CYIAudioVolumeBridge ( )
inlinevirtual

Member Function Documentation

virtual bool CYIAudioVolumeBridge::AdjustVolume ( float  fPercentage)
pure virtual

Adjusts the volume by the specified fPercentage. The percentage value is in in the range from 0.0 to 1.0; the platform must normalize this to whatever range makes sense. This function will return false if the bridge call was not successful.

Note
This function does not work on iOS & tvOS, as it is not supported without the MPVolumeView UI element.
virtual bool CYIAudioVolumeBridge::GetVolume ( float &  fPercentage)
pure virtual

Gets the current volume as a normalized parameter in the range from 0.0 to 1.0, storing it in the parameter fPercentage. This function will return false if the bridge call was not successful.

virtual bool CYIAudioVolumeBridge::SetMuteEnabled ( bool  bEnabled)
pure virtual

Enables or disables muted volume on the platform. This function will return false if the bridge call was not successful.

Note
This function does not work on iOS & tvOS, as it is not supported without the MPVolumeView UI element.
On Android versions after API 23 mute can be overriden by the user using the volume keys. If mute is represented in the application's UI it is recommended to observe volume changes so that the UI can be updated when the user changes the volume.
See also
StartObservingVolumeChanges
virtual void CYIAudioVolumeBridge::StartObservingVolumeChanges ( )
pure virtual

Start system volume change observation. This is required to subscribe the notification of hardware volume button press.

Note
The user should be aware that observing volume changes may not be supported on some devices and across versions of Android. In this case PlatformVolumeChanged may not be emitted even after calling this method.
virtual void CYIAudioVolumeBridge::StopObservingVolumeChanges ( )
pure virtual

Stop system volume change observation that subscribes the notification of hardware volume button press.

Member Data Documentation

CYISignal CYIAudioVolumeBridge::PlatformVolumeChanged

The documentation for this class was generated from the following file: