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