williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@2
|
5 |
* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@2
|
7 |
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description: Interface for controlling keysounds from Avkon.
|
williamr@2
|
15 |
*
|
williamr@2
|
16 |
*/
|
williamr@2
|
17 |
|
williamr@2
|
18 |
#ifndef __AKNSOUNDSYSTEM_H__
|
williamr@2
|
19 |
#define __AKNSOUNDSYSTEM_H__
|
williamr@2
|
20 |
|
williamr@2
|
21 |
// INCLUDES
|
williamr@2
|
22 |
#include <e32base.h>
|
williamr@2
|
23 |
#include <w32std.h>
|
williamr@2
|
24 |
#include <aknsoundinfo.h>
|
williamr@2
|
25 |
|
williamr@2
|
26 |
// FORWARD DECLARATIONS
|
williamr@2
|
27 |
class CAknSoundPlayer;
|
williamr@2
|
28 |
class CAknKeySoundStack;
|
williamr@2
|
29 |
|
williamr@2
|
30 |
// CLASS DECLARATION
|
williamr@2
|
31 |
/**
|
williamr@2
|
32 |
* Interface for controlling keysounds from Avkon.
|
williamr@2
|
33 |
* Provides support for handling key sounds.
|
williamr@2
|
34 |
* @since S60 0.9
|
williamr@2
|
35 |
*/
|
williamr@2
|
36 |
NONSHARABLE_CLASS(CAknKeySoundSystem) : public CBase
|
williamr@2
|
37 |
{
|
williamr@2
|
38 |
public:
|
williamr@2
|
39 |
/**
|
williamr@2
|
40 |
* Base class default constructor. If a client application is derived from @c CAknAppUi,
|
williamr@2
|
41 |
* its @c KeySounds() method should be used instead to obtain a key sound system instance.
|
williamr@2
|
42 |
* If this method is used, the client needs explicitly call @c BringToForeground().
|
williamr@2
|
43 |
*
|
williamr@2
|
44 |
* @param aUid Application UID.
|
williamr@2
|
45 |
* @return A pointer to a new @c CAknKeySoundSystem object.
|
williamr@2
|
46 |
*/
|
williamr@2
|
47 |
IMPORT_C static CAknKeySoundSystem* NewL(TInt aUid);
|
williamr@2
|
48 |
|
williamr@2
|
49 |
/**
|
williamr@2
|
50 |
* Destructor.
|
williamr@2
|
51 |
*/
|
williamr@2
|
52 |
IMPORT_C ~CAknKeySoundSystem();
|
williamr@2
|
53 |
|
williamr@2
|
54 |
/**
|
williamr@2
|
55 |
* Reads key sound context from resource file and pushes it to the sound stack.
|
williamr@2
|
56 |
* All key presses for the application produce sounds as specified in this key sound context.
|
williamr@2
|
57 |
* The resource specified must be of the @c AVKON_SKEY_LIST type. There are also some default
|
williamr@2
|
58 |
* Avkon contexts available, e.g. @c R_AVKON_DEFAULT_SKEY_LIST and @c R_AVKON_SILENT_SKEY_LIST.
|
williamr@2
|
59 |
*
|
williamr@2
|
60 |
* @param aResourceId Key sound context resource ID.
|
williamr@2
|
61 |
*/
|
williamr@2
|
62 |
IMPORT_C void PushContextL(TInt aResourceId);
|
williamr@2
|
63 |
|
williamr@2
|
64 |
/**
|
williamr@2
|
65 |
* Pops the top context from the key sound stack.
|
williamr@2
|
66 |
*/
|
williamr@2
|
67 |
IMPORT_C void PopContext();
|
williamr@2
|
68 |
|
williamr@2
|
69 |
/**
|
williamr@2
|
70 |
* Plays a sound corresponding to the given key event. This is called directly by Avkon,
|
williamr@2
|
71 |
* though it can be used in other circumstances in order to play the correct sound
|
williamr@2
|
72 |
* associated with certain key presses.
|
williamr@2
|
73 |
*
|
williamr@2
|
74 |
* @param aKeyEvent The scan code of the key that caused the event.
|
williamr@2
|
75 |
*/
|
williamr@2
|
76 |
IMPORT_C void PlaySound(const TKeyEvent& aKeyEvent);
|
williamr@2
|
77 |
|
williamr@2
|
78 |
/**
|
williamr@2
|
79 |
* Plays a sound corresponding to the given sound ID. The ID can be an application specific ID
|
williamr@2
|
80 |
* or a system specific ID. System specific IDs are specified in Avkon enum @c TAvkonSystemSID.
|
williamr@2
|
81 |
*
|
williamr@2
|
82 |
* @param aSid Sound ID to be played.
|
williamr@2
|
83 |
*/
|
williamr@2
|
84 |
IMPORT_C void PlaySound(TInt aSid);
|
williamr@2
|
85 |
|
williamr@2
|
86 |
/**
|
williamr@2
|
87 |
* Installs an application specific set of sound IDs. The specified resource ID must be
|
williamr@2
|
88 |
* of the type @c AVKON_SOUND_INFO_LIST. The sound IDs contained in the resource are made
|
williamr@2
|
89 |
* available for use in sound contexts within this application only. The method can only be
|
williamr@2
|
90 |
* used to install a single application sound information list. Calling the method a
|
williamr@2
|
91 |
* second time causes the previous sound information list to be replaced. Note also that
|
williamr@2
|
92 |
* application specific SIDs should be less than 1000.
|
williamr@2
|
93 |
*
|
williamr@2
|
94 |
* @param aResourceId Avkon resource ID.
|
williamr@2
|
95 |
*/
|
williamr@2
|
96 |
IMPORT_C void AddAppSoundInfoListL(TInt aResourceId);
|
williamr@2
|
97 |
|
williamr@2
|
98 |
/**
|
williamr@2
|
99 |
* This function brings the sounds back to foreground. This function should
|
williamr@2
|
100 |
* be called from @c HandleForegroundEventL(). @c HandleForegroundEventL() is
|
williamr@2
|
101 |
* implemented in @c CAknAppUi and it is reimplemented in @c CAknViewAppUi.
|
williamr@2
|
102 |
* No need to call this function if using the @c KeySounds() method from @c CAknAppUi instead
|
williamr@2
|
103 |
* of @c CAknKeySoundSystem::NewL(). In such case @c CAknAppUi calls this method automatically.
|
williamr@2
|
104 |
*/
|
williamr@2
|
105 |
IMPORT_C void BringToForeground();
|
williamr@2
|
106 |
|
williamr@2
|
107 |
/**
|
williamr@2
|
108 |
* Stops playing the sound with given ID. Does nothing if a sound matching the ID is
|
williamr@2
|
109 |
* not playing.
|
williamr@2
|
110 |
*
|
williamr@2
|
111 |
* @param aSid Sound ID to stop.
|
williamr@2
|
112 |
*/
|
williamr@2
|
113 |
IMPORT_C void StopSound(TInt aSid);
|
williamr@2
|
114 |
|
williamr@2
|
115 |
/**
|
williamr@2
|
116 |
* Locks sound context, which prevents other instances from bringing their sound contexts
|
williamr@2
|
117 |
* topmost. Only the first call is effective, i.e. if some other instance has already
|
williamr@2
|
118 |
* locked its own context, the function does nothing. This is used in system components,
|
williamr@2
|
119 |
* e.g. in key lock where key tones must be disabled while lock is active.
|
williamr@2
|
120 |
*/
|
williamr@2
|
121 |
IMPORT_C void LockContext();
|
williamr@2
|
122 |
|
williamr@2
|
123 |
/**
|
williamr@2
|
124 |
* Releases the context lock. After calling this method, all instances can freely modify
|
williamr@2
|
125 |
* their sound contexts again. The caller of the method can be some other instance than
|
williamr@2
|
126 |
* the instance that locked the context.
|
williamr@2
|
127 |
*/
|
williamr@2
|
128 |
IMPORT_C void ReleaseContext();
|
williamr@2
|
129 |
|
williamr@2
|
130 |
/**
|
williamr@2
|
131 |
* Reads sound information from given Avkon sound ID. This method is intended for applications
|
williamr@2
|
132 |
* that need Avkon sound definitions for playing sounds with their own audio instances of
|
williamr@2
|
133 |
* Multimedia Framework (such applications should not read Avkon resources as the resource
|
williamr@2
|
134 |
* format can change without any notice but instead use this method).
|
williamr@2
|
135 |
*
|
williamr@2
|
136 |
* @since S60 2.0
|
williamr@2
|
137 |
* @param aAvkonSid ID for Avkon sound whose information is requested.
|
williamr@2
|
138 |
* @param aInfo Sound information will be put in this structure.
|
williamr@2
|
139 |
* @return @c KErrNone if succesful, @c KErrNotFound if requested sound ID is not found.
|
williamr@2
|
140 |
*/
|
williamr@2
|
141 |
IMPORT_C TInt RequestSoundInfoL(TInt aAvkonSid, CAknSoundInfo& aInfo);
|
williamr@2
|
142 |
|
williamr@2
|
143 |
/**
|
williamr@2
|
144 |
* Returns top context id from the session.
|
williamr@2
|
145 |
*
|
williamr@2
|
146 |
* @since S60 3.1
|
williamr@2
|
147 |
* @return The resource id of the context that is at the top of the sound stack.
|
williamr@2
|
148 |
*/
|
williamr@2
|
149 |
IMPORT_C TInt TopContext();
|
williamr@2
|
150 |
|
williamr@2
|
151 |
/**
|
williamr@2
|
152 |
* Disables next matching key sound until next pointer up event.
|
williamr@2
|
153 |
*
|
williamr@2
|
154 |
* @since S60 5.0
|
williamr@2
|
155 |
* @param aScanCode ScanCode of key which sound is disabled.
|
williamr@2
|
156 |
*/
|
williamr@2
|
157 |
void DisableNextKeySound(TInt aScanCode);
|
williamr@2
|
158 |
|
williamr@2
|
159 |
private:
|
williamr@2
|
160 |
CAknKeySoundSystem();
|
williamr@2
|
161 |
void ConstructL(TInt aUid);
|
williamr@2
|
162 |
|
williamr@2
|
163 |
private:
|
williamr@2
|
164 |
CAknSoundPlayer* iSoundPlayer;
|
williamr@2
|
165 |
TInt iSpare;
|
williamr@2
|
166 |
};
|
williamr@2
|
167 |
|
williamr@2
|
168 |
#endif // __AKNSOUNDSYSTEM_H__
|
williamr@2
|
169 |
|
williamr@2
|
170 |
// End of file
|