CAknKeySoundSystem Class Reference

Link against: avkon.lib

Capability Information

Required Capabilities

None


#include <
aknsoundsystem.h>

Detailed Description

Interface for controlling keysounds from Avkon.

Provides support for handling key sounds.

Since:
S60 0.9

Public Member Functions

IMPORT_C ~CAknKeySoundSystem ()
 Destructor.
IMPORT_C void PushContextL (TInt aResourceId)
 Reads key sound context from resource file and pushes it to the sound stack.
IMPORT_C void PopContext ()
 Pops the top context from the key sound stack.
IMPORT_C void PlaySound (const TKeyEvent &aKeyEvent)
 Plays a sound corresponding to the given key event.
IMPORT_C void PlaySound (TInt aSid)
 Plays a sound corresponding to the given sound ID.
IMPORT_C void AddAppSoundInfoListL (TInt aResourceId)
 Installs an application specific set of sound IDs.
IMPORT_C void BringToForeground ()
 This function brings the sounds back to foreground.
IMPORT_C void StopSound (TInt aSid)
 Stops playing the sound with given ID.
IMPORT_C void LockContext ()
 Locks sound context, which prevents other instances from bringing their sound contexts topmost.
IMPORT_C void ReleaseContext ()
 Releases the context lock.
IMPORT_C TInt RequestSoundInfoL (TInt aAvkonSid, CAknSoundInfo &aInfo)
 Reads sound information from given Avkon sound ID.
IMPORT_C TInt TopContext ()
 Returns top context id from the session.
void DisableNextKeySound (TInt aScanCode)
 Disables next matching key sound until next pointer up event.

Static Public Member Functions

static IMPORT_C CAknKeySoundSystemNewL (TInt aUid)
 Base class default constructor.

Constructor & Destructor Documentation

IMPORT_C CAknKeySoundSystem::~CAknKeySoundSystem  ) 
 

Destructor.


Member Function Documentation

IMPORT_C void CAknKeySoundSystem::AddAppSoundInfoListL TInt  aResourceId  ) 
 

Installs an application specific set of sound IDs.

The specified resource ID must be of the type AVKON_SOUND_INFO_LIST. The sound IDs contained in the resource are made available for use in sound contexts within this application only. The method can only be used to install a single application sound information list. Calling the method a second time causes the previous sound information list to be replaced. Note also that application specific SIDs should be less than 1000.

Parameters:
aResourceId Avkon resource ID.
IMPORT_C void CAknKeySoundSystem::BringToForeground  ) 
 

This function brings the sounds back to foreground.

This function should be called from HandleForegroundEventL(). HandleForegroundEventL() is implemented in CAknAppUi and it is reimplemented in CAknViewAppUi. No need to call this function if using the KeySounds() method from CAknAppUi instead of CAknKeySoundSystem::NewL(). In such case CAknAppUi calls this method automatically.

void CAknKeySoundSystem::DisableNextKeySound TInt  aScanCode  ) 
 

Disables next matching key sound until next pointer up event.

Since:
S60 5.0
Parameters:
aScanCode ScanCode of key which sound is disabled.
IMPORT_C void CAknKeySoundSystem::LockContext  ) 
 

Locks sound context, which prevents other instances from bringing their sound contexts topmost.

Only the first call is effective, i.e. if some other instance has already locked its own context, the function does nothing. This is used in system components, e.g. in key lock where key tones must be disabled while lock is active.

static IMPORT_C CAknKeySoundSystem* CAknKeySoundSystem::NewL TInt  aUid  )  [static]
 

Base class default constructor.

If a client application is derived from CAknAppUi, its KeySounds() method should be used instead to obtain a key sound system instance. If this method is used, the client needs explicitly call BringToForeground().

Parameters:
aUid Application UID.
Returns:
A pointer to a new CAknKeySoundSystem object.
IMPORT_C void CAknKeySoundSystem::PlaySound TInt  aSid  ) 
 

Plays a sound corresponding to the given sound ID.

The ID can be an application specific ID or a system specific ID. System specific IDs are specified in Avkon enum TAvkonSystemSID.

Parameters:
aSid Sound ID to be played.
IMPORT_C void CAknKeySoundSystem::PlaySound const TKeyEvent &  aKeyEvent  ) 
 

Plays a sound corresponding to the given key event.

This is called directly by Avkon, though it can be used in other circumstances in order to play the correct sound associated with certain key presses.

Parameters:
aKeyEvent The scan code of the key that caused the event.
IMPORT_C void CAknKeySoundSystem::PopContext  ) 
 

Pops the top context from the key sound stack.

IMPORT_C void CAknKeySoundSystem::PushContextL TInt  aResourceId  ) 
 

Reads key sound context from resource file and pushes it to the sound stack.

All key presses for the application produce sounds as specified in this key sound context. The resource specified must be of the AVKON_SKEY_LIST type. There are also some default Avkon contexts available, e.g. R_AVKON_DEFAULT_SKEY_LIST and R_AVKON_SILENT_SKEY_LIST.

Parameters:
aResourceId Key sound context resource ID.
IMPORT_C void CAknKeySoundSystem::ReleaseContext  ) 
 

Releases the context lock.

After calling this method, all instances can freely modify their sound contexts again. The caller of the method can be some other instance than the instance that locked the context.

IMPORT_C TInt CAknKeySoundSystem::RequestSoundInfoL TInt  aAvkonSid,
CAknSoundInfo aInfo
 

Reads sound information from given Avkon sound ID.

This method is intended for applications that need Avkon sound definitions for playing sounds with their own audio instances of Multimedia Framework (such applications should not read Avkon resources as the resource format can change without any notice but instead use this method).

Since:
S60 2.0
Parameters:
aAvkonSid ID for Avkon sound whose information is requested.
aInfo Sound information will be put in this structure.
Returns:
KErrNone if succesful, KErrNotFound if requested sound ID is not found.
IMPORT_C void CAknKeySoundSystem::StopSound TInt  aSid  ) 
 

Stops playing the sound with given ID.

Does nothing if a sound matching the ID is not playing.

Parameters:
aSid Sound ID to stop.
IMPORT_C TInt CAknKeySoundSystem::TopContext  ) 
 

Returns top context id from the session.

Since:
S60 3.1
Returns:
The resource id of the context that is at the top of the sound stack.

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

Copyright © Nokia Corporation 2001-2007
Back to top