SystemSound

Since: BlackBerry 10.0.0

#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() function is provided to asynchronously play a system-defined sound file.

bb::multimedia::SystemSound::play(bb::multimedia::SystemSound::CameraShutterEvent);

Use this function 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(bb::multimedia::SystemSound::InputKeypress);
keypress.play();
keypress.play(); // again

Thirdly, a SystemSound instance can be used from QML.

import bb.multimedia 1.0
// ...

Page {
    Container {
        // ...

        attachedObjects: [
            SystemSound {
                id: systemSound
                sound: SystemSound.CameraShutterEvent;
            }
        ]

        Button {
            text: "Play Camera Shutter Sound"
            onClicked: {
                systemSound.play();
            }
        }
    }
}


Overview

Public Functions Index

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

Static Public Functions Index

voidplay (const bb::multimedia::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.

Since:

BlackBerry 10.0.0

BrowserStartEvent = 2

Browser startup sound.

Since:

BlackBerry 10.0.0

CameraShutterEvent = 3

Camera shutter sound when taking a still photograph.

Since:

BlackBerry 10.0.0

DeviceLockEvent = 4

Device has been locked sound.

Since:

BlackBerry 10.0.0

DeviceUnlockEvent = 5

Device has been unlocked sound.

Since:

BlackBerry 10.0.0

DeviceTetherEvent = 6

Device has been tethered with another device sound.

Since:

BlackBerry 10.0.0

DeviceUntetherEvent = 7

Device has been untethered with another device sound.

Since:

BlackBerry 10.0.0

GeneralNotification = 8

General notification dialog sound.

Since:

BlackBerry 10.0.0

InputKeypress = 9

A Virtual Keyboard key press sound.

Since:

BlackBerry 10.0.0

RecordingStartEvent = 10

Start of a recording sound.

Since:

BlackBerry 10.0.0

RecordingStopEvent = 11

End of a recording sound.

Since:

BlackBerry 10.0.0

SapphireNotification = 12

BlackBerry Bridge notification sound.

Since:

BlackBerry 10.0.0

SystemMasterVolumeReference = 13

The sound played when master volume is changed.

Since:

BlackBerry 10.0.0

VideoCallEvent = 14

Incoming video call notification sound.

Since:

BlackBerry 10.0.0

VideoCallOutgoingEvent = 15

Outgoing video call notification sound.

Since:

BlackBerry 10.0.0

CameraBurstEvent = 16

Camera burst sound when taking multiple still photographs.

Since:

BlackBerry 10.0.0

Properties

bb::multimedia::SystemSound::Type sound

Represents any of the enumerated sound types.

This property 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.

The sound to be played defaults to the None 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

bb::multimedia::SystemSound::Type sound ()

Retrieves the sound that's associated with this object.

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

Last modified: 2014-06-24



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus