SystemSound

#include <bb/multimedia/SystemSound>

To link against this class, add the following line to your .pro file: LIBS += -lbbmultimedia

The SystemSound class provides access to play system-defined sounds.

This class is targeted at GUI applications that wish to play asynchronous sounds as the platform does, for example a camera 'shutter' sound when a picture is taken with the device camera.

A static play() method is provided to asynchronously play a system-defined sound file.

SystemSound::play(SystemSound::CameraShutterEvent);

Use this method when a single 'one-off' sound is needed, such as an alert when presenting an informational dialog. In this case the sound is automatically prepared and played.

Secondly, a SystemSound instance can be created to play a sound several times repeatedly.

SystemSound keypress(SystemSound::InputKeypress);
keypress.play();
keypress.play(); // again

Thirdly, a SystemSound instance can be used from QML.

import bb.multimedia 1.0
...
attachedObjects: [
    SystemSound {
        id: sound
        sound: SystemSound.CameraShutterEvent
    }
]
...
onClicked: {
    sound.play();
}

Since:

BlackBerry 10.0.0

Public Functions Index

SystemSound (SystemSound::Type sound, QObject *parent=0)
SystemSound (QObject *parent=0)
virtual ~SystemSound ()
boolsetSound (SystemSound::Type sound)
SystemSound::Typesound () const

Static Public Functions Index

voidplay (const SystemSound::Type sound)

Public Slots Index

voidplay ()

Public Types

Type

Represents various platform system sounds.

Since:

BlackBerry 10.0.0

None = 0

Default sound state when no sound has been set.

BatteryAlarm = 1

Battery alarm sound.

BrowserStartEvent = 2

Browser startup sound.

CameraShutterEvent = 3

Camera shutter sound when taking a still photograph.

DeviceLockEvent = 4

Device has been locked sound.

DeviceUnlockEvent = 5

Device has been unlocked sound.

DeviceTetherEvent = 6

Device has been tethered with another device sound.

DeviceUntetherEvent = 7

Device has been untethered with another device sound.

GeneralNotification = 8

General notification dialog sound.

InputKeypress = 9

A Virtual Keyboard key press sound.

RecordingStartEvent = 10

Start of a recording sound.

RecordingStopEvent = 11

End of a recording sound.

SapphireNotification = 12

BlackBerry Bridge notification sound.

SystemMasterVolumeReference = 13

The sound played when master volume is changed.

VideoCallEvent = 14

Incoming video call notification sound.

VideoCallOutgoingEvent = 15

Outgoing video call notification sound.

CameraBurstEvent = 16

Camera burst sound when taking multiple still photographs.

Properties

bb::multimedia::SystemSound::Type sound

Sounds represents any of the enumerated Sound types.

Allows the user to change the system sound played when play() is called.

Since:

BlackBerry 10.0.0

Public Functions

SystemSound (

Constructs a new SystemSound object to play a system-defined sound.

The sound parameter is one of the SystemSound::Type enum values. An example of a system-defined sound is the sound heard when a system notification dialog appears.

Parameters
sound

A SystemSound::Type enum value denoting the sound to play.

parent

An optional parameter to specify the parent of this QObject.

Since:

BlackBerry 10.0.0

SystemSound (

Constructs a new SystemSound object.

Defaults to the SoundNone sound. Unless a different sound property is specified, calls to play() do nothing.

Parameters
parent

An optional parameter to specify the parent of this QObject.

Since:

BlackBerry 10.0.0

virtual~SystemSound ()

Destructor.

Since:

BlackBerry 10.0.0

bool setSound (

Associates a new sound.

Parameters
sound

A SystemSound::Type enum value denoting the sound to play.

Return:

true if the new sound was set and loaded, false otherwise

Since:

BlackBerry 10.0.0

SystemSound::Type sound ()

Return:

the sound associated with this object.

Since:

BlackBerry 10.0.0

Static Public Functions

void play (

Plays the default system-defined sound specified by the given SystemSound::Type value.

Parameters
sound

A SystemSound::Type enum value denoting the sound to play.

Since:

BlackBerry 10.0.0

Public Slots

void play ()

Plays the default system-defined sound specified by the given SystemSound::Type value.

Since:

BlackBerry 10.0.0