|
1 |
|
2 // SoundDevice.inl |
|
3 |
|
4 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
5 // All rights reserved. |
|
6 // This component and the accompanying materials are made available |
|
7 // under the terms of "Eclipse Public License v1.0" |
|
8 // which accompanies this distribution, and is available |
|
9 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
10 // |
|
11 // Initial Contributors: |
|
12 // Nokia Corporation - initial contribution. |
|
13 // |
|
14 // Contributors: |
|
15 // |
|
16 // Description: |
|
17 // |
|
18 |
|
19 #ifndef SOUNDDEVICE_INL |
|
20 #define SOUNDDEVICE_INL |
|
21 |
|
22 #include <mmf/server/mmfdevsoundcustominterfacesupport.h> |
|
23 |
|
24 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
25 #include <mmf/server/mmfdevsoundcustominterfaceobserver.h> |
|
26 #include <mmf/server/mmfdevsoundcustominterfacesupportclasses.h> |
|
27 #endif |
|
28 |
|
29 #include <mmf/common/mmfstandardcustomcommands.h> |
|
30 |
|
31 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
32 #include <mmf/common/mmfstandardcustomcommandsenums.h> |
|
33 #include <mmf/common/mmfstandardcustomcommandsimpl.h> |
|
34 #endif |
|
35 |
|
36 |
|
37 inline TInt CMMFDevSound::RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData) |
|
38 { |
|
39 MAutoPauseResumeSupport* support = |
|
40 static_cast<MAutoPauseResumeSupport*>(CustomInterface(KMmfUidDevSoundAudioResourceCustomInterface)); |
|
41 if (support==NULL) |
|
42 { |
|
43 return KErrNotSupported; |
|
44 } |
|
45 if(aEventType != KMMFEventCategoryAudioResourceAvailable) |
|
46 { |
|
47 return KErrNotSupported; |
|
48 } |
|
49 else |
|
50 { |
|
51 return support->RegisterAsClient(aEventType, aNotificationRegistrationData); |
|
52 } |
|
53 } |
|
54 |
|
55 inline TInt CMMFDevSound::CancelRegisterAsClient(TUid aEventType) |
|
56 { |
|
57 MAutoPauseResumeSupport* support = |
|
58 static_cast<MAutoPauseResumeSupport*>(CustomInterface(KMmfUidDevSoundAudioResourceCustomInterface)); |
|
59 if (support==NULL) |
|
60 { |
|
61 return KErrNotSupported; |
|
62 } |
|
63 if(aEventType != KMMFEventCategoryAudioResourceAvailable) |
|
64 { |
|
65 return KErrNotSupported; |
|
66 } |
|
67 else |
|
68 { |
|
69 return support->CancelRegisterAsClient(aEventType); |
|
70 } |
|
71 } |
|
72 |
|
73 inline TInt CMMFDevSound::GetResourceNotificationData(TUid aEventType,TDes8& aNotificationData) |
|
74 { |
|
75 MAutoPauseResumeSupport* support = |
|
76 static_cast<MAutoPauseResumeSupport*>(CustomInterface(KMmfUidDevSoundAudioResourceCustomInterface)); |
|
77 if (support==NULL) |
|
78 { |
|
79 return KErrNotSupported; |
|
80 } |
|
81 if(aEventType != KMMFEventCategoryAudioResourceAvailable) |
|
82 { |
|
83 return KErrNotSupported; |
|
84 } |
|
85 else |
|
86 { |
|
87 return support->GetResourceNotificationData(aEventType, aNotificationData); |
|
88 } |
|
89 } |
|
90 |
|
91 inline TInt CMMFDevSound::WillResumePlay() |
|
92 { |
|
93 MAutoPauseResumeSupport* support = |
|
94 static_cast<MAutoPauseResumeSupport*>(CustomInterface(KMmfUidDevSoundAudioResourceCustomInterface)); |
|
95 if (support==NULL) |
|
96 { |
|
97 return KErrNotSupported; |
|
98 } |
|
99 return support->WillResumePlay(); |
|
100 } |
|
101 |
|
102 inline TInt CMMFDevSound::EmptyBuffers() |
|
103 { |
|
104 MMMFDevSoundEmptyBuffers* emptybuffers = |
|
105 static_cast<MMMFDevSoundEmptyBuffers*>(CustomInterface(KMmfUidDevSoundEmptyBuffersCustomInterface)); |
|
106 if (emptybuffers == NULL) |
|
107 { |
|
108 return KErrNotSupported; |
|
109 } |
|
110 return emptybuffers->EmptyBuffers(); |
|
111 } |
|
112 |
|
113 inline TInt CMMFDevSound::CancelInitialize() |
|
114 { |
|
115 MMMFDevSoundCancelInitialize* cancelInitialize = |
|
116 static_cast<MMMFDevSoundCancelInitialize*>(CustomInterface(KMmfUidDevSoundCancelInitializeCustomInterface)); |
|
117 if (cancelInitialize == NULL) |
|
118 { |
|
119 return KErrNotSupported; |
|
120 } |
|
121 return cancelInitialize->CancelInitialize(); |
|
122 } |
|
123 |
|
124 /* |
|
125 * -doxygen comments in header- |
|
126 */ |
|
127 inline TInt CMMFDevSound::SetClientThreadInfo(TThreadId aTid) |
|
128 { |
|
129 MAudioClientThreadInfo* threadInfo = |
|
130 static_cast<MAudioClientThreadInfo*>(CustomInterface(KMmfUidDevSoundAudioClientThreadInfoCustomInterface)); |
|
131 if (threadInfo) |
|
132 { |
|
133 return threadInfo->SetClientThreadInfo(aTid); |
|
134 } |
|
135 else |
|
136 { |
|
137 return KErrNotSupported; |
|
138 } |
|
139 } |
|
140 |
|
141 inline TInt CMMFDevSound::GetTimePlayed(TTimeIntervalMicroSeconds& aTime) |
|
142 { |
|
143 MMMFDevSoundTimePlayed* timePlayed = |
|
144 static_cast<MMMFDevSoundTimePlayed*>(CustomInterface(KMmfUidDevSoundTimePlayedCustomInterface)); |
|
145 if (timePlayed == NULL) |
|
146 { |
|
147 return KErrNotSupported; |
|
148 } |
|
149 return timePlayed->GetTimePlayed(aTime); |
|
150 } |
|
151 |
|
152 inline TBool CMMFDevSound::IsGetTimePlayedSupported() |
|
153 { |
|
154 MMMFDevSoundTimePlayed* timePlayed = |
|
155 static_cast<MMMFDevSoundTimePlayed*>(CustomInterface(KMmfUidDevSoundTimePlayedCustomInterface)); |
|
156 if (timePlayed == NULL) |
|
157 { |
|
158 return EFalse; |
|
159 } |
|
160 return ETrue; |
|
161 } |
|
162 |
|
163 inline TBool CMMFDevSound::QueryIgnoresUnderflow() |
|
164 { |
|
165 MMMFDevSoundQueryIgnoresUnderflow* ignoresUnderflow = |
|
166 static_cast<MMMFDevSoundQueryIgnoresUnderflow*>(CustomInterface(KMmfUidDevSoundQueryIgnoresUnderflowCustomInterface)); |
|
167 if (ignoresUnderflow == NULL) |
|
168 { |
|
169 return EFalse; |
|
170 } |
|
171 return ignoresUnderflow->QueryIgnoresUnderflow(); |
|
172 } |
|
173 |
|
174 inline TBool CMMFDevSound::IsResumeSupported() |
|
175 { |
|
176 MMMFDevSoundTruePause* truePause = |
|
177 static_cast<MMMFDevSoundTruePause*>(CustomInterface(KMmfUidDevSoundTruePauseCustomInterface)); |
|
178 if (truePause == NULL) |
|
179 { |
|
180 return EFalse; |
|
181 } |
|
182 return truePause->IsResumeSupported(); |
|
183 } |
|
184 |
|
185 inline TInt CMMFDevSound::Resume() |
|
186 { |
|
187 MMMFDevSoundTruePause* truePause = |
|
188 static_cast<MMMFDevSoundTruePause*>(CustomInterface(KMmfUidDevSoundTruePauseCustomInterface)); |
|
189 if (truePause == NULL || EFalse == truePause->IsResumeSupported() ) |
|
190 { |
|
191 return KErrNotSupported; |
|
192 } |
|
193 return truePause->Resume(); |
|
194 } |
|
195 |
|
196 #endif // SOUNDDEVICE_INL |