You can get the maximum volume level for system, notifications, alarm, media and so on. Also, you can change or get the current volume level.
For more information on the Sound features, see Sound Guide.
Since: 2.3
Interface | Method |
---|---|
SoundManagerObject | |
SoundManager |
SoundModeType getSoundMode () void setVolume (SoundType type, double volume) double getVolume (SoundType type) void setSoundModeChangeListener (SoundModeChangeCallback callback) void unsetSoundModeChangeListener () void setVolumeChangeListener (SoundVolumeChangeCallback callback) void unsetVolumeChangeListener () |
SoundModeChangeCallback | void onsuccess (SoundModeType mode) |
SoundVolumeChangeCallback | void onsuccess (SoundType type, double volume) |
enum SoundType { "SYSTEM", "NOTIFICATION", "ALARM", "MEDIA", "VOICE", "RINGTONE" };
Since: 2.3
Remark : VOICE type might not be supported on a device which does not support voice recognition.
[NoInterfaceObject] interface SoundManagerObject { readonly attribute SoundManager sound; };
Tizen implements SoundManagerObject;
Since: 2.3
There is a tizen.sound object that allows accessing the functionality of the Sound API.
[NoInterfaceObject] interface SoundManager { SoundModeType getSoundMode() raises(WebAPIException); void setVolume(SoundType type, double volume) raises(WebAPIException); double getVolume(SoundType type) raises(WebAPIException); void setSoundModeChangeListener(SoundModeChangeCallback callback) raises(WebAPIException); void unsetSoundModeChangeListener() raises(WebAPIException); void setVolumeChangeListener(SoundVolumeChangeCallback callback) raises(WebAPIException); void unsetVolumeChangeListener() raises(WebAPIException); };
Since: 2.3
getSoundMode
SoundModeType getSoundMode();
Since: 2.3
Return value:
SoundModeType The current sound modeExceptions:
with error type UnknownError in any error case.
setVolume
void setVolume(SoundType type, double volume);
Since: 2.3
Privilege level: public
Privilege: http://tizen.org/privilege/volume.set
Parameters:
Exceptions:
with error type NotSupportedError, if the given type is not supported. (e.g. when VOICE type is given on a Tizen wearable device).
with error type TypeMismatchError, if the input parameter is not compatible with the expected type.
with error type InvalidValuesError, if any of the input parameters contain an invalid value.
with error type UnknownError in any other error case.
getVolume
double getVolume(SoundType type);
Since: 2.3
Parameters:
Return value:
double The current volume levelExceptions:
with error type NotSupportedError, if the given type is not supported.
with error type TypeMismatchError, if the input parameter is not compatible with the expected type.
with error type UnknownError in any other error case.
setSoundModeChangeListener
void setSoundModeChangeListener(SoundModeChangeCallback callback);
Since: 2.3
Parameters:
Exceptions:
with error type TypeMismatchError, if the input parameter is not compatible with the expected type.
with error type UnknownError in any other error case.
unsetSoundModeChangeListener
void unsetSoundModeChangeListener();
Since: 2.3
Exceptions:
with error type UnknownError in any error case.
setVolumeChangeListener
void setVolumeChangeListener(SoundVolumeChangeCallback callback);
Since: 2.3
Parameters:
Exceptions:
with error type TypeMismatchError, if the input parameter is not compatible with the expected type.
with error type UnknownError in any other error case.
unsetVolumeChangeListener
void unsetVolumeChangeListener();
Since: 2.3
Exceptions:
with error type UnknownError in any other error case.
[Callback=FunctionOnly, NoInterfaceObject] interface SoundModeChangeCallback { void onsuccess(SoundModeType mode); };
Since: 2.3
onsuccess
void onsuccess(SoundModeType mode);
Since: 2.3
Parameters:
[Callback=FunctionOnly, NoInterfaceObject] interface SoundVolumeChangeCallback { void onsuccess(SoundType type, double volume); };
Since: 2.3
onsuccess
void onsuccess(SoundType type, double volume);
Since: 2.3
Parameters:
module Sound { enum SoundType { "SYSTEM", "NOTIFICATION", "ALARM", "MEDIA", "VOICE", "RINGTONE" }; enum SoundModeType { "SOUND", "VIBRATE", "MUTE" }; [NoInterfaceObject] interface SoundManagerObject { readonly attribute SoundManager sound; }; Tizen implements SoundManagerObject; [NoInterfaceObject] interface SoundManager { SoundModeType getSoundMode() raises(WebAPIException); void setVolume(SoundType type, double volume) raises(WebAPIException); double getVolume(SoundType type) raises(WebAPIException); void setSoundModeChangeListener(SoundModeChangeCallback callback) raises(WebAPIException); void unsetSoundModeChangeListener() raises(WebAPIException); void setVolumeChangeListener(SoundVolumeChangeCallback callback) raises(WebAPIException); void unsetVolumeChangeListener() raises(WebAPIException); }; [Callback=FunctionOnly, NoInterfaceObject] interface SoundModeChangeCallback { void onsuccess(SoundModeType mode); }; [Callback=FunctionOnly, NoInterfaceObject] interface SoundVolumeChangeCallback { void onsuccess(SoundType type, double volume); }; };