|
1 /* |
|
2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 /** |
|
22 @file |
|
23 @publishedPartner |
|
24 @released |
|
25 */ |
|
26 |
|
27 |
|
28 #ifndef MAUDIOCONTEXT_H |
|
29 #define MAUDIOCONTEXT_H |
|
30 |
|
31 #include <e32base.h> |
|
32 |
|
33 #include <a3f/a3fbase.h> |
|
34 |
|
35 class MAudioStream; |
|
36 class MAudioProcessingUnit; |
|
37 class MAudioContextObserver; |
|
38 |
|
39 /** |
|
40 * An interface to an audio context. |
|
41 * |
|
42 * Audio context is a container for a set of logically related audio streams and audio processing units. |
|
43 * All streams and processing units are created into a context. |
|
44 * A new context can be created using an instance of CAudioContextFactory. |
|
45 * When the context is no longer needed, it must be removed using CAudioContextFactory::DeleteAudioContext(). |
|
46 */ |
|
47 class MAudioContext |
|
48 { |
|
49 public: |
|
50 |
|
51 /** |
|
52 * Returns the context identifier. |
|
53 * |
|
54 * @return return the context identifier |
|
55 */ |
|
56 virtual TAudioContextId ContextId() const = 0; |
|
57 |
|
58 /** |
|
59 * Creates a new audio stream into this context. |
|
60 * |
|
61 * The stream must be removed using DeleteAudioStream() when it is no longer needed. |
|
62 * |
|
63 * @param aStream on return contains a pointer to the created stream. |
|
64 * @return an error code. KErrNone if successful, otherwise one of the system wide error codes. |
|
65 */ |
|
66 virtual TInt CreateAudioStream(MAudioStream*& aStream)=0; |
|
67 |
|
68 /** |
|
69 * Deletes an audio stream from this context. |
|
70 * |
|
71 * After removing the stream all references to it will become invalid and must not be used. |
|
72 * At the end of the call, aStream will have been set to NULL. |
|
73 * Calling DeleteAudioStream() with a parameter whose value is NULL is itself a null operation. |
|
74 * @param aStream a pointer to the stream to Delete. |
|
75 * @return an error code. KErrNone if successful, otherwise one of the system wide error codes. |
|
76 */ |
|
77 virtual void DeleteAudioStream(MAudioStream*& aStream)=0; |
|
78 |
|
79 /** |
|
80 * Creates a new audio processing unit into this context. |
|
81 * |
|
82 * The processing unit must be removed using DeleteProcessingUnit() when it is no longer needed. |
|
83 * |
|
84 * @param aType the type of the processing unit. |
|
85 * @param aProcessingUnit on return contains a pointer to the created processing unit. |
|
86 * @return an error code. KErrNone if successful, otherwise one of the system wide error codes. |
|
87 */ |
|
88 virtual TInt CreateAudioProcessingUnit(TUid aTypeId, MAudioProcessingUnit*& aProcessingUnit)=0; |
|
89 |
|
90 /** |
|
91 * Deletes the audio processing unit from this context. |
|
92 * |
|
93 * After removing the processing unit all references to it will become invalid and must not be used. |
|
94 * At the end of the call, aProcessingUnit will have been set to NULL. |
|
95 * Calling DeleteAudioProcessingUnit() with a parameter whose value is NULL is itself a null operation. |
|
96 * @param aProcessingUnit a pointer to the processing unit to remove. |
|
97 * @return an error code. KErrNone if successful, otherwise one of the system wide error codes. |
|
98 */ |
|
99 virtual void DeleteAudioProcessingUnit(MAudioProcessingUnit*& aProcessingUnit)=0; |
|
100 |
|
101 /** |
|
102 * Apply changes made to audio components associated with this context. |
|
103 * |
|
104 * A state change applied to an Audio Stream should be considered "pending" until Commit() is called, |
|
105 * in that the adaptation merely records that the state setting has been requested and does not seek |
|
106 * to implement the state change until Commit(). |
|
107 * |
|
108 * Commit() can be thought of as an asynchronous call, and completion is signalled by the appropriate |
|
109 * ContextEvent() callback of MAudioContextObserver. |
|
110 * @return An error code. KErrNone on success. KErrNotReady if SetClientSettings() has not been called. |
|
111 */ |
|
112 virtual TInt Commit()=0; |
|
113 |
|
114 /** |
|
115 * Forget any pending, requested changes made to this context or its components. |
|
116 * |
|
117 * Typically called where the client has started to request changes, has yet to call Commit() and changes its mind. |
|
118 * |
|
119 * @return A system wide error code. KErrNone on success. KErrNotReady if called during Commit() cycle. |
|
120 */ |
|
121 virtual TInt Reset()=0; |
|
122 |
|
123 /** |
|
124 * Sets the client information used by the underlying MMRC. |
|
125 * |
|
126 * This must be called before any call to Commit(). The client context contains information about the client application |
|
127 * which is utilising the audio functionality, since this will typically be a different process than is calling A3F. |
|
128 * |
|
129 * @param aSettings Essentially the process Id of the client application, |
|
130 * the one whose details are used to determine capabilities and policy. |
|
131 * @return an error code. KErrNone for success, otherwise one of the system-wide error codes. |
|
132 */ |
|
133 virtual TInt SetClientSettings(const TClientContextSettings& aSettings)=0; |
|
134 |
|
135 /** |
|
136 * A mechanism to obtain extensions to the Context API. |
|
137 * |
|
138 * @param aType Uid that denotes the type of the interface. |
|
139 * @return the pointer to the specified interface, or NULL if it does not exist. |
|
140 * Must be cast to correct type by the user. |
|
141 */ |
|
142 virtual TAny* Interface(TUid aType)=0; |
|
143 |
|
144 /** |
|
145 * Registers an audio context observer. |
|
146 * |
|
147 * The observer will be notified about context state changes. |
|
148 * |
|
149 * @param aObserver the observer reference to register. |
|
150 * @return An error code. KErrNone on success, otherwise one of the system wide error codes. |
|
151 */ |
|
152 virtual TInt RegisterAudioContextObserver(MAudioContextObserver& aObserver) = 0; |
|
153 |
|
154 /** |
|
155 * Unregisters an audio context observer. |
|
156 * |
|
157 * @param aObserver the observer reference to unregister. |
|
158 * @return An error code. KErrNone on success, otherwise one of the system wide error codes. |
|
159 */ |
|
160 virtual void UnregisterAudioContextObserver(MAudioContextObserver& aObserver) = 0; |
|
161 }; |
|
162 |
|
163 #endif // MAUDIOCONTEXT_H |