|
1 /* |
|
2 * Copyright (c) 2005 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: Manipulates the virtual location of the SoundSource3D. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <jdebug.h> |
|
21 #include "cammsaudiolocationcontrol.h" |
|
22 |
|
23 // ============================ MEMBER FUNCTIONS =============================== |
|
24 |
|
25 // ----------------------------------------------------------------------------- |
|
26 // CAMMSAudioLocationControl::NewLC |
|
27 // Two-phased constructor. |
|
28 // ----------------------------------------------------------------------------- |
|
29 CAMMSAudioLocationControl* CAMMSAudioLocationControl::NewLC( |
|
30 CMMAPlayer* aPlayer) |
|
31 { |
|
32 CAMMSAudioLocationControl* self = |
|
33 new(ELeave) CAMMSAudioLocationControl(aPlayer); |
|
34 |
|
35 CleanupStack::PushL(self); |
|
36 |
|
37 return self; |
|
38 } |
|
39 |
|
40 // Destructor |
|
41 CAMMSAudioLocationControl::~CAMMSAudioLocationControl() |
|
42 { |
|
43 DEBUG("AMMS::CAMMSAudioLocationControl::~CAMMSAudioLocationControl"); |
|
44 |
|
45 // Perform DeallocateControl, if the state change has not yet performed it. |
|
46 DeallocateControl(); |
|
47 delete(CAudioEffect*)iLocationEffect; |
|
48 } |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // CAMMSAudioLocationControl::PrepareControlL |
|
52 // Function which is called after the correct state is set in Player. |
|
53 // ----------------------------------------------------------------------------- |
|
54 // |
|
55 void CAMMSAudioLocationControl::PrepareControlL() |
|
56 { |
|
57 // Perform the action only for the first time, skip if called afterwards |
|
58 if (!iLocationEffect) |
|
59 { |
|
60 DEBUG("AMMS::CAMMSAudioLocationControl::PrepareControlL"); |
|
61 |
|
62 CCustomCommandUtility* customCommandUtility = |
|
63 CreateCustomCommandUtilityL(); |
|
64 |
|
65 // Set the base class location effect as CSourceLocation |
|
66 // Effect API takes the ownership of customCommandUtility. |
|
67 iLocationEffect = CSourceLocation::NewL(customCommandUtility); |
|
68 |
|
69 // Enable the Effect API Control |
|
70 iLocationEffect->EnableL(); |
|
71 } |
|
72 } |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // CAMMSAudioLocationControl::DeallocateControl |
|
76 // Function which is called after the correct state is set in Player. |
|
77 // ----------------------------------------------------------------------------- |
|
78 // |
|
79 void CAMMSAudioLocationControl::DeallocateControl() |
|
80 { |
|
81 if (iLocationEffect) |
|
82 { |
|
83 DEBUG("AMMS::CAMMSAudioLocationControl::DeallocateControl"); |
|
84 |
|
85 // Disable the Effect API Control |
|
86 TRAPD(err, iLocationEffect->DisableL()); |
|
87 if (err != KErrNone) |
|
88 { |
|
89 // The only even theoritically possible error code here would be |
|
90 // KErrAccessDenied which is a result from Effect API calling ApplyL |
|
91 // method without having update rights, but since the Effect |
|
92 // is already created, that situation can be discarded here. |
|
93 } |
|
94 |
|
95 // Delete the Effect API class. |
|
96 // The class that is derived from CLocation is casted here to the |
|
97 // base class CAudioEffect, since CLocation has the destructor |
|
98 // defined as protected, but the derived class and the base class |
|
99 // have it defined as public. |
|
100 delete(CAudioEffect*)iLocationEffect; |
|
101 iLocationEffect = NULL; |
|
102 } |
|
103 } |
|
104 |
|
105 const TDesC& CAMMSAudioLocationControl::ClassName() const |
|
106 { |
|
107 return KAMMSAudioLocationControl; |
|
108 } |
|
109 |
|
110 // ----------------------------------------------------------------------------- |
|
111 // CAMMSAudioLocationControl::CAMMSAudioLocationControl |
|
112 // C++ default constructor can NOT contain any code, that |
|
113 // might leave. |
|
114 // ----------------------------------------------------------------------------- |
|
115 CAMMSAudioLocationControl::CAMMSAudioLocationControl(CMMAPlayer* aPlayer) |
|
116 : CAMMSLocationControl(aPlayer) |
|
117 { |
|
118 } |
|
119 |
|
120 // End of File |